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