import{d as x,ak as N,a as _,m as p,f as i,i as y,j as C,k as m,t as f,p as g,h as w,W as S,o as l,v as $}from"./zEcrVex8.js";import{_ as O}from"./DGW5Lmzt.js";import"./liR6BZS3.js";const R=/(^|@)\S+:\d+/,k=/^\s*at .*(\S+:\d+|\(native\))/m,F=/^(eval@)?(\[native code\])?$/;function I(t,a){if(typeof t.stacktrace<"u"||typeof t["opera#sourceloc"]<"u")return P(t);if(t.stack&&t.stack.match(k))return b(t);if(t.stack)return T(t);throw new Error("Cannot parse given Error object")}function v(t){if(!t.includes(":"))return[t,void 0,void 0];const r=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));return[r[1],r[2]||void 0,r[3]||void 0]}function d(t,a){return t}function b(t,a){return A(t.stack)}function A(t,a){return d(t.split(`
`).filter(e=>!!e.match(k))).map(e=>{e.includes("(eval ")&&(e=e.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));let o=e.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,"");const n=o.match(/ (\(.+\)$)/);o=n?o.replace(n[0],""):o;const c=v(n?n[1]:o),s=n&&o||void 0,u=["eval","<anonymous>"].includes(c[0])?void 0:c[0];return{function:s,file:u,line:c[1]?+c[1]:void 0,col:c[2]?+c[2]:void 0,raw:e}})}function T(t,a){return V(t.stack)}function V(t,a){return d(t.split(`
`).filter(e=>!e.match(F))).map(e=>{if(e.includes(" > eval")&&(e=e.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),!e.includes("@")&&!e.includes(":"))return{function:e};{const o=/(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/,n=e.match(o),c=n&&n[1]?n[1]:void 0,s=v(e.replace(o,""));return{function:c,file:s[0],line:s[1]?+s[1]:void 0,col:s[2]?+s[2]:void 0,raw:e}}})}function P(t,a){return!t.stacktrace||t.message.includes(`
`)&&t.message.split(`
`).length>t.stacktrace.split(`
`).length?B(t):t.stack?X(t):L(t)}function B(t,a){const r=/Line (\d+).*script (?:in )?(\S+)/i,e=t.message.split(`
`),o=[];for(let n=2,c=e.length;n<c;n+=2){const s=r.exec(e[n]);s&&o.push({file:s[2],line:+s[1],raw:e[n]})}return d(o)}function L(t,a){const r=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,e=t.stacktrace.split(`
`),o=[];for(let n=0,c=e.length;n<c;n+=2){const s=r.exec(e[n]);s&&o.push({function:s[3]||void 0,file:s[2],line:s[1]?+s[1]:void 0,raw:e[n]})}return d(o)}function X(t,a){return d(t.stack.split(`
`).filter(e=>!!e.match(R)&&!e.match(/^Error created at/))).map(e=>{const o=e.split("@"),n=v(o.pop()),c=o.shift()||"",s=c.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;let u;c.match(/\(([^)]*)\)/)&&(u=c.replace(/^[^(]+\(([^)]*)\)$/,"$1"));const E=u===void 0||u==="[arguments not available]"?void 0:u.split(",");return{function:s,args:E,file:n[0],line:n[1]?+n[1]:void 0,col:n[2]?+n[2]:void 0,raw:e}})}function D(t){return t.map(a=>({functionName:a.function,args:a.args,fileName:a.file,lineNumber:a.line,columnNumber:a.col,source:a.raw}))}function h(t,a){return D(I(t))}const G={p6:""},M={key:0},j={"text-6xl":""},K={key:0,op75:""},W={my4:"","text-xl":"","text-red":""},z={key:1,"of-auto":"",rounded:"","bg-active":"",p2:""},H=["textContent"],U={key:1,op50:""},Y=x({__name:"error",setup(t){const a=N(),r=_(()=>{const o=a.value?.nuxt?.payload?.error;return o&&(console.error("[Nuxt DevTools] Error in payload:"),console.error(o),console.error({...o})),o}),e=_(()=>{if(!r.value?.stack)return[];try{return r.value.stack.startsWith("<pre>")?h({stack:r.value.stack.replace(/<.*?>/g,"")}):h(r.value)}catch(o){return console.error(o),[]}});return(o,n)=>{const c=S,s=O;return l(),p("div",G,[i(r)?(l(),p("div",M,[y(c,{n:"red",icon:"i-carbon-warning-alt-filled",mb5:""},{default:C(()=>n[0]||(n[0]=[$(" Error occurred in this page ")])),_:1}),m("div",j,f(i(r).statusCode||"Client Error"),1),i(r).statusMessage?(l(),p("div",K,f(i(r).statusMessage),1)):g("",!0),m("div",W,f(i(r).message||i(r).description||"Unknown error"),1),i(e).length||i(r).stack?(l(),p("div",z,[n[1]||(n[1]=m("div",{px1:"",op50:""}," Stacktrace ",-1)),i(e).length?(l(),w(s,{key:0,px2:"",stacktrace:i(e)},null,8,["stacktrace"])):(l(),p("pre",{key:1,textContent:f(i(r).stack)},null,8,H))])):g("",!0)])):(l(),p("div",U," No error "))])}}});export{Y as default};
