import{P as a,R as o}from"./zod-H_cgTO0M.js";var s=a({detail:o()}),c=a({error:o()});function i(r){if(!r)return"Unknown error";if(r instanceof Error){let e=s.safeParse(r.cause);return e.success?e.data.detail:u(r.message)}if(typeof r=="object"){let e=s.safeParse(r);if(e.success)return e.data.detail;let t=c.safeParse(r);if(t.success)return t.data.error}try{return JSON.stringify(r)}catch{return String(r)}}function u(r){let e=l(r);if(!e)return r;let t=s.safeParse(e);if(t.success)return t.data.detail;let n=c.safeParse(e);return n.success?n.data.error:r}function l(r){try{return JSON.parse(r)}catch{return r}}var f=class extends Error{constructor(r,e,t){super(e,{cause:t}),this.name="HTTPError",this.status=r}},d=class extends Error{constructor(r="The cell containing this UI element has not been run yet. Please run the cell first."){super(r),this.name="CellNotInitializedError"}},h=class extends Error{constructor(r="This UI element could not reach its function on the kernel. Try re-running the cell."){super(r),this.name="FunctionNotFoundError"}},m=class extends Error{constructor(r="Not yet connected to a kernel."){super(r),this.name="NoKernelConnectedError"}};export{i as a,m as i,h as n,f as r,d as t};
