import*as e from"react";function g({compilationErrors:a}){const c=r=>r.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g,""),s=r=>{const o=r.indexOf("|");if(o!==-1){const d=r.slice(0,o+1),i=r.slice(o+1);return e.createElement(e.Fragment,null,d,e.createElement("div",{style:t.highlightedText},i))}return r},p=(r,o)=>{const i=c(r).split(`
`),m=o?i.findIndex(n=>n.trimStart().startsWith(`${o} |`)):-1;return i.map((n,l)=>{const f=l===m;return e.createElement("span",{style:t.codeLine,key:l},f?s(n):n)})};return e.createElement("div",{"data-cy":"CompilationError/Container",style:t.container},e.createElement("h2",{style:t.title},"Build Error"),e.createElement("div",{style:t.errorHeader},"Failed to compile"),e.createElement("div",{style:t.errorDetails},a?.map((r,o)=>e.createElement(e.Fragment,{key:o},e.createElement("div",{"data-cy":"CompilationError/Error",style:t.errorBlock},e.createElement("div",{style:t.fileHeader},"Error in file: ",r.sourceFileRelativePath),e.createElement("div",{style:t.errorDescription},r.message),r.codeframe&&e.createElement("pre",{style:t.codeBlock},e.createElement("pre",{style:t.codeFrame},p(r.codeframe,r.sourceFileLocation?.line)))),o<a?.length-1&&e.createElement("hr",{style:t.divider}))),e.createElement("div",{style:t.fixInstruction},a?.length===1?"This error occurred during the build process and can only be dismissed by fixing the error.":"These errors occurred during the build process and can only be dismissed by fixing the errors.")))}const t={container:{margin:"48px auto",padding:"24px",borderRadius:"6px",background:"#fbfbfc",maxWidth:"800px",fontFamily:"system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', Arial, sans-serif"},errorHeader:{backgroundColor:"#f9316d",color:"white",padding:"12px",fontSize:"20px"},title:{color:"#f9316d"},errorDetails:{marginTop:"16px"},codeBlock:{borderRadius:"4px",fontSize:"14px",overflow:"auto"},codeLine:{display:"block",fontWeight:"bold"},errorDescription:{display:"block",padding:"0 0 16px",borderBottom:"1px solid #3b3c45",color:"#f9316d"},codeFrame:{margin:"8px 0 0 0",backgroundColor:"#fbfbfc",color:"#3b3c45",padding:"8px",borderRadius:"4px"},fixInstruction:{margin:"12px 0 0 0",fontSize:"14px",color:"#3b3c45",fontStyle:"italic"},errorBlock:{margin:"32px 0",padding:"16px",border:"1px solid #f9316d",borderRadius:"8px",backgroundColor:"#fbfbfc",boxShadow:"0 2px 4px rgba(0, 0, 0, 0.1)"},fileHeader:{fontSize:"16px",fontWeight:"bold",color:"#f9316d",margin:"0 0 8px 0"},divider:{border:"none",borderBottom:"1px solid #3b3c45",margin:"16px 0"},highlightedText:{color:"#f9316d",fontWeight:"bold",backgroundColor:"rgba(255, 85, 85, 0.2)",borderRadius:"4px"}};export{g as CompilationError};
