import {
colors,
wordWrap
} from "./chunk-4L7RY2JA.js";
import {
publicDirURL
} from "./chunk-OSUFJZHZ.js";
import {
BaseComponent
} from "./chunk-4YEN7HVQ.js";
// src/templates/error_info/main.ts
var ERROR_ICON_SVG = ``;
var HINT_ICON_SVG = ``;
var ErrorInfo = class extends BaseComponent {
cssFile = new URL("./error_info/style.css", publicDirURL);
/**
* The toHTML method is used to output the HTML for the
* web view
*/
async toHTML(props) {
return `
${props.error.name}
${props.title}
${ERROR_ICON_SVG}${props.error.message}
${props.error.hint ? `
${HINT_ICON_SVG}${props.error.hint}
` : ""}
`;
}
/**
* The toANSI method is used to output the text for the console
*/
async toANSI(props) {
const errorMessage = colors.red(
`\u2139 ${wordWrap(`${props.error.name}: ${props.error.message}`, {
width: process.stdout.columns,
indent: " ",
newLine: "\n",
escape: (value) => value
})}`
);
const hint = props.error.hint ? `
${colors.blue("\u25C9")} ${colors.dim().italic(
wordWrap(props.error.hint.replace(/(<([^>]+)>)/gi, ""), {
width: process.stdout.columns,
indent: " ",
newLine: "\n",
escape: (value) => value
})
)}` : "";
return `${errorMessage}${hint}`;
}
};
export {
ErrorInfo
};