import { colors } from "./chunk-4L7RY2JA.js"; import { publicDirURL } from "./chunk-OSUFJZHZ.js"; import { BaseComponent } from "./chunk-4YEN7HVQ.js"; // src/templates/error_cause/main.ts import { dump, themes } from "@poppinss/dumper/html"; import { dump as dumpCli } from "@poppinss/dumper/console"; var ErrorCause = class extends BaseComponent { cssFile = new URL("./error_cause/style.css", publicDirURL); /** * The toHTML method is used to output the HTML for the * web view */ async toHTML(props) { if (!props.error.cause) { return ""; } return `

Error Cause

${dump(props.error.cause, { cspNonce: props.cspNonce, styles: themes.cssVariables, inspectObjectPrototype: false, inspectStaticMembers: false, inspectArrayPrototype: false })}
`; } /** * The toANSI method is used to output the text for the console */ async toANSI(props) { if (!props.error.cause) { return ""; } let depth = process.env.YOUCH_CAUSE ? Number(process.env.YOUCH_CAUSE) : 2; if (Number.isNaN(depth)) { depth = 2; } return ` ${colors.red("[CAUSE]")} ${dumpCli(props.error.cause, { depth, inspectObjectPrototype: false, inspectStaticMembers: false, inspectArrayPrototype: false })}`; } }; export { ErrorCause };