@tonyclaw/agent-inspector 2.1.1 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/assets/{CompareDrawer-DkDpl_Sg.js → CompareDrawer-BLYcm6Dg.js} +1 -1
- package/.output/public/assets/{ProxyViewerContainer-D_-e1qn7.js → ProxyViewerContainer-Ba5wFn00.js} +5 -5
- package/.output/public/assets/{ReplayDialog-CKqYfD0A.js → ReplayDialog-_kCy9L9E.js} +1 -1
- package/.output/public/assets/{RequestAnatomy-CQZl-YIx.js → RequestAnatomy-DWp5pWsv.js} +1 -1
- package/.output/public/assets/{ResponseView-DW9tFPi0.js → ResponseView-Ci92o6mt.js} +1 -1
- package/.output/public/assets/{StreamingChunkSequence-m8zKc3L1.js → StreamingChunkSequence-C-1ZQl_b.js} +1 -1
- package/.output/public/assets/_sessionId-DKzAmSNP.js +1 -0
- package/.output/public/assets/index-B-MZ9lQM.css +1 -0
- package/.output/public/assets/index-ZZHwgkWJ.js +1 -0
- package/.output/public/assets/{main-BjXd3DR-.js → main-RgLvmIQk.js} +7 -7
- package/.output/server/{_sessionId-LjzdyWF4.mjs → _sessionId-DnOYbKO7.mjs} +2 -2
- package/.output/server/_ssr/{CompareDrawer-YX2uOwh9.mjs → CompareDrawer-D44_F13_.mjs} +2 -2
- package/.output/server/_ssr/{ProxyViewerContainer-BcKHl2E3.mjs → ProxyViewerContainer-Cx4p_awW.mjs} +8 -8
- package/.output/server/_ssr/{ReplayDialog-B9AxvV2j.mjs → ReplayDialog-wScCF3Oc.mjs} +3 -3
- package/.output/server/_ssr/{RequestAnatomy-DxmUOcz8.mjs → RequestAnatomy-Cf7R7PXS.mjs} +2 -2
- package/.output/server/_ssr/{ResponseView-B73PHDQ0.mjs → ResponseView-7pVIZLL-.mjs} +2 -2
- package/.output/server/_ssr/{StreamingChunkSequence-Bkwxu5Ev.mjs → StreamingChunkSequence-Bs57_GbC.mjs} +2 -2
- package/.output/server/_ssr/{index-Dfl6uxit.mjs → index-6eY__la9.mjs} +2 -2
- package/.output/server/_ssr/index.mjs +2 -2
- package/.output/server/_ssr/{router-B5cpU5Hi.mjs → router-DRZPhZB6.mjs} +5 -5
- package/.output/server/{_tanstack-start-manifest_v-CHhxRQY_.mjs → _tanstack-start-manifest_v-DfAVFkZ5.mjs} +1 -1
- package/.output/server/index.mjs +55 -55
- package/package.json +1 -1
- package/src/assets/agent-inspector.ico +0 -0
- package/src/assets/favicon.svg +21 -31
- package/src/components/ProxyViewer.tsx +2 -2
- package/.output/public/assets/_sessionId-DyfzgUXv.js +0 -1
- package/.output/public/assets/index-B6bobhTz.js +0 -1
- package/.output/public/assets/index-CLQKZ5A5.css +0 -1
package/.output/public/assets/{ProxyViewerContainer-D_-e1qn7.js → ProxyViewerContainer-Ba5wFn00.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CompareDrawer-
|
|
2
|
-
import{u as Yr,a as Qd,r as g,j as i,c as lo,g as Ia,b as Xr,d as ut,e as ef,f as Cx,h as tf,_ as Ln}from"./main-BjXd3DR-.js";function oe(e,t,n){function r(l,c){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,c);const u=a.prototype,d=Object.keys(u);for(let f=0;f<d.length;f++){const h=d[f];h in l||(l[h]=u[h].bind(l))}}const o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function a(l){var c;const u=n?.Parent?new s:this;r(u,l),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:l=>n?.Parent&&l instanceof n.Parent?!0:l?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class er extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class nf extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const rf={};function mn(e){return rf}function of(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Mi(e,t){return typeof t=="bigint"?t.toString():t}function gs(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function za(e){return e==null}function Pa(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function jx(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}const s=n>o?n:o,a=Number.parseInt(e.toFixed(s).replace(".","")),l=Number.parseInt(t.toFixed(s).replace(".",""));return a%l/10**s}const ec=Symbol("evaluating");function Pe(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ec)return r===void 0&&(r=ec,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Dn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function vn(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function tc(e){return JSON.stringify(e)}function Nx(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const sf="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ur(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Ex=gs(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function lr(e){if(Ur(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Ur(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function af(e){return lr(e)?{...e}:Array.isArray(e)?[...e]:e}const Tx=new Set(["string","number","symbol"]);function cr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function wn(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function _e(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Ax(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Ix={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function zx(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=vn(e._zod.def,{get shape(){const a={};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&(a[l]=n.shape[l])}return Dn(this,"shape",a),a},checks:[]});return wn(e,s)}function Px(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=vn(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&delete a[l]}return Dn(this,"shape",a),a},checks:[]});return wn(e,s)}function Rx(e,t){if(!lr(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(s,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=vn(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return Dn(this,"shape",s),s}});return wn(e,o)}function Ox(e,t){if(!lr(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=vn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Dn(this,"shape",r),r}});return wn(e,n)}function Mx(e,t){const n=vn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Dn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return wn(e,n)}function Lx(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=vn(t._zod.def,{get shape(){const l=t._zod.def.shape,c={...l};if(n)for(const u in n){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:l[u]}):l[u])}else for(const u in l)c[u]=e?new e({type:"optional",innerType:l[u]}):l[u];return Dn(this,"shape",c),c},checks:[]});return wn(t,a)}function Dx(e,t,n){const r=vn(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const a in n){if(!(a in s))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(s[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)s[a]=new e({type:"nonoptional",innerType:o[a]});return Dn(this,"shape",s),s}});return wn(t,r)}function Xn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Qn(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function co(e){return typeof e=="string"?e:e?.message}function gn(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=co(e.inst?._zod.def?.error?.(e))??co(t?.error?.(e))??co(n.customError?.(e))??co(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Ra(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Hr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const lf=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Mi,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},cf=oe("$ZodError",lf),uf=oe("$ZodError",lf,{Parent:Error});function Fx(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function $x(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>r({issues:a}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let a=n,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return r(e),n}const Oa=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new er;if(a.issues.length){const l=new(o?.Err??e)(a.issues.map(c=>gn(c,s,mn())));throw sf(l,o?.callee),l}return a.value},Ma=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const l=new(o?.Err??e)(a.issues.map(c=>gn(c,s,mn())));throw sf(l,o?.callee),l}return a.value},xs=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new er;return s.issues.length?{success:!1,error:new(e??cf)(s.issues.map(a=>gn(a,o,mn())))}:{success:!0,data:s.value}},Bx=xs(uf),bs=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(a=>gn(a,o,mn())))}:{success:!0,data:s.value}},Ux=bs(uf),Hx=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Oa(e)(t,n,o)},Wx=e=>(t,n,r)=>Oa(e)(t,n,r),Vx=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ma(e)(t,n,o)},Zx=e=>async(t,n,r)=>Ma(e)(t,n,r),qx=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return xs(e)(t,n,o)},Kx=e=>(t,n,r)=>xs(e)(t,n,r),Gx=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return bs(e)(t,n,o)},Jx=e=>async(t,n,r)=>bs(e)(t,n,r),Yx=/^[cC][^\s-]{8,}$/,Xx=/^[0-9a-z]+$/,Qx=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,e0=/^[0-9a-vA-V]{20}$/,t0=/^[A-Za-z0-9]{27}$/,n0=/^[a-zA-Z0-9_-]{21}$/,r0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,o0=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,nc=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,s0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,i0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function a0(){return new RegExp(i0,"u")}const l0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,c0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,u0=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,d0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,f0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,df=/^[A-Za-z0-9_-]*$/,p0=/^\+[1-9]\d{6,14}$/,ff="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",h0=new RegExp(`^${ff}$`);function pf(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function m0(e){return new RegExp(`^${pf(e)}$`)}function g0(e){const t=pf({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${ff}T(?:${r})$`)}const x0=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},b0=/^-?\d+$/,hf=/^-?\d+(?:\.\d+)?$/,y0=/^(?:true|false)$/i,v0=/^null$/i,w0=/^[^A-Z]*$/,k0=/^[^a-z]*$/,pt=oe("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),mf={number:"number",bigint:"bigint",object:"date"},gf=oe("$ZodCheckLessThan",(e,t)=>{pt.init(e,t);const n=mf[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),xf=oe("$ZodCheckGreaterThan",(e,t)=>{pt.init(e,t);const n=mf[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_0=oe("$ZodCheckMultipleOf",(e,t)=>{pt.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):jx(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),S0=oe("$ZodCheckNumberFormat",(e,t)=>{pt.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,s]=Ix[t.format];e._zod.onattach.push(a=>{const l=a._zod.bag;l.format=t.format,l.minimum=o,l.maximum=s,n&&(l.pattern=b0)}),e._zod.check=a=>{const l=a.value;if(n){if(!Number.isInteger(l)){a.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}l<o&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>s&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),C0=oe("$ZodCheckMaxLength",(e,t)=>{var n;pt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!za(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const a=Ra(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),j0=oe("$ZodCheckMinLength",(e,t)=>{var n;pt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!za(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const a=Ra(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),N0=oe("$ZodCheckLengthEquals",(e,t)=>{var n;pt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!za(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const a=Ra(o),l=s>t.length;r.issues.push({origin:a,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ys=oe("$ZodCheckStringFormat",(e,t)=>{var n,r;pt.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),E0=oe("$ZodCheckRegex",(e,t)=>{ys.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),T0=oe("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=w0),ys.init(e,t)}),A0=oe("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=k0),ys.init(e,t)}),I0=oe("$ZodCheckIncludes",(e,t)=>{pt.init(e,t);const n=cr(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),z0=oe("$ZodCheckStartsWith",(e,t)=>{pt.init(e,t);const n=new RegExp(`^${cr(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),P0=oe("$ZodCheckEndsWith",(e,t)=>{pt.init(e,t);const n=new RegExp(`.*${cr(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),R0=oe("$ZodCheckOverwrite",(e,t)=>{pt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class O0{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CompareDrawer-BLYcm6Dg.js","assets/main-RgLvmIQk.js","assets/ReplayDialog-_kCy9L9E.js","assets/ResponseView-Ci92o6mt.js","assets/RequestAnatomy-DWp5pWsv.js","assets/StreamingChunkSequence-C-1ZQl_b.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as Yr,a as Qd,r as g,j as i,c as lo,g as Ia,b as Xr,d as ut,e as ef,f as Cx,h as tf,_ as Ln}from"./main-RgLvmIQk.js";function oe(e,t,n){function r(l,c){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,c);const u=a.prototype,d=Object.keys(u);for(let f=0;f<d.length;f++){const h=d[f];h in l||(l[h]=u[h].bind(l))}}const o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function a(l){var c;const u=n?.Parent?new s:this;r(u,l),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:l=>n?.Parent&&l instanceof n.Parent?!0:l?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class er extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class nf extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const rf={};function mn(e){return rf}function of(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Mi(e,t){return typeof t=="bigint"?t.toString():t}function gs(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function za(e){return e==null}function Pa(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function jx(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}const s=n>o?n:o,a=Number.parseInt(e.toFixed(s).replace(".","")),l=Number.parseInt(t.toFixed(s).replace(".",""));return a%l/10**s}const ec=Symbol("evaluating");function Pe(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ec)return r===void 0&&(r=ec,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Dn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function vn(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function tc(e){return JSON.stringify(e)}function Nx(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const sf="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ur(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Ex=gs(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function lr(e){if(Ur(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Ur(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function af(e){return lr(e)?{...e}:Array.isArray(e)?[...e]:e}const Tx=new Set(["string","number","symbol"]);function cr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function wn(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function _e(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Ax(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Ix={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function zx(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=vn(e._zod.def,{get shape(){const a={};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&(a[l]=n.shape[l])}return Dn(this,"shape",a),a},checks:[]});return wn(e,s)}function Px(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=vn(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&delete a[l]}return Dn(this,"shape",a),a},checks:[]});return wn(e,s)}function Rx(e,t){if(!lr(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(s,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=vn(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return Dn(this,"shape",s),s}});return wn(e,o)}function Ox(e,t){if(!lr(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=vn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Dn(this,"shape",r),r}});return wn(e,n)}function Mx(e,t){const n=vn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Dn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return wn(e,n)}function Lx(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=vn(t._zod.def,{get shape(){const l=t._zod.def.shape,c={...l};if(n)for(const u in n){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:l[u]}):l[u])}else for(const u in l)c[u]=e?new e({type:"optional",innerType:l[u]}):l[u];return Dn(this,"shape",c),c},checks:[]});return wn(t,a)}function Dx(e,t,n){const r=vn(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const a in n){if(!(a in s))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(s[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)s[a]=new e({type:"nonoptional",innerType:o[a]});return Dn(this,"shape",s),s}});return wn(t,r)}function Xn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Qn(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function co(e){return typeof e=="string"?e:e?.message}function gn(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=co(e.inst?._zod.def?.error?.(e))??co(t?.error?.(e))??co(n.customError?.(e))??co(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Ra(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Hr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const lf=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Mi,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},cf=oe("$ZodError",lf),uf=oe("$ZodError",lf,{Parent:Error});function Fx(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function $x(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>r({issues:a}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let a=n,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return r(e),n}const Oa=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new er;if(a.issues.length){const l=new(o?.Err??e)(a.issues.map(c=>gn(c,s,mn())));throw sf(l,o?.callee),l}return a.value},Ma=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const l=new(o?.Err??e)(a.issues.map(c=>gn(c,s,mn())));throw sf(l,o?.callee),l}return a.value},xs=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new er;return s.issues.length?{success:!1,error:new(e??cf)(s.issues.map(a=>gn(a,o,mn())))}:{success:!0,data:s.value}},Bx=xs(uf),bs=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(a=>gn(a,o,mn())))}:{success:!0,data:s.value}},Ux=bs(uf),Hx=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Oa(e)(t,n,o)},Wx=e=>(t,n,r)=>Oa(e)(t,n,r),Vx=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ma(e)(t,n,o)},Zx=e=>async(t,n,r)=>Ma(e)(t,n,r),qx=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return xs(e)(t,n,o)},Kx=e=>(t,n,r)=>xs(e)(t,n,r),Gx=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return bs(e)(t,n,o)},Jx=e=>async(t,n,r)=>bs(e)(t,n,r),Yx=/^[cC][^\s-]{8,}$/,Xx=/^[0-9a-z]+$/,Qx=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,e0=/^[0-9a-vA-V]{20}$/,t0=/^[A-Za-z0-9]{27}$/,n0=/^[a-zA-Z0-9_-]{21}$/,r0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,o0=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,nc=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,s0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,i0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function a0(){return new RegExp(i0,"u")}const l0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,c0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,u0=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,d0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,f0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,df=/^[A-Za-z0-9_-]*$/,p0=/^\+[1-9]\d{6,14}$/,ff="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",h0=new RegExp(`^${ff}$`);function pf(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function m0(e){return new RegExp(`^${pf(e)}$`)}function g0(e){const t=pf({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${ff}T(?:${r})$`)}const x0=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},b0=/^-?\d+$/,hf=/^-?\d+(?:\.\d+)?$/,y0=/^(?:true|false)$/i,v0=/^null$/i,w0=/^[^A-Z]*$/,k0=/^[^a-z]*$/,pt=oe("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),mf={number:"number",bigint:"bigint",object:"date"},gf=oe("$ZodCheckLessThan",(e,t)=>{pt.init(e,t);const n=mf[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),xf=oe("$ZodCheckGreaterThan",(e,t)=>{pt.init(e,t);const n=mf[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_0=oe("$ZodCheckMultipleOf",(e,t)=>{pt.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):jx(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),S0=oe("$ZodCheckNumberFormat",(e,t)=>{pt.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,s]=Ix[t.format];e._zod.onattach.push(a=>{const l=a._zod.bag;l.format=t.format,l.minimum=o,l.maximum=s,n&&(l.pattern=b0)}),e._zod.check=a=>{const l=a.value;if(n){if(!Number.isInteger(l)){a.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}l<o&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>s&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),C0=oe("$ZodCheckMaxLength",(e,t)=>{var n;pt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!za(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const a=Ra(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),j0=oe("$ZodCheckMinLength",(e,t)=>{var n;pt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!za(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const a=Ra(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),N0=oe("$ZodCheckLengthEquals",(e,t)=>{var n;pt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!za(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const a=Ra(o),l=s>t.length;r.issues.push({origin:a,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ys=oe("$ZodCheckStringFormat",(e,t)=>{var n,r;pt.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),E0=oe("$ZodCheckRegex",(e,t)=>{ys.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),T0=oe("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=w0),ys.init(e,t)}),A0=oe("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=k0),ys.init(e,t)}),I0=oe("$ZodCheckIncludes",(e,t)=>{pt.init(e,t);const n=cr(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),z0=oe("$ZodCheckStartsWith",(e,t)=>{pt.init(e,t);const n=new RegExp(`^${cr(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),P0=oe("$ZodCheckEndsWith",(e,t)=>{pt.init(e,t);const n=new RegExp(`.*${cr(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),R0=oe("$ZodCheckOverwrite",(e,t)=>{pt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class O0{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
3
3
|
`).filter(a=>a),o=Math.min(...r.map(a=>a.length-a.trimStart().length)),s=r.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(const a of s)this.content.push(a)}compile(){const t=Function,n=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...n,o.join(`
|
|
4
4
|
`))}}const M0={major:4,minor:3,patch:6},qe=oe("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=M0;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const s of o._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(a,l,c)=>{let u=Xn(a),d;for(const f of l){if(f._zod.def.when){if(!f._zod.def.when(a))continue}else if(u)continue;const h=a.issues.length,p=f._zod.check(a);if(p instanceof Promise&&c?.async===!1)throw new er;if(d||p instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await p,a.issues.length!==h&&(u||(u=Xn(a,h)))});else{if(a.issues.length===h)continue;u||(u=Xn(a,h))}}return d?d.then(()=>a):a},s=(a,l,c)=>{if(Xn(a))return a.aborted=!0,a;const u=o(l,r,c);if(u instanceof Promise){if(c.async===!1)throw new er;return u.then(d=>e._zod.parse(d,c))}return e._zod.parse(u,c)};e._zod.run=(a,l)=>{if(l.skipChecks)return e._zod.parse(a,l);if(l.direction==="backward"){const u=e._zod.parse({value:a.value,issues:[]},{...l,skipChecks:!0});return u instanceof Promise?u.then(d=>s(d,a,l)):s(u,a,l)}const c=e._zod.parse(a,l);if(c instanceof Promise){if(l.async===!1)throw new er;return c.then(u=>o(u,r,l))}return o(c,r,l)}}Pe(e,"~standard",()=>({validate:o=>{try{const s=Bx(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Ux(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),La=oe("$ZodString",(e,t)=>{qe.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??x0(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Ge=oe("$ZodStringFormat",(e,t)=>{ys.init(e,t),La.init(e,t)}),L0=oe("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=o0),Ge.init(e,t)}),D0=oe("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=nc(r))}else t.pattern??(t.pattern=nc());Ge.init(e,t)}),F0=oe("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=s0),Ge.init(e,t)}),$0=oe("$ZodURL",(e,t)=>{Ge.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),B0=oe("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=a0()),Ge.init(e,t)}),U0=oe("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=n0),Ge.init(e,t)}),H0=oe("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Yx),Ge.init(e,t)}),W0=oe("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Xx),Ge.init(e,t)}),V0=oe("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Qx),Ge.init(e,t)}),Z0=oe("$ZodXID",(e,t)=>{t.pattern??(t.pattern=e0),Ge.init(e,t)}),q0=oe("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=t0),Ge.init(e,t)}),K0=oe("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=g0(t)),Ge.init(e,t)}),G0=oe("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=h0),Ge.init(e,t)}),J0=oe("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=m0(t)),Ge.init(e,t)}),Y0=oe("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=r0),Ge.init(e,t)}),X0=oe("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=l0),Ge.init(e,t),e._zod.bag.format="ipv4"}),Q0=oe("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=c0),Ge.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),eb=oe("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=u0),Ge.init(e,t)}),tb=oe("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=d0),Ge.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,s]=r;if(!s)throw new Error;const a=Number(s);if(`${a}`!==s)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function bf(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const nb=oe("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=f0),Ge.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{bf(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function rb(e){if(!df.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return bf(n)}const ob=oe("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=df),Ge.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{rb(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),sb=oe("$ZodE164",(e,t)=>{t.pattern??(t.pattern=p0),Ge.init(e,t)});function ib(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const ab=oe("$ZodJWT",(e,t)=>{Ge.init(e,t),e._zod.check=n=>{ib(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),yf=oe("$ZodNumber",(e,t)=>{qe.init(e,t),e._zod.pattern=e._zod.bag.pattern??hf,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),lb=oe("$ZodNumberFormat",(e,t)=>{S0.init(e,t),yf.init(e,t)}),cb=oe("$ZodBoolean",(e,t)=>{qe.init(e,t),e._zod.pattern=y0,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),ub=oe("$ZodNull",(e,t)=>{qe.init(e,t),e._zod.pattern=v0,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{const o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),db=oe("$ZodUnknown",(e,t)=>{qe.init(e,t),e._zod.parse=n=>n}),fb=oe("$ZodNever",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function rc(e,t,n){e.issues.length&&t.issues.push(...Qn(n,e.issues)),t.value[n]=e.value}const pb=oe("$ZodArray",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const s=[];for(let a=0;a<o.length;a++){const l=o[a],c=t.element._zod.run({value:l,issues:[]},r);c instanceof Promise?s.push(c.then(u=>rc(u,n,a))):rc(c,n,a)}return s.length?Promise.all(s).then(()=>n):n}});function $o(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Qn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function vf(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=Ax(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function wf(e,t,n,r,o,s){const a=[],l=o.keySet,c=o.catchall._zod,u=c.def.type,d=c.optout==="optional";for(const f in t){if(l.has(f))continue;if(u==="never"){a.push(f);continue}const h=c.run({value:t[f],issues:[]},r);h instanceof Promise?e.push(h.then(p=>$o(p,n,f,t,d))):$o(h,n,f,t,d)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const hb=oe("$ZodObject",(e,t)=>{if(qe.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const l=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...l};return Object.defineProperty(t,"shape",{value:c}),c}})}const r=gs(()=>vf(t));Pe(e._zod,"propValues",()=>{const l=t.shape,c={};for(const u in l){const d=l[u]._zod;if(d.values){c[u]??(c[u]=new Set);for(const f of d.values)c[u].add(f)}}return c});const o=Ur,s=t.catchall;let a;e._zod.parse=(l,c)=>{a??(a=r.value);const u=l.value;if(!o(u))return l.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),l;l.value={};const d=[],f=a.shape;for(const h of a.keys){const p=f[h],y=p._zod.optout==="optional",m=p._zod.run({value:u[h],issues:[]},c);m instanceof Promise?d.push(m.then(x=>$o(x,l,h,u,y))):$o(m,l,h,u,y)}return s?wf(d,u,l,c,r.value,e):d.length?Promise.all(d).then(()=>l):l}}),mb=oe("$ZodObjectJIT",(e,t)=>{hb.init(e,t);const n=e._zod.parse,r=gs(()=>vf(t)),o=h=>{const p=new O0(["shape","payload","ctx"]),y=r.value,m=w=>{const C=tc(w);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};p.write("const input = payload.value;");const x=Object.create(null);let b=0;for(const w of y.keys)x[w]=`key_${b++}`;p.write("const newResult = {};");for(const w of y.keys){const C=x[w],S=tc(w),E=h[w]?._zod?.optout==="optional";p.write(`const ${C} = ${m(w)};`),E?p.write(`
|
|
5
5
|
if (${C}.issues.length) {
|
|
@@ -38,7 +38,7 @@ import{u as Yr,a as Qd,r as g,j as i,c as lo,g as Ia,b as Xr,d as ut,e as ef,f a
|
|
|
38
38
|
`)}p.write("payload.value = newResult;"),p.write("return payload;");const v=p.compile();return(w,C)=>v(h,w,C)};let s;const a=Ur,l=!rf.jitless,u=l&&Ex.value,d=t.catchall;let f;e._zod.parse=(h,p)=>{f??(f=r.value);const y=h.value;return a(y)?l&&u&&p?.async===!1&&p.jitless!==!0?(s||(s=o(t.shape)),h=s(h,p),d?wf([],y,h,p,f,e):h):n(h,p):(h.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),h)}});function oc(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!Xn(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(a=>gn(a,r,mn())))}),t)}const kf=oe("$ZodUnion",(e,t)=>{qe.init(e,t),Pe(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Pe(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Pe(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Pe(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>Pa(s.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(n)return r(o,s);let a=!1;const l=[];for(const c of t.options){const u=c._zod.run({value:o.value,issues:[]},s);if(u instanceof Promise)l.push(u),a=!0;else{if(u.issues.length===0)return u;l.push(u)}}return a?Promise.all(l).then(c=>oc(c,o,e,s)):oc(l,o,e,s)}}),gb=oe("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,kf.init(e,t);const n=e._zod.parse;Pe(e._zod,"propValues",()=>{const o={};for(const s of t.options){const a=s._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[l,c]of Object.entries(a)){o[l]||(o[l]=new Set);for(const u of c)o[l].add(u)}}return o});const r=gs(()=>{const o=t.options,s=new Map;for(const a of o){const l=a._zod.propValues?.[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const c of l){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,a)}}return s});e._zod.parse=(o,s)=>{const a=o.value;if(!Ur(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const l=r.value.get(a?.[t.discriminator]);return l?l._zod.run(o,s):t.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),xb=oe("$ZodIntersection",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([c,u])=>sc(n,c,u)):sc(n,s,a)}});function Li(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(lr(e)&&lr(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of r){const a=Li(e[s],t[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};o[s]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r],a=Li(o,s);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function sc(e,t,n){const r=new Map;let o;for(const l of t.issues)if(l.code==="unrecognized_keys"){o??(o=l);for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(l);for(const l of n.issues)if(l.code==="unrecognized_keys")for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(l);const s=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(s.length&&o&&e.issues.push({...o,keys:s}),Xn(e))return e;const a=Li(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const bb=oe("$ZodRecord",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!lr(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[],a=t.keyType._zod.values;if(a){n.value={};const l=new Set;for(const u of a)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){l.add(typeof u=="number"?u.toString():u);const d=t.valueType._zod.run({value:o[u],issues:[]},r);d instanceof Promise?s.push(d.then(f=>{f.issues.length&&n.issues.push(...Qn(u,f.issues)),n.value[u]=f.value})):(d.issues.length&&n.issues.push(...Qn(u,d.issues)),n.value[u]=d.value)}let c;for(const u in o)l.has(u)||(c=c??[],c.push(u));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{n.value={};for(const l of Reflect.ownKeys(o)){if(l==="__proto__")continue;let c=t.keyType._zod.run({value:l,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&hf.test(l)&&c.issues.length){const f=t.keyType._zod.run({value:Number(l),issues:[]},r);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(c=f)}if(c.issues.length){t.mode==="loose"?n.value[l]=o[l]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(f=>gn(f,r,mn())),input:l,path:[l],inst:e});continue}const d=t.valueType._zod.run({value:o[l],issues:[]},r);d instanceof Promise?s.push(d.then(f=>{f.issues.length&&n.issues.push(...Qn(l,f.issues)),n.value[c.value]=f.value})):(d.issues.length&&n.issues.push(...Qn(l,d.issues)),n.value[c.value]=d.value)}}return s.length?Promise.all(s).then(()=>n):n}}),yb=oe("$ZodEnum",(e,t)=>{qe.init(e,t);const n=of(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Tx.has(typeof o)).map(o=>typeof o=="string"?cr(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),vb=oe("$ZodLiteral",(e,t)=>{if(qe.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?cr(r):r?cr(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),wb=oe("$ZodTransform",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new nf(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n));if(o instanceof Promise)throw new er;return n.value=o,n}});function ic(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const _f=oe("$ZodOptional",(e,t)=>{qe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Pe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Pe(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Pa(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>ic(s,n.value)):ic(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),kb=oe("$ZodExactOptional",(e,t)=>{_f.init(e,t),Pe(e._zod,"values",()=>t.innerType._zod.values),Pe(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),_b=oe("$ZodNullable",(e,t)=>{qe.init(e,t),Pe(e._zod,"optin",()=>t.innerType._zod.optin),Pe(e._zod,"optout",()=>t.innerType._zod.optout),Pe(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Pa(n.source)}|null)$`):void 0}),Pe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Sb=oe("$ZodDefault",(e,t)=>{qe.init(e,t),e._zod.optin="optional",Pe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>ac(s,t)):ac(o,t)}});function ac(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Cb=oe("$ZodPrefault",(e,t)=>{qe.init(e,t),e._zod.optin="optional",Pe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),jb=oe("$ZodNonOptional",(e,t)=>{qe.init(e,t),Pe(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>lc(s,e)):lc(o,e)}});function lc(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Nb=oe("$ZodCatch",(e,t)=>{qe.init(e,t),Pe(e._zod,"optin",()=>t.innerType._zod.optin),Pe(e._zod,"optout",()=>t.innerType._zod.optout),Pe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(a=>gn(a,r,mn()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>gn(s,r,mn()))},input:n.value}),n.issues=[]),n)}}),Eb=oe("$ZodPipe",(e,t)=>{qe.init(e,t),Pe(e._zod,"values",()=>t.in._zod.values),Pe(e._zod,"optin",()=>t.in._zod.optin),Pe(e._zod,"optout",()=>t.out._zod.optout),Pe(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(a=>uo(a,t.in,r)):uo(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>uo(s,t.out,r)):uo(o,t.out,r)}});function uo(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Tb=oe("$ZodReadonly",(e,t)=>{qe.init(e,t),Pe(e._zod,"propValues",()=>t.innerType._zod.propValues),Pe(e._zod,"values",()=>t.innerType._zod.values),Pe(e._zod,"optin",()=>t.innerType?._zod?.optin),Pe(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(cc):cc(o)}});function cc(e){return e.value=Object.freeze(e.value),e}const Ab=oe("$ZodLazy",(e,t)=>{qe.init(e,t),Pe(e._zod,"innerType",()=>t.getter()),Pe(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Pe(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Pe(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Pe(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),Ib=oe("$ZodCustom",(e,t)=>{pt.init(e,t),qe.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>uc(s,n,r,e));uc(o,n,r,e)}});function uc(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Hr(o))}}var dc;class zb{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function Pb(){return new zb}(dc=globalThis).__zod_globalRegistry??(dc.__zod_globalRegistry=Pb());const Or=globalThis.__zod_globalRegistry;function Rb(e,t){return new e({type:"string",..._e(t)})}function Ob(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._e(t)})}function fc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._e(t)})}function Mb(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._e(t)})}function Lb(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._e(t)})}function Db(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._e(t)})}function Fb(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._e(t)})}function $b(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._e(t)})}function Bb(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._e(t)})}function Ub(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._e(t)})}function Hb(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._e(t)})}function Wb(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._e(t)})}function Vb(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._e(t)})}function Zb(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._e(t)})}function qb(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._e(t)})}function Kb(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._e(t)})}function Gb(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._e(t)})}function Jb(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._e(t)})}function Yb(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._e(t)})}function Xb(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._e(t)})}function Qb(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._e(t)})}function e1(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._e(t)})}function t1(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._e(t)})}function n1(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._e(t)})}function r1(e,t){return new e({type:"string",format:"date",check:"string_format",..._e(t)})}function o1(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._e(t)})}function s1(e,t){return new e({type:"string",format:"duration",check:"string_format",..._e(t)})}function i1(e,t){return new e({type:"number",checks:[],..._e(t)})}function a1(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._e(t)})}function l1(e,t){return new e({type:"boolean",..._e(t)})}function c1(e,t){return new e({type:"null",..._e(t)})}function u1(e){return new e({type:"unknown"})}function d1(e,t){return new e({type:"never",..._e(t)})}function pc(e,t){return new gf({check:"less_than",..._e(t),value:e,inclusive:!1})}function Xs(e,t){return new gf({check:"less_than",..._e(t),value:e,inclusive:!0})}function hc(e,t){return new xf({check:"greater_than",..._e(t),value:e,inclusive:!1})}function Qs(e,t){return new xf({check:"greater_than",..._e(t),value:e,inclusive:!0})}function mc(e,t){return new _0({check:"multiple_of",..._e(t),value:e})}function Sf(e,t){return new C0({check:"max_length",..._e(t),maximum:e})}function Bo(e,t){return new j0({check:"min_length",..._e(t),minimum:e})}function Cf(e,t){return new N0({check:"length_equals",..._e(t),length:e})}function f1(e,t){return new E0({check:"string_format",format:"regex",..._e(t),pattern:e})}function p1(e){return new T0({check:"string_format",format:"lowercase",..._e(e)})}function h1(e){return new A0({check:"string_format",format:"uppercase",..._e(e)})}function m1(e,t){return new I0({check:"string_format",format:"includes",..._e(t),includes:e})}function g1(e,t){return new z0({check:"string_format",format:"starts_with",..._e(t),prefix:e})}function x1(e,t){return new P0({check:"string_format",format:"ends_with",..._e(t),suffix:e})}function mr(e){return new R0({check:"overwrite",tx:e})}function b1(e){return mr(t=>t.normalize(e))}function y1(){return mr(e=>e.trim())}function v1(){return mr(e=>e.toLowerCase())}function w1(){return mr(e=>e.toUpperCase())}function k1(){return mr(e=>Nx(e))}function _1(e,t,n){return new e({type:"array",element:t,..._e(n)})}function S1(e,t,n){return new e({type:"custom",check:"custom",fn:t,..._e(n)})}function C1(e){const t=j1(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Hr(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(Hr(o))}},e(n.value,n)));return t}function j1(e,t){const n=new pt({check:"custom",..._e(t)});return n._zod.check=e,n}function jf(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Or,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Xe(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const l=e._zod.toJSONSchema?.();if(l)a.schema=l;else{const d={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,d);else{const h=a.schema,p=t.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,h,d)}const f=e._zod.parent;f&&(a.ref||(a.ref=f),Xe(f,t,d),t.seen.get(f).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(a.schema,c),t.io==="input"&&at(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function Nf(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const a of e.seen.entries()){const l=e.metadataRegistry.get(a[0])?.id;if(l){const c=r.get(l);if(c&&c!==a[0])throw new Error(`Duplicate schema id "${l}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(l,a[0])}}const o=a=>{const l=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const f=e.external.registry.get(a[0])?.id,h=e.external.uri??(y=>y);if(f)return{ref:h(f)};const p=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=p,{defId:p,ref:`${h("__shared")}#/${l}/${p}`}}if(a[1]===n)return{ref:"#"};const u=`#/${l}/`,d=a[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},s=a=>{if(a[1].schema.$ref)return;const l=a[1],{ref:c,defId:u}=o(a);l.def={...l.schema},u&&(l.defId=u);const d=l.schema;for(const f in d)delete d[f];d.$ref=c};if(e.cycles==="throw")for(const a of e.seen.entries()){const l=a[1];if(l.cycle)throw new Error(`Cycle detected: #/${l.cycle?.join("/")}/<root>
|
|
39
39
|
|
|
40
40
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const a of e.seen.entries()){const l=a[1];if(t===a[0]){s(a);continue}if(e.external){const u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){s(a);continue}}if(e.metadataRegistry.get(a[0])?.id){s(a);continue}if(l.cycle){s(a);continue}if(l.count>1&&e.reused==="ref"){s(a);continue}}}function Ef(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=a=>{const l=e.seen.get(a);if(l.ref===null)return;const c=l.def??l.schema,u={...c},d=l.ref;if(l.ref=null,d){r(d);const h=e.seen.get(d),p=h.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(p)):Object.assign(c,p),Object.assign(c,u),a._zod.parent===d)for(const m in c)m==="$ref"||m==="allOf"||m in u||delete c[m];if(p.$ref&&h.def)for(const m in c)m==="$ref"||m==="allOf"||m in h.def&&JSON.stringify(c[m])===JSON.stringify(h.def[m])&&delete c[m]}const f=a._zod.parent;if(f&&f!==d){r(f);const h=e.seen.get(f);if(h?.schema.$ref&&(c.$ref=h.schema.$ref,h.def))for(const p in c)p==="$ref"||p==="allOf"||p in h.def&&JSON.stringify(c[p])===JSON.stringify(h.def[p])&&delete c[p]}e.override({zodSchema:a,jsonSchema:c,path:l.path??[]})};for(const a of[...e.seen.entries()].reverse())r(a[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,n.def??n.schema);const s=e.external?.defs??{};for(const a of e.seen.entries()){const l=a[1];l.def&&l.defId&&(s[l.defId]=l.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Uo(t,"input",e.processors),output:Uo(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function at(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return at(r.element,n);if(r.type==="set")return at(r.valueType,n);if(r.type==="lazy")return at(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return at(r.innerType,n);if(r.type==="intersection")return at(r.left,n)||at(r.right,n);if(r.type==="record"||r.type==="map")return at(r.keyType,n)||at(r.valueType,n);if(r.type==="pipe")return at(r.in,n)||at(r.out,n);if(r.type==="object"){for(const o in r.shape)if(at(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(at(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(at(o,n))return!0;return!!(r.rest&&at(r.rest,n))}return!1}const N1=(e,t={})=>n=>{const r=jf({...n,processors:t});return Xe(e,r),Nf(r,e),Ef(r,e)},Uo=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},a=jf({...o??{},target:s,io:t,processors:n});return Xe(e,a),Nf(a,e),Ef(a,e)},E1={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},T1=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:a,format:l,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof a=="number"&&(o.maxLength=a),l&&(o.format=E1[l]??l,o.format===""&&delete o.format,l==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){const d=[...c];d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},A1=(e,t,n,r)=>{const o=n,{minimum:s,maximum:a,format:l,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;typeof l=="string"&&l.includes("int")?o.type="integer":o.type="number",typeof d=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=d,o.exclusiveMinimum=!0):o.exclusiveMinimum=d),typeof s=="number"&&(o.minimum=s,typeof d=="number"&&t.target!=="draft-04"&&(d>=s?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof a=="number"&&(o.maximum=a,typeof u=="number"&&t.target!=="draft-04"&&(u<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},I1=(e,t,n,r)=>{n.type="boolean"},z1=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},P1=(e,t,n,r)=>{n.not={}},R1=(e,t,n,r)=>{},O1=(e,t,n,r)=>{const o=e._zod.def,s=of(o.entries);s.every(a=>typeof a=="number")&&(n.type="number"),s.every(a=>typeof a=="string")&&(n.type="string"),n.enum=s},M1=(e,t,n,r)=>{const o=e._zod.def,s=[];for(const a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(a))}else s.push(a);if(s.length!==0)if(s.length===1){const a=s[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else s.every(a=>typeof a=="number")&&(n.type="number"),s.every(a=>typeof a=="string")&&(n.type="string"),s.every(a=>typeof a=="boolean")&&(n.type="boolean"),s.every(a=>a===null)&&(n.type="null"),n.enum=s},L1=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},D1=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},F1=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:a,maximum:l}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof l=="number"&&(o.maxItems=l),o.type="array",o.items=Xe(s.element,t,{...r,path:[...r.path,"items"]})},$1=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object",o.properties={};const a=s.shape;for(const u in a)o.properties[u]=Xe(a[u],t,{...r,path:[...r.path,"properties",u]});const l=new Set(Object.keys(a)),c=new Set([...l].filter(u=>{const d=s.shape[u]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));c.size>0&&(o.required=Array.from(c)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=Xe(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},B1=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,a=o.options.map((l,c)=>Xe(l,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=a:n.anyOf=a},U1=(e,t,n,r)=>{const o=e._zod.def,s=Xe(o.left,t,{...r,path:[...r.path,"allOf",0]}),a=Xe(o.right,t,{...r,path:[...r.path,"allOf",1]}),l=u=>"allOf"in u&&Object.keys(u).length===1,c=[...l(s)?s.allOf:[s],...l(a)?a.allOf:[a]];n.allOf=c},H1=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object";const a=s.keyType,c=a._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){const d=Xe(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const f of c)o.patternProperties[f.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Xe(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Xe(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=a._zod.values;if(u){const d=[...u].filter(f=>typeof f=="string"||typeof f=="number");d.length>0&&(o.required=d)}},W1=(e,t,n,r)=>{const o=e._zod.def,s=Xe(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},V1=(e,t,n,r)=>{const o=e._zod.def;Xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Z1=(e,t,n,r)=>{const o=e._zod.def;Xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},q1=(e,t,n,r)=>{const o=e._zod.def;Xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},K1=(e,t,n,r)=>{const o=e._zod.def;Xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},G1=(e,t,n,r)=>{const o=e._zod.def,s=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Xe(s,t,r);const a=t.seen.get(e);a.ref=s},J1=(e,t,n,r)=>{const o=e._zod.def;Xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},Tf=(e,t,n,r)=>{const o=e._zod.def;Xe(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Y1=(e,t,n,r)=>{const o=e._zod.innerType;Xe(o,t,r);const s=t.seen.get(e);s.ref=o},X1=oe("ZodISODateTime",(e,t)=>{K0.init(e,t),Ye.init(e,t)});function Q1(e){return n1(X1,e)}const ey=oe("ZodISODate",(e,t)=>{G0.init(e,t),Ye.init(e,t)});function ty(e){return r1(ey,e)}const ny=oe("ZodISOTime",(e,t)=>{J0.init(e,t),Ye.init(e,t)});function ry(e){return o1(ny,e)}const oy=oe("ZodISODuration",(e,t)=>{Y0.init(e,t),Ye.init(e,t)});function sy(e){return s1(oy,e)}const iy=(e,t)=>{cf.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>$x(e,n)},flatten:{value:n=>Fx(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Mi,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Mi,2)}},isEmpty:{get(){return e.issues.length===0}}})},jt=oe("ZodError",iy,{Parent:Error}),ay=Oa(jt),ly=Ma(jt),cy=xs(jt),uy=bs(jt),dy=Hx(jt),fy=Wx(jt),py=Vx(jt),hy=Zx(jt),my=qx(jt),gy=Kx(jt),xy=Gx(jt),by=Jx(jt),Ke=oe("ZodType",(e,t)=>(qe.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Uo(e,"input"),output:Uo(e,"output")}}),e.toJSONSchema=N1(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(vn(t,{checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(n,r)=>wn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>ay(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>cy(e,n,r),e.parseAsync=async(n,r)=>ly(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>uy(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>dy(e,n,r),e.decode=(n,r)=>fy(e,n,r),e.encodeAsync=async(n,r)=>py(e,n,r),e.decodeAsync=async(n,r)=>hy(e,n,r),e.safeEncode=(n,r)=>my(e,n,r),e.safeDecode=(n,r)=>gy(e,n,r),e.safeEncodeAsync=async(n,r)=>xy(e,n,r),e.safeDecodeAsync=async(n,r)=>by(e,n,r),e.refine=(n,r)=>e.check(hv(n,r)),e.superRefine=n=>e.check(mv(n)),e.overwrite=n=>e.check(mr(n)),e.optional=()=>bc(e),e.exactOptional=()=>Qy(e),e.nullable=()=>yc(e),e.nullish=()=>bc(yc(e)),e.nonoptional=n=>sv(e,n),e.array=()=>ye(e),e.or=n=>sn([e,n]),e.and=n=>qy(e,n),e.transform=n=>vc(e,Yy(n)),e.default=n=>nv(e,n),e.prefault=n=>ov(e,n),e.catch=n=>av(e,n),e.pipe=n=>vc(e,n),e.readonly=()=>uv(e),e.describe=n=>{const r=e.clone();return Or.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return Or.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Or.get(e);const r=e.clone();return Or.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Af=oe("_ZodString",(e,t)=>{La.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(r,o,s)=>T1(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(f1(...r)),e.includes=(...r)=>e.check(m1(...r)),e.startsWith=(...r)=>e.check(g1(...r)),e.endsWith=(...r)=>e.check(x1(...r)),e.min=(...r)=>e.check(Bo(...r)),e.max=(...r)=>e.check(Sf(...r)),e.length=(...r)=>e.check(Cf(...r)),e.nonempty=(...r)=>e.check(Bo(1,...r)),e.lowercase=r=>e.check(p1(r)),e.uppercase=r=>e.check(h1(r)),e.trim=()=>e.check(y1()),e.normalize=(...r)=>e.check(b1(...r)),e.toLowerCase=()=>e.check(v1()),e.toUpperCase=()=>e.check(w1()),e.slugify=()=>e.check(k1())}),yy=oe("ZodString",(e,t)=>{La.init(e,t),Af.init(e,t),e.email=n=>e.check(Ob(vy,n)),e.url=n=>e.check($b(wy,n)),e.jwt=n=>e.check(t1(My,n)),e.emoji=n=>e.check(Bb(ky,n)),e.guid=n=>e.check(fc(gc,n)),e.uuid=n=>e.check(Mb(fo,n)),e.uuidv4=n=>e.check(Lb(fo,n)),e.uuidv6=n=>e.check(Db(fo,n)),e.uuidv7=n=>e.check(Fb(fo,n)),e.nanoid=n=>e.check(Ub(_y,n)),e.guid=n=>e.check(fc(gc,n)),e.cuid=n=>e.check(Hb(Sy,n)),e.cuid2=n=>e.check(Wb(Cy,n)),e.ulid=n=>e.check(Vb(jy,n)),e.base64=n=>e.check(Xb(Py,n)),e.base64url=n=>e.check(Qb(Ry,n)),e.xid=n=>e.check(Zb(Ny,n)),e.ksuid=n=>e.check(qb(Ey,n)),e.ipv4=n=>e.check(Kb(Ty,n)),e.ipv6=n=>e.check(Gb(Ay,n)),e.cidrv4=n=>e.check(Jb(Iy,n)),e.cidrv6=n=>e.check(Yb(zy,n)),e.e164=n=>e.check(e1(Oy,n)),e.datetime=n=>e.check(Q1(n)),e.date=n=>e.check(ty(n)),e.time=n=>e.check(ry(n)),e.duration=n=>e.check(sy(n))});function I(e){return Rb(yy,e)}const Ye=oe("ZodStringFormat",(e,t)=>{Ge.init(e,t),Af.init(e,t)}),vy=oe("ZodEmail",(e,t)=>{F0.init(e,t),Ye.init(e,t)}),gc=oe("ZodGUID",(e,t)=>{L0.init(e,t),Ye.init(e,t)}),fo=oe("ZodUUID",(e,t)=>{D0.init(e,t),Ye.init(e,t)}),wy=oe("ZodURL",(e,t)=>{$0.init(e,t),Ye.init(e,t)}),ky=oe("ZodEmoji",(e,t)=>{B0.init(e,t),Ye.init(e,t)}),_y=oe("ZodNanoID",(e,t)=>{U0.init(e,t),Ye.init(e,t)}),Sy=oe("ZodCUID",(e,t)=>{H0.init(e,t),Ye.init(e,t)}),Cy=oe("ZodCUID2",(e,t)=>{W0.init(e,t),Ye.init(e,t)}),jy=oe("ZodULID",(e,t)=>{V0.init(e,t),Ye.init(e,t)}),Ny=oe("ZodXID",(e,t)=>{Z0.init(e,t),Ye.init(e,t)}),Ey=oe("ZodKSUID",(e,t)=>{q0.init(e,t),Ye.init(e,t)}),Ty=oe("ZodIPv4",(e,t)=>{X0.init(e,t),Ye.init(e,t)}),Ay=oe("ZodIPv6",(e,t)=>{Q0.init(e,t),Ye.init(e,t)}),Iy=oe("ZodCIDRv4",(e,t)=>{eb.init(e,t),Ye.init(e,t)}),zy=oe("ZodCIDRv6",(e,t)=>{tb.init(e,t),Ye.init(e,t)}),Py=oe("ZodBase64",(e,t)=>{nb.init(e,t),Ye.init(e,t)}),Ry=oe("ZodBase64URL",(e,t)=>{ob.init(e,t),Ye.init(e,t)}),Oy=oe("ZodE164",(e,t)=>{sb.init(e,t),Ye.init(e,t)}),My=oe("ZodJWT",(e,t)=>{ab.init(e,t),Ye.init(e,t)}),If=oe("ZodNumber",(e,t)=>{yf.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(r,o,s)=>A1(e,r,o),e.gt=(r,o)=>e.check(hc(r,o)),e.gte=(r,o)=>e.check(Qs(r,o)),e.min=(r,o)=>e.check(Qs(r,o)),e.lt=(r,o)=>e.check(pc(r,o)),e.lte=(r,o)=>e.check(Xs(r,o)),e.max=(r,o)=>e.check(Xs(r,o)),e.int=r=>e.check(xc(r)),e.safe=r=>e.check(xc(r)),e.positive=r=>e.check(hc(0,r)),e.nonnegative=r=>e.check(Qs(0,r)),e.negative=r=>e.check(pc(0,r)),e.nonpositive=r=>e.check(Xs(0,r)),e.multipleOf=(r,o)=>e.check(mc(r,o)),e.step=(r,o)=>e.check(mc(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function se(e){return i1(If,e)}const Ly=oe("ZodNumberFormat",(e,t)=>{lb.init(e,t),If.init(e,t)});function xc(e){return a1(Ly,e)}const Dy=oe("ZodBoolean",(e,t)=>{cb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>I1(e,n,r)});function He(e){return l1(Dy,e)}const Fy=oe("ZodNull",(e,t)=>{ub.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>z1(e,n,r)});function Di(e){return c1(Fy,e)}const $y=oe("ZodUnknown",(e,t)=>{db.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>R1()});function Fi(){return u1($y)}const By=oe("ZodNever",(e,t)=>{fb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>P1(e,n,r)});function Uy(e){return d1(By,e)}const Hy=oe("ZodArray",(e,t)=>{pb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>F1(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(Bo(n,r)),e.nonempty=n=>e.check(Bo(1,n)),e.max=(n,r)=>e.check(Sf(n,r)),e.length=(n,r)=>e.check(Cf(n,r)),e.unwrap=()=>e.element});function ye(e,t){return _1(Hy,e,t)}const Wy=oe("ZodObject",(e,t)=>{mb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$1(e,n,r,o),Pe(e,"shape",()=>t.shape),e.keyof=()=>Re(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Fi()}),e.loose=()=>e.clone({...e._zod.def,catchall:Fi()}),e.strict=()=>e.clone({...e._zod.def,catchall:Uy()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Rx(e,n),e.safeExtend=n=>Ox(e,n),e.merge=n=>Mx(e,n),e.pick=n=>zx(e,n),e.omit=n=>Px(e,n),e.partial=(...n)=>Lx(Pf,e,n[0]),e.required=(...n)=>Dx(Rf,e,n[0])});function re(e,t){const n={type:"object",shape:e??{},..._e(t)};return new Wy(n)}const zf=oe("ZodUnion",(e,t)=>{kf.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>B1(e,n,r,o),e.options=t.options});function sn(e,t){return new zf({type:"union",options:e,..._e(t)})}const Vy=oe("ZodDiscriminatedUnion",(e,t)=>{zf.init(e,t),gb.init(e,t)});function Fn(e,t,n){return new Vy({type:"union",options:t,discriminator:e,..._e(n)})}const Zy=oe("ZodIntersection",(e,t)=>{xb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>U1(e,n,r,o)});function qy(e,t){return new Zy({type:"intersection",left:e,right:t})}const Ky=oe("ZodRecord",(e,t)=>{bb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>H1(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function rt(e,t,n){return new Ky({type:"record",keyType:e,valueType:t,..._e(n)})}const $i=oe("ZodEnum",(e,t)=>{yb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(r,o,s)=>O1(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const a of r)if(n.has(a))s[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new $i({...t,checks:[],..._e(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const a of r)if(n.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new $i({...t,checks:[],..._e(o),entries:s})}});function Re(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new $i({type:"enum",entries:n,..._e(t)})}const Gy=oe("ZodLiteral",(e,t)=>{vb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>M1(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Ne(e,t){return new Gy({type:"literal",values:Array.isArray(e)?e:[e],..._e(t)})}const Jy=oe("ZodTransform",(e,t)=>{wb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>D1(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new nf(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Hr(s,n.value,t));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=e),n.issues.push(Hr(a))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function Yy(e){return new Jy({type:"transform",transform:e})}const Pf=oe("ZodOptional",(e,t)=>{_f.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Tf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function bc(e){return new Pf({type:"optional",innerType:e})}const Xy=oe("ZodExactOptional",(e,t)=>{kb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Tf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Qy(e){return new Xy({type:"optional",innerType:e})}const ev=oe("ZodNullable",(e,t)=>{_b.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>W1(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function yc(e){return new ev({type:"nullable",innerType:e})}const tv=oe("ZodDefault",(e,t)=>{Sb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Z1(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function nv(e,t){return new tv({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():af(t)}})}const rv=oe("ZodPrefault",(e,t)=>{Cb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>q1(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ov(e,t){return new rv({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():af(t)}})}const Rf=oe("ZodNonOptional",(e,t)=>{jb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>V1(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function sv(e,t){return new Rf({type:"nonoptional",innerType:e,..._e(t)})}const iv=oe("ZodCatch",(e,t)=>{Nb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>K1(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function av(e,t){return new iv({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const lv=oe("ZodPipe",(e,t)=>{Eb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>G1(e,n,r,o),e.in=t.in,e.out=t.out});function vc(e,t){return new lv({type:"pipe",in:e,out:t})}const cv=oe("ZodReadonly",(e,t)=>{Tb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>J1(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function uv(e){return new cv({type:"readonly",innerType:e})}const dv=oe("ZodLazy",(e,t)=>{Ab.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Y1(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function fv(e){return new dv({type:"lazy",getter:e})}const pv=oe("ZodCustom",(e,t)=>{Ib.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>L1(e,n)});function hv(e,t={}){return S1(pv,e,t)}function mv(e){return C1(e)}const ft=fv(()=>sn([I(),se(),He(),Di(),ye(ft),rt(I(),ft)]));const Of=re({index:se(),timestamp:se(),type:I(),data:ft}),gv=re({chunks:ye(Of),truncated:He().optional().default(!1)}),Ho=re({id:se(),timestamp:I(),method:I(),path:I(),model:I().nullable(),sessionId:I().nullable(),rawRequestBody:I().nullable(),responseStatus:se().nullable(),responseText:I().nullable(),inputTokens:se().nullable(),outputTokens:se().nullable(),cacheCreationInputTokens:se().nullable(),cacheReadInputTokens:se().nullable(),elapsedMs:se().nullable(),firstChunkMs:se().nullable().optional(),totalStreamMs:se().nullable().optional(),tokensPerSecond:se().nullable().optional(),streaming:He(),userAgent:I().nullable(),origin:I().nullable(),rawHeaders:rt(I(),I()).optional(),headers:rt(I(),I()).optional(),apiFormat:Re(["anthropic","openai","unknown"]).default("unknown"),isTest:He().optional().default(!1),replayOfLogId:se().nullable().optional(),providerName:I().nullable().optional(),clientPort:se().nullable().optional(),clientPid:se().nullable().optional(),clientCwd:I().nullable().optional(),clientProjectFolder:I().nullable().optional(),streamingChunks:gv.optional(),streamingChunksPath:I().nullable().optional(),rawRequestBodyBytes:se().int().nonnegative().nullable().optional(),responseTextBytes:se().int().nonnegative().nullable().optional(),bodyContentMode:Re(["full","compact","truncated"]).optional(),warnings:ye(I()).optional(),error:I().nullable().optional()}),Da=re({type:I(),ttl:I().optional(),scope:I().optional()}),Fa=re({type:Ne("text"),text:I(),cache_control:Da.optional()}),Mf=re({type:Ne("thinking"),thinking:I(),signature:I().optional()}),xv=re({type:Ne("think"),thinking:I(),signature:I().optional()}),bv=re({type:Ne("base64"),media_type:I(),data:I()}),Lf=re({type:Ne("image"),source:bv}),Df=re({type:Ne("tool_use"),id:I(),name:I(),input:rt(I(),ft)}),yv=Fn("type",[Fa,Lf]),vv=re({type:Ne("tool_result"),tool_use_id:I().optional(),content:sn([I(),ye(yv)]),is_error:He().optional()}),wv=Fn("type",[Fa,Mf,Lf,Df,vv]),kv=sn([I(),ye(wv)]),_v=re({role:Re(["user","assistant"]),content:kv}),Sv=re({type:Ne("text"),text:I(),cache_control:Da.optional()}),Cv=re({type:I(),properties:rt(I(),rt(I(),ft)).optional(),required:ye(I()).optional(),additionalProperties:He().optional(),$schema:I().optional()}),jv=re({name:I(),description:I().optional(),input_schema:Cv.optional(),cache_control:Da.optional()}),Nv=Fn("type",[re({type:Ne("enabled"),budget_tokens:se()}),re({type:Ne("disabled")}),re({type:Ne("adaptive")})]),Ff=re({model:I(),messages:ye(_v),system:ye(Sv).optional(),tools:ye(jv).optional(),max_tokens:se().optional(),temperature:se().optional(),stream:He().optional(),thinking:Nv.optional(),metadata:re({user_id:I().optional()}).optional()}),$a=Fn("type",[Fa,Mf,xv,Df]),Ev=re({input_tokens:se().nullable().optional(),output_tokens:se().nullable().optional(),cache_creation_input_tokens:se().nullable().optional(),cache_read_input_tokens:se().nullable().optional()}).passthrough(),$f=re({id:I(),type:Ne("message"),model:I(),role:Ne("assistant"),content:ye($a),stop_reason:I().nullable(),stop_sequence:I().nullable().optional(),usage:Ev}).passthrough(),Tv=re({type:Ne("message_start"),message:re({id:I(),type:Ne("message"),model:I(),role:Ne("assistant"),content:ye($a),stop_reason:Di(),stop_sequence:Di(),usage:re({input_tokens:se(),cache_creation_input_tokens:se().optional(),cache_read_input_tokens:se().optional()}).passthrough()})}),Av=re({type:Ne("content_block_start"),index:se(),content_block:$a}),Iv=Fn("type",[re({type:Ne("text_delta"),text:I()}),re({type:Ne("input_json_delta"),partial_json:I()}),re({type:Ne("thinking_delta"),thinking:I()}),re({type:Ne("signature_delta"),signature:I()})]),zv=re({type:Ne("content_block_delta"),index:se(),delta:Iv}),Pv=re({type:Ne("content_block_stop"),index:se()}),Rv=re({type:Ne("message_delta"),delta:re({stop_reason:I().nullable(),stop_sequence:I().nullable().optional()}),usage:re({output_tokens:se(),input_tokens:se().optional(),cache_creation_input_tokens:se().optional(),cache_read_input_tokens:se().optional()}).passthrough()}),Ov=re({type:Ne("message_stop")}),Mv=re({type:Ne("ping")}),Lv=re({type:Ne("error"),error:re({type:I(),message:I()})}),Dv=Fn("type",[Tv,Av,zv,Pv,Rv,Ov,Mv,Lv]),Fv=sn([I(),ye(Fn("type",[re({type:Ne("text"),text:I()}),re({type:Ne("image_url"),image_url:re({url:I(),detail:I().optional()})})]))]),Bf=re({role:Re(["system","user","assistant","tool"]),content:Fv,name:I().optional(),reasoning_content:I().optional(),thinking:I().optional(),think:I().optional()}),$v=re({name:I(),arguments:I()}),Uf=re({index:se().optional(),id:I().optional(),type:Ne("function").optional(),function:re({name:I().optional(),arguments:I().optional()})});Bf.extend({content:sn([I(),ye(re({type:Ne("text"),text:I()}))]).optional(),function_call:$v.optional(),tool_calls:ye(Uf).optional()});const Bv=re({type:Ne("function"),function:re({name:I(),description:I().optional(),parameters:rt(I(),ft)})}),Hf=re({model:I(),messages:ye(Bf),temperature:se().optional(),max_tokens:se().optional(),stream:He().optional(),tools:ye(Bv).optional(),tool_choice:sn([Re(["auto","none","required"]),re({type:Ne("auto")}),re({type:Ne("none")}),re({type:Ne("function"),function:re({name:I()})})]).optional(),user:I().optional()}),Wf=re({role:Re(["assistant"]).optional(),content:I().nullable().optional(),reasoning_content:I().nullable().optional(),thinking:I().nullable().optional(),think:I().nullable().optional(),function_call:re({name:I().optional(),arguments:I().optional()}).nullable().optional(),tool_calls:ye(re({index:se(),id:I().optional(),type:Ne("function").optional(),function:re({name:I().optional(),arguments:I().optional()})})).nullable().optional()}),Uv=re({index:se(),message:re({role:Re(["assistant"]),content:I().nullable(),reasoning_content:I().optional(),thinking:I().optional(),think:I().optional(),function_call:re({name:I(),arguments:I()}).nullable().optional(),tool_calls:ye(Uf).optional()}).optional(),delta:Wf.optional(),finish_reason:I().nullable()}),Hv=re({id:I(),object:Ne("chat.completion"),created:se(),model:I(),choices:ye(Uv),usage:re({prompt_tokens:se().nullable().optional(),completion_tokens:se().nullable().optional(),total_tokens:se().nullable().optional()}).passthrough(),service_tier:I().nullable().optional(),system_fingerprint:I().nullable().optional()}).passthrough(),Wv=re({id:I(),object:Ne("chat.completion.chunk"),created:se(),model:I(),choices:ye(re({index:se(),delta:Wf,finish_reason:I().nullable().optional()})),usage:re({prompt_tokens:se().nullable().optional(),completion_tokens:se().nullable().optional(),total_tokens:se().nullable().optional()}).passthrough().nullable().optional()}).passthrough();function Vf(e){try{const t=JSON.parse(e),n=Hv.safeParse(t);return n.success?n.data:null}catch{return null}}const Vv=re({error:I()});async function zt(e,t){const n=await e.json();return t.parse(n)}async function tn(e,t){try{const n=await e.json(),r=Vv.safeParse(n);return r.success?r.data.error:t}catch{return t}}async function an(e,t,n,r){const o=await fetch(e,n);if(!o.ok){const s=r?.(o)??`Request failed with status ${o.status}`;throw new Error(await tn(o,s))}return zt(o,t)}const Zf=re({input:se().int().nonnegative(),output:se().int().nonnegative(),cacheCreate:se().int().nonnegative(),cacheRead:se().int().nonnegative(),total:se().int().nonnegative()}),Zv=re({id:se().int().positive(),timestamp:I(),provider:I().nullable(),model:I().nullable(),apiFormat:Re(["anthropic","openai","unknown"]),method:I(),path:I(),status:se().nullable(),isStreaming:He(),hasError:He(),error:I().nullable(),latencyMs:se().nullable(),firstChunkMs:se().nullable().optional(),totalStreamMs:se().nullable().optional(),tokensPerSecond:se().nullable().optional(),tokens:re({input:se().nullable(),output:se().nullable(),cacheCreate:se().nullable(),cacheRead:se().nullable()}),sessionId:I().nullable()}),qf=re({id:I(),status:Re(["active","failed","completed","empty"]),logCoverage:Re(["recent","history"]),source:Re(["explicit","client-process","client-connection","provider-test"]).nullable(),runtimeMode:Re(["in-process","worker-thread","child-process"]).nullable(),createdAt:I().nullable(),updatedAt:I().nullable(),requestCount:se().int().nonnegative(),activeRequests:se().int().nonnegative(),completedRequests:se().int().nonnegative(),failedRequests:se().int().nonnegative(),queuedTasks:se().int().nonnegative(),runningTasks:se().int().nonnegative(),lastTaskError:I().nullable(),logCount:se().int().nonnegative(),errorCount:se().int().nonnegative(),models:ye(I()),providers:ye(I()),tokenUsage:Zf,lastLogId:se().nullable(),lastModel:I().nullable(),clientPid:se().nullable(),clientProjectFolder:I().nullable(),inspectorPath:I(),inspectorUrl:I(),apiPath:I(),apiUrl:I(),compactLogsPath:I(),compactLogsUrl:I(),latestLogLimit:se().int().positive(),latestLogs:ye(Zv)}),Qr=Re(["created","running","completed","failed","cancelled"]),Ba=re({jsonPath:I(),markdownPath:I(),htmlPath:I(),exportedAt:I()}),qv=Re(["run-created","session-started","request","session-finished","evidence-exported"]),Kv=Re(["info","success","warning","error"]),Gv=re({timestamp:I(),kind:qv,severity:Kv,title:I(),details:I(),logId:se().int().positive().nullable(),status:se().nullable(),model:I().nullable(),provider:I().nullable(),latencyMs:se().nullable(),isStreaming:He().nullable()}),Jv=Re(["none","active","provider-timeout","provider-http-error","provider-auth-error","provider-rate-limit","network-or-container","streaming-mismatch","context-pressure","runtime-task-error","model-output-error","unknown-failure","no-session-data"]),Kf=re({outcome:Re(["success","failure","active","unknown"]),severity:Re(["none","low","medium","high"]),category:Jv,summary:I(),evidenceLogIds:ye(se().int().positive()),hints:ye(I())}),Ua=re({status:Re(["PASS","FAIL","RUNNING","UNKNOWN"]),summary:I(),markdown:I()}),Gf=Ua,Ha=re({id:I(),sessionId:I(),groupId:I().nullable().default(null),title:I(),task:I().nullable(),project:I().nullable(),agent:I().nullable(),status:Qr,tags:ye(I()),metadata:rt(I(),ft),evidence:Ba.nullable(),createdAt:I(),updatedAt:I()});re({runId:I().min(1).optional(),sessionId:I().min(1).optional(),groupId:I().min(1).nullable().optional(),title:I().min(1).optional(),task:I().nullable().optional(),project:I().nullable().optional(),agent:I().nullable().optional(),status:Qr.optional(),tags:ye(I()).optional(),metadata:rt(I(),ft).optional()}).optional();re({sessionId:I().min(1).optional(),groupId:I().min(1).nullable().optional(),title:I().min(1).optional(),task:I().nullable().optional(),project:I().nullable().optional(),agent:I().nullable().optional(),status:Qr.optional(),tags:ye(I()).optional(),metadata:rt(I(),ft).optional()});re({includeHistory:He().optional(),latestLogLimit:se().int().positive().max(50).optional()}).optional();re({run:Ha,evidence:Ba,session:qf.nullable(),timeline:ye(Gv),classification:Kf,jenkinsReport:Ua});const Yv=re({run:Ha,classification:Kf,evidence:Ba.nullable(),jenkinsReport:Ua.nullable(),sessionId:I(),inspectorUrl:I().nullable(),evidenceMarkdownPath:I().nullable(),updatedAt:I()});re({failures:ye(Yv),total:se().int().nonnegative(),limit:se().int().positive()});const Wa=Re(["created","running","completed","failed","cancelled"]),Va=Re(["evaluation","batch","manual"]),Za=re({jsonPath:I(),markdownPath:I(),htmlPath:I(),exportedAt:I()}),Jf=re({id:I(),groupId:I(),sessionId:I(),runId:I().nullable(),label:I().nullable(),agent:I().nullable(),provider:I().nullable(),model:I().nullable(),status:Qr.nullable(),metadata:rt(I(),ft),addedAt:I(),updatedAt:I()}),qa=re({id:I(),title:I(),kind:Va,task:I().nullable(),project:I().nullable(),status:Wa,tags:ye(I()),metadata:rt(I(),ft),evidence:Za.nullable(),members:ye(Jf),createdAt:I(),updatedAt:I()});re({groupId:I().min(1).optional(),title:I().min(1).optional(),kind:Va.optional(),task:I().nullable().optional(),project:I().nullable().optional(),status:Wa.optional(),tags:ye(I()).optional(),metadata:rt(I(),ft).optional()}).optional();re({title:I().min(1).optional(),kind:Va.optional(),task:I().nullable().optional(),project:I().nullable().optional(),status:Wa.optional(),tags:ye(I()).optional(),metadata:rt(I(),ft).optional()});re({memberId:I().min(1).optional(),sessionId:I().min(1),runId:I().min(1).nullable().optional(),label:I().min(1).nullable().optional(),agent:I().min(1).nullable().optional(),provider:I().min(1).nullable().optional(),model:I().min(1).nullable().optional(),status:Qr.nullable().optional(),metadata:rt(I(),ft).optional()});re({includeHistory:He().optional(),latestLogLimit:se().int().positive().max(50).optional()}).optional();re({deleteEvidence:He().optional()});const Xv=re({groupId:I(),deleted:He(),evidenceDeleted:He(),evidencePath:I().nullable()}),Qv=re({member:Jf,run:Ha.nullable(),session:qf.nullable()}),Yf=re({memberCount:se().int().nonnegative(),sessionsWithData:se().int().nonnegative(),missingSessions:se().int().nonnegative(),requestCount:se().int().nonnegative(),errorCount:se().int().nonnegative(),tokenUsage:Zf,models:ye(I()),providers:ye(I()),completedMembers:se().int().nonnegative(),failedMembers:se().int().nonnegative(),runningMembers:se().int().nonnegative()}),e2=re({group:qa,evidence:Za,markdown:I(),summary:Yf.nullable(),report:Gf.nullable()}),t2=re({group:qa,evidence:Za,members:ye(Qv),summary:Yf,jenkinsReport:Gf}),Xf=re({groups:ye(qa)}),Wo=10,Bi=600,Vo=60,Ui=600,Zo="time",Ka="simple",Qf=Re(["time","full"]),n2=Re(["simple","full"]),vs=re({stripClaudeCodeBillingHeader:He(),hasSeenOnboarding:He().default(!1),slowResponseThresholdSeconds:se().int().min(0).max(Bi).default(Wo),providerTestTimeoutSeconds:se().int().min(1).max(Ui).default(Vo),timeDisplayFormat:Qf.default(Zo),captureMode:n2.default(Ka)}),Yn="/api/config";async function r2(e){return an(e,vs,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function po(e){return an(Yn,vs,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function Ga(){const e=Yr(Yn,r2,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=Qd(),n=e.data?.stripClaudeCodeBillingHeader??!1,r=e.data?.captureMode??Ka,o=e.data?.slowResponseThresholdSeconds??Wo,s=e.data?.providerTestTimeoutSeconds??Vo,a=e.data?.timeDisplayFormat??Zo,l=h=>({stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:e.data?.hasSeenOnboarding??!1,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??Wo,providerTestTimeoutSeconds:e.data?.providerTestTimeoutSeconds??Vo,timeDisplayFormat:e.data?.timeDisplayFormat??Zo,captureMode:r,...h}),c=async h=>{await t(Yn,po({stripClaudeCodeBillingHeader:h}),{optimisticData:l({stripClaudeCodeBillingHeader:h}),rollbackOnError:!0,revalidate:!1})},u=async h=>{await t(Yn,po({slowResponseThresholdSeconds:h}),{optimisticData:l({slowResponseThresholdSeconds:h}),rollbackOnError:!0,revalidate:!1})},d=async h=>{await t(Yn,po({timeDisplayFormat:h}),{optimisticData:l({timeDisplayFormat:h}),rollbackOnError:!0,revalidate:!1})},f=async h=>{await t(Yn,po({providerTestTimeoutSeconds:h}),{optimisticData:l({providerTestTimeoutSeconds:h}),rollbackOnError:!0,revalidate:!1})};return{strip:n,captureMode:r,slowResponseThresholdSeconds:o,providerTestTimeoutSeconds:s,timeDisplayFormat:a,isLoading:e.isLoading,isError:e.error!==void 0,setStrip:c,setSlowResponseThresholdSeconds:u,setProviderTestTimeoutSeconds:f,setTimeDisplayFormat:d}}const ep=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const o2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const s2=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const wc=e=>{const t=s2(e);return t.charAt(0).toUpperCase()+t.slice(1)};var i2={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const a2=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const l2=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:a,...l},c)=>g.createElement("svg",{ref:c,...i2,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:ep("lucide",o),...!s&&!a2(l)&&{"aria-hidden":"true"},...l},[...a.map(([u,d])=>g.createElement(u,d)),...Array.isArray(s)?s:[s]]));const be=(e,t)=>{const n=g.forwardRef(({className:r,...o},s)=>g.createElement(l2,{ref:s,iconNode:t,className:ep(`lucide-${o2(wc(e))}`,`lucide-${e}`,r),...o}));return n.displayName=wc(e),n};const c2=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],u2=be("arrow-down-right",c2);const d2=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],f2=be("arrow-down",d2);const p2=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],h2=be("arrow-left",p2);const m2=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],g2=be("arrow-up-right",m2);const x2=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],b2=be("arrow-up",x2);const y2=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],v2=be("blocks",y2);const w2=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],tp=be("brain",w2);const k2=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],et=be("check",k2);const _2=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],wt=be("chevron-down",_2);const S2=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],C2=be("chevron-left",S2);const j2=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Kt=be("chevron-right",j2);const N2=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Ja=be("chevron-up",N2);const E2=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],np=be("chevrons-down",E2);const T2=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],A2=be("chevrons-left",T2);const I2=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],z2=be("chevrons-right",I2);const P2=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],R2=be("chevrons-up",P2);const O2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Wr=be("circle-alert",O2);const M2=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],L2=be("circle-check-big",M2);const D2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],kc=be("circle-check",D2);const F2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],$2=be("circle-question-mark",F2);const B2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],rp=be("circle-x",B2);const U2=[["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z",key:"1tn4o7"}],["path",{d:"m6.2 5.3 3.1 3.9",key:"iuk76l"}],["path",{d:"m12.4 3.4 3.1 4",key:"6hsd6n"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z",key:"ltgou9"}]],H2=be("clapperboard",U2);const W2=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],xn=be("clock",W2);const V2=[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]],Z2=be("cloud-upload",V2);const q2=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],K2=be("code-xml",q2);const G2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],J2=be("columns-2",G2);const Y2=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],kt=be("copy",Y2);const X2=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],ws=be("download",X2);const Q2=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],ew=be("ellipsis",Q2);const tw=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Ya=be("external-link",tw);const nw=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Xa=be("eye-off",nw);const rw=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Qa=be("eye",rw);const ow=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],sw=be("file-braces",ow);const iw=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]],aw=be("file-diff",iw);const lw=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],cw=be("file-search",lw);const uw=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m8 16 2-2-2-2",key:"10vzyd"}],["path",{d:"M12 18h4",key:"1wd2n7"}]],dw=be("file-terminal",uw);const fw=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],pw=be("file-text",fw);const hw=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],el=be("gauge",hw);const mw=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]],gw=be("git-compare-arrows",mw);const xw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],op=be("globe",xw);const bw=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],yw=be("history",bw);const vw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],ww=be("info",vw);const kw=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],_c=be("layers",kw);const _w=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Vt=be("loader-circle",_w);const Sw=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Cw=be("lock",Sw);const jw=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],ks=be("message-square",jw);const Nw=[["path",{d:"M5 12h14",key:"1ays0h"}]],Ew=be("minus",Nw);const Tw=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],Aw=be("mouse-pointer-click",Tw);const Iw=[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]],zw=be("octagon-alert",Iw);const Pw=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],sp=be("pencil",Pw);const Rw=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Hi=be("plus",Rw);const Ow=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Sc=be("radio",Ow);const Mw=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Wi=be("refresh-cw",Mw);const Lw=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Dw=be("rotate-ccw",Lw);const Fw=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Vi=be("rotate-cw",Fw);const $w=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]],Bw=be("rows-3",$w);const Uw=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],Hw=be("save",Uw);const Ww=[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]],Vw=be("scan",Ww);const Zw=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],qw=be("search",Zw);const Kw=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],Gw=be("server",Kw);const Jw=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Yw=be("settings",Jw);const Xw=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Cc=be("shield-check",Xw);const Qw=[["path",{d:"M7 18v-6a5 5 0 1 1 10 0v6",key:"pcx96s"}],["path",{d:"M5 21a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2z",key:"1b4s83"}],["path",{d:"M21 12h1",key:"jtio3y"}],["path",{d:"M18.5 4.5 18 5",key:"g5sp9y"}],["path",{d:"M2 12h1",key:"1uaihz"}],["path",{d:"M12 2v1",key:"11qlp1"}],["path",{d:"m4.929 4.929.707.707",key:"1i51kw"}],["path",{d:"M12 12v6",key:"3ahymv"}]],ek=be("siren",Qw);const tk=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],tl=be("terminal",tk);const nk=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ur=be("trash-2",nk);const rk=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],tr=be("triangle-alert",rk);const ok=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],sk=be("upload",ok);const ik=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],ak=be("user",ik);const lk=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],ck=be("wifi-off",lk);const uk=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],dk=be("wifi",uk);const fk=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],eo=be("wrench",fk);const pk=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],nl=be("x",pk);const hk=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Vr=be("zap",hk),Zi="/api/config";async function mk(e){return an(e,vs,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function gk(e){return an(Zi,vs,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function xk(){const e=Yr(Zi,mk,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=Qd(),n=e.data?.hasSeenOnboarding??!1,r=e.data?.captureMode??Ka,o=async()=>{await t(Zi,gk({hasSeenOnboarding:!0}),{optimisticData:{stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:!0,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??Wo,providerTestTimeoutSeconds:e.data?.providerTestTimeoutSeconds??Vo,timeDisplayFormat:e.data?.timeDisplayFormat??Zo,captureMode:r},rollbackOnError:!0,revalidate:!1})};return{hasSeenOnboarding:n,captureMode:r,isLoading:e.isLoading,markSeen:o}}function bk(){const{hasSeenOnboarding:e,isLoading:t,markSeen:n}=xk(),[r,o]=g.useState(!1);if(t||e)return null;const s=r?"grid":"hidden sm:grid";return i.jsx("div",{role:"note","aria-label":"Onboarding tip",className:"mx-4 mt-2 mb-1 rounded-md border border-amber-500/30 bg-[#130d04] px-3 py-2 text-sm shadow-[0_12px_40px_rgba(0,0,0,0.16)]",children:i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(ww,{className:"mt-0.5 size-4 shrink-0 text-amber-300","aria-hidden":"true"}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[i.jsx("span",{className:"font-medium text-amber-200",children:"Inspector ready"}),i.jsx("span",{className:"hidden truncate text-xs text-muted-foreground sm:inline",children:"Request, response, tool, timing, token, replay, and memory signals are active."})]}),i.jsx("div",{className:"mt-1 text-xs leading-relaxed text-muted-foreground sm:hidden",children:"Core capture is active."}),i.jsxs("div",{className:`${s} mt-2 gap-x-4 gap-y-1 text-xs leading-relaxed text-muted-foreground sm:grid-cols-2`,children:[i.jsxs("div",{children:[i.jsx("strong",{children:"Evidence"}),": logs, sessions, groups, and MCP exports are available."]}),i.jsxs("div",{children:[i.jsx("strong",{children:"Network"}),": replace ",i.jsx("code",{children:"localhost"})," if containers differ."]})]})]}),i.jsx("button",{type:"button",onClick:()=>o(a=>!a),className:"inline-flex h-8 shrink-0 items-center gap-1 rounded-md border border-amber-500/30 px-2 text-xs text-amber-200 transition-colors hover:bg-amber-500/10 sm:hidden","aria-expanded":r,"aria-label":r?"Hide onboarding details":"Show onboarding details",children:i.jsx(wt,{className:`size-3.5 transition-transform ${r?"rotate-180":""}`})}),i.jsxs("button",{type:"button",onClick:()=>{n()},className:"hidden h-8 shrink-0 items-center gap-1.5 rounded-md border border-amber-500/40 px-3 text-xs text-amber-200 transition-colors hover:bg-amber-500/10 sm:inline-flex","aria-label":"Dismiss onboarding tip",children:[i.jsx(et,{className:"size-3.5"}),"Got it"]}),i.jsx("button",{type:"button",onClick:()=>{n()},className:"-m-1 shrink-0 p-1 text-muted-foreground transition-colors hover:text-foreground","aria-label":"Dismiss",children:i.jsx(nl,{className:"size-3.5"})})]})})}function ho(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ei={exports:{}};var jc;function yk(){return jc||(jc=1,(function(e,t){(function(n){e.exports=n()})(function(){return(function n(r,o,s){function a(u,d){if(!o[u]){if(!r[u]){var f=typeof ho=="function"&&ho;if(!d&&f)return f(u,!0);if(l)return l(u,!0);var h=new Error("Cannot find module '"+u+"'");throw h.code="MODULE_NOT_FOUND",h}var p=o[u]={exports:{}};r[u][0].call(p.exports,function(y){var m=r[u][1][y];return a(m||y)},p,p.exports,n,r,o,s)}return o[u].exports}for(var l=typeof ho=="function"&&ho,c=0;c<s.length;c++)a(s[c]);return a})({1:[function(n,r,o){var s=n("./utils"),a=n("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(c){for(var u,d,f,h,p,y,m,x=[],b=0,v=c.length,w=v,C=s.getTypeOf(c)!=="string";b<c.length;)w=v-b,f=C?(u=c[b++],d=b<v?c[b++]:0,b<v?c[b++]:0):(u=c.charCodeAt(b++),d=b<v?c.charCodeAt(b++):0,b<v?c.charCodeAt(b++):0),h=u>>2,p=(3&u)<<4|d>>4,y=1<w?(15&d)<<2|f>>6:64,m=2<w?63&f:64,x.push(l.charAt(h)+l.charAt(p)+l.charAt(y)+l.charAt(m));return x.join("")},o.decode=function(c){var u,d,f,h,p,y,m=0,x=0,b="data:";if(c.substr(0,b.length)===b)throw new Error("Invalid base64 input, it looks like a data url.");var v,w=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&w--,c.charAt(c.length-2)===l.charAt(64)&&w--,w%1!=0)throw new Error("Invalid base64 input, bad content length.");for(v=a.uint8array?new Uint8Array(0|w):new Array(0|w);m<c.length;)u=l.indexOf(c.charAt(m++))<<2|(h=l.indexOf(c.charAt(m++)))>>4,d=(15&h)<<4|(p=l.indexOf(c.charAt(m++)))>>2,f=(3&p)<<6|(y=l.indexOf(c.charAt(m++))),v[x++]=u,p!==64&&(v[x++]=d),y!==64&&(v[x++]=f);return v}},{"./support":30,"./utils":32}],2:[function(n,r,o){var s=n("./external"),a=n("./stream/DataWorker"),l=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function u(d,f,h,p,y){this.compressedSize=d,this.uncompressedSize=f,this.crc32=h,this.compression=p,this.compressedContent=y}u.prototype={getContentWorker:function(){var d=new a(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),f=this;return d.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new a(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,f,h){return d.pipe(new l).pipe(new c("uncompressedSize")).pipe(f.compressWorker(h)).pipe(new c("compressedSize")).withStreamInfo("compression",f)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){var s=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){var s=n("./utils"),a=(function(){for(var l,c=[],u=0;u<256;u++){l=u;for(var d=0;d<8;d++)l=1&l?3988292384^l>>>1:l>>>1;c[u]=l}return c})();r.exports=function(l,c){return l!==void 0&&l.length?s.getTypeOf(l)!=="string"?(function(u,d,f,h){var p=a,y=h+f;u^=-1;for(var m=h;m<y;m++)u=u>>>8^p[255&(u^d[m])];return-1^u})(0|c,l,l.length,0):(function(u,d,f,h){var p=a,y=h+f;u^=-1;for(var m=h;m<y;m++)u=u>>>8^p[255&(u^d.charCodeAt(m))];return-1^u})(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(n,r,o){o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){var s=null;s=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:s}},{lie:37}],7:[function(n,r,o){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=n("pako"),l=n("./utils"),c=n("./stream/GenericWorker"),u=s?"uint8array":"array";function d(f,h){c.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=h,this.meta={}}o.magic="\b\0",l.inherits(d,c),d.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(l.transformTo(u,f.data),!1)},d.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(h){f.push({data:h,meta:f.meta})}},o.compressWorker=function(f){return new d("Deflate",f)},o.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){function s(p,y){var m,x="";for(m=0;m<y;m++)x+=String.fromCharCode(255&p),p>>>=8;return x}function a(p,y,m,x,b,v){var w,C,S=p.file,j=p.compression,E=v!==u.utf8encode,N=l.transformTo("string",v(S.name)),z=l.transformTo("string",u.utf8encode(S.name)),M=S.comment,B=l.transformTo("string",v(M)),T=l.transformTo("string",u.utf8encode(M)),D=z.length!==S.name.length,k=T.length!==M.length,L="",W="",U="",$=S.dir,G=S.date,A={crc32:0,compressedSize:0,uncompressedSize:0};y&&!m||(A.crc32=p.crc32,A.compressedSize=p.compressedSize,A.uncompressedSize=p.uncompressedSize);var K=0;y&&(K|=8),E||!D&&!k||(K|=2048);var q=0,P=0;$&&(q|=16),b==="UNIX"?(P=798,q|=(function(le,ge){var ne=le;return le||(ne=ge?16893:33204),(65535&ne)<<16})(S.unixPermissions,$)):(P=20,q|=(function(le){return 63&(le||0)})(S.dosPermissions)),w=G.getUTCHours(),w<<=6,w|=G.getUTCMinutes(),w<<=5,w|=G.getUTCSeconds()/2,C=G.getUTCFullYear()-1980,C<<=4,C|=G.getUTCMonth()+1,C<<=5,C|=G.getUTCDate(),D&&(W=s(1,1)+s(d(N),4)+z,L+="up"+s(W.length,2)+W),k&&(U=s(1,1)+s(d(B),4)+T,L+="uc"+s(U.length,2)+U);var ie="";return ie+=`
|
|
41
|
-
\0`,ie+=s(K,2),ie+=j.magic,ie+=s(w,2),ie+=s(C,2),ie+=s(A.crc32,4),ie+=s(A.compressedSize,4),ie+=s(A.uncompressedSize,4),ie+=s(N.length,2),ie+=s(L.length,2),{fileRecord:f.LOCAL_FILE_HEADER+ie+N+L,dirRecord:f.CENTRAL_FILE_HEADER+s(P,2)+ie+s(B.length,2)+"\0\0\0\0"+s(q,4)+s(x,4)+N+L+B}}var l=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function h(p,y,m,x){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=y,this.zipPlatform=m,this.encodeFileName=x,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(h,c),h.prototype.push=function(p){var y=p.meta.percent||0,m=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,c.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:m?(y+100*(m-x-1))/m:100}}))},h.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var y=this.streamFiles&&!p.file.dir;if(y){var m=a(p,y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(p){this.accumulate=!1;var y=this.streamFiles&&!p.file.dir,m=a(p,y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),y)this.push({data:(function(x){return f.DATA_DESCRIPTOR+s(x.crc32,4)+s(x.compressedSize,4)+s(x.uncompressedSize,4)})(p),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var p=this.bytesWritten,y=0;y<this.dirRecords.length;y++)this.push({data:this.dirRecords[y],meta:{percent:100}});var m=this.bytesWritten-p,x=(function(b,v,w,C,S){var j=l.transformTo("string",S(C));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(b,2)+s(b,2)+s(v,4)+s(w,4)+s(j.length,2)+j})(this.dirRecords.length,m,p,this.zipComment,this.encodeFileName);this.push({data:x,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(p){this._sources.push(p);var y=this;return p.on("data",function(m){y.processChunk(m)}),p.on("end",function(){y.closedSource(y.previous.streamInfo),y._sources.length?y.prepareNextSource():y.end()}),p.on("error",function(m){y.error(m)}),this},h.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(p){var y=this._sources;if(!c.prototype.error.call(this,p))return!1;for(var m=0;m<y.length;m++)try{y[m].error(p)}catch{}return!0},h.prototype.lock=function(){c.prototype.lock.call(this);for(var p=this._sources,y=0;y<p.length;y++)p[y].lock()},r.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){var s=n("../compressions"),a=n("./ZipFileWorker");o.generateWorker=function(l,c,u){var d=new a(c.streamFiles,u,c.platform,c.encodeFileName),f=0;try{l.forEach(function(h,p){f++;var y=(function(v,w){var C=v||w,S=s[C];if(!S)throw new Error(C+" is not a valid compression method !");return S})(p.options.compression,c.compression),m=p.options.compressionOptions||c.compressionOptions||{},x=p.dir,b=p.date;p._compressWorker(y,m).withStreamInfo("file",{name:h,dir:x,date:b,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(h){d.error(h)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){function s(){if(!(this instanceof s))return new s;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var a=new s;for(var l in this)typeof this[l]!="function"&&(a[l]=this[l]);return a}}(s.prototype=n("./object")).loadAsync=n("./load"),s.support=n("./support"),s.defaults=n("./defaults"),s.version="3.10.1",s.loadAsync=function(a,l){return new s().loadAsync(a,l)},s.external=n("./external"),r.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){var s=n("./utils"),a=n("./external"),l=n("./utf8"),c=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function f(h){return new a.Promise(function(p,y){var m=h.decompressed.getContentWorker().pipe(new u);m.on("error",function(x){y(x)}).on("end",function(){m.streamInfo.crc32!==h.decompressed.crc32?y(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}r.exports=function(h,p){var y=this;return p=s.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),d.isNode&&d.isStream(h)?a.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",h,!0,p.optimizedBinaryString,p.base64).then(function(m){var x=new c(p);return x.load(m),x}).then(function(m){var x=[a.Promise.resolve(m)],b=m.files;if(p.checkCRC32)for(var v=0;v<b.length;v++)x.push(f(b[v]));return a.Promise.all(x)}).then(function(m){for(var x=m.shift(),b=x.files,v=0;v<b.length;v++){var w=b[v],C=w.fileNameStr,S=s.resolve(w.fileNameStr);y.file(S,w.decompressed,{binary:!0,optimizedBinaryString:!0,date:w.date,dir:w.dir,comment:w.fileCommentStr.length?w.fileCommentStr:null,unixPermissions:w.unixPermissions,dosPermissions:w.dosPermissions,createFolders:p.createFolders}),w.dir||(y.file(S).unsafeOriginalName=C)}return x.zipComment.length&&(y.comment=x.zipComment),y})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){var s=n("../utils"),a=n("../stream/GenericWorker");function l(c,u){a.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}s.inherits(l,a),l.prototype._bindStream=function(c){var u=this;(this._stream=c).pause(),c.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},l.prototype.pause=function(){return!!a.prototype.pause.call(this)&&(this._stream.pause(),!0)},l.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){var s=n("readable-stream").Readable;function a(l,c,u){s.call(this,c),this._helper=l;var d=this;l.on("data",function(f,h){d.push(f)||d._helper.pause(),u&&u(h)}).on("error",function(f){d.emit("error",f)}).on("end",function(){d.push(null)})}n("../utils").inherits(a,s),a.prototype._read=function(){this._helper.resume()},r.exports=a},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(s,a){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(s,a);if(typeof s=="number")throw new Error('The "data" argument must not be a number');return new Buffer(s,a)},allocBuffer:function(s){if(Buffer.alloc)return Buffer.alloc(s);var a=new Buffer(s);return a.fill(0),a},isBuffer:function(s){return Buffer.isBuffer(s)},isStream:function(s){return s&&typeof s.on=="function"&&typeof s.pause=="function"&&typeof s.resume=="function"}}},{}],15:[function(n,r,o){function s(S,j,E){var N,z=l.getTypeOf(j),M=l.extend(E||{},d);M.date=M.date||new Date,M.compression!==null&&(M.compression=M.compression.toUpperCase()),typeof M.unixPermissions=="string"&&(M.unixPermissions=parseInt(M.unixPermissions,8)),M.unixPermissions&&16384&M.unixPermissions&&(M.dir=!0),M.dosPermissions&&16&M.dosPermissions&&(M.dir=!0),M.dir&&(S=b(S)),M.createFolders&&(N=x(S))&&v.call(this,N,!0);var B=z==="string"&&M.binary===!1&&M.base64===!1;E&&E.binary!==void 0||(M.binary=!B),(j instanceof f&&j.uncompressedSize===0||M.dir||!j||j.length===0)&&(M.base64=!1,M.binary=!0,j="",M.compression="STORE",z="string");var T=null;T=j instanceof f||j instanceof c?j:y.isNode&&y.isStream(j)?new m(S,j):l.prepareContent(S,j,M.binary,M.optimizedBinaryString,M.base64);var D=new h(S,T,M);this.files[S]=D}var a=n("./utf8"),l=n("./utils"),c=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),h=n("./zipObject"),p=n("./generate"),y=n("./nodejsUtils"),m=n("./nodejs/NodejsStreamInputAdapter"),x=function(S){S.slice(-1)==="/"&&(S=S.substring(0,S.length-1));var j=S.lastIndexOf("/");return 0<j?S.substring(0,j):""},b=function(S){return S.slice(-1)!=="/"&&(S+="/"),S},v=function(S,j){return j=j!==void 0?j:d.createFolders,S=b(S),this.files[S]||s.call(this,S,null,{dir:!0,createFolders:j}),this.files[S]};function w(S){return Object.prototype.toString.call(S)==="[object RegExp]"}var C={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(S){var j,E,N;for(j in this.files)N=this.files[j],(E=j.slice(this.root.length,j.length))&&j.slice(0,this.root.length)===this.root&&S(E,N)},filter:function(S){var j=[];return this.forEach(function(E,N){S(E,N)&&j.push(N)}),j},file:function(S,j,E){if(arguments.length!==1)return S=this.root+S,s.call(this,S,j,E),this;if(w(S)){var N=S;return this.filter(function(M,B){return!B.dir&&N.test(M)})}var z=this.files[this.root+S];return z&&!z.dir?z:null},folder:function(S){if(!S)return this;if(w(S))return this.filter(function(z,M){return M.dir&&S.test(z)});var j=this.root+S,E=v.call(this,j),N=this.clone();return N.root=E.name,N},remove:function(S){S=this.root+S;var j=this.files[S];if(j||(S.slice(-1)!=="/"&&(S+="/"),j=this.files[S]),j&&!j.dir)delete this.files[S];else for(var E=this.filter(function(z,M){return M.name.slice(0,S.length)===S}),N=0;N<E.length;N++)delete this.files[E[N].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(S){var j,E={};try{if((E=l.extend(S||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:a.utf8encode})).type=E.type.toLowerCase(),E.compression=E.compression.toUpperCase(),E.type==="binarystring"&&(E.type="string"),!E.type)throw new Error("No output type specified.");l.checkSupport(E.type),E.platform!=="darwin"&&E.platform!=="freebsd"&&E.platform!=="linux"&&E.platform!=="sunos"||(E.platform="UNIX"),E.platform==="win32"&&(E.platform="DOS");var N=E.comment||this.comment||"";j=p.generateWorker(this,E,N)}catch(z){(j=new c("error")).error(z)}return new u(j,E.type||"string",E.mimeType)},generateAsync:function(S,j){return this.generateInternalStream(S).accumulate(j)},generateNodeStream:function(S,j){return(S=S||{}).type||(S.type="nodebuffer"),this.generateInternalStream(S).toNodejsStream(j)}};r.exports=C},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,o){r.exports=n("stream")},{stream:void 0}],17:[function(n,r,o){var s=n("./DataReader");function a(l){s.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}n("../utils").inherits(a,s),a.prototype.byteAt=function(l){return this.data[this.zero+l]},a.prototype.lastIndexOfSignature=function(l){for(var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),f=l.charCodeAt(3),h=this.length-4;0<=h;--h)if(this.data[h]===c&&this.data[h+1]===u&&this.data[h+2]===d&&this.data[h+3]===f)return h-this.zero;return-1},a.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),f=l.charCodeAt(3),h=this.readData(4);return c===h[0]&&u===h[1]&&d===h[2]&&f===h[3]},a.prototype.readData=function(l){if(this.checkOffset(l),l===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=a},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){var s=n("../utils");function a(l){this.data=l,this.length=l.length,this.index=0,this.zero=0}a.prototype={checkOffset:function(l){this.checkIndex(this.index+l)},checkIndex:function(l){if(this.length<this.zero+l||l<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+l+"). Corrupted zip ?")},setIndex:function(l){this.checkIndex(l),this.index=l},skip:function(l){this.setIndex(this.index+l)},byteAt:function(){},readInt:function(l){var c,u=0;for(this.checkOffset(l),c=this.index+l-1;c>=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=l,u},readString:function(l){return s.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},r.exports=a},{"../utils":32}],19:[function(n,r,o){var s=n("./Uint8ArrayReader");function a(l){s.call(this,l)}n("../utils").inherits(a,s),a.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){var s=n("./DataReader");function a(l){s.call(this,l)}n("../utils").inherits(a,s),a.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},a.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},a.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},a.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=a},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){var s=n("./ArrayReader");function a(l){s.call(this,l)}n("../utils").inherits(a,s),a.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){var s=n("../utils"),a=n("../support"),l=n("./ArrayReader"),c=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(f){var h=s.getTypeOf(f);return s.checkSupport(h),h!=="string"||a.uint8array?h==="nodebuffer"?new u(f):a.uint8array?new d(s.transformTo("uint8array",f)):new l(s.transformTo("array",f)):new c(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){var s=n("./GenericWorker"),a=n("../utils");function l(c){s.call(this,"ConvertWorker to "+c),this.destType=c}a.inherits(l,s),l.prototype.processChunk=function(c){this.push({data:a.transformTo(this.destType,c.data),meta:c.meta})},r.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){var s=n("./GenericWorker"),a=n("../crc32");function l(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(l,s),l.prototype.processChunk=function(c){this.streamInfo.crc32=a(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){var s=n("../utils"),a=n("./GenericWorker");function l(c){a.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}s.inherits(l,a),l.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}a.prototype.processChunk.call(this,c)},r.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){var s=n("../utils"),a=n("./GenericWorker");function l(c){a.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=s.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}s.inherits(l,a),l.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){function s(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,l){return this._listeners[a].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,l){if(this._listeners[a])for(var c=0;c<this._listeners[a].length;c++)this._listeners[a][c].call(this,l)},pipe:function(a){return a.registerPrevious(this)},registerPrevious:function(a){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=a.streamInfo,this.mergeStreamInfo(),this.previous=a;var l=this;return a.on("data",function(c){l.processChunk(c)}),a.on("end",function(){l.end()}),a.on("error",function(c){l.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var a=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),a=!0),this.previous&&this.previous.resume(),!a},flush:function(){},processChunk:function(a){this.push(a)},withStreamInfo:function(a,l){return this.extraStreamInfo[a]=l,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var a in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,a)&&(this.streamInfo[a]=this.extraStreamInfo[a])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var a="Worker "+this.name;return this.previous?this.previous+" -> "+a:a}},r.exports=s},{}],29:[function(n,r,o){var s=n("../utils"),a=n("./ConvertWorker"),l=n("./GenericWorker"),c=n("../base64"),u=n("../support"),d=n("../external"),f=null;if(u.nodestream)try{f=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function h(y,m){return new d.Promise(function(x,b){var v=[],w=y._internalType,C=y._outputType,S=y._mimeType;y.on("data",function(j,E){v.push(j),m&&m(E)}).on("error",function(j){v=[],b(j)}).on("end",function(){try{var j=(function(E,N,z){switch(E){case"blob":return s.newBlob(s.transformTo("arraybuffer",N),z);case"base64":return c.encode(N);default:return s.transformTo(E,N)}})(C,(function(E,N){var z,M=0,B=null,T=0;for(z=0;z<N.length;z++)T+=N[z].length;switch(E){case"string":return N.join("");case"array":return Array.prototype.concat.apply([],N);case"uint8array":for(B=new Uint8Array(T),z=0;z<N.length;z++)B.set(N[z],M),M+=N[z].length;return B;case"nodebuffer":return Buffer.concat(N);default:throw new Error("concat : unsupported type '"+E+"'")}})(w,v),S);x(j)}catch(E){b(E)}v=[]}).resume()})}function p(y,m,x){var b=m;switch(m){case"blob":case"arraybuffer":b="uint8array";break;case"base64":b="string"}try{this._internalType=b,this._outputType=m,this._mimeType=x,s.checkSupport(b),this._worker=y.pipe(new a(b)),y.lock()}catch(v){this._worker=new l("error"),this._worker.error(v)}}p.prototype={accumulate:function(y){return h(this,y)},on:function(y,m){var x=this;return y==="data"?this._worker.on(y,function(b){m.call(x,b.data,b.meta)}):this._worker.on(y,function(){s.delay(m,arguments,x)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(y){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},y)}},r.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var s=new ArrayBuffer(0);try{o.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(s),o.blob=a.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){for(var s=n("./utils"),a=n("./support"),l=n("./nodejsUtils"),c=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){c.call(this,"utf-8 decode"),this.leftOver=null}function h(){c.call(this,"utf-8 encode")}o.utf8encode=function(p){return a.nodebuffer?l.newBufferFrom(p,"utf-8"):(function(y){var m,x,b,v,w,C=y.length,S=0;for(v=0;v<C;v++)(64512&(x=y.charCodeAt(v)))==55296&&v+1<C&&(64512&(b=y.charCodeAt(v+1)))==56320&&(x=65536+(x-55296<<10)+(b-56320),v++),S+=x<128?1:x<2048?2:x<65536?3:4;for(m=a.uint8array?new Uint8Array(S):new Array(S),v=w=0;w<S;v++)(64512&(x=y.charCodeAt(v)))==55296&&v+1<C&&(64512&(b=y.charCodeAt(v+1)))==56320&&(x=65536+(x-55296<<10)+(b-56320),v++),x<128?m[w++]=x:(x<2048?m[w++]=192|x>>>6:(x<65536?m[w++]=224|x>>>12:(m[w++]=240|x>>>18,m[w++]=128|x>>>12&63),m[w++]=128|x>>>6&63),m[w++]=128|63&x);return m})(p)},o.utf8decode=function(p){return a.nodebuffer?s.transformTo("nodebuffer",p).toString("utf-8"):(function(y){var m,x,b,v,w=y.length,C=new Array(2*w);for(m=x=0;m<w;)if((b=y[m++])<128)C[x++]=b;else if(4<(v=u[b]))C[x++]=65533,m+=v-1;else{for(b&=v===2?31:v===3?15:7;1<v&&m<w;)b=b<<6|63&y[m++],v--;1<v?C[x++]=65533:b<65536?C[x++]=b:(b-=65536,C[x++]=55296|b>>10&1023,C[x++]=56320|1023&b)}return C.length!==x&&(C.subarray?C=C.subarray(0,x):C.length=x),s.applyFromCharCode(C)})(p=s.transformTo(a.uint8array?"uint8array":"array",p))},s.inherits(f,c),f.prototype.processChunk=function(p){var y=s.transformTo(a.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var m=y;(y=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),y.set(m,this.leftOver.length)}else y=this.leftOver.concat(y);this.leftOver=null}var x=(function(v,w){var C;for((w=w||v.length)>v.length&&(w=v.length),C=w-1;0<=C&&(192&v[C])==128;)C--;return C<0||C===0?w:C+u[v[C]]>w?C:w})(y),b=y;x!==y.length&&(a.uint8array?(b=y.subarray(0,x),this.leftOver=y.subarray(x,y.length)):(b=y.slice(0,x),this.leftOver=y.slice(x,y.length))),this.push({data:o.utf8decode(b),meta:p.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=f,s.inherits(h,c),h.prototype.processChunk=function(p){this.push({data:o.utf8encode(p.data),meta:p.meta})},o.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){var s=n("./support"),a=n("./base64"),l=n("./nodejsUtils"),c=n("./external");function u(m){return m}function d(m,x){for(var b=0;b<m.length;++b)x[b]=255&m.charCodeAt(b);return x}n("setimmediate"),o.newBlob=function(m,x){o.checkSupport("blob");try{return new Blob([m],{type:x})}catch{try{var b=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return b.append(m),b.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(m,x,b){var v=[],w=0,C=m.length;if(C<=b)return String.fromCharCode.apply(null,m);for(;w<C;)x==="array"||x==="nodebuffer"?v.push(String.fromCharCode.apply(null,m.slice(w,Math.min(w+b,C)))):v.push(String.fromCharCode.apply(null,m.subarray(w,Math.min(w+b,C)))),w+=b;return v.join("")},stringifyByChar:function(m){for(var x="",b=0;b<m.length;b++)x+=String.fromCharCode(m[b]);return x},applyCanBeUsed:{uint8array:(function(){try{return s.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return s.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}})()}};function h(m){var x=65536,b=o.getTypeOf(m),v=!0;if(b==="uint8array"?v=f.applyCanBeUsed.uint8array:b==="nodebuffer"&&(v=f.applyCanBeUsed.nodebuffer),v)for(;1<x;)try{return f.stringifyByChunk(m,b,x)}catch{x=Math.floor(x/2)}return f.stringifyByChar(m)}function p(m,x){for(var b=0;b<m.length;b++)x[b]=m[b];return x}o.applyFromCharCode=h;var y={};y.string={string:u,array:function(m){return d(m,new Array(m.length))},arraybuffer:function(m){return y.string.uint8array(m).buffer},uint8array:function(m){return d(m,new Uint8Array(m.length))},nodebuffer:function(m){return d(m,l.allocBuffer(m.length))}},y.array={string:h,array:u,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return l.newBufferFrom(m)}},y.arraybuffer={string:function(m){return h(new Uint8Array(m))},array:function(m){return p(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:u,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return l.newBufferFrom(new Uint8Array(m))}},y.uint8array={string:h,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:u,nodebuffer:function(m){return l.newBufferFrom(m)}},y.nodebuffer={string:h,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return y.nodebuffer.uint8array(m).buffer},uint8array:function(m){return p(m,new Uint8Array(m.length))},nodebuffer:u},o.transformTo=function(m,x){if(x=x||"",!m)return x;o.checkSupport(m);var b=o.getTypeOf(x);return y[b][m](x)},o.resolve=function(m){for(var x=m.split("/"),b=[],v=0;v<x.length;v++){var w=x[v];w==="."||w===""&&v!==0&&v!==x.length-1||(w===".."?b.pop():b.push(w))}return b.join("/")},o.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":s.nodebuffer&&l.isBuffer(m)?"nodebuffer":s.uint8array&&m instanceof Uint8Array?"uint8array":s.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(m){if(!s[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(m){var x,b,v="";for(b=0;b<(m||"").length;b++)v+="\\x"+((x=m.charCodeAt(b))<16?"0":"")+x.toString(16).toUpperCase();return v},o.delay=function(m,x,b){setImmediate(function(){m.apply(b||null,x||[])})},o.inherits=function(m,x){function b(){}b.prototype=x.prototype,m.prototype=new b},o.extend=function(){var m,x,b={};for(m=0;m<arguments.length;m++)for(x in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],x)&&b[x]===void 0&&(b[x]=arguments[m][x]);return b},o.prepareContent=function(m,x,b,v,w){return c.Promise.resolve(x).then(function(C){return s.blob&&(C instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(C))!==-1)&&typeof FileReader<"u"?new c.Promise(function(S,j){var E=new FileReader;E.onload=function(N){S(N.target.result)},E.onerror=function(N){j(N.target.error)},E.readAsArrayBuffer(C)}):C}).then(function(C){var S=o.getTypeOf(C);return S?(S==="arraybuffer"?C=o.transformTo("uint8array",C):S==="string"&&(w?C=a.decode(C):b&&v!==!0&&(C=(function(j){return d(j,s.uint8array?new Uint8Array(j.length):new Array(j.length))})(C))),C):c.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){var s=n("./reader/readerFor"),a=n("./utils"),l=n("./signature"),c=n("./zipEntry"),u=n("./support");function d(f){this.files=[],this.loadOptions=f}d.prototype={checkSignature:function(f){if(!this.reader.readAndCheckSignature(f)){this.reader.index-=4;var h=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+a.pretty(h)+", expected "+a.pretty(f)+")")}},isSignature:function(f,h){var p=this.reader.index;this.reader.setIndex(f);var y=this.reader.readString(4)===h;return this.reader.setIndex(p),y},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),h=u.uint8array?"uint8array":"array",p=a.transformTo(h,f);this.zipComment=this.loadOptions.decodeFileName(p)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,h,p,y=this.zip64EndOfCentralSize-44;0<y;)f=this.reader.readInt(2),h=this.reader.readInt(4),p=this.reader.readData(h),this.zip64ExtensibleData[f]={id:f,length:h,value:p}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,h;for(f=0;f<this.files.length;f++)h=this.files[f],this.reader.setIndex(h.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),h.readLocalPart(this.reader),h.handleUTF8(),h.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(f=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var f=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,l.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var h=f;if(this.checkSignature(l.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a.MAX_VALUE_16BITS||this.centralDirRecords===a.MAX_VALUE_16BITS||this.centralDirSize===a.MAX_VALUE_32BITS||this.centralDirOffset===a.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,l.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var y=h-p;if(0<y)this.isSignature(h,l.CENTRAL_FILE_HEADER)||(this.reader.zero=y);else if(y<0)throw new Error("Corrupted zip: missing "+Math.abs(y)+" bytes.")},prepareReader:function(f){this.reader=s(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){var s=n("./reader/readerFor"),a=n("./utils"),l=n("./compressedObject"),c=n("./crc32"),u=n("./utf8"),d=n("./compressions"),f=n("./support");function h(p,y){this.options=p,this.loadOptions=y}h.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var y,m;if(p.skip(22),this.fileNameLength=p.readInt(2),m=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(m),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((y=(function(x){for(var b in d)if(Object.prototype.hasOwnProperty.call(d,b)&&d[b].magic===x)return d[b];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+a.pretty(this.compressionMethod)+" unknown (inner file : "+a.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,y,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var y=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(y),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=s(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var y,m,x,b=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<b;)y=p.readInt(2),m=p.readInt(2),x=p.readData(m),this.extraFields[y]={id:y,length:m,value:x};p.setIndex(b)},handleUTF8:function(){var p=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var y=this.findExtraFieldUnicodePath();if(y!==null)this.fileNameStr=y;else{var m=a.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var b=a.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(b)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var y=s(p.value);return y.readInt(1)!==1||c(this.fileName)!==y.readInt(4)?null:u.utf8decode(y.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var y=s(p.value);return y.readInt(1)!==1||c(this.fileComment)!==y.readInt(4)?null:u.utf8decode(y.readData(p.length-5))}return null}},r.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){function s(y,m,x){this.name=y,this.dir=x.dir,this.date=x.date,this.comment=x.comment,this.unixPermissions=x.unixPermissions,this.dosPermissions=x.dosPermissions,this._data=m,this._dataBinary=x.binary,this.options={compression:x.compression,compressionOptions:x.compressionOptions}}var a=n("./stream/StreamHelper"),l=n("./stream/DataWorker"),c=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");s.prototype={internalStream:function(y){var m=null,x="string";try{if(!y)throw new Error("No output type specified.");var b=(x=y.toLowerCase())==="string"||x==="text";x!=="binarystring"&&x!=="text"||(x="string"),m=this._decompressWorker();var v=!this._dataBinary;v&&!b&&(m=m.pipe(new c.Utf8EncodeWorker)),!v&&b&&(m=m.pipe(new c.Utf8DecodeWorker))}catch(w){(m=new d("error")).error(w)}return new a(m,x,"")},async:function(y,m){return this.internalStream(y).accumulate(m)},nodeStream:function(y,m){return this.internalStream(y||"nodebuffer").toNodejsStream(m)},_compressWorker:function(y,m){if(this._data instanceof u&&this._data.compression.magic===y.magic)return this._data.getCompressedWorker();var x=this._decompressWorker();return this._dataBinary||(x=x.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(x,y,m)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new l(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<f.length;p++)s.prototype[f[p]]=h;r.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(s){var a,l,c=s.MutationObserver||s.WebKitMutationObserver;if(c){var u=0,d=new c(y),f=s.document.createTextNode("");d.observe(f,{characterData:!0}),a=function(){f.data=u=++u%2}}else if(s.setImmediate||s.MessageChannel===void 0)a="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var m=s.document.createElement("script");m.onreadystatechange=function(){y(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},s.document.documentElement.appendChild(m)}:function(){setTimeout(y,0)};else{var h=new s.MessageChannel;h.port1.onmessage=y,a=function(){h.port2.postMessage(0)}}var p=[];function y(){var m,x;l=!0;for(var b=p.length;b;){for(x=p,p=[],m=-1;++m<b;)x[m]();b=p.length}l=!1}r.exports=function(m){p.push(m)!==1||l||a()}}).call(this,typeof lo<"u"?lo:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){var s=n("immediate");function a(){}var l={},c=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function f(b){if(typeof b!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,b!==a&&m(this,b)}function h(b,v,w){this.promise=b,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof w=="function"&&(this.onRejected=w,this.callRejected=this.otherCallRejected)}function p(b,v,w){s(function(){var C;try{C=v(w)}catch(S){return l.reject(b,S)}C===b?l.reject(b,new TypeError("Cannot resolve promise with itself")):l.resolve(b,C)})}function y(b){var v=b&&b.then;if(b&&(typeof b=="object"||typeof b=="function")&&typeof v=="function")return function(){v.apply(b,arguments)}}function m(b,v){var w=!1;function C(E){w||(w=!0,l.reject(b,E))}function S(E){w||(w=!0,l.resolve(b,E))}var j=x(function(){v(S,C)});j.status==="error"&&C(j.value)}function x(b,v){var w={};try{w.value=b(v),w.status="success"}catch(C){w.status="error",w.value=C}return w}(r.exports=f).prototype.finally=function(b){if(typeof b!="function")return this;var v=this.constructor;return this.then(function(w){return v.resolve(b()).then(function(){return w})},function(w){return v.resolve(b()).then(function(){throw w})})},f.prototype.catch=function(b){return this.then(null,b)},f.prototype.then=function(b,v){if(typeof b!="function"&&this.state===u||typeof v!="function"&&this.state===c)return this;var w=new this.constructor(a);return this.state!==d?p(w,this.state===u?b:v,this.outcome):this.queue.push(new h(w,b,v)),w},h.prototype.callFulfilled=function(b){l.resolve(this.promise,b)},h.prototype.otherCallFulfilled=function(b){p(this.promise,this.onFulfilled,b)},h.prototype.callRejected=function(b){l.reject(this.promise,b)},h.prototype.otherCallRejected=function(b){p(this.promise,this.onRejected,b)},l.resolve=function(b,v){var w=x(y,v);if(w.status==="error")return l.reject(b,w.value);var C=w.value;if(C)m(b,C);else{b.state=u,b.outcome=v;for(var S=-1,j=b.queue.length;++S<j;)b.queue[S].callFulfilled(v)}return b},l.reject=function(b,v){b.state=c,b.outcome=v;for(var w=-1,C=b.queue.length;++w<C;)b.queue[w].callRejected(v);return b},f.resolve=function(b){return b instanceof this?b:l.resolve(new this(a),b)},f.reject=function(b){var v=new this(a);return l.reject(v,b)},f.all=function(b){var v=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=b.length,C=!1;if(!w)return this.resolve([]);for(var S=new Array(w),j=0,E=-1,N=new this(a);++E<w;)z(b[E],E);return N;function z(M,B){v.resolve(M).then(function(T){S[B]=T,++j!==w||C||(C=!0,l.resolve(N,S))},function(T){C||(C=!0,l.reject(N,T))})}},f.race=function(b){var v=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=b.length,C=!1;if(!w)return this.resolve([]);for(var S=-1,j=new this(a);++S<w;)E=b[S],v.resolve(E).then(function(N){C||(C=!0,l.resolve(j,N))},function(N){C||(C=!0,l.reject(j,N))});var E;return j}},{immediate:36}],38:[function(n,r,o){var s={};(0,n("./lib/utils/common").assign)(s,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){var s=n("./zlib/deflate"),a=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/messages"),u=n("./zlib/zstream"),d=Object.prototype.toString,f=0,h=-1,p=0,y=8;function m(b){if(!(this instanceof m))return new m(b);this.options=a.assign({level:h,method:y,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},b||{});var v=this.options;v.raw&&0<v.windowBits?v.windowBits=-v.windowBits:v.gzip&&0<v.windowBits&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var w=s.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(w!==f)throw new Error(c[w]);if(v.header&&s.deflateSetHeader(this.strm,v.header),v.dictionary){var C;if(C=typeof v.dictionary=="string"?l.string2buf(v.dictionary):d.call(v.dictionary)==="[object ArrayBuffer]"?new Uint8Array(v.dictionary):v.dictionary,(w=s.deflateSetDictionary(this.strm,C))!==f)throw new Error(c[w]);this._dict_set=!0}}function x(b,v){var w=new m(v);if(w.push(b,!0),w.err)throw w.msg||c[w.err];return w.result}m.prototype.push=function(b,v){var w,C,S=this.strm,j=this.options.chunkSize;if(this.ended)return!1;C=v===~~v?v:v===!0?4:0,typeof b=="string"?S.input=l.string2buf(b):d.call(b)==="[object ArrayBuffer]"?S.input=new Uint8Array(b):S.input=b,S.next_in=0,S.avail_in=S.input.length;do{if(S.avail_out===0&&(S.output=new a.Buf8(j),S.next_out=0,S.avail_out=j),(w=s.deflate(S,C))!==1&&w!==f)return this.onEnd(w),!(this.ended=!0);S.avail_out!==0&&(S.avail_in!==0||C!==4&&C!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(a.shrinkBuf(S.output,S.next_out))):this.onData(a.shrinkBuf(S.output,S.next_out)))}while((0<S.avail_in||S.avail_out===0)&&w!==1);return C===4?(w=s.deflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===f):C!==2||(this.onEnd(f),!(S.avail_out=0))},m.prototype.onData=function(b){this.chunks.push(b)},m.prototype.onEnd=function(b){b===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=b,this.msg=this.strm.msg},o.Deflate=m,o.deflate=x,o.deflateRaw=function(b,v){return(v=v||{}).raw=!0,x(b,v)},o.gzip=function(b,v){return(v=v||{}).gzip=!0,x(b,v)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){var s=n("./zlib/inflate"),a=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/constants"),u=n("./zlib/messages"),d=n("./zlib/zstream"),f=n("./zlib/gzheader"),h=Object.prototype.toString;function p(m){if(!(this instanceof p))return new p(m);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},m||{});var x=this.options;x.raw&&0<=x.windowBits&&x.windowBits<16&&(x.windowBits=-x.windowBits,x.windowBits===0&&(x.windowBits=-15)),!(0<=x.windowBits&&x.windowBits<16)||m&&m.windowBits||(x.windowBits+=32),15<x.windowBits&&x.windowBits<48&&(15&x.windowBits)==0&&(x.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var b=s.inflateInit2(this.strm,x.windowBits);if(b!==c.Z_OK)throw new Error(u[b]);this.header=new f,s.inflateGetHeader(this.strm,this.header)}function y(m,x){var b=new p(x);if(b.push(m,!0),b.err)throw b.msg||u[b.err];return b.result}p.prototype.push=function(m,x){var b,v,w,C,S,j,E=this.strm,N=this.options.chunkSize,z=this.options.dictionary,M=!1;if(this.ended)return!1;v=x===~~x?x:x===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof m=="string"?E.input=l.binstring2buf(m):h.call(m)==="[object ArrayBuffer]"?E.input=new Uint8Array(m):E.input=m,E.next_in=0,E.avail_in=E.input.length;do{if(E.avail_out===0&&(E.output=new a.Buf8(N),E.next_out=0,E.avail_out=N),(b=s.inflate(E,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&z&&(j=typeof z=="string"?l.string2buf(z):h.call(z)==="[object ArrayBuffer]"?new Uint8Array(z):z,b=s.inflateSetDictionary(this.strm,j)),b===c.Z_BUF_ERROR&&M===!0&&(b=c.Z_OK,M=!1),b!==c.Z_STREAM_END&&b!==c.Z_OK)return this.onEnd(b),!(this.ended=!0);E.next_out&&(E.avail_out!==0&&b!==c.Z_STREAM_END&&(E.avail_in!==0||v!==c.Z_FINISH&&v!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(w=l.utf8border(E.output,E.next_out),C=E.next_out-w,S=l.buf2string(E.output,w),E.next_out=C,E.avail_out=N-C,C&&a.arraySet(E.output,E.output,w,C,0),this.onData(S)):this.onData(a.shrinkBuf(E.output,E.next_out)))),E.avail_in===0&&E.avail_out===0&&(M=!0)}while((0<E.avail_in||E.avail_out===0)&&b!==c.Z_STREAM_END);return b===c.Z_STREAM_END&&(v=c.Z_FINISH),v===c.Z_FINISH?(b=s.inflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===c.Z_OK):v!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(E.avail_out=0))},p.prototype.onData=function(m){this.chunks.push(m)},p.prototype.onEnd=function(m){m===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},o.Inflate=p,o.inflate=y,o.inflateRaw=function(m,x){return(x=x||{}).raw=!0,y(m,x)},o.ungzip=y},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(c){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var f in d)d.hasOwnProperty(f)&&(c[f]=d[f])}}return c},o.shrinkBuf=function(c,u){return c.length===u?c:c.subarray?c.subarray(0,u):(c.length=u,c)};var a={arraySet:function(c,u,d,f,h){if(u.subarray&&c.subarray)c.set(u.subarray(d,d+f),h);else for(var p=0;p<f;p++)c[h+p]=u[d+p]},flattenChunks:function(c){var u,d,f,h,p,y;for(u=f=0,d=c.length;u<d;u++)f+=c[u].length;for(y=new Uint8Array(f),u=h=0,d=c.length;u<d;u++)p=c[u],y.set(p,h),h+=p.length;return y}},l={arraySet:function(c,u,d,f,h){for(var p=0;p<f;p++)c[h+p]=u[d+p]},flattenChunks:function(c){return[].concat.apply([],c)}};o.setTyped=function(c){c?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,a)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,l))},o.setTyped(s)},{}],42:[function(n,r,o){var s=n("./common"),a=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var c=new s.Buf8(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(f,h){if(h<65537&&(f.subarray&&l||!f.subarray&&a))return String.fromCharCode.apply(null,s.shrinkBuf(f,h));for(var p="",y=0;y<h;y++)p+=String.fromCharCode(f[y]);return p}c[254]=c[254]=1,o.string2buf=function(f){var h,p,y,m,x,b=f.length,v=0;for(m=0;m<b;m++)(64512&(p=f.charCodeAt(m)))==55296&&m+1<b&&(64512&(y=f.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(y-56320),m++),v+=p<128?1:p<2048?2:p<65536?3:4;for(h=new s.Buf8(v),m=x=0;x<v;m++)(64512&(p=f.charCodeAt(m)))==55296&&m+1<b&&(64512&(y=f.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(y-56320),m++),p<128?h[x++]=p:(p<2048?h[x++]=192|p>>>6:(p<65536?h[x++]=224|p>>>12:(h[x++]=240|p>>>18,h[x++]=128|p>>>12&63),h[x++]=128|p>>>6&63),h[x++]=128|63&p);return h},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var h=new s.Buf8(f.length),p=0,y=h.length;p<y;p++)h[p]=f.charCodeAt(p);return h},o.buf2string=function(f,h){var p,y,m,x,b=h||f.length,v=new Array(2*b);for(p=y=0;p<b;)if((m=f[p++])<128)v[y++]=m;else if(4<(x=c[m]))v[y++]=65533,p+=x-1;else{for(m&=x===2?31:x===3?15:7;1<x&&p<b;)m=m<<6|63&f[p++],x--;1<x?v[y++]=65533:m<65536?v[y++]=m:(m-=65536,v[y++]=55296|m>>10&1023,v[y++]=56320|1023&m)}return d(v,y)},o.utf8border=function(f,h){var p;for((h=h||f.length)>f.length&&(h=f.length),p=h-1;0<=p&&(192&f[p])==128;)p--;return p<0||p===0?h:p+c[f[p]]>h?p:h}},{"./common":41}],43:[function(n,r,o){r.exports=function(s,a,l,c){for(var u=65535&s|0,d=s>>>16&65535|0,f=0;l!==0;){for(l-=f=2e3<l?2e3:l;d=d+(u=u+a[c++]|0)|0,--f;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(n,r,o){r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){var s=(function(){for(var a,l=[],c=0;c<256;c++){a=c;for(var u=0;u<8;u++)a=1&a?3988292384^a>>>1:a>>>1;l[c]=a}return l})();r.exports=function(a,l,c,u){var d=s,f=u+c;a^=-1;for(var h=u;h<f;h++)a=a>>>8^d[255&(a^l[h])];return-1^a}},{}],46:[function(n,r,o){var s,a=n("../utils/common"),l=n("./trees"),c=n("./adler32"),u=n("./crc32"),d=n("./messages"),f=0,h=4,p=0,y=-2,m=-1,x=4,b=2,v=8,w=9,C=286,S=30,j=19,E=2*C+1,N=15,z=3,M=258,B=M+z+1,T=42,D=113,k=1,L=2,W=3,U=4;function $(_,ee){return _.msg=d[ee],ee}function G(_){return(_<<1)-(4<_?9:0)}function A(_){for(var ee=_.length;0<=--ee;)_[ee]=0}function K(_){var ee=_.state,Q=ee.pending;Q>_.avail_out&&(Q=_.avail_out),Q!==0&&(a.arraySet(_.output,ee.pending_buf,ee.pending_out,Q,_.next_out),_.next_out+=Q,ee.pending_out+=Q,_.total_out+=Q,_.avail_out-=Q,ee.pending-=Q,ee.pending===0&&(ee.pending_out=0))}function q(_,ee){l._tr_flush_block(_,0<=_.block_start?_.block_start:-1,_.strstart-_.block_start,ee),_.block_start=_.strstart,K(_.strm)}function P(_,ee){_.pending_buf[_.pending++]=ee}function ie(_,ee){_.pending_buf[_.pending++]=ee>>>8&255,_.pending_buf[_.pending++]=255&ee}function le(_,ee){var Q,O,R=_.max_chain_length,Z=_.strstart,V=_.prev_length,J=_.nice_match,H=_.strstart>_.w_size-B?_.strstart-(_.w_size-B):0,ae=_.window,Y=_.w_mask,te=_.prev,F=_.strstart+M,X=ae[Z+V-1],ce=ae[Z+V];_.prev_length>=_.good_match&&(R>>=2),J>_.lookahead&&(J=_.lookahead);do if(ae[(Q=ee)+V]===ce&&ae[Q+V-1]===X&&ae[Q]===ae[Z]&&ae[++Q]===ae[Z+1]){Z+=2,Q++;do;while(ae[++Z]===ae[++Q]&&ae[++Z]===ae[++Q]&&ae[++Z]===ae[++Q]&&ae[++Z]===ae[++Q]&&ae[++Z]===ae[++Q]&&ae[++Z]===ae[++Q]&&ae[++Z]===ae[++Q]&&ae[++Z]===ae[++Q]&&Z<F);if(O=M-(F-Z),Z=F-M,V<O){if(_.match_start=ee,J<=(V=O))break;X=ae[Z+V-1],ce=ae[Z+V]}}while((ee=te[ee&Y])>H&&--R!=0);return V<=_.lookahead?V:_.lookahead}function ge(_){var ee,Q,O,R,Z,V,J,H,ae,Y,te=_.w_size;do{if(R=_.window_size-_.lookahead-_.strstart,_.strstart>=te+(te-B)){for(a.arraySet(_.window,_.window,te,te,0),_.match_start-=te,_.strstart-=te,_.block_start-=te,ee=Q=_.hash_size;O=_.head[--ee],_.head[ee]=te<=O?O-te:0,--Q;);for(ee=Q=te;O=_.prev[--ee],_.prev[ee]=te<=O?O-te:0,--Q;);R+=te}if(_.strm.avail_in===0)break;if(V=_.strm,J=_.window,H=_.strstart+_.lookahead,ae=R,Y=void 0,Y=V.avail_in,ae<Y&&(Y=ae),Q=Y===0?0:(V.avail_in-=Y,a.arraySet(J,V.input,V.next_in,Y,H),V.state.wrap===1?V.adler=c(V.adler,J,Y,H):V.state.wrap===2&&(V.adler=u(V.adler,J,Y,H)),V.next_in+=Y,V.total_in+=Y,Y),_.lookahead+=Q,_.lookahead+_.insert>=z)for(Z=_.strstart-_.insert,_.ins_h=_.window[Z],_.ins_h=(_.ins_h<<_.hash_shift^_.window[Z+1])&_.hash_mask;_.insert&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[Z+z-1])&_.hash_mask,_.prev[Z&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=Z,Z++,_.insert--,!(_.lookahead+_.insert<z)););}while(_.lookahead<B&&_.strm.avail_in!==0)}function ne(_,ee){for(var Q,O;;){if(_.lookahead<B){if(ge(_),_.lookahead<B&&ee===f)return k;if(_.lookahead===0)break}if(Q=0,_.lookahead>=z&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),Q!==0&&_.strstart-Q<=_.w_size-B&&(_.match_length=le(_,Q)),_.match_length>=z)if(O=l._tr_tally(_,_.strstart-_.match_start,_.match_length-z),_.lookahead-=_.match_length,_.match_length<=_.max_lazy_match&&_.lookahead>=z){for(_.match_length--;_.strstart++,_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart,--_.match_length!=0;);_.strstart++}else _.strstart+=_.match_length,_.match_length=0,_.ins_h=_.window[_.strstart],_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+1])&_.hash_mask;else O=l._tr_tally(_,0,_.window[_.strstart]),_.lookahead--,_.strstart++;if(O&&(q(_,!1),_.strm.avail_out===0))return k}return _.insert=_.strstart<z-1?_.strstart:z-1,ee===h?(q(_,!0),_.strm.avail_out===0?W:U):_.last_lit&&(q(_,!1),_.strm.avail_out===0)?k:L}function ue(_,ee){for(var Q,O,R;;){if(_.lookahead<B){if(ge(_),_.lookahead<B&&ee===f)return k;if(_.lookahead===0)break}if(Q=0,_.lookahead>=z&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),_.prev_length=_.match_length,_.prev_match=_.match_start,_.match_length=z-1,Q!==0&&_.prev_length<_.max_lazy_match&&_.strstart-Q<=_.w_size-B&&(_.match_length=le(_,Q),_.match_length<=5&&(_.strategy===1||_.match_length===z&&4096<_.strstart-_.match_start)&&(_.match_length=z-1)),_.prev_length>=z&&_.match_length<=_.prev_length){for(R=_.strstart+_.lookahead-z,O=l._tr_tally(_,_.strstart-1-_.prev_match,_.prev_length-z),_.lookahead-=_.prev_length-1,_.prev_length-=2;++_.strstart<=R&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),--_.prev_length!=0;);if(_.match_available=0,_.match_length=z-1,_.strstart++,O&&(q(_,!1),_.strm.avail_out===0))return k}else if(_.match_available){if((O=l._tr_tally(_,0,_.window[_.strstart-1]))&&q(_,!1),_.strstart++,_.lookahead--,_.strm.avail_out===0)return k}else _.match_available=1,_.strstart++,_.lookahead--}return _.match_available&&(O=l._tr_tally(_,0,_.window[_.strstart-1]),_.match_available=0),_.insert=_.strstart<z-1?_.strstart:z-1,ee===h?(q(_,!0),_.strm.avail_out===0?W:U):_.last_lit&&(q(_,!1),_.strm.avail_out===0)?k:L}function de(_,ee,Q,O,R){this.good_length=_,this.max_lazy=ee,this.nice_length=Q,this.max_chain=O,this.func=R}function he(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=v,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new a.Buf16(2*E),this.dyn_dtree=new a.Buf16(2*(2*S+1)),this.bl_tree=new a.Buf16(2*(2*j+1)),A(this.dyn_ltree),A(this.dyn_dtree),A(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new a.Buf16(N+1),this.heap=new a.Buf16(2*C+1),A(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new a.Buf16(2*C+1),A(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function me(_){var ee;return _&&_.state?(_.total_in=_.total_out=0,_.data_type=b,(ee=_.state).pending=0,ee.pending_out=0,ee.wrap<0&&(ee.wrap=-ee.wrap),ee.status=ee.wrap?T:D,_.adler=ee.wrap===2?0:1,ee.last_flush=f,l._tr_init(ee),p):$(_,y)}function fe(_){var ee=me(_);return ee===p&&(function(Q){Q.window_size=2*Q.w_size,A(Q.head),Q.max_lazy_match=s[Q.level].max_lazy,Q.good_match=s[Q.level].good_length,Q.nice_match=s[Q.level].nice_length,Q.max_chain_length=s[Q.level].max_chain,Q.strstart=0,Q.block_start=0,Q.lookahead=0,Q.insert=0,Q.match_length=Q.prev_length=z-1,Q.match_available=0,Q.ins_h=0})(_.state),ee}function Se(_,ee,Q,O,R,Z){if(!_)return y;var V=1;if(ee===m&&(ee=6),O<0?(V=0,O=-O):15<O&&(V=2,O-=16),R<1||w<R||Q!==v||O<8||15<O||ee<0||9<ee||Z<0||x<Z)return $(_,y);O===8&&(O=9);var J=new he;return(_.state=J).strm=_,J.wrap=V,J.gzhead=null,J.w_bits=O,J.w_size=1<<J.w_bits,J.w_mask=J.w_size-1,J.hash_bits=R+7,J.hash_size=1<<J.hash_bits,J.hash_mask=J.hash_size-1,J.hash_shift=~~((J.hash_bits+z-1)/z),J.window=new a.Buf8(2*J.w_size),J.head=new a.Buf16(J.hash_size),J.prev=new a.Buf16(J.w_size),J.lit_bufsize=1<<R+6,J.pending_buf_size=4*J.lit_bufsize,J.pending_buf=new a.Buf8(J.pending_buf_size),J.d_buf=1*J.lit_bufsize,J.l_buf=3*J.lit_bufsize,J.level=ee,J.strategy=Z,J.method=Q,fe(_)}s=[new de(0,0,0,0,function(_,ee){var Q=65535;for(Q>_.pending_buf_size-5&&(Q=_.pending_buf_size-5);;){if(_.lookahead<=1){if(ge(_),_.lookahead===0&&ee===f)return k;if(_.lookahead===0)break}_.strstart+=_.lookahead,_.lookahead=0;var O=_.block_start+Q;if((_.strstart===0||_.strstart>=O)&&(_.lookahead=_.strstart-O,_.strstart=O,q(_,!1),_.strm.avail_out===0)||_.strstart-_.block_start>=_.w_size-B&&(q(_,!1),_.strm.avail_out===0))return k}return _.insert=0,ee===h?(q(_,!0),_.strm.avail_out===0?W:U):(_.strstart>_.block_start&&(q(_,!1),_.strm.avail_out),k)}),new de(4,4,8,4,ne),new de(4,5,16,8,ne),new de(4,6,32,32,ne),new de(4,4,16,16,ue),new de(8,16,32,32,ue),new de(8,16,128,128,ue),new de(8,32,128,256,ue),new de(32,128,258,1024,ue),new de(32,258,258,4096,ue)],o.deflateInit=function(_,ee){return Se(_,ee,v,15,8,0)},o.deflateInit2=Se,o.deflateReset=fe,o.deflateResetKeep=me,o.deflateSetHeader=function(_,ee){return _&&_.state?_.state.wrap!==2?y:(_.state.gzhead=ee,p):y},o.deflate=function(_,ee){var Q,O,R,Z;if(!_||!_.state||5<ee||ee<0)return _?$(_,y):y;if(O=_.state,!_.output||!_.input&&_.avail_in!==0||O.status===666&&ee!==h)return $(_,_.avail_out===0?-5:y);if(O.strm=_,Q=O.last_flush,O.last_flush=ee,O.status===T)if(O.wrap===2)_.adler=0,P(O,31),P(O,139),P(O,8),O.gzhead?(P(O,(O.gzhead.text?1:0)+(O.gzhead.hcrc?2:0)+(O.gzhead.extra?4:0)+(O.gzhead.name?8:0)+(O.gzhead.comment?16:0)),P(O,255&O.gzhead.time),P(O,O.gzhead.time>>8&255),P(O,O.gzhead.time>>16&255),P(O,O.gzhead.time>>24&255),P(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),P(O,255&O.gzhead.os),O.gzhead.extra&&O.gzhead.extra.length&&(P(O,255&O.gzhead.extra.length),P(O,O.gzhead.extra.length>>8&255)),O.gzhead.hcrc&&(_.adler=u(_.adler,O.pending_buf,O.pending,0)),O.gzindex=0,O.status=69):(P(O,0),P(O,0),P(O,0),P(O,0),P(O,0),P(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),P(O,3),O.status=D);else{var V=v+(O.w_bits-8<<4)<<8;V|=(2<=O.strategy||O.level<2?0:O.level<6?1:O.level===6?2:3)<<6,O.strstart!==0&&(V|=32),V+=31-V%31,O.status=D,ie(O,V),O.strstart!==0&&(ie(O,_.adler>>>16),ie(O,65535&_.adler)),_.adler=1}if(O.status===69)if(O.gzhead.extra){for(R=O.pending;O.gzindex<(65535&O.gzhead.extra.length)&&(O.pending!==O.pending_buf_size||(O.gzhead.hcrc&&O.pending>R&&(_.adler=u(_.adler,O.pending_buf,O.pending-R,R)),K(_),R=O.pending,O.pending!==O.pending_buf_size));)P(O,255&O.gzhead.extra[O.gzindex]),O.gzindex++;O.gzhead.hcrc&&O.pending>R&&(_.adler=u(_.adler,O.pending_buf,O.pending-R,R)),O.gzindex===O.gzhead.extra.length&&(O.gzindex=0,O.status=73)}else O.status=73;if(O.status===73)if(O.gzhead.name){R=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>R&&(_.adler=u(_.adler,O.pending_buf,O.pending-R,R)),K(_),R=O.pending,O.pending===O.pending_buf_size)){Z=1;break}Z=O.gzindex<O.gzhead.name.length?255&O.gzhead.name.charCodeAt(O.gzindex++):0,P(O,Z)}while(Z!==0);O.gzhead.hcrc&&O.pending>R&&(_.adler=u(_.adler,O.pending_buf,O.pending-R,R)),Z===0&&(O.gzindex=0,O.status=91)}else O.status=91;if(O.status===91)if(O.gzhead.comment){R=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>R&&(_.adler=u(_.adler,O.pending_buf,O.pending-R,R)),K(_),R=O.pending,O.pending===O.pending_buf_size)){Z=1;break}Z=O.gzindex<O.gzhead.comment.length?255&O.gzhead.comment.charCodeAt(O.gzindex++):0,P(O,Z)}while(Z!==0);O.gzhead.hcrc&&O.pending>R&&(_.adler=u(_.adler,O.pending_buf,O.pending-R,R)),Z===0&&(O.status=103)}else O.status=103;if(O.status===103&&(O.gzhead.hcrc?(O.pending+2>O.pending_buf_size&&K(_),O.pending+2<=O.pending_buf_size&&(P(O,255&_.adler),P(O,_.adler>>8&255),_.adler=0,O.status=D)):O.status=D),O.pending!==0){if(K(_),_.avail_out===0)return O.last_flush=-1,p}else if(_.avail_in===0&&G(ee)<=G(Q)&&ee!==h)return $(_,-5);if(O.status===666&&_.avail_in!==0)return $(_,-5);if(_.avail_in!==0||O.lookahead!==0||ee!==f&&O.status!==666){var J=O.strategy===2?(function(H,ae){for(var Y;;){if(H.lookahead===0&&(ge(H),H.lookahead===0)){if(ae===f)return k;break}if(H.match_length=0,Y=l._tr_tally(H,0,H.window[H.strstart]),H.lookahead--,H.strstart++,Y&&(q(H,!1),H.strm.avail_out===0))return k}return H.insert=0,ae===h?(q(H,!0),H.strm.avail_out===0?W:U):H.last_lit&&(q(H,!1),H.strm.avail_out===0)?k:L})(O,ee):O.strategy===3?(function(H,ae){for(var Y,te,F,X,ce=H.window;;){if(H.lookahead<=M){if(ge(H),H.lookahead<=M&&ae===f)return k;if(H.lookahead===0)break}if(H.match_length=0,H.lookahead>=z&&0<H.strstart&&(te=ce[F=H.strstart-1])===ce[++F]&&te===ce[++F]&&te===ce[++F]){X=H.strstart+M;do;while(te===ce[++F]&&te===ce[++F]&&te===ce[++F]&&te===ce[++F]&&te===ce[++F]&&te===ce[++F]&&te===ce[++F]&&te===ce[++F]&&F<X);H.match_length=M-(X-F),H.match_length>H.lookahead&&(H.match_length=H.lookahead)}if(H.match_length>=z?(Y=l._tr_tally(H,1,H.match_length-z),H.lookahead-=H.match_length,H.strstart+=H.match_length,H.match_length=0):(Y=l._tr_tally(H,0,H.window[H.strstart]),H.lookahead--,H.strstart++),Y&&(q(H,!1),H.strm.avail_out===0))return k}return H.insert=0,ae===h?(q(H,!0),H.strm.avail_out===0?W:U):H.last_lit&&(q(H,!1),H.strm.avail_out===0)?k:L})(O,ee):s[O.level].func(O,ee);if(J!==W&&J!==U||(O.status=666),J===k||J===W)return _.avail_out===0&&(O.last_flush=-1),p;if(J===L&&(ee===1?l._tr_align(O):ee!==5&&(l._tr_stored_block(O,0,0,!1),ee===3&&(A(O.head),O.lookahead===0&&(O.strstart=0,O.block_start=0,O.insert=0))),K(_),_.avail_out===0))return O.last_flush=-1,p}return ee!==h?p:O.wrap<=0?1:(O.wrap===2?(P(O,255&_.adler),P(O,_.adler>>8&255),P(O,_.adler>>16&255),P(O,_.adler>>24&255),P(O,255&_.total_in),P(O,_.total_in>>8&255),P(O,_.total_in>>16&255),P(O,_.total_in>>24&255)):(ie(O,_.adler>>>16),ie(O,65535&_.adler)),K(_),0<O.wrap&&(O.wrap=-O.wrap),O.pending!==0?p:1)},o.deflateEnd=function(_){var ee;return _&&_.state?(ee=_.state.status)!==T&&ee!==69&&ee!==73&&ee!==91&&ee!==103&&ee!==D&&ee!==666?$(_,y):(_.state=null,ee===D?$(_,-3):p):y},o.deflateSetDictionary=function(_,ee){var Q,O,R,Z,V,J,H,ae,Y=ee.length;if(!_||!_.state||(Z=(Q=_.state).wrap)===2||Z===1&&Q.status!==T||Q.lookahead)return y;for(Z===1&&(_.adler=c(_.adler,ee,Y,0)),Q.wrap=0,Y>=Q.w_size&&(Z===0&&(A(Q.head),Q.strstart=0,Q.block_start=0,Q.insert=0),ae=new a.Buf8(Q.w_size),a.arraySet(ae,ee,Y-Q.w_size,Q.w_size,0),ee=ae,Y=Q.w_size),V=_.avail_in,J=_.next_in,H=_.input,_.avail_in=Y,_.next_in=0,_.input=ee,ge(Q);Q.lookahead>=z;){for(O=Q.strstart,R=Q.lookahead-(z-1);Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[O+z-1])&Q.hash_mask,Q.prev[O&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=O,O++,--R;);Q.strstart=O,Q.lookahead=z-1,ge(Q)}return Q.strstart+=Q.lookahead,Q.block_start=Q.strstart,Q.insert=Q.lookahead,Q.lookahead=0,Q.match_length=Q.prev_length=z-1,Q.match_available=0,_.next_in=J,_.input=H,_.avail_in=V,Q.wrap=Z,p},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){r.exports=function(s,a){var l,c,u,d,f,h,p,y,m,x,b,v,w,C,S,j,E,N,z,M,B,T,D,k,L;l=s.state,c=s.next_in,k=s.input,u=c+(s.avail_in-5),d=s.next_out,L=s.output,f=d-(a-s.avail_out),h=d+(s.avail_out-257),p=l.dmax,y=l.wsize,m=l.whave,x=l.wnext,b=l.window,v=l.hold,w=l.bits,C=l.lencode,S=l.distcode,j=(1<<l.lenbits)-1,E=(1<<l.distbits)-1;e:do{w<15&&(v+=k[c++]<<w,w+=8,v+=k[c++]<<w,w+=8),N=C[v&j];t:for(;;){if(v>>>=z=N>>>24,w-=z,(z=N>>>16&255)===0)L[d++]=65535&N;else{if(!(16&z)){if((64&z)==0){N=C[(65535&N)+(v&(1<<z)-1)];continue t}if(32&z){l.mode=12;break e}s.msg="invalid literal/length code",l.mode=30;break e}M=65535&N,(z&=15)&&(w<z&&(v+=k[c++]<<w,w+=8),M+=v&(1<<z)-1,v>>>=z,w-=z),w<15&&(v+=k[c++]<<w,w+=8,v+=k[c++]<<w,w+=8),N=S[v&E];n:for(;;){if(v>>>=z=N>>>24,w-=z,!(16&(z=N>>>16&255))){if((64&z)==0){N=S[(65535&N)+(v&(1<<z)-1)];continue n}s.msg="invalid distance code",l.mode=30;break e}if(B=65535&N,w<(z&=15)&&(v+=k[c++]<<w,(w+=8)<z&&(v+=k[c++]<<w,w+=8)),p<(B+=v&(1<<z)-1)){s.msg="invalid distance too far back",l.mode=30;break e}if(v>>>=z,w-=z,(z=d-f)<B){if(m<(z=B-z)&&l.sane){s.msg="invalid distance too far back",l.mode=30;break e}if(D=b,(T=0)===x){if(T+=y-z,z<M){for(M-=z;L[d++]=b[T++],--z;);T=d-B,D=L}}else if(x<z){if(T+=y+x-z,(z-=x)<M){for(M-=z;L[d++]=b[T++],--z;);if(T=0,x<M){for(M-=z=x;L[d++]=b[T++],--z;);T=d-B,D=L}}}else if(T+=x-z,z<M){for(M-=z;L[d++]=b[T++],--z;);T=d-B,D=L}for(;2<M;)L[d++]=D[T++],L[d++]=D[T++],L[d++]=D[T++],M-=3;M&&(L[d++]=D[T++],1<M&&(L[d++]=D[T++]))}else{for(T=d-B;L[d++]=L[T++],L[d++]=L[T++],L[d++]=L[T++],2<(M-=3););M&&(L[d++]=L[T++],1<M&&(L[d++]=L[T++]))}break}}break}}while(c<u&&d<h);c-=M=w>>3,v&=(1<<(w-=M<<3))-1,s.next_in=c,s.next_out=d,s.avail_in=c<u?u-c+5:5-(c-u),s.avail_out=d<h?h-d+257:257-(d-h),l.hold=v,l.bits=w}},{}],49:[function(n,r,o){var s=n("../utils/common"),a=n("./adler32"),l=n("./crc32"),c=n("./inffast"),u=n("./inftrees"),d=1,f=2,h=0,p=-2,y=1,m=852,x=592;function b(T){return(T>>>24&255)+(T>>>8&65280)+((65280&T)<<8)+((255&T)<<24)}function v(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(T){var D;return T&&T.state?(D=T.state,T.total_in=T.total_out=D.total=0,T.msg="",D.wrap&&(T.adler=1&D.wrap),D.mode=y,D.last=0,D.havedict=0,D.dmax=32768,D.head=null,D.hold=0,D.bits=0,D.lencode=D.lendyn=new s.Buf32(m),D.distcode=D.distdyn=new s.Buf32(x),D.sane=1,D.back=-1,h):p}function C(T){var D;return T&&T.state?((D=T.state).wsize=0,D.whave=0,D.wnext=0,w(T)):p}function S(T,D){var k,L;return T&&T.state?(L=T.state,D<0?(k=0,D=-D):(k=1+(D>>4),D<48&&(D&=15)),D&&(D<8||15<D)?p:(L.window!==null&&L.wbits!==D&&(L.window=null),L.wrap=k,L.wbits=D,C(T))):p}function j(T,D){var k,L;return T?(L=new v,(T.state=L).window=null,(k=S(T,D))!==h&&(T.state=null),k):p}var E,N,z=!0;function M(T){if(z){var D;for(E=new s.Buf32(512),N=new s.Buf32(32),D=0;D<144;)T.lens[D++]=8;for(;D<256;)T.lens[D++]=9;for(;D<280;)T.lens[D++]=7;for(;D<288;)T.lens[D++]=8;for(u(d,T.lens,0,288,E,0,T.work,{bits:9}),D=0;D<32;)T.lens[D++]=5;u(f,T.lens,0,32,N,0,T.work,{bits:5}),z=!1}T.lencode=E,T.lenbits=9,T.distcode=N,T.distbits=5}function B(T,D,k,L){var W,U=T.state;return U.window===null&&(U.wsize=1<<U.wbits,U.wnext=0,U.whave=0,U.window=new s.Buf8(U.wsize)),L>=U.wsize?(s.arraySet(U.window,D,k-U.wsize,U.wsize,0),U.wnext=0,U.whave=U.wsize):(L<(W=U.wsize-U.wnext)&&(W=L),s.arraySet(U.window,D,k-L,W,U.wnext),(L-=W)?(s.arraySet(U.window,D,k-L,L,0),U.wnext=L,U.whave=U.wsize):(U.wnext+=W,U.wnext===U.wsize&&(U.wnext=0),U.whave<U.wsize&&(U.whave+=W))),0}o.inflateReset=C,o.inflateReset2=S,o.inflateResetKeep=w,o.inflateInit=function(T){return j(T,15)},o.inflateInit2=j,o.inflate=function(T,D){var k,L,W,U,$,G,A,K,q,P,ie,le,ge,ne,ue,de,he,me,fe,Se,_,ee,Q,O,R=0,Z=new s.Buf8(4),V=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!T||!T.state||!T.output||!T.input&&T.avail_in!==0)return p;(k=T.state).mode===12&&(k.mode=13),$=T.next_out,W=T.output,A=T.avail_out,U=T.next_in,L=T.input,G=T.avail_in,K=k.hold,q=k.bits,P=G,ie=A,ee=h;e:for(;;)switch(k.mode){case y:if(k.wrap===0){k.mode=13;break}for(;q<16;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}if(2&k.wrap&&K===35615){Z[k.check=0]=255&K,Z[1]=K>>>8&255,k.check=l(k.check,Z,2,0),q=K=0,k.mode=2;break}if(k.flags=0,k.head&&(k.head.done=!1),!(1&k.wrap)||(((255&K)<<8)+(K>>8))%31){T.msg="incorrect header check",k.mode=30;break}if((15&K)!=8){T.msg="unknown compression method",k.mode=30;break}if(q-=4,_=8+(15&(K>>>=4)),k.wbits===0)k.wbits=_;else if(_>k.wbits){T.msg="invalid window size",k.mode=30;break}k.dmax=1<<_,T.adler=k.check=1,k.mode=512&K?10:12,q=K=0;break;case 2:for(;q<16;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}if(k.flags=K,(255&k.flags)!=8){T.msg="unknown compression method",k.mode=30;break}if(57344&k.flags){T.msg="unknown header flags set",k.mode=30;break}k.head&&(k.head.text=K>>8&1),512&k.flags&&(Z[0]=255&K,Z[1]=K>>>8&255,k.check=l(k.check,Z,2,0)),q=K=0,k.mode=3;case 3:for(;q<32;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}k.head&&(k.head.time=K),512&k.flags&&(Z[0]=255&K,Z[1]=K>>>8&255,Z[2]=K>>>16&255,Z[3]=K>>>24&255,k.check=l(k.check,Z,4,0)),q=K=0,k.mode=4;case 4:for(;q<16;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}k.head&&(k.head.xflags=255&K,k.head.os=K>>8),512&k.flags&&(Z[0]=255&K,Z[1]=K>>>8&255,k.check=l(k.check,Z,2,0)),q=K=0,k.mode=5;case 5:if(1024&k.flags){for(;q<16;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}k.length=K,k.head&&(k.head.extra_len=K),512&k.flags&&(Z[0]=255&K,Z[1]=K>>>8&255,k.check=l(k.check,Z,2,0)),q=K=0}else k.head&&(k.head.extra=null);k.mode=6;case 6:if(1024&k.flags&&(G<(le=k.length)&&(le=G),le&&(k.head&&(_=k.head.extra_len-k.length,k.head.extra||(k.head.extra=new Array(k.head.extra_len)),s.arraySet(k.head.extra,L,U,le,_)),512&k.flags&&(k.check=l(k.check,L,le,U)),G-=le,U+=le,k.length-=le),k.length))break e;k.length=0,k.mode=7;case 7:if(2048&k.flags){if(G===0)break e;for(le=0;_=L[U+le++],k.head&&_&&k.length<65536&&(k.head.name+=String.fromCharCode(_)),_&&le<G;);if(512&k.flags&&(k.check=l(k.check,L,le,U)),G-=le,U+=le,_)break e}else k.head&&(k.head.name=null);k.length=0,k.mode=8;case 8:if(4096&k.flags){if(G===0)break e;for(le=0;_=L[U+le++],k.head&&_&&k.length<65536&&(k.head.comment+=String.fromCharCode(_)),_&&le<G;);if(512&k.flags&&(k.check=l(k.check,L,le,U)),G-=le,U+=le,_)break e}else k.head&&(k.head.comment=null);k.mode=9;case 9:if(512&k.flags){for(;q<16;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}if(K!==(65535&k.check)){T.msg="header crc mismatch",k.mode=30;break}q=K=0}k.head&&(k.head.hcrc=k.flags>>9&1,k.head.done=!0),T.adler=k.check=0,k.mode=12;break;case 10:for(;q<32;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}T.adler=k.check=b(K),q=K=0,k.mode=11;case 11:if(k.havedict===0)return T.next_out=$,T.avail_out=A,T.next_in=U,T.avail_in=G,k.hold=K,k.bits=q,2;T.adler=k.check=1,k.mode=12;case 12:if(D===5||D===6)break e;case 13:if(k.last){K>>>=7&q,q-=7&q,k.mode=27;break}for(;q<3;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}switch(k.last=1&K,q-=1,3&(K>>>=1)){case 0:k.mode=14;break;case 1:if(M(k),k.mode=20,D!==6)break;K>>>=2,q-=2;break e;case 2:k.mode=17;break;case 3:T.msg="invalid block type",k.mode=30}K>>>=2,q-=2;break;case 14:for(K>>>=7&q,q-=7&q;q<32;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}if((65535&K)!=(K>>>16^65535)){T.msg="invalid stored block lengths",k.mode=30;break}if(k.length=65535&K,q=K=0,k.mode=15,D===6)break e;case 15:k.mode=16;case 16:if(le=k.length){if(G<le&&(le=G),A<le&&(le=A),le===0)break e;s.arraySet(W,L,U,le,$),G-=le,U+=le,A-=le,$+=le,k.length-=le;break}k.mode=12;break;case 17:for(;q<14;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}if(k.nlen=257+(31&K),K>>>=5,q-=5,k.ndist=1+(31&K),K>>>=5,q-=5,k.ncode=4+(15&K),K>>>=4,q-=4,286<k.nlen||30<k.ndist){T.msg="too many length or distance symbols",k.mode=30;break}k.have=0,k.mode=18;case 18:for(;k.have<k.ncode;){for(;q<3;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}k.lens[V[k.have++]]=7&K,K>>>=3,q-=3}for(;k.have<19;)k.lens[V[k.have++]]=0;if(k.lencode=k.lendyn,k.lenbits=7,Q={bits:k.lenbits},ee=u(0,k.lens,0,19,k.lencode,0,k.work,Q),k.lenbits=Q.bits,ee){T.msg="invalid code lengths set",k.mode=30;break}k.have=0,k.mode=19;case 19:for(;k.have<k.nlen+k.ndist;){for(;de=(R=k.lencode[K&(1<<k.lenbits)-1])>>>16&255,he=65535&R,!((ue=R>>>24)<=q);){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}if(he<16)K>>>=ue,q-=ue,k.lens[k.have++]=he;else{if(he===16){for(O=ue+2;q<O;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}if(K>>>=ue,q-=ue,k.have===0){T.msg="invalid bit length repeat",k.mode=30;break}_=k.lens[k.have-1],le=3+(3&K),K>>>=2,q-=2}else if(he===17){for(O=ue+3;q<O;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}q-=ue,_=0,le=3+(7&(K>>>=ue)),K>>>=3,q-=3}else{for(O=ue+7;q<O;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}q-=ue,_=0,le=11+(127&(K>>>=ue)),K>>>=7,q-=7}if(k.have+le>k.nlen+k.ndist){T.msg="invalid bit length repeat",k.mode=30;break}for(;le--;)k.lens[k.have++]=_}}if(k.mode===30)break;if(k.lens[256]===0){T.msg="invalid code -- missing end-of-block",k.mode=30;break}if(k.lenbits=9,Q={bits:k.lenbits},ee=u(d,k.lens,0,k.nlen,k.lencode,0,k.work,Q),k.lenbits=Q.bits,ee){T.msg="invalid literal/lengths set",k.mode=30;break}if(k.distbits=6,k.distcode=k.distdyn,Q={bits:k.distbits},ee=u(f,k.lens,k.nlen,k.ndist,k.distcode,0,k.work,Q),k.distbits=Q.bits,ee){T.msg="invalid distances set",k.mode=30;break}if(k.mode=20,D===6)break e;case 20:k.mode=21;case 21:if(6<=G&&258<=A){T.next_out=$,T.avail_out=A,T.next_in=U,T.avail_in=G,k.hold=K,k.bits=q,c(T,ie),$=T.next_out,W=T.output,A=T.avail_out,U=T.next_in,L=T.input,G=T.avail_in,K=k.hold,q=k.bits,k.mode===12&&(k.back=-1);break}for(k.back=0;de=(R=k.lencode[K&(1<<k.lenbits)-1])>>>16&255,he=65535&R,!((ue=R>>>24)<=q);){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}if(de&&(240&de)==0){for(me=ue,fe=de,Se=he;de=(R=k.lencode[Se+((K&(1<<me+fe)-1)>>me)])>>>16&255,he=65535&R,!(me+(ue=R>>>24)<=q);){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}K>>>=me,q-=me,k.back+=me}if(K>>>=ue,q-=ue,k.back+=ue,k.length=he,de===0){k.mode=26;break}if(32&de){k.back=-1,k.mode=12;break}if(64&de){T.msg="invalid literal/length code",k.mode=30;break}k.extra=15&de,k.mode=22;case 22:if(k.extra){for(O=k.extra;q<O;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}k.length+=K&(1<<k.extra)-1,K>>>=k.extra,q-=k.extra,k.back+=k.extra}k.was=k.length,k.mode=23;case 23:for(;de=(R=k.distcode[K&(1<<k.distbits)-1])>>>16&255,he=65535&R,!((ue=R>>>24)<=q);){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}if((240&de)==0){for(me=ue,fe=de,Se=he;de=(R=k.distcode[Se+((K&(1<<me+fe)-1)>>me)])>>>16&255,he=65535&R,!(me+(ue=R>>>24)<=q);){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}K>>>=me,q-=me,k.back+=me}if(K>>>=ue,q-=ue,k.back+=ue,64&de){T.msg="invalid distance code",k.mode=30;break}k.offset=he,k.extra=15&de,k.mode=24;case 24:if(k.extra){for(O=k.extra;q<O;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}k.offset+=K&(1<<k.extra)-1,K>>>=k.extra,q-=k.extra,k.back+=k.extra}if(k.offset>k.dmax){T.msg="invalid distance too far back",k.mode=30;break}k.mode=25;case 25:if(A===0)break e;if(le=ie-A,k.offset>le){if((le=k.offset-le)>k.whave&&k.sane){T.msg="invalid distance too far back",k.mode=30;break}ge=le>k.wnext?(le-=k.wnext,k.wsize-le):k.wnext-le,le>k.length&&(le=k.length),ne=k.window}else ne=W,ge=$-k.offset,le=k.length;for(A<le&&(le=A),A-=le,k.length-=le;W[$++]=ne[ge++],--le;);k.length===0&&(k.mode=21);break;case 26:if(A===0)break e;W[$++]=k.length,A--,k.mode=21;break;case 27:if(k.wrap){for(;q<32;){if(G===0)break e;G--,K|=L[U++]<<q,q+=8}if(ie-=A,T.total_out+=ie,k.total+=ie,ie&&(T.adler=k.check=k.flags?l(k.check,W,ie,$-ie):a(k.check,W,ie,$-ie)),ie=A,(k.flags?K:b(K))!==k.check){T.msg="incorrect data check",k.mode=30;break}q=K=0}k.mode=28;case 28:if(k.wrap&&k.flags){for(;q<32;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}if(K!==(4294967295&k.total)){T.msg="incorrect length check",k.mode=30;break}q=K=0}k.mode=29;case 29:ee=1;break e;case 30:ee=-3;break e;case 31:return-4;default:return p}return T.next_out=$,T.avail_out=A,T.next_in=U,T.avail_in=G,k.hold=K,k.bits=q,(k.wsize||ie!==T.avail_out&&k.mode<30&&(k.mode<27||D!==4))&&B(T,T.output,T.next_out,ie-T.avail_out)?(k.mode=31,-4):(P-=T.avail_in,ie-=T.avail_out,T.total_in+=P,T.total_out+=ie,k.total+=ie,k.wrap&&ie&&(T.adler=k.check=k.flags?l(k.check,W,ie,T.next_out-ie):a(k.check,W,ie,T.next_out-ie)),T.data_type=k.bits+(k.last?64:0)+(k.mode===12?128:0)+(k.mode===20||k.mode===15?256:0),(P==0&&ie===0||D===4)&&ee===h&&(ee=-5),ee)},o.inflateEnd=function(T){if(!T||!T.state)return p;var D=T.state;return D.window&&(D.window=null),T.state=null,h},o.inflateGetHeader=function(T,D){var k;return T&&T.state?(2&(k=T.state).wrap)==0?p:((k.head=D).done=!1,h):p},o.inflateSetDictionary=function(T,D){var k,L=D.length;return T&&T.state?(k=T.state).wrap!==0&&k.mode!==11?p:k.mode===11&&a(1,D,L,0)!==k.check?-3:B(T,D,L,L)?(k.mode=31,-4):(k.havedict=1,h):p},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){var s=n("../utils/common"),a=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(d,f,h,p,y,m,x,b){var v,w,C,S,j,E,N,z,M,B=b.bits,T=0,D=0,k=0,L=0,W=0,U=0,$=0,G=0,A=0,K=0,q=null,P=0,ie=new s.Buf16(16),le=new s.Buf16(16),ge=null,ne=0;for(T=0;T<=15;T++)ie[T]=0;for(D=0;D<p;D++)ie[f[h+D]]++;for(W=B,L=15;1<=L&&ie[L]===0;L--);if(L<W&&(W=L),L===0)return y[m++]=20971520,y[m++]=20971520,b.bits=1,0;for(k=1;k<L&&ie[k]===0;k++);for(W<k&&(W=k),T=G=1;T<=15;T++)if(G<<=1,(G-=ie[T])<0)return-1;if(0<G&&(d===0||L!==1))return-1;for(le[1]=0,T=1;T<15;T++)le[T+1]=le[T]+ie[T];for(D=0;D<p;D++)f[h+D]!==0&&(x[le[f[h+D]]++]=D);if(E=d===0?(q=ge=x,19):d===1?(q=a,P-=257,ge=l,ne-=257,256):(q=c,ge=u,-1),T=k,j=m,$=D=K=0,C=-1,S=(A=1<<(U=W))-1,d===1&&852<A||d===2&&592<A)return 1;for(;;){for(N=T-$,M=x[D]<E?(z=0,x[D]):x[D]>E?(z=ge[ne+x[D]],q[P+x[D]]):(z=96,0),v=1<<T-$,k=w=1<<U;y[j+(K>>$)+(w-=v)]=N<<24|z<<16|M|0,w!==0;);for(v=1<<T-1;K&v;)v>>=1;if(v!==0?(K&=v-1,K+=v):K=0,D++,--ie[T]==0){if(T===L)break;T=f[h+x[D]]}if(W<T&&(K&S)!==C){for($===0&&($=W),j+=k,G=1<<(U=T-$);U+$<L&&!((G-=ie[U+$])<=0);)U++,G<<=1;if(A+=1<<U,d===1&&852<A||d===2&&592<A)return 1;y[C=K&S]=W<<24|U<<16|j-m|0}}return K!==0&&(y[j+K]=T-$<<24|64<<16|0),b.bits=W,0}},{"../utils/common":41}],51:[function(n,r,o){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){var s=n("../utils/common"),a=0,l=1;function c(R){for(var Z=R.length;0<=--Z;)R[Z]=0}var u=0,d=29,f=256,h=f+1+d,p=30,y=19,m=2*h+1,x=15,b=16,v=7,w=256,C=16,S=17,j=18,E=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],N=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],z=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],M=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],B=new Array(2*(h+2));c(B);var T=new Array(2*p);c(T);var D=new Array(512);c(D);var k=new Array(256);c(k);var L=new Array(d);c(L);var W,U,$,G=new Array(p);function A(R,Z,V,J,H){this.static_tree=R,this.extra_bits=Z,this.extra_base=V,this.elems=J,this.max_length=H,this.has_stree=R&&R.length}function K(R,Z){this.dyn_tree=R,this.max_code=0,this.stat_desc=Z}function q(R){return R<256?D[R]:D[256+(R>>>7)]}function P(R,Z){R.pending_buf[R.pending++]=255&Z,R.pending_buf[R.pending++]=Z>>>8&255}function ie(R,Z,V){R.bi_valid>b-V?(R.bi_buf|=Z<<R.bi_valid&65535,P(R,R.bi_buf),R.bi_buf=Z>>b-R.bi_valid,R.bi_valid+=V-b):(R.bi_buf|=Z<<R.bi_valid&65535,R.bi_valid+=V)}function le(R,Z,V){ie(R,V[2*Z],V[2*Z+1])}function ge(R,Z){for(var V=0;V|=1&R,R>>>=1,V<<=1,0<--Z;);return V>>>1}function ne(R,Z,V){var J,H,ae=new Array(x+1),Y=0;for(J=1;J<=x;J++)ae[J]=Y=Y+V[J-1]<<1;for(H=0;H<=Z;H++){var te=R[2*H+1];te!==0&&(R[2*H]=ge(ae[te]++,te))}}function ue(R){var Z;for(Z=0;Z<h;Z++)R.dyn_ltree[2*Z]=0;for(Z=0;Z<p;Z++)R.dyn_dtree[2*Z]=0;for(Z=0;Z<y;Z++)R.bl_tree[2*Z]=0;R.dyn_ltree[2*w]=1,R.opt_len=R.static_len=0,R.last_lit=R.matches=0}function de(R){8<R.bi_valid?P(R,R.bi_buf):0<R.bi_valid&&(R.pending_buf[R.pending++]=R.bi_buf),R.bi_buf=0,R.bi_valid=0}function he(R,Z,V,J){var H=2*Z,ae=2*V;return R[H]<R[ae]||R[H]===R[ae]&&J[Z]<=J[V]}function me(R,Z,V){for(var J=R.heap[V],H=V<<1;H<=R.heap_len&&(H<R.heap_len&&he(Z,R.heap[H+1],R.heap[H],R.depth)&&H++,!he(Z,J,R.heap[H],R.depth));)R.heap[V]=R.heap[H],V=H,H<<=1;R.heap[V]=J}function fe(R,Z,V){var J,H,ae,Y,te=0;if(R.last_lit!==0)for(;J=R.pending_buf[R.d_buf+2*te]<<8|R.pending_buf[R.d_buf+2*te+1],H=R.pending_buf[R.l_buf+te],te++,J===0?le(R,H,Z):(le(R,(ae=k[H])+f+1,Z),(Y=E[ae])!==0&&ie(R,H-=L[ae],Y),le(R,ae=q(--J),V),(Y=N[ae])!==0&&ie(R,J-=G[ae],Y)),te<R.last_lit;);le(R,w,Z)}function Se(R,Z){var V,J,H,ae=Z.dyn_tree,Y=Z.stat_desc.static_tree,te=Z.stat_desc.has_stree,F=Z.stat_desc.elems,X=-1;for(R.heap_len=0,R.heap_max=m,V=0;V<F;V++)ae[2*V]!==0?(R.heap[++R.heap_len]=X=V,R.depth[V]=0):ae[2*V+1]=0;for(;R.heap_len<2;)ae[2*(H=R.heap[++R.heap_len]=X<2?++X:0)]=1,R.depth[H]=0,R.opt_len--,te&&(R.static_len-=Y[2*H+1]);for(Z.max_code=X,V=R.heap_len>>1;1<=V;V--)me(R,ae,V);for(H=F;V=R.heap[1],R.heap[1]=R.heap[R.heap_len--],me(R,ae,1),J=R.heap[1],R.heap[--R.heap_max]=V,R.heap[--R.heap_max]=J,ae[2*H]=ae[2*V]+ae[2*J],R.depth[H]=(R.depth[V]>=R.depth[J]?R.depth[V]:R.depth[J])+1,ae[2*V+1]=ae[2*J+1]=H,R.heap[1]=H++,me(R,ae,1),2<=R.heap_len;);R.heap[--R.heap_max]=R.heap[1],(function(ce,ve){var Ee,We,mt,Oe,Lt,Yt,Je=ve.dyn_tree,Xt=ve.max_code,At=ve.stat_desc.static_tree,_x=ve.stat_desc.has_stree,Sx=ve.stat_desc.extra_bits,Ql=ve.stat_desc.extra_base,Sr=ve.stat_desc.max_length,ao=0;for(Oe=0;Oe<=x;Oe++)ce.bl_count[Oe]=0;for(Je[2*ce.heap[ce.heap_max]+1]=0,Ee=ce.heap_max+1;Ee<m;Ee++)Sr<(Oe=Je[2*Je[2*(We=ce.heap[Ee])+1]+1]+1)&&(Oe=Sr,ao++),Je[2*We+1]=Oe,Xt<We||(ce.bl_count[Oe]++,Lt=0,Ql<=We&&(Lt=Sx[We-Ql]),Yt=Je[2*We],ce.opt_len+=Yt*(Oe+Lt),_x&&(ce.static_len+=Yt*(At[2*We+1]+Lt)));if(ao!==0){do{for(Oe=Sr-1;ce.bl_count[Oe]===0;)Oe--;ce.bl_count[Oe]--,ce.bl_count[Oe+1]+=2,ce.bl_count[Sr]--,ao-=2}while(0<ao);for(Oe=Sr;Oe!==0;Oe--)for(We=ce.bl_count[Oe];We!==0;)Xt<(mt=ce.heap[--Ee])||(Je[2*mt+1]!==Oe&&(ce.opt_len+=(Oe-Je[2*mt+1])*Je[2*mt],Je[2*mt+1]=Oe),We--)}})(R,Z),ne(ae,X,R.bl_count)}function _(R,Z,V){var J,H,ae=-1,Y=Z[1],te=0,F=7,X=4;for(Y===0&&(F=138,X=3),Z[2*(V+1)+1]=65535,J=0;J<=V;J++)H=Y,Y=Z[2*(J+1)+1],++te<F&&H===Y||(te<X?R.bl_tree[2*H]+=te:H!==0?(H!==ae&&R.bl_tree[2*H]++,R.bl_tree[2*C]++):te<=10?R.bl_tree[2*S]++:R.bl_tree[2*j]++,ae=H,X=(te=0)===Y?(F=138,3):H===Y?(F=6,3):(F=7,4))}function ee(R,Z,V){var J,H,ae=-1,Y=Z[1],te=0,F=7,X=4;for(Y===0&&(F=138,X=3),J=0;J<=V;J++)if(H=Y,Y=Z[2*(J+1)+1],!(++te<F&&H===Y)){if(te<X)for(;le(R,H,R.bl_tree),--te!=0;);else H!==0?(H!==ae&&(le(R,H,R.bl_tree),te--),le(R,C,R.bl_tree),ie(R,te-3,2)):te<=10?(le(R,S,R.bl_tree),ie(R,te-3,3)):(le(R,j,R.bl_tree),ie(R,te-11,7));ae=H,X=(te=0)===Y?(F=138,3):H===Y?(F=6,3):(F=7,4)}}c(G);var Q=!1;function O(R,Z,V,J){ie(R,(u<<1)+(J?1:0),3),(function(H,ae,Y,te){de(H),P(H,Y),P(H,~Y),s.arraySet(H.pending_buf,H.window,ae,Y,H.pending),H.pending+=Y})(R,Z,V)}o._tr_init=function(R){Q||((function(){var Z,V,J,H,ae,Y=new Array(x+1);for(H=J=0;H<d-1;H++)for(L[H]=J,Z=0;Z<1<<E[H];Z++)k[J++]=H;for(k[J-1]=H,H=ae=0;H<16;H++)for(G[H]=ae,Z=0;Z<1<<N[H];Z++)D[ae++]=H;for(ae>>=7;H<p;H++)for(G[H]=ae<<7,Z=0;Z<1<<N[H]-7;Z++)D[256+ae++]=H;for(V=0;V<=x;V++)Y[V]=0;for(Z=0;Z<=143;)B[2*Z+1]=8,Z++,Y[8]++;for(;Z<=255;)B[2*Z+1]=9,Z++,Y[9]++;for(;Z<=279;)B[2*Z+1]=7,Z++,Y[7]++;for(;Z<=287;)B[2*Z+1]=8,Z++,Y[8]++;for(ne(B,h+1,Y),Z=0;Z<p;Z++)T[2*Z+1]=5,T[2*Z]=ge(Z,5);W=new A(B,E,f+1,h,x),U=new A(T,N,0,p,x),$=new A(new Array(0),z,0,y,v)})(),Q=!0),R.l_desc=new K(R.dyn_ltree,W),R.d_desc=new K(R.dyn_dtree,U),R.bl_desc=new K(R.bl_tree,$),R.bi_buf=0,R.bi_valid=0,ue(R)},o._tr_stored_block=O,o._tr_flush_block=function(R,Z,V,J){var H,ae,Y=0;0<R.level?(R.strm.data_type===2&&(R.strm.data_type=(function(te){var F,X=4093624447;for(F=0;F<=31;F++,X>>>=1)if(1&X&&te.dyn_ltree[2*F]!==0)return a;if(te.dyn_ltree[18]!==0||te.dyn_ltree[20]!==0||te.dyn_ltree[26]!==0)return l;for(F=32;F<f;F++)if(te.dyn_ltree[2*F]!==0)return l;return a})(R)),Se(R,R.l_desc),Se(R,R.d_desc),Y=(function(te){var F;for(_(te,te.dyn_ltree,te.l_desc.max_code),_(te,te.dyn_dtree,te.d_desc.max_code),Se(te,te.bl_desc),F=y-1;3<=F&&te.bl_tree[2*M[F]+1]===0;F--);return te.opt_len+=3*(F+1)+5+5+4,F})(R),H=R.opt_len+3+7>>>3,(ae=R.static_len+3+7>>>3)<=H&&(H=ae)):H=ae=V+5,V+4<=H&&Z!==-1?O(R,Z,V,J):R.strategy===4||ae===H?(ie(R,2+(J?1:0),3),fe(R,B,T)):(ie(R,4+(J?1:0),3),(function(te,F,X,ce){var ve;for(ie(te,F-257,5),ie(te,X-1,5),ie(te,ce-4,4),ve=0;ve<ce;ve++)ie(te,te.bl_tree[2*M[ve]+1],3);ee(te,te.dyn_ltree,F-1),ee(te,te.dyn_dtree,X-1)})(R,R.l_desc.max_code+1,R.d_desc.max_code+1,Y+1),fe(R,R.dyn_ltree,R.dyn_dtree)),ue(R),J&&de(R)},o._tr_tally=function(R,Z,V){return R.pending_buf[R.d_buf+2*R.last_lit]=Z>>>8&255,R.pending_buf[R.d_buf+2*R.last_lit+1]=255&Z,R.pending_buf[R.l_buf+R.last_lit]=255&V,R.last_lit++,Z===0?R.dyn_ltree[2*V]++:(R.matches++,Z--,R.dyn_ltree[2*(k[V]+f+1)]++,R.dyn_dtree[2*q(Z)]++),R.last_lit===R.lit_bufsize-1},o._tr_align=function(R){ie(R,2,3),le(R,w,B),(function(Z){Z.bi_valid===16?(P(Z,Z.bi_buf),Z.bi_buf=0,Z.bi_valid=0):8<=Z.bi_valid&&(Z.pending_buf[Z.pending++]=255&Z.bi_buf,Z.bi_buf>>=8,Z.bi_valid-=8)})(R)}},{"../utils/common":41}],53:[function(n,r,o){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(s){(function(a,l){if(!a.setImmediate){var c,u,d,f,h=1,p={},y=!1,m=a.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(a);x=x&&x.setTimeout?x:a,c={}.toString.call(a.process)==="[object process]"?function(C){process.nextTick(function(){v(C)})}:(function(){if(a.postMessage&&!a.importScripts){var C=!0,S=a.onmessage;return a.onmessage=function(){C=!1},a.postMessage("","*"),a.onmessage=S,C}})()?(f="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",w,!1):a.attachEvent("onmessage",w),function(C){a.postMessage(f+C,"*")}):a.MessageChannel?((d=new MessageChannel).port1.onmessage=function(C){v(C.data)},function(C){d.port2.postMessage(C)}):m&&"onreadystatechange"in m.createElement("script")?(u=m.documentElement,function(C){var S=m.createElement("script");S.onreadystatechange=function(){v(C),S.onreadystatechange=null,u.removeChild(S),S=null},u.appendChild(S)}):function(C){setTimeout(v,0,C)},x.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var S=new Array(arguments.length-1),j=0;j<S.length;j++)S[j]=arguments[j+1];var E={callback:C,args:S};return p[h]=E,c(h),h++},x.clearImmediate=b}function b(C){delete p[C]}function v(C){if(y)setTimeout(v,0,C);else{var S=p[C];if(S){y=!0;try{(function(j){var E=j.callback,N=j.args;switch(N.length){case 0:E();break;case 1:E(N[0]);break;case 2:E(N[0],N[1]);break;case 3:E(N[0],N[1],N[2]);break;default:E.apply(l,N)}})(S)}finally{b(C),y=!1}}}}function w(C){C.source===a&&typeof C.data=="string"&&C.data.indexOf(f)===0&&v(+C.data.slice(f.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof lo<"u"?lo:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(ei)),ei.exports}var vk=yk();const wk=Ia(vk),ip="[REDACTED]",kk=/(^|[-_])(api[-_]?key|authorization|cookie|token|secret|password|access[-_]?token|refresh[-_]?token)([-_]|$)/i,_k=[/Bearer\s+[A-Za-z0-9._~+/=-]{12,}/gi,/\bsk-[A-Za-z0-9_-]{12,}\b/g,/\bsk-ant-[A-Za-z0-9_-]{12,}\b/g,/\bghp_[A-Za-z0-9_]{12,}\b/g,/\bglpat-[A-Za-z0-9_-]{12,}\b/g],Nc=200,Sk=25e6,Ec=50;function Ck(e){return e<1024?`${e} chars`:e<1024*1024?`${Math.ceil(e/1024)} KB`:`${Math.ceil(e/(1024*1024))} MB`}function jk(e){let t=0;for(const n of e)t+=n.rawRequestBody?.length??0,t+=n.responseText?.length??0;return t}function Nk(e){if(e.length>Nc)return`Export is limited to ${Nc} logs at once. Narrow the filter and try again.`;const t=jk(e);return t>Sk?`Export is too large (${Ck(t)} of text). Narrow the filter and try again.`:null}async function Ek(e){try{const t=await fetch(`/api/logs/${e}/chunks`);if(!t.ok)return null;const n=await t.json();return JSON.stringify(n,null,2)}catch{return null}}function Tk(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qi(e){if(Array.isArray(e))return e.map(n=>qi(n));if(!Tk(e))return e;const t={};for(const[n,r]of Object.entries(e))t[n]=kk.test(n)?ip:qi(r);return t}function Ak(e){const t=n=>{let r=n;for(const o of _k)r=r.replace(o,ip);return r};try{const n=JSON.parse(e);return t(JSON.stringify(qi(n),null,2))}catch{return t(e)}}function ti(e,t){return t==="redacted"?Ak(e):e}async function Ik(e,t="redacted"){const n=Nk(e);if(n!==null)return{ok:!1,message:n};const r=new wk,o=t==="redacted"?"redacted":"raw",s=e.filter(u=>u.streaming).slice(0,Ec);r.file("manifest.json",JSON.stringify({exportedAt:new Date().toISOString(),mode:t,redacted:t==="redacted",logCount:e.length,logIds:e.map(u=>u.id),streamingChunkExportLimit:Ec,streamingChunkLogIds:s.map(u=>u.id)},null,2));for(const u of e)u.rawRequestBody!==null&&r.file(`#${u.id}.Request.json`,ti(u.rawRequestBody,t)),u.responseText!==null&&r.file(`#${u.id}.Response.json`,ti(u.responseText,t));for(const u of s){const d=await Ek(u.id);d!==null&&r.file(`#${u.id}.SSE.Response.json`,ti(d,t))}const a=await r.generateAsync({type:"blob"}),l=URL.createObjectURL(a),c=document.createElement("a");return c.href=l,c.download=`agent-inspector-export-${o}-${new Date().toISOString().slice(0,10)}.zip`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(l),{ok:!0}}function zk(e,t){if(e!==null){e.removeAllRanges();for(const n of t)e.addRange(n)}}function Pk(e){if(e===null)return[];const t=[];for(let n=0;n<e.rangeCount;n++)t.push(e.getRangeAt(n));return t}function Rk(e){if(typeof document>"u")return!1;const t=document.activeElement,n=document.getSelection(),r=Pk(n),o=document.createElement("textarea");o.value=e,o.setAttribute("readonly",""),o.style.position="fixed",o.style.top="0",o.style.left="-9999px",o.style.opacity="0",document.body.appendChild(o),o.focus(),o.select(),o.setSelectionRange(0,e.length);let s=!1;try{s=document.execCommand("copy")}catch{}finally{document.body.removeChild(o),zk(n,r),typeof HTMLElement<"u"&&t instanceof HTMLElement&&t.focus({preventScroll:!0})}return s}async function Ot(e){const t=globalThis.navigator?.clipboard;if(t!==void 0)try{return await t.writeText(e),!0}catch{}return Rk(e)}function Ki(e,t){switch(t){case"full":return e;case"time":return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function rl(e,t,n){return`${Ki(e,n)} - ${Ki(t,n)}`}function ap(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=ap(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function lp(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=ap(e))&&(r&&(r+=" "),r+=t);return r}const Ok=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Mk=(e,t)=>({classGroupId:e,validator:t}),cp=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),qo="-",Tc=[],Lk="arbitrary..",Dk=e=>{const t=$k(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return Fk(a);const l=a.split(qo),c=l[0]===""&&l.length>1?1:0;return up(l,c,t)},getConflictingClassGroupIds:(a,l)=>{if(l){const c=r[a],u=n[a];return c?u?Ok(u,c):c:u||Tc}return n[a]||Tc}}},up=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);if(s){const u=up(e,t+1,s);if(u)return u}const a=n.validators;if(a===null)return;const l=t===0?e.join(qo):e.slice(t).join(qo),c=a.length;for(let u=0;u<c;u++){const d=a[u];if(d.validator(l))return d.classGroupId}},Fk=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?Lk+r:void 0})(),$k=e=>{const{theme:t,classGroups:n}=e;return Bk(n,t)},Bk=(e,t)=>{const n=cp();for(const r in e){const o=e[r];ol(o,n,r,t)}return n},ol=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const a=e[s];Uk(a,t,n,r)}},Uk=(e,t,n,r)=>{if(typeof e=="string"){Hk(e,t,n);return}if(typeof e=="function"){Wk(e,t,n,r);return}Vk(e,t,n,r)},Hk=(e,t,n)=>{const r=e===""?t:dp(t,e);r.classGroupId=n},Wk=(e,t,n,r)=>{if(Zk(e)){ol(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Mk(n,e))},Vk=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let a=0;a<s;a++){const[l,c]=o[a];ol(c,dp(t,l),n,r)}},dp=(e,t)=>{let n=e;const r=t.split(qo),o=r.length;for(let s=0;s<o;s++){const a=r[s];let l=n.nextPart.get(a);l||(l=cp(),n.nextPart.set(a,l)),n=l}return n},Zk=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,qk=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(s,a)=>{n[s]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let a=n[s];if(a!==void 0)return a;if((a=r[s])!==void 0)return o(s,a),a},set(s,a){s in n?n[s]=a:o(s,a)}}},Gi="!",Ac=":",Kk=[],Ic=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),Gk=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let a=0,l=0,c=0,u;const d=o.length;for(let m=0;m<d;m++){const x=o[m];if(a===0&&l===0){if(x===Ac){s.push(o.slice(c,m)),c=m+1;continue}if(x==="/"){u=m;continue}}x==="["?a++:x==="]"?a--:x==="("?l++:x===")"&&l--}const f=s.length===0?o:o.slice(c);let h=f,p=!1;f.endsWith(Gi)?(h=f.slice(0,-1),p=!0):f.startsWith(Gi)&&(h=f.slice(1),p=!0);const y=u&&u>c?u-c:void 0;return Ic(s,p,h,y)};if(t){const o=t+Ac,s=r;r=a=>a.startsWith(o)?s(a.slice(o.length)):Ic(Kk,!1,a,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},Jk=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let s=0;s<n.length;s++){const a=n[s],l=a[0]==="[",c=t.has(a);l||c?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(a)):o.push(a)}return o.length>0&&(o.sort(),r.push(...o)),r}},Yk=e=>({cache:qk(e.cacheSize),parseClassName:Gk(e),sortModifiers:Jk(e),...Dk(e)}),Xk=/\s+/,Qk=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,a=[],l=e.trim().split(Xk);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:f,modifiers:h,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:m}=n(d);if(f){c=d+(c.length>0?" "+c:c);continue}let x=!!m,b=r(x?y.substring(0,m):y);if(!b){if(!x){c=d+(c.length>0?" "+c:c);continue}if(b=r(y),!b){c=d+(c.length>0?" "+c:c);continue}x=!1}const v=h.length===0?"":h.length===1?h[0]:s(h).join(":"),w=p?v+Gi:v,C=w+b;if(a.indexOf(C)>-1)continue;a.push(C);const S=o(b,x);for(let j=0;j<S.length;++j){const E=S[j];a.push(w+E)}c=d+(c.length>0?" "+c:c)}return c},e_=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=fp(n))&&(o&&(o+=" "),o+=r);return o},fp=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=fp(e[r]))&&(n&&(n+=" "),n+=t);return n},t_=(e,...t)=>{let n,r,o,s;const a=c=>{const u=t.reduce((d,f)=>f(d),e());return n=Yk(u),r=n.cache.get,o=n.cache.set,s=l,l(c)},l=c=>{const u=r(c);if(u)return u;const d=Qk(c,n);return o(c,d),d};return s=a,(...c)=>s(e_(...c))},n_=[],tt=e=>{const t=n=>n[e]||n_;return t.isThemeGetter=!0,t},pp=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,hp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,r_=/^\d+\/\d+$/,o_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,s_=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,i_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,a_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,l_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Un=e=>r_.test(e),ze=e=>!!e&&!Number.isNaN(Number(e)),cn=e=>!!e&&Number.isInteger(Number(e)),ni=e=>e.endsWith("%")&&ze(e.slice(0,-1)),Qt=e=>o_.test(e),c_=()=>!0,u_=e=>s_.test(e)&&!i_.test(e),mp=()=>!1,d_=e=>a_.test(e),f_=e=>l_.test(e),p_=e=>!we(e)&&!ke(e),h_=e=>gr(e,bp,mp),we=e=>pp.test(e),jn=e=>gr(e,yp,u_),ri=e=>gr(e,y_,ze),zc=e=>gr(e,gp,mp),m_=e=>gr(e,xp,f_),mo=e=>gr(e,vp,d_),ke=e=>hp.test(e),Cr=e=>xr(e,yp),g_=e=>xr(e,v_),Pc=e=>xr(e,gp),x_=e=>xr(e,bp),b_=e=>xr(e,xp),go=e=>xr(e,vp,!0),gr=(e,t,n)=>{const r=pp.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},xr=(e,t,n=!1)=>{const r=hp.exec(e);return r?r[1]?t(r[1]):n:!1},gp=e=>e==="position"||e==="percentage",xp=e=>e==="image"||e==="url",bp=e=>e==="length"||e==="size"||e==="bg-size",yp=e=>e==="length",y_=e=>e==="number",v_=e=>e==="family-name",vp=e=>e==="shadow",w_=()=>{const e=tt("color"),t=tt("font"),n=tt("text"),r=tt("font-weight"),o=tt("tracking"),s=tt("leading"),a=tt("breakpoint"),l=tt("container"),c=tt("spacing"),u=tt("radius"),d=tt("shadow"),f=tt("inset-shadow"),h=tt("text-shadow"),p=tt("drop-shadow"),y=tt("blur"),m=tt("perspective"),x=tt("aspect"),b=tt("ease"),v=tt("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...C(),ke,we],j=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],N=()=>[ke,we,c],z=()=>[Un,"full","auto",...N()],M=()=>[cn,"none","subgrid",ke,we],B=()=>["auto",{span:["full",cn,ke,we]},cn,ke,we],T=()=>[cn,"auto",ke,we],D=()=>["auto","min","max","fr",ke,we],k=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],L=()=>["start","end","center","stretch","center-safe","end-safe"],W=()=>["auto",...N()],U=()=>[Un,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...N()],$=()=>[e,ke,we],G=()=>[...C(),Pc,zc,{position:[ke,we]}],A=()=>["no-repeat",{repeat:["","x","y","space","round"]}],K=()=>["auto","cover","contain",x_,h_,{size:[ke,we]}],q=()=>[ni,Cr,jn],P=()=>["","none","full",u,ke,we],ie=()=>["",ze,Cr,jn],le=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ne=()=>[ze,ni,Pc,zc],ue=()=>["","none",y,ke,we],de=()=>["none",ze,ke,we],he=()=>["none",ze,ke,we],me=()=>[ze,ke,we],fe=()=>[Un,"full",...N()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Qt],breakpoint:[Qt],color:[c_],container:[Qt],"drop-shadow":[Qt],ease:["in","out","in-out"],font:[p_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Qt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Qt],shadow:[Qt],spacing:["px",ze],text:[Qt],"text-shadow":[Qt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Un,we,ke,x]}],container:["container"],columns:[{columns:[ze,we,ke,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{start:z()}],end:[{end:z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[cn,"auto",ke,we]}],basis:[{basis:[Un,"full","auto",l,...N()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ze,Un,"auto","initial","none",we]}],grow:[{grow:["",ze,ke,we]}],shrink:[{shrink:["",ze,ke,we]}],order:[{order:[cn,"first","last","none",ke,we]}],"grid-cols":[{"grid-cols":M()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":T()}],"col-end":[{"col-end":T()}],"grid-rows":[{"grid-rows":M()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":T()}],"row-end":[{"row-end":T()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:N()}],"gap-x":[{"gap-x":N()}],"gap-y":[{"gap-y":N()}],"justify-content":[{justify:[...k(),"normal"]}],"justify-items":[{"justify-items":[...L(),"normal"]}],"justify-self":[{"justify-self":["auto",...L()]}],"align-content":[{content:["normal",...k()]}],"align-items":[{items:[...L(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...L(),{baseline:["","last"]}]}],"place-content":[{"place-content":k()}],"place-items":[{"place-items":[...L(),"baseline"]}],"place-self":[{"place-self":["auto",...L()]}],p:[{p:N()}],px:[{px:N()}],py:[{py:N()}],ps:[{ps:N()}],pe:[{pe:N()}],pt:[{pt:N()}],pr:[{pr:N()}],pb:[{pb:N()}],pl:[{pl:N()}],m:[{m:W()}],mx:[{mx:W()}],my:[{my:W()}],ms:[{ms:W()}],me:[{me:W()}],mt:[{mt:W()}],mr:[{mr:W()}],mb:[{mb:W()}],ml:[{ml:W()}],"space-x":[{"space-x":N()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":N()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],w:[{w:[l,"screen",...U()]}],"min-w":[{"min-w":[l,"screen","none",...U()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[a]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",n,Cr,jn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ke,ri]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ni,we]}],"font-family":[{font:[g_,we,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,ke,we]}],"line-clamp":[{"line-clamp":[ze,"none",ke,ri]}],leading:[{leading:[s,...N()]}],"list-image":[{"list-image":["none",ke,we]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ke,we]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:$()}],"text-color":[{text:$()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...le(),"wavy"]}],"text-decoration-thickness":[{decoration:[ze,"from-font","auto",ke,jn]}],"text-decoration-color":[{decoration:$()}],"underline-offset":[{"underline-offset":[ze,"auto",ke,we]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke,we]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ke,we]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:G()}],"bg-repeat":[{bg:A()}],"bg-size":[{bg:K()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},cn,ke,we],radial:["",ke,we],conic:[cn,ke,we]},b_,m_]}],"bg-color":[{bg:$()}],"gradient-from-pos":[{from:q()}],"gradient-via-pos":[{via:q()}],"gradient-to-pos":[{to:q()}],"gradient-from":[{from:$()}],"gradient-via":[{via:$()}],"gradient-to":[{to:$()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:ie()}],"border-w-x":[{"border-x":ie()}],"border-w-y":[{"border-y":ie()}],"border-w-s":[{"border-s":ie()}],"border-w-e":[{"border-e":ie()}],"border-w-t":[{"border-t":ie()}],"border-w-r":[{"border-r":ie()}],"border-w-b":[{"border-b":ie()}],"border-w-l":[{"border-l":ie()}],"divide-x":[{"divide-x":ie()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ie()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...le(),"hidden","none"]}],"divide-style":[{divide:[...le(),"hidden","none"]}],"border-color":[{border:$()}],"border-color-x":[{"border-x":$()}],"border-color-y":[{"border-y":$()}],"border-color-s":[{"border-s":$()}],"border-color-e":[{"border-e":$()}],"border-color-t":[{"border-t":$()}],"border-color-r":[{"border-r":$()}],"border-color-b":[{"border-b":$()}],"border-color-l":[{"border-l":$()}],"divide-color":[{divide:$()}],"outline-style":[{outline:[...le(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ze,ke,we]}],"outline-w":[{outline:["",ze,Cr,jn]}],"outline-color":[{outline:$()}],shadow:[{shadow:["","none",d,go,mo]}],"shadow-color":[{shadow:$()}],"inset-shadow":[{"inset-shadow":["none",f,go,mo]}],"inset-shadow-color":[{"inset-shadow":$()}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:$()}],"ring-offset-w":[{"ring-offset":[ze,jn]}],"ring-offset-color":[{"ring-offset":$()}],"inset-ring-w":[{"inset-ring":ie()}],"inset-ring-color":[{"inset-ring":$()}],"text-shadow":[{"text-shadow":["none",h,go,mo]}],"text-shadow-color":[{"text-shadow":$()}],opacity:[{opacity:[ze,ke,we]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ze]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":$()}],"mask-image-linear-to-color":[{"mask-linear-to":$()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":$()}],"mask-image-t-to-color":[{"mask-t-to":$()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":$()}],"mask-image-r-to-color":[{"mask-r-to":$()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":$()}],"mask-image-b-to-color":[{"mask-b-to":$()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":$()}],"mask-image-l-to-color":[{"mask-l-to":$()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":$()}],"mask-image-x-to-color":[{"mask-x-to":$()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":$()}],"mask-image-y-to-color":[{"mask-y-to":$()}],"mask-image-radial":[{"mask-radial":[ke,we]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":$()}],"mask-image-radial-to-color":[{"mask-radial-to":$()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[ze]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":$()}],"mask-image-conic-to-color":[{"mask-conic-to":$()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:G()}],"mask-repeat":[{mask:A()}],"mask-size":[{mask:K()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ke,we]}],filter:[{filter:["","none",ke,we]}],blur:[{blur:ue()}],brightness:[{brightness:[ze,ke,we]}],contrast:[{contrast:[ze,ke,we]}],"drop-shadow":[{"drop-shadow":["","none",p,go,mo]}],"drop-shadow-color":[{"drop-shadow":$()}],grayscale:[{grayscale:["",ze,ke,we]}],"hue-rotate":[{"hue-rotate":[ze,ke,we]}],invert:[{invert:["",ze,ke,we]}],saturate:[{saturate:[ze,ke,we]}],sepia:[{sepia:["",ze,ke,we]}],"backdrop-filter":[{"backdrop-filter":["","none",ke,we]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[ze,ke,we]}],"backdrop-contrast":[{"backdrop-contrast":[ze,ke,we]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ze,ke,we]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ze,ke,we]}],"backdrop-invert":[{"backdrop-invert":["",ze,ke,we]}],"backdrop-opacity":[{"backdrop-opacity":[ze,ke,we]}],"backdrop-saturate":[{"backdrop-saturate":[ze,ke,we]}],"backdrop-sepia":[{"backdrop-sepia":["",ze,ke,we]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":N()}],"border-spacing-x":[{"border-spacing-x":N()}],"border-spacing-y":[{"border-spacing-y":N()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ke,we]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ze,"initial",ke,we]}],ease:[{ease:["linear","initial",b,ke,we]}],delay:[{delay:[ze,ke,we]}],animate:[{animate:["none",v,ke,we]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,ke,we]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":["scale-3d"],skew:[{skew:me()}],"skew-x":[{"skew-x":me()}],"skew-y":[{"skew-y":me()}],transform:[{transform:[ke,we,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:fe()}],"translate-x":[{"translate-x":fe()}],"translate-y":[{"translate-y":fe()}],"translate-z":[{"translate-z":fe()}],"translate-none":["translate-none"],accent:[{accent:$()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:$()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ke,we]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ke,we]}],fill:[{fill:["none",...$()]}],"stroke-w":[{stroke:[ze,Cr,jn,ri]}],stroke:[{stroke:["none",...$()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},k_=t_(w_);function xe(...e){return k_(lp(e))}function Ue(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":(e/1e3).toFixed(1).replace(/\.0$/,"")+"K"}function wp(e){return e>=1024*1024?(e/(1024*1024)).toFixed(1).replace(/\.0$/,"")+"M":(e/1024).toFixed(1).replace(/\.0$/,"")+"K"}function Rc(e,t,n){const r=e*10;return!Number.isSafeInteger(r)||r%t!==0?null:(r/t/10).toFixed(1).replace(/\.0$/,"")+n}function __(e){if(!Number.isSafeInteger(e)||e<=0)return e.toString();if(e>=1024*1024){const n=Rc(e,1048576,"M");if(n!==null)return n}const t=Rc(e,1024,"K");return t!==null?t:e.toString()}function S_(e){if(e===void 0||e==="")return 1;switch(e.toLowerCase()){case"k":return 1024;case"m":return 1024*1024;default:return null}}function Ko(e){const t=e.trim().replaceAll(",","");if(t==="")return null;const n=/^(\d+(?:\.\d+)?)\s*([kKmM])?$/.exec(t);if(n===null)return null;const r=n[1];if(r===void 0)return null;const o=Number(r),s=n[2],a=S_(s);if(!Number.isFinite(o)||o<=0||a===null||(s===void 0||s==="")&&!Number.isInteger(o))return null;const l=Math.round(o*a);return!Number.isSafeInteger(l)||l<=0?null:l}function C_(e){return e===null?"pending":e>=200&&e<300?"success":e>=400&&e<500?"client_error":e>=500?"server_error":"pending"}const j_=re({model:I().min(1),contextWindow:se().int().positive().optional(),outputLimit:se().int().positive().optional(),source:Re(["manual","registry"]).optional(),sourceUrl:I().optional(),updatedAt:I().optional()}),Go=re({id:I(),name:I(),apiKey:I(),model:I().optional(),models:ye(I()).min(1),format:Re(["anthropic","openai"]).optional(),baseUrl:I().optional(),anthropicBaseUrl:I().optional(),openaiBaseUrl:I().optional(),authHeader:Re(["bearer","x-api-key"]).optional().default("bearer"),apiDocsUrl:I().optional(),modelMetadataUrl:I().optional(),modelMetadata:ye(j_).optional(),source:Re(["company","personal"]).optional(),createdAt:I(),updatedAt:I()});async function N_(e){return an(e,Go.array(),void 0,t=>`Failed to fetch ${e}: ${t.status}`)}function kp(){const e=Yr("/api/providers?includeSecrets=1",N_,{revalidateOnFocus:!1,revalidateIfStale:!1});return{providers:e.data??[],isLoading:e.isLoading,isError:e.error,mutate:e.mutate}}const E_="2.1.1",Oc={version:E_},Mc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Lc=lp,sl=(e,t)=>n=>{var r;if(t?.variants==null)return Lc(e,n?.class,n?.className);const{variants:o,defaultVariants:s}=t,a=Object.keys(o).map(u=>{const d=n?.[u],f=s?.[u];if(d===null)return null;const h=Mc(d)||Mc(f);return o[u][h]}),l=n&&Object.entries(n).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(y=>{let[m,x]=y;return Array.isArray(x)?x.includes({...s,...l}[m]):{...s,...l}[m]===x})?[...u,f,h]:u},[]);return Lc(e,a,c,n?.class,n?.className)};function Dc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function _p(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Dc(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Dc(e[o],null)}}}}function De(...e){return g.useCallback(_p(...e),e)}function dr(e){const t=A_(e),n=g.forwardRef((r,o)=>{const{children:s,...a}=r,l=g.Children.toArray(s),c=l.find(z_);if(c){const u=c.props.children,d=l.map(f=>f===c?g.Children.count(u)>1?g.Children.only(null):g.isValidElement(u)?u.props.children:null:f);return i.jsx(t,{...a,ref:o,children:g.isValidElement(u)?g.cloneElement(u,void 0,d):null})}return i.jsx(t,{...a,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var T_=dr("Slot");function A_(e){const t=g.forwardRef((n,r)=>{const{children:o,...s}=n;if(g.isValidElement(o)){const a=R_(o),l=P_(s,o.props);return o.type!==g.Fragment&&(l.ref=r?_p(r,a):a),g.cloneElement(o,l)}return g.Children.count(o)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Sp=Symbol("radix.slottable");function I_(e){const t=({children:n})=>i.jsx(i.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Sp,t}function z_(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Sp}function P_(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...l)=>{const c=s(...l);return o(...l),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function R_(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var O_=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ae=O_.reduce((e,t)=>{const n=dr(`Primitive.${t}`),r=g.forwardRef((o,s)=>{const{asChild:a,...l}=o,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function M_(e,t){e&&Xr.flushSync(()=>e.dispatchEvent(t))}var Cp=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),L_="VisuallyHidden",jp=g.forwardRef((e,t)=>i.jsx(Ae.span,{...e,ref:t,style:{...Cp,...e.style}}));jp.displayName=L_;var D_=jp;function F_(e,t){const n=g.createContext(t),r=s=>{const{children:a,...l}=s,c=g.useMemo(()=>l,Object.values(l));return i.jsx(n.Provider,{value:c,children:a})};r.displayName=e+"Provider";function o(s){const a=g.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function ln(e,t=[]){let n=[];function r(s,a){const l=g.createContext(a),c=n.length;n=[...n,a];const u=f=>{const{scope:h,children:p,...y}=f,m=h?.[e]?.[c]||l,x=g.useMemo(()=>y,Object.values(y));return i.jsx(m.Provider,{value:x,children:p})};u.displayName=s+"Provider";function d(f,h){const p=h?.[e]?.[c]||l,y=g.useContext(p);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const o=()=>{const s=n.map(a=>g.createContext(a));return function(l){const c=l?.[e]||s;return g.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[r,$_(o,...t)]}function $_(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function Np(e){const t=e+"CollectionProvider",[n,r]=ln(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=m=>{const{scope:x,children:b}=m,v=ut.useRef(null),w=ut.useRef(new Map).current;return i.jsx(o,{scope:x,itemMap:w,collectionRef:v,children:b})};a.displayName=t;const l=e+"CollectionSlot",c=dr(l),u=ut.forwardRef((m,x)=>{const{scope:b,children:v}=m,w=s(l,b),C=De(x,w.collectionRef);return i.jsx(c,{ref:C,children:v})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=dr(d),p=ut.forwardRef((m,x)=>{const{scope:b,children:v,...w}=m,C=ut.useRef(null),S=De(x,C),j=s(d,b);return ut.useEffect(()=>(j.itemMap.set(C,{ref:C,...w}),()=>{j.itemMap.delete(C)})),i.jsx(h,{[f]:"",ref:S,children:v})});p.displayName=d;function y(m){const x=s(e+"CollectionConsumer",m);return ut.useCallback(()=>{const v=x.collectionRef.current;if(!v)return[];const w=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(x.itemMap.values()).sort((j,E)=>w.indexOf(j.ref.current)-w.indexOf(E.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:a,Slot:u,ItemSlot:p},y,r]}function Ce(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}var st=globalThis?.document?g.useLayoutEffect:()=>{},B_=ef[" useInsertionEffect ".trim().toString()]||st;function In({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,a]=U_({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:o;{const d=g.useRef(e!==void 0);g.useEffect(()=>{const f=d.current;f!==l&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,r])}const u=g.useCallback(d=>{if(l){const f=H_(d)?d(e):d;f!==e&&a.current?.(f)}else s(d)},[l,e,s,a]);return[c,u]}function U_({defaultProp:e,onChange:t}){const[n,r]=g.useState(e),o=g.useRef(n),s=g.useRef(t);return B_(()=>{s.current=t},[t]),g.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}function H_(e){return typeof e=="function"}function W_(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var Nt=e=>{const{present:t,children:n}=e,r=V_(t),o=typeof n=="function"?n({present:r.isPresent}):g.Children.only(n),s=De(r.ref,Z_(o));return typeof n=="function"||r.isPresent?g.cloneElement(o,{ref:s}):null};Nt.displayName="Presence";function V_(e){const[t,n]=g.useState(),r=g.useRef(null),o=g.useRef(e),s=g.useRef("none"),a=e?"mounted":"unmounted",[l,c]=W_(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const u=xo(r.current);s.current=l==="mounted"?u:"none"},[l]),st(()=>{const u=r.current,d=o.current;if(d!==e){const h=s.current,p=xo(u);e?c("MOUNT"):p==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),st(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const m=xo(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&m&&(c("ANIMATION_END"),!o.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},h=p=>{p.target===t&&(s.current=xo(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:g.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function xo(e){return e?.animationName||"none"}function Z_(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var q_=ef[" useId ".trim().toString()]||(()=>{}),K_=0;function Ht(e){const[t,n]=g.useState(q_());return st(()=>{n(r=>r??String(K_++))},[e]),e||(t?`radix-${t}`:"")}var _s="Collapsible",[G_]=ln(_s),[J_,il]=G_(_s),Ep=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:a,...l}=e,[c,u]=In({prop:r,defaultProp:o??!1,onChange:a,caller:_s});return i.jsx(J_,{scope:n,disabled:s,contentId:Ht(),open:c,onOpenToggle:g.useCallback(()=>u(d=>!d),[u]),children:i.jsx(Ae.div,{"data-state":ll(c),"data-disabled":s?"":void 0,...l,ref:t})})});Ep.displayName=_s;var Tp="CollapsibleTrigger",Ap=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=il(Tp,n);return i.jsx(Ae.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":ll(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:Ce(e.onClick,o.onOpenToggle)})});Ap.displayName=Tp;var al="CollapsibleContent",Ip=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=il(al,e.__scopeCollapsible);return i.jsx(Nt,{present:n||o.open,children:({present:s})=>i.jsx(Y_,{...r,ref:t,present:s})})});Ip.displayName=al;var Y_=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=e,a=il(al,n),[l,c]=g.useState(r),u=g.useRef(null),d=De(t,u),f=g.useRef(0),h=f.current,p=g.useRef(0),y=p.current,m=a.open||l,x=g.useRef(m),b=g.useRef(void 0);return g.useEffect(()=>{const v=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(v)},[]),st(()=>{const v=u.current;if(v){b.current=b.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const w=v.getBoundingClientRect();f.current=w.height,p.current=w.width,x.current||(v.style.transitionDuration=b.current.transitionDuration,v.style.animationName=b.current.animationName),c(r)}},[a.open,r]),i.jsx(Ae.div,{"data-state":ll(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!m,...s,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...e.style},children:m&&o})});function ll(e){return e?"open":"closed"}var X_=Ep,Q_=g.createContext(void 0);function Ss(e){const t=g.useContext(Q_);return e||t||"ltr"}function lt(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>t.current?.(...n),[])}function eS(e,t=globalThis?.document){const n=lt(e);g.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var tS="DismissableLayer",Ji="dismissableLayer.update",nS="dismissableLayer.pointerDownOutside",rS="dismissableLayer.focusOutside",Fc,zp=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Cs=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...c}=e,u=g.useContext(zp),[d,f]=g.useState(null),h=d?.ownerDocument??globalThis?.document,[,p]=g.useState({}),y=De(t,E=>f(E)),m=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(x),v=d?m.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,C=v>=b,S=iS(E=>{const N=E.target,z=[...u.branches].some(M=>M.contains(N));!C||z||(o?.(E),a?.(E),E.defaultPrevented||l?.())},h),j=aS(E=>{const N=E.target;[...u.branches].some(M=>M.contains(N))||(s?.(E),a?.(E),E.defaultPrevented||l?.())},h);return eS(E=>{v===u.layers.size-1&&(r?.(E),!E.defaultPrevented&&l&&(E.preventDefault(),l()))},h),g.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Fc=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),$c(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Fc)}},[d,h,n,u]),g.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),$c())},[d,u]),g.useEffect(()=>{const E=()=>p({});return document.addEventListener(Ji,E),()=>document.removeEventListener(Ji,E)},[]),i.jsx(Ae.div,{...c,ref:y,style:{pointerEvents:w?C?"auto":"none":void 0,...e.style},onFocusCapture:Ce(e.onFocusCapture,j.onFocusCapture),onBlurCapture:Ce(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:Ce(e.onPointerDownCapture,S.onPointerDownCapture)})});Cs.displayName=tS;var oS="DismissableLayerBranch",sS=g.forwardRef((e,t)=>{const n=g.useContext(zp),r=g.useRef(null),o=De(t,r);return g.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),i.jsx(Ae.div,{...e,ref:o})});sS.displayName=oS;function iS(e,t=globalThis?.document){const n=lt(e),r=g.useRef(!1),o=g.useRef(()=>{});return g.useEffect(()=>{const s=l=>{if(l.target&&!r.current){let c=function(){Pp(nS,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function aS(e,t=globalThis?.document){const n=lt(e),r=g.useRef(!1);return g.useEffect(()=>{const o=s=>{s.target&&!r.current&&Pp(rS,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function $c(){const e=new CustomEvent(Ji);document.dispatchEvent(e)}function Pp(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?M_(o,s):o.dispatchEvent(s)}var oi="focusScope.autoFocusOnMount",si="focusScope.autoFocusOnUnmount",Bc={bubbles:!1,cancelable:!0},lS="FocusScope",cl=g.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...a}=e,[l,c]=g.useState(null),u=lt(o),d=lt(s),f=g.useRef(null),h=De(t,m=>c(m)),p=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(r){let m=function(w){if(p.paused||!l)return;const C=w.target;l.contains(C)?f.current=C:pn(f.current,{select:!0})},x=function(w){if(p.paused||!l)return;const C=w.relatedTarget;C!==null&&(l.contains(C)||pn(f.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const S of w)S.removedNodes.length>0&&pn(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",x);const v=new MutationObserver(b);return l&&v.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",x),v.disconnect()}}},[r,l,p.paused]),g.useEffect(()=>{if(l){Hc.add(p);const m=document.activeElement;if(!l.contains(m)){const b=new CustomEvent(oi,Bc);l.addEventListener(oi,u),l.dispatchEvent(b),b.defaultPrevented||(cS(hS(Rp(l)),{select:!0}),document.activeElement===m&&pn(l))}return()=>{l.removeEventListener(oi,u),setTimeout(()=>{const b=new CustomEvent(si,Bc);l.addEventListener(si,d),l.dispatchEvent(b),b.defaultPrevented||pn(m??document.body,{select:!0}),l.removeEventListener(si,d),Hc.remove(p)},0)}}},[l,u,d,p]);const y=g.useCallback(m=>{if(!n&&!r||p.paused)return;const x=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(x&&b){const v=m.currentTarget,[w,C]=uS(v);w&&C?!m.shiftKey&&b===C?(m.preventDefault(),n&&pn(w,{select:!0})):m.shiftKey&&b===w&&(m.preventDefault(),n&&pn(C,{select:!0})):b===v&&m.preventDefault()}},[n,r,p.paused]);return i.jsx(Ae.div,{tabIndex:-1,...a,ref:h,onKeyDown:y})});cl.displayName=lS;function cS(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(pn(r,{select:t}),document.activeElement!==n)return}function uS(e){const t=Rp(e),n=Uc(t,e),r=Uc(t.reverse(),e);return[n,r]}function Rp(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Uc(e,t){for(const n of e)if(!dS(n,{upTo:t}))return n}function dS(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function fS(e){return e instanceof HTMLInputElement&&"select"in e}function pn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&fS(e)&&t&&e.select()}}var Hc=pS();function pS(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Wc(e,t),e.unshift(t)},remove(t){e=Wc(e,t),e[0]?.resume()}}}function Wc(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function hS(e){return e.filter(t=>t.tagName!=="A")}var mS="Portal",js=g.forwardRef((e,t)=>{const{container:n,...r}=e,[o,s]=g.useState(!1);st(()=>s(!0),[]);const a=n||o&&globalThis?.document?.body;return a?Cx.createPortal(i.jsx(Ae.div,{...r,ref:t}),a):null});js.displayName=mS;var ii=0;function Op(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Vc()),document.body.insertAdjacentElement("beforeend",e[1]??Vc()),ii++,()=>{ii===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),ii--}},[])}function Vc(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var $t=function(){return $t=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},$t.apply(this,arguments)};function Mp(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function gS(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var Oo="right-scroll-bar-position",Mo="width-before-scroll-bar",xS="with-scroll-bars-hidden",bS="--removed-body-scroll-bar-size";function ai(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function yS(e,t){var n=g.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var vS=typeof window<"u"?g.useLayoutEffect:g.useEffect,Zc=new WeakMap;function wS(e,t){var n=yS(null,function(r){return e.forEach(function(o){return ai(o,r)})});return vS(function(){var r=Zc.get(n);if(r){var o=new Set(r),s=new Set(e),a=n.current;o.forEach(function(l){s.has(l)||ai(l,null)}),s.forEach(function(l){o.has(l)||ai(l,a)})}Zc.set(n,e)},[e]),n}function kS(e){return e}function _S(e,t){t===void 0&&(t=kS);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var a=t(s,r);return n.push(a),function(){n=n.filter(function(l){return l!==a})}},assignSyncMedium:function(s){for(r=!0;n.length;){var a=n;n=[],a.forEach(s)}n={push:function(l){return s(l)},filter:function(){return n}}},assignMedium:function(s){r=!0;var a=[];if(n.length){var l=n;n=[],l.forEach(s),a=n}var c=function(){var d=a;a=[],d.forEach(s)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){a.push(d),u()},filter:function(d){return a=a.filter(d),n}}}};return o}function SS(e){e===void 0&&(e={});var t=_S(null);return t.options=$t({async:!0,ssr:!1},e),t}var Lp=function(e){var t=e.sideCar,n=Mp(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return g.createElement(r,$t({},n))};Lp.isSideCarExport=!0;function CS(e,t){return e.useMedium(t),Lp}var Dp=SS(),li=function(){},Ns=g.forwardRef(function(e,t){var n=g.useRef(null),r=g.useState({onScrollCapture:li,onWheelCapture:li,onTouchMoveCapture:li}),o=r[0],s=r[1],a=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,h=e.sideCar,p=e.noRelative,y=e.noIsolation,m=e.inert,x=e.allowPinchZoom,b=e.as,v=b===void 0?"div":b,w=e.gapMode,C=Mp(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=h,j=wS([n,t]),E=$t($t({},C),o);return g.createElement(g.Fragment,null,d&&g.createElement(S,{sideCar:Dp,removeScrollBar:u,shards:f,noRelative:p,noIsolation:y,inert:m,setCallbacks:s,allowPinchZoom:!!x,lockRef:n,gapMode:w}),a?g.cloneElement(g.Children.only(l),$t($t({},E),{ref:j})):g.createElement(v,$t({},E,{className:c,ref:j}),l))});Ns.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ns.classNames={fullWidth:Mo,zeroRight:Oo};var jS=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function NS(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=jS();return t&&e.setAttribute("nonce",t),e}function ES(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function TS(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var AS=function(){var e=0,t=null;return{add:function(n){e==0&&(t=NS())&&(ES(t,n),TS(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},IS=function(){var e=AS();return function(t,n){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Fp=function(){var e=IS(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},zS={left:0,top:0,right:0,gap:0},ci=function(e){return parseInt(e||"",10)||0},PS=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[ci(n),ci(r),ci(o)]},RS=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return zS;var t=PS(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},OS=Fp(),nr="data-scroll-locked",MS=function(e,t,n,r){var o=e.left,s=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
41
|
+
\0`,ie+=s(K,2),ie+=j.magic,ie+=s(w,2),ie+=s(C,2),ie+=s(A.crc32,4),ie+=s(A.compressedSize,4),ie+=s(A.uncompressedSize,4),ie+=s(N.length,2),ie+=s(L.length,2),{fileRecord:f.LOCAL_FILE_HEADER+ie+N+L,dirRecord:f.CENTRAL_FILE_HEADER+s(P,2)+ie+s(B.length,2)+"\0\0\0\0"+s(q,4)+s(x,4)+N+L+B}}var l=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function h(p,y,m,x){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=y,this.zipPlatform=m,this.encodeFileName=x,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(h,c),h.prototype.push=function(p){var y=p.meta.percent||0,m=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,c.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:m?(y+100*(m-x-1))/m:100}}))},h.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var y=this.streamFiles&&!p.file.dir;if(y){var m=a(p,y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(p){this.accumulate=!1;var y=this.streamFiles&&!p.file.dir,m=a(p,y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),y)this.push({data:(function(x){return f.DATA_DESCRIPTOR+s(x.crc32,4)+s(x.compressedSize,4)+s(x.uncompressedSize,4)})(p),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var p=this.bytesWritten,y=0;y<this.dirRecords.length;y++)this.push({data:this.dirRecords[y],meta:{percent:100}});var m=this.bytesWritten-p,x=(function(b,v,w,C,S){var j=l.transformTo("string",S(C));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(b,2)+s(b,2)+s(v,4)+s(w,4)+s(j.length,2)+j})(this.dirRecords.length,m,p,this.zipComment,this.encodeFileName);this.push({data:x,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(p){this._sources.push(p);var y=this;return p.on("data",function(m){y.processChunk(m)}),p.on("end",function(){y.closedSource(y.previous.streamInfo),y._sources.length?y.prepareNextSource():y.end()}),p.on("error",function(m){y.error(m)}),this},h.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(p){var y=this._sources;if(!c.prototype.error.call(this,p))return!1;for(var m=0;m<y.length;m++)try{y[m].error(p)}catch{}return!0},h.prototype.lock=function(){c.prototype.lock.call(this);for(var p=this._sources,y=0;y<p.length;y++)p[y].lock()},r.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){var s=n("../compressions"),a=n("./ZipFileWorker");o.generateWorker=function(l,c,u){var d=new a(c.streamFiles,u,c.platform,c.encodeFileName),f=0;try{l.forEach(function(h,p){f++;var y=(function(v,w){var C=v||w,S=s[C];if(!S)throw new Error(C+" is not a valid compression method !");return S})(p.options.compression,c.compression),m=p.options.compressionOptions||c.compressionOptions||{},x=p.dir,b=p.date;p._compressWorker(y,m).withStreamInfo("file",{name:h,dir:x,date:b,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(h){d.error(h)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){function s(){if(!(this instanceof s))return new s;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var a=new s;for(var l in this)typeof this[l]!="function"&&(a[l]=this[l]);return a}}(s.prototype=n("./object")).loadAsync=n("./load"),s.support=n("./support"),s.defaults=n("./defaults"),s.version="3.10.1",s.loadAsync=function(a,l){return new s().loadAsync(a,l)},s.external=n("./external"),r.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){var s=n("./utils"),a=n("./external"),l=n("./utf8"),c=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function f(h){return new a.Promise(function(p,y){var m=h.decompressed.getContentWorker().pipe(new u);m.on("error",function(x){y(x)}).on("end",function(){m.streamInfo.crc32!==h.decompressed.crc32?y(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}r.exports=function(h,p){var y=this;return p=s.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),d.isNode&&d.isStream(h)?a.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",h,!0,p.optimizedBinaryString,p.base64).then(function(m){var x=new c(p);return x.load(m),x}).then(function(m){var x=[a.Promise.resolve(m)],b=m.files;if(p.checkCRC32)for(var v=0;v<b.length;v++)x.push(f(b[v]));return a.Promise.all(x)}).then(function(m){for(var x=m.shift(),b=x.files,v=0;v<b.length;v++){var w=b[v],C=w.fileNameStr,S=s.resolve(w.fileNameStr);y.file(S,w.decompressed,{binary:!0,optimizedBinaryString:!0,date:w.date,dir:w.dir,comment:w.fileCommentStr.length?w.fileCommentStr:null,unixPermissions:w.unixPermissions,dosPermissions:w.dosPermissions,createFolders:p.createFolders}),w.dir||(y.file(S).unsafeOriginalName=C)}return x.zipComment.length&&(y.comment=x.zipComment),y})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){var s=n("../utils"),a=n("../stream/GenericWorker");function l(c,u){a.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}s.inherits(l,a),l.prototype._bindStream=function(c){var u=this;(this._stream=c).pause(),c.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},l.prototype.pause=function(){return!!a.prototype.pause.call(this)&&(this._stream.pause(),!0)},l.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){var s=n("readable-stream").Readable;function a(l,c,u){s.call(this,c),this._helper=l;var d=this;l.on("data",function(f,h){d.push(f)||d._helper.pause(),u&&u(h)}).on("error",function(f){d.emit("error",f)}).on("end",function(){d.push(null)})}n("../utils").inherits(a,s),a.prototype._read=function(){this._helper.resume()},r.exports=a},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(s,a){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(s,a);if(typeof s=="number")throw new Error('The "data" argument must not be a number');return new Buffer(s,a)},allocBuffer:function(s){if(Buffer.alloc)return Buffer.alloc(s);var a=new Buffer(s);return a.fill(0),a},isBuffer:function(s){return Buffer.isBuffer(s)},isStream:function(s){return s&&typeof s.on=="function"&&typeof s.pause=="function"&&typeof s.resume=="function"}}},{}],15:[function(n,r,o){function s(S,j,E){var N,z=l.getTypeOf(j),M=l.extend(E||{},d);M.date=M.date||new Date,M.compression!==null&&(M.compression=M.compression.toUpperCase()),typeof M.unixPermissions=="string"&&(M.unixPermissions=parseInt(M.unixPermissions,8)),M.unixPermissions&&16384&M.unixPermissions&&(M.dir=!0),M.dosPermissions&&16&M.dosPermissions&&(M.dir=!0),M.dir&&(S=b(S)),M.createFolders&&(N=x(S))&&v.call(this,N,!0);var B=z==="string"&&M.binary===!1&&M.base64===!1;E&&E.binary!==void 0||(M.binary=!B),(j instanceof f&&j.uncompressedSize===0||M.dir||!j||j.length===0)&&(M.base64=!1,M.binary=!0,j="",M.compression="STORE",z="string");var T=null;T=j instanceof f||j instanceof c?j:y.isNode&&y.isStream(j)?new m(S,j):l.prepareContent(S,j,M.binary,M.optimizedBinaryString,M.base64);var D=new h(S,T,M);this.files[S]=D}var a=n("./utf8"),l=n("./utils"),c=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),h=n("./zipObject"),p=n("./generate"),y=n("./nodejsUtils"),m=n("./nodejs/NodejsStreamInputAdapter"),x=function(S){S.slice(-1)==="/"&&(S=S.substring(0,S.length-1));var j=S.lastIndexOf("/");return 0<j?S.substring(0,j):""},b=function(S){return S.slice(-1)!=="/"&&(S+="/"),S},v=function(S,j){return j=j!==void 0?j:d.createFolders,S=b(S),this.files[S]||s.call(this,S,null,{dir:!0,createFolders:j}),this.files[S]};function w(S){return Object.prototype.toString.call(S)==="[object RegExp]"}var C={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(S){var j,E,N;for(j in this.files)N=this.files[j],(E=j.slice(this.root.length,j.length))&&j.slice(0,this.root.length)===this.root&&S(E,N)},filter:function(S){var j=[];return this.forEach(function(E,N){S(E,N)&&j.push(N)}),j},file:function(S,j,E){if(arguments.length!==1)return S=this.root+S,s.call(this,S,j,E),this;if(w(S)){var N=S;return this.filter(function(M,B){return!B.dir&&N.test(M)})}var z=this.files[this.root+S];return z&&!z.dir?z:null},folder:function(S){if(!S)return this;if(w(S))return this.filter(function(z,M){return M.dir&&S.test(z)});var j=this.root+S,E=v.call(this,j),N=this.clone();return N.root=E.name,N},remove:function(S){S=this.root+S;var j=this.files[S];if(j||(S.slice(-1)!=="/"&&(S+="/"),j=this.files[S]),j&&!j.dir)delete this.files[S];else for(var E=this.filter(function(z,M){return M.name.slice(0,S.length)===S}),N=0;N<E.length;N++)delete this.files[E[N].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(S){var j,E={};try{if((E=l.extend(S||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:a.utf8encode})).type=E.type.toLowerCase(),E.compression=E.compression.toUpperCase(),E.type==="binarystring"&&(E.type="string"),!E.type)throw new Error("No output type specified.");l.checkSupport(E.type),E.platform!=="darwin"&&E.platform!=="freebsd"&&E.platform!=="linux"&&E.platform!=="sunos"||(E.platform="UNIX"),E.platform==="win32"&&(E.platform="DOS");var N=E.comment||this.comment||"";j=p.generateWorker(this,E,N)}catch(z){(j=new c("error")).error(z)}return new u(j,E.type||"string",E.mimeType)},generateAsync:function(S,j){return this.generateInternalStream(S).accumulate(j)},generateNodeStream:function(S,j){return(S=S||{}).type||(S.type="nodebuffer"),this.generateInternalStream(S).toNodejsStream(j)}};r.exports=C},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,o){r.exports=n("stream")},{stream:void 0}],17:[function(n,r,o){var s=n("./DataReader");function a(l){s.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}n("../utils").inherits(a,s),a.prototype.byteAt=function(l){return this.data[this.zero+l]},a.prototype.lastIndexOfSignature=function(l){for(var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),f=l.charCodeAt(3),h=this.length-4;0<=h;--h)if(this.data[h]===c&&this.data[h+1]===u&&this.data[h+2]===d&&this.data[h+3]===f)return h-this.zero;return-1},a.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),f=l.charCodeAt(3),h=this.readData(4);return c===h[0]&&u===h[1]&&d===h[2]&&f===h[3]},a.prototype.readData=function(l){if(this.checkOffset(l),l===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=a},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){var s=n("../utils");function a(l){this.data=l,this.length=l.length,this.index=0,this.zero=0}a.prototype={checkOffset:function(l){this.checkIndex(this.index+l)},checkIndex:function(l){if(this.length<this.zero+l||l<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+l+"). Corrupted zip ?")},setIndex:function(l){this.checkIndex(l),this.index=l},skip:function(l){this.setIndex(this.index+l)},byteAt:function(){},readInt:function(l){var c,u=0;for(this.checkOffset(l),c=this.index+l-1;c>=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=l,u},readString:function(l){return s.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},r.exports=a},{"../utils":32}],19:[function(n,r,o){var s=n("./Uint8ArrayReader");function a(l){s.call(this,l)}n("../utils").inherits(a,s),a.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){var s=n("./DataReader");function a(l){s.call(this,l)}n("../utils").inherits(a,s),a.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},a.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},a.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},a.prototype.readData=function(l){this.checkOffset(l);var c=this.data.slice(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=a},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){var s=n("./ArrayReader");function a(l){s.call(this,l)}n("../utils").inherits(a,s),a.prototype.readData=function(l){if(this.checkOffset(l),l===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+l);return this.index+=l,c},r.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){var s=n("../utils"),a=n("../support"),l=n("./ArrayReader"),c=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(f){var h=s.getTypeOf(f);return s.checkSupport(h),h!=="string"||a.uint8array?h==="nodebuffer"?new u(f):a.uint8array?new d(s.transformTo("uint8array",f)):new l(s.transformTo("array",f)):new c(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){var s=n("./GenericWorker"),a=n("../utils");function l(c){s.call(this,"ConvertWorker to "+c),this.destType=c}a.inherits(l,s),l.prototype.processChunk=function(c){this.push({data:a.transformTo(this.destType,c.data),meta:c.meta})},r.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){var s=n("./GenericWorker"),a=n("../crc32");function l(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(l,s),l.prototype.processChunk=function(c){this.streamInfo.crc32=a(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){var s=n("../utils"),a=n("./GenericWorker");function l(c){a.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}s.inherits(l,a),l.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}a.prototype.processChunk.call(this,c)},r.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){var s=n("../utils"),a=n("./GenericWorker");function l(c){a.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=s.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}s.inherits(l,a),l.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){function s(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,l){return this._listeners[a].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,l){if(this._listeners[a])for(var c=0;c<this._listeners[a].length;c++)this._listeners[a][c].call(this,l)},pipe:function(a){return a.registerPrevious(this)},registerPrevious:function(a){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=a.streamInfo,this.mergeStreamInfo(),this.previous=a;var l=this;return a.on("data",function(c){l.processChunk(c)}),a.on("end",function(){l.end()}),a.on("error",function(c){l.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var a=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),a=!0),this.previous&&this.previous.resume(),!a},flush:function(){},processChunk:function(a){this.push(a)},withStreamInfo:function(a,l){return this.extraStreamInfo[a]=l,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var a in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,a)&&(this.streamInfo[a]=this.extraStreamInfo[a])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var a="Worker "+this.name;return this.previous?this.previous+" -> "+a:a}},r.exports=s},{}],29:[function(n,r,o){var s=n("../utils"),a=n("./ConvertWorker"),l=n("./GenericWorker"),c=n("../base64"),u=n("../support"),d=n("../external"),f=null;if(u.nodestream)try{f=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function h(y,m){return new d.Promise(function(x,b){var v=[],w=y._internalType,C=y._outputType,S=y._mimeType;y.on("data",function(j,E){v.push(j),m&&m(E)}).on("error",function(j){v=[],b(j)}).on("end",function(){try{var j=(function(E,N,z){switch(E){case"blob":return s.newBlob(s.transformTo("arraybuffer",N),z);case"base64":return c.encode(N);default:return s.transformTo(E,N)}})(C,(function(E,N){var z,M=0,B=null,T=0;for(z=0;z<N.length;z++)T+=N[z].length;switch(E){case"string":return N.join("");case"array":return Array.prototype.concat.apply([],N);case"uint8array":for(B=new Uint8Array(T),z=0;z<N.length;z++)B.set(N[z],M),M+=N[z].length;return B;case"nodebuffer":return Buffer.concat(N);default:throw new Error("concat : unsupported type '"+E+"'")}})(w,v),S);x(j)}catch(E){b(E)}v=[]}).resume()})}function p(y,m,x){var b=m;switch(m){case"blob":case"arraybuffer":b="uint8array";break;case"base64":b="string"}try{this._internalType=b,this._outputType=m,this._mimeType=x,s.checkSupport(b),this._worker=y.pipe(new a(b)),y.lock()}catch(v){this._worker=new l("error"),this._worker.error(v)}}p.prototype={accumulate:function(y){return h(this,y)},on:function(y,m){var x=this;return y==="data"?this._worker.on(y,function(b){m.call(x,b.data,b.meta)}):this._worker.on(y,function(){s.delay(m,arguments,x)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(y){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},y)}},r.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var s=new ArrayBuffer(0);try{o.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(s),o.blob=a.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){for(var s=n("./utils"),a=n("./support"),l=n("./nodejsUtils"),c=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){c.call(this,"utf-8 decode"),this.leftOver=null}function h(){c.call(this,"utf-8 encode")}o.utf8encode=function(p){return a.nodebuffer?l.newBufferFrom(p,"utf-8"):(function(y){var m,x,b,v,w,C=y.length,S=0;for(v=0;v<C;v++)(64512&(x=y.charCodeAt(v)))==55296&&v+1<C&&(64512&(b=y.charCodeAt(v+1)))==56320&&(x=65536+(x-55296<<10)+(b-56320),v++),S+=x<128?1:x<2048?2:x<65536?3:4;for(m=a.uint8array?new Uint8Array(S):new Array(S),v=w=0;w<S;v++)(64512&(x=y.charCodeAt(v)))==55296&&v+1<C&&(64512&(b=y.charCodeAt(v+1)))==56320&&(x=65536+(x-55296<<10)+(b-56320),v++),x<128?m[w++]=x:(x<2048?m[w++]=192|x>>>6:(x<65536?m[w++]=224|x>>>12:(m[w++]=240|x>>>18,m[w++]=128|x>>>12&63),m[w++]=128|x>>>6&63),m[w++]=128|63&x);return m})(p)},o.utf8decode=function(p){return a.nodebuffer?s.transformTo("nodebuffer",p).toString("utf-8"):(function(y){var m,x,b,v,w=y.length,C=new Array(2*w);for(m=x=0;m<w;)if((b=y[m++])<128)C[x++]=b;else if(4<(v=u[b]))C[x++]=65533,m+=v-1;else{for(b&=v===2?31:v===3?15:7;1<v&&m<w;)b=b<<6|63&y[m++],v--;1<v?C[x++]=65533:b<65536?C[x++]=b:(b-=65536,C[x++]=55296|b>>10&1023,C[x++]=56320|1023&b)}return C.length!==x&&(C.subarray?C=C.subarray(0,x):C.length=x),s.applyFromCharCode(C)})(p=s.transformTo(a.uint8array?"uint8array":"array",p))},s.inherits(f,c),f.prototype.processChunk=function(p){var y=s.transformTo(a.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var m=y;(y=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),y.set(m,this.leftOver.length)}else y=this.leftOver.concat(y);this.leftOver=null}var x=(function(v,w){var C;for((w=w||v.length)>v.length&&(w=v.length),C=w-1;0<=C&&(192&v[C])==128;)C--;return C<0||C===0?w:C+u[v[C]]>w?C:w})(y),b=y;x!==y.length&&(a.uint8array?(b=y.subarray(0,x),this.leftOver=y.subarray(x,y.length)):(b=y.slice(0,x),this.leftOver=y.slice(x,y.length))),this.push({data:o.utf8decode(b),meta:p.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=f,s.inherits(h,c),h.prototype.processChunk=function(p){this.push({data:o.utf8encode(p.data),meta:p.meta})},o.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){var s=n("./support"),a=n("./base64"),l=n("./nodejsUtils"),c=n("./external");function u(m){return m}function d(m,x){for(var b=0;b<m.length;++b)x[b]=255&m.charCodeAt(b);return x}n("setimmediate"),o.newBlob=function(m,x){o.checkSupport("blob");try{return new Blob([m],{type:x})}catch{try{var b=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return b.append(m),b.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(m,x,b){var v=[],w=0,C=m.length;if(C<=b)return String.fromCharCode.apply(null,m);for(;w<C;)x==="array"||x==="nodebuffer"?v.push(String.fromCharCode.apply(null,m.slice(w,Math.min(w+b,C)))):v.push(String.fromCharCode.apply(null,m.subarray(w,Math.min(w+b,C)))),w+=b;return v.join("")},stringifyByChar:function(m){for(var x="",b=0;b<m.length;b++)x+=String.fromCharCode(m[b]);return x},applyCanBeUsed:{uint8array:(function(){try{return s.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return s.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}})()}};function h(m){var x=65536,b=o.getTypeOf(m),v=!0;if(b==="uint8array"?v=f.applyCanBeUsed.uint8array:b==="nodebuffer"&&(v=f.applyCanBeUsed.nodebuffer),v)for(;1<x;)try{return f.stringifyByChunk(m,b,x)}catch{x=Math.floor(x/2)}return f.stringifyByChar(m)}function p(m,x){for(var b=0;b<m.length;b++)x[b]=m[b];return x}o.applyFromCharCode=h;var y={};y.string={string:u,array:function(m){return d(m,new Array(m.length))},arraybuffer:function(m){return y.string.uint8array(m).buffer},uint8array:function(m){return d(m,new Uint8Array(m.length))},nodebuffer:function(m){return d(m,l.allocBuffer(m.length))}},y.array={string:h,array:u,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return l.newBufferFrom(m)}},y.arraybuffer={string:function(m){return h(new Uint8Array(m))},array:function(m){return p(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:u,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return l.newBufferFrom(new Uint8Array(m))}},y.uint8array={string:h,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:u,nodebuffer:function(m){return l.newBufferFrom(m)}},y.nodebuffer={string:h,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return y.nodebuffer.uint8array(m).buffer},uint8array:function(m){return p(m,new Uint8Array(m.length))},nodebuffer:u},o.transformTo=function(m,x){if(x=x||"",!m)return x;o.checkSupport(m);var b=o.getTypeOf(x);return y[b][m](x)},o.resolve=function(m){for(var x=m.split("/"),b=[],v=0;v<x.length;v++){var w=x[v];w==="."||w===""&&v!==0&&v!==x.length-1||(w===".."?b.pop():b.push(w))}return b.join("/")},o.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":s.nodebuffer&&l.isBuffer(m)?"nodebuffer":s.uint8array&&m instanceof Uint8Array?"uint8array":s.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(m){if(!s[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(m){var x,b,v="";for(b=0;b<(m||"").length;b++)v+="\\x"+((x=m.charCodeAt(b))<16?"0":"")+x.toString(16).toUpperCase();return v},o.delay=function(m,x,b){setImmediate(function(){m.apply(b||null,x||[])})},o.inherits=function(m,x){function b(){}b.prototype=x.prototype,m.prototype=new b},o.extend=function(){var m,x,b={};for(m=0;m<arguments.length;m++)for(x in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],x)&&b[x]===void 0&&(b[x]=arguments[m][x]);return b},o.prepareContent=function(m,x,b,v,w){return c.Promise.resolve(x).then(function(C){return s.blob&&(C instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(C))!==-1)&&typeof FileReader<"u"?new c.Promise(function(S,j){var E=new FileReader;E.onload=function(N){S(N.target.result)},E.onerror=function(N){j(N.target.error)},E.readAsArrayBuffer(C)}):C}).then(function(C){var S=o.getTypeOf(C);return S?(S==="arraybuffer"?C=o.transformTo("uint8array",C):S==="string"&&(w?C=a.decode(C):b&&v!==!0&&(C=(function(j){return d(j,s.uint8array?new Uint8Array(j.length):new Array(j.length))})(C))),C):c.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){var s=n("./reader/readerFor"),a=n("./utils"),l=n("./signature"),c=n("./zipEntry"),u=n("./support");function d(f){this.files=[],this.loadOptions=f}d.prototype={checkSignature:function(f){if(!this.reader.readAndCheckSignature(f)){this.reader.index-=4;var h=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+a.pretty(h)+", expected "+a.pretty(f)+")")}},isSignature:function(f,h){var p=this.reader.index;this.reader.setIndex(f);var y=this.reader.readString(4)===h;return this.reader.setIndex(p),y},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),h=u.uint8array?"uint8array":"array",p=a.transformTo(h,f);this.zipComment=this.loadOptions.decodeFileName(p)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,h,p,y=this.zip64EndOfCentralSize-44;0<y;)f=this.reader.readInt(2),h=this.reader.readInt(4),p=this.reader.readData(h),this.zip64ExtensibleData[f]={id:f,length:h,value:p}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,h;for(f=0;f<this.files.length;f++)h=this.files[f],this.reader.setIndex(h.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),h.readLocalPart(this.reader),h.handleUTF8(),h.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(f=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var f=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,l.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var h=f;if(this.checkSignature(l.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a.MAX_VALUE_16BITS||this.centralDirRecords===a.MAX_VALUE_16BITS||this.centralDirSize===a.MAX_VALUE_32BITS||this.centralDirOffset===a.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,l.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var y=h-p;if(0<y)this.isSignature(h,l.CENTRAL_FILE_HEADER)||(this.reader.zero=y);else if(y<0)throw new Error("Corrupted zip: missing "+Math.abs(y)+" bytes.")},prepareReader:function(f){this.reader=s(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){var s=n("./reader/readerFor"),a=n("./utils"),l=n("./compressedObject"),c=n("./crc32"),u=n("./utf8"),d=n("./compressions"),f=n("./support");function h(p,y){this.options=p,this.loadOptions=y}h.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var y,m;if(p.skip(22),this.fileNameLength=p.readInt(2),m=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(m),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((y=(function(x){for(var b in d)if(Object.prototype.hasOwnProperty.call(d,b)&&d[b].magic===x)return d[b];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+a.pretty(this.compressionMethod)+" unknown (inner file : "+a.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,y,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var y=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(y),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=s(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var y,m,x,b=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<b;)y=p.readInt(2),m=p.readInt(2),x=p.readData(m),this.extraFields[y]={id:y,length:m,value:x};p.setIndex(b)},handleUTF8:function(){var p=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var y=this.findExtraFieldUnicodePath();if(y!==null)this.fileNameStr=y;else{var m=a.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var b=a.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(b)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var y=s(p.value);return y.readInt(1)!==1||c(this.fileName)!==y.readInt(4)?null:u.utf8decode(y.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var y=s(p.value);return y.readInt(1)!==1||c(this.fileComment)!==y.readInt(4)?null:u.utf8decode(y.readData(p.length-5))}return null}},r.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){function s(y,m,x){this.name=y,this.dir=x.dir,this.date=x.date,this.comment=x.comment,this.unixPermissions=x.unixPermissions,this.dosPermissions=x.dosPermissions,this._data=m,this._dataBinary=x.binary,this.options={compression:x.compression,compressionOptions:x.compressionOptions}}var a=n("./stream/StreamHelper"),l=n("./stream/DataWorker"),c=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");s.prototype={internalStream:function(y){var m=null,x="string";try{if(!y)throw new Error("No output type specified.");var b=(x=y.toLowerCase())==="string"||x==="text";x!=="binarystring"&&x!=="text"||(x="string"),m=this._decompressWorker();var v=!this._dataBinary;v&&!b&&(m=m.pipe(new c.Utf8EncodeWorker)),!v&&b&&(m=m.pipe(new c.Utf8DecodeWorker))}catch(w){(m=new d("error")).error(w)}return new a(m,x,"")},async:function(y,m){return this.internalStream(y).accumulate(m)},nodeStream:function(y,m){return this.internalStream(y||"nodebuffer").toNodejsStream(m)},_compressWorker:function(y,m){if(this._data instanceof u&&this._data.compression.magic===y.magic)return this._data.getCompressedWorker();var x=this._decompressWorker();return this._dataBinary||(x=x.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(x,y,m)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new l(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<f.length;p++)s.prototype[f[p]]=h;r.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(s){var a,l,c=s.MutationObserver||s.WebKitMutationObserver;if(c){var u=0,d=new c(y),f=s.document.createTextNode("");d.observe(f,{characterData:!0}),a=function(){f.data=u=++u%2}}else if(s.setImmediate||s.MessageChannel===void 0)a="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var m=s.document.createElement("script");m.onreadystatechange=function(){y(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},s.document.documentElement.appendChild(m)}:function(){setTimeout(y,0)};else{var h=new s.MessageChannel;h.port1.onmessage=y,a=function(){h.port2.postMessage(0)}}var p=[];function y(){var m,x;l=!0;for(var b=p.length;b;){for(x=p,p=[],m=-1;++m<b;)x[m]();b=p.length}l=!1}r.exports=function(m){p.push(m)!==1||l||a()}}).call(this,typeof lo<"u"?lo:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){var s=n("immediate");function a(){}var l={},c=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function f(b){if(typeof b!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,b!==a&&m(this,b)}function h(b,v,w){this.promise=b,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof w=="function"&&(this.onRejected=w,this.callRejected=this.otherCallRejected)}function p(b,v,w){s(function(){var C;try{C=v(w)}catch(S){return l.reject(b,S)}C===b?l.reject(b,new TypeError("Cannot resolve promise with itself")):l.resolve(b,C)})}function y(b){var v=b&&b.then;if(b&&(typeof b=="object"||typeof b=="function")&&typeof v=="function")return function(){v.apply(b,arguments)}}function m(b,v){var w=!1;function C(E){w||(w=!0,l.reject(b,E))}function S(E){w||(w=!0,l.resolve(b,E))}var j=x(function(){v(S,C)});j.status==="error"&&C(j.value)}function x(b,v){var w={};try{w.value=b(v),w.status="success"}catch(C){w.status="error",w.value=C}return w}(r.exports=f).prototype.finally=function(b){if(typeof b!="function")return this;var v=this.constructor;return this.then(function(w){return v.resolve(b()).then(function(){return w})},function(w){return v.resolve(b()).then(function(){throw w})})},f.prototype.catch=function(b){return this.then(null,b)},f.prototype.then=function(b,v){if(typeof b!="function"&&this.state===u||typeof v!="function"&&this.state===c)return this;var w=new this.constructor(a);return this.state!==d?p(w,this.state===u?b:v,this.outcome):this.queue.push(new h(w,b,v)),w},h.prototype.callFulfilled=function(b){l.resolve(this.promise,b)},h.prototype.otherCallFulfilled=function(b){p(this.promise,this.onFulfilled,b)},h.prototype.callRejected=function(b){l.reject(this.promise,b)},h.prototype.otherCallRejected=function(b){p(this.promise,this.onRejected,b)},l.resolve=function(b,v){var w=x(y,v);if(w.status==="error")return l.reject(b,w.value);var C=w.value;if(C)m(b,C);else{b.state=u,b.outcome=v;for(var S=-1,j=b.queue.length;++S<j;)b.queue[S].callFulfilled(v)}return b},l.reject=function(b,v){b.state=c,b.outcome=v;for(var w=-1,C=b.queue.length;++w<C;)b.queue[w].callRejected(v);return b},f.resolve=function(b){return b instanceof this?b:l.resolve(new this(a),b)},f.reject=function(b){var v=new this(a);return l.reject(v,b)},f.all=function(b){var v=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=b.length,C=!1;if(!w)return this.resolve([]);for(var S=new Array(w),j=0,E=-1,N=new this(a);++E<w;)z(b[E],E);return N;function z(M,B){v.resolve(M).then(function(T){S[B]=T,++j!==w||C||(C=!0,l.resolve(N,S))},function(T){C||(C=!0,l.reject(N,T))})}},f.race=function(b){var v=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=b.length,C=!1;if(!w)return this.resolve([]);for(var S=-1,j=new this(a);++S<w;)E=b[S],v.resolve(E).then(function(N){C||(C=!0,l.resolve(j,N))},function(N){C||(C=!0,l.reject(j,N))});var E;return j}},{immediate:36}],38:[function(n,r,o){var s={};(0,n("./lib/utils/common").assign)(s,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){var s=n("./zlib/deflate"),a=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/messages"),u=n("./zlib/zstream"),d=Object.prototype.toString,f=0,h=-1,p=0,y=8;function m(b){if(!(this instanceof m))return new m(b);this.options=a.assign({level:h,method:y,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},b||{});var v=this.options;v.raw&&0<v.windowBits?v.windowBits=-v.windowBits:v.gzip&&0<v.windowBits&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var w=s.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(w!==f)throw new Error(c[w]);if(v.header&&s.deflateSetHeader(this.strm,v.header),v.dictionary){var C;if(C=typeof v.dictionary=="string"?l.string2buf(v.dictionary):d.call(v.dictionary)==="[object ArrayBuffer]"?new Uint8Array(v.dictionary):v.dictionary,(w=s.deflateSetDictionary(this.strm,C))!==f)throw new Error(c[w]);this._dict_set=!0}}function x(b,v){var w=new m(v);if(w.push(b,!0),w.err)throw w.msg||c[w.err];return w.result}m.prototype.push=function(b,v){var w,C,S=this.strm,j=this.options.chunkSize;if(this.ended)return!1;C=v===~~v?v:v===!0?4:0,typeof b=="string"?S.input=l.string2buf(b):d.call(b)==="[object ArrayBuffer]"?S.input=new Uint8Array(b):S.input=b,S.next_in=0,S.avail_in=S.input.length;do{if(S.avail_out===0&&(S.output=new a.Buf8(j),S.next_out=0,S.avail_out=j),(w=s.deflate(S,C))!==1&&w!==f)return this.onEnd(w),!(this.ended=!0);S.avail_out!==0&&(S.avail_in!==0||C!==4&&C!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(a.shrinkBuf(S.output,S.next_out))):this.onData(a.shrinkBuf(S.output,S.next_out)))}while((0<S.avail_in||S.avail_out===0)&&w!==1);return C===4?(w=s.deflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===f):C!==2||(this.onEnd(f),!(S.avail_out=0))},m.prototype.onData=function(b){this.chunks.push(b)},m.prototype.onEnd=function(b){b===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=b,this.msg=this.strm.msg},o.Deflate=m,o.deflate=x,o.deflateRaw=function(b,v){return(v=v||{}).raw=!0,x(b,v)},o.gzip=function(b,v){return(v=v||{}).gzip=!0,x(b,v)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){var s=n("./zlib/inflate"),a=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/constants"),u=n("./zlib/messages"),d=n("./zlib/zstream"),f=n("./zlib/gzheader"),h=Object.prototype.toString;function p(m){if(!(this instanceof p))return new p(m);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},m||{});var x=this.options;x.raw&&0<=x.windowBits&&x.windowBits<16&&(x.windowBits=-x.windowBits,x.windowBits===0&&(x.windowBits=-15)),!(0<=x.windowBits&&x.windowBits<16)||m&&m.windowBits||(x.windowBits+=32),15<x.windowBits&&x.windowBits<48&&(15&x.windowBits)==0&&(x.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var b=s.inflateInit2(this.strm,x.windowBits);if(b!==c.Z_OK)throw new Error(u[b]);this.header=new f,s.inflateGetHeader(this.strm,this.header)}function y(m,x){var b=new p(x);if(b.push(m,!0),b.err)throw b.msg||u[b.err];return b.result}p.prototype.push=function(m,x){var b,v,w,C,S,j,E=this.strm,N=this.options.chunkSize,z=this.options.dictionary,M=!1;if(this.ended)return!1;v=x===~~x?x:x===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof m=="string"?E.input=l.binstring2buf(m):h.call(m)==="[object ArrayBuffer]"?E.input=new Uint8Array(m):E.input=m,E.next_in=0,E.avail_in=E.input.length;do{if(E.avail_out===0&&(E.output=new a.Buf8(N),E.next_out=0,E.avail_out=N),(b=s.inflate(E,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&z&&(j=typeof z=="string"?l.string2buf(z):h.call(z)==="[object ArrayBuffer]"?new Uint8Array(z):z,b=s.inflateSetDictionary(this.strm,j)),b===c.Z_BUF_ERROR&&M===!0&&(b=c.Z_OK,M=!1),b!==c.Z_STREAM_END&&b!==c.Z_OK)return this.onEnd(b),!(this.ended=!0);E.next_out&&(E.avail_out!==0&&b!==c.Z_STREAM_END&&(E.avail_in!==0||v!==c.Z_FINISH&&v!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(w=l.utf8border(E.output,E.next_out),C=E.next_out-w,S=l.buf2string(E.output,w),E.next_out=C,E.avail_out=N-C,C&&a.arraySet(E.output,E.output,w,C,0),this.onData(S)):this.onData(a.shrinkBuf(E.output,E.next_out)))),E.avail_in===0&&E.avail_out===0&&(M=!0)}while((0<E.avail_in||E.avail_out===0)&&b!==c.Z_STREAM_END);return b===c.Z_STREAM_END&&(v=c.Z_FINISH),v===c.Z_FINISH?(b=s.inflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===c.Z_OK):v!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(E.avail_out=0))},p.prototype.onData=function(m){this.chunks.push(m)},p.prototype.onEnd=function(m){m===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},o.Inflate=p,o.inflate=y,o.inflateRaw=function(m,x){return(x=x||{}).raw=!0,y(m,x)},o.ungzip=y},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(c){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var f in d)d.hasOwnProperty(f)&&(c[f]=d[f])}}return c},o.shrinkBuf=function(c,u){return c.length===u?c:c.subarray?c.subarray(0,u):(c.length=u,c)};var a={arraySet:function(c,u,d,f,h){if(u.subarray&&c.subarray)c.set(u.subarray(d,d+f),h);else for(var p=0;p<f;p++)c[h+p]=u[d+p]},flattenChunks:function(c){var u,d,f,h,p,y;for(u=f=0,d=c.length;u<d;u++)f+=c[u].length;for(y=new Uint8Array(f),u=h=0,d=c.length;u<d;u++)p=c[u],y.set(p,h),h+=p.length;return y}},l={arraySet:function(c,u,d,f,h){for(var p=0;p<f;p++)c[h+p]=u[d+p]},flattenChunks:function(c){return[].concat.apply([],c)}};o.setTyped=function(c){c?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,a)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,l))},o.setTyped(s)},{}],42:[function(n,r,o){var s=n("./common"),a=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var c=new s.Buf8(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(f,h){if(h<65537&&(f.subarray&&l||!f.subarray&&a))return String.fromCharCode.apply(null,s.shrinkBuf(f,h));for(var p="",y=0;y<h;y++)p+=String.fromCharCode(f[y]);return p}c[254]=c[254]=1,o.string2buf=function(f){var h,p,y,m,x,b=f.length,v=0;for(m=0;m<b;m++)(64512&(p=f.charCodeAt(m)))==55296&&m+1<b&&(64512&(y=f.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(y-56320),m++),v+=p<128?1:p<2048?2:p<65536?3:4;for(h=new s.Buf8(v),m=x=0;x<v;m++)(64512&(p=f.charCodeAt(m)))==55296&&m+1<b&&(64512&(y=f.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(y-56320),m++),p<128?h[x++]=p:(p<2048?h[x++]=192|p>>>6:(p<65536?h[x++]=224|p>>>12:(h[x++]=240|p>>>18,h[x++]=128|p>>>12&63),h[x++]=128|p>>>6&63),h[x++]=128|63&p);return h},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var h=new s.Buf8(f.length),p=0,y=h.length;p<y;p++)h[p]=f.charCodeAt(p);return h},o.buf2string=function(f,h){var p,y,m,x,b=h||f.length,v=new Array(2*b);for(p=y=0;p<b;)if((m=f[p++])<128)v[y++]=m;else if(4<(x=c[m]))v[y++]=65533,p+=x-1;else{for(m&=x===2?31:x===3?15:7;1<x&&p<b;)m=m<<6|63&f[p++],x--;1<x?v[y++]=65533:m<65536?v[y++]=m:(m-=65536,v[y++]=55296|m>>10&1023,v[y++]=56320|1023&m)}return d(v,y)},o.utf8border=function(f,h){var p;for((h=h||f.length)>f.length&&(h=f.length),p=h-1;0<=p&&(192&f[p])==128;)p--;return p<0||p===0?h:p+c[f[p]]>h?p:h}},{"./common":41}],43:[function(n,r,o){r.exports=function(s,a,l,c){for(var u=65535&s|0,d=s>>>16&65535|0,f=0;l!==0;){for(l-=f=2e3<l?2e3:l;d=d+(u=u+a[c++]|0)|0,--f;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(n,r,o){r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){var s=(function(){for(var a,l=[],c=0;c<256;c++){a=c;for(var u=0;u<8;u++)a=1&a?3988292384^a>>>1:a>>>1;l[c]=a}return l})();r.exports=function(a,l,c,u){var d=s,f=u+c;a^=-1;for(var h=u;h<f;h++)a=a>>>8^d[255&(a^l[h])];return-1^a}},{}],46:[function(n,r,o){var s,a=n("../utils/common"),l=n("./trees"),c=n("./adler32"),u=n("./crc32"),d=n("./messages"),f=0,h=4,p=0,y=-2,m=-1,x=4,b=2,v=8,w=9,C=286,S=30,j=19,E=2*C+1,N=15,z=3,M=258,B=M+z+1,T=42,D=113,k=1,L=2,W=3,U=4;function $(_,ee){return _.msg=d[ee],ee}function G(_){return(_<<1)-(4<_?9:0)}function A(_){for(var ee=_.length;0<=--ee;)_[ee]=0}function K(_){var ee=_.state,Q=ee.pending;Q>_.avail_out&&(Q=_.avail_out),Q!==0&&(a.arraySet(_.output,ee.pending_buf,ee.pending_out,Q,_.next_out),_.next_out+=Q,ee.pending_out+=Q,_.total_out+=Q,_.avail_out-=Q,ee.pending-=Q,ee.pending===0&&(ee.pending_out=0))}function q(_,ee){l._tr_flush_block(_,0<=_.block_start?_.block_start:-1,_.strstart-_.block_start,ee),_.block_start=_.strstart,K(_.strm)}function P(_,ee){_.pending_buf[_.pending++]=ee}function ie(_,ee){_.pending_buf[_.pending++]=ee>>>8&255,_.pending_buf[_.pending++]=255&ee}function le(_,ee){var Q,O,R=_.max_chain_length,Z=_.strstart,V=_.prev_length,J=_.nice_match,H=_.strstart>_.w_size-B?_.strstart-(_.w_size-B):0,ae=_.window,Y=_.w_mask,te=_.prev,F=_.strstart+M,X=ae[Z+V-1],ce=ae[Z+V];_.prev_length>=_.good_match&&(R>>=2),J>_.lookahead&&(J=_.lookahead);do if(ae[(Q=ee)+V]===ce&&ae[Q+V-1]===X&&ae[Q]===ae[Z]&&ae[++Q]===ae[Z+1]){Z+=2,Q++;do;while(ae[++Z]===ae[++Q]&&ae[++Z]===ae[++Q]&&ae[++Z]===ae[++Q]&&ae[++Z]===ae[++Q]&&ae[++Z]===ae[++Q]&&ae[++Z]===ae[++Q]&&ae[++Z]===ae[++Q]&&ae[++Z]===ae[++Q]&&Z<F);if(O=M-(F-Z),Z=F-M,V<O){if(_.match_start=ee,J<=(V=O))break;X=ae[Z+V-1],ce=ae[Z+V]}}while((ee=te[ee&Y])>H&&--R!=0);return V<=_.lookahead?V:_.lookahead}function ge(_){var ee,Q,O,R,Z,V,J,H,ae,Y,te=_.w_size;do{if(R=_.window_size-_.lookahead-_.strstart,_.strstart>=te+(te-B)){for(a.arraySet(_.window,_.window,te,te,0),_.match_start-=te,_.strstart-=te,_.block_start-=te,ee=Q=_.hash_size;O=_.head[--ee],_.head[ee]=te<=O?O-te:0,--Q;);for(ee=Q=te;O=_.prev[--ee],_.prev[ee]=te<=O?O-te:0,--Q;);R+=te}if(_.strm.avail_in===0)break;if(V=_.strm,J=_.window,H=_.strstart+_.lookahead,ae=R,Y=void 0,Y=V.avail_in,ae<Y&&(Y=ae),Q=Y===0?0:(V.avail_in-=Y,a.arraySet(J,V.input,V.next_in,Y,H),V.state.wrap===1?V.adler=c(V.adler,J,Y,H):V.state.wrap===2&&(V.adler=u(V.adler,J,Y,H)),V.next_in+=Y,V.total_in+=Y,Y),_.lookahead+=Q,_.lookahead+_.insert>=z)for(Z=_.strstart-_.insert,_.ins_h=_.window[Z],_.ins_h=(_.ins_h<<_.hash_shift^_.window[Z+1])&_.hash_mask;_.insert&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[Z+z-1])&_.hash_mask,_.prev[Z&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=Z,Z++,_.insert--,!(_.lookahead+_.insert<z)););}while(_.lookahead<B&&_.strm.avail_in!==0)}function ne(_,ee){for(var Q,O;;){if(_.lookahead<B){if(ge(_),_.lookahead<B&&ee===f)return k;if(_.lookahead===0)break}if(Q=0,_.lookahead>=z&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),Q!==0&&_.strstart-Q<=_.w_size-B&&(_.match_length=le(_,Q)),_.match_length>=z)if(O=l._tr_tally(_,_.strstart-_.match_start,_.match_length-z),_.lookahead-=_.match_length,_.match_length<=_.max_lazy_match&&_.lookahead>=z){for(_.match_length--;_.strstart++,_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart,--_.match_length!=0;);_.strstart++}else _.strstart+=_.match_length,_.match_length=0,_.ins_h=_.window[_.strstart],_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+1])&_.hash_mask;else O=l._tr_tally(_,0,_.window[_.strstart]),_.lookahead--,_.strstart++;if(O&&(q(_,!1),_.strm.avail_out===0))return k}return _.insert=_.strstart<z-1?_.strstart:z-1,ee===h?(q(_,!0),_.strm.avail_out===0?W:U):_.last_lit&&(q(_,!1),_.strm.avail_out===0)?k:L}function ue(_,ee){for(var Q,O,R;;){if(_.lookahead<B){if(ge(_),_.lookahead<B&&ee===f)return k;if(_.lookahead===0)break}if(Q=0,_.lookahead>=z&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),_.prev_length=_.match_length,_.prev_match=_.match_start,_.match_length=z-1,Q!==0&&_.prev_length<_.max_lazy_match&&_.strstart-Q<=_.w_size-B&&(_.match_length=le(_,Q),_.match_length<=5&&(_.strategy===1||_.match_length===z&&4096<_.strstart-_.match_start)&&(_.match_length=z-1)),_.prev_length>=z&&_.match_length<=_.prev_length){for(R=_.strstart+_.lookahead-z,O=l._tr_tally(_,_.strstart-1-_.prev_match,_.prev_length-z),_.lookahead-=_.prev_length-1,_.prev_length-=2;++_.strstart<=R&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),--_.prev_length!=0;);if(_.match_available=0,_.match_length=z-1,_.strstart++,O&&(q(_,!1),_.strm.avail_out===0))return k}else if(_.match_available){if((O=l._tr_tally(_,0,_.window[_.strstart-1]))&&q(_,!1),_.strstart++,_.lookahead--,_.strm.avail_out===0)return k}else _.match_available=1,_.strstart++,_.lookahead--}return _.match_available&&(O=l._tr_tally(_,0,_.window[_.strstart-1]),_.match_available=0),_.insert=_.strstart<z-1?_.strstart:z-1,ee===h?(q(_,!0),_.strm.avail_out===0?W:U):_.last_lit&&(q(_,!1),_.strm.avail_out===0)?k:L}function de(_,ee,Q,O,R){this.good_length=_,this.max_lazy=ee,this.nice_length=Q,this.max_chain=O,this.func=R}function he(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=v,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new a.Buf16(2*E),this.dyn_dtree=new a.Buf16(2*(2*S+1)),this.bl_tree=new a.Buf16(2*(2*j+1)),A(this.dyn_ltree),A(this.dyn_dtree),A(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new a.Buf16(N+1),this.heap=new a.Buf16(2*C+1),A(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new a.Buf16(2*C+1),A(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function me(_){var ee;return _&&_.state?(_.total_in=_.total_out=0,_.data_type=b,(ee=_.state).pending=0,ee.pending_out=0,ee.wrap<0&&(ee.wrap=-ee.wrap),ee.status=ee.wrap?T:D,_.adler=ee.wrap===2?0:1,ee.last_flush=f,l._tr_init(ee),p):$(_,y)}function fe(_){var ee=me(_);return ee===p&&(function(Q){Q.window_size=2*Q.w_size,A(Q.head),Q.max_lazy_match=s[Q.level].max_lazy,Q.good_match=s[Q.level].good_length,Q.nice_match=s[Q.level].nice_length,Q.max_chain_length=s[Q.level].max_chain,Q.strstart=0,Q.block_start=0,Q.lookahead=0,Q.insert=0,Q.match_length=Q.prev_length=z-1,Q.match_available=0,Q.ins_h=0})(_.state),ee}function Se(_,ee,Q,O,R,Z){if(!_)return y;var V=1;if(ee===m&&(ee=6),O<0?(V=0,O=-O):15<O&&(V=2,O-=16),R<1||w<R||Q!==v||O<8||15<O||ee<0||9<ee||Z<0||x<Z)return $(_,y);O===8&&(O=9);var J=new he;return(_.state=J).strm=_,J.wrap=V,J.gzhead=null,J.w_bits=O,J.w_size=1<<J.w_bits,J.w_mask=J.w_size-1,J.hash_bits=R+7,J.hash_size=1<<J.hash_bits,J.hash_mask=J.hash_size-1,J.hash_shift=~~((J.hash_bits+z-1)/z),J.window=new a.Buf8(2*J.w_size),J.head=new a.Buf16(J.hash_size),J.prev=new a.Buf16(J.w_size),J.lit_bufsize=1<<R+6,J.pending_buf_size=4*J.lit_bufsize,J.pending_buf=new a.Buf8(J.pending_buf_size),J.d_buf=1*J.lit_bufsize,J.l_buf=3*J.lit_bufsize,J.level=ee,J.strategy=Z,J.method=Q,fe(_)}s=[new de(0,0,0,0,function(_,ee){var Q=65535;for(Q>_.pending_buf_size-5&&(Q=_.pending_buf_size-5);;){if(_.lookahead<=1){if(ge(_),_.lookahead===0&&ee===f)return k;if(_.lookahead===0)break}_.strstart+=_.lookahead,_.lookahead=0;var O=_.block_start+Q;if((_.strstart===0||_.strstart>=O)&&(_.lookahead=_.strstart-O,_.strstart=O,q(_,!1),_.strm.avail_out===0)||_.strstart-_.block_start>=_.w_size-B&&(q(_,!1),_.strm.avail_out===0))return k}return _.insert=0,ee===h?(q(_,!0),_.strm.avail_out===0?W:U):(_.strstart>_.block_start&&(q(_,!1),_.strm.avail_out),k)}),new de(4,4,8,4,ne),new de(4,5,16,8,ne),new de(4,6,32,32,ne),new de(4,4,16,16,ue),new de(8,16,32,32,ue),new de(8,16,128,128,ue),new de(8,32,128,256,ue),new de(32,128,258,1024,ue),new de(32,258,258,4096,ue)],o.deflateInit=function(_,ee){return Se(_,ee,v,15,8,0)},o.deflateInit2=Se,o.deflateReset=fe,o.deflateResetKeep=me,o.deflateSetHeader=function(_,ee){return _&&_.state?_.state.wrap!==2?y:(_.state.gzhead=ee,p):y},o.deflate=function(_,ee){var Q,O,R,Z;if(!_||!_.state||5<ee||ee<0)return _?$(_,y):y;if(O=_.state,!_.output||!_.input&&_.avail_in!==0||O.status===666&&ee!==h)return $(_,_.avail_out===0?-5:y);if(O.strm=_,Q=O.last_flush,O.last_flush=ee,O.status===T)if(O.wrap===2)_.adler=0,P(O,31),P(O,139),P(O,8),O.gzhead?(P(O,(O.gzhead.text?1:0)+(O.gzhead.hcrc?2:0)+(O.gzhead.extra?4:0)+(O.gzhead.name?8:0)+(O.gzhead.comment?16:0)),P(O,255&O.gzhead.time),P(O,O.gzhead.time>>8&255),P(O,O.gzhead.time>>16&255),P(O,O.gzhead.time>>24&255),P(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),P(O,255&O.gzhead.os),O.gzhead.extra&&O.gzhead.extra.length&&(P(O,255&O.gzhead.extra.length),P(O,O.gzhead.extra.length>>8&255)),O.gzhead.hcrc&&(_.adler=u(_.adler,O.pending_buf,O.pending,0)),O.gzindex=0,O.status=69):(P(O,0),P(O,0),P(O,0),P(O,0),P(O,0),P(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),P(O,3),O.status=D);else{var V=v+(O.w_bits-8<<4)<<8;V|=(2<=O.strategy||O.level<2?0:O.level<6?1:O.level===6?2:3)<<6,O.strstart!==0&&(V|=32),V+=31-V%31,O.status=D,ie(O,V),O.strstart!==0&&(ie(O,_.adler>>>16),ie(O,65535&_.adler)),_.adler=1}if(O.status===69)if(O.gzhead.extra){for(R=O.pending;O.gzindex<(65535&O.gzhead.extra.length)&&(O.pending!==O.pending_buf_size||(O.gzhead.hcrc&&O.pending>R&&(_.adler=u(_.adler,O.pending_buf,O.pending-R,R)),K(_),R=O.pending,O.pending!==O.pending_buf_size));)P(O,255&O.gzhead.extra[O.gzindex]),O.gzindex++;O.gzhead.hcrc&&O.pending>R&&(_.adler=u(_.adler,O.pending_buf,O.pending-R,R)),O.gzindex===O.gzhead.extra.length&&(O.gzindex=0,O.status=73)}else O.status=73;if(O.status===73)if(O.gzhead.name){R=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>R&&(_.adler=u(_.adler,O.pending_buf,O.pending-R,R)),K(_),R=O.pending,O.pending===O.pending_buf_size)){Z=1;break}Z=O.gzindex<O.gzhead.name.length?255&O.gzhead.name.charCodeAt(O.gzindex++):0,P(O,Z)}while(Z!==0);O.gzhead.hcrc&&O.pending>R&&(_.adler=u(_.adler,O.pending_buf,O.pending-R,R)),Z===0&&(O.gzindex=0,O.status=91)}else O.status=91;if(O.status===91)if(O.gzhead.comment){R=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>R&&(_.adler=u(_.adler,O.pending_buf,O.pending-R,R)),K(_),R=O.pending,O.pending===O.pending_buf_size)){Z=1;break}Z=O.gzindex<O.gzhead.comment.length?255&O.gzhead.comment.charCodeAt(O.gzindex++):0,P(O,Z)}while(Z!==0);O.gzhead.hcrc&&O.pending>R&&(_.adler=u(_.adler,O.pending_buf,O.pending-R,R)),Z===0&&(O.status=103)}else O.status=103;if(O.status===103&&(O.gzhead.hcrc?(O.pending+2>O.pending_buf_size&&K(_),O.pending+2<=O.pending_buf_size&&(P(O,255&_.adler),P(O,_.adler>>8&255),_.adler=0,O.status=D)):O.status=D),O.pending!==0){if(K(_),_.avail_out===0)return O.last_flush=-1,p}else if(_.avail_in===0&&G(ee)<=G(Q)&&ee!==h)return $(_,-5);if(O.status===666&&_.avail_in!==0)return $(_,-5);if(_.avail_in!==0||O.lookahead!==0||ee!==f&&O.status!==666){var J=O.strategy===2?(function(H,ae){for(var Y;;){if(H.lookahead===0&&(ge(H),H.lookahead===0)){if(ae===f)return k;break}if(H.match_length=0,Y=l._tr_tally(H,0,H.window[H.strstart]),H.lookahead--,H.strstart++,Y&&(q(H,!1),H.strm.avail_out===0))return k}return H.insert=0,ae===h?(q(H,!0),H.strm.avail_out===0?W:U):H.last_lit&&(q(H,!1),H.strm.avail_out===0)?k:L})(O,ee):O.strategy===3?(function(H,ae){for(var Y,te,F,X,ce=H.window;;){if(H.lookahead<=M){if(ge(H),H.lookahead<=M&&ae===f)return k;if(H.lookahead===0)break}if(H.match_length=0,H.lookahead>=z&&0<H.strstart&&(te=ce[F=H.strstart-1])===ce[++F]&&te===ce[++F]&&te===ce[++F]){X=H.strstart+M;do;while(te===ce[++F]&&te===ce[++F]&&te===ce[++F]&&te===ce[++F]&&te===ce[++F]&&te===ce[++F]&&te===ce[++F]&&te===ce[++F]&&F<X);H.match_length=M-(X-F),H.match_length>H.lookahead&&(H.match_length=H.lookahead)}if(H.match_length>=z?(Y=l._tr_tally(H,1,H.match_length-z),H.lookahead-=H.match_length,H.strstart+=H.match_length,H.match_length=0):(Y=l._tr_tally(H,0,H.window[H.strstart]),H.lookahead--,H.strstart++),Y&&(q(H,!1),H.strm.avail_out===0))return k}return H.insert=0,ae===h?(q(H,!0),H.strm.avail_out===0?W:U):H.last_lit&&(q(H,!1),H.strm.avail_out===0)?k:L})(O,ee):s[O.level].func(O,ee);if(J!==W&&J!==U||(O.status=666),J===k||J===W)return _.avail_out===0&&(O.last_flush=-1),p;if(J===L&&(ee===1?l._tr_align(O):ee!==5&&(l._tr_stored_block(O,0,0,!1),ee===3&&(A(O.head),O.lookahead===0&&(O.strstart=0,O.block_start=0,O.insert=0))),K(_),_.avail_out===0))return O.last_flush=-1,p}return ee!==h?p:O.wrap<=0?1:(O.wrap===2?(P(O,255&_.adler),P(O,_.adler>>8&255),P(O,_.adler>>16&255),P(O,_.adler>>24&255),P(O,255&_.total_in),P(O,_.total_in>>8&255),P(O,_.total_in>>16&255),P(O,_.total_in>>24&255)):(ie(O,_.adler>>>16),ie(O,65535&_.adler)),K(_),0<O.wrap&&(O.wrap=-O.wrap),O.pending!==0?p:1)},o.deflateEnd=function(_){var ee;return _&&_.state?(ee=_.state.status)!==T&&ee!==69&&ee!==73&&ee!==91&&ee!==103&&ee!==D&&ee!==666?$(_,y):(_.state=null,ee===D?$(_,-3):p):y},o.deflateSetDictionary=function(_,ee){var Q,O,R,Z,V,J,H,ae,Y=ee.length;if(!_||!_.state||(Z=(Q=_.state).wrap)===2||Z===1&&Q.status!==T||Q.lookahead)return y;for(Z===1&&(_.adler=c(_.adler,ee,Y,0)),Q.wrap=0,Y>=Q.w_size&&(Z===0&&(A(Q.head),Q.strstart=0,Q.block_start=0,Q.insert=0),ae=new a.Buf8(Q.w_size),a.arraySet(ae,ee,Y-Q.w_size,Q.w_size,0),ee=ae,Y=Q.w_size),V=_.avail_in,J=_.next_in,H=_.input,_.avail_in=Y,_.next_in=0,_.input=ee,ge(Q);Q.lookahead>=z;){for(O=Q.strstart,R=Q.lookahead-(z-1);Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[O+z-1])&Q.hash_mask,Q.prev[O&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=O,O++,--R;);Q.strstart=O,Q.lookahead=z-1,ge(Q)}return Q.strstart+=Q.lookahead,Q.block_start=Q.strstart,Q.insert=Q.lookahead,Q.lookahead=0,Q.match_length=Q.prev_length=z-1,Q.match_available=0,_.next_in=J,_.input=H,_.avail_in=V,Q.wrap=Z,p},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){r.exports=function(s,a){var l,c,u,d,f,h,p,y,m,x,b,v,w,C,S,j,E,N,z,M,B,T,D,k,L;l=s.state,c=s.next_in,k=s.input,u=c+(s.avail_in-5),d=s.next_out,L=s.output,f=d-(a-s.avail_out),h=d+(s.avail_out-257),p=l.dmax,y=l.wsize,m=l.whave,x=l.wnext,b=l.window,v=l.hold,w=l.bits,C=l.lencode,S=l.distcode,j=(1<<l.lenbits)-1,E=(1<<l.distbits)-1;e:do{w<15&&(v+=k[c++]<<w,w+=8,v+=k[c++]<<w,w+=8),N=C[v&j];t:for(;;){if(v>>>=z=N>>>24,w-=z,(z=N>>>16&255)===0)L[d++]=65535&N;else{if(!(16&z)){if((64&z)==0){N=C[(65535&N)+(v&(1<<z)-1)];continue t}if(32&z){l.mode=12;break e}s.msg="invalid literal/length code",l.mode=30;break e}M=65535&N,(z&=15)&&(w<z&&(v+=k[c++]<<w,w+=8),M+=v&(1<<z)-1,v>>>=z,w-=z),w<15&&(v+=k[c++]<<w,w+=8,v+=k[c++]<<w,w+=8),N=S[v&E];n:for(;;){if(v>>>=z=N>>>24,w-=z,!(16&(z=N>>>16&255))){if((64&z)==0){N=S[(65535&N)+(v&(1<<z)-1)];continue n}s.msg="invalid distance code",l.mode=30;break e}if(B=65535&N,w<(z&=15)&&(v+=k[c++]<<w,(w+=8)<z&&(v+=k[c++]<<w,w+=8)),p<(B+=v&(1<<z)-1)){s.msg="invalid distance too far back",l.mode=30;break e}if(v>>>=z,w-=z,(z=d-f)<B){if(m<(z=B-z)&&l.sane){s.msg="invalid distance too far back",l.mode=30;break e}if(D=b,(T=0)===x){if(T+=y-z,z<M){for(M-=z;L[d++]=b[T++],--z;);T=d-B,D=L}}else if(x<z){if(T+=y+x-z,(z-=x)<M){for(M-=z;L[d++]=b[T++],--z;);if(T=0,x<M){for(M-=z=x;L[d++]=b[T++],--z;);T=d-B,D=L}}}else if(T+=x-z,z<M){for(M-=z;L[d++]=b[T++],--z;);T=d-B,D=L}for(;2<M;)L[d++]=D[T++],L[d++]=D[T++],L[d++]=D[T++],M-=3;M&&(L[d++]=D[T++],1<M&&(L[d++]=D[T++]))}else{for(T=d-B;L[d++]=L[T++],L[d++]=L[T++],L[d++]=L[T++],2<(M-=3););M&&(L[d++]=L[T++],1<M&&(L[d++]=L[T++]))}break}}break}}while(c<u&&d<h);c-=M=w>>3,v&=(1<<(w-=M<<3))-1,s.next_in=c,s.next_out=d,s.avail_in=c<u?u-c+5:5-(c-u),s.avail_out=d<h?h-d+257:257-(d-h),l.hold=v,l.bits=w}},{}],49:[function(n,r,o){var s=n("../utils/common"),a=n("./adler32"),l=n("./crc32"),c=n("./inffast"),u=n("./inftrees"),d=1,f=2,h=0,p=-2,y=1,m=852,x=592;function b(T){return(T>>>24&255)+(T>>>8&65280)+((65280&T)<<8)+((255&T)<<24)}function v(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(T){var D;return T&&T.state?(D=T.state,T.total_in=T.total_out=D.total=0,T.msg="",D.wrap&&(T.adler=1&D.wrap),D.mode=y,D.last=0,D.havedict=0,D.dmax=32768,D.head=null,D.hold=0,D.bits=0,D.lencode=D.lendyn=new s.Buf32(m),D.distcode=D.distdyn=new s.Buf32(x),D.sane=1,D.back=-1,h):p}function C(T){var D;return T&&T.state?((D=T.state).wsize=0,D.whave=0,D.wnext=0,w(T)):p}function S(T,D){var k,L;return T&&T.state?(L=T.state,D<0?(k=0,D=-D):(k=1+(D>>4),D<48&&(D&=15)),D&&(D<8||15<D)?p:(L.window!==null&&L.wbits!==D&&(L.window=null),L.wrap=k,L.wbits=D,C(T))):p}function j(T,D){var k,L;return T?(L=new v,(T.state=L).window=null,(k=S(T,D))!==h&&(T.state=null),k):p}var E,N,z=!0;function M(T){if(z){var D;for(E=new s.Buf32(512),N=new s.Buf32(32),D=0;D<144;)T.lens[D++]=8;for(;D<256;)T.lens[D++]=9;for(;D<280;)T.lens[D++]=7;for(;D<288;)T.lens[D++]=8;for(u(d,T.lens,0,288,E,0,T.work,{bits:9}),D=0;D<32;)T.lens[D++]=5;u(f,T.lens,0,32,N,0,T.work,{bits:5}),z=!1}T.lencode=E,T.lenbits=9,T.distcode=N,T.distbits=5}function B(T,D,k,L){var W,U=T.state;return U.window===null&&(U.wsize=1<<U.wbits,U.wnext=0,U.whave=0,U.window=new s.Buf8(U.wsize)),L>=U.wsize?(s.arraySet(U.window,D,k-U.wsize,U.wsize,0),U.wnext=0,U.whave=U.wsize):(L<(W=U.wsize-U.wnext)&&(W=L),s.arraySet(U.window,D,k-L,W,U.wnext),(L-=W)?(s.arraySet(U.window,D,k-L,L,0),U.wnext=L,U.whave=U.wsize):(U.wnext+=W,U.wnext===U.wsize&&(U.wnext=0),U.whave<U.wsize&&(U.whave+=W))),0}o.inflateReset=C,o.inflateReset2=S,o.inflateResetKeep=w,o.inflateInit=function(T){return j(T,15)},o.inflateInit2=j,o.inflate=function(T,D){var k,L,W,U,$,G,A,K,q,P,ie,le,ge,ne,ue,de,he,me,fe,Se,_,ee,Q,O,R=0,Z=new s.Buf8(4),V=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!T||!T.state||!T.output||!T.input&&T.avail_in!==0)return p;(k=T.state).mode===12&&(k.mode=13),$=T.next_out,W=T.output,A=T.avail_out,U=T.next_in,L=T.input,G=T.avail_in,K=k.hold,q=k.bits,P=G,ie=A,ee=h;e:for(;;)switch(k.mode){case y:if(k.wrap===0){k.mode=13;break}for(;q<16;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}if(2&k.wrap&&K===35615){Z[k.check=0]=255&K,Z[1]=K>>>8&255,k.check=l(k.check,Z,2,0),q=K=0,k.mode=2;break}if(k.flags=0,k.head&&(k.head.done=!1),!(1&k.wrap)||(((255&K)<<8)+(K>>8))%31){T.msg="incorrect header check",k.mode=30;break}if((15&K)!=8){T.msg="unknown compression method",k.mode=30;break}if(q-=4,_=8+(15&(K>>>=4)),k.wbits===0)k.wbits=_;else if(_>k.wbits){T.msg="invalid window size",k.mode=30;break}k.dmax=1<<_,T.adler=k.check=1,k.mode=512&K?10:12,q=K=0;break;case 2:for(;q<16;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}if(k.flags=K,(255&k.flags)!=8){T.msg="unknown compression method",k.mode=30;break}if(57344&k.flags){T.msg="unknown header flags set",k.mode=30;break}k.head&&(k.head.text=K>>8&1),512&k.flags&&(Z[0]=255&K,Z[1]=K>>>8&255,k.check=l(k.check,Z,2,0)),q=K=0,k.mode=3;case 3:for(;q<32;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}k.head&&(k.head.time=K),512&k.flags&&(Z[0]=255&K,Z[1]=K>>>8&255,Z[2]=K>>>16&255,Z[3]=K>>>24&255,k.check=l(k.check,Z,4,0)),q=K=0,k.mode=4;case 4:for(;q<16;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}k.head&&(k.head.xflags=255&K,k.head.os=K>>8),512&k.flags&&(Z[0]=255&K,Z[1]=K>>>8&255,k.check=l(k.check,Z,2,0)),q=K=0,k.mode=5;case 5:if(1024&k.flags){for(;q<16;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}k.length=K,k.head&&(k.head.extra_len=K),512&k.flags&&(Z[0]=255&K,Z[1]=K>>>8&255,k.check=l(k.check,Z,2,0)),q=K=0}else k.head&&(k.head.extra=null);k.mode=6;case 6:if(1024&k.flags&&(G<(le=k.length)&&(le=G),le&&(k.head&&(_=k.head.extra_len-k.length,k.head.extra||(k.head.extra=new Array(k.head.extra_len)),s.arraySet(k.head.extra,L,U,le,_)),512&k.flags&&(k.check=l(k.check,L,le,U)),G-=le,U+=le,k.length-=le),k.length))break e;k.length=0,k.mode=7;case 7:if(2048&k.flags){if(G===0)break e;for(le=0;_=L[U+le++],k.head&&_&&k.length<65536&&(k.head.name+=String.fromCharCode(_)),_&&le<G;);if(512&k.flags&&(k.check=l(k.check,L,le,U)),G-=le,U+=le,_)break e}else k.head&&(k.head.name=null);k.length=0,k.mode=8;case 8:if(4096&k.flags){if(G===0)break e;for(le=0;_=L[U+le++],k.head&&_&&k.length<65536&&(k.head.comment+=String.fromCharCode(_)),_&&le<G;);if(512&k.flags&&(k.check=l(k.check,L,le,U)),G-=le,U+=le,_)break e}else k.head&&(k.head.comment=null);k.mode=9;case 9:if(512&k.flags){for(;q<16;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}if(K!==(65535&k.check)){T.msg="header crc mismatch",k.mode=30;break}q=K=0}k.head&&(k.head.hcrc=k.flags>>9&1,k.head.done=!0),T.adler=k.check=0,k.mode=12;break;case 10:for(;q<32;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}T.adler=k.check=b(K),q=K=0,k.mode=11;case 11:if(k.havedict===0)return T.next_out=$,T.avail_out=A,T.next_in=U,T.avail_in=G,k.hold=K,k.bits=q,2;T.adler=k.check=1,k.mode=12;case 12:if(D===5||D===6)break e;case 13:if(k.last){K>>>=7&q,q-=7&q,k.mode=27;break}for(;q<3;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}switch(k.last=1&K,q-=1,3&(K>>>=1)){case 0:k.mode=14;break;case 1:if(M(k),k.mode=20,D!==6)break;K>>>=2,q-=2;break e;case 2:k.mode=17;break;case 3:T.msg="invalid block type",k.mode=30}K>>>=2,q-=2;break;case 14:for(K>>>=7&q,q-=7&q;q<32;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}if((65535&K)!=(K>>>16^65535)){T.msg="invalid stored block lengths",k.mode=30;break}if(k.length=65535&K,q=K=0,k.mode=15,D===6)break e;case 15:k.mode=16;case 16:if(le=k.length){if(G<le&&(le=G),A<le&&(le=A),le===0)break e;s.arraySet(W,L,U,le,$),G-=le,U+=le,A-=le,$+=le,k.length-=le;break}k.mode=12;break;case 17:for(;q<14;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}if(k.nlen=257+(31&K),K>>>=5,q-=5,k.ndist=1+(31&K),K>>>=5,q-=5,k.ncode=4+(15&K),K>>>=4,q-=4,286<k.nlen||30<k.ndist){T.msg="too many length or distance symbols",k.mode=30;break}k.have=0,k.mode=18;case 18:for(;k.have<k.ncode;){for(;q<3;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}k.lens[V[k.have++]]=7&K,K>>>=3,q-=3}for(;k.have<19;)k.lens[V[k.have++]]=0;if(k.lencode=k.lendyn,k.lenbits=7,Q={bits:k.lenbits},ee=u(0,k.lens,0,19,k.lencode,0,k.work,Q),k.lenbits=Q.bits,ee){T.msg="invalid code lengths set",k.mode=30;break}k.have=0,k.mode=19;case 19:for(;k.have<k.nlen+k.ndist;){for(;de=(R=k.lencode[K&(1<<k.lenbits)-1])>>>16&255,he=65535&R,!((ue=R>>>24)<=q);){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}if(he<16)K>>>=ue,q-=ue,k.lens[k.have++]=he;else{if(he===16){for(O=ue+2;q<O;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}if(K>>>=ue,q-=ue,k.have===0){T.msg="invalid bit length repeat",k.mode=30;break}_=k.lens[k.have-1],le=3+(3&K),K>>>=2,q-=2}else if(he===17){for(O=ue+3;q<O;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}q-=ue,_=0,le=3+(7&(K>>>=ue)),K>>>=3,q-=3}else{for(O=ue+7;q<O;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}q-=ue,_=0,le=11+(127&(K>>>=ue)),K>>>=7,q-=7}if(k.have+le>k.nlen+k.ndist){T.msg="invalid bit length repeat",k.mode=30;break}for(;le--;)k.lens[k.have++]=_}}if(k.mode===30)break;if(k.lens[256]===0){T.msg="invalid code -- missing end-of-block",k.mode=30;break}if(k.lenbits=9,Q={bits:k.lenbits},ee=u(d,k.lens,0,k.nlen,k.lencode,0,k.work,Q),k.lenbits=Q.bits,ee){T.msg="invalid literal/lengths set",k.mode=30;break}if(k.distbits=6,k.distcode=k.distdyn,Q={bits:k.distbits},ee=u(f,k.lens,k.nlen,k.ndist,k.distcode,0,k.work,Q),k.distbits=Q.bits,ee){T.msg="invalid distances set",k.mode=30;break}if(k.mode=20,D===6)break e;case 20:k.mode=21;case 21:if(6<=G&&258<=A){T.next_out=$,T.avail_out=A,T.next_in=U,T.avail_in=G,k.hold=K,k.bits=q,c(T,ie),$=T.next_out,W=T.output,A=T.avail_out,U=T.next_in,L=T.input,G=T.avail_in,K=k.hold,q=k.bits,k.mode===12&&(k.back=-1);break}for(k.back=0;de=(R=k.lencode[K&(1<<k.lenbits)-1])>>>16&255,he=65535&R,!((ue=R>>>24)<=q);){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}if(de&&(240&de)==0){for(me=ue,fe=de,Se=he;de=(R=k.lencode[Se+((K&(1<<me+fe)-1)>>me)])>>>16&255,he=65535&R,!(me+(ue=R>>>24)<=q);){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}K>>>=me,q-=me,k.back+=me}if(K>>>=ue,q-=ue,k.back+=ue,k.length=he,de===0){k.mode=26;break}if(32&de){k.back=-1,k.mode=12;break}if(64&de){T.msg="invalid literal/length code",k.mode=30;break}k.extra=15&de,k.mode=22;case 22:if(k.extra){for(O=k.extra;q<O;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}k.length+=K&(1<<k.extra)-1,K>>>=k.extra,q-=k.extra,k.back+=k.extra}k.was=k.length,k.mode=23;case 23:for(;de=(R=k.distcode[K&(1<<k.distbits)-1])>>>16&255,he=65535&R,!((ue=R>>>24)<=q);){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}if((240&de)==0){for(me=ue,fe=de,Se=he;de=(R=k.distcode[Se+((K&(1<<me+fe)-1)>>me)])>>>16&255,he=65535&R,!(me+(ue=R>>>24)<=q);){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}K>>>=me,q-=me,k.back+=me}if(K>>>=ue,q-=ue,k.back+=ue,64&de){T.msg="invalid distance code",k.mode=30;break}k.offset=he,k.extra=15&de,k.mode=24;case 24:if(k.extra){for(O=k.extra;q<O;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}k.offset+=K&(1<<k.extra)-1,K>>>=k.extra,q-=k.extra,k.back+=k.extra}if(k.offset>k.dmax){T.msg="invalid distance too far back",k.mode=30;break}k.mode=25;case 25:if(A===0)break e;if(le=ie-A,k.offset>le){if((le=k.offset-le)>k.whave&&k.sane){T.msg="invalid distance too far back",k.mode=30;break}ge=le>k.wnext?(le-=k.wnext,k.wsize-le):k.wnext-le,le>k.length&&(le=k.length),ne=k.window}else ne=W,ge=$-k.offset,le=k.length;for(A<le&&(le=A),A-=le,k.length-=le;W[$++]=ne[ge++],--le;);k.length===0&&(k.mode=21);break;case 26:if(A===0)break e;W[$++]=k.length,A--,k.mode=21;break;case 27:if(k.wrap){for(;q<32;){if(G===0)break e;G--,K|=L[U++]<<q,q+=8}if(ie-=A,T.total_out+=ie,k.total+=ie,ie&&(T.adler=k.check=k.flags?l(k.check,W,ie,$-ie):a(k.check,W,ie,$-ie)),ie=A,(k.flags?K:b(K))!==k.check){T.msg="incorrect data check",k.mode=30;break}q=K=0}k.mode=28;case 28:if(k.wrap&&k.flags){for(;q<32;){if(G===0)break e;G--,K+=L[U++]<<q,q+=8}if(K!==(4294967295&k.total)){T.msg="incorrect length check",k.mode=30;break}q=K=0}k.mode=29;case 29:ee=1;break e;case 30:ee=-3;break e;case 31:return-4;default:return p}return T.next_out=$,T.avail_out=A,T.next_in=U,T.avail_in=G,k.hold=K,k.bits=q,(k.wsize||ie!==T.avail_out&&k.mode<30&&(k.mode<27||D!==4))&&B(T,T.output,T.next_out,ie-T.avail_out)?(k.mode=31,-4):(P-=T.avail_in,ie-=T.avail_out,T.total_in+=P,T.total_out+=ie,k.total+=ie,k.wrap&&ie&&(T.adler=k.check=k.flags?l(k.check,W,ie,T.next_out-ie):a(k.check,W,ie,T.next_out-ie)),T.data_type=k.bits+(k.last?64:0)+(k.mode===12?128:0)+(k.mode===20||k.mode===15?256:0),(P==0&&ie===0||D===4)&&ee===h&&(ee=-5),ee)},o.inflateEnd=function(T){if(!T||!T.state)return p;var D=T.state;return D.window&&(D.window=null),T.state=null,h},o.inflateGetHeader=function(T,D){var k;return T&&T.state?(2&(k=T.state).wrap)==0?p:((k.head=D).done=!1,h):p},o.inflateSetDictionary=function(T,D){var k,L=D.length;return T&&T.state?(k=T.state).wrap!==0&&k.mode!==11?p:k.mode===11&&a(1,D,L,0)!==k.check?-3:B(T,D,L,L)?(k.mode=31,-4):(k.havedict=1,h):p},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){var s=n("../utils/common"),a=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],l=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(d,f,h,p,y,m,x,b){var v,w,C,S,j,E,N,z,M,B=b.bits,T=0,D=0,k=0,L=0,W=0,U=0,$=0,G=0,A=0,K=0,q=null,P=0,ie=new s.Buf16(16),le=new s.Buf16(16),ge=null,ne=0;for(T=0;T<=15;T++)ie[T]=0;for(D=0;D<p;D++)ie[f[h+D]]++;for(W=B,L=15;1<=L&&ie[L]===0;L--);if(L<W&&(W=L),L===0)return y[m++]=20971520,y[m++]=20971520,b.bits=1,0;for(k=1;k<L&&ie[k]===0;k++);for(W<k&&(W=k),T=G=1;T<=15;T++)if(G<<=1,(G-=ie[T])<0)return-1;if(0<G&&(d===0||L!==1))return-1;for(le[1]=0,T=1;T<15;T++)le[T+1]=le[T]+ie[T];for(D=0;D<p;D++)f[h+D]!==0&&(x[le[f[h+D]]++]=D);if(E=d===0?(q=ge=x,19):d===1?(q=a,P-=257,ge=l,ne-=257,256):(q=c,ge=u,-1),T=k,j=m,$=D=K=0,C=-1,S=(A=1<<(U=W))-1,d===1&&852<A||d===2&&592<A)return 1;for(;;){for(N=T-$,M=x[D]<E?(z=0,x[D]):x[D]>E?(z=ge[ne+x[D]],q[P+x[D]]):(z=96,0),v=1<<T-$,k=w=1<<U;y[j+(K>>$)+(w-=v)]=N<<24|z<<16|M|0,w!==0;);for(v=1<<T-1;K&v;)v>>=1;if(v!==0?(K&=v-1,K+=v):K=0,D++,--ie[T]==0){if(T===L)break;T=f[h+x[D]]}if(W<T&&(K&S)!==C){for($===0&&($=W),j+=k,G=1<<(U=T-$);U+$<L&&!((G-=ie[U+$])<=0);)U++,G<<=1;if(A+=1<<U,d===1&&852<A||d===2&&592<A)return 1;y[C=K&S]=W<<24|U<<16|j-m|0}}return K!==0&&(y[j+K]=T-$<<24|64<<16|0),b.bits=W,0}},{"../utils/common":41}],51:[function(n,r,o){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){var s=n("../utils/common"),a=0,l=1;function c(R){for(var Z=R.length;0<=--Z;)R[Z]=0}var u=0,d=29,f=256,h=f+1+d,p=30,y=19,m=2*h+1,x=15,b=16,v=7,w=256,C=16,S=17,j=18,E=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],N=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],z=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],M=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],B=new Array(2*(h+2));c(B);var T=new Array(2*p);c(T);var D=new Array(512);c(D);var k=new Array(256);c(k);var L=new Array(d);c(L);var W,U,$,G=new Array(p);function A(R,Z,V,J,H){this.static_tree=R,this.extra_bits=Z,this.extra_base=V,this.elems=J,this.max_length=H,this.has_stree=R&&R.length}function K(R,Z){this.dyn_tree=R,this.max_code=0,this.stat_desc=Z}function q(R){return R<256?D[R]:D[256+(R>>>7)]}function P(R,Z){R.pending_buf[R.pending++]=255&Z,R.pending_buf[R.pending++]=Z>>>8&255}function ie(R,Z,V){R.bi_valid>b-V?(R.bi_buf|=Z<<R.bi_valid&65535,P(R,R.bi_buf),R.bi_buf=Z>>b-R.bi_valid,R.bi_valid+=V-b):(R.bi_buf|=Z<<R.bi_valid&65535,R.bi_valid+=V)}function le(R,Z,V){ie(R,V[2*Z],V[2*Z+1])}function ge(R,Z){for(var V=0;V|=1&R,R>>>=1,V<<=1,0<--Z;);return V>>>1}function ne(R,Z,V){var J,H,ae=new Array(x+1),Y=0;for(J=1;J<=x;J++)ae[J]=Y=Y+V[J-1]<<1;for(H=0;H<=Z;H++){var te=R[2*H+1];te!==0&&(R[2*H]=ge(ae[te]++,te))}}function ue(R){var Z;for(Z=0;Z<h;Z++)R.dyn_ltree[2*Z]=0;for(Z=0;Z<p;Z++)R.dyn_dtree[2*Z]=0;for(Z=0;Z<y;Z++)R.bl_tree[2*Z]=0;R.dyn_ltree[2*w]=1,R.opt_len=R.static_len=0,R.last_lit=R.matches=0}function de(R){8<R.bi_valid?P(R,R.bi_buf):0<R.bi_valid&&(R.pending_buf[R.pending++]=R.bi_buf),R.bi_buf=0,R.bi_valid=0}function he(R,Z,V,J){var H=2*Z,ae=2*V;return R[H]<R[ae]||R[H]===R[ae]&&J[Z]<=J[V]}function me(R,Z,V){for(var J=R.heap[V],H=V<<1;H<=R.heap_len&&(H<R.heap_len&&he(Z,R.heap[H+1],R.heap[H],R.depth)&&H++,!he(Z,J,R.heap[H],R.depth));)R.heap[V]=R.heap[H],V=H,H<<=1;R.heap[V]=J}function fe(R,Z,V){var J,H,ae,Y,te=0;if(R.last_lit!==0)for(;J=R.pending_buf[R.d_buf+2*te]<<8|R.pending_buf[R.d_buf+2*te+1],H=R.pending_buf[R.l_buf+te],te++,J===0?le(R,H,Z):(le(R,(ae=k[H])+f+1,Z),(Y=E[ae])!==0&&ie(R,H-=L[ae],Y),le(R,ae=q(--J),V),(Y=N[ae])!==0&&ie(R,J-=G[ae],Y)),te<R.last_lit;);le(R,w,Z)}function Se(R,Z){var V,J,H,ae=Z.dyn_tree,Y=Z.stat_desc.static_tree,te=Z.stat_desc.has_stree,F=Z.stat_desc.elems,X=-1;for(R.heap_len=0,R.heap_max=m,V=0;V<F;V++)ae[2*V]!==0?(R.heap[++R.heap_len]=X=V,R.depth[V]=0):ae[2*V+1]=0;for(;R.heap_len<2;)ae[2*(H=R.heap[++R.heap_len]=X<2?++X:0)]=1,R.depth[H]=0,R.opt_len--,te&&(R.static_len-=Y[2*H+1]);for(Z.max_code=X,V=R.heap_len>>1;1<=V;V--)me(R,ae,V);for(H=F;V=R.heap[1],R.heap[1]=R.heap[R.heap_len--],me(R,ae,1),J=R.heap[1],R.heap[--R.heap_max]=V,R.heap[--R.heap_max]=J,ae[2*H]=ae[2*V]+ae[2*J],R.depth[H]=(R.depth[V]>=R.depth[J]?R.depth[V]:R.depth[J])+1,ae[2*V+1]=ae[2*J+1]=H,R.heap[1]=H++,me(R,ae,1),2<=R.heap_len;);R.heap[--R.heap_max]=R.heap[1],(function(ce,ve){var Ee,We,mt,Oe,Lt,Yt,Je=ve.dyn_tree,Xt=ve.max_code,At=ve.stat_desc.static_tree,_x=ve.stat_desc.has_stree,Sx=ve.stat_desc.extra_bits,Ql=ve.stat_desc.extra_base,Sr=ve.stat_desc.max_length,ao=0;for(Oe=0;Oe<=x;Oe++)ce.bl_count[Oe]=0;for(Je[2*ce.heap[ce.heap_max]+1]=0,Ee=ce.heap_max+1;Ee<m;Ee++)Sr<(Oe=Je[2*Je[2*(We=ce.heap[Ee])+1]+1]+1)&&(Oe=Sr,ao++),Je[2*We+1]=Oe,Xt<We||(ce.bl_count[Oe]++,Lt=0,Ql<=We&&(Lt=Sx[We-Ql]),Yt=Je[2*We],ce.opt_len+=Yt*(Oe+Lt),_x&&(ce.static_len+=Yt*(At[2*We+1]+Lt)));if(ao!==0){do{for(Oe=Sr-1;ce.bl_count[Oe]===0;)Oe--;ce.bl_count[Oe]--,ce.bl_count[Oe+1]+=2,ce.bl_count[Sr]--,ao-=2}while(0<ao);for(Oe=Sr;Oe!==0;Oe--)for(We=ce.bl_count[Oe];We!==0;)Xt<(mt=ce.heap[--Ee])||(Je[2*mt+1]!==Oe&&(ce.opt_len+=(Oe-Je[2*mt+1])*Je[2*mt],Je[2*mt+1]=Oe),We--)}})(R,Z),ne(ae,X,R.bl_count)}function _(R,Z,V){var J,H,ae=-1,Y=Z[1],te=0,F=7,X=4;for(Y===0&&(F=138,X=3),Z[2*(V+1)+1]=65535,J=0;J<=V;J++)H=Y,Y=Z[2*(J+1)+1],++te<F&&H===Y||(te<X?R.bl_tree[2*H]+=te:H!==0?(H!==ae&&R.bl_tree[2*H]++,R.bl_tree[2*C]++):te<=10?R.bl_tree[2*S]++:R.bl_tree[2*j]++,ae=H,X=(te=0)===Y?(F=138,3):H===Y?(F=6,3):(F=7,4))}function ee(R,Z,V){var J,H,ae=-1,Y=Z[1],te=0,F=7,X=4;for(Y===0&&(F=138,X=3),J=0;J<=V;J++)if(H=Y,Y=Z[2*(J+1)+1],!(++te<F&&H===Y)){if(te<X)for(;le(R,H,R.bl_tree),--te!=0;);else H!==0?(H!==ae&&(le(R,H,R.bl_tree),te--),le(R,C,R.bl_tree),ie(R,te-3,2)):te<=10?(le(R,S,R.bl_tree),ie(R,te-3,3)):(le(R,j,R.bl_tree),ie(R,te-11,7));ae=H,X=(te=0)===Y?(F=138,3):H===Y?(F=6,3):(F=7,4)}}c(G);var Q=!1;function O(R,Z,V,J){ie(R,(u<<1)+(J?1:0),3),(function(H,ae,Y,te){de(H),P(H,Y),P(H,~Y),s.arraySet(H.pending_buf,H.window,ae,Y,H.pending),H.pending+=Y})(R,Z,V)}o._tr_init=function(R){Q||((function(){var Z,V,J,H,ae,Y=new Array(x+1);for(H=J=0;H<d-1;H++)for(L[H]=J,Z=0;Z<1<<E[H];Z++)k[J++]=H;for(k[J-1]=H,H=ae=0;H<16;H++)for(G[H]=ae,Z=0;Z<1<<N[H];Z++)D[ae++]=H;for(ae>>=7;H<p;H++)for(G[H]=ae<<7,Z=0;Z<1<<N[H]-7;Z++)D[256+ae++]=H;for(V=0;V<=x;V++)Y[V]=0;for(Z=0;Z<=143;)B[2*Z+1]=8,Z++,Y[8]++;for(;Z<=255;)B[2*Z+1]=9,Z++,Y[9]++;for(;Z<=279;)B[2*Z+1]=7,Z++,Y[7]++;for(;Z<=287;)B[2*Z+1]=8,Z++,Y[8]++;for(ne(B,h+1,Y),Z=0;Z<p;Z++)T[2*Z+1]=5,T[2*Z]=ge(Z,5);W=new A(B,E,f+1,h,x),U=new A(T,N,0,p,x),$=new A(new Array(0),z,0,y,v)})(),Q=!0),R.l_desc=new K(R.dyn_ltree,W),R.d_desc=new K(R.dyn_dtree,U),R.bl_desc=new K(R.bl_tree,$),R.bi_buf=0,R.bi_valid=0,ue(R)},o._tr_stored_block=O,o._tr_flush_block=function(R,Z,V,J){var H,ae,Y=0;0<R.level?(R.strm.data_type===2&&(R.strm.data_type=(function(te){var F,X=4093624447;for(F=0;F<=31;F++,X>>>=1)if(1&X&&te.dyn_ltree[2*F]!==0)return a;if(te.dyn_ltree[18]!==0||te.dyn_ltree[20]!==0||te.dyn_ltree[26]!==0)return l;for(F=32;F<f;F++)if(te.dyn_ltree[2*F]!==0)return l;return a})(R)),Se(R,R.l_desc),Se(R,R.d_desc),Y=(function(te){var F;for(_(te,te.dyn_ltree,te.l_desc.max_code),_(te,te.dyn_dtree,te.d_desc.max_code),Se(te,te.bl_desc),F=y-1;3<=F&&te.bl_tree[2*M[F]+1]===0;F--);return te.opt_len+=3*(F+1)+5+5+4,F})(R),H=R.opt_len+3+7>>>3,(ae=R.static_len+3+7>>>3)<=H&&(H=ae)):H=ae=V+5,V+4<=H&&Z!==-1?O(R,Z,V,J):R.strategy===4||ae===H?(ie(R,2+(J?1:0),3),fe(R,B,T)):(ie(R,4+(J?1:0),3),(function(te,F,X,ce){var ve;for(ie(te,F-257,5),ie(te,X-1,5),ie(te,ce-4,4),ve=0;ve<ce;ve++)ie(te,te.bl_tree[2*M[ve]+1],3);ee(te,te.dyn_ltree,F-1),ee(te,te.dyn_dtree,X-1)})(R,R.l_desc.max_code+1,R.d_desc.max_code+1,Y+1),fe(R,R.dyn_ltree,R.dyn_dtree)),ue(R),J&&de(R)},o._tr_tally=function(R,Z,V){return R.pending_buf[R.d_buf+2*R.last_lit]=Z>>>8&255,R.pending_buf[R.d_buf+2*R.last_lit+1]=255&Z,R.pending_buf[R.l_buf+R.last_lit]=255&V,R.last_lit++,Z===0?R.dyn_ltree[2*V]++:(R.matches++,Z--,R.dyn_ltree[2*(k[V]+f+1)]++,R.dyn_dtree[2*q(Z)]++),R.last_lit===R.lit_bufsize-1},o._tr_align=function(R){ie(R,2,3),le(R,w,B),(function(Z){Z.bi_valid===16?(P(Z,Z.bi_buf),Z.bi_buf=0,Z.bi_valid=0):8<=Z.bi_valid&&(Z.pending_buf[Z.pending++]=255&Z.bi_buf,Z.bi_buf>>=8,Z.bi_valid-=8)})(R)}},{"../utils/common":41}],53:[function(n,r,o){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(s){(function(a,l){if(!a.setImmediate){var c,u,d,f,h=1,p={},y=!1,m=a.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(a);x=x&&x.setTimeout?x:a,c={}.toString.call(a.process)==="[object process]"?function(C){process.nextTick(function(){v(C)})}:(function(){if(a.postMessage&&!a.importScripts){var C=!0,S=a.onmessage;return a.onmessage=function(){C=!1},a.postMessage("","*"),a.onmessage=S,C}})()?(f="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",w,!1):a.attachEvent("onmessage",w),function(C){a.postMessage(f+C,"*")}):a.MessageChannel?((d=new MessageChannel).port1.onmessage=function(C){v(C.data)},function(C){d.port2.postMessage(C)}):m&&"onreadystatechange"in m.createElement("script")?(u=m.documentElement,function(C){var S=m.createElement("script");S.onreadystatechange=function(){v(C),S.onreadystatechange=null,u.removeChild(S),S=null},u.appendChild(S)}):function(C){setTimeout(v,0,C)},x.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var S=new Array(arguments.length-1),j=0;j<S.length;j++)S[j]=arguments[j+1];var E={callback:C,args:S};return p[h]=E,c(h),h++},x.clearImmediate=b}function b(C){delete p[C]}function v(C){if(y)setTimeout(v,0,C);else{var S=p[C];if(S){y=!0;try{(function(j){var E=j.callback,N=j.args;switch(N.length){case 0:E();break;case 1:E(N[0]);break;case 2:E(N[0],N[1]);break;case 3:E(N[0],N[1],N[2]);break;default:E.apply(l,N)}})(S)}finally{b(C),y=!1}}}}function w(C){C.source===a&&typeof C.data=="string"&&C.data.indexOf(f)===0&&v(+C.data.slice(f.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof lo<"u"?lo:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(ei)),ei.exports}var vk=yk();const wk=Ia(vk),ip="[REDACTED]",kk=/(^|[-_])(api[-_]?key|authorization|cookie|token|secret|password|access[-_]?token|refresh[-_]?token)([-_]|$)/i,_k=[/Bearer\s+[A-Za-z0-9._~+/=-]{12,}/gi,/\bsk-[A-Za-z0-9_-]{12,}\b/g,/\bsk-ant-[A-Za-z0-9_-]{12,}\b/g,/\bghp_[A-Za-z0-9_]{12,}\b/g,/\bglpat-[A-Za-z0-9_-]{12,}\b/g],Nc=200,Sk=25e6,Ec=50;function Ck(e){return e<1024?`${e} chars`:e<1024*1024?`${Math.ceil(e/1024)} KB`:`${Math.ceil(e/(1024*1024))} MB`}function jk(e){let t=0;for(const n of e)t+=n.rawRequestBody?.length??0,t+=n.responseText?.length??0;return t}function Nk(e){if(e.length>Nc)return`Export is limited to ${Nc} logs at once. Narrow the filter and try again.`;const t=jk(e);return t>Sk?`Export is too large (${Ck(t)} of text). Narrow the filter and try again.`:null}async function Ek(e){try{const t=await fetch(`/api/logs/${e}/chunks`);if(!t.ok)return null;const n=await t.json();return JSON.stringify(n,null,2)}catch{return null}}function Tk(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qi(e){if(Array.isArray(e))return e.map(n=>qi(n));if(!Tk(e))return e;const t={};for(const[n,r]of Object.entries(e))t[n]=kk.test(n)?ip:qi(r);return t}function Ak(e){const t=n=>{let r=n;for(const o of _k)r=r.replace(o,ip);return r};try{const n=JSON.parse(e);return t(JSON.stringify(qi(n),null,2))}catch{return t(e)}}function ti(e,t){return t==="redacted"?Ak(e):e}async function Ik(e,t="redacted"){const n=Nk(e);if(n!==null)return{ok:!1,message:n};const r=new wk,o=t==="redacted"?"redacted":"raw",s=e.filter(u=>u.streaming).slice(0,Ec);r.file("manifest.json",JSON.stringify({exportedAt:new Date().toISOString(),mode:t,redacted:t==="redacted",logCount:e.length,logIds:e.map(u=>u.id),streamingChunkExportLimit:Ec,streamingChunkLogIds:s.map(u=>u.id)},null,2));for(const u of e)u.rawRequestBody!==null&&r.file(`#${u.id}.Request.json`,ti(u.rawRequestBody,t)),u.responseText!==null&&r.file(`#${u.id}.Response.json`,ti(u.responseText,t));for(const u of s){const d=await Ek(u.id);d!==null&&r.file(`#${u.id}.SSE.Response.json`,ti(d,t))}const a=await r.generateAsync({type:"blob"}),l=URL.createObjectURL(a),c=document.createElement("a");return c.href=l,c.download=`agent-inspector-export-${o}-${new Date().toISOString().slice(0,10)}.zip`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(l),{ok:!0}}function zk(e,t){if(e!==null){e.removeAllRanges();for(const n of t)e.addRange(n)}}function Pk(e){if(e===null)return[];const t=[];for(let n=0;n<e.rangeCount;n++)t.push(e.getRangeAt(n));return t}function Rk(e){if(typeof document>"u")return!1;const t=document.activeElement,n=document.getSelection(),r=Pk(n),o=document.createElement("textarea");o.value=e,o.setAttribute("readonly",""),o.style.position="fixed",o.style.top="0",o.style.left="-9999px",o.style.opacity="0",document.body.appendChild(o),o.focus(),o.select(),o.setSelectionRange(0,e.length);let s=!1;try{s=document.execCommand("copy")}catch{}finally{document.body.removeChild(o),zk(n,r),typeof HTMLElement<"u"&&t instanceof HTMLElement&&t.focus({preventScroll:!0})}return s}async function Ot(e){const t=globalThis.navigator?.clipboard;if(t!==void 0)try{return await t.writeText(e),!0}catch{}return Rk(e)}function Ki(e,t){switch(t){case"full":return e;case"time":return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}}function rl(e,t,n){return`${Ki(e,n)} - ${Ki(t,n)}`}function ap(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=ap(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function lp(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=ap(e))&&(r&&(r+=" "),r+=t);return r}const Ok=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Mk=(e,t)=>({classGroupId:e,validator:t}),cp=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),qo="-",Tc=[],Lk="arbitrary..",Dk=e=>{const t=$k(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return Fk(a);const l=a.split(qo),c=l[0]===""&&l.length>1?1:0;return up(l,c,t)},getConflictingClassGroupIds:(a,l)=>{if(l){const c=r[a],u=n[a];return c?u?Ok(u,c):c:u||Tc}return n[a]||Tc}}},up=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);if(s){const u=up(e,t+1,s);if(u)return u}const a=n.validators;if(a===null)return;const l=t===0?e.join(qo):e.slice(t).join(qo),c=a.length;for(let u=0;u<c;u++){const d=a[u];if(d.validator(l))return d.classGroupId}},Fk=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?Lk+r:void 0})(),$k=e=>{const{theme:t,classGroups:n}=e;return Bk(n,t)},Bk=(e,t)=>{const n=cp();for(const r in e){const o=e[r];ol(o,n,r,t)}return n},ol=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const a=e[s];Uk(a,t,n,r)}},Uk=(e,t,n,r)=>{if(typeof e=="string"){Hk(e,t,n);return}if(typeof e=="function"){Wk(e,t,n,r);return}Vk(e,t,n,r)},Hk=(e,t,n)=>{const r=e===""?t:dp(t,e);r.classGroupId=n},Wk=(e,t,n,r)=>{if(Zk(e)){ol(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Mk(n,e))},Vk=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let a=0;a<s;a++){const[l,c]=o[a];ol(c,dp(t,l),n,r)}},dp=(e,t)=>{let n=e;const r=t.split(qo),o=r.length;for(let s=0;s<o;s++){const a=r[s];let l=n.nextPart.get(a);l||(l=cp(),n.nextPart.set(a,l)),n=l}return n},Zk=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,qk=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(s,a)=>{n[s]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let a=n[s];if(a!==void 0)return a;if((a=r[s])!==void 0)return o(s,a),a},set(s,a){s in n?n[s]=a:o(s,a)}}},Gi="!",Ac=":",Kk=[],Ic=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),Gk=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let a=0,l=0,c=0,u;const d=o.length;for(let m=0;m<d;m++){const x=o[m];if(a===0&&l===0){if(x===Ac){s.push(o.slice(c,m)),c=m+1;continue}if(x==="/"){u=m;continue}}x==="["?a++:x==="]"?a--:x==="("?l++:x===")"&&l--}const f=s.length===0?o:o.slice(c);let h=f,p=!1;f.endsWith(Gi)?(h=f.slice(0,-1),p=!0):f.startsWith(Gi)&&(h=f.slice(1),p=!0);const y=u&&u>c?u-c:void 0;return Ic(s,p,h,y)};if(t){const o=t+Ac,s=r;r=a=>a.startsWith(o)?s(a.slice(o.length)):Ic(Kk,!1,a,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},Jk=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let s=0;s<n.length;s++){const a=n[s],l=a[0]==="[",c=t.has(a);l||c?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(a)):o.push(a)}return o.length>0&&(o.sort(),r.push(...o)),r}},Yk=e=>({cache:qk(e.cacheSize),parseClassName:Gk(e),sortModifiers:Jk(e),...Dk(e)}),Xk=/\s+/,Qk=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,a=[],l=e.trim().split(Xk);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:f,modifiers:h,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:m}=n(d);if(f){c=d+(c.length>0?" "+c:c);continue}let x=!!m,b=r(x?y.substring(0,m):y);if(!b){if(!x){c=d+(c.length>0?" "+c:c);continue}if(b=r(y),!b){c=d+(c.length>0?" "+c:c);continue}x=!1}const v=h.length===0?"":h.length===1?h[0]:s(h).join(":"),w=p?v+Gi:v,C=w+b;if(a.indexOf(C)>-1)continue;a.push(C);const S=o(b,x);for(let j=0;j<S.length;++j){const E=S[j];a.push(w+E)}c=d+(c.length>0?" "+c:c)}return c},e_=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=fp(n))&&(o&&(o+=" "),o+=r);return o},fp=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=fp(e[r]))&&(n&&(n+=" "),n+=t);return n},t_=(e,...t)=>{let n,r,o,s;const a=c=>{const u=t.reduce((d,f)=>f(d),e());return n=Yk(u),r=n.cache.get,o=n.cache.set,s=l,l(c)},l=c=>{const u=r(c);if(u)return u;const d=Qk(c,n);return o(c,d),d};return s=a,(...c)=>s(e_(...c))},n_=[],tt=e=>{const t=n=>n[e]||n_;return t.isThemeGetter=!0,t},pp=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,hp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,r_=/^\d+\/\d+$/,o_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,s_=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,i_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,a_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,l_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Un=e=>r_.test(e),ze=e=>!!e&&!Number.isNaN(Number(e)),cn=e=>!!e&&Number.isInteger(Number(e)),ni=e=>e.endsWith("%")&&ze(e.slice(0,-1)),Qt=e=>o_.test(e),c_=()=>!0,u_=e=>s_.test(e)&&!i_.test(e),mp=()=>!1,d_=e=>a_.test(e),f_=e=>l_.test(e),p_=e=>!we(e)&&!ke(e),h_=e=>gr(e,bp,mp),we=e=>pp.test(e),jn=e=>gr(e,yp,u_),ri=e=>gr(e,y_,ze),zc=e=>gr(e,gp,mp),m_=e=>gr(e,xp,f_),mo=e=>gr(e,vp,d_),ke=e=>hp.test(e),Cr=e=>xr(e,yp),g_=e=>xr(e,v_),Pc=e=>xr(e,gp),x_=e=>xr(e,bp),b_=e=>xr(e,xp),go=e=>xr(e,vp,!0),gr=(e,t,n)=>{const r=pp.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},xr=(e,t,n=!1)=>{const r=hp.exec(e);return r?r[1]?t(r[1]):n:!1},gp=e=>e==="position"||e==="percentage",xp=e=>e==="image"||e==="url",bp=e=>e==="length"||e==="size"||e==="bg-size",yp=e=>e==="length",y_=e=>e==="number",v_=e=>e==="family-name",vp=e=>e==="shadow",w_=()=>{const e=tt("color"),t=tt("font"),n=tt("text"),r=tt("font-weight"),o=tt("tracking"),s=tt("leading"),a=tt("breakpoint"),l=tt("container"),c=tt("spacing"),u=tt("radius"),d=tt("shadow"),f=tt("inset-shadow"),h=tt("text-shadow"),p=tt("drop-shadow"),y=tt("blur"),m=tt("perspective"),x=tt("aspect"),b=tt("ease"),v=tt("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...C(),ke,we],j=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],N=()=>[ke,we,c],z=()=>[Un,"full","auto",...N()],M=()=>[cn,"none","subgrid",ke,we],B=()=>["auto",{span:["full",cn,ke,we]},cn,ke,we],T=()=>[cn,"auto",ke,we],D=()=>["auto","min","max","fr",ke,we],k=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],L=()=>["start","end","center","stretch","center-safe","end-safe"],W=()=>["auto",...N()],U=()=>[Un,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...N()],$=()=>[e,ke,we],G=()=>[...C(),Pc,zc,{position:[ke,we]}],A=()=>["no-repeat",{repeat:["","x","y","space","round"]}],K=()=>["auto","cover","contain",x_,h_,{size:[ke,we]}],q=()=>[ni,Cr,jn],P=()=>["","none","full",u,ke,we],ie=()=>["",ze,Cr,jn],le=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ne=()=>[ze,ni,Pc,zc],ue=()=>["","none",y,ke,we],de=()=>["none",ze,ke,we],he=()=>["none",ze,ke,we],me=()=>[ze,ke,we],fe=()=>[Un,"full",...N()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Qt],breakpoint:[Qt],color:[c_],container:[Qt],"drop-shadow":[Qt],ease:["in","out","in-out"],font:[p_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Qt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Qt],shadow:[Qt],spacing:["px",ze],text:[Qt],"text-shadow":[Qt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Un,we,ke,x]}],container:["container"],columns:[{columns:[ze,we,ke,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{start:z()}],end:[{end:z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[cn,"auto",ke,we]}],basis:[{basis:[Un,"full","auto",l,...N()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ze,Un,"auto","initial","none",we]}],grow:[{grow:["",ze,ke,we]}],shrink:[{shrink:["",ze,ke,we]}],order:[{order:[cn,"first","last","none",ke,we]}],"grid-cols":[{"grid-cols":M()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":T()}],"col-end":[{"col-end":T()}],"grid-rows":[{"grid-rows":M()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":T()}],"row-end":[{"row-end":T()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:N()}],"gap-x":[{"gap-x":N()}],"gap-y":[{"gap-y":N()}],"justify-content":[{justify:[...k(),"normal"]}],"justify-items":[{"justify-items":[...L(),"normal"]}],"justify-self":[{"justify-self":["auto",...L()]}],"align-content":[{content:["normal",...k()]}],"align-items":[{items:[...L(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...L(),{baseline:["","last"]}]}],"place-content":[{"place-content":k()}],"place-items":[{"place-items":[...L(),"baseline"]}],"place-self":[{"place-self":["auto",...L()]}],p:[{p:N()}],px:[{px:N()}],py:[{py:N()}],ps:[{ps:N()}],pe:[{pe:N()}],pt:[{pt:N()}],pr:[{pr:N()}],pb:[{pb:N()}],pl:[{pl:N()}],m:[{m:W()}],mx:[{mx:W()}],my:[{my:W()}],ms:[{ms:W()}],me:[{me:W()}],mt:[{mt:W()}],mr:[{mr:W()}],mb:[{mb:W()}],ml:[{ml:W()}],"space-x":[{"space-x":N()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":N()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],w:[{w:[l,"screen",...U()]}],"min-w":[{"min-w":[l,"screen","none",...U()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[a]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",n,Cr,jn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ke,ri]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ni,we]}],"font-family":[{font:[g_,we,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,ke,we]}],"line-clamp":[{"line-clamp":[ze,"none",ke,ri]}],leading:[{leading:[s,...N()]}],"list-image":[{"list-image":["none",ke,we]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ke,we]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:$()}],"text-color":[{text:$()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...le(),"wavy"]}],"text-decoration-thickness":[{decoration:[ze,"from-font","auto",ke,jn]}],"text-decoration-color":[{decoration:$()}],"underline-offset":[{"underline-offset":[ze,"auto",ke,we]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke,we]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ke,we]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:G()}],"bg-repeat":[{bg:A()}],"bg-size":[{bg:K()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},cn,ke,we],radial:["",ke,we],conic:[cn,ke,we]},b_,m_]}],"bg-color":[{bg:$()}],"gradient-from-pos":[{from:q()}],"gradient-via-pos":[{via:q()}],"gradient-to-pos":[{to:q()}],"gradient-from":[{from:$()}],"gradient-via":[{via:$()}],"gradient-to":[{to:$()}],rounded:[{rounded:P()}],"rounded-s":[{"rounded-s":P()}],"rounded-e":[{"rounded-e":P()}],"rounded-t":[{"rounded-t":P()}],"rounded-r":[{"rounded-r":P()}],"rounded-b":[{"rounded-b":P()}],"rounded-l":[{"rounded-l":P()}],"rounded-ss":[{"rounded-ss":P()}],"rounded-se":[{"rounded-se":P()}],"rounded-ee":[{"rounded-ee":P()}],"rounded-es":[{"rounded-es":P()}],"rounded-tl":[{"rounded-tl":P()}],"rounded-tr":[{"rounded-tr":P()}],"rounded-br":[{"rounded-br":P()}],"rounded-bl":[{"rounded-bl":P()}],"border-w":[{border:ie()}],"border-w-x":[{"border-x":ie()}],"border-w-y":[{"border-y":ie()}],"border-w-s":[{"border-s":ie()}],"border-w-e":[{"border-e":ie()}],"border-w-t":[{"border-t":ie()}],"border-w-r":[{"border-r":ie()}],"border-w-b":[{"border-b":ie()}],"border-w-l":[{"border-l":ie()}],"divide-x":[{"divide-x":ie()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ie()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...le(),"hidden","none"]}],"divide-style":[{divide:[...le(),"hidden","none"]}],"border-color":[{border:$()}],"border-color-x":[{"border-x":$()}],"border-color-y":[{"border-y":$()}],"border-color-s":[{"border-s":$()}],"border-color-e":[{"border-e":$()}],"border-color-t":[{"border-t":$()}],"border-color-r":[{"border-r":$()}],"border-color-b":[{"border-b":$()}],"border-color-l":[{"border-l":$()}],"divide-color":[{divide:$()}],"outline-style":[{outline:[...le(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ze,ke,we]}],"outline-w":[{outline:["",ze,Cr,jn]}],"outline-color":[{outline:$()}],shadow:[{shadow:["","none",d,go,mo]}],"shadow-color":[{shadow:$()}],"inset-shadow":[{"inset-shadow":["none",f,go,mo]}],"inset-shadow-color":[{"inset-shadow":$()}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:$()}],"ring-offset-w":[{"ring-offset":[ze,jn]}],"ring-offset-color":[{"ring-offset":$()}],"inset-ring-w":[{"inset-ring":ie()}],"inset-ring-color":[{"inset-ring":$()}],"text-shadow":[{"text-shadow":["none",h,go,mo]}],"text-shadow-color":[{"text-shadow":$()}],opacity:[{opacity:[ze,ke,we]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ze]}],"mask-image-linear-from-pos":[{"mask-linear-from":ne()}],"mask-image-linear-to-pos":[{"mask-linear-to":ne()}],"mask-image-linear-from-color":[{"mask-linear-from":$()}],"mask-image-linear-to-color":[{"mask-linear-to":$()}],"mask-image-t-from-pos":[{"mask-t-from":ne()}],"mask-image-t-to-pos":[{"mask-t-to":ne()}],"mask-image-t-from-color":[{"mask-t-from":$()}],"mask-image-t-to-color":[{"mask-t-to":$()}],"mask-image-r-from-pos":[{"mask-r-from":ne()}],"mask-image-r-to-pos":[{"mask-r-to":ne()}],"mask-image-r-from-color":[{"mask-r-from":$()}],"mask-image-r-to-color":[{"mask-r-to":$()}],"mask-image-b-from-pos":[{"mask-b-from":ne()}],"mask-image-b-to-pos":[{"mask-b-to":ne()}],"mask-image-b-from-color":[{"mask-b-from":$()}],"mask-image-b-to-color":[{"mask-b-to":$()}],"mask-image-l-from-pos":[{"mask-l-from":ne()}],"mask-image-l-to-pos":[{"mask-l-to":ne()}],"mask-image-l-from-color":[{"mask-l-from":$()}],"mask-image-l-to-color":[{"mask-l-to":$()}],"mask-image-x-from-pos":[{"mask-x-from":ne()}],"mask-image-x-to-pos":[{"mask-x-to":ne()}],"mask-image-x-from-color":[{"mask-x-from":$()}],"mask-image-x-to-color":[{"mask-x-to":$()}],"mask-image-y-from-pos":[{"mask-y-from":ne()}],"mask-image-y-to-pos":[{"mask-y-to":ne()}],"mask-image-y-from-color":[{"mask-y-from":$()}],"mask-image-y-to-color":[{"mask-y-to":$()}],"mask-image-radial":[{"mask-radial":[ke,we]}],"mask-image-radial-from-pos":[{"mask-radial-from":ne()}],"mask-image-radial-to-pos":[{"mask-radial-to":ne()}],"mask-image-radial-from-color":[{"mask-radial-from":$()}],"mask-image-radial-to-color":[{"mask-radial-to":$()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[ze]}],"mask-image-conic-from-pos":[{"mask-conic-from":ne()}],"mask-image-conic-to-pos":[{"mask-conic-to":ne()}],"mask-image-conic-from-color":[{"mask-conic-from":$()}],"mask-image-conic-to-color":[{"mask-conic-to":$()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:G()}],"mask-repeat":[{mask:A()}],"mask-size":[{mask:K()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ke,we]}],filter:[{filter:["","none",ke,we]}],blur:[{blur:ue()}],brightness:[{brightness:[ze,ke,we]}],contrast:[{contrast:[ze,ke,we]}],"drop-shadow":[{"drop-shadow":["","none",p,go,mo]}],"drop-shadow-color":[{"drop-shadow":$()}],grayscale:[{grayscale:["",ze,ke,we]}],"hue-rotate":[{"hue-rotate":[ze,ke,we]}],invert:[{invert:["",ze,ke,we]}],saturate:[{saturate:[ze,ke,we]}],sepia:[{sepia:["",ze,ke,we]}],"backdrop-filter":[{"backdrop-filter":["","none",ke,we]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[ze,ke,we]}],"backdrop-contrast":[{"backdrop-contrast":[ze,ke,we]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ze,ke,we]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ze,ke,we]}],"backdrop-invert":[{"backdrop-invert":["",ze,ke,we]}],"backdrop-opacity":[{"backdrop-opacity":[ze,ke,we]}],"backdrop-saturate":[{"backdrop-saturate":[ze,ke,we]}],"backdrop-sepia":[{"backdrop-sepia":["",ze,ke,we]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":N()}],"border-spacing-x":[{"border-spacing-x":N()}],"border-spacing-y":[{"border-spacing-y":N()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ke,we]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ze,"initial",ke,we]}],ease:[{ease:["linear","initial",b,ke,we]}],delay:[{delay:[ze,ke,we]}],animate:[{animate:["none",v,ke,we]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,ke,we]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":["scale-3d"],skew:[{skew:me()}],"skew-x":[{"skew-x":me()}],"skew-y":[{"skew-y":me()}],transform:[{transform:[ke,we,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:fe()}],"translate-x":[{"translate-x":fe()}],"translate-y":[{"translate-y":fe()}],"translate-z":[{"translate-z":fe()}],"translate-none":["translate-none"],accent:[{accent:$()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:$()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ke,we]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ke,we]}],fill:[{fill:["none",...$()]}],"stroke-w":[{stroke:[ze,Cr,jn,ri]}],stroke:[{stroke:["none",...$()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},k_=t_(w_);function xe(...e){return k_(lp(e))}function Ue(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":(e/1e3).toFixed(1).replace(/\.0$/,"")+"K"}function wp(e){return e>=1024*1024?(e/(1024*1024)).toFixed(1).replace(/\.0$/,"")+"M":(e/1024).toFixed(1).replace(/\.0$/,"")+"K"}function Rc(e,t,n){const r=e*10;return!Number.isSafeInteger(r)||r%t!==0?null:(r/t/10).toFixed(1).replace(/\.0$/,"")+n}function __(e){if(!Number.isSafeInteger(e)||e<=0)return e.toString();if(e>=1024*1024){const n=Rc(e,1048576,"M");if(n!==null)return n}const t=Rc(e,1024,"K");return t!==null?t:e.toString()}function S_(e){if(e===void 0||e==="")return 1;switch(e.toLowerCase()){case"k":return 1024;case"m":return 1024*1024;default:return null}}function Ko(e){const t=e.trim().replaceAll(",","");if(t==="")return null;const n=/^(\d+(?:\.\d+)?)\s*([kKmM])?$/.exec(t);if(n===null)return null;const r=n[1];if(r===void 0)return null;const o=Number(r),s=n[2],a=S_(s);if(!Number.isFinite(o)||o<=0||a===null||(s===void 0||s==="")&&!Number.isInteger(o))return null;const l=Math.round(o*a);return!Number.isSafeInteger(l)||l<=0?null:l}function C_(e){return e===null?"pending":e>=200&&e<300?"success":e>=400&&e<500?"client_error":e>=500?"server_error":"pending"}const j_=re({model:I().min(1),contextWindow:se().int().positive().optional(),outputLimit:se().int().positive().optional(),source:Re(["manual","registry"]).optional(),sourceUrl:I().optional(),updatedAt:I().optional()}),Go=re({id:I(),name:I(),apiKey:I(),model:I().optional(),models:ye(I()).min(1),format:Re(["anthropic","openai"]).optional(),baseUrl:I().optional(),anthropicBaseUrl:I().optional(),openaiBaseUrl:I().optional(),authHeader:Re(["bearer","x-api-key"]).optional().default("bearer"),apiDocsUrl:I().optional(),modelMetadataUrl:I().optional(),modelMetadata:ye(j_).optional(),source:Re(["company","personal"]).optional(),createdAt:I(),updatedAt:I()});async function N_(e){return an(e,Go.array(),void 0,t=>`Failed to fetch ${e}: ${t.status}`)}function kp(){const e=Yr("/api/providers?includeSecrets=1",N_,{revalidateOnFocus:!1,revalidateIfStale:!1});return{providers:e.data??[],isLoading:e.isLoading,isError:e.error,mutate:e.mutate}}const E_="2.1.3",Oc={version:E_},Mc=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Lc=lp,sl=(e,t)=>n=>{var r;if(t?.variants==null)return Lc(e,n?.class,n?.className);const{variants:o,defaultVariants:s}=t,a=Object.keys(o).map(u=>{const d=n?.[u],f=s?.[u];if(d===null)return null;const h=Mc(d)||Mc(f);return o[u][h]}),l=n&&Object.entries(n).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(y=>{let[m,x]=y;return Array.isArray(x)?x.includes({...s,...l}[m]):{...s,...l}[m]===x})?[...u,f,h]:u},[]);return Lc(e,a,c,n?.class,n?.className)};function Dc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function _p(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Dc(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Dc(e[o],null)}}}}function De(...e){return g.useCallback(_p(...e),e)}function dr(e){const t=A_(e),n=g.forwardRef((r,o)=>{const{children:s,...a}=r,l=g.Children.toArray(s),c=l.find(z_);if(c){const u=c.props.children,d=l.map(f=>f===c?g.Children.count(u)>1?g.Children.only(null):g.isValidElement(u)?u.props.children:null:f);return i.jsx(t,{...a,ref:o,children:g.isValidElement(u)?g.cloneElement(u,void 0,d):null})}return i.jsx(t,{...a,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var T_=dr("Slot");function A_(e){const t=g.forwardRef((n,r)=>{const{children:o,...s}=n;if(g.isValidElement(o)){const a=R_(o),l=P_(s,o.props);return o.type!==g.Fragment&&(l.ref=r?_p(r,a):a),g.cloneElement(o,l)}return g.Children.count(o)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Sp=Symbol("radix.slottable");function I_(e){const t=({children:n})=>i.jsx(i.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Sp,t}function z_(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Sp}function P_(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...l)=>{const c=s(...l);return o(...l),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function R_(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var O_=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ae=O_.reduce((e,t)=>{const n=dr(`Primitive.${t}`),r=g.forwardRef((o,s)=>{const{asChild:a,...l}=o,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function M_(e,t){e&&Xr.flushSync(()=>e.dispatchEvent(t))}var Cp=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),L_="VisuallyHidden",jp=g.forwardRef((e,t)=>i.jsx(Ae.span,{...e,ref:t,style:{...Cp,...e.style}}));jp.displayName=L_;var D_=jp;function F_(e,t){const n=g.createContext(t),r=s=>{const{children:a,...l}=s,c=g.useMemo(()=>l,Object.values(l));return i.jsx(n.Provider,{value:c,children:a})};r.displayName=e+"Provider";function o(s){const a=g.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function ln(e,t=[]){let n=[];function r(s,a){const l=g.createContext(a),c=n.length;n=[...n,a];const u=f=>{const{scope:h,children:p,...y}=f,m=h?.[e]?.[c]||l,x=g.useMemo(()=>y,Object.values(y));return i.jsx(m.Provider,{value:x,children:p})};u.displayName=s+"Provider";function d(f,h){const p=h?.[e]?.[c]||l,y=g.useContext(p);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const o=()=>{const s=n.map(a=>g.createContext(a));return function(l){const c=l?.[e]||s;return g.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[r,$_(o,...t)]}function $_(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function Np(e){const t=e+"CollectionProvider",[n,r]=ln(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=m=>{const{scope:x,children:b}=m,v=ut.useRef(null),w=ut.useRef(new Map).current;return i.jsx(o,{scope:x,itemMap:w,collectionRef:v,children:b})};a.displayName=t;const l=e+"CollectionSlot",c=dr(l),u=ut.forwardRef((m,x)=>{const{scope:b,children:v}=m,w=s(l,b),C=De(x,w.collectionRef);return i.jsx(c,{ref:C,children:v})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=dr(d),p=ut.forwardRef((m,x)=>{const{scope:b,children:v,...w}=m,C=ut.useRef(null),S=De(x,C),j=s(d,b);return ut.useEffect(()=>(j.itemMap.set(C,{ref:C,...w}),()=>{j.itemMap.delete(C)})),i.jsx(h,{[f]:"",ref:S,children:v})});p.displayName=d;function y(m){const x=s(e+"CollectionConsumer",m);return ut.useCallback(()=>{const v=x.collectionRef.current;if(!v)return[];const w=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(x.itemMap.values()).sort((j,E)=>w.indexOf(j.ref.current)-w.indexOf(E.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:a,Slot:u,ItemSlot:p},y,r]}function Ce(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}var st=globalThis?.document?g.useLayoutEffect:()=>{},B_=ef[" useInsertionEffect ".trim().toString()]||st;function In({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,a]=U_({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:o;{const d=g.useRef(e!==void 0);g.useEffect(()=>{const f=d.current;f!==l&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,r])}const u=g.useCallback(d=>{if(l){const f=H_(d)?d(e):d;f!==e&&a.current?.(f)}else s(d)},[l,e,s,a]);return[c,u]}function U_({defaultProp:e,onChange:t}){const[n,r]=g.useState(e),o=g.useRef(n),s=g.useRef(t);return B_(()=>{s.current=t},[t]),g.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}function H_(e){return typeof e=="function"}function W_(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var Nt=e=>{const{present:t,children:n}=e,r=V_(t),o=typeof n=="function"?n({present:r.isPresent}):g.Children.only(n),s=De(r.ref,Z_(o));return typeof n=="function"||r.isPresent?g.cloneElement(o,{ref:s}):null};Nt.displayName="Presence";function V_(e){const[t,n]=g.useState(),r=g.useRef(null),o=g.useRef(e),s=g.useRef("none"),a=e?"mounted":"unmounted",[l,c]=W_(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const u=xo(r.current);s.current=l==="mounted"?u:"none"},[l]),st(()=>{const u=r.current,d=o.current;if(d!==e){const h=s.current,p=xo(u);e?c("MOUNT"):p==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),st(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const m=xo(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&m&&(c("ANIMATION_END"),!o.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},h=p=>{p.target===t&&(s.current=xo(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:g.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function xo(e){return e?.animationName||"none"}function Z_(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var q_=ef[" useId ".trim().toString()]||(()=>{}),K_=0;function Ht(e){const[t,n]=g.useState(q_());return st(()=>{n(r=>r??String(K_++))},[e]),e||(t?`radix-${t}`:"")}var _s="Collapsible",[G_]=ln(_s),[J_,il]=G_(_s),Ep=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:a,...l}=e,[c,u]=In({prop:r,defaultProp:o??!1,onChange:a,caller:_s});return i.jsx(J_,{scope:n,disabled:s,contentId:Ht(),open:c,onOpenToggle:g.useCallback(()=>u(d=>!d),[u]),children:i.jsx(Ae.div,{"data-state":ll(c),"data-disabled":s?"":void 0,...l,ref:t})})});Ep.displayName=_s;var Tp="CollapsibleTrigger",Ap=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=il(Tp,n);return i.jsx(Ae.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":ll(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:Ce(e.onClick,o.onOpenToggle)})});Ap.displayName=Tp;var al="CollapsibleContent",Ip=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=il(al,e.__scopeCollapsible);return i.jsx(Nt,{present:n||o.open,children:({present:s})=>i.jsx(Y_,{...r,ref:t,present:s})})});Ip.displayName=al;var Y_=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=e,a=il(al,n),[l,c]=g.useState(r),u=g.useRef(null),d=De(t,u),f=g.useRef(0),h=f.current,p=g.useRef(0),y=p.current,m=a.open||l,x=g.useRef(m),b=g.useRef(void 0);return g.useEffect(()=>{const v=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(v)},[]),st(()=>{const v=u.current;if(v){b.current=b.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const w=v.getBoundingClientRect();f.current=w.height,p.current=w.width,x.current||(v.style.transitionDuration=b.current.transitionDuration,v.style.animationName=b.current.animationName),c(r)}},[a.open,r]),i.jsx(Ae.div,{"data-state":ll(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!m,...s,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...e.style},children:m&&o})});function ll(e){return e?"open":"closed"}var X_=Ep,Q_=g.createContext(void 0);function Ss(e){const t=g.useContext(Q_);return e||t||"ltr"}function lt(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>t.current?.(...n),[])}function eS(e,t=globalThis?.document){const n=lt(e);g.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var tS="DismissableLayer",Ji="dismissableLayer.update",nS="dismissableLayer.pointerDownOutside",rS="dismissableLayer.focusOutside",Fc,zp=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Cs=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:a,onDismiss:l,...c}=e,u=g.useContext(zp),[d,f]=g.useState(null),h=d?.ownerDocument??globalThis?.document,[,p]=g.useState({}),y=De(t,E=>f(E)),m=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(x),v=d?m.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,C=v>=b,S=iS(E=>{const N=E.target,z=[...u.branches].some(M=>M.contains(N));!C||z||(o?.(E),a?.(E),E.defaultPrevented||l?.())},h),j=aS(E=>{const N=E.target;[...u.branches].some(M=>M.contains(N))||(s?.(E),a?.(E),E.defaultPrevented||l?.())},h);return eS(E=>{v===u.layers.size-1&&(r?.(E),!E.defaultPrevented&&l&&(E.preventDefault(),l()))},h),g.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Fc=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),$c(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Fc)}},[d,h,n,u]),g.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),$c())},[d,u]),g.useEffect(()=>{const E=()=>p({});return document.addEventListener(Ji,E),()=>document.removeEventListener(Ji,E)},[]),i.jsx(Ae.div,{...c,ref:y,style:{pointerEvents:w?C?"auto":"none":void 0,...e.style},onFocusCapture:Ce(e.onFocusCapture,j.onFocusCapture),onBlurCapture:Ce(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:Ce(e.onPointerDownCapture,S.onPointerDownCapture)})});Cs.displayName=tS;var oS="DismissableLayerBranch",sS=g.forwardRef((e,t)=>{const n=g.useContext(zp),r=g.useRef(null),o=De(t,r);return g.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),i.jsx(Ae.div,{...e,ref:o})});sS.displayName=oS;function iS(e,t=globalThis?.document){const n=lt(e),r=g.useRef(!1),o=g.useRef(()=>{});return g.useEffect(()=>{const s=l=>{if(l.target&&!r.current){let c=function(){Pp(nS,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function aS(e,t=globalThis?.document){const n=lt(e),r=g.useRef(!1);return g.useEffect(()=>{const o=s=>{s.target&&!r.current&&Pp(rS,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function $c(){const e=new CustomEvent(Ji);document.dispatchEvent(e)}function Pp(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?M_(o,s):o.dispatchEvent(s)}var oi="focusScope.autoFocusOnMount",si="focusScope.autoFocusOnUnmount",Bc={bubbles:!1,cancelable:!0},lS="FocusScope",cl=g.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...a}=e,[l,c]=g.useState(null),u=lt(o),d=lt(s),f=g.useRef(null),h=De(t,m=>c(m)),p=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(r){let m=function(w){if(p.paused||!l)return;const C=w.target;l.contains(C)?f.current=C:pn(f.current,{select:!0})},x=function(w){if(p.paused||!l)return;const C=w.relatedTarget;C!==null&&(l.contains(C)||pn(f.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const S of w)S.removedNodes.length>0&&pn(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",x);const v=new MutationObserver(b);return l&&v.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",x),v.disconnect()}}},[r,l,p.paused]),g.useEffect(()=>{if(l){Hc.add(p);const m=document.activeElement;if(!l.contains(m)){const b=new CustomEvent(oi,Bc);l.addEventListener(oi,u),l.dispatchEvent(b),b.defaultPrevented||(cS(hS(Rp(l)),{select:!0}),document.activeElement===m&&pn(l))}return()=>{l.removeEventListener(oi,u),setTimeout(()=>{const b=new CustomEvent(si,Bc);l.addEventListener(si,d),l.dispatchEvent(b),b.defaultPrevented||pn(m??document.body,{select:!0}),l.removeEventListener(si,d),Hc.remove(p)},0)}}},[l,u,d,p]);const y=g.useCallback(m=>{if(!n&&!r||p.paused)return;const x=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(x&&b){const v=m.currentTarget,[w,C]=uS(v);w&&C?!m.shiftKey&&b===C?(m.preventDefault(),n&&pn(w,{select:!0})):m.shiftKey&&b===w&&(m.preventDefault(),n&&pn(C,{select:!0})):b===v&&m.preventDefault()}},[n,r,p.paused]);return i.jsx(Ae.div,{tabIndex:-1,...a,ref:h,onKeyDown:y})});cl.displayName=lS;function cS(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(pn(r,{select:t}),document.activeElement!==n)return}function uS(e){const t=Rp(e),n=Uc(t,e),r=Uc(t.reverse(),e);return[n,r]}function Rp(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Uc(e,t){for(const n of e)if(!dS(n,{upTo:t}))return n}function dS(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function fS(e){return e instanceof HTMLInputElement&&"select"in e}function pn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&fS(e)&&t&&e.select()}}var Hc=pS();function pS(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Wc(e,t),e.unshift(t)},remove(t){e=Wc(e,t),e[0]?.resume()}}}function Wc(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function hS(e){return e.filter(t=>t.tagName!=="A")}var mS="Portal",js=g.forwardRef((e,t)=>{const{container:n,...r}=e,[o,s]=g.useState(!1);st(()=>s(!0),[]);const a=n||o&&globalThis?.document?.body;return a?Cx.createPortal(i.jsx(Ae.div,{...r,ref:t}),a):null});js.displayName=mS;var ii=0;function Op(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Vc()),document.body.insertAdjacentElement("beforeend",e[1]??Vc()),ii++,()=>{ii===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),ii--}},[])}function Vc(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var $t=function(){return $t=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},$t.apply(this,arguments)};function Mp(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function gS(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var Oo="right-scroll-bar-position",Mo="width-before-scroll-bar",xS="with-scroll-bars-hidden",bS="--removed-body-scroll-bar-size";function ai(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function yS(e,t){var n=g.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var vS=typeof window<"u"?g.useLayoutEffect:g.useEffect,Zc=new WeakMap;function wS(e,t){var n=yS(null,function(r){return e.forEach(function(o){return ai(o,r)})});return vS(function(){var r=Zc.get(n);if(r){var o=new Set(r),s=new Set(e),a=n.current;o.forEach(function(l){s.has(l)||ai(l,null)}),s.forEach(function(l){o.has(l)||ai(l,a)})}Zc.set(n,e)},[e]),n}function kS(e){return e}function _S(e,t){t===void 0&&(t=kS);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var a=t(s,r);return n.push(a),function(){n=n.filter(function(l){return l!==a})}},assignSyncMedium:function(s){for(r=!0;n.length;){var a=n;n=[],a.forEach(s)}n={push:function(l){return s(l)},filter:function(){return n}}},assignMedium:function(s){r=!0;var a=[];if(n.length){var l=n;n=[],l.forEach(s),a=n}var c=function(){var d=a;a=[],d.forEach(s)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){a.push(d),u()},filter:function(d){return a=a.filter(d),n}}}};return o}function SS(e){e===void 0&&(e={});var t=_S(null);return t.options=$t({async:!0,ssr:!1},e),t}var Lp=function(e){var t=e.sideCar,n=Mp(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return g.createElement(r,$t({},n))};Lp.isSideCarExport=!0;function CS(e,t){return e.useMedium(t),Lp}var Dp=SS(),li=function(){},Ns=g.forwardRef(function(e,t){var n=g.useRef(null),r=g.useState({onScrollCapture:li,onWheelCapture:li,onTouchMoveCapture:li}),o=r[0],s=r[1],a=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,h=e.sideCar,p=e.noRelative,y=e.noIsolation,m=e.inert,x=e.allowPinchZoom,b=e.as,v=b===void 0?"div":b,w=e.gapMode,C=Mp(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=h,j=wS([n,t]),E=$t($t({},C),o);return g.createElement(g.Fragment,null,d&&g.createElement(S,{sideCar:Dp,removeScrollBar:u,shards:f,noRelative:p,noIsolation:y,inert:m,setCallbacks:s,allowPinchZoom:!!x,lockRef:n,gapMode:w}),a?g.cloneElement(g.Children.only(l),$t($t({},E),{ref:j})):g.createElement(v,$t({},E,{className:c,ref:j}),l))});Ns.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ns.classNames={fullWidth:Mo,zeroRight:Oo};var jS=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function NS(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=jS();return t&&e.setAttribute("nonce",t),e}function ES(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function TS(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var AS=function(){var e=0,t=null;return{add:function(n){e==0&&(t=NS())&&(ES(t,n),TS(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},IS=function(){var e=AS();return function(t,n){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Fp=function(){var e=IS(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},zS={left:0,top:0,right:0,gap:0},ci=function(e){return parseInt(e||"",10)||0},PS=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[ci(n),ci(r),ci(o)]},RS=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return zS;var t=PS(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},OS=Fp(),nr="data-scroll-locked",MS=function(e,t,n,r){var o=e.left,s=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
42
42
|
.`.concat(xS,` {
|
|
43
43
|
overflow: hidden `).concat(r,`;
|
|
44
44
|
padding-right: `).concat(l,"px ").concat(r,`;
|
|
@@ -90,7 +90,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
90
90
|
`)}function hi(e,t,n,r){return{role:e,label:t,text:n,size:Tl(n),characters:Al(n),path:r}}const qN={format:"anthropic",analyzeRequest(e){if(e===null)return An(e);try{const t=Ff.safeParse(JSON.parse(e));return t.success?{parsed:t.data,comparisonValue:t.data,messageCount:t.data.messages.length,toolCount:t.data.tools!==void 0&&t.data.tools.length>0?t.data.tools.length:null}:An(e)}catch{return An(e)}},analyzeResponse(e){if(e===null)return or;try{let t=JSON.parse(e);typeof t=="string"&&(t=JSON.parse(t));const n=$f.safeParse(t);if(!n.success)return or;const r=n.data.content.filter(o=>o.type==="tool_use").map(o=>o.name);return{parsed:n.data,toolNames:r.length>0?r:null}}catch{return or}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(t.system!==void 0){const r=VN(t.system);r.length>0&&n.push(hi("system","system",r,"/system"))}if(Array.isArray(t.messages)&&t.messages.forEach((r,o)=>{if(r===null||typeof r!="object")return;const s=r,a=s.role==="user"||s.role==="assistant"?s.role:"user",l=WN(s.content);n.push(hi(a,`[${o}] ${a}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=ZN(t.tools);n.push(hi("tools","tools",r,"/tools"))}return n.length>0?n:null}};function KN(e){if(typeof e=="string")return e;if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const r=n,o=r.type;o==="text"&&typeof r.text=="string"?t.push(r.text):o==="image_url"&&t.push("[image]")}return t.join(`
|
|
91
91
|
`)}function GN(e){const t=[],n=KN(e.content);n.length>0&&t.push(n);const r=typeof e.reasoning_content=="string"?e.reasoning_content:typeof e.thinking=="string"?e.thinking:typeof e.think=="string"?e.think:"";r.length>0&&t.push(r);const o=e.tool_calls;if(Array.isArray(o))for(const s of o){if(s===null||typeof s!="object")continue;const a=s.function;if(a===void 0)continue;const l=typeof a.name=="string"?a.name:"",c=typeof a.arguments=="string"?a.arguments:"";t.push(`${l} ${c}`.trim())}return t.join(`
|
|
92
92
|
`)}function JN(e){if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const o=n.function;o!==void 0&&(typeof o.name=="string"&&t.push(o.name),typeof o.description=="string"&&t.push(o.description),o.parameters!==void 0&&t.push(JSON.stringify(o.parameters)))}return t.join(`
|
|
93
|
-
`)}function cu(e,t,n,r){return{role:e,label:t,text:n,size:Tl(n),characters:Al(n),path:r}}const YN={format:"openai",analyzeRequest(e){if(e===null)return An(e);try{const t=Hf.safeParse(JSON.parse(e));return t.success?{parsed:t.data,comparisonValue:t.data,messageCount:t.data.messages.length,toolCount:t.data.tools!==void 0&&t.data.tools.length>0?t.data.tools.length:null}:An(e)}catch{return An(e)}},analyzeResponse(e){if(e===null)return or;const t=Vf(e);if(t===null)return or;const n=t.choices[0]?.message?.tool_calls?.map(r=>r.function?.name??"").filter(r=>r!=="")??[];return{parsed:t,toolNames:n.length>0?n:null}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(Array.isArray(t.messages)&&t.messages.forEach((r,o)=>{if(r===null||typeof r!="object")return;const s=r,a=s.role==="user"||s.role==="assistant"||s.role==="system"||s.role==="tool"?s.role:"user",l=GN(s);n.push(cu(a,`[${o}] ${a}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=JN(t.tools);n.push(cu("tools","tools",r,"/tools"))}return n.length>0?n:null}},XN={format:"unknown",analyzeRequest(e){return An(e)},analyzeResponse(){return or},anatomySegments(){return null}},QN={anthropic:qN,openai:YN,unknown:XN};function Vm(e){return QN[e]}function Mn(e){const t=NN(e.path);return t==="unknown"?e.apiFormat:t}const eE={anthropic:"Anthropic",openai:"OpenAI",unknown:"Unknown"};function tE({conversationId:e,startTime:t,endTime:n,totalCalls:r,totalInputTokens:o,totalOutputTokens:s,apiFormat:a,expanded:l,onToggle:c,hideApiFormat:u=!1,isLoading:d=!1,userAgent:f,timeDisplayFormat:h,onClear:p}){const[y,m]=g.useState(!1),x=v=>{v.stopPropagation(),p!==void 0&&m(!0)},b=g.useCallback(v=>{v.stopPropagation(),window.open(tf(e),"_blank","noopener,noreferrer")},[e]);return i.jsxs("div",{role:"button",tabIndex:0,"data-nav-id":`conv-${e}`,"data-nav-action":l?"collapse":"expand",className:xe("flex items-center gap-3 px-3 py-2 cursor-pointer transition-colors","hover:bg-muted/50","select-none","border border-border rounded-lg mb-2 bg-background sticky top-0 z-10","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),onClick:c,onKeyDown:v=>{v.target===v.currentTarget&&(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),c())},children:[l?i.jsx(wt,{className:"size-4 text-muted-foreground shrink-0"}):d?i.jsx(Vt,{className:"size-4 animate-spin text-muted-foreground shrink-0"}):i.jsx(Kt,{className:"size-4 text-muted-foreground shrink-0"}),i.jsx("span",{className:"text-purple-400/90 font-mono text-xs font-semibold shrink-0",title:e,children:e.startsWith("PID:")||e.includes("|")?e:e.length>24?e.slice(0,12)+"..."+e.slice(-12):e}),f!=null&&f!==""&&i.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:f,children:[i.jsx(ak,{className:"size-3"}),i.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",children:f})]}),!u&&i.jsx(ot,{variant:"outline",className:xe("text-[10px] px-1.5 py-0 h-5 font-mono shrink-0",a==="openai"&&"border-blue-500/40 text-blue-400",a==="anthropic"&&"border-orange-500/40 text-orange-400",a==="unknown"&&"border-muted text-muted-foreground"),children:eE[a]}),i.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[i.jsx(xn,{className:"size-3"}),i.jsx("span",{className:"font-mono tabular-nums",children:rl(t,n,h)})]}),i.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[i.jsx(ks,{className:"size-3"}),i.jsxs("span",{className:"font-mono tabular-nums",children:[r," call",r!==1?"s":""]})]}),i.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[i.jsx(Vr,{className:"size-3 text-muted-foreground"}),i.jsxs("span",{className:"font-mono tabular-nums",children:[i.jsx("span",{className:"text-blue-400",children:Ue(o)})," / ",i.jsx("span",{className:"text-amber-400",children:Ue(s)})]})]}),i.jsx("span",{className:"flex-1 min-w-0"}),i.jsx("button",{type:"button",onClick:b,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&b(v)},"aria-label":`Open session ${e} in a new tab`,title:"Open this session in a new tab",className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 inline-flex items-center justify-center size-8 rounded hover:bg-muted cursor-pointer",children:i.jsx(Ya,{className:"size-3.5"})}),p!==void 0&&i.jsx("button",{type:"button",onClick:x,"aria-label":`Clear group (${r} request${r!==1?"s":""})`,title:"Clear this group",className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 inline-flex items-center justify-center size-8 rounded hover:bg-muted cursor-pointer",children:i.jsx(ur,{className:"size-3.5"})}),i.jsx(Um,{open:y,onOpenChange:m,title:"Clear this group?",description:`This will remove ${r} request${r!==1?"s":""} from this conversation. This action cannot be undone.`,confirmLabel:"Clear",variant:"destructive",onConfirm:()=>{p?.()}})]})}function nE(e){for(const t of e){const n=Mn(t);if(n!=="unknown")return n}return"unknown"}function rE(e){let t=!1,n=!1;for(const r of e){const o=Mn(r);if(o==="anthropic"?t=!0:o==="openai"&&(n=!0),t&&n)return!0}return!1}function oE(e){if(e.isTest===!0)return"provider-test";if(e.sessionId!==null&&e.sessionId!==""&&e.sessionId!==void 0)return e.sessionId;const t=e.clientPid!==null&&e.clientPid!==void 0,n=e.clientProjectFolder!==null&&e.clientProjectFolder!==void 0;if(!t&&!n)return"default";const r=t?`PID:${e.clientPid}`:"unknown",o=n?e.clientProjectFolder:"no-folder";return`${r}|${o}`}function sE(e){const t=new Map;for(const r of e){const o=oE(r),s=t.get(o);s!==void 0?s.push(r):t.set(o,[r])}const n=[];for(const[r,o]of t){const s=[...o].sort((a,l)=>a.timestamp.localeCompare(l.timestamp));n.push({id:r,conversationId:r,logs:s})}return n.sort((r,o)=>(r.logs[0]?.timestamp??"").localeCompare(o.logs[0]?.timestamp??"")),n}function uu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function iE(e){if(e.responseText===null)return null;try{let t=JSON.parse(e.responseText);return typeof t=="string"&&(t=JSON.parse(t)),uu(t)?typeof t.stop_reason=="string"?t.stop_reason==="end_turn"||t.stop_reason==="tool_use"?t.stop_reason:null:Array.isArray(t.choices)&&t.choices.length>0&&uu(t.choices[0])&&typeof t.choices[0].finish_reason=="string"&&t.choices[0].finish_reason==="stop"?"stop":null:null}catch{return null}}function Zm(e){return e==="end_turn"||e==="stop"}function Tt({className:e,style:t,d:n,eyeStalks:r,eyes:o,legs:s,extras:a}){return i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:t,className:xe("inline-block size-5",e),children:[i.jsx("path",{d:n}),r,o,s,a]})}const Sn=i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),i.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),i.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),i.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]}),qm=i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"7",y1:"16",x2:"5.5",y2:"18.5"}),i.jsx("line",{x1:"9.5",y1:"17",x2:"8.5",y2:"19.5"}),i.jsx("line",{x1:"14.5",y1:"17",x2:"15.5",y2:"19.5"}),i.jsx("line",{x1:"17",y1:"16",x2:"18.5",y2:"18.5"})]});function Km({className:e}){return i.jsx(Tt,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),i.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"})]}),legs:Sn,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),i.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function aE({className:e}){return i.jsx(Tt,{className:e,d:"M4 13 C4 7 7.5 5.5 12 5.5 C16.5 5.5 20 7 20 13 C20 17.5 16.5 19 12 19 C7.5 19 4 17.5 4 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"9.5",y1:"6.5",x2:"9.5",y2:"4.5"}),i.jsx("line",{x1:"14.5",y1:"6.5",x2:"14.5",y2:"4.5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"9.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"14.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"})]}),legs:qm,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C4 9.5 2.5 10 3 12 C3.5 13.5 4.5 13 5 12"}),i.jsx("path",{d:"M19 11 C20 9.5 21.5 10 21 12 C20.5 13.5 19.5 13 19 12"})]})})}function lE({className:e}){return i.jsx(Tt,{className:e,d:"M3 13.5 C3 8 7 6 12 6 C17 6 21 8 21 13.5 C21 17 17 19 12 19 C7 19 3 17 3 13.5 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"7",y1:"7",x2:"6.5",y2:"4.5"}),i.jsx("line",{x1:"17",y1:"7",x2:"17.5",y2:"4.5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"6.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"17.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:Sn,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M4 12 C2.5 10.5 1 11 1.5 13 C2 14.5 3.5 14 4.5 13"}),i.jsx("path",{d:"M20 12 C21.5 10.5 23 11 22.5 13 C22 14.5 20.5 14 19.5 13"})]})})}function cE({className:e}){return i.jsx(Tt,{className:e,d:"M6 14 C6 8 9 5.5 12 5.5 C15 5.5 18 8 18 14 C18 18 15 20 12 20 C9 20 6 18 6 14 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"6.5",x2:"10",y2:"3.5"}),i.jsx("line",{x1:"14",y1:"6.5",x2:"14",y2:"3.5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"10",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"14",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"7",y1:"17",x2:"5",y2:"20.5"}),i.jsx("line",{x1:"9.5",y1:"18.5",x2:"8.5",y2:"21.5"}),i.jsx("line",{x1:"14.5",y1:"18.5",x2:"15.5",y2:"21.5"}),i.jsx("line",{x1:"17",y1:"17",x2:"19",y2:"20.5"})]}),extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M6.5 11 C5 8.5 3 9 3.5 11.5 C4 13.5 5 13 6 12"}),i.jsx("path",{d:"M17.5 11 C19 8.5 21 9 20.5 11.5 C20 13.5 19 13 18 12"})]})})}function uE({className:e}){return i.jsx(Tt,{className:e,d:"M5 13 C5 9 8 7 12 7 L13 4 L14 7 C16 7 19 9 19 13 C19 16 16 18 13 18 L12 21 L11 18 C8 18 5 16 5 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),i.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:Sn,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),i.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function dE({className:e}){return i.jsx(Tt,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),i.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),i.jsx("line",{x1:"13.5",y1:"4",x2:"15.5",y2:"5"})]}),legs:Sn,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),i.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function fE({className:e}){return i.jsx(Tt,{className:e,d:"M5.5 13.5 C5.5 10 8.5 8 12 8 C15.5 8 18.5 10 18.5 13.5 C18.5 16 15.5 17.5 12 17.5 C8.5 17.5 5.5 16 5.5 13.5 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"8",x2:"10",y2:"6"}),i.jsx("line",{x1:"14",y1:"8",x2:"14",y2:"6"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"9",y1:"6",x2:"11",y2:"6.5"}),i.jsx("line",{x1:"13",y1:"6",x2:"15",y2:"6.5"})]}),legs:qm,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M6 11.5 C4.5 10.5 3 11 3.5 12.5 C4 13.5 5 13 5.5 12.5"}),i.jsx("path",{d:"M18 11.5 C19.5 10.5 21 11 20.5 12.5 C20 13.5 19 13 18.5 12.5"})]})})}function pE({className:e}){return i.jsx(Tt,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),i.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:Sn,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),i.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),i.jsx("line",{x1:"8.5",y1:"4",x2:"10.5",y2:"4.5"}),i.jsx("line",{x1:"15.5",y1:"4",x2:"13.5",y2:"4.5"}),i.jsx("path",{d:"M9 15.5 C10 14.5 14 14.5 15 15.5"})]})})}function hE({className:e}){return i.jsx(Tt,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),i.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"9.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"}),i.jsx("circle",{cx:"14.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"})]}),legs:Sn,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),i.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),i.jsx("ellipse",{cx:"12",cy:"15",rx:"2",ry:"1.5",fill:"currentColor",stroke:"none"})]})})}function mE({className:e}){return i.jsx(Tt,{className:e,d:"M4.5 13 C4.5 8 7.5 6 12 6 C16.5 6 19.5 8 19.5 13 C19.5 17 16.5 18.5 12 18.5 C7.5 18.5 4.5 17 4.5 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"9.5",y1:"7",x2:"9",y2:"5"}),i.jsx("line",{x1:"14.5",y1:"7",x2:"15",y2:"5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"9",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"15",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"})]}),legs:Sn,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C3.5 9 2 9.5 2.5 12 C3 14 4 13 5 12"}),i.jsx("path",{d:"M19 11 C20.5 9 22 9.5 21.5 12 C21 14 20 13 19 12"}),i.jsx("path",{d:"M9 14.5 C10 16 14 16 15 14.5"}),i.jsx("circle",{cx:"7",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"}),i.jsx("circle",{cx:"17",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"})]})})}function gE({className:e}){return i.jsx(Tt,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5.5"}),i.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5.5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"7.5",y1:"5.5",x2:"16.5",y2:"5.5"}),i.jsx("rect",{x:"7",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"}),i.jsx("rect",{x:"13",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"})]}),legs:Sn,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),i.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),i.jsx("path",{d:"M9.5 15 C10.5 16 13.5 16 14.5 15"})]})})}function xE({className:e}){return i.jsx(Tt,{className:e,d:"M7 13.5 C7 10.5 9.5 9 12 9 C14.5 9 17 10.5 17 13.5 C17 16 14.5 17.5 12 17.5 C9.5 17.5 7 16 7 13.5 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10.5",y1:"9.5",x2:"10.5",y2:"8"}),i.jsx("line",{x1:"13.5",y1:"9.5",x2:"13.5",y2:"8"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"10.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"13.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"8",y1:"16",x2:"6.5",y2:"18"}),i.jsx("line",{x1:"10",y1:"17",x2:"9.5",y2:"19"}),i.jsx("line",{x1:"14",y1:"17",x2:"14.5",y2:"19"}),i.jsx("line",{x1:"16",y1:"16",x2:"17.5",y2:"18"})]}),extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M7.5 12 C6.5 11 5.5 11.5 6 13 C6.5 14 7 13.5 7.5 13"}),i.jsx("path",{d:"M16.5 12 C17.5 11 18.5 11.5 18 13 C17.5 14 17 13.5 16.5 13"})]})})}const Kr=[Km,aE,lE,cE,uE,dE,fE,pE,hE,mE,gE,xE];function os(e){return Kr[Math.abs(e)%Kr.length]??Km}function bE(e){const t=Kr.length-2;return t<=0?0:1+((Number.isFinite(e)?Math.trunc(e):0)%t+t)%t}function yE(e){return os(bE(e))}const vE="data:image/svg+xml,%3csvg%20height='2500'%20viewBox='0%206.603%201192.672%201193.397'%20width='2500'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m233.96%20800.215%20234.684-131.678%203.947-11.436-3.947-6.363h-11.436l-39.221-2.416-134.094-3.624-116.296-4.832-112.67-6.04-28.35-6.04-26.577-35.035%202.738-17.477%2023.84-16.027%2034.147%202.98%2075.463%205.155%20113.235%207.812%2082.147%204.832%20121.692%2012.644h19.329l2.738-7.812-6.604-4.832-5.154-4.832-117.182-79.41-126.845-83.92-66.443-48.321-35.92-24.484-18.12-22.953-7.813-50.093%2032.618-35.92%2043.812%202.98%2011.195%202.98%2044.375%2034.147%2094.792%2073.37%20123.786%2091.167%2018.12%2015.06%207.249-5.154.886-3.624-8.135-13.61-67.329-121.692-71.838-123.785-31.974-51.302-8.456-30.765c-2.98-12.645-5.154-23.275-5.154-36.242l37.127-50.416%2020.537-6.604%2049.53%206.604%2020.86%2018.121%2030.765%2070.39%2049.852%20110.818%2077.315%20150.684%2022.631%2044.698%2012.08%2041.396%204.51%2012.645h7.813v-7.248l6.362-84.886%2011.759-104.215%2011.436-134.094%203.946-37.772%2018.685-45.262%2037.127-24.482%2028.994%2013.852%2023.839%2034.148-3.303%2022.067-14.174%2092.134-27.785%20144.323-18.121%2096.644h10.55l12.08-12.08%2048.887-64.913%2082.147-102.685%2036.242-40.752%2042.282-45.02%2027.14-21.423h51.303l37.772%2056.135-16.913%2057.986-52.832%2067.007-43.812%2056.779-62.82%2084.563-39.22%2067.651%203.623%205.396%209.343-.886%20141.906-30.201%2076.671-13.852%2091.49-15.705%2041.396%2019.329%204.51%2019.65-16.269%2040.189-97.852%2024.16-114.764%2022.954-170.9%2040.43-2.093%201.53%202.416%202.98%2076.993%207.248%2032.94%201.771h80.617l150.12%2011.195%2039.222%2025.933%2023.517%2031.732-3.946%2024.16-60.403%2030.766-81.503-19.33-190.228-45.26-65.235-16.27h-9.02v5.397l54.362%2053.154%2099.624%2089.96%20124.752%20115.973%206.362%2028.671-16.027%2022.63-16.912-2.415-109.611-82.47-42.282-37.127-95.758-80.618h-6.363v8.456l22.067%2032.296%20116.537%20175.167%206.04%2053.719-8.456%2017.476-30.201%2010.55-33.181-6.04-68.215-95.758-70.39-107.84-56.778-96.644-6.926%203.947-33.503%20360.886-15.705%2018.443-36.243%2013.852-30.201-22.953-16.027-37.127%2016.027-73.37%2019.329-95.758%2015.704-76.107%2014.175-94.55%208.456-31.41-.563-2.094-6.927.886-71.275%2097.852-108.402%20146.497-85.772%2091.812-20.537%208.134-35.597-18.443%203.301-32.94%2019.893-29.315%20118.712-151.007%2071.597-93.583%2046.228-54.04-.322-7.813h-2.738l-315.302%20204.725-56.135%207.248-24.16-22.63%202.98-37.128%2011.435-12.08%2094.792-65.236-.322.323z'%20fill='%23d97757'/%3e%3c/svg%3e",wE="data:image/svg+xml,%3csvg%20height='2500'%20viewBox='-1%20-.1%20949.1%20959.8'%20width='2474'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m925.8%20456.3c10.4%2023.2%2017%2048%2019.7%2073.3%202.6%2025.3%201.3%2050.9-4.1%2075.8-5.3%2024.9-14.5%2048.8-27.3%2070.8-8.4%2014.7-18.3%2028.5-29.7%2041.2-11.3%2012.6-23.9%2024-37.6%2034-13.8%2010-28.5%2018.4-44.1%2025.3-15.5%206.8-31.7%2012-48.3%2015.4-7.8%2024.2-19.4%2047.1-34.4%2067.7-14.9%2020.6-33%2038.7-53.6%2053.6-20.6%2015-43.4%2026.6-67.6%2034.4-24.2%207.9-49.5%2011.8-75%2011.8-16.9.1-33.9-1.7-50.5-5.1-16.5-3.5-32.7-8.8-48.2-15.7s-30.2-15.5-43.9-25.5c-13.6-10-26.2-21.5-37.4-34.2-25%205.4-50.6%206.7-75.9%204.1-25.3-2.7-50.1-9.3-73.4-19.7-23.2-10.3-44.7-24.3-63.6-41.4s-35-37.1-47.7-59.1c-8.5-14.7-15.5-30.2-20.8-46.3s-8.8-32.7-10.6-49.6c-1.8-16.8-1.7-33.8.1-50.7%201.8-16.8%205.5-33.4%2010.8-49.5-17-18.9-31-40.4-41.4-63.6-10.3-23.3-17-48-19.6-73.3-2.7-25.3-1.3-50.9%204-75.8s14.5-48.8%2027.3-70.8c8.4-14.7%2018.3-28.6%2029.6-41.2s24-24%2037.7-34%2028.5-18.5%2044-25.3c15.6-6.9%2031.8-12%2048.4-15.4%207.8-24.3%2019.4-47.1%2034.3-67.7%2015-20.6%2033.1-38.7%2053.7-53.7%2020.6-14.9%2043.4-26.5%2067.6-34.4%2024.2-7.8%2049.5-11.8%2075-11.7%2016.9-.1%2033.9%201.6%2050.5%205.1s32.8%208.7%2048.3%2015.6c15.5%207%2030.2%2015.5%2043.9%2025.5%2013.7%2010.1%2026.3%2021.5%2037.5%2034.2%2024.9-5.3%2050.5-6.6%2075.8-4s50%209.3%2073.3%2019.6c23.2%2010.4%2044.7%2024.3%2063.6%2041.4%2018.9%2017%2035%2036.9%2047.7%2059%208.5%2014.6%2015.5%2030.1%2020.8%2046.3%205.3%2016.1%208.9%2032.7%2010.6%2049.6%201.8%2016.9%201.8%2033.9-.1%2050.8-1.8%2016.9-5.5%2033.5-10.8%2049.6%2017.1%2018.9%2031%2040.3%2041.4%2063.6zm-333.2%20426.9c21.8-9%2041.6-22.3%2058.3-39s30-36.5%2039-58.4c9-21.8%2013.7-45.2%2013.7-68.8v-223q-.1-.3-.2-.7-.1-.3-.3-.6-.2-.3-.5-.5-.3-.3-.6-.4l-80.7-46.6v269.4c0%202.7-.4%205.5-1.1%208.1-.7%202.7-1.7%205.2-3.1%207.6s-3%204.6-5%206.5a32.1%2032.1%200%200%201%20-6.5%205l-191.1%20110.3c-1.6%201-4.3%202.4-5.7%203.2%207.9%206.7%2016.5%2012.6%2025.5%2017.8%209.1%205.2%2018.5%209.6%2028.3%2013.2%209.8%203.5%2019.9%206.2%2030.1%208%2010.3%201.8%2020.7%202.7%2031.1%202.7%2023.6%200%2047-4.7%2068.8-13.8zm-455.1-151.4c11.9%2020.5%2027.6%2038.3%2046.3%2052.7%2018.8%2014.4%2040.1%2024.9%2062.9%2031s46.6%207.7%2070%204.6%2045.9-10.7%2066.4-22.5l193.2-111.5.5-.5q.2-.2.3-.6.2-.3.3-.6v-94l-233.2%20134.9c-2.4%201.4-4.9%202.4-7.5%203.2-2.7.7-5.4%201-8.2%201-2.7%200-5.4-.3-8.1-1-2.6-.8-5.2-1.8-7.6-3.2l-191.1-110.4c-1.7-1-4.2-2.5-5.6-3.4-1.8%2010.3-2.7%2020.7-2.7%2031.1s1%2020.8%202.8%2031.1c1.8%2010.2%204.6%2020.3%208.1%2030.1%203.6%209.8%208%2019.2%2013.2%2028.2zm-50.2-417c-11.8%2020.5-19.4%2043.1-22.5%2066.5s-1.5%2047.1%204.6%2070c6.1%2022.8%2016.6%2044.1%2031%2062.9%2014.4%2018.7%2032.3%2034.4%2052.7%2046.2l193.1%20111.6q.3.1.7.2h.7q.4%200%20.7-.2.3-.1.6-.3l81-46.8-233.2-134.6c-2.3-1.4-4.5-3.1-6.5-5a32.1%2032.1%200%200%201%20-5-6.5c-1.3-2.4-2.4-4.9-3.1-7.6-.7-2.6-1.1-5.3-1-8.1v-227.1c-9.8%203.6-19.3%208-28.3%2013.2-9%205.3-17.5%2011.3-25.5%2018-7.9%206.7-15.3%2014.1-22%2022.1-6.7%207.9-12.6%2016.5-17.8%2025.5zm663.3%20154.4c2.4%201.4%204.6%203%206.6%205%201.9%201.9%203.6%204.1%205%206.5%201.3%202.4%202.4%205%203.1%207.6.6%202.7%201%205.4.9%208.2v227.1c32.1-11.8%2060.1-32.5%2080.8-59.7%2020.8-27.2%2033.3-59.7%2036.2-93.7s-3.9-68.2-19.7-98.5-39.9-55.5-69.5-72.5l-193.1-111.6q-.3-.1-.7-.2h-.7q-.3.1-.7.2-.3.1-.6.3l-80.6%2046.6%20233.2%20134.7zm80.5-121h-.1v.1zm-.1-.1c5.8-33.6%201.9-68.2-11.3-99.7-13.1-31.5-35-58.6-63-78.2-28-19.5-61-30.7-95.1-32.2-34.2-1.4-68%206.9-97.6%2023.9l-193.1%20111.5q-.3.2-.5.5l-.4.6q-.1.3-.2.7-.1.3-.1.7v93.2l233.2-134.7c2.4-1.4%205-2.4%207.6-3.2%202.7-.7%205.4-1%208.1-1%202.8%200%205.5.3%208.2%201%202.6.8%205.1%201.8%207.5%203.2l191.1%20110.4c1.7%201%204.2%202.4%205.6%203.3zm-505.3-103.2c0-2.7.4-5.4%201.1-8.1.7-2.6%201.7-5.2%203.1-7.6%201.4-2.3%203-4.5%205-6.5%201.9-1.9%204.1-3.6%206.5-4.9l191.1-110.3c1.8-1.1%204.3-2.5%205.7-3.2-26.2-21.9-58.2-35.9-92.1-40.2-33.9-4.4-68.3%201-99.2%2015.5-31%2014.5-57.2%2037.6-75.5%2066.4-18.3%2028.9-28%2062.3-28%2096.5v223q.1.4.2.7.1.3.3.6.2.3.5.6.2.2.6.4l80.7%2046.6zm43.8%20294.7%20103.9%2060%20103.9-60v-119.9l-103.8-60-103.9%2060z'/%3e%3c/svg%3e",kE="data:image/svg+xml,%3csvg%20fill='none'%20height='1320'%20viewBox='3.771%206.973%2023.993%2017.652'%20width='2500'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m27.501%208.469c-.252-.123-.36.111-.508.23-.05.04-.093.09-.135.135-.368.395-.797.652-1.358.621-.821-.045-1.521.213-2.14.842-.132-.776-.57-1.238-1.235-1.535-.349-.155-.701-.309-.944-.645-.171-.238-.217-.504-.303-.765-.054-.159-.108-.32-.29-.348-.197-.031-.274.135-.352.273-.31.567-.43%201.192-.419%201.825.028%201.421.628%202.554%201.82%203.36.136.093.17.186.128.321-.081.278-.178.547-.264.824-.054.178-.135.217-.324.14a5.448%205.448%200%200%201%20-1.719-1.169c-.848-.82-1.614-1.726-2.57-2.435-.225-.166-.449-.32-.681-.467-.976-.95.128-1.729.383-1.82.267-.096.093-.428-.77-.424s-1.653.293-2.659.677a2.782%202.782%200%200%201%20-.46.135%209.554%209.554%200%200%200%20-2.853-.1c-1.866.21-3.356%201.092-4.452%202.6-1.315%201.81-1.625%203.87-1.246%206.018.399%202.261%201.552%204.136%203.326%205.601%201.837%201.518%203.955%202.262%206.37%202.12%201.466-.085%203.1-.282%204.942-1.842.465.23.952.322%201.762.392.623.059%201.223-.031%201.687-.127.728-.154.677-.828.414-.953-2.132-.994-1.665-.59-2.09-.916%201.084-1.285%202.717-2.619%203.356-6.94.05-.343.007-.558%200-.837-.004-.168.034-.235.228-.254a4.084%204.084%200%200%200%201.529-.47c1.382-.757%201.938-1.997%202.07-3.485.02-.227-.004-.463-.243-.582zm-12.041%2013.391c-2.067-1.627-3.07-2.162-3.483-2.138-.387.021-.318.465-.233.754.089.285.205.482.368.732.113.166.19.414-.112.598-.666.414-1.823-.139-1.878-.166-1.347-.793-2.473-1.842-3.267-3.276-.765-1.38-1.21-2.861-1.284-4.441-.02-.383.093-.518.472-.586a4.692%204.692%200%200%201%201.514-.04c2.109.31%203.905%201.255%205.41%202.749.86.853%201.51%201.871%202.18%202.865.711%201.057%201.478%202.063%202.454%202.887.343.289.619.51.881.672-.792.088-2.117.107-3.022-.61zm.99-6.38a.304.304%200%201%201%20.609%200c0%20.17-.136.304-.306.304a.3.3%200%200%201%20-.303-.305zm3.077%201.581c-.197.08-.394.15-.584.159a1.246%201.246%200%200%201%20-.79-.252c-.27-.227-.463-.354-.546-.752a1.752%201.752%200%200%201%20.016-.582c.07-.324-.008-.531-.235-.72-.187-.155-.422-.196-.682-.196a.551.551%200%200%201%20-.252-.078c-.108-.055-.197-.19-.112-.356.027-.053.159-.183.19-.207.352-.201.758-.135%201.134.016.349.142.611.404.99.773.388.448.457.573.678.906.174.264.333.534.441.842.066.192-.02.35-.248.448z'%20fill='%234d6bfe'/%3e%3c/svg%3e",_E="/assets/minimax-BPMzvuL-.jpeg",SE="/assets/alibaba-TTwafVwX.svg",CE="/assets/qwen-CONDcHqt.png",jE="/assets/zhipuai-BPNAnxo-.svg",NE={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen","glm-":"zhipuai"};function Gm(e){if(e===null)return"unknown";const t=e.toLowerCase();for(const[n,r]of Object.entries(NE))if(t.startsWith(n.toLowerCase()))return r;return"unknown"}const $n={width:24,height:24,objectFit:"contain"},EE=ut.memo(({className:e})=>i.jsx("img",{src:vE,alt:"Anthropic",className:e,style:$n})),TE=ut.memo(({className:e})=>i.jsx("img",{src:wE,alt:"OpenAI",className:e,style:{...$n,background:"white",borderRadius:"4px"}})),AE=ut.memo(({className:e})=>i.jsx("img",{src:kE,alt:"DeepSeek",className:e,style:$n})),IE=ut.memo(({className:e})=>i.jsx("img",{src:_E,alt:"MiniMax",className:e,style:$n})),zE=ut.memo(({className:e})=>i.jsx("img",{src:SE,alt:"Alibaba",className:e,style:$n})),PE=ut.memo(({className:e})=>i.jsx("img",{src:CE,alt:"Qwen",className:e,style:$n})),RE=ut.memo(({className:e})=>i.jsx("img",{src:jE,alt:"ZhipuAI",className:e,style:$n}));function Jm({provider:e,className:t}){switch(e){case"anthropic":return i.jsx(EE,{className:t});case"openai":return i.jsx(TE,{className:t});case"deepseek":return i.jsx(AE,{className:t});case"minimax":return i.jsx(IE,{className:t});case"alibaba":return i.jsx(zE,{className:t});case"qwen":return i.jsx(PE,{className:t});case"zhipuai":return i.jsx(RE,{className:t});case"unknown":return null}}function nt({delayDuration:e=0,...t}){return i.jsx(pN,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Fe({...e}){return i.jsx(hN,{"data-slot":"tooltip",...e})}function $e({...e}){return i.jsx(mN,{"data-slot":"tooltip-trigger",...e})}function Be({className:e,sideOffset:t=0,children:n,...r}){return i.jsx(gN,{children:i.jsxs(xN,{"data-slot":"tooltip-content",sideOffset:t,className:xe("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,i.jsx(bN,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function Il(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Me(e,t){return e===null||typeof e!="object"||Array.isArray(e)?void 0:Object.getOwnPropertyDescriptor(e,t)?.value}const OE="x-anthropic-billing-header:";function ME(e){return e.trimStart().toLowerCase().startsWith(OE)}function LE(e){return Il(e)?Object.prototype.hasOwnProperty.call(e,"system"):!1}function DE(e){if(!Il(e))return!1;const t=Me(e,"type"),n=Me(e,"text");return typeof t!="string"||t!=="text"||typeof n!="string"?!1:ME(n)}function FE(e){let t;try{t=JSON.parse(e)}catch{return{body:e,removed:0}}if(!LE(t))return{body:e,removed:0};const n=t.system;if(!Array.isArray(n)||n.length===0)return{body:e,removed:0};const r=[];let o=0;for(const s of n){if(DE(s)){o+=1;continue}r.push(s)}return o===0?{body:e,removed:0}:(r.length===0?delete t.system:t.system=r,{body:JSON.stringify(t),removed:o})}function $E(e){return{depth:Number.POSITIVE_INFINITY}}function Ym(e){try{const t=JSON.parse(e);return{kind:"json",data:ss(t)}}catch{return{kind:"text"}}}function mi(e){const t=g.useMemo(()=>e===null?null:Ym(e),[e]),n=t?.kind==="json"?t.data:null,r=g.useMemo(()=>n===null?null:$E(),[n]),[o,s]=g.useState(!1),[a,l]=g.useState(0),[c,u]=g.useState(0),[d,f]=g.useTransition(),h=g.useCallback(()=>{const p=!o,y=p&&r!==null?r.depth:0;f(()=>{s(p),l(y),u(m=>m+1)})},[o,r]);return{parsedData:n,policy:r,isExpanded:o,toggle:h,isPending:d,bulkDepth:a,bulkRevision:c}}function ss(e){if(e==null)return null;switch(typeof e){case"string":return e;case"number":return e;case"boolean":return e;case"object":{if(Array.isArray(e))return e.map(n=>ss(n));const t={};for(const n of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,n);t[n]=ss(r?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function Xm({className:e,orientation:t="horizontal",...n}){return i.jsx(K5,{"data-slot":"tabs","data-orientation":t,orientation:t,className:xe("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",e),...n})}const BE=sl("rounded-lg p-[3px] group-data-[orientation=horizontal]/tabs:h-9 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Qm({className:e,variant:t="default",...n}){return i.jsx(G5,{"data-slot":"tabs-list","data-variant":t,className:xe(BE({variant:t}),e),...n})}function _t({className:e,...t}){return i.jsx(J5,{"data-slot":"tabs-trigger",className:xe("focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent","data-[state=active]:bg-background dark:data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 data-[state=active]:text-foreground","after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",e),...t})}function St({className:e,...t}){return i.jsx(Y5,{"data-slot":"tabs-content",className:xe("flex-1 outline-none",e),...t})}function en(e){const[t,n]=g.useState(!1),r=g.useRef(null);g.useEffect(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);const o=g.useCallback(s=>{s.stopPropagation(),e!==null&&Ot(e).then(a=>{a&&(n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),2e3))})},[e]);return{copied:t,copy:o}}const UE=g.lazy(()=>Ln(()=>import("./CompareDrawer-DkDpl_Sg.js"),__vite__mapDeps([0,1])).then(e=>({default:e.CompareDrawer}))),HE=g.lazy(()=>Ln(()=>import("./ReplayDialog-CKqYfD0A.js"),__vite__mapDeps([2,1,3])).then(e=>({default:e.ReplayDialog}))),WE=g.lazy(()=>Ln(()=>import("./RequestAnatomy-CQZl-YIx.js"),__vite__mapDeps([4,1])).then(e=>({default:e.RequestAnatomy}))),VE=g.lazy(()=>Ln(()=>import("./ResponseView-DW9tFPi0.js"),__vite__mapDeps([3,1])).then(e=>({default:e.ResponseView}))),ZE=g.lazy(()=>Ln(()=>import("./StreamingChunkSequence-m8zKc3L1.js"),__vite__mapDeps([5,1])).then(e=>({default:e.StreamingChunkSequence}))),du=g.lazy(()=>Ln(()=>Promise.resolve().then(()=>Zg),void 0).then(e=>({default:e.JsonViewer}))),qE=g.lazy(()=>Ln(()=>Promise.resolve().then(()=>Zg),void 0).then(e=>({default:e.JsonViewerFromString}))),KE=1200,GE=12;function JE(e){const{containerRef:t,setExpandToPath:n,ensureTabActive:r,highlightMs:o}=e,s=g.useRef(null);return g.useCallback(a=>{r?.(),n(a.path);const l=f=>{f.scrollIntoView({behavior:"smooth",block:"center"}),f.classList.add("ring-2","ring-primary/60","ring-offset-1","ring-offset-background","rounded-sm","transition-shadow"),s.current!==null&&clearTimeout(s.current),s.current=setTimeout(()=>{f.classList.remove("ring-2","ring-primary/60","ring-offset-1","ring-offset-background","rounded-sm","transition-shadow"),n(null)},o??KE)},u=`[data-anatomy-path="${(f=>typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(f):f.replace(/(["'\\[\](){}])/g,"\\$1"))(a.path)}"]`,d=f=>{const h=t.current;if(h!==null){const p=h.querySelector(u);if(p!==null){l(p);return}}f>0?window.requestAnimationFrame(()=>d(f-1)):n(null)};window.requestAnimationFrame(()=>d(GE))},[t,r,o,n])}class eg{diff(t,n,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);const s=this.castInput(t,r),a=this.castInput(n,r),l=this.removeEmpty(this.tokenize(s,r)),c=this.removeEmpty(this.tokenize(a,r));return this.diffWithOptionsObj(l,c,r,o)}diffWithOptionsObj(t,n,r,o){var s;const a=v=>{if(v=this.postProcess(v,r),o){setTimeout(function(){o(v)},0);return}else return v},l=n.length,c=t.length;let u=1,d=l+c;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));const f=(s=r.timeout)!==null&&s!==void 0?s:1/0,h=Date.now()+f,p=[{oldPos:-1,lastComponent:void 0}];let y=this.extractCommon(p[0],n,t,0,r);if(p[0].oldPos+1>=c&&y+1>=l)return a(this.buildValues(p[0].lastComponent,n,t));let m=-1/0,x=1/0;const b=()=>{for(let v=Math.max(m,-u);v<=Math.min(x,u);v+=2){let w;const C=p[v-1],S=p[v+1];C&&(p[v-1]=void 0);let j=!1;if(S){const N=S.oldPos-v;j=S&&0<=N&&N<l}const E=C&&C.oldPos+1<c;if(!j&&!E){p[v]=void 0;continue}if(!E||j&&C.oldPos<S.oldPos?w=this.addToPath(S,!0,!1,0,r):w=this.addToPath(C,!1,!0,1,r),y=this.extractCommon(w,n,t,v,r),w.oldPos+1>=c&&y+1>=l)return a(this.buildValues(w.lastComponent,n,t))||!0;p[v]=w,w.oldPos+1>=c&&(x=Math.min(x,v-1)),y+1>=l&&(m=Math.max(m,v+1))}u++};if(o)(function v(){setTimeout(function(){if(u>d||Date.now()>h)return o(void 0);b()||v()},0)})();else for(;u<=d&&Date.now()<=h;){const v=b();if(v)return v}}addToPath(t,n,r,o,s){const a=t.lastComponent;return a&&!s.oneChangePerToken&&a.added===n&&a.removed===r?{oldPos:t.oldPos+o,lastComponent:{count:a.count+1,added:n,removed:r,previousComponent:a.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:n,removed:r,previousComponent:a}}}extractCommon(t,n,r,o,s){const a=n.length,l=r.length;let c=t.oldPos,u=c-o,d=0;for(;u+1<a&&c+1<l&&this.equals(r[c+1],n[u+1],s);)u++,c++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const o=[];let s;for(;t;)o.push(t),s=t.previousComponent,delete t.previousComponent,t=s;o.reverse();const a=o.length;let l=0,c=0,u=0;for(;l<a;l++){const d=o[l];if(d.removed)d.value=this.join(r.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let f=n.slice(c,c+d.count);f=f.map(function(h,p){const y=r[u+p];return y.length>h.length?y:h}),d.value=this.join(f)}else d.value=this.join(n.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return o}}class YE extends eg{constructor(){super(...arguments),this.tokenize=ng}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
|
93
|
+
`)}function cu(e,t,n,r){return{role:e,label:t,text:n,size:Tl(n),characters:Al(n),path:r}}const YN={format:"openai",analyzeRequest(e){if(e===null)return An(e);try{const t=Hf.safeParse(JSON.parse(e));return t.success?{parsed:t.data,comparisonValue:t.data,messageCount:t.data.messages.length,toolCount:t.data.tools!==void 0&&t.data.tools.length>0?t.data.tools.length:null}:An(e)}catch{return An(e)}},analyzeResponse(e){if(e===null)return or;const t=Vf(e);if(t===null)return or;const n=t.choices[0]?.message?.tool_calls?.map(r=>r.function?.name??"").filter(r=>r!=="")??[];return{parsed:t,toolNames:n.length>0?n:null}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(Array.isArray(t.messages)&&t.messages.forEach((r,o)=>{if(r===null||typeof r!="object")return;const s=r,a=s.role==="user"||s.role==="assistant"||s.role==="system"||s.role==="tool"?s.role:"user",l=GN(s);n.push(cu(a,`[${o}] ${a}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=JN(t.tools);n.push(cu("tools","tools",r,"/tools"))}return n.length>0?n:null}},XN={format:"unknown",analyzeRequest(e){return An(e)},analyzeResponse(){return or},anatomySegments(){return null}},QN={anthropic:qN,openai:YN,unknown:XN};function Vm(e){return QN[e]}function Mn(e){const t=NN(e.path);return t==="unknown"?e.apiFormat:t}const eE={anthropic:"Anthropic",openai:"OpenAI",unknown:"Unknown"};function tE({conversationId:e,startTime:t,endTime:n,totalCalls:r,totalInputTokens:o,totalOutputTokens:s,apiFormat:a,expanded:l,onToggle:c,hideApiFormat:u=!1,isLoading:d=!1,userAgent:f,timeDisplayFormat:h,onClear:p}){const[y,m]=g.useState(!1),x=v=>{v.stopPropagation(),p!==void 0&&m(!0)},b=g.useCallback(v=>{v.stopPropagation(),window.open(tf(e),"_blank","noopener,noreferrer")},[e]);return i.jsxs("div",{role:"button",tabIndex:0,"data-nav-id":`conv-${e}`,"data-nav-action":l?"collapse":"expand",className:xe("flex items-center gap-3 px-3 py-2 cursor-pointer transition-colors","hover:bg-muted/50","select-none","border border-border rounded-lg mb-2 bg-background sticky top-0 z-10","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),onClick:c,onKeyDown:v=>{v.target===v.currentTarget&&(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),c())},children:[l?i.jsx(wt,{className:"size-4 text-muted-foreground shrink-0"}):d?i.jsx(Vt,{className:"size-4 animate-spin text-muted-foreground shrink-0"}):i.jsx(Kt,{className:"size-4 text-muted-foreground shrink-0"}),i.jsx("span",{className:"text-purple-400/90 font-mono text-xs font-semibold shrink-0",title:e,children:e.startsWith("PID:")||e.includes("|")?e:e.length>24?e.slice(0,12)+"..."+e.slice(-12):e}),f!=null&&f!==""&&i.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:f,children:[i.jsx(ak,{className:"size-3"}),i.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",children:f})]}),!u&&i.jsx(ot,{variant:"outline",className:xe("text-[10px] px-1.5 py-0 h-5 font-mono shrink-0",a==="openai"&&"border-blue-500/40 text-blue-400",a==="anthropic"&&"border-orange-500/40 text-orange-400",a==="unknown"&&"border-muted text-muted-foreground"),children:eE[a]}),i.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[i.jsx(xn,{className:"size-3"}),i.jsx("span",{className:"font-mono tabular-nums",children:rl(t,n,h)})]}),i.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[i.jsx(ks,{className:"size-3"}),i.jsxs("span",{className:"font-mono tabular-nums",children:[r," call",r!==1?"s":""]})]}),i.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[i.jsx(Vr,{className:"size-3 text-muted-foreground"}),i.jsxs("span",{className:"font-mono tabular-nums",children:[i.jsx("span",{className:"text-blue-400",children:Ue(o)})," / ",i.jsx("span",{className:"text-amber-400",children:Ue(s)})]})]}),i.jsx("span",{className:"flex-1 min-w-0"}),i.jsx("button",{type:"button",onClick:b,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&b(v)},"aria-label":`Open session ${e} in a new tab`,title:"Open this session in a new tab",className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 inline-flex items-center justify-center size-8 rounded hover:bg-muted cursor-pointer",children:i.jsx(Ya,{className:"size-3.5"})}),p!==void 0&&i.jsx("button",{type:"button",onClick:x,"aria-label":`Clear group (${r} request${r!==1?"s":""})`,title:"Clear this group",className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 inline-flex items-center justify-center size-8 rounded hover:bg-muted cursor-pointer",children:i.jsx(ur,{className:"size-3.5"})}),i.jsx(Um,{open:y,onOpenChange:m,title:"Clear this group?",description:`This will remove ${r} request${r!==1?"s":""} from this conversation. This action cannot be undone.`,confirmLabel:"Clear",variant:"destructive",onConfirm:()=>{p?.()}})]})}function nE(e){for(const t of e){const n=Mn(t);if(n!=="unknown")return n}return"unknown"}function rE(e){let t=!1,n=!1;for(const r of e){const o=Mn(r);if(o==="anthropic"?t=!0:o==="openai"&&(n=!0),t&&n)return!0}return!1}function oE(e){if(e.isTest===!0)return"provider-test";if(e.sessionId!==null&&e.sessionId!==""&&e.sessionId!==void 0)return e.sessionId;const t=e.clientPid!==null&&e.clientPid!==void 0,n=e.clientProjectFolder!==null&&e.clientProjectFolder!==void 0;if(!t&&!n)return"default";const r=t?`PID:${e.clientPid}`:"unknown",o=n?e.clientProjectFolder:"no-folder";return`${r}|${o}`}function sE(e){const t=new Map;for(const r of e){const o=oE(r),s=t.get(o);s!==void 0?s.push(r):t.set(o,[r])}const n=[];for(const[r,o]of t){const s=[...o].sort((a,l)=>a.timestamp.localeCompare(l.timestamp));n.push({id:r,conversationId:r,logs:s})}return n.sort((r,o)=>(r.logs[0]?.timestamp??"").localeCompare(o.logs[0]?.timestamp??"")),n}function uu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function iE(e){if(e.responseText===null)return null;try{let t=JSON.parse(e.responseText);return typeof t=="string"&&(t=JSON.parse(t)),uu(t)?typeof t.stop_reason=="string"?t.stop_reason==="end_turn"||t.stop_reason==="tool_use"?t.stop_reason:null:Array.isArray(t.choices)&&t.choices.length>0&&uu(t.choices[0])&&typeof t.choices[0].finish_reason=="string"&&t.choices[0].finish_reason==="stop"?"stop":null:null}catch{return null}}function Zm(e){return e==="end_turn"||e==="stop"}function Tt({className:e,style:t,d:n,eyeStalks:r,eyes:o,legs:s,extras:a}){return i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:t,className:xe("inline-block size-5",e),children:[i.jsx("path",{d:n}),r,o,s,a]})}const Sn=i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),i.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),i.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),i.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]}),qm=i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"7",y1:"16",x2:"5.5",y2:"18.5"}),i.jsx("line",{x1:"9.5",y1:"17",x2:"8.5",y2:"19.5"}),i.jsx("line",{x1:"14.5",y1:"17",x2:"15.5",y2:"19.5"}),i.jsx("line",{x1:"17",y1:"16",x2:"18.5",y2:"18.5"})]});function Km({className:e}){return i.jsx(Tt,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),i.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"})]}),legs:Sn,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),i.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function aE({className:e}){return i.jsx(Tt,{className:e,d:"M4 13 C4 7 7.5 5.5 12 5.5 C16.5 5.5 20 7 20 13 C20 17.5 16.5 19 12 19 C7.5 19 4 17.5 4 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"9.5",y1:"6.5",x2:"9.5",y2:"4.5"}),i.jsx("line",{x1:"14.5",y1:"6.5",x2:"14.5",y2:"4.5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"9.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"14.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"})]}),legs:qm,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C4 9.5 2.5 10 3 12 C3.5 13.5 4.5 13 5 12"}),i.jsx("path",{d:"M19 11 C20 9.5 21.5 10 21 12 C20.5 13.5 19.5 13 19 12"})]})})}function lE({className:e}){return i.jsx(Tt,{className:e,d:"M3 13.5 C3 8 7 6 12 6 C17 6 21 8 21 13.5 C21 17 17 19 12 19 C7 19 3 17 3 13.5 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"7",y1:"7",x2:"6.5",y2:"4.5"}),i.jsx("line",{x1:"17",y1:"7",x2:"17.5",y2:"4.5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"6.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"17.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:Sn,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M4 12 C2.5 10.5 1 11 1.5 13 C2 14.5 3.5 14 4.5 13"}),i.jsx("path",{d:"M20 12 C21.5 10.5 23 11 22.5 13 C22 14.5 20.5 14 19.5 13"})]})})}function cE({className:e}){return i.jsx(Tt,{className:e,d:"M6 14 C6 8 9 5.5 12 5.5 C15 5.5 18 8 18 14 C18 18 15 20 12 20 C9 20 6 18 6 14 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"6.5",x2:"10",y2:"3.5"}),i.jsx("line",{x1:"14",y1:"6.5",x2:"14",y2:"3.5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"10",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"14",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"7",y1:"17",x2:"5",y2:"20.5"}),i.jsx("line",{x1:"9.5",y1:"18.5",x2:"8.5",y2:"21.5"}),i.jsx("line",{x1:"14.5",y1:"18.5",x2:"15.5",y2:"21.5"}),i.jsx("line",{x1:"17",y1:"17",x2:"19",y2:"20.5"})]}),extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M6.5 11 C5 8.5 3 9 3.5 11.5 C4 13.5 5 13 6 12"}),i.jsx("path",{d:"M17.5 11 C19 8.5 21 9 20.5 11.5 C20 13.5 19 13 18 12"})]})})}function uE({className:e}){return i.jsx(Tt,{className:e,d:"M5 13 C5 9 8 7 12 7 L13 4 L14 7 C16 7 19 9 19 13 C19 16 16 18 13 18 L12 21 L11 18 C8 18 5 16 5 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),i.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:Sn,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),i.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function dE({className:e}){return i.jsx(Tt,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),i.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),i.jsx("line",{x1:"13.5",y1:"4",x2:"15.5",y2:"5"})]}),legs:Sn,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),i.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function fE({className:e}){return i.jsx(Tt,{className:e,d:"M5.5 13.5 C5.5 10 8.5 8 12 8 C15.5 8 18.5 10 18.5 13.5 C18.5 16 15.5 17.5 12 17.5 C8.5 17.5 5.5 16 5.5 13.5 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"8",x2:"10",y2:"6"}),i.jsx("line",{x1:"14",y1:"8",x2:"14",y2:"6"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"9",y1:"6",x2:"11",y2:"6.5"}),i.jsx("line",{x1:"13",y1:"6",x2:"15",y2:"6.5"})]}),legs:qm,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M6 11.5 C4.5 10.5 3 11 3.5 12.5 C4 13.5 5 13 5.5 12.5"}),i.jsx("path",{d:"M18 11.5 C19.5 10.5 21 11 20.5 12.5 C20 13.5 19 13 18.5 12.5"})]})})}function pE({className:e}){return i.jsx(Tt,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),i.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:Sn,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),i.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),i.jsx("line",{x1:"8.5",y1:"4",x2:"10.5",y2:"4.5"}),i.jsx("line",{x1:"15.5",y1:"4",x2:"13.5",y2:"4.5"}),i.jsx("path",{d:"M9 15.5 C10 14.5 14 14.5 15 15.5"})]})})}function hE({className:e}){return i.jsx(Tt,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),i.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"9.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"}),i.jsx("circle",{cx:"14.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"})]}),legs:Sn,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),i.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),i.jsx("ellipse",{cx:"12",cy:"15",rx:"2",ry:"1.5",fill:"currentColor",stroke:"none"})]})})}function mE({className:e}){return i.jsx(Tt,{className:e,d:"M4.5 13 C4.5 8 7.5 6 12 6 C16.5 6 19.5 8 19.5 13 C19.5 17 16.5 18.5 12 18.5 C7.5 18.5 4.5 17 4.5 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"9.5",y1:"7",x2:"9",y2:"5"}),i.jsx("line",{x1:"14.5",y1:"7",x2:"15",y2:"5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"9",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"15",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"})]}),legs:Sn,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C3.5 9 2 9.5 2.5 12 C3 14 4 13 5 12"}),i.jsx("path",{d:"M19 11 C20.5 9 22 9.5 21.5 12 C21 14 20 13 19 12"}),i.jsx("path",{d:"M9 14.5 C10 16 14 16 15 14.5"}),i.jsx("circle",{cx:"7",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"}),i.jsx("circle",{cx:"17",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"})]})})}function gE({className:e}){return i.jsx(Tt,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5.5"}),i.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5.5"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"7.5",y1:"5.5",x2:"16.5",y2:"5.5"}),i.jsx("rect",{x:"7",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"}),i.jsx("rect",{x:"13",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"})]}),legs:Sn,extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),i.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),i.jsx("path",{d:"M9.5 15 C10.5 16 13.5 16 14.5 15"})]})})}function xE({className:e}){return i.jsx(Tt,{className:e,d:"M7 13.5 C7 10.5 9.5 9 12 9 C14.5 9 17 10.5 17 13.5 C17 16 14.5 17.5 12 17.5 C9.5 17.5 7 16 7 13.5 Z",eyeStalks:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"10.5",y1:"9.5",x2:"10.5",y2:"8"}),i.jsx("line",{x1:"13.5",y1:"9.5",x2:"13.5",y2:"8"})]}),eyes:i.jsxs(i.Fragment,{children:[i.jsx("circle",{cx:"10.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"13.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:i.jsxs(i.Fragment,{children:[i.jsx("line",{x1:"8",y1:"16",x2:"6.5",y2:"18"}),i.jsx("line",{x1:"10",y1:"17",x2:"9.5",y2:"19"}),i.jsx("line",{x1:"14",y1:"17",x2:"14.5",y2:"19"}),i.jsx("line",{x1:"16",y1:"16",x2:"17.5",y2:"18"})]}),extras:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M7.5 12 C6.5 11 5.5 11.5 6 13 C6.5 14 7 13.5 7.5 13"}),i.jsx("path",{d:"M16.5 12 C17.5 11 18.5 11.5 18 13 C17.5 14 17 13.5 16.5 13"})]})})}const Kr=[Km,aE,lE,cE,uE,dE,fE,pE,hE,mE,gE,xE];function os(e){return Kr[Math.abs(e)%Kr.length]??Km}function bE(e){const t=Kr.length-2;return t<=0?0:1+((Number.isFinite(e)?Math.trunc(e):0)%t+t)%t}function yE(e){return os(bE(e))}const vE="data:image/svg+xml,%3csvg%20height='2500'%20viewBox='0%206.603%201192.672%201193.397'%20width='2500'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m233.96%20800.215%20234.684-131.678%203.947-11.436-3.947-6.363h-11.436l-39.221-2.416-134.094-3.624-116.296-4.832-112.67-6.04-28.35-6.04-26.577-35.035%202.738-17.477%2023.84-16.027%2034.147%202.98%2075.463%205.155%20113.235%207.812%2082.147%204.832%20121.692%2012.644h19.329l2.738-7.812-6.604-4.832-5.154-4.832-117.182-79.41-126.845-83.92-66.443-48.321-35.92-24.484-18.12-22.953-7.813-50.093%2032.618-35.92%2043.812%202.98%2011.195%202.98%2044.375%2034.147%2094.792%2073.37%20123.786%2091.167%2018.12%2015.06%207.249-5.154.886-3.624-8.135-13.61-67.329-121.692-71.838-123.785-31.974-51.302-8.456-30.765c-2.98-12.645-5.154-23.275-5.154-36.242l37.127-50.416%2020.537-6.604%2049.53%206.604%2020.86%2018.121%2030.765%2070.39%2049.852%20110.818%2077.315%20150.684%2022.631%2044.698%2012.08%2041.396%204.51%2012.645h7.813v-7.248l6.362-84.886%2011.759-104.215%2011.436-134.094%203.946-37.772%2018.685-45.262%2037.127-24.482%2028.994%2013.852%2023.839%2034.148-3.303%2022.067-14.174%2092.134-27.785%20144.323-18.121%2096.644h10.55l12.08-12.08%2048.887-64.913%2082.147-102.685%2036.242-40.752%2042.282-45.02%2027.14-21.423h51.303l37.772%2056.135-16.913%2057.986-52.832%2067.007-43.812%2056.779-62.82%2084.563-39.22%2067.651%203.623%205.396%209.343-.886%20141.906-30.201%2076.671-13.852%2091.49-15.705%2041.396%2019.329%204.51%2019.65-16.269%2040.189-97.852%2024.16-114.764%2022.954-170.9%2040.43-2.093%201.53%202.416%202.98%2076.993%207.248%2032.94%201.771h80.617l150.12%2011.195%2039.222%2025.933%2023.517%2031.732-3.946%2024.16-60.403%2030.766-81.503-19.33-190.228-45.26-65.235-16.27h-9.02v5.397l54.362%2053.154%2099.624%2089.96%20124.752%20115.973%206.362%2028.671-16.027%2022.63-16.912-2.415-109.611-82.47-42.282-37.127-95.758-80.618h-6.363v8.456l22.067%2032.296%20116.537%20175.167%206.04%2053.719-8.456%2017.476-30.201%2010.55-33.181-6.04-68.215-95.758-70.39-107.84-56.778-96.644-6.926%203.947-33.503%20360.886-15.705%2018.443-36.243%2013.852-30.201-22.953-16.027-37.127%2016.027-73.37%2019.329-95.758%2015.704-76.107%2014.175-94.55%208.456-31.41-.563-2.094-6.927.886-71.275%2097.852-108.402%20146.497-85.772%2091.812-20.537%208.134-35.597-18.443%203.301-32.94%2019.893-29.315%20118.712-151.007%2071.597-93.583%2046.228-54.04-.322-7.813h-2.738l-315.302%20204.725-56.135%207.248-24.16-22.63%202.98-37.128%2011.435-12.08%2094.792-65.236-.322.323z'%20fill='%23d97757'/%3e%3c/svg%3e",wE="data:image/svg+xml,%3csvg%20height='2500'%20viewBox='-1%20-.1%20949.1%20959.8'%20width='2474'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m925.8%20456.3c10.4%2023.2%2017%2048%2019.7%2073.3%202.6%2025.3%201.3%2050.9-4.1%2075.8-5.3%2024.9-14.5%2048.8-27.3%2070.8-8.4%2014.7-18.3%2028.5-29.7%2041.2-11.3%2012.6-23.9%2024-37.6%2034-13.8%2010-28.5%2018.4-44.1%2025.3-15.5%206.8-31.7%2012-48.3%2015.4-7.8%2024.2-19.4%2047.1-34.4%2067.7-14.9%2020.6-33%2038.7-53.6%2053.6-20.6%2015-43.4%2026.6-67.6%2034.4-24.2%207.9-49.5%2011.8-75%2011.8-16.9.1-33.9-1.7-50.5-5.1-16.5-3.5-32.7-8.8-48.2-15.7s-30.2-15.5-43.9-25.5c-13.6-10-26.2-21.5-37.4-34.2-25%205.4-50.6%206.7-75.9%204.1-25.3-2.7-50.1-9.3-73.4-19.7-23.2-10.3-44.7-24.3-63.6-41.4s-35-37.1-47.7-59.1c-8.5-14.7-15.5-30.2-20.8-46.3s-8.8-32.7-10.6-49.6c-1.8-16.8-1.7-33.8.1-50.7%201.8-16.8%205.5-33.4%2010.8-49.5-17-18.9-31-40.4-41.4-63.6-10.3-23.3-17-48-19.6-73.3-2.7-25.3-1.3-50.9%204-75.8s14.5-48.8%2027.3-70.8c8.4-14.7%2018.3-28.6%2029.6-41.2s24-24%2037.7-34%2028.5-18.5%2044-25.3c15.6-6.9%2031.8-12%2048.4-15.4%207.8-24.3%2019.4-47.1%2034.3-67.7%2015-20.6%2033.1-38.7%2053.7-53.7%2020.6-14.9%2043.4-26.5%2067.6-34.4%2024.2-7.8%2049.5-11.8%2075-11.7%2016.9-.1%2033.9%201.6%2050.5%205.1s32.8%208.7%2048.3%2015.6c15.5%207%2030.2%2015.5%2043.9%2025.5%2013.7%2010.1%2026.3%2021.5%2037.5%2034.2%2024.9-5.3%2050.5-6.6%2075.8-4s50%209.3%2073.3%2019.6c23.2%2010.4%2044.7%2024.3%2063.6%2041.4%2018.9%2017%2035%2036.9%2047.7%2059%208.5%2014.6%2015.5%2030.1%2020.8%2046.3%205.3%2016.1%208.9%2032.7%2010.6%2049.6%201.8%2016.9%201.8%2033.9-.1%2050.8-1.8%2016.9-5.5%2033.5-10.8%2049.6%2017.1%2018.9%2031%2040.3%2041.4%2063.6zm-333.2%20426.9c21.8-9%2041.6-22.3%2058.3-39s30-36.5%2039-58.4c9-21.8%2013.7-45.2%2013.7-68.8v-223q-.1-.3-.2-.7-.1-.3-.3-.6-.2-.3-.5-.5-.3-.3-.6-.4l-80.7-46.6v269.4c0%202.7-.4%205.5-1.1%208.1-.7%202.7-1.7%205.2-3.1%207.6s-3%204.6-5%206.5a32.1%2032.1%200%200%201%20-6.5%205l-191.1%20110.3c-1.6%201-4.3%202.4-5.7%203.2%207.9%206.7%2016.5%2012.6%2025.5%2017.8%209.1%205.2%2018.5%209.6%2028.3%2013.2%209.8%203.5%2019.9%206.2%2030.1%208%2010.3%201.8%2020.7%202.7%2031.1%202.7%2023.6%200%2047-4.7%2068.8-13.8zm-455.1-151.4c11.9%2020.5%2027.6%2038.3%2046.3%2052.7%2018.8%2014.4%2040.1%2024.9%2062.9%2031s46.6%207.7%2070%204.6%2045.9-10.7%2066.4-22.5l193.2-111.5.5-.5q.2-.2.3-.6.2-.3.3-.6v-94l-233.2%20134.9c-2.4%201.4-4.9%202.4-7.5%203.2-2.7.7-5.4%201-8.2%201-2.7%200-5.4-.3-8.1-1-2.6-.8-5.2-1.8-7.6-3.2l-191.1-110.4c-1.7-1-4.2-2.5-5.6-3.4-1.8%2010.3-2.7%2020.7-2.7%2031.1s1%2020.8%202.8%2031.1c1.8%2010.2%204.6%2020.3%208.1%2030.1%203.6%209.8%208%2019.2%2013.2%2028.2zm-50.2-417c-11.8%2020.5-19.4%2043.1-22.5%2066.5s-1.5%2047.1%204.6%2070c6.1%2022.8%2016.6%2044.1%2031%2062.9%2014.4%2018.7%2032.3%2034.4%2052.7%2046.2l193.1%20111.6q.3.1.7.2h.7q.4%200%20.7-.2.3-.1.6-.3l81-46.8-233.2-134.6c-2.3-1.4-4.5-3.1-6.5-5a32.1%2032.1%200%200%201%20-5-6.5c-1.3-2.4-2.4-4.9-3.1-7.6-.7-2.6-1.1-5.3-1-8.1v-227.1c-9.8%203.6-19.3%208-28.3%2013.2-9%205.3-17.5%2011.3-25.5%2018-7.9%206.7-15.3%2014.1-22%2022.1-6.7%207.9-12.6%2016.5-17.8%2025.5zm663.3%20154.4c2.4%201.4%204.6%203%206.6%205%201.9%201.9%203.6%204.1%205%206.5%201.3%202.4%202.4%205%203.1%207.6.6%202.7%201%205.4.9%208.2v227.1c32.1-11.8%2060.1-32.5%2080.8-59.7%2020.8-27.2%2033.3-59.7%2036.2-93.7s-3.9-68.2-19.7-98.5-39.9-55.5-69.5-72.5l-193.1-111.6q-.3-.1-.7-.2h-.7q-.3.1-.7.2-.3.1-.6.3l-80.6%2046.6%20233.2%20134.7zm80.5-121h-.1v.1zm-.1-.1c5.8-33.6%201.9-68.2-11.3-99.7-13.1-31.5-35-58.6-63-78.2-28-19.5-61-30.7-95.1-32.2-34.2-1.4-68%206.9-97.6%2023.9l-193.1%20111.5q-.3.2-.5.5l-.4.6q-.1.3-.2.7-.1.3-.1.7v93.2l233.2-134.7c2.4-1.4%205-2.4%207.6-3.2%202.7-.7%205.4-1%208.1-1%202.8%200%205.5.3%208.2%201%202.6.8%205.1%201.8%207.5%203.2l191.1%20110.4c1.7%201%204.2%202.4%205.6%203.3zm-505.3-103.2c0-2.7.4-5.4%201.1-8.1.7-2.6%201.7-5.2%203.1-7.6%201.4-2.3%203-4.5%205-6.5%201.9-1.9%204.1-3.6%206.5-4.9l191.1-110.3c1.8-1.1%204.3-2.5%205.7-3.2-26.2-21.9-58.2-35.9-92.1-40.2-33.9-4.4-68.3%201-99.2%2015.5-31%2014.5-57.2%2037.6-75.5%2066.4-18.3%2028.9-28%2062.3-28%2096.5v223q.1.4.2.7.1.3.3.6.2.3.5.6.2.2.6.4l80.7%2046.6zm43.8%20294.7%20103.9%2060%20103.9-60v-119.9l-103.8-60-103.9%2060z'/%3e%3c/svg%3e",kE="data:image/svg+xml,%3csvg%20fill='none'%20height='1320'%20viewBox='3.771%206.973%2023.993%2017.652'%20width='2500'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='m27.501%208.469c-.252-.123-.36.111-.508.23-.05.04-.093.09-.135.135-.368.395-.797.652-1.358.621-.821-.045-1.521.213-2.14.842-.132-.776-.57-1.238-1.235-1.535-.349-.155-.701-.309-.944-.645-.171-.238-.217-.504-.303-.765-.054-.159-.108-.32-.29-.348-.197-.031-.274.135-.352.273-.31.567-.43%201.192-.419%201.825.028%201.421.628%202.554%201.82%203.36.136.093.17.186.128.321-.081.278-.178.547-.264.824-.054.178-.135.217-.324.14a5.448%205.448%200%200%201%20-1.719-1.169c-.848-.82-1.614-1.726-2.57-2.435-.225-.166-.449-.32-.681-.467-.976-.95.128-1.729.383-1.82.267-.096.093-.428-.77-.424s-1.653.293-2.659.677a2.782%202.782%200%200%201%20-.46.135%209.554%209.554%200%200%200%20-2.853-.1c-1.866.21-3.356%201.092-4.452%202.6-1.315%201.81-1.625%203.87-1.246%206.018.399%202.261%201.552%204.136%203.326%205.601%201.837%201.518%203.955%202.262%206.37%202.12%201.466-.085%203.1-.282%204.942-1.842.465.23.952.322%201.762.392.623.059%201.223-.031%201.687-.127.728-.154.677-.828.414-.953-2.132-.994-1.665-.59-2.09-.916%201.084-1.285%202.717-2.619%203.356-6.94.05-.343.007-.558%200-.837-.004-.168.034-.235.228-.254a4.084%204.084%200%200%200%201.529-.47c1.382-.757%201.938-1.997%202.07-3.485.02-.227-.004-.463-.243-.582zm-12.041%2013.391c-2.067-1.627-3.07-2.162-3.483-2.138-.387.021-.318.465-.233.754.089.285.205.482.368.732.113.166.19.414-.112.598-.666.414-1.823-.139-1.878-.166-1.347-.793-2.473-1.842-3.267-3.276-.765-1.38-1.21-2.861-1.284-4.441-.02-.383.093-.518.472-.586a4.692%204.692%200%200%201%201.514-.04c2.109.31%203.905%201.255%205.41%202.749.86.853%201.51%201.871%202.18%202.865.711%201.057%201.478%202.063%202.454%202.887.343.289.619.51.881.672-.792.088-2.117.107-3.022-.61zm.99-6.38a.304.304%200%201%201%20.609%200c0%20.17-.136.304-.306.304a.3.3%200%200%201%20-.303-.305zm3.077%201.581c-.197.08-.394.15-.584.159a1.246%201.246%200%200%201%20-.79-.252c-.27-.227-.463-.354-.546-.752a1.752%201.752%200%200%201%20.016-.582c.07-.324-.008-.531-.235-.72-.187-.155-.422-.196-.682-.196a.551.551%200%200%201%20-.252-.078c-.108-.055-.197-.19-.112-.356.027-.053.159-.183.19-.207.352-.201.758-.135%201.134.016.349.142.611.404.99.773.388.448.457.573.678.906.174.264.333.534.441.842.066.192-.02.35-.248.448z'%20fill='%234d6bfe'/%3e%3c/svg%3e",_E="/assets/minimax-BPMzvuL-.jpeg",SE="/assets/alibaba-TTwafVwX.svg",CE="/assets/qwen-CONDcHqt.png",jE="/assets/zhipuai-BPNAnxo-.svg",NE={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen","glm-":"zhipuai"};function Gm(e){if(e===null)return"unknown";const t=e.toLowerCase();for(const[n,r]of Object.entries(NE))if(t.startsWith(n.toLowerCase()))return r;return"unknown"}const $n={width:24,height:24,objectFit:"contain"},EE=ut.memo(({className:e})=>i.jsx("img",{src:vE,alt:"Anthropic",className:e,style:$n})),TE=ut.memo(({className:e})=>i.jsx("img",{src:wE,alt:"OpenAI",className:e,style:{...$n,background:"white",borderRadius:"4px"}})),AE=ut.memo(({className:e})=>i.jsx("img",{src:kE,alt:"DeepSeek",className:e,style:$n})),IE=ut.memo(({className:e})=>i.jsx("img",{src:_E,alt:"MiniMax",className:e,style:$n})),zE=ut.memo(({className:e})=>i.jsx("img",{src:SE,alt:"Alibaba",className:e,style:$n})),PE=ut.memo(({className:e})=>i.jsx("img",{src:CE,alt:"Qwen",className:e,style:$n})),RE=ut.memo(({className:e})=>i.jsx("img",{src:jE,alt:"ZhipuAI",className:e,style:$n}));function Jm({provider:e,className:t}){switch(e){case"anthropic":return i.jsx(EE,{className:t});case"openai":return i.jsx(TE,{className:t});case"deepseek":return i.jsx(AE,{className:t});case"minimax":return i.jsx(IE,{className:t});case"alibaba":return i.jsx(zE,{className:t});case"qwen":return i.jsx(PE,{className:t});case"zhipuai":return i.jsx(RE,{className:t});case"unknown":return null}}function nt({delayDuration:e=0,...t}){return i.jsx(pN,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Fe({...e}){return i.jsx(hN,{"data-slot":"tooltip",...e})}function $e({...e}){return i.jsx(mN,{"data-slot":"tooltip-trigger",...e})}function Be({className:e,sideOffset:t=0,children:n,...r}){return i.jsx(gN,{children:i.jsxs(xN,{"data-slot":"tooltip-content",sideOffset:t,className:xe("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,i.jsx(bN,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function Il(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Me(e,t){return e===null||typeof e!="object"||Array.isArray(e)?void 0:Object.getOwnPropertyDescriptor(e,t)?.value}const OE="x-anthropic-billing-header:";function ME(e){return e.trimStart().toLowerCase().startsWith(OE)}function LE(e){return Il(e)?Object.prototype.hasOwnProperty.call(e,"system"):!1}function DE(e){if(!Il(e))return!1;const t=Me(e,"type"),n=Me(e,"text");return typeof t!="string"||t!=="text"||typeof n!="string"?!1:ME(n)}function FE(e){let t;try{t=JSON.parse(e)}catch{return{body:e,removed:0}}if(!LE(t))return{body:e,removed:0};const n=t.system;if(!Array.isArray(n)||n.length===0)return{body:e,removed:0};const r=[];let o=0;for(const s of n){if(DE(s)){o+=1;continue}r.push(s)}return o===0?{body:e,removed:0}:(r.length===0?delete t.system:t.system=r,{body:JSON.stringify(t),removed:o})}function $E(e){return{depth:Number.POSITIVE_INFINITY}}function Ym(e){try{const t=JSON.parse(e);return{kind:"json",data:ss(t)}}catch{return{kind:"text"}}}function mi(e){const t=g.useMemo(()=>e===null?null:Ym(e),[e]),n=t?.kind==="json"?t.data:null,r=g.useMemo(()=>n===null?null:$E(),[n]),[o,s]=g.useState(!1),[a,l]=g.useState(0),[c,u]=g.useState(0),[d,f]=g.useTransition(),h=g.useCallback(()=>{const p=!o,y=p&&r!==null?r.depth:0;f(()=>{s(p),l(y),u(m=>m+1)})},[o,r]);return{parsedData:n,policy:r,isExpanded:o,toggle:h,isPending:d,bulkDepth:a,bulkRevision:c}}function ss(e){if(e==null)return null;switch(typeof e){case"string":return e;case"number":return e;case"boolean":return e;case"object":{if(Array.isArray(e))return e.map(n=>ss(n));const t={};for(const n of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,n);t[n]=ss(r?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function Xm({className:e,orientation:t="horizontal",...n}){return i.jsx(K5,{"data-slot":"tabs","data-orientation":t,orientation:t,className:xe("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",e),...n})}const BE=sl("rounded-lg p-[3px] group-data-[orientation=horizontal]/tabs:h-9 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Qm({className:e,variant:t="default",...n}){return i.jsx(G5,{"data-slot":"tabs-list","data-variant":t,className:xe(BE({variant:t}),e),...n})}function _t({className:e,...t}){return i.jsx(J5,{"data-slot":"tabs-trigger",className:xe("focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent","data-[state=active]:bg-background dark:data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 data-[state=active]:text-foreground","after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",e),...t})}function St({className:e,...t}){return i.jsx(Y5,{"data-slot":"tabs-content",className:xe("flex-1 outline-none",e),...t})}function en(e){const[t,n]=g.useState(!1),r=g.useRef(null);g.useEffect(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);const o=g.useCallback(s=>{s.stopPropagation(),e!==null&&Ot(e).then(a=>{a&&(n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),2e3))})},[e]);return{copied:t,copy:o}}const UE=g.lazy(()=>Ln(()=>import("./CompareDrawer-BLYcm6Dg.js"),__vite__mapDeps([0,1])).then(e=>({default:e.CompareDrawer}))),HE=g.lazy(()=>Ln(()=>import("./ReplayDialog-_kCy9L9E.js"),__vite__mapDeps([2,1,3])).then(e=>({default:e.ReplayDialog}))),WE=g.lazy(()=>Ln(()=>import("./RequestAnatomy-DWp5pWsv.js"),__vite__mapDeps([4,1])).then(e=>({default:e.RequestAnatomy}))),VE=g.lazy(()=>Ln(()=>import("./ResponseView-Ci92o6mt.js"),__vite__mapDeps([3,1])).then(e=>({default:e.ResponseView}))),ZE=g.lazy(()=>Ln(()=>import("./StreamingChunkSequence-C-1ZQl_b.js"),__vite__mapDeps([5,1])).then(e=>({default:e.StreamingChunkSequence}))),du=g.lazy(()=>Ln(()=>Promise.resolve().then(()=>Zg),void 0).then(e=>({default:e.JsonViewer}))),qE=g.lazy(()=>Ln(()=>Promise.resolve().then(()=>Zg),void 0).then(e=>({default:e.JsonViewerFromString}))),KE=1200,GE=12;function JE(e){const{containerRef:t,setExpandToPath:n,ensureTabActive:r,highlightMs:o}=e,s=g.useRef(null);return g.useCallback(a=>{r?.(),n(a.path);const l=f=>{f.scrollIntoView({behavior:"smooth",block:"center"}),f.classList.add("ring-2","ring-primary/60","ring-offset-1","ring-offset-background","rounded-sm","transition-shadow"),s.current!==null&&clearTimeout(s.current),s.current=setTimeout(()=>{f.classList.remove("ring-2","ring-primary/60","ring-offset-1","ring-offset-background","rounded-sm","transition-shadow"),n(null)},o??KE)},u=`[data-anatomy-path="${(f=>typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(f):f.replace(/(["'\\[\](){}])/g,"\\$1"))(a.path)}"]`,d=f=>{const h=t.current;if(h!==null){const p=h.querySelector(u);if(p!==null){l(p);return}}f>0?window.requestAnimationFrame(()=>d(f-1)):n(null)};window.requestAnimationFrame(()=>d(GE))},[t,r,o,n])}class eg{diff(t,n,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);const s=this.castInput(t,r),a=this.castInput(n,r),l=this.removeEmpty(this.tokenize(s,r)),c=this.removeEmpty(this.tokenize(a,r));return this.diffWithOptionsObj(l,c,r,o)}diffWithOptionsObj(t,n,r,o){var s;const a=v=>{if(v=this.postProcess(v,r),o){setTimeout(function(){o(v)},0);return}else return v},l=n.length,c=t.length;let u=1,d=l+c;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));const f=(s=r.timeout)!==null&&s!==void 0?s:1/0,h=Date.now()+f,p=[{oldPos:-1,lastComponent:void 0}];let y=this.extractCommon(p[0],n,t,0,r);if(p[0].oldPos+1>=c&&y+1>=l)return a(this.buildValues(p[0].lastComponent,n,t));let m=-1/0,x=1/0;const b=()=>{for(let v=Math.max(m,-u);v<=Math.min(x,u);v+=2){let w;const C=p[v-1],S=p[v+1];C&&(p[v-1]=void 0);let j=!1;if(S){const N=S.oldPos-v;j=S&&0<=N&&N<l}const E=C&&C.oldPos+1<c;if(!j&&!E){p[v]=void 0;continue}if(!E||j&&C.oldPos<S.oldPos?w=this.addToPath(S,!0,!1,0,r):w=this.addToPath(C,!1,!0,1,r),y=this.extractCommon(w,n,t,v,r),w.oldPos+1>=c&&y+1>=l)return a(this.buildValues(w.lastComponent,n,t))||!0;p[v]=w,w.oldPos+1>=c&&(x=Math.min(x,v-1)),y+1>=l&&(m=Math.max(m,v+1))}u++};if(o)(function v(){setTimeout(function(){if(u>d||Date.now()>h)return o(void 0);b()||v()},0)})();else for(;u<=d&&Date.now()<=h;){const v=b();if(v)return v}}addToPath(t,n,r,o,s){const a=t.lastComponent;return a&&!s.oneChangePerToken&&a.added===n&&a.removed===r?{oldPos:t.oldPos+o,lastComponent:{count:a.count+1,added:n,removed:r,previousComponent:a.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:n,removed:r,previousComponent:a}}}extractCommon(t,n,r,o,s){const a=n.length,l=r.length;let c=t.oldPos,u=c-o,d=0;for(;u+1<a&&c+1<l&&this.equals(r[c+1],n[u+1],s);)u++,c++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const o=[];let s;for(;t;)o.push(t),s=t.previousComponent,delete t.previousComponent,t=s;o.reverse();const a=o.length;let l=0,c=0,u=0;for(;l<a;l++){const d=o[l];if(d.removed)d.value=this.join(r.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let f=n.slice(c,c+d.count);f=f.map(function(h,p){const y=r[u+p];return y.length>h.length?y:h}),d.value=this.join(f)}else d.value=this.join(n.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return o}}class YE extends eg{constructor(){super(...arguments),this.tokenize=ng}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
|
94
94
|
`))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
|
|
95
95
|
`))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
|
|
96
96
|
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
@@ -114,4 +114,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
114
114
|
`},o),s}function _I(e,t){return e&&"run"in e?async function(n,r){const o=Yu(n,{file:r,...t});await e.run(o,r)}:function(n,r){return Yu(n,{file:r,...e||t})}}function Xu(e){if(e)throw e}var ki,Qu;function SI(){if(Qu)return ki;Qu=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},s=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var d=e.call(u,"constructor"),f=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!d&&!f)return!1;var h;for(h in u);return typeof h>"u"||e.call(u,h)},a=function(u,d){n&&d.name==="__proto__"?n(u,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):u[d.name]=d.newValue},l=function(u,d){if(d==="__proto__")if(e.call(u,d)){if(r)return r(u,d).value}else return;return u[d]};return ki=function c(){var u,d,f,h,p,y,m=arguments[0],x=1,b=arguments.length,v=!1;for(typeof m=="boolean"&&(v=m,m=arguments[1]||{},x=2),(m==null||typeof m!="object"&&typeof m!="function")&&(m={});x<b;++x)if(u=arguments[x],u!=null)for(d in u)f=l(m,d),h=l(u,d),m!==h&&(v&&h&&(s(h)||(p=o(h)))?(p?(p=!1,y=f&&o(f)?f:[]):y=f&&s(f)?f:{},a(m,{name:d,newValue:c(v,y,h)})):typeof h<"u"&&a(m,{name:d,newValue:h}));return m},ki}var CI=SI();const _i=Ia(CI);function va(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function jI(){const e=[],t={run:n,use:r};return t;function n(...o){let s=-1;const a=o.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);l(null,...o);function l(c,...u){const d=e[++s];let f=-1;if(c){a(c);return}for(;++f<o.length;)(u[f]===null||u[f]===void 0)&&(u[f]=o[f]);o=u,d?NI(d,l)(...u):a(null,...u)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function NI(e,t){let n;return r;function r(...a){const l=e.length>a.length;let c;l&&a.push(o);try{c=e.apply(this,a)}catch(u){const d=u;if(l&&n)throw d;return o(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(s,o):c instanceof Error?o(c):s(c))}function o(a,...l){n||(n=!0,t(a,...l))}function s(a){o(null,a)}}const Dt={basename:EI,dirname:TI,extname:AI,join:II,sep:"/"};function EI(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');so(e);let n=0,r=-1,o=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(s){n=o+1;break}}else r<0&&(s=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,l=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(s){n=o+1;break}}else a<0&&(s=!0,a=o+1),l>-1&&(e.codePointAt(o)===t.codePointAt(l--)?l<0&&(r=o):(l=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function TI(e){if(so(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function AI(e){so(e);let t=e.length,n=-1,r=0,o=-1,s=0,a;for(;t--;){const l=e.codePointAt(t);if(l===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),l===46?o<0?o=t:s!==1&&(s=1):o>-1&&(s=-1)}return o<0||n<0||s===0||s===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function II(...e){let t=-1,n;for(;++t<e.length;)so(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":zI(n)}function zI(e){so(e);const t=e.codePointAt(0)===47;let n=PI(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function PI(e,t){let n="",r=0,o=-1,s=0,a=-1,l,c;for(;++a<=e.length;){if(a<e.length)l=e.codePointAt(a);else{if(l===47)break;l=47}if(l===47){if(!(o===a-1||s===1))if(o!==a-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),o=a,s=0;continue}}else if(n.length>0){n="",r=0,o=a,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,a):n=e.slice(o+1,a),r=a-o-1;o=a,s=0}else l===46&&s>-1?s++:s=-1}return n}function so(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const RI={cwd:OI};function OI(){return"/"}function wa(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function MI(e){if(typeof e=="string")e=new URL(e);else if(!wa(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return LI(e)}function LI(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const Si=["history","path","basename","stem","extname","dirname"];class Ug{constructor(t){let n;t?wa(t)?n={path:t}:typeof t=="string"||DI(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":RI.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Si.length;){const s=Si[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let o;for(o in n)Si.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?Dt.basename(this.path):void 0}set basename(t){ji(t,"basename"),Ci(t,"basename"),this.path=Dt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Dt.dirname(this.path):void 0}set dirname(t){ed(this.basename,"dirname"),this.path=Dt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Dt.extname(this.path):void 0}set extname(t){if(Ci(t,"extname"),ed(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Dt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){wa(t)&&(t=MI(t)),ji(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Dt.basename(this.path,this.extname):void 0}set stem(t){ji(t,"stem"),Ci(t,"stem"),this.path=Dt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){const o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){const o=new it(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Ci(e,t){if(e&&e.includes(Dt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Dt.sep+"`")}function ji(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ed(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function DI(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const FI=(function(e){const r=this.constructor.prototype,o=r[e],s=function(){return o.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),$I={}.hasOwnProperty;class Vl extends FI{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=jI()}copy(){const t=new Vl;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(_i(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Ti("data",this.frozen),this.namespace[t]=n,this):$I.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Ti("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=jo(t),r=this.parser||this.Parser;return Ni("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ni("process",this.parser||this.Parser),Ei("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(s,a){const l=jo(t),c=r.parse(l);r.run(c,l,function(d,f,h){if(d||!f||!h)return u(d);const p=f,y=r.stringify(p,h);HI(y)?h.value=y:h.result=y,u(d,h)});function u(d,f){d||!f?a(d):s?s(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),Ni("processSync",this.parser||this.Parser),Ei("processSync",this.compiler||this.Compiler),this.process(t,o),nd("processSync","process",n),r;function o(s,a){n=!0,Xu(s),r=a}}run(t,n,r){td(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(a,l){const c=jo(n);o.run(t,c,u);function u(d,f,h){const p=f||t;d?l(d):a?a(p):r(void 0,p,h)}}}runSync(t,n){let r=!1,o;return this.run(t,n,s),nd("runSync","run",r),o;function s(a,l){Xu(a),o=l,r=!0}}stringify(t,n){this.freeze();const r=jo(n),o=this.compiler||this.Compiler;return Ei("stringify",o),td(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(Ti("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...f]=u;c(d,f)}else a(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function a(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(o.settings=_i(!0,o.settings,u.settings))}function l(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const f=u[d];s(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let f=-1,h=-1;for(;++f<r.length;)if(r[f][0]===u){h=f;break}if(h===-1)r.push([u,...d]);else if(d.length>0){let[p,...y]=d;const m=r[h][1];va(m)&&va(p)&&(p=_i(!0,m,p)),r[h]=[u,p,...y]}}}}const BI=new Vl().freeze();function Ni(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ei(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Ti(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function td(e){if(!va(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function nd(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function jo(e){return UI(e)?e:new Ug(e)}function UI(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function HI(e){return typeof e=="string"||WI(e)}function WI(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const VI="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",rd=[],od={allowDangerousHtml:!0},ZI=/^(https?|ircs?|mailto|xmpp)$/i,qI=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function sd(e){const t=KI(e),n=GI(e);return JI(t.runSync(t.parse(n),n),e)}function KI(e){const t=e.rehypePlugins||rd,n=e.remarkPlugins||rd,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...od}:od;return BI().use(EA).use(n).use(_I,r).use(t)}function GI(e){const t=e.children||"",n=new Ug;return typeof t=="string"&&(n.value=t),n}function JI(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,s=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||YI;for(const d of qI)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+VI+d.id,void 0);return Bg(e,u),aT(e,{Fragment:i.Fragment,components:o,ignoreInvalidStyle:!0,jsx:i.jsx,jsxs:i.jsxs,passKeys:!0,passNode:!0});function u(d,f,h){if(d.type==="raw"&&h&&typeof f=="number")return a?h.children.splice(f,1):h.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let p;for(p in yi)if(Object.hasOwn(yi,p)&&Object.hasOwn(d.properties,p)){const y=d.properties[p],m=yi[p];(m===null||m.includes(d.tagName))&&(d.properties[p]=c(String(y||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(d,f,h)),p&&h&&typeof f=="number")return l&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function YI(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||r!==-1&&t>r||ZI.test(e.slice(0,t))?e:""}function Hg(e){if(e===null)return"null";if(Array.isArray(e))return"array";switch(typeof e){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"object":return"object";case"bigint":case"symbol":case"undefined":case"function":return"object"}}function Lr(e){return e!==null&&(Array.isArray(e)||typeof e=="object")}function Wg(e){return Array.isArray(e)?e.map((t,n)=>[String(n),t]):typeof e=="object"&&e!==null?Object.entries(e):[]}const id=120;function XI({text:e}){const[t,n]=g.useState(!1);return e.length>id?i.jsxs("span",{className:"text-emerald-400 break-all",children:['"',t?i.jsx("span",{className:"cursor-pointer prose prose-sm dark:prose-invert inline max-w-none [&_p]:inline [&_p]:my-0 [&_code]:text-emerald-300 [&_a]:text-emerald-300",onClick:o=>{o.stopPropagation(),n(!1)},onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.stopPropagation(),n(!1))},role:"button",tabIndex:0,children:i.jsx(sd,{children:e})}):i.jsxs(Fe,{delayDuration:300,children:[i.jsxs($e,{onClick:o=>{o.stopPropagation(),n(!0)},className:"text-left cursor-pointer",children:[i.jsx("span",{children:e.slice(0,id)}),i.jsx("span",{className:"text-emerald-400/50",children:"…"})]}),i.jsxs(Be,{side:"bottom",className:"max-w-md text-xs p-2 break-words whitespace-pre-wrap",children:[e.slice(0,500),e.length>500?"…":""]})]}),'"']}):i.jsxs("span",{className:"text-emerald-400 break-all",children:['"',i.jsx("span",{className:"prose prose-sm dark:prose-invert inline max-w-none [&_p]:inline [&_p]:my-0 [&_code]:text-emerald-300 [&_a]:text-emerald-300",children:i.jsx(sd,{children:e})}),'"']})}function Vg({value:e}){if(e===null)return i.jsx("span",{className:"text-rose-400 italic",children:"null"});switch(typeof e){case"string":return i.jsx(XI,{text:e});case"number":return i.jsx("span",{className:"text-amber-400",children:e});case"boolean":return i.jsx("span",{className:"text-blue-400",children:e?"true":"false"});case"object":case"bigint":case"symbol":case"undefined":case"function":return i.jsx("span",{className:"text-muted-foreground",children:JSON.stringify(e)})}}function ad({value:e}){const[t,n]=g.useState(!1);function r(o){o.stopPropagation(),Ot(JSON.stringify(e,null,2)).then(s=>{s&&(n(!0),setTimeout(()=>{n(!1)},2e3))})}return i.jsx("button",{type:"button",onClick:r,className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors","aria-label":t?"Copied JSON":"Copy JSON",title:"Copy JSON",children:t?i.jsx(et,{className:"size-3 text-green-500"}):i.jsx(kt,{className:"size-3"})})}function QI({value:e}){const[t,n]=g.useState(!1);function r(o){o.stopPropagation(),Ot(JSON.stringify(e,null,2)).then(s=>{s&&(n(!0),setTimeout(()=>{n(!1)},2e3))})}return i.jsx("button",{type:"button",onClick:r,className:"opacity-0 group-hover/row:opacity-100 hover:bg-muted p-0.5 rounded transition-opacity shrink-0","aria-label":t?"Copied JSON value":"Copy JSON value",title:"Copy to clipboard",children:t?i.jsx(et,{className:"size-3 text-green-500"}):i.jsx(kt,{className:"size-3 text-muted-foreground"})})}function ez({onClick:e}){return i.jsx("button",{type:"button",onClick:e,className:"opacity-0 group-hover/row:opacity-100 hover:bg-muted p-0.5 rounded transition-opacity shrink-0",title:"Expand all descendants",children:i.jsx(np,{className:"size-3.5 text-muted-foreground"})})}const tz=g.memo(function e({name:t,value:n,level:r,defaultExpandDepth:o,isArrayItem:s,path:a,expandTargetPath:l,anatomyPaths:c}){const u=g.useMemo(()=>l===null?!1:a===""?l.length>0:l===a||l.startsWith(`${a}/`),[l,a]),d=r<o||u&&Lr(n),[f,h]=g.useState(d);g.useEffect(()=>{u&&Lr(n)&&!f&&h(!0)},[l]);const[p,y]=g.useState(0),[m,x]=g.useState(null),b=Lr(n),v=m===Number.POSITIVE_INFINITY,w=g.useMemo(()=>Wg(n),[n]),C=g.useMemo(()=>w.some(([,k])=>Lr(k)),[w]),S=Hg(n),j=S==="array"?"[":"{",E=S==="array"?"]":"}",N=c!==null&&c.has(a);function z(){h(!0),x(Number.POSITIVE_INFINITY),y(k=>k+1)}function M(){h(!1),x(0),y(k=>k+1)}function B(){v?M():h(!f)}function T(k){k.stopPropagation(),z()}const D=m??o;return i.jsxs("div",{className:xe(r>0&&"border-l border-border/50 ml-2"),children:[i.jsxs("div",{className:xe("flex items-start gap-1 py-0.5 px-1 -ml-1 rounded-sm group/row",b&&"cursor-pointer hover:bg-muted/50"),"data-anatomy-path":N?a:void 0,onClick:b?B:void 0,onKeyDown:b?k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),B())}:void 0,onDoubleClick:b&&C?()=>z():void 0,role:b?"button":void 0,tabIndex:b?0:void 0,children:[b?i.jsx("span",{className:"w-4 h-5 flex items-center justify-center shrink-0",children:f?i.jsx(wt,{className:"size-3 text-muted-foreground"}):i.jsx(Kt,{className:"size-3 text-muted-foreground"})}):i.jsx("span",{className:"w-4 shrink-0"}),i.jsx("span",{className:xe("shrink-0",s?"text-muted-foreground":"text-cyan-400"),children:s?t:`"${t}"`}),i.jsx("span",{className:"text-muted-foreground shrink-0",children:b?"":":"}),b?i.jsxs("span",{className:"text-muted-foreground",children:[j,i.jsxs("span",{className:"text-muted-foreground/60 text-xs",children:[" ",w.length," ",w.length===1?"item":"items"," ",E]})]}):i.jsx("span",{className:"min-w-0",children:i.jsx(Vg,{value:n})}),b&&C&&!v&&i.jsx(ez,{onClick:T}),i.jsx(QI,{value:n})]}),b&&f&&i.jsxs("div",{className:"pl-4",children:[w.map(([k,L])=>i.jsx(e,{name:k,value:L,level:r+1,defaultExpandDepth:D,isArrayItem:S==="array",path:a===""?`/${k}`:`${a}/${k}`,expandTargetPath:l,anatomyPaths:c},k)),i.jsx("div",{className:"text-muted-foreground py-0.5 px-1",children:E})]},p)]})});function Zl({data:e,defaultExpandDepth:t=0,className:n,showCopy:r=!1,bulkDepth:o,bulkRevision:s,anatomyPaths:a=null,expandToPath:l=null}){const c=Lr(e),u=g.useMemo(()=>Wg(e),[e]),d=o??t,f=s??0;if(!c)return i.jsx(nt,{children:i.jsx("div",{className:xe("font-mono text-xs leading-relaxed",n),children:i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(Vg,{value:e}),r&&i.jsx(ad,{value:e})]})})});const p=Hg(e)==="array";return i.jsx(nt,{children:i.jsxs("div",{className:xe("font-mono text-xs leading-relaxed",n),children:[r&&i.jsx("div",{className:"mb-2 flex items-center justify-end gap-2",children:i.jsx(ad,{value:e})}),u.length===0&&i.jsxs("div",{className:"rounded-md border border-white/10 bg-black/20 px-3 py-2 text-muted-foreground",children:[i.jsx("span",{className:"text-cyan-300",children:p?"[]":"{}"}),i.jsx("span",{className:"ml-2 text-[10px] uppercase",children:"0 items"})]}),i.jsx("div",{children:u.map(([y,m])=>i.jsx(tz,{name:y,value:m,level:0,defaultExpandDepth:d,isArrayItem:p,path:`/${y}`,expandTargetPath:l,anatomyPaths:a},y))},f)]})})}const nz=g.memo(function({text:t,defaultExpandDepth:n=0,className:r,bulkDepth:o,bulkRevision:s}){const a=g.useMemo(()=>Ym(t),[t]);return a.kind==="json"?i.jsx(Zl,{data:a.data,defaultExpandDepth:n,className:r,bulkDepth:o,bulkRevision:s}):i.jsx("pre",{className:xe("font-mono text-xs whitespace-pre-wrap break-words",r),children:t})}),Zg=Object.freeze(Object.defineProperty({__proto__:null,JsonViewer:Zl,JsonViewerFromString:nz},Symbol.toStringTag,{value:"Module"}));function rz({className:e,children:t,...n}){return i.jsxs(l5,{"data-slot":"scroll-area",className:xe("relative overflow-hidden",e),...n,children:[i.jsx(c5,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full max-h-[inherit] rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),i.jsx(oz,{}),i.jsx(u5,{})]})}function oz({className:e,orientation:t="vertical",...n}){return i.jsx(Bh,{"data-slot":"scroll-area-scrollbar",orientation:t,className:xe("flex touch-none p-px transition-colors select-none",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e),...n,children:i.jsx(Vh,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}const qg={file:"file",shell:"shell",browser:"browser",web:"web",mcp:"MCP",code:"code",other:"other"},sz={file:"border-blue-400/20 bg-blue-400/5 text-blue-300",shell:"border-teal-400/20 bg-teal-400/5 text-teal-300",browser:"border-cyan-400/20 bg-cyan-400/5 text-cyan-300",web:"border-sky-400/20 bg-sky-400/5 text-sky-300",mcp:"border-violet-400/20 bg-violet-400/5 text-violet-300",code:"border-emerald-400/20 bg-emerald-400/5 text-emerald-300",other:"border-muted-foreground/20 bg-muted/30 text-muted-foreground"};function iz({category:e}){switch(e){case"file":return i.jsx(pw,{className:"size-3.5"});case"shell":return i.jsx(tl,{className:"size-3.5"});case"browser":return i.jsx(Aw,{className:"size-3.5"});case"web":return i.jsx(op,{className:"size-3.5"});case"mcp":return i.jsx(v2,{className:"size-3.5"});case"code":return i.jsx(K2,{className:"size-3.5"});case"other":return i.jsx(ew,{className:"size-3.5"})}}function az({names:e}){return e.length===0?null:i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[i.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"required"}),e.slice(0,4).map(t=>i.jsx(ot,{variant:"outline",className:"h-5 max-w-36 truncate rounded-md px-1.5 py-0 font-mono text-[10px]",children:t},t)),e.length>4&&i.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:["+",e.length-4]})]})}function lz({tool:e,called:t}){const[n,r]=g.useState(!1),o=en(e.name),s=e.description!==null||e.requiredParameters.length>0||e.schema!==null;return i.jsx(I3,{open:n,onOpenChange:r,children:i.jsxs("div",{className:"rounded-md border border-white/10 bg-black/20 shadow-[inset_0_1px_0_rgba(255,255,255,0.03)]",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-2.5 py-2",children:[i.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>r(a=>!a),"aria-expanded":n,disabled:!s,children:[i.jsx(iz,{category:e.category}),i.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold text-foreground/90",children:e.name}),t&&i.jsx(ot,{variant:"outline",className:"h-5 rounded-md border-emerald-400/20 bg-emerald-400/5 px-1.5 py-0 text-[10px] text-emerald-300",children:"called"}),i.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:[e.parameterCount," params"]}),e.descriptionPreview!==null&&i.jsx("span",{className:"hidden min-w-0 truncate text-xs text-muted-foreground md:inline",children:e.descriptionPreview}),i.jsx("span",{className:"flex-1"}),s&&(n?i.jsx(wt,{className:"size-3.5 shrink-0 text-muted-foreground"}):i.jsx(Kt,{className:"size-3.5 shrink-0 text-muted-foreground"}))]}),i.jsx("button",{type:"button",className:"inline-flex size-7 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:o.copy,"aria-label":o.copied?"Copied tool name":"Copy tool name",children:o.copied?i.jsx(et,{className:"size-3.5 text-emerald-400"}):i.jsx(kt,{className:"size-3.5"})})]}),i.jsx(z3,{children:i.jsxs("div",{className:"space-y-2 border-t border-white/10 bg-white/[0.02] px-2.5 py-2",children:[e.description!==null&&i.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:e.description}),i.jsx(az,{names:e.requiredParameters}),e.schema!==null&&i.jsx(rz,{className:"max-h-64 rounded-md border border-white/10 bg-[#06080b] p-2",children:i.jsx(Zl,{data:ss(e.schema),defaultExpandDepth:0})})]})})]})})}function cz(e,t){return t.length===0?!0:`${e.name} ${e.description??""} ${qg[e.category]}`.toLowerCase().trim().includes(t)}const uz=g.memo(function({summary:t,calledToolNames:n}){const[r,o]=g.useState(!1),[s,a]=g.useState(""),l=g.useMemo(()=>new Set(n),[n]),c=s.trim().toLowerCase(),u=g.useMemo(()=>t===null?[]:t.tools.filter(h=>cz(h,c)),[c,t]);if(t===null)return null;const d=t.tools.slice(0,6),f=t.tools.length-d.length;return i.jsxs("section",{className:"mb-3 overflow-hidden rounded-md border border-white/10 bg-[#080b0f] shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]",children:[i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 px-3 py-2",children:[i.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[i.jsx(eo,{className:"size-4 shrink-0 text-sky-300/80"}),i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[i.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Request Tools"}),i.jsx(ot,{variant:"outline",className:"h-5 rounded-md px-1.5 py-0 font-mono text-[10px]",children:t.tools.length}),t.toolChoiceLabel!==null&&i.jsxs(ot,{variant:"outline",className:"h-5 rounded-md px-1.5 py-0 font-mono text-[10px] text-muted-foreground",children:["tool_choice: ",t.toolChoiceLabel]})]}),i.jsx("div",{className:"mt-1 flex min-w-0 flex-wrap gap-1",children:t.categories.map(h=>i.jsxs(ot,{variant:"outline",className:xe("h-5 rounded-md px-1.5 py-0 font-mono text-[10px]",sz[h.category]),children:[h.count," ",qg[h.category]]},h.category))})]})]}),i.jsxs(Ie,{type:"button",variant:"ghost",size:"sm",className:"h-7 border border-white/10 bg-black/20 px-2 text-muted-foreground hover:border-cyan-300/30 hover:bg-cyan-400/10 hover:text-cyan-100",onClick:()=>o(h=>!h),"aria-expanded":r,children:[r?i.jsx(wt,{className:"size-3.5"}):i.jsx(Kt,{className:"size-3.5"}),r?"Hide":"Show"]})]}),i.jsxs("div",{className:"flex min-w-0 flex-wrap gap-1.5 border-t border-white/10 bg-black/10 px-3 py-2",children:[d.map(h=>i.jsx(ot,{variant:"outline",className:xe("h-5 max-w-44 truncate rounded-md px-1.5 py-0 font-mono text-[10px]",l.has(h.name)&&"border-emerald-400/20 text-emerald-300"),children:h.name},h.name)),f>0&&i.jsxs("span",{className:"font-mono text-[10px] leading-5 text-muted-foreground",children:["+",f]})]}),r&&i.jsxs("div",{className:"space-y-2 border-t border-white/10 bg-black/15 px-3 py-3",children:[i.jsxs("label",{className:"flex h-8 items-center gap-2 rounded-md border border-white/10 bg-[#06080b] px-2 text-xs",children:[i.jsx(qw,{className:"size-3.5 shrink-0 text-muted-foreground"}),i.jsx("input",{value:s,onChange:h=>a(h.target.value),placeholder:"Filter tools",className:"min-w-0 flex-1 bg-transparent font-mono text-xs outline-none placeholder:text-muted-foreground/70"})]}),i.jsx("div",{className:"grid gap-1.5",children:u.length>0?u.map(h=>i.jsx(lz,{tool:h,called:l.has(h.name)},h.name)):i.jsx("p",{className:"py-2 text-xs text-muted-foreground",children:"No matching tools"})})]})]})}),on="agent-inspector:focus-log";function ka(e){window.dispatchEvent(new CustomEvent(on,{detail:e}))}function Ys(e){if(typeof CustomEvent>"u"||!(e instanceof CustomEvent))return null;const t=e.detail,n=Me(t,"logId");if(typeof n!="number"||!Number.isInteger(n)||n<0)return null;const r=Me(t,"tab");switch(r){case"anatomy":case"request":return{logId:n,tab:r};case void 0:return{logId:n,tab:"request"};default:return null}}function ld(e,t,n){return e==="anthropic"&&t==="full"&&n}function dz(e,t){return e==="full"&&t}function fz(e,t,n,r){return e==="anthropic"&&t==="full"&&n&&r}const pz=["file","shell","browser","web","mcp","code","other"];function _a(e){const t=e.replace(/\s+/g," ").trim();return t.length<=120?t:`${t.slice(0,119)}...`}function Kg(e){if(e===null)return null;const t=e.replace(/\s+/g," ").trim();if(t.length===0)return null;const n=t.search(/[.!?。!?]/);return n>=24?_a(t.slice(0,n+1)):_a(t)}function hz(e,t){return`${e} ${t??""}`.toLowerCase()}function Gn(e,t){return t.some(n=>e.includes(n))}function Gg(e,t){const n=hz(e,t);return e.startsWith("mcp__")||e.startsWith("inspector_")||Gn(n,[" mcp","model context protocol"])?"mcp":Gn(n,["bash","shell","terminal","command","powershell","exec","process"])?"shell":Gn(n,["browser","playwright","screenshot","click","navigate","page","tab"])?"browser":Gn(n,["read","write","edit","file","glob","grep","patch","filesystem","directory"])?"file":Gn(n,["web","search","http","url","fetch"])?"web":Gn(n,["code","typescript","javascript","python","repl"])?"code":"other"}function Jg(e){const t=Me(e,"properties");return t===null||typeof t!="object"||Array.isArray(t)?[]:Object.keys(t).sort((n,r)=>n.localeCompare(r))}function Yg(e){const t=Me(e,"required");if(!Array.isArray(t))return[];const n=[];for(const r of t)typeof r=="string"&&r.length>0&&n.push(r);return n.sort((r,o)=>r.localeCompare(o))}function mz(e){const t=Me(e,"name");if(typeof t!="string"||t.length===0)return null;const n=Me(e,"description"),r=Me(e,"input_schema")??null,o=typeof n=="string"?n:null;return{name:t,description:o,descriptionPreview:Kg(o),category:Gg(t,o),parameterCount:Jg(r).length,requiredParameters:Yg(r),schema:r}}function gz(e){const t=Me(e,"function"),n=Me(t,"name");if(typeof n!="string"||n.length===0)return null;const r=Me(t,"description"),o=Me(t,"parameters")??null,s=typeof r=="string"?r:null;return{name:n,description:s,descriptionPreview:Kg(s),category:Gg(n,s),parameterCount:Jg(o).length,requiredParameters:Yg(o),schema:o}}function xz(e){const t=gz(e);return t!==null?t:mz(e)}function bz(e){if(e==null)return null;if(typeof e=="string")return e;const t=Me(e,"type"),n=Me(e,"name"),r=Me(Me(e,"function"),"name");if(typeof t=="string"&&typeof r=="string"&&r.length>0)return`${t}: ${r}`;if(typeof t=="string"&&typeof n=="string"&&n.length>0)return`${t}: ${n}`;if(typeof t=="string")return t;const o=JSON.stringify(e);return o===void 0?null:_a(o)}function yz(e){const t=new Map;for(const n of e)t.set(n.category,(t.get(n.category)??0)+1);return pz.flatMap(n=>{const r=t.get(n)??0;return r>0?[{category:n,count:r}]:[]})}function vz(e){const t=Me(e,"tools");if(!Array.isArray(t)||t.length===0)return null;const n=[];for(const r of t){const o=xz(r);o!==null&&n.push(o)}return n.length===0?null:{tools:n,toolChoiceLabel:bz(Me(e,"tool_choice")),categories:yz(n)}}function Jn(){return i.jsx("div",{className:"h-1","aria-hidden":"true"})}function wz(e,t){switch(e){case"anatomy":return t===null?"request":"anatomy";case"request":return"request"}}const Nn="h-9 flex-none rounded-none border-0 border-b-2 border-transparent bg-transparent px-3 text-xs font-semibold text-muted-foreground shadow-none hover:bg-cyan-400/[0.04] hover:text-foreground data-[state=active]:border-cyan-300 data-[state=active]:bg-transparent data-[state=active]:text-cyan-100 data-[state=active]:shadow-none";function kz(e){return e.bodyContentMode==="compact"||e.bodyContentMode==="truncated"}function En({children:e,className:t}){return i.jsx("div",{className:xe("inspector-scrollbar mx-3 mb-3 max-h-[72vh] overflow-auto rounded-md border border-white/10 bg-[#06080b] p-3 shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]",t),children:e})}function Fo({children:e}){return i.jsx("div",{className:"rounded-md border border-dashed border-white/10 bg-white/[0.02] px-3 py-5 text-center text-xs italic text-muted-foreground",children:e})}function cd({children:e}){return i.jsx("pre",{className:"inspector-scrollbar max-h-[64vh] overflow-auto whitespace-pre-wrap break-words rounded-md border border-white/10 bg-black/30 p-3 font-mono text-xs leading-relaxed text-muted-foreground",children:e})}const _z={loading:"border-cyan-400/25 bg-cyan-400/[0.06] text-cyan-100",warning:"border-amber-400/25 bg-amber-400/[0.08] text-amber-100",danger:"border-rose-400/25 bg-rose-400/[0.08] text-rose-100"};function No({tone:e,title:t,children:n}){return i.jsxs("div",{className:xe("mb-3 rounded-md border px-3 py-2 text-xs shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]",_z[e]),children:[t!==void 0&&i.jsx("div",{className:"mb-1 font-semibold",children:t}),i.jsx("div",{className:"leading-relaxed text-muted-foreground",children:n})]})}function ud({headers:e,emptyLabel:t}){const n=e===void 0?[]:Object.entries(e).sort(([r],[o])=>r.localeCompare(o));return n.length===0?i.jsx(Fo,{children:t}):i.jsx("div",{className:"overflow-hidden rounded-md border border-white/10 bg-black/20 font-mono text-xs",children:n.map(([r,o])=>i.jsxs("div",{className:"grid min-w-0 grid-cols-[minmax(140px,0.32fr)_minmax(0,1fr)] border-b border-white/5 last:border-b-0",children:[i.jsx("div",{className:"min-w-0 truncate border-r border-white/5 bg-white/[0.03] px-2.5 py-2 font-semibold text-cyan-200",children:r}),i.jsx("div",{className:"min-w-0 truncate px-2.5 py-2 text-muted-foreground",title:o,children:o})]},r))})}function Sz({active:e,onClick:t}){return i.jsxs(Fe,{children:[i.jsx($e,{asChild:!0,children:i.jsxs(Ie,{variant:e?"default":"outline",size:"sm",className:xe("h-8 border-white/10 text-xs shadow-none",e?"bg-cyan-300 text-black hover:bg-cyan-200":"bg-[#0a0d11] text-muted-foreground hover:border-cyan-300/30 hover:bg-cyan-400/10 hover:text-cyan-100"),onClick:t,"aria-pressed":e,children:[i.jsx(gw,{className:"size-3.5 mr-1"}),e?"Showing diff":"Diff with Raw"]})}),i.jsx(Be,{children:e?"Hide diff view":"Compare proxy output against the original raw version"})]})}const Cz=g.memo(function({rawBody:e,displayedBody:t,emptyLabel:n}){const r=g.useMemo(()=>r3(e,t),[e,t]);return i.jsx(ag,{result:r,emptyLabel:n})}),jz=g.memo(function({rawHeaders:e,headers:t,emptyLabel:n}){const r=g.useMemo(()=>n3(e,t),[e,t]);return i.jsx(ag,{result:r,emptyLabel:n})}),Nz=g.memo(function({log:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,timeDisplayFormat:o,cacheTrend:s=null,onCompareWithPrevious:a}){const[l,c]=g.useState(!1),[u,d]=g.useState(!1),[f,h]=g.useState(!1),[p,y]=g.useState(!1),[m,x]=g.useState("request"),[b,v]=g.useState(null),[w,C]=g.useState(null),[S,j]=g.useState("idle"),E=g.useRef(null),N=w??e,z=Mn(N),M=Vm(z),B=g.useMemo(()=>M.analyzeRequest(N.rawRequestBody),[M,N.rawRequestBody]),T=g.useMemo(()=>M.analyzeResponse(N.responseText),[M,N.responseText]),k=g.useMemo(()=>!n||z!=="anthropic"||N.rawRequestBody===null?null:FE(N.rawRequestBody).body,[N.rawRequestBody,z,n])??N.rawRequestBody,L=mi(k),W=mi(N.rawRequestBody),U=mi(N.responseText),$=g.useMemo(()=>N.headers&&Object.keys(N.headers).length>0?JSON.stringify(N.headers,null,2):null,[N.headers]),G=g.useMemo(()=>N.rawHeaders&&Object.keys(N.rawHeaders).length>0?JSON.stringify(N.rawHeaders,null,2):null,[N.rawHeaders]),A=en(k),K=en(N.rawRequestBody),q=en($),P=en(G),ie=en(N.responseText),le=g.useMemo(()=>({request:{copyLabel:"Copy request body",copyText:k,copyCopied:A.copied,onCopy:A.copy,expansion:{isExpanded:L.isExpanded,isPending:L.isPending,onToggle:L.toggle},diffWithRaw:fz(z,t,n,N.rawRequestBody!==null)?{active:p,onToggle:()=>y(!p)}:void 0,diffWithPrevious:a===void 0?void 0:()=>{a(N)}},"raw-request":{copyLabel:"Copy raw request",copyText:N.rawRequestBody,copyCopied:K.copied,onCopy:K.copy,expansion:{isExpanded:W.isExpanded,isPending:W.isPending,onToggle:W.toggle}},headers:{copyLabel:"Copy headers",copyText:$,copyCopied:q.copied,onCopy:q.copy,expansion:null},"raw-headers":{copyLabel:"Copy raw headers",copyText:G,copyCopied:P.copied,onCopy:P.copy,expansion:null},raw:{copyLabel:"Copy response",copyText:N.responseText,copyCopied:ie.copied,onCopy:ie.copy,expansion:{isExpanded:U.isExpanded,isPending:U.isPending,onToggle:U.toggle}}}),[k,A,L,p,N,N.rawRequestBody,K,W,$,q,G,P,N.responseText,ie,U,z,t,n,a]),ge=g.useMemo(()=>L.parsedData!==null?M.anatomySegments(L.parsedData):null,[M,L.parsedData]),ne=g.useMemo(()=>vz(L.parsedData),[L.parsedData]),ue=N.warnings??[],de=g.useMemo(()=>{if(ge!==null)return new Set(ge.map(fe=>fe.path))},[ge]),he=JE({containerRef:E,setExpandToPath:v,ensureTabActive:()=>{m!=="request"&&x("request")}}),me=g.useCallback(()=>{const fe=!l;fe&&x(ge!==null?"anatomy":"request"),c(fe)},[ge,l]);return g.useEffect(()=>{C(null),j("idle")},[e.id]),g.useEffect(()=>{if(!l||!kz(e)||w!==null||S!=="idle")return;let fe=!1;return j("loading"),an(`/api/logs/${String(e.id)}`,Ho).then(Se=>{fe||(C(Se),j("idle"))}).catch(()=>{fe||j("failed")}),()=>{fe=!0}},[S,l,w,e.bodyContentMode,e.id]),g.useEffect(()=>{const fe=Se=>{const _=Ys(Se);_!==null&&_.logId===e.id&&(c(!0),x(wz(_.tab,ge)))};return window.addEventListener(on,fe),()=>{window.removeEventListener(on,fe)}},[ge,e.id]),i.jsxs(nt,{children:[i.jsxs("div",{className:xe("mb-2 overflow-hidden rounded-md border bg-[#090a0d] transition-[background-color,border-color,box-shadow]",l?"border-cyan-300/20 shadow-[0_18px_60px_rgba(0,0,0,0.28),inset_0_1px_0_rgba(255,255,255,0.05)]":"border-border/70 hover:border-border"),children:[i.jsx(A3,{log:N,messageCount:B.messageCount,toolCount:B.toolCount,expanded:l,onToggle:me,cacheTrend:s,slowResponseThresholdSeconds:r,timeDisplayFormat:o,activeTab:m,tabActions:le,onReplay:a===void 0?void 0:()=>{d(!0)}}),l&&i.jsx("div",{className:"border-t border-white/10 bg-[#050607]/80 pt-2",onClick:fe=>fe.stopPropagation(),onKeyDown:fe=>fe.stopPropagation(),children:i.jsxs(Xm,{value:m,onValueChange:x,className:"gap-2",children:[i.jsxs(Qm,{variant:"line",className:"inspector-scrollbar mx-3 h-auto w-[calc(100%-1.5rem)] justify-start overflow-x-auto rounded-none border-b border-white/10 bg-transparent p-0",children:[t==="full"&&i.jsx(_t,{className:Nn,value:"raw-headers",children:"Raw Headers"}),t==="full"&&i.jsx(_t,{className:Nn,value:"headers",children:"Headers"}),ge!==null&&i.jsx(_t,{className:Nn,value:"anatomy",children:"Context"}),ld(z,t,n)&&i.jsx(_t,{className:Nn,value:"raw-request",children:"Raw Request"}),i.jsx(_t,{className:Nn,value:"request",children:"Request"}),t==="full"&&i.jsx(_t,{className:Nn,value:"raw",children:"Raw Response"}),i.jsx(_t,{className:Nn,value:"parsed",children:"Response"})]}),ld(z,t,n)&&i.jsx(St,{value:"raw-request",children:m==="raw-request"&&i.jsx(En,{children:N.rawRequestBody===null?i.jsx(Fo,{children:"No request body"}):W.parsedData!==null?i.jsx(g.Suspense,{fallback:i.jsx(Jn,{}),children:i.jsx(du,{data:W.parsedData,bulkDepth:W.bulkDepth,bulkRevision:W.bulkRevision})}):i.jsx(cd,{children:N.rawRequestBody})})}),i.jsx(St,{value:"request",children:m==="request"&&i.jsxs(En,{children:[S==="loading"&&i.jsx(No,{tone:"loading",children:"Loading full request and response bodies..."}),S==="failed"&&i.jsx(No,{tone:"warning",children:"Full request and response bodies could not be loaded. Compact metadata is still available."}),ue.length>0&&i.jsxs(No,{tone:"warning",children:[i.jsxs("div",{className:"flex items-center gap-2 font-semibold text-amber-300",children:[i.jsx(tr,{className:"size-3.5"}),"Tool schema warnings"]}),i.jsx("ul",{className:"mt-2 space-y-1 text-muted-foreground",children:ue.map(fe=>i.jsx("li",{children:fe},fe))})]}),i.jsx(uz,{summary:ne,calledToolNames:T.toolNames??[]}),p?i.jsx(Cz,{rawBody:N.rawRequestBody,displayedBody:k,emptyLabel:"No transformation applied; raw and sent request bodies are identical."}):i.jsx("div",{ref:E,children:k===null?i.jsx(Fo,{children:"No request body"}):L.parsedData!==null?i.jsx(g.Suspense,{fallback:i.jsx(Jn,{}),children:i.jsx(du,{data:L.parsedData,bulkDepth:L.bulkDepth,bulkRevision:L.bulkRevision,anatomyPaths:de,expandToPath:b})}):i.jsx(cd,{children:k})})]})}),ge!==null&&i.jsx(St,{value:"anatomy",children:m==="anatomy"&&i.jsx(En,{className:"p-0",children:i.jsx(g.Suspense,{fallback:i.jsx(Jn,{}),children:i.jsx(WE,{parsed:L.parsedData,inputTokens:N.inputTokens??null,model:N.model,segments:ge,onSegmentActivate:he})})})}),t==="full"&&i.jsx(St,{value:"headers",children:m==="headers"&&i.jsxs(En,{children:[i.jsx("div",{className:"flex justify-end gap-2 mb-2",children:dz(t,N.rawHeaders!==void 0&&Object.keys(N.rawHeaders).length>0)&&i.jsx(Sz,{active:f,onClick:fe=>{fe.stopPropagation(),h(!f)}})}),f?i.jsx(jz,{rawHeaders:N.rawHeaders,headers:N.headers,emptyLabel:"No transformation applied; raw and processed headers are identical."}):i.jsx(ud,{headers:N.headers,emptyLabel:"No headers captured"})]})}),t==="full"&&i.jsx(St,{value:"raw-headers",children:m==="raw-headers"&&i.jsx(En,{children:i.jsx(ud,{headers:N.rawHeaders,emptyLabel:"No raw headers captured"})})}),i.jsx(St,{value:"raw",children:m==="raw"&&i.jsxs(En,{className:"space-y-3",children:[N.error!==void 0&&N.error!==null&&i.jsx(No,{tone:"danger",title:"SSE Error",children:i.jsx("span",{className:"font-mono",children:N.error})}),N.responseText!==null?i.jsx(g.Suspense,{fallback:i.jsx(Jn,{}),children:i.jsx(qE,{text:N.responseText,defaultExpandDepth:0,bulkDepth:U.bulkDepth,bulkRevision:U.bulkRevision})}):i.jsx(Fo,{children:"No response"}),N.streaming===!0&&i.jsx(g.Suspense,{fallback:i.jsx(Jn,{}),children:i.jsx(ZE,{logId:N.id,truncated:N.streamingChunksPath!==null})})]})}),i.jsx(St,{value:"parsed",children:m==="parsed"&&i.jsx(En,{children:i.jsx(g.Suspense,{fallback:i.jsx(Jn,{}),children:i.jsx(VE,{responseText:N.responseText,responseStatus:N.responseStatus,streaming:N.streaming,inputTokens:N.inputTokens,outputTokens:N.outputTokens,cacheCreationInputTokens:N.cacheCreationInputTokens,cacheReadInputTokens:N.cacheReadInputTokens,apiFormat:z,error:N.error})})})})]})})]}),i.jsx(g.Suspense,{fallback:null,children:i.jsx(HE,{log:N,open:u,onOpenChange:d})})]})});function Ez({stopReason:e,isPending:t,isFirst:n,isTurnStart:r,isOnlyEntry:o=!1,crabIndex:s=0,collapsible:a=!1,onToggle:l}){const c=e==="end_turn"||e==="stop",u=o&&r&&c,d=t&&!c,f=g.useMemo(()=>os(s),[s]),h=g.useMemo(()=>yE(s),[s]),p=a&&l?{role:"button",tabIndex:0,className:"cursor-pointer",onClick:y=>{y.stopPropagation(),l()},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),l())}}:{};return i.jsxs("div",{className:"flex flex-col items-center w-6 shrink-0 pt-0.5 pb-0.5",children:[i.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]",children:!n&&i.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),u?i.jsx("span",{title:"Start and end of turn",children:i.jsx(h,{className:xe("size-3.5 text-[#80FF00]","animate-crab-settle","drop-shadow-[0_0_4px_rgba(128,255,0,0.5)]")})}):c?i.jsx("span",{title:e==="end_turn"?"End of Turn (Anthropic)":"End of Turn (OpenAI)",...p,children:i.jsx(f,{className:xe("size-3.5 text-amber-400","animate-crab-settle","drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})}):r?i.jsx("span",{title:"Start of turn",...p,children:i.jsx(f,{className:xe("size-3.5 text-emerald-400","animate-crab-appear","drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}):d?i.jsx("span",{title:"Processing…",children:i.jsx(f,{className:xe("size-3.5 text-amber-300/80","animate-crab-crawl")})}):i.jsx("span",{children:i.jsx(f,{className:"size-3.5 text-muted-foreground/40"})}),i.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:!c&&i.jsx("div",{className:xe("w-0.5 h-full",t?"border-dashed bg-transparent border-l-2 border-muted-foreground/20":"bg-muted-foreground/30")})})]})}function Tz({event:e}){const t=en(e.argumentsText),n=e.argumentsText!==null;return i.jsxs("div",{className:"group/tool-trace flex min-w-0 items-center gap-2 rounded-md border border-border/70 bg-muted/20 px-2.5 py-1.5 text-xs",children:[i.jsx(eo,{className:"size-3.5 shrink-0 text-sky-400/70"}),i.jsx("span",{className:"font-mono font-semibold text-foreground/80",children:e.name}),e.argumentsPreview!==null&&i.jsxs(i.Fragment,{children:[i.jsx(Kt,{className:"size-3 shrink-0 text-muted-foreground/60"}),i.jsx("span",{className:"min-w-0 truncate font-mono text-muted-foreground",children:e.argumentsPreview})]}),n&&i.jsx("button",{type:"button",className:"ml-auto inline-flex size-6 shrink-0 items-center justify-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-background/80 hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/tool-trace:opacity-100 group-focus-within/tool-trace:opacity-100",onClick:t.copy,"aria-label":t.copied?"Copied tool arguments":"Copy tool arguments",title:t.copied?"Copied tool arguments":"Copy tool arguments",children:t.copied?i.jsx(et,{className:"size-3.5"}):i.jsx(kt,{className:"size-3.5"})})]},e.id)}function Az({events:e}){return e.length===0?null:i.jsx("div",{className:"mx-3 mb-2 grid gap-1.5",children:e.map(t=>i.jsx(Tz,{event:t},t.id))})}const dd=180;function Iz(e,t){return e||t}function zz(e,t,n){return e>1&&t&&!n}function Pz(e){const t=[];let n=[],r=0;for(const o of e){n.push({log:o,stopReason:iE(o)});const s=n[n.length-1];s!==void 0&&Zm(s.stopReason)&&(t.push({entries:n,turnIndex:r}),n=[],r+=1)}return n.length>0&&t.push({entries:n,turnIndex:r}),t}function Rz(e){const t=new Map;for(const n of e)for(let r=1;r<n.logs.length;r+=1){const o=n.logs[r],s=n.logs[r-1];if(o===void 0||s===void 0)continue;const a=Mn(o),l=Mn(s);a==="unknown"||a!==l||t.set(o.id,s)}return t}function Xg(e){if(e===null)return null;try{const t=JSON.parse(e);return typeof t=="string"?JSON.parse(t):t}catch{return null}}function Qg(e){if(e==null)return null;const t=typeof e=="string"?e:JSON.stringify(e);if(t===void 0)return null;const n=t.replace(/\s+/g," ").trim();return n.length===0?null:n.length>dd?`${n.slice(0,dd-1)}...`:n}function ex(e){if(e==null)return null;if(typeof e=="string")return e.length>0?e:null;const t=JSON.stringify(e,null,2);return t===void 0||t.length===0?null:t}function Oz(e){const t=Xg(e.responseText),n=Me(t,"content");if(!Array.isArray(n))return[];const r=[];for(const o of n){if(Me(o,"type")!=="tool_use")continue;const a=Me(o,"name");if(typeof a!="string"||a.length===0)continue;const l=Me(o,"input");r.push({id:`${String(e.id)}-anthropic-tool-${String(r.length)}`,logId:e.id,index:r.length,provider:"anthropic",name:a,argumentsText:ex(l),argumentsPreview:Qg(l)})}return r}function Mz(e){const t=Xg(e.responseText),n=Me(t,"choices");if(!Array.isArray(n))return[];const r=[];for(const o of n){const s=Me(o,"message"),a=Me(s,"tool_calls");if(Array.isArray(a))for(const l of a){const c=Me(l,"function"),u=Me(c,"name");if(typeof u!="string"||u.length===0)continue;const d=Me(c,"arguments");r.push({id:`${String(e.id)}-openai-tool-${String(r.length)}`,logId:e.id,index:r.length,provider:"openai",name:u,argumentsText:ex(d),argumentsPreview:Qg(d)})}}return r}function ql(e){switch(Mn(e)){case"anthropic":return Oz(e);case"openai":return Mz(e);case"unknown":return[]}}function Lz(e,t,n=0){let r=0,o=0,s=0,a=0,l=0,c=0,u=0,d=0,f=null,h=0;for(const p of e)p.responseStatus===null?o+=1:p.responseStatus>=400&&(r+=1),p.elapsedMs!==null&&t>0&&p.elapsedMs>t*1e3&&(s+=1),p.inputTokens!==null&&(a+=p.inputTokens),p.outputTokens!==null&&(l+=p.outputTokens),p.cacheCreationInputTokens!==null&&(c+=p.cacheCreationInputTokens),p.cacheReadInputTokens!==null&&(u+=p.cacheReadInputTokens),p.elapsedMs!==null&&(d+=p.elapsedMs,f=f===null?p.elapsedMs:Math.max(f,p.elapsedMs)),h+=ql(p).length;return{llmCallCount:e.length,toolCallCount:h,failedCallCount:r,pendingCallCount:o,slowCallCount:s,totalInputTokens:a,totalOutputTokens:l,totalCacheCreationInputTokens:c,totalCacheReadInputTokens:u,totalElapsedMs:d,maxElapsedMs:f,startedAt:e[0]?.timestamp??null,endedAt:e[e.length-1]?.timestamp??null,knowledgeCandidateCount:n}}function Ai(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const Dz=g.memo(function({entries:t,viewMode:n,strip:r,slowResponseThresholdSeconds:o,cacheTrends:s,onCompareWithPrevious:a,comparisonPredecessors:l,turnIndex:c=0,timeDisplayFormat:u}){const d=t.length-1,f=t[d]?.stopReason??null,h=f!==null?Zm(f):!1,p=t[d]?.log.responseStatus===null,y=t.length===1,m=zz(t.length,h,p),[x,b]=g.useState(!1),v=g.useRef(!1);g.useEffect(()=>{m?h&&!v.current&&b(!0):b(!1),v.current=h},[m,h]),g.useEffect(()=>{const W=U=>{const $=Ys(U);$!==null&&t.some(G=>G.log.id===$.logId)&&m&&b(!1)};return window.addEventListener(on,W),()=>{window.removeEventListener(on,W)}},[m,t]);const w=g.useCallback(()=>{m&&b(W=>!W)},[m]),C=g.useMemo(()=>{let W=0,U=0,$=null,G=!1;for(const A of t)A.log.inputTokens!==null&&(W+=A.log.inputTokens,G=!0),A.log.outputTokens!==null&&(U+=A.log.outputTokens,G=!0),A.log.elapsedMs!==null&&($=$===null?A.log.elapsedMs:Math.max($,A.log.elapsedMs));return{totalInput:W,totalOutput:U,hasTokens:G,maxElapsed:$}},[t,d]),S=g.useMemo(()=>{const W=new Set;for(const U of t){const $=Gm(U.log.model);$!=="unknown"&&W.add($)}return[...W]},[t]),j=g.useMemo(()=>os(t[0]?.log.id??0),[t]),E=g.useMemo(()=>os(t[d]?.log.id??0),[t,d]),N=c%2===0?"bg-muted/10":"bg-muted/25",z=C.maxElapsed!==null&&o>0&&C.maxElapsed>o*1e3,M=g.useMemo(()=>{const W=new Map;for(const U of t){const $=ql(U.log);$.length>0&&W.set(U.log.id,$)}return W},[t]),[B,T]=g.useState(0),D=g.useRef(null);g.useEffect(()=>{const W=D.current;if(!W)return;let U=0;const $=new ResizeObserver(()=>{window.cancelAnimationFrame(U),U=window.requestAnimationFrame(()=>T(G=>G+1))});return $.observe(W),()=>{$.disconnect(),window.cancelAnimationFrame(U)}},[]);const k=t[0]?.log.id??c,L=`Turn ${String(c+1)}`;return i.jsx("div",{ref:D,tabIndex:x?void 0:0,role:x?void 0:"group","aria-label":x?void 0:L,"data-nav-id":x?void 0:`turn-${String(k)}`,className:xe("border rounded-lg",p?"border-amber-500/10":"border-transparent",!x&&"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),children:x?i.jsxs("div",{"data-nav-id":`turn-collapsed-${String(k)}`,"data-nav-action":"expand",role:"button",tabIndex:0,className:"flex items-stretch cursor-pointer focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none rounded-lg",onClick:w,onKeyDown:W=>{(W.key==="Enter"||W.key===" ")&&(W.preventDefault(),w())},children:[i.jsx("div",{className:"w-5 shrink-0 flex items-start pt-1.5",children:i.jsx("span",{className:"text-[10px] text-muted-foreground/50 font-mono tabular-nums leading-none select-none",children:c+1})}),i.jsxs("div",{className:"w-6 shrink-0 flex flex-col items-center pt-0.5 pb-0.5",children:[i.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]"}),i.jsx("span",{role:"button",tabIndex:0,title:"Start of turn — click to expand",className:"cursor-pointer",onClick:W=>{W.stopPropagation(),w()},onKeyDown:W=>{(W.key==="Enter"||W.key===" ")&&(W.preventDefault(),w())},children:i.jsx(j,{className:xe("size-3.5 text-emerald-400","animate-crab-appear drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}),i.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:i.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),i.jsx("span",{role:"button",tabIndex:0,title:"End of Turn — click to expand",className:"cursor-pointer",onClick:W=>{W.stopPropagation(),w()},onKeyDown:W=>{(W.key==="Enter"||W.key===" ")&&(W.preventDefault(),w())},children:i.jsx(E,{className:xe("size-3.5 text-amber-400","animate-crab-settle drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})})]}),t.length>1&&i.jsxs("div",{className:xe("flex-1 min-w-0 mb-0.5 rounded-lg border border-border py-1 px-3 flex items-center gap-3 text-xs",N),children:[i.jsxs("span",{className:"text-blue-400/80 font-mono font-semibold tabular-nums shrink-0",children:["#",t[0]?.log.id??"?"," ~ #",t[d]?.log.id??"?"]}),i.jsxs("span",{className:"text-muted-foreground shrink-0",children:[t.length," request",t.length>1?"s":""]}),S.length>0&&i.jsx("span",{className:"flex items-center gap-0.5 shrink-0",children:S.map(W=>i.jsx(Jm,{provider:W,className:"size-4"},W))}),C.maxElapsed!==null&&i.jsx(nt,{children:i.jsxs(Fe,{children:[i.jsx($e,{asChild:!0,children:i.jsxs("span",{className:xe("flex items-center gap-1 shrink-0",z?"text-amber-400":"text-muted-foreground"),children:[i.jsx(xn,{className:"size-3"}),i.jsx("span",{className:"font-mono tabular-nums",children:Ai(C.maxElapsed)}),z&&i.jsx(tr,{className:"size-3","aria-label":"Slow response"})]})}),i.jsx(Be,{children:z?`Slow response: ${Ai(C.maxElapsed)} exceeds ${Ai(o*1e3)}`:"Slowest request in this turn"})]})}),C.hasTokens&&i.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[i.jsx(Vr,{className:"size-3 text-muted-foreground"}),i.jsxs("span",{className:"font-mono tabular-nums",children:[i.jsxs("span",{className:"text-blue-400",children:["IN ",Ue(C.totalInput)]})," / ",i.jsxs("span",{className:"text-amber-400",children:["OUT ",Ue(C.totalOutput)]})]})]}),i.jsx("span",{className:"flex-1 min-w-0"}),i.jsx(Kt,{className:"size-4 text-muted-foreground shrink-0"})]})]}):t.map((W,U)=>{const{log:$,stopReason:G}=W,A=U===0;return i.jsxs("div",{className:"flex items-stretch",children:[A?i.jsx("div",{className:"w-5 shrink-0 flex items-start pt-1.5",children:i.jsx("span",{className:"text-[10px] text-muted-foreground/50 font-mono tabular-nums leading-none select-none",children:c+1})}):i.jsx("div",{className:"w-5 shrink-0"}),i.jsx(Ez,{stopReason:G,isPending:$.responseStatus===null,isFirst:U===0,isTurnStart:A,isOnlyEntry:y,crabIndex:$.id%12,collapsible:m&&A,onToggle:w}),i.jsxs("div",{className:xe("flex-1 min-w-0 mb-0.5 rounded-lg",N),children:[i.jsx(Nz,{log:$,viewMode:n,strip:r,slowResponseThresholdSeconds:o,timeDisplayFormat:u,cacheTrend:s?.get($.id)??null,onCompareWithPrevious:l.has($.id)?a:void 0}),i.jsx(Az,{events:M.get($.id)??[]})]})]},$.id)})})}),Kl=Re(["episode","procedure","preference","project-fact"]),Fz=Re(["draft","promoted","failed"]),tx=re({source:Ne("agent-inspector"),sessionId:I(),logIds:ye(se().int().positive()),project:I().nullable(),models:ye(I())}),$z=re({redacted:He(),patterns:ye(I())}),io=re({id:I(),type:Kl,title:I(),content:I(),tags:ye(I()),source:Ne("agent-inspector"),sessionId:I(),logIds:ye(se().int().positive()),evidence:tx,status:Fz,createdAt:I(),updatedAt:I(),openClawMemoryId:I().nullable(),error:I().nullable(),redaction:$z});re({idempotencyKey:I(),type:Kl,title:I(),content:I(),tags:ye(I()),source:Ne("agent-inspector"),project:I().nullable(),evidence:tx});const Bz=re({id:I(),type:Kl.or(I()),title:I(),content:I(),score:se().nullable(),source:I().nullable(),project:I().nullable(),evidence:Fi().optional()});re({results:ye(Bz),warning:I().nullable()});const Uz=re({candidates:ye(io)}),Hz=re({candidate:io}),Wz=re({error:I().optional(),candidate:io.optional()}),Vz=re({candidate:io}),Zz={draft:"border-amber-500/30 bg-amber-500/10 text-amber-500",promoted:"border-emerald-500/30 bg-emerald-500/10 text-emerald-500",failed:"border-destructive/30 bg-destructive/10 text-destructive"};function Sa(e){return e===null?"-":e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`}function qz(e,t,n){return e===null||t===null?null:rl(e,t,n)}function Kz(e){return`${String(e)} candidate${e===1?"":"s"}`}function nx(e){return`log-${String(e)}`}function rx(e){const t=nx(e),n=document.getElementById(t);window.history.replaceState(null,"",`#${t}`),n instanceof HTMLElement&&(n.scrollIntoView({block:"center",behavior:"smooth"}),n.focus({preventScroll:!0}))}function Gz(e){for(const t of e)if(t.responseStatus!==null&&t.responseStatus>=400)return t;return null}function Jz(e){let t=null,n=-1;for(const r of e)r.elapsedMs!==null&&r.elapsedMs>n&&(t=r,n=r.elapsedMs);return t}function Yz(e){for(const t of e)if(ql(t).length>0)return t;return null}function Xz(e){const t=[{kind:"session",title:`${String(e.summary.llmCallCount)} LLM call${e.summary.llmCallCount===1?"":"s"}`,detail:`Scope ${e.scopeId}`,logId:e.logs[0]?.id??null}],n=Yz(e.logs);e.summary.toolCallCount>0&&n!==null&&t.push({kind:"tool",title:`${String(e.summary.toolCallCount)} tool call${e.summary.toolCallCount===1?"":"s"}`,detail:`First tool evidence at #${String(n.id)}`,logId:n.id});const r=Gz(e.logs);r!==null&&t.push({kind:"failure",title:`Failure #${String(r.responseStatus)}`,detail:`First failed request is #${String(r.id)}`,logId:r.id});const o=Jz(e.logs);if(o!==null&&e.summary.maxElapsedMs!==null&&t.push({kind:"slow",title:`Slowest ${Sa(e.summary.maxElapsedMs)}`,detail:`Max latency observed at #${String(o.id)}`,logId:o.id}),e.candidates.length>0){const s=e.candidates.filter(l=>l.status==="draft").length,a=e.candidates.filter(l=>l.status==="promoted").length;t.push({kind:"candidate",title:`${String(e.candidates.length)} memory candidate${e.candidates.length===1?"":"s"}`,detail:`${String(s)} draft / ${String(a)} promoted`,logId:e.candidates[0]?.logIds[0]??null})}return t}function Qz(e){switch(e){case"session":return i.jsx(ks,{className:"size-3.5 text-blue-400"});case"tool":return i.jsx(eo,{className:"size-3.5 text-sky-400/70"});case"slow":return i.jsx(xn,{className:"size-3.5 text-amber-400"});case"failure":return i.jsx(rp,{className:"size-3.5 text-destructive"});case"candidate":return i.jsx(tp,{className:"size-3.5 text-emerald-400"})}}function eP({insights:e}){return e.length===0?null:i.jsx("div",{className:"mt-2 grid gap-1.5 border-t border-border/70 pt-2 md:grid-cols-2 xl:grid-cols-3",children:e.map(t=>i.jsxs("button",{type:"button",className:xe("flex min-w-0 items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs","text-muted-foreground transition-colors hover:bg-muted/40 hover:text-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),onClick:()=>{t.logId!==null&&rx(t.logId)},disabled:t.logId===null,children:[Qz(t.kind),i.jsxs("span",{className:"min-w-0",children:[i.jsx("span",{className:"block truncate font-medium text-foreground/90",children:t.title}),i.jsx("span",{className:"block truncate font-mono text-[10px]",children:t.detail})]})]},`${t.kind}-${t.title}`))})}function tP(e){switch(e){case"draft":return"Draft";case"promoted":return"Promoted";case"failed":return"Failed"}}function nP(e,t){if(t)return"Promoting";switch(e.status){case"draft":return"Promote";case"failed":return"Retry";case"promoted":return"Promoted"}}function rP(e){return e.redaction.redacted?`Redacted ${e.redaction.patterns.join(", ")}`:"No sensitive pattern matched"}function oP(e,t){const n=e.replace(/\s+/g," ").trim();return n.length<=t?n:`${n.slice(0,t-3)}...`}function sP(e){const t=e[0],n=e[e.length-1];return t===void 0?"No evidence logs":n===void 0||t===n?`#${String(t)}`:`#${String(t)}-#${String(n)}`}function fd(e){return e.join(", ")}function iP(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function aP({candidate:e,isPromoting:t,isUpdating:n,onPromoteCandidate:r,onUpdateCandidate:o}){const[s,a]=g.useState(!1),[l,c]=g.useState(e.type),[u,d]=g.useState(e.title),[f,h]=g.useState(e.content),[p,y]=g.useState(fd(e.tags)),[m,x]=g.useState(null),b=e.status!=="promoted",v=e.status!=="promoted",w=g.useCallback(()=>{c(e.type),d(e.title),h(e.content),y(fd(e.tags)),x(null)},[e.content,e.tags,e.title,e.type]),C=g.useCallback(async()=>{const S=u.trim(),j=f.trim(),E=iP(p);if(S.length===0){x("Title is required.");return}if(j.length===0){x("Content is required.");return}if(E.length===0){x("At least one tag is required.");return}x(null),await o(e.id,{type:l,title:S,content:j,tags:E})&&a(!1)},[e.id,f,p,u,l,o]);return s?i.jsx("div",{className:"rounded-md border border-border/80 bg-background/60 px-2.5 py-2",children:i.jsxs("div",{className:"grid gap-2",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsxs("select",{value:l,disabled:n,onChange:S=>{const j=io.shape.type.safeParse(S.currentTarget.value);j.success&&c(j.data)},className:"h-7 rounded-md border border-input bg-background px-2 text-xs","aria-label":"Candidate type",children:[i.jsx("option",{value:"episode",children:"episode"}),i.jsx("option",{value:"procedure",children:"procedure"}),i.jsx("option",{value:"preference",children:"preference"}),i.jsx("option",{value:"project-fact",children:"project-fact"})]}),i.jsx("input",{value:u,disabled:n,onChange:S=>d(S.currentTarget.value),className:"h-7 min-w-[220px] flex-1 rounded-md border border-input bg-background px-2 text-xs","aria-label":"Candidate title"})]}),i.jsx("textarea",{value:f,disabled:n,onChange:S=>h(S.currentTarget.value),className:"min-h-28 rounded-md border border-input bg-background px-2 py-1.5 font-mono text-[11px] leading-relaxed","aria-label":"Candidate content"}),i.jsx("input",{value:p,disabled:n,onChange:S=>y(S.currentTarget.value),className:"h-7 rounded-md border border-input bg-background px-2 text-xs","aria-label":"Candidate tags"}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground",children:[i.jsx(Cc,{className:"size-3"}),"Saving reruns Inspector redaction before promotion."]}),i.jsx("span",{className:"flex-1"}),m!==null&&i.jsx("span",{className:"text-[10px] text-destructive",children:m}),i.jsxs(Ie,{type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:n,onClick:()=>{w(),a(!1)},children:[i.jsx(nl,{className:"size-3.5"}),"Cancel"]}),i.jsxs(Ie,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:n,onClick:()=>{C()},children:[n?i.jsx(Wi,{className:"size-3.5 animate-spin"}):i.jsx(Hw,{className:"size-3.5"}),"Save"]})]})]})}):i.jsxs("div",{className:"rounded-md border border-border/80 bg-background/60 px-2.5 py-2",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx(ot,{variant:"outline",className:"h-5 px-1.5 text-[10px] font-mono",children:e.type}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",title:e.title,children:e.title}),i.jsx(ot,{variant:"outline",className:xe("h-5 shrink-0 px-1.5 text-[10px] font-mono",Zz[e.status]),children:tP(e.status)})]}),i.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",title:e.content,children:oP(e.content,360)}),i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-[10px] text-muted-foreground",children:[i.jsxs("span",{className:"inline-flex items-center gap-1",children:[i.jsx(cw,{className:"size-3"}),sP(e.logIds)]}),i.jsxs("span",{className:"inline-flex items-center gap-1",children:[i.jsx(Cc,{className:"size-3"}),rP(e)]}),e.status==="promoted"&&i.jsxs("span",{className:"inline-flex items-center gap-1 text-emerald-500",children:[i.jsx(kc,{className:"size-3"}),e.openClawMemoryId??"OpenClaw"]}),e.status==="failed"&&e.error!==null&&i.jsxs("span",{className:"inline-flex items-center gap-1 text-destructive",children:[i.jsx(rp,{className:"size-3"}),e.error]})]}),i.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[e.logIds.map(S=>i.jsxs("a",{href:`#${nx(S)}`,onClick:j=>{j.preventDefault(),rx(S)},className:"rounded border border-blue-400/25 px-1.5 py-0.5 font-mono text-[10px] text-blue-400 underline-offset-2 transition-colors hover:bg-blue-400/10 hover:text-blue-300 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":`Jump to evidence log ${String(S)}`,children:["#",S]},S)),i.jsx("span",{className:"flex-1"}),v&&i.jsxs(Ie,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1.5 px-2 text-[10px]",disabled:n||t,onClick:()=>a(!0),children:[i.jsx(sp,{className:"size-3"}),"Review"]}),i.jsxs(Ie,{type:"button",variant:b?"outline":"ghost",size:"sm",className:"h-6 gap-1.5 px-2 text-[10px]",onClick:()=>r(e.id),disabled:!b||t||n,children:[t?i.jsx(Wi,{className:"size-3 animate-spin"}):b?i.jsx(Z2,{className:"size-3"}):i.jsx(kc,{className:"size-3"}),nP(e,t)]})]})]})}function lP({candidates:e,promotingCandidateIds:t,updatingCandidateIds:n,onPromoteCandidate:r,onUpdateCandidate:o}){return e.length===0?null:i.jsx("div",{className:"mt-2 grid gap-1.5",children:e.map(s=>i.jsx(aP,{candidate:s,isPromoting:t.has(s.id),isUpdating:n.has(s.id),onPromoteCandidate:r,onUpdateCandidate:o},s.id))})}function cP({logs:e,scopeId:t,slowResponseThresholdSeconds:n,showRollupMetrics:r,timeDisplayFormat:o}){const[s,a]=g.useState([]),[l,c]=g.useState(!0),[u,d]=g.useState({status:"idle",error:null}),[f,h]=g.useState(()=>new Set),[p,y]=g.useState(()=>new Set),m=s.length>0,x=g.useMemo(()=>Lz(e,n,s.length),[s.length,e,n]),b=g.useMemo(()=>Xz({logs:e,scopeId:t,summary:x,candidates:s}),[s,e,t,x]),v=r||x.maxElapsedMs!==null,w=g.useMemo(()=>qz(x.startedAt,x.endedAt,o),[x.endedAt,x.startedAt,o]),C=g.useCallback(()=>{e.length===0||u.status==="loading"||(d({status:"loading",error:null}),(async()=>{try{const E=await fetch(`/api/knowledge/sessions/${encodeURIComponent(t)}/candidates`,{method:"POST"});if(!E.ok){const z=await tn(E,`Candidate generation failed with ${String(E.status)}`);d({status:"failed",error:z});return}const N=await zt(E,Uz);a(N.candidates),c(N.candidates.length>0),d(N.candidates.length>0?{status:"ready",error:null}:{status:"failed",error:"No candidate was generated for this trace scope."})}catch(E){d({status:"failed",error:E instanceof Error?E.message:"Candidate response was invalid"})}})())},[u.status,e.length,t]),S=g.useCallback(E=>{h(N=>{if(N.has(E))return N;const z=new Set(N);return z.add(E),z}),(async()=>{try{const N=await fetch(`/api/knowledge/candidates/${encodeURIComponent(E)}/promote`,{method:"POST"}),z=await N.json().catch(()=>null),M=Hz.safeParse(z);if(N.ok&&M.success){a(T=>T.map(D=>D.id===M.data.candidate.id?M.data.candidate:D)),d({status:"ready",error:null});return}const B=Wz.safeParse(z);B.success&&B.data.candidate!==void 0&&a(T=>T.map(D=>D.id===B.data.candidate?.id?B.data.candidate:D)),d({status:"failed",error:B.success?B.data.error??"Candidate promotion failed":`Candidate promotion failed with ${String(N.status)}`})}catch(N){d({status:"failed",error:N instanceof Error?N.message:"Candidate promotion failed"})}finally{h(N=>{const z=new Set(N);return z.delete(E),z})}})()},[]),j=g.useCallback(async(E,N)=>{y(z=>{if(z.has(E))return z;const M=new Set(z);return M.add(E),M});try{const z=await fetch(`/api/knowledge/candidates/${encodeURIComponent(E)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)});if(!z.ok){const B=await tn(z,`Candidate update failed with ${String(z.status)}`);return d({status:"failed",error:B}),!1}const M=await zt(z,Vz);return a(B=>B.map(T=>T.id===M.candidate.id?M.candidate:T)),d({status:"ready",error:null}),!0}catch(z){return d({status:"failed",error:z instanceof Error?z.message:"Candidate update failed"}),!1}finally{y(z=>{const M=new Set(z);return M.delete(E),M})}},[]);return e.length===0?null:i.jsxs("section",{className:"mb-2 rounded-lg border border-border bg-muted/10 px-3 py-2",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 text-xs",children:[r&&i.jsxs("span",{className:"inline-flex items-center gap-1.5 font-semibold text-foreground",children:[i.jsx(ks,{className:"size-3.5 text-blue-400"}),x.llmCallCount," LLM"]}),i.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[i.jsx(eo,{className:"size-3.5 text-sky-400/70"}),x.toolCallCount," tools"]}),r&&i.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[i.jsx(Vr,{className:"size-3.5 text-emerald-400"}),i.jsxs("span",{className:"font-mono",children:[Ue(x.totalInputTokens)," / ",Ue(x.totalOutputTokens)]})]}),(x.totalCacheCreationInputTokens>0||x.totalCacheReadInputTokens>0)&&i.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[i.jsx(Vr,{className:"size-3.5 text-purple-400"}),i.jsxs("span",{className:"font-mono",children:["KV Cache +",Ue(x.totalCacheCreationInputTokens)," / ~",Ue(x.totalCacheReadInputTokens)]})]}),v&&i.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[i.jsx(xn,{className:"size-3.5"}),r&&i.jsx("span",{className:"font-mono",children:Sa(x.totalElapsedMs)}),x.maxElapsedMs!==null&&i.jsxs("span",{className:"font-mono text-muted-foreground/70",children:["max ",Sa(x.maxElapsedMs)]})]}),r&&w!==null&&i.jsx("span",{className:"font-mono text-muted-foreground/70",children:w}),(x.failedCallCount>0||x.pendingCallCount>0||x.slowCallCount>0)&&i.jsxs("span",{className:"inline-flex items-center gap-1.5 text-amber-400",children:[i.jsx(tr,{className:"size-3.5"}),i.jsxs("span",{className:"font-mono",children:[x.failedCallCount," fail / ",x.pendingCallCount," pending /"," ",x.slowCallCount," slow"]})]}),i.jsx("span",{className:"flex-1"}),m&&i.jsx(ot,{variant:"outline",className:"h-6 px-2 text-[10px] font-mono",children:Kz(x.knowledgeCandidateCount)}),i.jsxs(Ie,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",onClick:C,disabled:u.status==="loading",children:[u.status==="loading"?i.jsx(Vt,{className:"size-3.5 animate-spin"}):i.jsx(tp,{className:"size-3.5"}),"Candidate"]}),m&&i.jsx(Ie,{type:"button",variant:"ghost",size:"icon",className:"size-7 text-muted-foreground",onClick:()=>c(E=>!E),"aria-expanded":l,"aria-label":l?"Collapse memory candidates":"Expand memory candidates",children:l?i.jsx(wt,{className:"size-3.5"}):i.jsx(Kt,{className:"size-3.5"})})]}),u.status==="failed"&&i.jsx("p",{className:"mt-2 text-xs text-destructive",children:u.error}),i.jsx(eP,{insights:b}),l&&i.jsx(lP,{candidates:s,promotingCandidateIds:f,updatingCandidateIds:p,onPromoteCandidate:S,onUpdateCandidate:j})]})}function uP(e){let t=0,n=0;for(const r of e)r.inputTokens!==null&&(t+=r.inputTokens),r.outputTokens!==null&&(n+=r.outputTokens);return{totalInputTokens:t,totalOutputTokens:n}}const ox=g.memo(function({group:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,cacheTrends:o,onCompareWithPrevious:s,comparisonPredecessors:a,onClearGroup:l,standalone:c=!1,hasPinnedSessionContext:u=!1,timeDisplayFormat:d,expanded:f,onExpandedChange:h}){const[p,y]=g.useState(!1),m=f??p,x=g.useCallback(N=>{if(h!==void 0){h(N);return}y(N)},[h]),b=g.useMemo(()=>uP(e.logs),[e.logs]),v=e.logs[0]?.timestamp??new Date().toISOString(),w=e.logs[e.logs.length-1]?.timestamp??new Date().toISOString(),C=rE(e.logs),S=e.logs.some(N=>N.responseStatus===null),j=c&&!u,E=g.useMemo(()=>Pz(e.logs),[e.logs]);return g.useEffect(()=>{const N=z=>{if(c)return;const M=Ys(z);M!==null&&e.logs.some(B=>B.id===M.logId)&&x(!0)};return window.addEventListener(on,N),()=>{window.removeEventListener(on,N)}},[e.logs,x,c]),i.jsxs("div",{className:"mb-2",children:[!c&&i.jsx(tE,{conversationId:e.conversationId,startTime:v,endTime:w,totalCalls:e.logs.length,totalInputTokens:b.totalInputTokens,totalOutputTokens:b.totalOutputTokens,apiFormat:nE(e.logs),expanded:m,onToggle:()=>x(!m),hideApiFormat:C,isLoading:S,userAgent:e.logs[0]?.userAgent??null,timeDisplayFormat:d,onClear:()=>l(e.logs.map(N=>N.id))}),Iz(c,m)&&i.jsxs("div",{children:[i.jsx(cP,{logs:e.logs,scopeId:e.conversationId,slowResponseThresholdSeconds:r,showRollupMetrics:j,timeDisplayFormat:d}),E.map(N=>i.jsx(Dz,{entries:N.entries,viewMode:t,strip:n,slowResponseThresholdSeconds:r,timeDisplayFormat:d,cacheTrends:o,onCompareWithPrevious:s,comparisonPredecessors:a,turnIndex:N.turnIndex},N.turnIndex))]})]})});function pd({className:e}){return i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:xe("inline-block size-5",e),children:[i.jsx("path",{d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z"}),i.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),i.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),i.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),i.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"}),i.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),i.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),i.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),i.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),i.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]})}const dP="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAD6CAQAAAAi5ZK2AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElNRQfpCxsJDCnsge2KAAAM2ElEQVR42u2de3AW1RnGnyQQDARDwiUFpHIVMHIpYgFRB2nLxQrC0FIDiCKDWNqBUqBlai8wvciIpaRTWh3QDqCDIIjKDL0IaBC5SKlysWJArgqh3BMICYFs/wgpGUi+8579dr89e/Z5zp/59j2755fn3d2z5wJQFEVRFEVRoVQSm+AG1UFrtEdT1EcjNEA5SlCMIhxDAQoJ3S4lIwf9cD+6ozXq1vKbYuzHNmxEPo6xwcKtungIS3EajkYpwLPoyqYLp3KwACe1cFcvezATmWzEMOk+rMBV18CrSjHy0IqNGQb1wMa4cV8vZfgzGrNRTVYm8nDFQ+SV5QymIIWNa6ZGaz6y6ZR/I4cNbJrSkOcb8MpyCVPYzCapKz71GXllWY5b2dhm6EGcTwhyBw52oyUbPHgNx6WEIXfg4CDuYKMHq0kevI/rlhP4Ghs+OE1ERcKRO3BwEh3Z+NFC7sDBATQngMRrcoDIHTj4iE/yUXJ5VVlhYsMkWezy+a6urgRbsAP7cRincQGpqI+maI+O6IMuSHYRbwIW0X/mJvZTeAH9ah1CATTCaKxBmWbUi7iTOMxEXoCncIsodgvM1ezo2cFPMebdy89qfyHL0vxSN5FQzHL5ajRxVU8v7NO4cWQRjCnIy/DDOOq6FcvENS0gGjMS+wUMjvvdZ5awrsv4KvEE7/Iz+Lontc4Q1vc8AQXt8rO4x7Oa54hqLOLI2aBdfrenHVyviWqdQUx2uLxS6fhMUO8ugrLD5VXqLfpmfxdh2eHyKi0S1P5b4rLF5ZVqiiJl/Z8SmD0ur9TzgnNoQWi2uLxSt+Gy8ixGEpvZLs9AN3RGqsYRa5Xn8SeCM9XlDfFT7Ll2bDnWYYRwOMZjyjP5kOjMdPkDOHpTjPX4iuDILOWL2znCMxH5IyitMc4+ZAuO3q08nyYEaFpiHxbjYWyDIMm/qDyje4kwPMgdOBihjDBNeU7fJcQwIXewTnBzUJ3Vk8Rozr18mOAtuxT1FFH6KmNMJkhTkH+7lse3G0s7RZyuygjPEGVYEntV6aSIlKOM8CvCDEtirywVyFDE6q2M8WPiDJPLJcMgBiljPEWg4XG5AwfTlfEmKWPkEml4XO7gCBooI85TRvlm8I1ax3CX68w8PYeB2KGFfEWM6Yo3qgy5uKj8VU/lLz5HG2QjHRlIA1CCIhTjBI6ggg43LbGXYYggZj3lgkYVtbwaluITvIlf4gHhNEomdheJXfpeXoX8EVHUAR4sY1CKfEyN5gibMCIHXvJsBYur2IDxSCNy05HXx1mPFy/5L2ZFZb6rGR2uusiByb6sWlOMZ5FOl5vocqAuDvm2XNExjLV5t52wuhyY7vM6Ve+jA11uksuB5glYcLgIY+hyc1yeJBj87E35q6BXkC5PAHJgdgKXI9xlzzt8eF0OjE/wypQH7Li7h9nl4wJYjPQ4utPlwSF/LKD1Z8+gC10eLeQOHHyJ1nR54pGPCniVadmcGyK3xOVVZYvWnNpqb5hBIv+L1hCJAdiuhXyVcpT6dV3GSLylhXyxy7YrxHYU4CBO4yKABmiCNuiIe9DMVbT5mMp7eWJc/rgLl1dgC6bE2NelM6Zim4uoDzOxm5nYS/GicNOuznhJc0X5k2HprIkS8gos1cTSSrgYodFbhkQ5sR/F/a7aqD8Oa9TSny43x+UblDNialcmVovr2WP2qOYoIV8V57tREuaK6/o+E7sJid2bO+00Ya0HTPV6lFy+3LNWmymsMZfIg+1w9fZ5ep6ozp3mjaKjy90rGetF9d5H5Ha4vFLZOB62zYGIPH6NEk2NqEvk4U/s1V/f8gX1DyJye5ADQC/BGfyRyO1I7Nf1rvIcPiZye1xeqaGCua6ZNiMf7sOSAolD3h+v4otrH2RewYPCo1JxWnkmQ4jcROTZNcyGWSMcN7PQ5KUJw4zc33t5G+xHzfu3S7655wqmPRG5ccgPxxjkqN7DvbnyfDYRuVmJvY1iYMQEQYxCxRkVEnlYXF5ZdguibFLEKI/6S9pQg1x+Ow4IYrZSxlmqjJFGl4fF5dLVJBcoYzQl8jDcy3XestV7tbcl8vC43IGD3spo6gEVtxF5mJCXCu7H6u6ZRlFE/nAoE7sDB8sEEd9URqkTfuT2P7FXlSuiZQb2KKKU0OXhcbmDGYKYdZWrTO8l8nDcyx04mCeKqh5IsYaJPRyJ3cEfhHFnePTPQ+ShQQ68r4z1NJEHkdj9Q95KcN7didwmlwOzBC2dTOT2uByoj5PBPcbR5UEgly0tPo3I7XE5kI1zgoVOWhO5PS4HXhHE/IDI7XE5MFIU9QdEbo/LO6NIEPWS98Mn/F04pD+R16oWOCiK+4LXyMf4irwnin1ErrtWzGtGIW+MXcJvdB4v/H87LvqIvL1yWG90XZ6J7UHNpVvoI/KGKPDxS5q/Lm/ry5e06i7/SBi5HHd5izxVI/nqIpcM6aXL1WW+1z7v6SPyJ0I7RMJvl+sgP+H9uLihviFvp5FDmNhrL096/34+2Jf3cgBYw8TuAfI3/OiHu8MXl+tsMM97ee3lKBr7AT1JuVuwG+Sp2EvkcSMvR1+/PqbO9Bw5MIn38rgTu69rP6fFeJd2hzwFn/OJPU6XO5gNX5VTy6iNk66QA4+KLqoCY5nYay0L4bs6YedN1e5EJ5fRdogu60dM7DE+/SZk+lIqxmMzrl5br2wzxrvbCA5Ad9FlraTLay2vJ3YV2DS0Rds4VzuYI7isQ1q9TNG6l79uzsK/8ldAyffhYRoRwz0qJgLIgT6CC/uHMcjpck/0c8Gl9aHLbUIO/FN5aflEbhfyOoJBfrlEbhNyydf5C0jnvdwm5MAY5eWtInK7kAOzlRc4mYndLuTAq8pL7KGMMTzUXTGGdrj6qc2KS7yq7O27E1fYxx4ufaK4yCOK41M0ofg7dYHIRVIh2xr3gyBdbpxUW8+8ozh+PV0ePqkmSK1RJPdLhrj890Qu1ynFxa6PeXRTQ76X871cS6rPqh/GPDrLiJc0ulxTqgVtj8U8OglneS8Pn9RrHjaMefwbvJeHT4vj/JY+iMjDJ/UQip8oIqyNcewyJnYT9T3lpf9NEaEJPqvlyEV0uZnqKpjVkqWIkV3DTuKlmusfE3kClYwzygaYIIiSi03XxuA7OIF5aE7kJuttZRPsQpIoUga64W601l75mF0xCZdkYdvBPtZP5AGom6Ahtvu2brnfiZ3IXfbKye7rdHmo9AtBc5zyYftIujxAtRONcduIFLrcJm3wpdmDdfm/iDy2BgqbZnpoXE7kSiUJOy8qMNWD2nJwlC43QY+Km+i5OF/fHhD0ARJ5grpjt4qbaT1auM4oU1DGxG6Oev2/71xdCpEr7Jqtro5YpwWELk+AXtZqsHz01ojdDHM1PU7kCVEznNDEko8RuEXQ0bsAJZqRiTxhGqQ5FdGBg3NYgsfRpoZoDTEIv8N/tCNGDnlSwPU/hxkujyzCPhzBOZQiBY3QFB3i6Lidp7lhZSbe0VorcyVGoZwer1JdbHHlTC8LE3vC1US8CLg/xf+XtDqEfLPa4BiRR0/dBXsGhzOxE3kMdcGXCUc+h8iDT/IFCQR+BROJ3ARlaw5DcF8uYAiRm6J6yHPRXaNb9mhvUknkPmuocuGC+MoS1Cdy89QSK3wCvg8PaZ8NkSdM/YT7hsvLRcwSfKwh8kBVB08LN/JSlxIscNUzT+QBKBlDsC1O4OeR53LkDZEHqN7Ic9VRW4a3kav92EbkxigF38BcbEO5CMBhLME45Tz3yCJPChn8dPRBF7RHB3RARrVtvC6hGIewHwUowBYcirMW/e/lubhCZybunyALmR7/6zKxR05ETuRETuRETuRsNCKniJwicorIKSKniJwicorIKSKniJyqGfnHmvsyE3nIlRJzHxi63ErlEXnUNI6JPWrKUO7rTJdbp98QedSUjWIm9qjpGSKPnrYysUdNzYRLEBO5RRrLxF6p5AhB7yz4zUqMtn+CUpSgZyt/sZpz0mzTWuXU5sbRaIgoOT1T8fdCnCZ026RC2lJzQ25CD4EKFX9PwWLUI/RoQQe+hbdcrEBFGazRovf0tdFwe1SUJVyx5u90u03aKOx7J3aLNEP8lY1J3ho10hg3Q7dbo59pjJwhdkvUAMeJPXr6jtY2Ary3W6Jfaw2CptutUJLmJgLEboXSsUkLO5O8JQ9079LtxE7sxE7sxE7sFqkhH+mIXV1WhG43DMoD7OPZZNHD/gWnPUUR+4BwX2wyeQMAijEYH4h/fS+hRw97c0K3B/tAvCf6ZRmh26OLGCpy+wE2VfQe6XLYTFHD/h6bKGrYy9CDDWQr9vwakV/FE2wce5WGl29CfgrD2TC2qy+W4/w14Hsxy5aVKvjFSN1CLVAPp1DEpqAoiqIoyiz9D9lYMumhgrvLAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDI1LTExLTI3VDA5OjEyOjQxKzAwOjAwvIZCxQAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyNS0xMS0yN1QwOToxMjo0MSswMDowMM3b+nkAAAAASUVORK5CYII=";function fP({className:e}){return i.jsx("img",{src:dP,alt:"Model Context Protocol","aria-hidden":"true",className:xe("inline-block size-8 object-contain invert",e)})}function ls({...e}){return i.jsx(R5,{"data-slot":"select",...e})}function cs({...e}){return i.jsx(M5,{"data-slot":"select-value",...e})}function us({className:e,size:t="default",children:n,...r}){return i.jsxs(O5,{"data-slot":"select-trigger","data-size":t,className:xe("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,i.jsx(L5,{asChild:!0,children:i.jsx(wt,{className:"size-4 opacity-50"})})]})}function ds({className:e,children:t,position:n="popper",align:r="center",...o}){return i.jsx(D5,{children:i.jsxs(F5,{"data-slot":"select-content",className:xe("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,align:r,...o,children:[i.jsx(pP,{}),i.jsx($5,{className:xe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),i.jsx(hP,{})]})})}function Ft({className:e,children:t,...n}){return i.jsxs(B5,{"data-slot":"select-item",className:xe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[i.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:i.jsx(H5,{children:i.jsx(et,{className:"size-4"})})}),i.jsx(U5,{children:t})]})}function pP({className:e,...t}){return i.jsx(W5,{"data-slot":"select-scroll-up-button",className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:i.jsx(Ja,{className:"size-4"})})}function hP({className:e,...t}){return i.jsx(V5,{"data-slot":"select-scroll-down-button",className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:i.jsx(wt,{className:"size-4"})})}function mP(e){return e===null||e.evidence===null?null:`/api/groups/${encodeURIComponent(e.id)}/evidence`}function gP(e){const t=Yr(mP(e),n=>an(n,e2));return{evidenceResponse:t.data??null,isLoading:t.isLoading,error:t.error,mutate:t.mutate}}function xP(){const e=Yr("/api/groups",t=>an(t,Xf));return{groups:e.data?.groups??[],isLoading:e.isLoading,error:e.error,mutate:e.mutate}}function bP(e,t){const n=`/api/groups/${encodeURIComponent(e)}`;return t?`${n}?deleteEvidence=1`:n}function sx(e){let t=0,n=0,r=0,o=0;for(const s of e.members)switch(s.status){case"completed":t+=1;break;case"failed":case"cancelled":n+=1;break;case"running":r+=1;break;case"created":break;case null:o+=1;break}return{memberCount:e.members.length,completedMembers:t,failedMembers:n,runningMembers:r,missingStatusMembers:o}}function yP(e,t){return t!==null&&t.group.id===e.id?t.members.map(n=>({member:n.member,exportMember:n})):e.members.map(n=>({member:n,exportMember:null}))}function Gl(e){switch(e){case"completed":return"border-emerald-200 bg-emerald-50 text-emerald-700";case"failed":case"cancelled":return"border-red-200 bg-red-50 text-red-700";case"running":return"border-sky-200 bg-sky-50 text-sky-700";case"created":return"border-zinc-200 bg-zinc-50 text-zinc-600";case null:return"border-zinc-200 bg-zinc-50 text-zinc-500"}}function Jl(e){return e??"unknown"}function vP(e){switch(e){case"PASS":return"border-emerald-200 bg-emerald-50 text-emerald-700";case"FAIL":return"border-red-200 bg-red-50 text-red-700";case"RUNNING":return"border-sky-200 bg-sky-50 text-sky-700";case"UNKNOWN":return"border-zinc-200 bg-zinc-50 text-zinc-600"}}function ix(e){return e===null||e.trim().length===0?"-":e}function ar(e){return e.toLocaleString()}function wP(e){return e==null?"-":e<1e3?`${ar(e)} ms`:`${(e/1e3).toFixed(1)} s`}function Yl(e){const t=Date.parse(e);return Number.isFinite(t)?new Intl.DateTimeFormat(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(t)):e}function ax(...e){for(const t of e)if(t!==null&&t.trim().length>0)return t;return"-"}function kP(e){const t=e.provider,n=e.model;return t!==null&&t.length>0&&n!==null&&n.length>0?`${t} / ${n}`:ax(t,n)}function _P(e,t){if(t!==null){const n=e.find(r=>r.id===t);if(n!==void 0)return n}return e[0]??null}function SP(e){return(e.exportMember?.session?.latestLogs??[])[0]??null}function CP(e,t){return t!==null&&t.group.id===e.id?t.evidence:e.evidence}function jP(e,t,n){return t!==null&&t.group.id===e.id?t.summary:n!==null&&n.group.id===e.id?n.summary:null}function NP(e,t,n){return t!==null&&t.group.id===e.id?t.jenkinsReport:n!==null&&n.group.id===e.id?n.report:null}function hd(){const[e,t]=g.useState(!1),[n,r]=g.useState(null),[o,s]=g.useState(null),[a,l]=g.useState(null),[c,u]=g.useState(null),[d,f]=g.useState(null),[h,p]=g.useState(!1),[y,m]=g.useState(null),[x,b]=g.useState(null),{groups:v,isLoading:w,error:C,mutate:S}=xP(),j=g.useMemo(()=>_P(v,n),[v,n]);g.useEffect(()=>{!e||n!==null&&v.some(G=>G.id===n)||r(v[0]?.id??null)},[v,e,n]);const E=j!==null&&c!==null&&c.group.id===j.id?c:null,{evidenceResponse:N,isLoading:z,error:M,mutate:B}=gP(j),T=g.useCallback(()=>{S()},[S]),D=g.useCallback(async $=>{s($.id),l(null);try{const G=await fetch(`/api/groups/${encodeURIComponent($.id)}/evidence`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({latestLogLimit:10})});if(!G.ok){l(await tn(G,`Export failed with status ${String(G.status)}`));return}const A=await zt(G,t2);u(A),await S(),await B()}catch(G){l(G instanceof Error?G.message:String(G))}finally{s(null)}},[S,B]),k=g.useCallback($=>{f($),p(!1),b(null)},[]),L=g.useCallback(()=>{y===null&&(f(null),p(!1),b(null))},[y]),W=g.useCallback($=>{r($),f(null),p(!1),b(null)},[]),U=g.useCallback(async()=>{const $=d;if($!==null){m($.id),b(null);try{const G=await fetch(bP($.id,h),{method:"DELETE"});if(!G.ok){b(await tn(G,`Delete failed with status ${String(G.status)}`));return}await zt(G,Xv),u(A=>A!==null&&A.group.id===$.id?null:A),r(A=>A===$.id?null:A),f(null),p(!1),await S(),await B()}catch(G){b(G instanceof Error?G.message:String(G))}finally{m(null)}}},[h,d,S,B]);return i.jsxs(Us,{open:e,onOpenChange:t,children:[i.jsx(Bm,{asChild:!0,children:i.jsxs(Ie,{type:"button",variant:"ghost",size:"icon",className:"relative size-8","aria-label":"Evaluation groups",title:"Evaluation groups",children:[i.jsx(_c,{className:"size-4"}),w?i.jsx(Vt,{className:"absolute -right-0.5 -top-0.5 size-3 animate-spin text-muted-foreground"}):v.length>0?i.jsx("span",{className:"absolute -right-1 -top-1 min-w-4 rounded-full bg-primary px-1 text-[10px] leading-4 text-primary-foreground",children:v.length}):null,i.jsx("span",{className:"sr-only",children:"Evaluation groups"})]})}),i.jsxs(Hs,{className:"flex max-h-[85vh] max-w-5xl flex-col overflow-hidden",children:[i.jsx(Ws,{children:i.jsxs(Vs,{className:"flex items-center gap-2 pr-8",children:[i.jsx(_c,{className:"size-5 text-muted-foreground"}),i.jsx("span",{children:"Groups"}),i.jsx(ot,{variant:"outline",children:ar(v.length)})]})}),i.jsxs("div",{className:"flex min-h-0 items-center justify-between gap-3 border-b border-border pb-3",children:[i.jsx("p",{className:"text-xs text-muted-foreground",children:"Evaluation batches, model runs, and exported evidence packs."}),i.jsxs(Ie,{type:"button",variant:"outline",size:"sm",className:"shrink-0",onClick:T,children:[i.jsx(Wi,{className:"size-3.5"}),"Refresh"]})]}),i.jsxs("div",{className:"grid min-h-0 flex-1 gap-4 md:grid-cols-[260px_minmax(0,1fr)]",children:[i.jsx(EP,{groups:v,selectedGroupId:j?.id??null,isLoading:w,error:C,onSelect:W}),i.jsx(TP,{group:j,deleteTarget:d,deleteEvidence:h,exportResult:E,evidenceResponse:N,evidenceLoading:z,evidenceError:M,exportError:a,deleteError:x,exportingGroupId:o,deletingGroupId:y,onDeleteEvidenceChange:p,onExport:D,onRequestDelete:k,onCancelDelete:L,onConfirmDelete:()=>{U()}})]})]})]})}function EP({groups:e,selectedGroupId:t,isLoading:n,error:r,onSelect:o}){return n?i.jsx("div",{className:"flex min-h-48 items-center justify-center rounded-md border border-dashed border-border text-xs text-muted-foreground",children:"Loading groups..."}):r!==void 0?i.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:r.message}):e.length===0?i.jsx("div",{className:"rounded-md border border-dashed border-border px-3 py-8 text-center text-xs text-muted-foreground",children:"No groups yet."}):i.jsx("div",{className:"min-h-0 overflow-y-auto pr-1",children:i.jsx("div",{className:"space-y-2",children:e.map(s=>{const a=sx(s),l=t===s.id;return i.jsxs("button",{type:"button",onClick:()=>o(s.id),className:xe("w-full rounded-md border px-3 py-2 text-left text-xs transition-colors",l?"border-primary bg-primary/5":"border-border bg-background hover:bg-muted/50"),children:[i.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[i.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:s.title}),i.jsx(ot,{variant:"outline",className:Gl(s.status),children:Jl(s.status)})]}),i.jsxs("div",{className:"mt-1 flex items-center gap-2 text-muted-foreground",children:[i.jsxs("span",{children:[a.memberCount," sessions"]}),i.jsx("span",{children:Yl(s.updatedAt)})]})]},s.id)})})})}function TP({group:e,deleteTarget:t,deleteEvidence:n,exportResult:r,evidenceResponse:o,evidenceLoading:s,evidenceError:a,exportError:l,deleteError:c,exportingGroupId:u,deletingGroupId:d,onDeleteEvidenceChange:f,onExport:h,onRequestDelete:p,onCancelDelete:y,onConfirmDelete:m}){if(e===null)return i.jsx("div",{className:"flex min-h-48 items-center justify-center rounded-md border border-dashed border-border text-xs text-muted-foreground",children:"Select a group to inspect."});const x=sx(e),b=jP(e,r,o),v=NP(e,r,o),w=CP(e,r),C=yP(e,r),S=u===e.id,j=d===e.id,E=t?.id===e.id;return i.jsx("div",{className:"min-h-0 overflow-y-auto pr-1",children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[i.jsxs("div",{className:"min-w-0 space-y-1",children:[i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[i.jsx("h3",{className:"min-w-0 truncate text-base font-semibold",children:e.title}),i.jsx(ot,{variant:"outline",className:Gl(e.status),children:Jl(e.status)}),i.jsx(ot,{variant:"outline",children:e.kind})]}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[i.jsx("span",{children:ix(e.project)}),i.jsxs("span",{children:["updated ",Yl(e.updatedAt)]})]})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[i.jsx(Ie,{type:"button",variant:"outline",size:"icon",className:"size-8 text-red-600 hover:text-red-700","aria-label":"Delete group",title:"Delete group",disabled:j,onClick:()=>p(e),children:j?i.jsx(Vt,{className:"size-3.5 animate-spin"}):i.jsx(ur,{className:"size-3.5"})}),i.jsxs(Ie,{type:"button",variant:"default",size:"sm",className:"shrink-0",disabled:S||j,onClick:()=>{h(e)},children:[S?i.jsx(Vt,{className:"size-3.5 animate-spin"}):i.jsx(ws,{className:"size-3.5"}),"Export evidence"]})]})]}),e.task!==null&&e.task.trim().length>0&&i.jsx("p",{className:"rounded-md border border-border bg-muted/20 px-3 py-2 text-xs text-muted-foreground",children:e.task}),E&&i.jsx(AP,{group:e,deleteEvidence:n,isDeleting:j,error:c,onDeleteEvidenceChange:f,onCancel:y,onConfirm:m}),i.jsxs("div",{className:"grid gap-2 sm:grid-cols-4",children:[i.jsx(dn,{label:"Members",value:x.memberCount}),i.jsx(dn,{label:"Done",value:x.completedMembers}),i.jsx(dn,{label:"Failed",value:x.failedMembers}),i.jsx(dn,{label:"Running",value:x.runningMembers})]}),b!==null&&i.jsxs("div",{className:"grid gap-2 sm:grid-cols-4",children:[i.jsx(dn,{label:"Requests",value:b.requestCount}),i.jsx(dn,{label:"Errors",value:b.errorCount}),i.jsx(dn,{label:"Tokens",value:b.tokenUsage.total}),i.jsx(dn,{label:"Missing",value:b.missingSessions})]}),i.jsx(IP,{report:v,loading:s,error:a,hasEvidence:w!==null}),i.jsx(zP,{evidence:w}),l!==null&&i.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:l}),c!==null&&!E&&i.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:c}),i.jsx(PP,{rows:C})]})})}function AP({group:e,deleteEvidence:t,isDeleting:n,error:r,onDeleteEvidenceChange:o,onCancel:s,onConfirm:a}){const l=e.evidence!==null,c=e.evidence?.markdownPath??"No evidence pack exported.";return i.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-3 text-red-900",children:i.jsxs("div",{className:"flex min-w-0 flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[i.jsxs("div",{className:"min-w-0 space-y-2",children:[i.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[i.jsx(ur,{className:"size-4 text-red-600"}),i.jsx("span",{children:"Delete group?"})]}),i.jsxs("p",{className:"text-xs text-red-800",children:["Delete ",i.jsx("span",{className:"font-medium",children:e.title}),". Session logs and run records stay intact."]}),i.jsxs("label",{className:xe("flex min-w-0 items-start gap-2 text-xs",l?"cursor-pointer":"opacity-60"),children:[i.jsx("input",{type:"checkbox",className:"mt-0.5 size-4 shrink-0",checked:t,disabled:!l||n,onChange:u=>o(u.currentTarget.checked)}),i.jsxs("span",{className:"min-w-0",children:[i.jsx("span",{className:"block font-medium",children:"Also delete exported evidence files"}),i.jsx("code",{className:"mt-1 block truncate font-mono text-[11px] text-red-700",children:c})]})]}),r!==null&&i.jsx("div",{className:"rounded-md border border-red-200 bg-white px-2 py-1.5 text-xs text-red-700",children:r})]}),i.jsxs("div",{className:"flex shrink-0 justify-end gap-2",children:[i.jsx(Ie,{type:"button",variant:"outline",size:"sm",disabled:n,onClick:s,children:"Cancel"}),i.jsxs(Ie,{type:"button",variant:"destructive",size:"sm",disabled:n,onClick:a,children:[n?i.jsx(Vt,{className:"size-3.5 animate-spin"}):i.jsx(ur,{className:"size-3.5"}),"Delete"]})]})]})})}function dn({label:e,value:t}){return i.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[i.jsx("div",{className:"text-[11px] font-medium uppercase text-muted-foreground",children:e}),i.jsx("div",{className:"mt-1 font-mono text-sm font-semibold",children:ar(t)})]})}function IP({report:e,loading:t,error:n,hasEvidence:r}){const{copied:o,copy:s}=en(e?.markdown??null);return e===null&&!t&&n===void 0?null:t?i.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-muted/20 px-3 py-2 text-xs text-muted-foreground",children:[i.jsx(Vt,{className:"size-3.5 animate-spin"}),"Loading evidence report..."]}):n!==void 0&&r?i.jsxs("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:["Failed to load evidence report: ",n.message]}):e===null?null:i.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[i.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("span",{className:"text-xs font-semibold",children:"Evidence report"}),i.jsx(ot,{variant:"outline",className:vP(e.status),children:e.status})]}),i.jsx(Ie,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":o?"Copied evidence report":"Copy evidence report",onClick:s,children:o?i.jsx(et,{className:"size-3.5 text-emerald-500"}):i.jsx(kt,{className:"size-3.5"})})]}),i.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:e.summary})]})}function zP({evidence:e}){return e===null?i.jsx("div",{className:"rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground",children:"No evidence pack exported yet."}):i.jsxs("div",{className:"space-y-2 rounded-md border border-border bg-muted/20 px-3 py-2",children:[i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:"text-xs font-semibold",children:"Evidence paths"}),i.jsx("span",{className:"text-[11px] text-muted-foreground",children:Yl(e.exportedAt)})]}),i.jsxs("div",{className:"grid gap-2",children:[i.jsx(Ii,{label:"JSON",value:e.jsonPath}),i.jsx(Ii,{label:"Markdown",value:e.markdownPath}),i.jsx(Ii,{label:"HTML",value:e.htmlPath})]})]})}function Ii({label:e,value:t}){const{copied:n,copy:r}=en(t);return i.jsxs("div",{className:"flex min-w-0 items-center gap-2 rounded-md border border-border bg-background px-2 py-1.5",children:[i.jsx("span",{className:"w-16 shrink-0 text-[11px] font-medium text-muted-foreground",children:e}),i.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs",children:t}),i.jsx(Ie,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":n?`Copied ${e} path`:`Copy ${e} path`,onClick:r,children:n?i.jsx(et,{className:"size-3.5 text-emerald-500"}):i.jsx(kt,{className:"size-3.5"})})]})}function PP({rows:e}){return e.length===0?i.jsx("div",{className:"rounded-md border border-dashed border-border px-3 py-8 text-center text-xs text-muted-foreground",children:"No sessions attached."}):i.jsxs("div",{className:"overflow-hidden rounded-md border border-border",children:[i.jsx("div",{className:"border-b border-border bg-muted/30 px-3 py-2 text-xs font-semibold",children:"Members"}),i.jsx("div",{className:"overflow-x-auto",children:i.jsxs("table",{className:"w-full min-w-[760px] text-left text-xs",children:[i.jsx("thead",{className:"border-b border-border bg-muted/20 text-muted-foreground",children:i.jsxs("tr",{children:[i.jsx("th",{className:"px-3 py-2 font-medium",children:"Session"}),i.jsx("th",{className:"px-3 py-2 font-medium",children:"Provider / Model"}),i.jsx("th",{className:"px-3 py-2 font-medium",children:"Status"}),i.jsx("th",{className:"px-3 py-2 font-medium",children:"Requests"}),i.jsx("th",{className:"px-3 py-2 font-medium",children:"Errors"}),i.jsx("th",{className:"px-3 py-2 font-medium",children:"First chunk"}),i.jsx("th",{className:"px-3 py-2 font-medium",children:"Tokens"})]})}),i.jsx("tbody",{children:e.map(t=>i.jsx(RP,{row:t},t.member.id))})]})})]})}function RP({row:e}){const t=e.member,n=e.exportMember?.session??null,r=SP(e),o=n?.inspectorPath??tf(t.sessionId),s=n?.requestCount??null,a=n?.errorCount??null,l=n?.tokenUsage.total??null,c=r?.firstChunkMs??null,u=ax(t.label,t.sessionId);return i.jsxs("tr",{className:"border-b border-border last:border-0",children:[i.jsxs("td",{className:"max-w-56 px-3 py-2",children:[i.jsxs("a",{href:o,target:"_blank",rel:"noreferrer",className:"inline-flex max-w-full min-w-0 items-center gap-2 rounded-sm font-mono text-xs text-primary outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","aria-label":`Open session ${u}`,title:`Open session ${u}`,children:[i.jsx("span",{className:"min-w-0 truncate",children:u}),i.jsx(Ya,{className:"size-3 shrink-0 text-muted-foreground"})]}),i.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:ix(t.agent)})]}),i.jsx("td",{className:"max-w-52 px-3 py-2",children:i.jsx("span",{className:"block truncate",children:kP(t)})}),i.jsx("td",{className:"px-3 py-2",children:i.jsx(ot,{variant:"outline",className:Gl(t.status),children:Jl(t.status)})}),i.jsx("td",{className:"px-3 py-2 font-mono",children:s===null?"-":ar(s)}),i.jsx("td",{className:"px-3 py-2 font-mono",children:a===null?"-":ar(a)}),i.jsx("td",{className:"px-3 py-2 font-mono",children:wP(c)}),i.jsx("td",{className:"px-3 py-2 font-mono",children:l===null?"-":ar(l)})]})}function OP(){return i.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[i.jsx("title",{children:"Claude Code"}),i.jsx("path",{clipRule:"evenodd",d:"M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z"})]})}function MP(){return i.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[i.jsx("title",{children:"OpenCode"}),i.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})]})}function LP(){return i.jsxs("svg",{fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[i.jsx("title",{children:"MiMo Code"}),i.jsx("text",{x:"12",y:"18",textAnchor:"middle",fontSize:"16",fontWeight:"800",fontFamily:"system-ui, sans-serif",children:"M"})]})}const DP=re({name:I(),apiKey:I(),format:Re(["anthropic","openai"]),anthropicBaseUrl:I(),openaiBaseUrl:I(),models:ye(I()),sourceTool:Re(["claude-code","opencode","mimo-code"]),alreadyExists:He()}),FP=re({providers:ye(DP),warnings:ye(I()).optional()}),$P=re({success:He().optional(),imported:se().optional(),message:I().optional(),errors:ye(I()).optional()}),BP={"claude-code":OP,opencode:MP,"mimo-code":LP};function UP({open:e,onOpenChange:t,onImportComplete:n}){const[r,o]=g.useState(!1),[s,a]=g.useState(null),[l,c]=g.useState([]),[u,d]=g.useState([]),[f,h]=g.useState(new Set),[p,y]=g.useState(!1),[m,x]=g.useState(null),[b,v]=g.useState(null),w=g.useCallback(()=>{o(!0),a(null),d([]),c([]),h(new Set),x(null),v(null),fetch("/api/providers/scan").then(E=>E.ok?E.json().then(N=>{const z=FP.safeParse(N);if(!z.success){a(`Invalid response: ${z.error.message}`);return}c(z.data.providers),d(z.data.warnings??[]);const M=new Set;z.data.providers.forEach((B,T)=>{B.alreadyExists||M.add(T)}),h(M)}):E.text().then(N=>{a(`Scan failed (${E.status}): ${N}`)})).catch(E=>{a(E instanceof Error?E.message:String(E))}).finally(()=>{o(!1)})},[]);g.useEffect(()=>{e&&w()},[e,w]);const C=g.useCallback(E=>{h(N=>{const z=new Set(N);return z.has(E)?z.delete(E):z.add(E),z})},[]),S=g.useCallback(()=>{const E=l.filter((M,B)=>f.has(B));if(E.length===0)return;y(!0),v(null),x(null);const N=new Date().toISOString(),z=E.map(M=>({id:window.crypto.randomUUID(),name:M.name,apiKey:M.apiKey,format:M.format,anthropicBaseUrl:M.anthropicBaseUrl,openaiBaseUrl:M.openaiBaseUrl,models:M.models,createdAt:N,updatedAt:N}));fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providers:z})}).then(M=>M.json()).then(M=>{const B=$P.safeParse(M);if(!B.success){v(`Invalid response: ${B.error.message}`);return}const T=B.data;c(D=>D.map((k,L)=>f.has(L)?{...k,alreadyExists:!0}:k)),h(new Set),T.errors!==void 0&&T.errors.length>0&&T.message!==void 0?x(T.message):x(`Imported ${T.imported??E.length} provider(s)`),n()}).catch(M=>{v(M instanceof Error?M.message:String(M))}).finally(()=>{y(!1)})},[l,f,n]),j=l.some(E=>!E.alreadyExists);return i.jsx(Us,{open:e,onOpenChange:t,children:i.jsxs(Hs,{className:"max-w-xl max-h-[80vh] overflow-hidden flex flex-col",children:[i.jsxs(Ws,{children:[i.jsx(Vs,{children:"Import from External Tools"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Detect provider configurations from Claude Code, OpenCode, and MiMo Code."})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto space-y-3",children:[r&&i.jsxs("div",{className:"flex items-center justify-center py-8 gap-2 text-muted-foreground",children:[i.jsx(Vt,{className:"size-4 animate-spin"}),i.jsx("span",{className:"text-sm",children:"Scanning for external providers..."})]}),s!==null&&i.jsxs("div",{className:"flex items-center gap-2 text-destructive text-sm py-4",children:[i.jsx(Wr,{className:"size-4"}),s]}),!r&&s===null&&l.length===0&&i.jsxs("p",{className:"text-sm text-muted-foreground py-8 text-center",children:["No external provider configurations found.",i.jsx("br",{}),i.jsx("span",{className:"text-xs",children:"Supported tools: Claude Code (~/.claude/settings.json), OpenCode (~/.config/opencode/opencode.json), MiMo Code (~/.config/mimocode/mimocode.jsonc)"})]}),!r&&l.map((E,N)=>i.jsxs("label",{className:`flex items-start gap-3 p-3 border rounded-md ${E.alreadyExists?"":"cursor-pointer hover:bg-muted/50"}`,children:[!E.alreadyExists&&i.jsx("input",{type:"checkbox",checked:f.has(N),disabled:p,onChange:()=>C(N),className:"mt-0.5 size-4"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[(()=>{const z=BP[E.sourceTool];return z===void 0?null:i.jsx(z,{})})(),E.alreadyExists&&i.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Already added"})]}),i.jsxs("div",{className:"text-xs text-muted-foreground mt-1 truncate",children:[E.models.slice(0,4).join(", "),E.models.length>4?` +${E.models.length-4} more`:""]}),i.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:E.format==="anthropic"?E.anthropicBaseUrl:E.openaiBaseUrl}),i.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 font-mono",children:E.apiKey.length>8?`${E.apiKey.slice(0,4)}••••${E.apiKey.slice(-4)}`:"••••"})]})]},`${E.sourceTool}-${E.name}`)),u.length>0&&i.jsx("div",{className:"text-xs text-muted-foreground space-y-1 border-t pt-2",children:u.map((E,N)=>i.jsxs("div",{className:"flex items-center gap-1",children:[i.jsx(Wr,{className:"size-3"}),E]},N))}),m!==null&&i.jsx("div",{className:"text-sm text-green-500 border-t pt-2",children:m}),b!==null&&i.jsx("div",{className:"text-sm text-destructive border-t pt-2",children:b})]}),i.jsxs("div",{className:"flex items-center justify-between pt-3 border-t",children:[i.jsxs(Ie,{variant:"outline",size:"sm",onClick:w,disabled:r,children:[i.jsx(Vt,{className:`size-3 mr-1 ${r?"animate-spin":""}`}),"Rescan"]}),i.jsxs(Ie,{size:"sm",onClick:S,disabled:!j||f.size===0||p,children:[i.jsx(ws,{className:"size-3 mr-1"}),p?"Importing...":`Import Selected (${f.size})`]})]})]})})}function lx(e){return e.length<=8?"••••••••":e.slice(0,4)+"••••••••"+e.slice(-4)}const cx=re({id:I().min(1),aliases:ye(I()).optional().default([]),contextWindow:se().int().positive().optional(),outputLimit:se().int().positive().optional(),sourceUrl:I().optional()}),HP=re({name:I().min(1).optional(),aliases:ye(I()).optional().default([]),baseUrls:ye(I()).optional().default([]),models:ye(cx).min(1)});re({version:se().int().positive().optional(),updatedAt:I().optional(),providers:ye(HP).optional().default([]),models:ye(cx).optional().default([])});function md(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}function WP(e){const t=e.models.filter(n=>n.trim()!=="");return t.length>0?t:e.model!==void 0&&e.model.trim()!==""?[e.model]:[]}function Xl(e,t){const n=md(t);return(e.modelMetadata??[]).find(o=>md(o.model)===n)??null}function VP(e){const t=WP(e);return t.length===0?!1:t.every(n=>{const r=Xl(e,n);return r!==null&&r.contextWindow!==void 0})}function ZP(e,t){if(e===null)return null;for(const n of t){const r=Xl(n,e);if(r!==null&&r.contextWindow!==void 0)return{providerName:n.name,model:r.model,tokens:r.contextWindow,sourceUrl:r.sourceUrl}}return null}const qP={deepseek:"https://api-docs.deepseek.com/zh-cn/"};function KP(e){return Object.prototype.hasOwnProperty.call(e,"success")}function GP(e){return Object.prototype.hasOwnProperty.call(e,"notConfigured")}function xt(e){return e!==void 0&&e.trim()!==""}function Ca(e){if(e===void 0)return;const t=Object.entries(e).map(([n,r])=>`${n}: ${r}`);if(t.length!==0)return t.join(`
|
|
115
115
|
`)}function gd(e){return Ca(e)!==void 0}function xd(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function JP(e){return e>=10?`${e.toFixed(0)}/s`:`${e.toFixed(1)}/s`}function YP(e){const t=e.debug;return xt(e.error?.hint)||xt(e.error?.details)||xt(e.rawResponse)||xt(t?.requestUrl)||xt(t?.requestBody)||xt(t?.responseBody)||gd(t?.requestHeaders)||gd(t?.responseHeaders)||t?.responseStatus!==void 0}function fn({title:e,children:t}){return i.jsxs("div",{className:"space-y-1",children:[i.jsx("div",{className:"font-medium text-foreground/80",children:e}),t]})}function zr({value:e}){return i.jsx("pre",{className:"max-h-40 overflow-auto whitespace-pre-wrap break-all rounded-md bg-background/80 p-2 font-mono text-[11px] leading-relaxed text-foreground/80",children:e})}function XP({result:e}){const t=e.debug,n=t?.requestUrl,r=t?.requestMethod??"POST",o=Ca(t?.requestHeaders),s=Ca(t?.responseHeaders),a=t?.responseStatus!==void 0?`${t.responseStatus}${xt(t.responseStatusText)?` ${t.responseStatusText}`:""}`:void 0,l=t?.responseBody??e.rawResponse;return i.jsxs("div",{className:"max-h-80 max-w-full space-y-2 overflow-auto rounded-md border bg-muted/50 p-2 text-xs text-muted-foreground shadow-sm sm:w-[520px]",children:[xt(e.error?.hint)&&i.jsx(fn,{title:"Hint",children:i.jsx("div",{children:e.error.hint})}),xt(e.error?.details)&&i.jsx(fn,{title:"Error",children:i.jsx(zr,{value:e.error.details})}),xt(n)&&i.jsx(fn,{title:"Request",children:i.jsxs("div",{className:"rounded-md bg-background/80 p-2 font-mono text-[11px] break-all text-foreground/80",children:[r," ",n]})}),o!==void 0&&i.jsx(fn,{title:"Request Headers",children:i.jsx(zr,{value:o})}),xt(t?.requestBody)&&i.jsx(fn,{title:"Request Body",children:i.jsx(zr,{value:t.requestBody})}),xt(a)&&i.jsx(fn,{title:"Response Status",children:i.jsx("div",{className:"rounded-md bg-background/80 p-2 font-mono text-[11px] text-foreground/80",children:a})}),s!==void 0&&i.jsx(fn,{title:"Response Headers",children:i.jsx(zr,{value:s})}),xt(l)&&i.jsx(fn,{title:"Response Body",children:i.jsx(zr,{value:l})})]})}function Eo({results:e}){return i.jsxs("div",{className:"flex min-w-0 flex-col gap-2",children:[i.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[i.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Non-stream"}),i.jsx(bd,{result:e.nonStreaming})]}),i.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[i.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Stream"}),i.jsx(bd,{result:e.streaming})]})]})}function QP(e){const t={className:"size-3",strokeWidth:2};switch(e){case"timeout":return i.jsx(xn,{...t});case"network_unreachable":return i.jsx(ck,{...t});case"connection_refused":return i.jsx(dk,{...t});case"auth_failed":return i.jsx(Cw,{...t});case"rate_limited":return i.jsx(el,{...t});case"server_error":return i.jsx(Gw,{...t});case"invalid_response":return i.jsx($2,{...t});case"unknown":return i.jsx(Wr,{...t});default:return i.jsx(Wr,{...t})}}function bd({result:e}){const[t,n]=g.useState(!1);if(!KP(e))return GP(e)?i.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[i.jsx(Ew,{className:"size-3"}),i.jsx("span",{children:"Not configured"})]}):i.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[i.jsx(Vi,{className:"size-3 animate-spin"}),i.jsx("span",{children:"Testing..."})]});if(e.success){const l=[],c=[];e.inputTokens!==void 0&&l.push(i.jsxs("span",{children:[e.inputTokens," in"]},"in")),e.outputTokens!==void 0&&l.push(i.jsxs("span",{children:[e.outputTokens," out"]},"out")),e.cacheCreationInputTokens!==void 0&&e.cacheCreationInputTokens>0&&l.push(i.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["KV Cache +",e.cacheCreationInputTokens]},"cache-create")),e.cacheReadInputTokens!==void 0&&e.cacheReadInputTokens>0&&l.push(i.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["KV Cache ~",e.cacheReadInputTokens]},"cache-read")),e.firstChunkMs!==void 0&&e.firstChunkMs!==null&&c.push(i.jsxs("span",{children:["first ",xd(e.firstChunkMs)]},"first")),e.totalStreamMs!==void 0&&e.totalStreamMs!==null&&c.push(i.jsxs("span",{children:["total ",xd(e.totalStreamMs)]},"total")),e.tokensPerSecond!==void 0&&e.tokensPerSecond!==null&&e.tokensPerSecond>0&&c.push(i.jsxs("span",{children:[JP(e.tokensPerSecond)," tok/s"]},"rate"));const u=[];for(let f=0;f<l.length;f++)f>0&&u.push(", "),u.push(l[f]);const d=[];for(let f=0;f<c.length;f++)f>0&&d.push(", "),d.push(c[f]);return i.jsx(nt,{children:i.jsxs(Fe,{children:[i.jsx($e,{asChild:!0,children:i.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 shrink-0",children:[i.jsx(L2,{className:"size-3"}),i.jsx("span",{children:"Connected"}),l.length>0&&i.jsxs("span",{className:"text-muted-foreground",children:["(",u,")"]}),c.length>0&&i.jsxs("span",{className:"hidden text-muted-foreground lg:inline",children:["(",d,")"]})]})}),i.jsx(Be,{children:"Connection test passed"})]})})}const r=e.error,o=r?.message??"Connection failed",s=r?.type??"unknown",a=YP(e);return i.jsxs("div",{className:"flex flex-col gap-1 shrink-0",children:[i.jsxs("div",{className:"flex items-center gap-1 text-xs text-red-600 max-w-[200px]",children:[QP(s),i.jsx(nt,{children:i.jsxs(Fe,{children:[i.jsx($e,{asChild:!0,children:i.jsx("span",{className:"truncate",children:o})}),i.jsx(Be,{children:"Connection test failed"})]})}),a&&i.jsxs("button",{type:"button",onClick:()=>n(l=>!l),"aria-expanded":t,"aria-label":t?"Hide provider test diagnostics":"Show provider test diagnostics",className:"inline-flex h-5 shrink-0 items-center gap-1 rounded border border-border/70 bg-background/70 px-1.5 text-[10px] text-muted-foreground transition-colors hover:text-foreground",children:[t?i.jsx(Xa,{className:"size-3"}):i.jsx(Qa,{className:"size-3"}),i.jsx("span",{children:t?"Hide":"Details"})]})]}),t&&a&&i.jsx(XP,{result:e})]})}function eR(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n,o=Math.floor(r/1e3);if(o<60)return"just now";const s=Math.floor(o/60);if(s<60)return`${s}m ago`;const a=Math.floor(s/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function tR(e){if(e===void 0||e.trim()==="")return null;try{const t=new URL(e);if(t.protocol!=="https:"&&t.protocol!=="http:")return null;const n=t.hostname.toLowerCase(),r=n==="huggingface.co"||n.endsWith(".huggingface.co");return{label:r?"HF":"Source",title:r?"Open Hugging Face model source":"Open model metadata source",url:e}}catch{return null}}function nR({provider:e,testResults:t,isTesting:n,testingTimeLeft:r,isHighlighted:o,onEdit:s,onDelete:a,onTest:l,onRefreshMetadata:c,isRefreshingMetadata:u=!1}){const[d,f]=g.useState(!1),[h,p]=g.useState(!1),[y,m]=g.useState(!1);function x(){Ot(e.apiKey).then(S=>{S&&(p(!0),setTimeout(()=>p(!1),2e3))})}const b=e.apiDocsUrl??Object.entries(qP).find(([S])=>e.name.toLowerCase().includes(S))?.[1],v=VP(e),w=e.modelMetadataUrl!==void 0&&e.modelMetadataUrl.trim()!=="",C=w?"Refresh":"Import defaults";return i.jsxs("div",{className:`border rounded-lg p-4 flex flex-col gap-3 bg-card transition-all duration-500 ${o===!0?"ring-2 ring-primary shadow-md":""}`,children:[i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[i.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[i.jsx("span",{className:"font-medium truncate",children:e.name}),e.source==="company"&&i.jsx(nt,{children:i.jsxs(Fe,{children:[i.jsx($e,{asChild:!0,children:i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400 shrink-0",children:"公司"})}),i.jsx(Be,{children:"Company-provided API key"})]})}),e.source==="personal"&&i.jsx(nt,{children:i.jsxs(Fe,{children:[i.jsx($e,{asChild:!0,children:i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400 shrink-0",children:"个人"})}),i.jsx(Be,{children:"Your personal API key"})]})})]}),b!==void 0&&i.jsxs("a",{href:b,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1 text-xs",title:"View API documentation",children:[i.jsx(Ya,{className:"size-3"}),i.jsx("span",{className:"sr-only",children:"Docs"})]})]}),e.models!==void 0&&e.models.length>0&&i.jsx("div",{className:"flex flex-wrap gap-1",children:e.models.map(S=>{const j=Xl(e,S),E=tR(j?.sourceUrl);return i.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:[i.jsx("span",{children:S}),j!==null&&j.contextWindow!==void 0&&i.jsx("span",{className:"font-mono text-foreground/80",children:wp(j.contextWindow)}),E!==null&&i.jsx(nt,{children:i.jsxs(Fe,{children:[i.jsx($e,{asChild:!0,children:i.jsx("a",{href:E.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-0.5 rounded border border-border/70 bg-background/70 px-1 font-mono text-[10px] leading-4 text-muted-foreground transition-colors hover:text-foreground","aria-label":E.title,children:E.label})}),i.jsx(Be,{children:E.title})]})})]},S)})}),!v&&i.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border border-amber-500/25 bg-amber-500/6 px-2 py-1.5 text-xs text-muted-foreground",children:[i.jsx("span",{children:"Context window metadata missing"}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[i.jsxs(Ie,{type:"button",variant:"outline",size:"sm",onClick:()=>c?.(e.id),className:"h-6 gap-1 px-2 text-xs",disabled:u,children:[i.jsx(Vi,{className:`size-3 ${u?"animate-spin":""}`}),C]}),!w&&i.jsx(Ie,{type:"button",variant:"ghost",size:"sm",onClick:()=>s(e),className:"h-6 px-2 text-xs",children:"Set URL"})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("code",{className:"text-xs text-muted-foreground bg-muted px-2 py-1 rounded flex-1 truncate",children:d?e.apiKey:lx(e.apiKey)}),i.jsx("button",{type:"button",onClick:()=>f(S=>!S),className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":d?"Hide API key":"Show API key",children:d?i.jsx(Xa,{className:"size-4"}):i.jsx(Qa,{className:"size-4"})}),i.jsx("button",{type:"button",onClick:x,className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":"Copy API key",children:h?i.jsx(et,{className:"size-4 text-green-500"}):i.jsx(kt,{className:"size-4"})})]}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&i.jsxs("div",{className:"flex min-w-0 flex-col gap-2",children:[i.jsxs("div",{className:"min-w-0 text-xs text-muted-foreground",children:[i.jsx("span",{className:"font-medium",children:"Anthropic:"})," ",i.jsx("span",{className:"truncate",children:e.anthropicBaseUrl})]}),t!==void 0&&i.jsx(Eo,{results:t.anthropic})]}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&i.jsxs("div",{className:"flex min-w-0 flex-col gap-2",children:[i.jsxs("div",{className:"min-w-0 text-xs text-muted-foreground",children:[i.jsx("span",{className:"font-medium",children:"OpenAI:"})," ",i.jsx("span",{className:"truncate",children:e.openaiBaseUrl})]}),t!==void 0&&i.jsx(Eo,{results:t.openai})]}),t?.testedAt!==void 0&&i.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[i.jsx(xn,{className:"size-3"}),i.jsxs("span",{children:["Tested ",eR(t.testedAt)]})]}),t?.models!==void 0&&Object.keys(t.models).length>0&&i.jsxs("div",{className:"border-t pt-2",children:[i.jsxs("button",{type:"button",onClick:()=>m(S=>!S),className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",children:[y?i.jsx(wt,{className:"size-3"}):i.jsx(Kt,{className:"size-3"}),"Model Test Results (",Object.keys(t.models).length,")"]}),y&&i.jsx("div",{className:"mt-2 overflow-x-auto",children:i.jsxs("table",{className:"w-full text-xs border-collapse",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"border-b border-border",children:[i.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Model"}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&i.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Anthropic"}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&i.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"OpenAI"})]})}),i.jsx("tbody",{children:Object.entries(t.models).map(([S,j])=>i.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[i.jsx("td",{className:"py-1 px-2 font-medium",children:S}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&i.jsx("td",{className:"py-1 px-2 align-top",children:i.jsx(Eo,{results:j.anthropic})}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&i.jsx("td",{className:"py-1 px-2 align-top",children:i.jsx(Eo,{results:j.openai})})]},S))})]})})]}),i.jsxs("div",{className:"flex gap-2 pt-1 border-t",children:[l!==void 0&&i.jsxs(Ie,{variant:"outline",size:"sm",onClick:()=>l(e.id),className:"text-xs h-7 gap-1",disabled:n??!1,children:[i.jsx(Vi,{className:`size-3 ${n??!1?"animate-spin":""}`}),n??!1?r!==void 0?`Testing (${r}s)`:"Testing...":"Test"]}),i.jsxs(Ie,{variant:"outline",size:"sm",onClick:()=>s(e),className:"text-xs h-7 gap-1",disabled:n??!1,children:[i.jsx(sp,{className:"size-3"}),"Edit"]}),i.jsxs(Ie,{variant:"outline",size:"sm",onClick:()=>a(e.id),className:"text-xs h-7 gap-1 text-destructive hover:text-destructive",disabled:n??!1,children:[i.jsx(ur,{className:"size-3"}),"Delete"]})]})]})}const yd=["zhipu","zhipuai","bigmodel","z.ai","zai","glm"],vd=["zhipu coding","glm coding","bigmodel coding","z.ai coding","zai coding"],rR={deepseek:{openaiBaseUrl:"https://api.deepseek.com"},minimax:{anthropicBaseUrl:"https://api.minimaxi.com/anthropic",apiDocsUrl:"https://platform.minimaxi.com/docs/api-reference/api-overview"},"zhipu coding":{anthropicBaseUrl:"https://open.bigmodel.cn/api/anthropic",openaiBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/coding-plan/quick-start"},"glm coding":{anthropicBaseUrl:"https://open.bigmodel.cn/api/anthropic",openaiBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/coding-plan/quick-start"},"bigmodel coding":{anthropicBaseUrl:"https://open.bigmodel.cn/api/anthropic",openaiBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/coding-plan/quick-start"},"z.ai coding":{anthropicBaseUrl:"https://open.bigmodel.cn/api/anthropic",openaiBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/coding-plan/quick-start"},"zai coding":{anthropicBaseUrl:"https://open.bigmodel.cn/api/anthropic",openaiBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/coding-plan/quick-start"},zhipu:{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},zhipuai:{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},bigmodel:{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},"z.ai":{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},zai:{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},glm:{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},alibaba:{openaiBaseUrl:"https://dashscope.aliyuncs.com/compatible-mode"}},wd=["MiniMax M3","MiniMax M2.7","MiniMax M2.7-highspeed","MiniMax M2.5","MiniMax M2.5-highspeed","MiniMax M2.1","MiniMax M2.1-highspeed","MiniMax M2"],kd=["glm-5","glm-5.1","glm-5.2","qwen3.6-plus","qwen3.7-max"],_d=["glm-5.2","glm-5.1","glm-5","glm-5-turbo","glm-4.7","glm-4.7-flashx","glm-4.6","glm-4.5","glm-4.5-air","glm-4.5-x","glm-4.5-airx","glm-4.5-flash"],ja="__unset__",fs="__custom__",ux=[{value:"32K",label:"Small"},{value:"64K",label:"Standard"},{value:"128K",label:"Medium"},{value:"200K",label:"Long"},{value:"256K",label:"Extended"},{value:"512K",label:"Large"},{value:"1M",label:"Max"}];function Tn(){return{contextWindow:"",contextWindowMode:"unset",outputLimit:""}}function Sd(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}function dx(e,t){const n=Sd(t);return e?.modelMetadata?.find(r=>Sd(r.model)===n)??null}function fx(e){const t=Ko(e);if(t===null)return null;for(const n of ux)if(Ko(n.value)===t)return n.value;return null}function oR(e){return e.trim()===""?"unset":fx(e)!==null?"preset":"custom"}function sR(e){switch(e.contextWindowMode){case"unset":return ja;case"custom":return fs;case"preset":return fx(e.contextWindow)??fs}}function zi(e){const t=e.trim().replaceAll(",","");if(t==="")return{amount:"",unit:"K"};const n=/^(\d+(?:\.\d+)?)\s*([kKmM])?$/.exec(t);if(n===null)return{amount:t,unit:"K"};const r=n[1];if(r===void 0)return{amount:t,unit:"K"};const o=n[2];if(o===void 0||o==="")return{amount:r,unit:"tokens"};switch(o.toLowerCase()){case"k":return{amount:r,unit:"K"};case"m":return{amount:r,unit:"M"};default:return{amount:t,unit:"K"}}}function Cd(e,t){const n=e.trim();if(n==="")return"";switch(t){case"K":return`${n}K`;case"M":return`${n}M`;case"tokens":return n}}function jd(e,t){return t.map(n=>{const r=dx(e,n),o=r?.contextWindow!==void 0?__(r.contextWindow):"";return{contextWindow:o,contextWindowMode:oR(o),outputLimit:r?.outputLimit?.toString()??""}})}function Nd(e){const t=e.trim();if(t==="")return null;const n=Number(t);return!Number.isInteger(n)||n<=0?null:n}function iR({provider:e,onSubmit:t,onCancel:n}){const[r,o]=g.useState(e?.name??""),[s,a]=g.useState(e?.apiKey??""),[l,c]=g.useState(!1),[u,d]=g.useState(!1),f=e?.models,[h,p]=g.useState(f!==void 0&&f.length>0?f:[""]),[y,m]=g.useState(()=>jd(e,f!==void 0&&f.length>0?f:[""])),[x,b]=g.useState("anthropic"),[v,w]=g.useState(e?.anthropicBaseUrl??""),[C,S]=g.useState(e?.openaiBaseUrl??""),[j,E]=g.useState(e?.apiDocsUrl??""),[N,z]=g.useState(e?.modelMetadataUrl??""),[M,B]=g.useState(e?.source),[T,D]=g.useState({}),[k,L]=g.useState(!1),[W,U]=g.useState(null),$=g.useRef([]);g.useEffect(()=>{if(W===null)return;const V=W;function J(H){if(!(H.target instanceof Node))return;const ae=$.current[V];ae!=null&&!ae.contains(H.target)&&U(null)}return document.addEventListener("mousedown",J),()=>document.removeEventListener("mousedown",J)},[W]);const[G,A]=g.useState(!1),[K,q]=g.useState(!1),P=r.toLowerCase().includes("minimax"),ie=r.toLowerCase().includes("alibaba"),le=[...yd,...vd].some(V=>r.toLowerCase().includes(V)),ge=P?wd:le?_d:ie?kd:[],ne=e?.modelMetadata?.some(V=>V.contextWindow!==void 0)??!1;function ue(){Ot(s).then(V=>{V&&(d(!0),setTimeout(()=>d(!1),2e3))})}g.useEffect(()=>{if(e){o(e.name),a(e.apiKey);const V=(e.models?.length??0)>0?e.models:[""];p(V),m(jd(e,V)),w(e.anthropicBaseUrl??""),S(e.openaiBaseUrl??""),E(e.apiDocsUrl??""),z(e.modelMetadataUrl??""),B(e.source),A(!1),q(!1)}},[e]),g.useEffect(()=>{const V=r.toLowerCase();for(const[J,H]of Object.entries(rR))if(V.includes(J)){H.anthropicBaseUrl!==void 0&&!G&&w(H.anthropicBaseUrl),H.openaiBaseUrl!==void 0&&!K&&S(H.openaiBaseUrl),H.apiDocsUrl!==void 0&&!j&&E(H.apiDocsUrl),J==="minimax"&&h.length===1&&h[0]===""&&p([wd[0]??""]),J==="alibaba"&&h.length===1&&h[0]===""&&p([kd[0]??""]),(yd.includes(J)||vd.includes(J))&&h.length===1&&h[0]===""&&p([_d[0]??""]);break}},[r]);function de(){const V={};return r.trim()||(V.name="Name is required"),s.trim()||(V.apiKey="API key is required"),(h.length===0||h.every(J=>!J.trim()))&&(V.models="At least one model is required"),v.trim()&&!he(v.trim())&&(V.anthropicBaseUrl="Invalid URL format"),C.trim()&&!he(C.trim())&&(V.openaiBaseUrl="Invalid URL format"),N.trim()&&!he(N.trim())&&(V.modelMetadataUrl="Invalid URL format"),y.forEach((J,H)=>{const ae=Ko(J.contextWindow),Y=Nd(J.outputLimit);J.contextWindow.trim()!==""&&ae===null&&(V[`modelMetadata.${H}.contextWindow`]="Context window must be a positive number, optionally using K or M"),J.outputLimit.trim()!==""&&Y===null&&(V[`modelMetadata.${H}.outputLimit`]="Output limit must be a positive integer"),ae!==null&&Y!==null&&Y>ae&&(V[`modelMetadata.${H}.outputLimit`]="Output limit should not exceed context window")}),!v.trim()&&!C.trim()&&(V.format="At least one format URL (Anthropic or OpenAI) is required"),D(V),Object.keys(V).length===0}function he(V){try{return new URL(V),!0}catch{return!1}}function me(V,J){p(H=>{const ae=[...H];return ae[V]=J,ae})}function fe(V,J){m(H=>{const ae=[...H];return ae[V]={...ae[V]??Tn(),...J},ae})}function Se(V,J){switch(J){case ja:fe(V,{contextWindow:"",contextWindowMode:"unset"});return;case fs:{const H=y[V]??Tn();fe(V,{contextWindow:H.contextWindow,contextWindowMode:"custom"});return}default:fe(V,{contextWindow:J,contextWindowMode:"preset"});return}}function _(V,J){const H=y[V]??Tn(),ae=zi(H.contextWindow);fe(V,{contextWindow:Cd(J,ae.unit),contextWindowMode:"custom"})}function ee(V,J){const H=y[V]??Tn(),ae=zi(H.contextWindow);switch(J){case"K":case"M":case"tokens":fe(V,{contextWindow:Cd(ae.amount,J),contextWindowMode:"custom"});return;default:return}}function Q(V){p(J=>J.filter((H,ae)=>ae!==V)),m(J=>J.filter((H,ae)=>ae!==V))}function O(){p(V=>[...V,""]),m(V=>[...V,Tn()])}function R(){const V=new Date().toISOString(),J=[];return h.forEach((H,ae)=>{const Y=H.trim();if(Y==="")return;const te=y[ae]??Tn(),F=Ko(te.contextWindow),X=Nd(te.outputLimit);if(F===null&&X===null)return;const ce=dx(e,Y);if(ce!==null&&ce.contextWindow===(F??void 0)&&ce.outputLimit===(X??void 0)){J.push({...ce,model:Y});return}const ve={model:Y,source:"manual",updatedAt:V};F!==null&&(ve.contextWindow=F),X!==null&&(ve.outputLimit=X),J.push(ve)}),J.length>0?J:e?.modelMetadata!==void 0?[]:void 0}function Z(V){if(V.preventDefault(),!!de()){L(!0);try{t({name:r.trim(),apiKey:s.trim(),models:h.map(J=>J.trim()).filter(J=>J!==""),anthropicBaseUrl:v.trim()||void 0,openaiBaseUrl:C.trim()||void 0,apiDocsUrl:j.trim()||void 0,modelMetadataUrl:N.trim()||void 0,modelMetadata:R(),source:M})}finally{L(!1)}}}return i.jsxs("form",{onSubmit:Z,className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs("label",{htmlFor:"provider-name",className:"text-sm font-medium",children:["Name ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsx("input",{id:"provider-name",type:"text",value:r,onChange:V=>o(V.target.value),placeholder:"Provider Name",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),T.name!==void 0&&i.jsx("p",{className:"text-xs text-destructive",children:T.name})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{htmlFor:"provider-source",className:"text-sm font-medium",children:"Token Source"}),i.jsxs("select",{id:"provider-source",value:M??"",onChange:V=>B(V.target.value==="company"||V.target.value==="personal"?V.target.value:void 0),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",children:[i.jsx("option",{value:"",children:"—"}),i.jsx("option",{value:"personal",children:"个人 (Personal)"}),i.jsx("option",{value:"company",children:"公司 (Company)"})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Label whether this API key is company-provided or personal."})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{htmlFor:"provider-model-metadata-url",className:"text-sm font-medium",children:"Model Metadata URL"}),i.jsx("input",{id:"provider-model-metadata-url",type:"text",value:N,onChange:V=>z(V.target.value),placeholder:"https://example.com/agent-inspector-models.json",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),T.modelMetadataUrl!==void 0&&i.jsx("p",{className:"text-xs text-destructive",children:T.modelMetadataUrl}),N.trim()===""&&i.jsx("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2 text-xs text-muted-foreground",children:"Built-in limits cover DeepSeek v4 pro/flash, MiniMax M3/M2.7/M2.5/M2.1, and GLM coding models. Use a registry URL for private or custom model limits."}),e!==void 0&&!ne&&N.trim()===""&&i.jsx("p",{className:"text-xs text-amber-400",children:"This provider has no matching context metadata yet."}),N.trim()!==""&&i.jsx("p",{className:"text-xs text-muted-foreground",children:"Agent Inspector will refresh model limits from this JSON registry after save."})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("label",{htmlFor:"provider-apikey",className:"text-sm font-medium",children:["API Key ",i.jsx("span",{className:"text-destructive",children:"*"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{id:"provider-apikey",type:"text",value:l||s.length===0?s:lx(s),onChange:V=>a(V.target.value),onFocus:()=>{!l&&s.length>0&&c(!0)},placeholder:"sk-ant-...",readOnly:!l&&s.length>0,className:"flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),i.jsx("button",{type:"button",onClick:()=>c(V=>!V),className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":l?"Hide API key":"Show API key",children:l?i.jsx(Xa,{className:"size-4"}):i.jsx(Qa,{className:"size-4"})}),i.jsx("button",{type:"button",onClick:ue,className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":"Copy API key",children:u?i.jsx(et,{className:"size-4 text-green-500"}):i.jsx(kt,{className:"size-4"})})]}),T.apiKey!==void 0&&i.jsx("p",{className:"text-xs text-destructive",children:T.apiKey})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("label",{className:"text-sm font-medium",children:["Models ",i.jsx("span",{className:"text-destructive",children:"*"})]}),h.map((V,J)=>{const H=y[J]??Tn(),ae=T[`modelMetadata.${J}.contextWindow`],Y=T[`modelMetadata.${J}.outputLimit`],te=sR(H),F=zi(H.contextWindow);return i.jsxs("div",{ref:X=>{$.current[J]=X},className:"space-y-2 rounded-md border border-border bg-muted/10 p-2",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx("input",{type:"text",value:V,onChange:X=>me(J,X.target.value),placeholder:ge.length>0?"Type or select a model...":"Model name",className:"w-full rounded-md border border-input bg-background px-4 py-3 pr-8 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),ge.length>0&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",onClick:()=>U(W===J?null:J),className:"absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors p-1 z-10","aria-label":"Show model suggestions",children:i.jsx(wt,{className:"size-4"})}),W===J&&i.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 z-50 bg-popover border border-border rounded-md shadow-md max-h-48 overflow-y-auto",children:ge.map(X=>i.jsx("button",{type:"button",onClick:()=>{me(J,X),U(null)},className:"w-full text-left px-3 py-2 text-sm hover:bg-muted transition-colors",children:X},X))})]})]}),h.length>1&&i.jsx("button",{type:"button",onClick:()=>Q(J),className:"text-muted-foreground hover:text-destructive transition-colors p-1 shrink-0","aria-label":"Remove model",children:i.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i.jsx("path",{d:"M3 6h18"}),i.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),i.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]})})]}),i.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[i.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[i.jsx("span",{children:"Context Window"}),i.jsxs(ls,{value:te,onValueChange:X=>Se(J,X),children:[i.jsx(us,{size:"sm",className:"w-full bg-background font-mono text-xs",children:i.jsx(cs,{})}),i.jsxs(ds,{className:"max-h-64",children:[i.jsx(Ft,{value:ja,children:"Not set"}),ux.map(X=>i.jsxs(Ft,{value:X.value,children:[X.label," · ",X.value]},X.value)),i.jsx(Ft,{value:fs,children:"Custom"})]})]}),H.contextWindowMode==="custom"&&i.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_5.75rem] gap-1.5",children:[i.jsx("input",{type:"text",inputMode:"decimal",value:F.amount,onChange:X=>_(J,X.target.value),placeholder:"128",className:"w-full rounded-md border border-input bg-background px-3 py-2 font-mono text-xs text-foreground ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px]"}),i.jsxs(ls,{value:F.unit,onValueChange:X=>ee(J,X),children:[i.jsx(us,{size:"sm",className:"w-full bg-background font-mono text-xs",children:i.jsx(cs,{})}),i.jsxs(ds,{children:[i.jsx(Ft,{value:"K",children:"K"}),i.jsx(Ft,{value:"M",children:"M"}),i.jsx(Ft,{value:"tokens",children:"tokens"})]})]})]}),ae!==void 0&&i.jsx("span",{className:"block text-destructive",children:ae})]}),i.jsxs("label",{className:"space-y-1 text-xs text-muted-foreground",children:[i.jsx("span",{children:"Output Limit"}),i.jsx("input",{type:"number",min:1,step:1e3,value:H.outputLimit,onChange:X=>fe(J,{outputLimit:X.target.value}),placeholder:"e.g. 8192",className:"w-full rounded-md border border-input bg-background px-3 py-2 font-mono text-xs text-foreground ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px]"}),Y!==void 0&&i.jsx("span",{className:"block text-destructive",children:Y})]})]})]},J)}),i.jsx("button",{type:"button",onClick:O,className:"text-xs text-primary hover:underline flex items-center gap-1",children:"+ Add Model"}),T.models!==void 0&&i.jsx("p",{className:"text-xs text-destructive",children:T.models})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex gap-1 border-b border-border",children:[i.jsx(nt,{children:i.jsxs(Fe,{children:[i.jsx($e,{asChild:!0,children:i.jsx("button",{type:"button",onClick:()=>b("anthropic"),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${x==="anthropic"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Anthropic Format"})}),i.jsx(Be,{children:"Anthropic Messages API format"})]})}),i.jsx(nt,{children:i.jsxs(Fe,{children:[i.jsx($e,{asChild:!0,children:i.jsx("button",{type:"button",onClick:()=>b("openai"),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${x==="openai"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"OpenAI Format"})}),i.jsx(Be,{children:"OpenAI Chat Completions API format"})]})})]}),T.format!==void 0&&i.jsx("p",{className:"text-xs text-destructive",children:T.format})]}),x==="anthropic"&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{htmlFor:"provider-anthropic-base-url",className:"text-sm font-medium",children:"Anthropic Base URL"}),i.jsx("input",{id:"provider-anthropic-base-url",type:"text",value:v,onChange:V=>{A(!0),w(V.target.value)},placeholder:"https://api.anthropic.com",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),T.anthropicBaseUrl!==void 0&&i.jsx("p",{className:"text-xs text-destructive",children:T.anthropicBaseUrl}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Anthropic-compatible endpoint URL. Leave empty if this provider does not support Anthropic format."})]}),x==="openai"&&i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{htmlFor:"provider-openai-base-url",className:"text-sm font-medium",children:"OpenAI Base URL"}),i.jsx("input",{id:"provider-openai-base-url",type:"text",value:C,onChange:V=>{q(!0),S(V.target.value)},placeholder:"https://api.openai.com/v1",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),T.openaiBaseUrl!==void 0&&i.jsx("p",{className:"text-xs text-destructive",children:T.openaiBaseUrl}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"OpenAI-compatible endpoint URL. Leave empty if this provider does not support OpenAI format."})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("label",{htmlFor:"provider-api-docs-url",className:"text-sm font-medium",children:"API Docs URL"}),i.jsx("input",{id:"provider-api-docs-url",type:"text",value:j,onChange:V=>E(V.target.value),placeholder:"https://api.example.com/docs",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional API documentation URL. If not set, uses known provider docs."})]}),i.jsxs("div",{className:"sticky bottom-0 bg-card border-t flex gap-2 justify-end pt-2 pb-2",children:[i.jsx(Ie,{type:"button",variant:"outline",onClick:n,disabled:k,children:"Cancel"}),i.jsx(Ie,{type:"submit",disabled:k,children:k?"Saving...":e?"Update Provider":"Add Provider"})]})]})}const aR=Re(["timeout","network_unreachable","connection_refused","auth_failed","rate_limited","server_error","invalid_response","unknown"]),lR=re({message:I(),type:aR,details:I().optional(),hint:I().optional()}),cR=re({type:Re(["text","thinking"]),text:I().optional(),thinking:I().optional()}),uR=re({requestUrl:I().optional(),requestMethod:I().optional(),requestHeaders:rt(I(),I()).optional(),requestBody:I().optional(),responseStatus:se().optional(),responseStatusText:I().optional(),responseHeaders:rt(I(),I()).optional(),responseBody:I().optional()}),dR=re({success:He(),error:lR.optional(),model:I().optional(),inputTokens:se().optional(),outputTokens:se().optional(),cacheCreationInputTokens:se().optional(),cacheReadInputTokens:se().optional(),latencyMs:se().optional(),firstChunkMs:se().nullable().optional(),totalStreamMs:se().nullable().optional(),tokensPerSecond:se().nullable().optional(),content:ye(cR).optional(),rawResponse:I().optional(),streaming:He().optional(),streamingChunks:re({chunks:ye(Of),truncated:He().default(!1)}).optional(),requestHeaders:rt(I(),I()).optional(),debug:uR.optional()}),Ed=sn([dR,re({notConfigured:Ne(!0)}),re({testing:Ne(!0)})]),ps=re({nonStreaming:Ed,streaming:Ed}),fR=re({anthropic:ps,openai:ps}),pR=re({anthropic:ps,openai:ps,models:rt(I(),fR).optional(),testedAt:I().optional()});function hR(){return{anthropic:{nonStreaming:{testing:!0},streaming:{testing:!0}},openai:{nonStreaming:{testing:!0},streaming:{testing:!0}}}}function Td(e,t){const n=()=>({nonStreaming:{success:!1,error:{message:e,type:t}},streaming:{notConfigured:!0}});return{anthropic:n(),openai:n()}}const mR=re({providerConfig:I()}),gR=re({success:He().optional(),imported:se().optional(),message:I().optional(),errors:ye(I()).optional()}),xR=re({provider:Go,imported:se(),matchedModels:ye(I()),missingModels:ye(I()),sourceUrl:I()}),To="Network error: could not reach the server. Is the proxy running?";function Ad(e){return{name:e.name,apiKey:e.apiKey,models:e.models,anthropicBaseUrl:(e.anthropicBaseUrl?.length??0)>0?e.anthropicBaseUrl:void 0,openaiBaseUrl:(e.openaiBaseUrl?.length??0)>0?e.openaiBaseUrl:void 0,apiDocsUrl:(e.apiDocsUrl?.length??0)>0?e.apiDocsUrl:void 0,modelMetadataUrl:(e.modelMetadataUrl?.length??0)>0?e.modelMetadataUrl:void 0,modelMetadata:e.modelMetadata,source:e.source}}function bR(e,t){const n=e?.models?.map(r=>r.trim()).filter(r=>r!=="").length??0;return Math.max(1,n)*t}async function yR(e,t){if(t.models!==void 0)try{await fetch(`/api/providers/${e}/test/log`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch{}}function vR({externalProviders:e,isLoading:t=!1,externalTestResults:n,externalTestingProviders:r,externalTestingTimeLeft:o,onProvidersMutate:s,onTestResultsChange:a,onTestingProvidersChange:l,onTestingTimeLeftChange:c}){const[u,d]=g.useState(!1),[f,h]=g.useState(),[p,y]=g.useState(null),[m,x]=g.useState({}),[b,v]=g.useState(new Set),[w,C]=g.useState({}),[S,j]=g.useState(null),[E,N]=g.useState(!1),[z,M]=g.useState(null),[B,T]=g.useState(!1),[D,k]=g.useState(!1),[L,W]=g.useState(null),[U,$]=g.useState("all"),[G,A]=g.useState(new Set),{providerTestTimeoutSeconds:K}=Ga(),q=g.useRef(null),P=g.useRef(null),ie=e??[],le=g.useMemo(()=>{const Y=U==="all"?ie:ie.filter(te=>te.source===U);return U==="all"?[...Y].sort((te,F)=>{const X={personal:0,company:1};return(X[te.source??""]??2)-(X[F.source??""]??2)}):Y},[ie,U]),ge=n??m,ne=r??b,ue=o??w,de=c?(Y,te)=>c(Y,te):(Y,te)=>{C(te===void 0?F=>{const X={...F};return delete X[Y],X}:F=>({...F,[Y]:te}))};g.useEffect(()=>{(async()=>{try{const Y=await fetch("/api/config/paths");if(Y.ok){const te=await zt(Y,mR);j(te.providerConfig)}}catch{}})()},[]);const he=g.useCallback(Y=>{P.current!==null&&clearTimeout(P.current),M(Y),q.current?.scrollTo({top:q.current.scrollHeight,behavior:"smooth"}),P.current=setTimeout(()=>{M(null),P.current=null},2e3)},[]);g.useEffect(()=>()=>{P.current!==null&&clearTimeout(P.current)},[]);const me=g.useCallback(()=>{s?.().catch(()=>{})},[s]),fe=g.useCallback((Y,te)=>{a?a(Y,te):x(F=>({...F,[Y]:te}))},[a]),Se=g.useCallback((Y,te)=>{if(l){l(Y,te);return}v(F=>{const X=new Set(F);return te?X.add(Y):X.delete(Y),X})},[l]),_=g.useCallback(async Y=>{fe(Y,hR()),Se(Y,!0);const te=new AbortController,F=ie.find(Ee=>Ee.id===Y);let ce=bR(F,K);de(Y,ce);const ve=setInterval(()=>{ce--,de(Y,ce),ce<=0&&(clearInterval(ve),te.abort())},1e3);try{const Ee=await fetch(`/api/providers/${Y}/test`,{method:"POST",signal:te.signal});if(Ee.ok){const We=await zt(Ee,pR);fe(Y,We),await yR(Y,We)}else fe(Y,Td(`HTTP ${Ee.status}: ${Ee.statusText}`,"server_error"))}catch(Ee){Ee instanceof Error&&Ee.name==="AbortError"&&fe(Y,Td("Request timed out","timeout"))}finally{clearInterval(ve),de(Y,void 0),Se(Y,!1)}},[K,ie,de,fe,Se]),ee=g.useCallback(async(Y,te,F=!0)=>{A(X=>{const ce=new Set(X);return ce.add(Y),ce});try{const X=te!==void 0&&te.trim()!==""?{url:te}:{},ce=await fetch(`/api/providers/${Y}/model-metadata`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(X)});if(!ce.ok)return F&&y(await tn(ce,"Failed to refresh model metadata")),!1;const ve=await zt(ce,xR);return ve.imported===0&&F?y("No matching model metadata found for this provider."):y(null),he(ve.provider.id),me(),ve.imported>0}catch{return F&&y(To),!1}finally{A(X=>{const ce=new Set(X);return ce.delete(Y),ce})}},[me,he]);function Q(Y){(async()=>{try{const te=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ad(Y))});if(!te.ok){y(await tn(te,"Failed to add provider"));return}const F=await zt(te,Go);d(!1),he(F.id),Y.modelMetadataUrl!==void 0&&Y.modelMetadataUrl.trim()!==""&&await ee(F.id,Y.modelMetadataUrl,!1),me(),await _(F.id)}catch{y(To)}})()}function O(Y){f&&(async()=>{try{const te=await fetch(`/api/providers/${f.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ad(Y))});if(!te.ok){y(await tn(te,"Failed to update provider"));return}const F=await zt(te,Go);h(void 0),he(F.id),Y.modelMetadataUrl!==void 0&&Y.modelMetadataUrl.trim()!==""&&await ee(F.id,Y.modelMetadataUrl,!1),me(),((Y.apiKey??"")!==(f.apiKey??"")||JSON.stringify(Y.models)!==JSON.stringify(f.models)||(Y.anthropicBaseUrl??"")!==(f.anthropicBaseUrl??"")||(Y.openaiBaseUrl??"")!==(f.openaiBaseUrl??""))&&await _(F.id)}catch{y(To)}})()}function R(Y){W(Y),k(!0)}function Z(){const Y=L;Y!==null&&(async()=>{let te;try{te=await fetch(`/api/providers/${Y}`,{method:"DELETE"})}catch{y(To);return}if(!te.ok){y(await tn(te,"Failed to delete provider"));return}me()})()}const V=g.useRef(null);function J(Y){const te="/api/providers/export";(async()=>{try{const F=await fetch(te);if(!F.ok){y("Failed to export providers");return}const X=await F.blob(),ce=URL.createObjectURL(X),ve=document.createElement("a");ve.href=ce,ve.download=F.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]??"providers.json",document.body.appendChild(ve),ve.click(),document.body.removeChild(ve),URL.revokeObjectURL(ce)}catch{y("Failed to export providers")}})()}function H(){V.current?.click()}function ae(Y){const te=Y.target.files?.[0];te&&(async()=>{try{const F=await te.text(),X=await fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F)}),ce=await zt(X,gR);X.ok&&ce.imported!==void 0&&ce.imported>0?(me(),y(null)):ce.errors&&ce.errors.length>0?y(ce.errors.join("; ")):y(ce.message??"Import failed")}catch{y("Failed to import providers")}Y.target.value=""})()}return t?i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading providers..."})}):u||f?i.jsxs("div",{className:"space-y-4",children:[i.jsx("div",{className:"flex items-center justify-between sticky top-0 bg-background z-10 pb-2",children:i.jsx("h3",{className:"text-lg font-medium",children:f?"Edit Provider":"Add New Provider"})}),i.jsx(iR,{provider:f,onSubmit:f?O:Q,onCancel:()=>{d(!1),h(void 0)}})]}):i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between sticky top-0 z-10 bg-background pb-2",children:[i.jsx("h3",{className:"text-lg font-medium",children:"Providers"}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(nt,{children:i.jsxs(Fe,{children:[i.jsx($e,{asChild:!0,children:i.jsxs(Ie,{variant:"outline",size:"sm",onClick:()=>J(),className:"gap-1 hover:bg-muted",children:[i.jsx(ws,{className:"size-3"}),"Export"]})}),i.jsx(Be,{children:"Download providers as JSON for backup or sharing"})]})}),i.jsx(nt,{children:i.jsxs(Fe,{children:[i.jsx($e,{asChild:!0,children:i.jsxs(Ie,{variant:"outline",size:"sm",onClick:H,className:"gap-1 hover:bg-muted",children:[i.jsx(sk,{className:"size-3"}),"Import"]})}),i.jsx(Be,{children:"Import providers from an exported JSON file"})]})}),i.jsx("input",{type:"file",ref:V,accept:".json",onChange:ae,style:{display:"none"}}),i.jsx(nt,{children:i.jsxs(Fe,{children:[i.jsx($e,{asChild:!0,children:i.jsxs(Ie,{variant:"outline",size:"sm",onClick:()=>T(!0),className:"gap-1",children:[i.jsx(Vw,{className:"size-3"}),"Scan"]})}),i.jsx(Be,{children:"Detect and import provider configs from Claude Code and OpenCode"})]})}),i.jsxs(Ie,{onClick:()=>d(!0),size:"sm",className:"gap-1",children:[i.jsx(Hi,{className:"size-4"}),"Add Provider"]})]})]}),S!==null&&i.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/30 rounded-md px-3 py-2",children:[i.jsx("span",{className:"shrink-0",children:"Config:"}),i.jsx("span",{className:"font-mono truncate",title:S,children:S}),i.jsx(nt,{children:i.jsxs(Fe,{children:[i.jsx($e,{asChild:!0,children:i.jsx("button",{type:"button",onClick:()=>{Ot(S).then(Y=>{Y&&(N(!0),setTimeout(()=>N(!1),2e3))})},className:"shrink-0 ml-auto text-muted-foreground hover:text-foreground transition-colors","aria-label":E?"Copied config file path":"Copy config file path",children:E?i.jsx(et,{className:"size-3 text-green-500"}):i.jsx(kt,{className:"size-3"})})}),i.jsx(Be,{children:"Copy config file path to clipboard"})]})})]}),p!==null&&i.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive bg-destructive/10 rounded-md px-3 py-2",children:[i.jsx(Wr,{className:"size-4 shrink-0"}),p]}),ie.length===0?i.jsxs("div",{className:"text-center py-12 space-y-3",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"No providers configured yet."}),i.jsxs(Ie,{onClick:()=>d(!0),variant:"outline",size:"sm",children:[i.jsx(Hi,{className:"size-4"}),"Add Your First Provider"]})]}):i.jsxs("div",{className:"space-y-3",children:[i.jsx("div",{className:"flex gap-1 border-b border-border",children:["all","personal","company"].map(Y=>i.jsx(nt,{children:i.jsxs(Fe,{children:[i.jsx($e,{asChild:!0,children:i.jsx("button",{type:"button",onClick:()=>$(Y),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${U===Y?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:Y==="all"?"All":Y==="personal"?"Personal":"Company"})}),i.jsx(Be,{children:Y==="all"?"Show all providers":Y==="personal"?"Providers you configured yourself":"Providers set by your organization"})]})},Y))}),i.jsx("div",{ref:q,className:"space-y-3",children:le.map(Y=>i.jsx(nR,{provider:Y,testResults:ge[Y.id],isTesting:ne.has(Y.id),testingTimeLeft:ue[Y.id],isHighlighted:Y.id===z,onEdit:te=>h(te),onDelete:R,onRefreshMetadata:te=>{ee(te)},isRefreshingMetadata:G.has(Y.id),onTest:te=>{_(te)}},Y.id))})]}),i.jsx(UP,{open:B,onOpenChange:T,onImportComplete:()=>{s!==void 0&&s()}}),i.jsx(Um,{open:D,onOpenChange:k,title:"Delete Provider",description:"Are you sure you want to delete this provider? This action cannot be undone.",confirmLabel:"Delete",variant:"destructive",onConfirm:Z})]})}function Id(){const[e,t]=g.useState(!1),[n,r]=g.useState("providers"),{providers:o,isLoading:s,mutate:a}=kp(),[l,c]=g.useState({}),[u,d]=g.useState(new Set),[f,h]=g.useState({}),p=g.useCallback((x,b)=>{c(v=>({...v,[x]:b}))},[]),y=g.useCallback((x,b)=>{d(v=>{const w=new Set(v);return b?w.add(x):w.delete(x),w})},[]),m=g.useCallback((x,b)=>{h(v=>{if(b===void 0){const w={...v};return delete w[x],w}return{...v,[x]:b}})},[]);return i.jsxs(Us,{open:e,onOpenChange:t,children:[i.jsx(Bm,{asChild:!0,children:i.jsxs(Ie,{variant:"ghost",size:"icon",className:"size-8",children:[i.jsx(Yw,{className:"size-4"}),i.jsx("span",{className:"sr-only",children:"Settings"})]})}),i.jsxs(Hs,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[i.jsx(Ws,{children:i.jsx(Vs,{children:"Settings"})}),i.jsxs(Xm,{value:n,onValueChange:r,className:"flex-1 overflow-hidden",children:[i.jsxs(Qm,{children:[i.jsx(_t,{value:"providers",children:"Providers"}),i.jsx(_t,{value:"proxy",children:"Proxy"}),i.jsx(_t,{value:"storage",children:"Storage"}),i.jsx(_t,{value:"mcp",children:"MCP"}),i.jsx(_t,{value:"onboarding",children:"Onboarding"})]}),i.jsxs("div",{className:"mt-4 flex-1 overflow-x-hidden overflow-y-auto pr-3",children:[i.jsx(St,{value:"providers",children:i.jsx(vR,{externalProviders:o,isLoading:s,externalTestResults:l,externalTestingProviders:u,externalTestingTimeLeft:f,onProvidersMutate:()=>a(),onTestResultsChange:p,onTestingProvidersChange:y,onTestingTimeLeftChange:m})}),i.jsx(St,{value:"proxy",children:i.jsx(CR,{})}),i.jsx(St,{value:"storage",children:i.jsx(kR,{})}),i.jsx(St,{value:"mcp",children:i.jsx(SR,{})}),i.jsx(St,{value:"onboarding",children:i.jsx(_R,{})})]})]})]})]})}const wR=re({memoryCount:se(),logDir:I(),logFileCount:se(),logBytes:se(),chunkDir:I(),chunkFileCount:se(),chunkBytes:se()});function zd(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KiB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)} MiB`:`${(e/1024/1024/1024).toFixed(1)} GiB`}function kR(){const[e,t]=g.useState(null),[n,r]=g.useState(null),[o,s]=g.useState(!1),[a,l]=g.useState(null),c=g.useCallback(async()=>{s(!0),r(null);try{const d=await fetch("/api/logs?stats=1");if(!d.ok){r(`Failed to load storage stats: HTTP ${String(d.status)}`);return}const f=await d.json(),h=wR.safeParse(f);if(!h.success){r("Storage stats response was not valid.");return}t(h.data)}catch(d){r(d instanceof Error?d.message:String(d))}finally{s(!1)}},[]);g.useEffect(()=>{c()},[c]);const u=g.useCallback((d,f)=>{Ot(f).then(h=>{h&&(l(d),setTimeout(()=>l(null),1600))})},[]);return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between gap-3",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-semibold",children:"Log storage"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Inspect local log and streaming chunk footprint before exporting or clearing sessions."})]}),i.jsx(Ie,{type:"button",variant:"outline",size:"sm",onClick:()=>{c()},children:o?"Refreshing...":"Refresh"})]}),e!==null&&i.jsxs("div",{className:"grid gap-2 text-xs",children:[i.jsx(hs,{id:"log-dir",label:"Log storage path",value:e.logDir,copiedId:a,onCopy:u}),i.jsx(hs,{id:"chunk-dir",label:"Streaming chunks storage path",value:e.chunkDir,copiedId:a,onCopy:u}),i.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[i.jsx("div",{className:"font-medium",children:"In-memory logs"}),i.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.memoryCount.toLocaleString()," loaded"]})]}),i.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[i.jsx("div",{className:"font-medium",children:"Log files"}),i.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.logFileCount.toLocaleString()," files / ",zd(e.logBytes)]})]}),i.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[i.jsx("div",{className:"font-medium",children:"Streaming chunks"}),i.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.chunkFileCount.toLocaleString()," files / ",zd(e.chunkBytes)]})]})]}),n!==null&&i.jsx("p",{className:"text-xs text-destructive",children:n})]})}function hs({id:e,label:t,value:n,copiedId:r,onCopy:o}){const s=r===e;return i.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-muted/20 px-3 py-2",children:[i.jsx("div",{className:"mb-1 text-xs font-medium text-muted-foreground",children:t}),i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:n}),i.jsx(Ie,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0",onClick:()=>o(e,n),"aria-label":s?`Copied ${t}`:`Copy ${t}`,children:s?i.jsx(et,{className:"size-3.5 text-emerald-500"}):i.jsx(kt,{className:"size-3.5"})})]})]})}function _R(){const[e,t]=g.useState(null),n=g.useMemo(()=>typeof window>"u"?"http://localhost:25947":window.location.origin,[]),r=g.useMemo(()=>[{id:"status",label:"Check onboarding",value:"agent-inspector onboard --status"},{id:"status-json",label:"Check onboarding JSON",value:"agent-inspector onboard --status --json"},{id:"refresh",label:"Refresh generated files",value:"agent-inspector onboard --force"},{id:"uninstall",label:"Remove matching generated files",value:"agent-inspector onboard --uninstall"},{id:"claude",label:"Claude Code command",value:"/agent-inspector:onboard"},{id:"codex",label:"Codex prompt",value:"Use the agent-inspector-onboard skill"},{id:"opencode-config",label:"OpenCode config",value:"agent-inspector onboard --opencode-only"},{id:"opencode-status",label:"OpenCode status",value:"agent-inspector onboard --status --opencode-only"},{id:"opencode-verify",label:"OpenCode verify",value:"opencode mcp list"},{id:"opencode-proxy",label:"OpenCode proxy",value:`LLM_BASE_URL=${n}/proxy`},{id:"mcp",label:"MCP URL",value:`${n}/api/mcp`},{id:"proxy",label:"Proxy URL",value:`${n}/proxy`},{id:"anthropic",label:"Anthropic base",value:`ANTHROPIC_BASE_URL=${n}/proxy`},{id:"openai",label:"OpenAI base",value:`OPENAI_BASE_URL=${n}/proxy`}],[n]),o=g.useCallback((s,a)=>{Ot(a).then(l=>{l&&(t(s),setTimeout(()=>t(null),1600))})},[]);return i.jsxs("div",{className:"min-w-0 space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(tl,{className:"size-4 text-muted-foreground"}),i.jsx("h3",{className:"text-sm font-semibold",children:"Agent onboarding"})]}),i.jsx("div",{className:"grid gap-2",children:r.map(s=>i.jsx(hs,{id:s.id,label:s.label,value:s.value,copiedId:e,onCopy:o},s.id))}),i.jsxs("div",{className:"grid gap-2 rounded-md border border-border bg-background px-3 py-2 text-xs text-muted-foreground",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(et,{className:"size-3.5 text-emerald-500"}),i.jsx("span",{children:"Provider test creates a traceable memory probe session."})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(et,{className:"size-3.5 text-emerald-500"}),i.jsx("span",{children:"Captured sessions can produce reviewable memory candidates."})]}),i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx(et,{className:"mt-0.5 size-3.5 text-emerald-500"}),i.jsxs("span",{children:["Streamable HTTP clients should use the MCP URL directly. Stdio-only clients should use",i.jsx("code",{className:"mx-1 rounded bg-muted px-1 py-0.5 font-mono text-[11px] text-foreground",children:"agent-inspector-mcp stdio"}),"instead. Configure only one entry for the same Inspector."]})]}),i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx(et,{className:"mt-0.5 size-3.5 text-emerald-500"}),i.jsxs("span",{children:["OpenCode onboarding safely merges"," ",i.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[11px] text-foreground",children:"mcp.agent-inspector"})," ","into"," ",i.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[11px] text-foreground",children:"opencode.json"}),", then verify with"," ",i.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[11px] text-foreground",children:"opencode mcp list"}),"."]})]}),i.jsxs("div",{className:"flex items-start gap-2",children:[i.jsx(et,{className:"mt-0.5 size-3.5 text-emerald-500"}),i.jsx("span",{children:"If your AI tool runs in another container or host, replace localhost with an address reachable from that tool and verify the network/firewall path."})]})]})]})}function SR(){const[e,t]=g.useState(null),r=`${g.useMemo(()=>typeof window>"u"?"http://localhost:25947":window.location.origin,[])}/api/mcp`,o=g.useMemo(()=>[{id:"mcp-url",label:"Streamable HTTP MCP URL",value:r},{id:"stdio",label:"Stdio bridge command",value:`agent-inspector-mcp stdio --url ${r}`},{id:"doctor",label:"Bridge doctor",value:`agent-inspector-mcp doctor --url ${r}`},{id:"readonly",label:"Readonly mode",value:"AGENT_INSPECTOR_MCP_READONLY=1 agent-inspector"},{id:"capabilities",label:"Capabilities resource",value:"inspector://mcp/capabilities"},{id:"context",label:"Current context resource",value:"inspector://context/current"},{id:"streamable-json",label:"Streamable HTTP JSON",value:JSON.stringify({mcpServers:{"agent-inspector":{type:"streamableHttp",url:r}}},null,2)},{id:"stdio-json",label:"Stdio MCP JSON",value:JSON.stringify({mcpServers:{"agent-inspector":{command:"agent-inspector-mcp",args:["stdio","--url",r]}}},null,2)},{id:"opencode-local",label:"OpenCode local MCP",value:JSON.stringify({mcp:{"agent-inspector":{type:"local",command:["agent-inspector-mcp","stdio","--url",r],enabled:!0}}},null,2)},{id:"codex-toml",label:"Codex TOML",value:`[mcp_servers.agent-inspector]
|
|
116
116
|
command = "agent-inspector-mcp"
|
|
117
|
-
args = ["stdio", "--url", "${r}"]`}],[r]),s=g.useCallback((a,l)=>{Ot(l).then(c=>{c&&(t(a),setTimeout(()=>t(null),1600))})},[]);return i.jsxs("div",{className:"min-w-0 space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(tl,{className:"size-4 text-muted-foreground"}),i.jsx("h3",{className:"text-sm font-semibold",children:"MCP access"})]}),i.jsxs("div",{className:"grid gap-2 rounded-md border border-border bg-background px-3 py-2 text-xs text-muted-foreground",children:[i.jsx("div",{children:"Use Streamable HTTP when the client supports URL-based MCP. Use the stdio bridge only for stdio-only clients. Configure one entry for the same Inspector instance."}),i.jsx("div",{children:"If the MCP client runs in another container or host, replace localhost with a reachable host/IP and verify the network path."})]}),i.jsx("div",{className:"grid gap-2",children:o.map(a=>i.jsx(hs,{id:a.id,label:a.label,value:a.value,copiedId:e,onCopy:s},a.id))})]})}function CR(){const{strip:e,slowResponseThresholdSeconds:t,providerTestTimeoutSeconds:n,timeDisplayFormat:r,isLoading:o,setStrip:s,setSlowResponseThresholdSeconds:a,setProviderTestTimeoutSeconds:l,setTimeDisplayFormat:c}=Ga(),[u,d]=g.useState(null),[f,h]=g.useState(!1),p=g.useCallback(async b=>{d(null),h(!0);try{await s(b)}catch(v){d(v instanceof Error?v.message:String(v))}finally{h(!1)}},[s]),y=g.useCallback(async b=>{d(null),h(!0);try{await a(b)}catch(v){d(v instanceof Error?v.message:String(v))}finally{h(!1)}},[a]),m=g.useCallback(async b=>{d(null),h(!0);try{await l(b)}catch(v){d(v instanceof Error?v.message:String(v))}finally{h(!1)}},[l]),x=g.useCallback(async b=>{d(null),h(!0);try{await c(b)}catch(v){d(v instanceof Error?v.message:String(v))}finally{h(!1)}},[c]);return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("h3",{className:"text-sm font-semibold",children:"Claude Code billing header"}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["When enabled, the proxy strips the synthetic ",i.jsx("code",{children:"x-anthropic-billing-header"})," text block that Claude Code prepends to the system prompt before forwarding to upstream. Improves prefix-cache hit rates against third-party upstreams. The default at startup is controlled by the ",i.jsx("code",{children:"AGENT_INSPECTOR_STRIP_CLAUDE_CODE_BILLING_HEADER"})," ","environment variable; your choice is persisted to ",i.jsx("code",{children:"config.json"})," and overrides the env var for subsequent requests."]})]}),i.jsxs("label",{className:"flex items-center gap-3",children:[i.jsx("input",{type:"checkbox",role:"switch",checked:e,disabled:o||f,onChange:b=>{p(b.currentTarget.checked)},className:"size-4 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"}),i.jsx("span",{className:"text-sm",children:o?"Loading...":e?"Stripping enabled":"Stripping disabled"})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{htmlFor:"slow-response-threshold",className:"text-sm font-semibold",children:"Slow response threshold"}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["Logs whose elapsed time exceeds this many seconds show a warning icon next to the duration. Set to ",i.jsx("code",{children:"0"})," to disable the indicator."]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{id:"slow-response-threshold",type:"number",min:0,max:Bi,step:1,value:t,disabled:o||f,onChange:b=>{const v=Number(b.currentTarget.value);Number.isInteger(v)&&(v<0||v>Bi||y(v))},className:"h-8 w-24 rounded-md border border-input bg-transparent px-2 text-sm font-mono disabled:cursor-not-allowed disabled:opacity-50"}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"seconds"})]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{htmlFor:"provider-test-timeout",className:"text-sm font-semibold",children:"Provider test timeout"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Provider Test waits this many seconds per configured model before aborting slow probes. The full test window scales with model count."}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{id:"provider-test-timeout",type:"number",min:1,max:Ui,step:1,value:n,disabled:o||f,onChange:b=>{const v=Number(b.currentTarget.value);Number.isInteger(v)&&(v<1||v>Ui||m(v))},className:"h-8 w-24 rounded-md border border-input bg-transparent px-2 text-sm font-mono disabled:cursor-not-allowed disabled:opacity-50"}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"seconds / model"})]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{htmlFor:"time-display-format",className:"text-sm font-semibold",children:"Time display"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Controls timestamps in session summaries, conversation headers, and log rows."}),i.jsxs("select",{id:"time-display-format",value:r,disabled:o||f,onChange:b=>{const v=Qf.safeParse(b.currentTarget.value);v.success&&x(v.data)},className:"h-8 rounded-md border border-input bg-background px-2 text-sm disabled:cursor-not-allowed disabled:opacity-50",children:[i.jsx("option",{value:"time",children:"Time only"}),i.jsx("option",{value:"full",children:"Full ISO"})]})]}),u!==null&&i.jsxs("p",{className:"text-xs text-destructive",children:["Failed to save: ",u]})]})}function jR(e){const t=new Map;for(const n of e){const r=n.logs;for(let o=1;o<r.length;o++){const s=r[o-1],a=r[o];s===void 0||a===void 0||t.set(a.id,{creation:Pd(s.cacheCreationInputTokens,a.cacheCreationInputTokens),read:Pd(s.cacheReadInputTokens,a.cacheReadInputTokens)})}}return t}function Pd(e,t){return t===null||e===null?null:t>e?{direction:"up",delta:t-e}:t<e?{direction:"down",delta:e-t}:null}const NR=30,ER=112,TR=6;function AR(e){return e>NR}function IR({groups:e,standalone:t,...n}){return AR(e.length)?i.jsx(zR,{groups:e,standalone:t,...n}):i.jsx(i.Fragment,{children:e.map(r=>i.jsx(ox,{group:r,standalone:t,...n},r.id))})}function zR({groups:e,standalone:t,...n}){const[r,o]=g.useState(()=>new Map),s=y3({count:e.length,estimateSize:()=>ER,overscan:TR,getItemKey:c=>e[c]?.id??c}),a=g.useCallback((c,u)=>{o(d=>{const f=new Map(d);return u?f.set(c,!0):f.delete(c),f})},[]),l=g.useMemo(()=>{const c=new Map;for(let u=0;u<e.length;u++){const d=e[u];if(d!==void 0)for(const f of d.logs)c.set(f.id,u)}return c},[e]);return g.useEffect(()=>{const c=u=>{const d=Ys(u);if(d===null)return;const f=l.get(d.logId);if(f===void 0)return;const h=e[f];h!==void 0&&(a(h.id,!0),s.scrollToIndex(f,{align:"center"}))};return window.addEventListener(on,c),()=>{window.removeEventListener(on,c)}},[e,l,a,s]),i.jsx("div",{className:"relative w-full",style:{height:`${s.getTotalSize()}px`},"data-virtualized-conversation-list":"true",children:s.getVirtualItems().map(c=>{const u=e[c.index];return u===void 0?null:i.jsx("div",{"data-index":c.index,ref:s.measureElement,className:"absolute left-0 top-0 w-full",style:{transform:`translateY(${c.start}px)`},children:i.jsx(ox,{group:u,standalone:t,expanded:r.get(u.id)??!1,onExpandedChange:d=>a(u.id,d),...n})},c.key)})})}const ms="data-nav-id",PR="data-nav-action";function Rd(e){return Array.from(e.querySelectorAll(`[${ms}]`))}function Od(e){return e instanceof HTMLElement}function RR(e,t){let n=e;for(;n!==null&&n!==t;){if(n.hasAttribute(ms))return n;n=n.parentElement}return e.hasAttribute(ms)?e:null}function Pi(e){const t=e.getAttribute(PR);return t==="toggle"||t==="expand"||t==="collapse"?t:null}function Pr(e){e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",behavior:"smooth"})}function Rr(e,t){return e[t]??null}function px(e){const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)}function Md(e){const t=e.tagName;return t==="BUTTON"||t==="A"||px(e)?!0:e.closest("[role='button'],[role='menuitem'],[role='option']")!==null}function OR(e){return e.closest("[role='dialog'],[role='menu'],[role='listbox']")!==null?!0:document.querySelector("[role='dialog'],[role='menu'],[role='listbox']")!==null}function MR(){const e=window.getSelection();return e===null?!1:e.type==="Range"&&e.toString().length>0}function Ao(e,t){return e.key===t&&e.shiftKey}function LR(e,t,n={}){const r=t??e,o=n.pageWide===!0,s=g.useCallback(a=>{const l=e.current,c=r.current;if(!l||!c)return;const u=a.target;if(!Od(u)||u!==c)return;const d=Rd(l),f=Rr(d,0);f!==null&&Pr(f)},[e,r]);g.useEffect(()=>{const a=l=>{if(l.altKey||l.ctrlKey||l.metaKey)return;const c=e.current;if(!c)return;const u=l.target;if(!Od(u)||px(u)||MR())return;const d=c.contains(u);if(d&&Md(u)&&!u.hasAttribute(ms)||!d&&(!o||Md(u)||OR(u)))return;const f=Rd(c);if(f.length===0)return;const h=RR(u,c),p=h!==null?f.indexOf(h):-1;let y=!1;switch(l.key){case"ArrowUp":case"W":{if(l.shiftKey&&l.key==="ArrowUp"||l.key==="W"&&!Ao(l,"W"))break;l.preventDefault();const m=p>0?p-1:p===-1?f.length-1:-1;if(m!==-1){const x=Rr(f,m);x!==null&&Pr(x)}y=!0;break}case"ArrowDown":case"S":{if(l.shiftKey&&l.key==="ArrowDown"||l.key==="S"&&!Ao(l,"S"))break;l.preventDefault();const m=p<f.length-1?p+1:p===-1?0:-1;if(m!==-1){const x=Rr(f,m);x!==null&&Pr(x)}y=!0;break}case"ArrowLeft":case"A":{if(l.shiftKey&&l.key==="ArrowLeft"||l.key==="A"&&!Ao(l,"A")||h===null)break;if(l.preventDefault(),Pi(h)==="collapse")h.click();else if(p>0){const x=Rr(f,p-1);x!==null&&Pr(x)}y=!0;break}case"ArrowRight":case"D":{if(l.shiftKey&&l.key==="ArrowRight"||l.key==="D"&&!Ao(l,"D")||h===null)break;if(l.preventDefault(),Pi(h)==="expand")h.click();else if(p<f.length-1){const x=Rr(f,p+1);x!==null&&Pr(x)}y=!0;break}case" ":{if(h===null)break;l.preventDefault(),Pi(h)!==null&&h.click(),y=!0;break}}y&&l.stopPropagation()};return document.addEventListener("keydown",a,{capture:!0}),()=>document.removeEventListener("keydown",a,{capture:!0})},[e,o,r]),g.useEffect(()=>(document.addEventListener("focusin",s),()=>document.removeEventListener("focusin",s)),[s])}const DR={system:"System",user:"User",assistant:"Assistant",tool:"Tool Results",tools:"Tool Definitions"},FR={system:"bg-sky-500/70",user:"bg-emerald-500/70",assistant:"bg-violet-500/70",tool:"bg-sky-400/55",tools:"bg-slate-500/70"},$R={system:"focus-visible:ring-sky-300",user:"focus-visible:ring-emerald-300",assistant:"focus-visible:ring-violet-300",tool:"focus-visible:ring-sky-300",tools:"focus-visible:ring-slate-300"},Ri=12,Io=1,Ld=80,Dd=24;function BR(e){return e.length<=Dd?e:`${e.slice(0,Dd-3)}...`}function UR(e){const t=e.replace(/\s+/g," ").trim();return t.length<=Ld?t:`${t.slice(0,Ld)}...`}function zo(e){return e>=10?`${e.toFixed(0)}%`:e>=1?`${e.toFixed(1)}%`:e>0?"<1%":"0%"}const HR=g.memo(function({segments:t,totalTokens:n,showLabels:r=!0,onActivate:o}){const s=g.useMemo(()=>n>0?n:t.reduce((x,b)=>x+b.size,0),[t,n]),a=t.slice(0,Ri),l=t.slice(Ri),c=l.reduce((x,b)=>x+b.size,0),u=l.length,d=Ri,f=d+u-1,h=u>0,p=o!==void 0,y=g.useMemo(()=>a.reduce((x,b)=>x+b.size,0),[a]),m=g.useMemo(()=>`Request context: ~${Ue(s)} tokens across ${t.length} segment${t.length===1?"":"s"}`,[t.length,s]);return t.length===0||s<=0?i.jsx("div",{role:"img","aria-label":m,className:"h-6"}):i.jsx(nt,{delayDuration:150,children:i.jsxs("div",{role:"img","aria-label":m,className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"relative flex h-6 w-full overflow-hidden rounded border border-border/40 bg-muted/30","data-testid":"anatomy-segment-bar",children:[a.map((x,b)=>{const v=s>0?x.size/s*100:0,w=Math.max(Io,v),C=xe("h-full border-r border-background/80 last:border-r-0",p?"opacity-90 hover:opacity-100 focus:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-background":"opacity-90",FR[x.role],p?$R[x.role]:""),S={width:`${w}%`},j=`${x.label}, ${zo(v)}, ~${Ue(x.size)} tokens`;return i.jsxs(Fe,{children:[i.jsx($e,{asChild:!0,children:p?i.jsx("button",{type:"button",role:"button",tabIndex:0,onClick:()=>o(x),onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),o(x))},"data-anatomy-path":x.path,"aria-label":j,className:C,style:S}):i.jsx("span",{"aria-label":j,className:C,style:S})}),i.jsxs(Be,{side:"bottom",className:"max-w-sm text-xs p-2 space-y-0.5",children:[i.jsxs("div",{className:"font-semibold",children:[x.label," - ",zo(v)," - ~",Ue(x.size)," ","tokens"]}),i.jsx("div",{className:"text-muted-foreground",children:DR[x.role]}),i.jsxs("div",{className:"text-muted-foreground",children:[x.characters.toLocaleString()," chars"]}),x.text.length>0&&i.jsx("div",{className:"text-muted-foreground/90 break-words whitespace-pre-wrap",children:UR(x.text)})]})]},`${x.path}-${b}`)}),h&&i.jsxs(Fe,{children:[i.jsx($e,{asChild:!0,children:i.jsxs("div",{role:"img","aria-label":`${u} additional segments`,className:"flex h-full items-center justify-center bg-muted-foreground/30 px-1.5 text-[10px] font-mono text-background",style:{width:`${Math.max(Io,c/s*100)}%`},children:["... +",u]})}),i.jsxs(Be,{side:"bottom",className:"text-xs",children:[u," more segment",u===1?"":"s"," (indices"," ",d,"-",f,")"]})]})]}),r&&i.jsxs("div",{className:"flex w-full gap-1 text-[10px] text-muted-foreground",children:[a.map((x,b)=>{const v=s>0?x.size/s*100:0,w=Math.max(Io,v);return i.jsxs("div",{className:"flex flex-col gap-0.5 truncate",style:{width:`${w}%`},title:`${x.label} - ${zo(v)} - ~${Ue(x.size)} tokens`,children:[i.jsx("span",{className:"truncate font-mono text-foreground/80",children:BR(x.label)}),i.jsxs("span",{className:"truncate font-mono text-muted-foreground/70",children:[zo(v)," - ~",Ue(x.size)]})]},`label-${x.path}-${b}`)}),h&&i.jsxs("div",{className:"flex flex-col gap-0.5 truncate text-muted-foreground",style:{width:`${Math.max(Io,c/s*100)}%`},children:[i.jsxs("span",{className:"truncate font-mono text-foreground/60",children:["... +",u]}),i.jsxs("span",{className:"truncate font-mono text-muted-foreground/60",children:["~",Ue(c)]})]})]}),y<s*.1&&i.jsx("div",{className:"h-0"})]})})}),hx=.75,mx=.9,Na=8e3,WR=.35,gx=40,xx=160,VR=5,ZR=8,qR=18,KR=6e4,GR=.7,Fd=3e3,JR=.3,$d=160,YR=new Set(["answer","body","content","data","error","message","markdown","output","response","result","stderr","stdout","text","transcript"]),XR=["context_window","contextWindow","context_length","contextLength","max_context_length","maxContextLength","max_input_tokens","maxInputTokens"],QR=["max_tokens","maxTokens","max_completion_tokens","maxCompletionTokens","max_output_tokens","maxOutputTokens"],eO=[{family:"OpenAI GPT-4.1",tokens:1047576,mode:"prefix",patterns:["gpt-4.1"]},{family:"OpenAI GPT-4o",tokens:128e3,mode:"prefix",patterns:["gpt-4o"]},{family:"OpenAI o-series",tokens:128e3,mode:"prefix",patterns:["o1","o3","o4"]},{family:"Anthropic Claude",tokens:2e5,mode:"prefix",patterns:["claude-"]},{family:"DeepSeek V4",tokens:1048576,mode:"prefix",patterns:["deepseek-v4-pro","deepseek-v4-flash"]},{family:"DeepSeek",tokens:64e3,mode:"prefix",patterns:["deepseek-"]},{family:"MiniMax M3",tokens:1048576,mode:"includes",patterns:["minimax-m3"]},{family:"MiniMax M2.7",tokens:204800,mode:"includes",patterns:["minimax-m2.7"]},{family:"MiniMax M2.5/M2.1",tokens:196608,mode:"includes",patterns:["minimax-m2.5","minimax-m2.1"]},{family:"GLM-5.2",tokens:1048576,mode:"prefix",patterns:["glm-5.2"]},{family:"GLM-5",tokens:202752,mode:"prefix",patterns:["glm-5","glm-5.1"]}],tO={system:"System",user:"User messages",assistant:"Assistant messages",tool:"Tool results",tools:"Tool definitions"};function nO(e){if(typeof e=="number")return Number.isFinite(e)&&e>0?Math.floor(e):null;if(typeof e=="string"){const t=Number(e);if(Number.isFinite(t)&&t>0)return Math.floor(t)}return null}function bx(e,t){for(const n of t){const r=nO(Me(e,n));if(r!==null)return r}return null}function rO(e){const t=Me(e,"model");if(typeof t!="string")return null;const n=t.trim();return n===""?null:n}function oO(e,t){switch(t.mode){case"prefix":return t.patterns.some(n=>e.startsWith(n));case"includes":return t.patterns.some(n=>e.includes(n))}}function sO(e,t,n=[]){const r=bx(t,XR);if(r!==null)return{tokens:r,label:"Request metadata",source:"request"};const o=ZP(e,n);if(o!==null)return{tokens:o.tokens,label:`${o.providerName} config`,source:"provider"};if(e===null)return{tokens:null,label:"Unknown model",source:"unknown"};const s=e.trim().toLowerCase().replace(/\s+/g,"-");for(const a of eO)if(oO(s,a))return{tokens:a.tokens,label:`${a.family} local rule`,source:"model-rule"};return{tokens:null,label:"No local rule",source:"unknown"}}function iO(e){return e<0?0:e>1?1:e}function aO(e){return e===null?"unknown":e>=mx?"danger":e>=hx?"watch":"ok"}function lO(e,t){return e.filter(n=>n.role===t).reduce((n,r)=>n+r.size,0)}function cO(e,t){return["system","user","assistant","tool","tools"].map(r=>{const o=lO(e,r);return{role:r,label:tO[r],tokens:o,percent:t>0?o/t:0}}).filter(r=>r.tokens>0).sort((r,o)=>o.tokens-r.tokens)}function Ea(e){return e.replace(/\s+/g," ").trim().toLowerCase()}function uO(e){const t=e.replace(/\s+/g," ").trim();return t.length<=$d?t:`${t.slice(0,$d-3)}...`}function dO(e){return{role:e.role,label:e.label,path:e.path,tokens:e.tokens,characters:e.characters}}function fO(e){return{role:e.role,label:e.label,path:e.path,tokens:e.size,characters:e.characters,text:e.text}}function pO(e){const t=e.trim();return t.startsWith("{")||t.startsWith("[")}function hO(e){if(!pO(e))return null;try{return JSON.parse(e)}catch{return null}}function mO(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function gO(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t]??"";if(!(n.startsWith("[")&&n.endsWith("]")))return n}return null}function xO(e){const t=gO(e);return t===null?!1:YR.has(mO(t))}function bO(e){return e.map(t=>t.startsWith("[")?t:`.${t}`).join("").replace(/^\./,"")}function yO(e,t,n){const r=Al(t);if(r<xx)return null;const o=Tl(t);return o<gx?null:{role:e.role,label:`${e.label} ${bO(n)}`,path:e.path,tokens:o,characters:r,text:t}}function Ta({value:e,segment:t,path:n,depth:r,candidates:o}){if(!(o.length>=ZR)&&!(r>VR)){if(typeof e=="string"){if(!xO(n))return;const s=yO(t,e,n);s!==null&&o.push(s);return}if(Array.isArray(e)){e.forEach((s,a)=>Ta({value:s,segment:t,path:[...n,`[${String(a)}]`],depth:r+1,candidates:o}));return}Il(e)&&Object.entries(e).forEach(([s,a])=>Ta({value:a,segment:t,path:[...n,s],depth:r+1,candidates:o}))}}function vO(e){const t=fO(e),n=hO(e.text);if(n===null)return[t];const r=[];Ta({value:n,segment:e,path:[],depth:0,candidates:r});const o=Ea(e.text),s=new Set([o]),a=r.filter(l=>{const c=Ea(l.text);return c===""||s.has(c)?!1:(s.add(c),!0)});return[t,...a]}function wO(e){const t=new Map;for(const r of e){const o=vO(r);for(const s of o){if(s.tokens<gx||s.characters<xx)continue;const a=Ea(s.text);if(a==="")continue;const l=t.get(a);if(l===void 0){t.set(a,{tokens:s.tokens,candidates:[s]});continue}t.set(a,{tokens:l.tokens+s.tokens,candidates:[...l.candidates,s]})}}const n=[];for(const r of t.values()){if(r.candidates.length<2)continue;const o=r.candidates[0]??null;if(o===null)continue;const s=r.tokens-o.tokens;n.push({key:`${o.path}:${o.label}:${String(r.candidates.length)}:${String(r.tokens)}`,count:r.candidates.length,totalTokens:r.tokens,repeatedTokens:s,preview:uO(o.text),firstLabel:o.label,segments:r.candidates.map(dO)})}return n.sort((r,o)=>o.repeatedTokens-r.repeatedTokens||o.totalTokens-r.totalTokens)}function kO(e){if(e.length===0)return null;const t=e.length,n=e.reduce((o,s)=>o+s.count,0),r=e.reduce((o,s)=>o+s.repeatedTokens,0);return{kind:"duplicate",severity:r>=Na?"danger":"watch",title:"Duplicate context",detail:`${String(n)} repeated blocks across ${String(t)} group${t===1?"":"s"}, ~${String(r)} repeated tokens.`}}function _O(e){return e.reduce((t,n)=>t+n.repeatedTokens,0)}function SO(e,t,n){const r=[],o=e.find(c=>c.role==="tools")??null;o!==null&&(o.tokens>=Na||o.percent>=WR&&o.tokens>=Fd)&&r.push({kind:"tool-schema",severity:o.tokens>=Na?"danger":"watch",title:"Large tool schema",detail:`Tool definitions take ${Math.round(o.percent*100)}% of request context.`});const s=e.find(c=>c.role==="system")??null;s!==null&&s.tokens>=Fd&&s.percent>=JR&&r.push({kind:"system-heavy",severity:"watch",title:"Large system prompt",detail:`System instructions take ${Math.round(s.percent*100)}% of request context.`});const a=e.filter(c=>c.role==="user"||c.role==="assistant"||c.role==="tool").reduce((c,u)=>c+u.tokens,0),l=t>0?a/t:0;return n>=qR&&(a>=KR||l>=GR)&&r.push({kind:"history-bloat",severity:l>=.85?"danger":"watch",title:"Conversation history growth",detail:`${String(n)} message blocks take ${Math.round(l*100)}% of request context.`}),r}function CO({risk:e,contextWindow:t,diagnostics:n,duplicateGroups:r}){let s=new Set(n.map(c=>c.kind)).size;(e==="watch"||e==="danger")&&(s+=1),t.source==="unknown"&&(s+=1);const a=n.some(c=>c.severity==="danger");return{level:e==="danger"||a?"risk":s>0?"optimizable":"ok",opportunityCount:s,reclaimableTokens:_O(r)}}function jO({segments:e,inputTokens:t,parsed:n,model:r,providers:o=[]}){const s=e.reduce((j,E)=>j+E.size,0),a=r??rO(n),l=t??s,c=bx(n,QR),u=sO(a,n,o),d=c??0,f=u.tokens===null?null:l+d,h=u.tokens===null?null:u.tokens-l,p=u.tokens===null?null:u.tokens-l-d,y=u.tokens===null||f===null?null:iO(f/u.tokens),m=cO(e,s),x=m[0]??null,b=e.filter(j=>j.role!=="tools").length,v=wO(e),w=kO(v),C=SO(m,s,b);w!==null&&C.unshift(w);const S=aO(y);return{model:a,contextWindow:u,estimatedInputTokens:l,outputReserveTokens:c,windowUsedTokens:f,remainingInputTokens:h,remainingAfterReserveTokens:p,usagePercent:y,riskLevel:S,roleUsages:m,largestRole:x,diagnostics:C,duplicateGroups:v,health:CO({risk:S,contextWindow:u,diagnostics:C,duplicateGroups:v})}}const j6={watch:hx,danger:mx};function NO(e){if(e===null)return null;try{return JSON.parse(e)}catch{return null}}function EO(e){return{role:e.role,label:e.label,size:e.tokens,characters:e.tokens*4,text:"",path:`role:${e.role}`}}function TO(e,t){const n=NO(e.rawRequestBody);if(n===null)return null;const o=Vm(Mn(e)).anatomySegments(n);if(o===null)return null;const s=jO({segments:o,inputTokens:e.inputTokens??null,parsed:n,model:e.model,providers:t}),a=s.model??e.model??"Unknown model",l=s.roleUsages.map(EO);return{logId:e.id,model:a,timestamp:e.timestamp,contextWindow:s.contextWindow,estimatedInputTokens:s.estimatedInputTokens,windowUsedTokens:s.windowUsedTokens,usagePercent:s.usagePercent,riskLevel:s.riskLevel,health:s.health,diagnostics:s.diagnostics.map(c=>c.title),roleSegments:l,roleTotalTokens:l.reduce((c,u)=>c+u.size,0)}}function AO(e,t){return e.usagePercent!==null&&t.usagePercent!==null?e.usagePercent>t.usagePercent:e.usagePercent!==null&&t.usagePercent===null?!0:e.usagePercent===null&&t.usagePercent!==null?!1:e.estimatedInputTokens>t.estimatedInputTokens}function Bd(e){switch(e){case"danger":return 4;case"watch":return 3;case"unknown":return 2;case"ok":return 1}}function IO(e,t){const n=Bd(t.latest.riskLevel)-Bd(e.latest.riskLevel);if(n!==0)return n;const r=e.peak.usagePercent??-1,s=(t.peak.usagePercent??-1)-r;return s!==0?s:t.latest.logId-e.latest.logId}function zO(e,t){return e.usagePercent===null||t.usagePercent===null?null:(t.usagePercent-e.usagePercent)*100}function PO(e,t=[]){const n=[...e].sort((s,a)=>s.id-a.id),r=new Map;for(const s of n){const a=TO(s,t);if(a===null)continue;const l=r.get(a.model);if(l===void 0){r.set(a.model,{model:a.model,requestCount:1,first:a,latest:a,peak:a});continue}r.set(a.model,{model:l.model,requestCount:l.requestCount+1,first:l.first,latest:a,peak:AO(a,l.peak)?a:l.peak})}return{models:[...r.values()].map(s=>({model:s.model,requestCount:s.requestCount,first:s.first,latest:s.latest,peak:s.peak,trendPercent:zO(s.first,s.latest)})).sort(IO)}}function hn(e){return e.length<=30?e:`${e.slice(0,12)}...${e.slice(-12)}`}function RO(e){return e==="full"}function OO(e,t){const n=t>0;return{redacted:n,raw:n&&RO(e)}}function Ud(e){let t=0,n=0;for(const r of e)r.inputTokens!==null&&(t+=r.inputTokens),r.outputTokens!==null&&(n+=r.outputTokens);return{totalIn:t,totalOut:n}}function yx(e,t){const n=e[0],r=e[e.length-1];return n===void 0||r===void 0?null:rl(n.timestamp,r.timestamp,t)}function MO(e){for(const t of e)if(t.userAgent!==null&&t.userAgent!==void 0&&t.userAgent!=="")return t.userAgent;return null}function LO(e){return e.error!==null&&e.error!==void 0&&e.error.length>0?!0:e.responseStatus!==null&&e.responseStatus>=400}function DO(e){const t=new Set;for(const r of e)r.model!==null&&r.model.length>0&&t.add(r.model);const n=[...t].sort();return n.length===0?"Model unknown":n.length===1?n[0]??"Model unknown":`${n.length} models`}function FO({logs:e,isLoading:t,timeDisplayFormat:n,slowResponseThresholdSeconds:r}){let o=0,s=0,a=0,l=0;const c=r*1e3;for(const f of e)LO(f)&&(o+=1),r>0&&f.elapsedMs!==null&&f.elapsedMs>=c&&(s+=1),f.inputTokens!==null&&(a+=f.inputTokens),f.outputTokens!==null&&(l+=f.outputTokens);const u=t?"rolling":o>0?"failed":s>0?"watch":"clear";return{status:u,statusLabel:u==="rolling"?"Rolling":u==="failed"?"Failure":u==="watch"?"Watch":"Clear",modelLabel:DO(e),requests:e.length,failures:o,slow:s,timeRange:yx(e,n),tokenLabel:`${Ue(a)} in / ${Ue(l)} out`}}function $O(e){switch(e){case"rolling":return"border-cyan-400/35 bg-cyan-500/10 text-cyan-200";case"failed":return"border-red-400/35 bg-red-500/10 text-red-100";case"watch":return"border-amber-300/35 bg-amber-400/10 text-amber-100";case"clear":return"border-emerald-400/30 bg-emerald-500/10 text-emerald-100"}}function BO({stats:e}){return e.requests===0?null:i.jsx("div",{className:"mb-4 rounded-md border border-border bg-[#0c0d0f] shadow-[0_14px_50px_rgba(0,0,0,0.25)]",children:i.jsxs("div",{className:"grid grid-cols-2 gap-0 md:grid-cols-[minmax(220px,1.2fr)_repeat(4,minmax(120px,1fr))]",children:[i.jsxs("div",{className:"col-span-2 border-b border-border/70 px-4 py-3 md:col-span-1 md:border-b-0 md:border-r",children:[i.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-semibold uppercase text-muted-foreground",children:[i.jsx(H2,{className:"size-3.5 text-cyan-300"}),"Opening Slate"]}),i.jsx("div",{className:"mt-2 min-w-0 truncate font-mono text-sm font-semibold text-foreground",children:e.modelLabel}),i.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",children:e.timeRange??"Timeline pending"})]}),i.jsxs("div",{className:"border-r border-b border-border/70 px-4 py-3 md:border-b-0",children:[i.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Status"}),i.jsx("div",{className:xe("mt-2 inline-flex h-7 items-center rounded-md border px-2.5 font-mono text-xs font-semibold",$O(e.status)),children:e.statusLabel})]}),i.jsxs("div",{className:"border-b border-border/70 px-4 py-3 md:border-b-0 md:border-r",children:[i.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Requests"}),i.jsx("div",{className:"mt-2 font-mono text-xl font-semibold text-foreground",children:e.requests})]}),i.jsxs("div",{className:"border-r border-border/70 px-4 py-3 md:border-r",children:[i.jsxs("div",{className:"flex items-center gap-1 text-[10px] uppercase text-muted-foreground",children:[i.jsx(ek,{className:"size-3 text-red-300"}),"Failure"]}),i.jsx("div",{className:"mt-2 font-mono text-xl font-semibold text-red-100",children:e.failures})]}),i.jsxs("div",{className:"px-4 py-3",children:[i.jsxs("div",{className:"flex items-center gap-1 text-[10px] uppercase text-muted-foreground",children:[i.jsx(el,{className:"size-3 text-amber-200"}),"Tempo"]}),i.jsxs("div",{className:"mt-2 font-mono text-sm font-semibold text-foreground",children:[e.slow," slow"]}),i.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",children:e.tokenLabel})]})]})})}function UO({pinnedSessionId:e,selectedSession:t,sessions:n,logs:r}){if(e!==void 0){const a=r.filter(l=>l.sessionId===e);return a.length===0?null:{label:e,logs:a,showBackLink:!0}}if(t!=="__all__"){const a=r.filter(l=>l.sessionId===t);return a.length===0?null:{label:t,logs:a,showBackLink:!0}}const o=n.length===1?n[0]??null:null;return o!==null&&r.every(l=>l.sessionId===o)?{label:o,logs:[...r],showBackLink:!1}:n.length===0&&r.length>0&&r.every(a=>a.sessionId===null)?{label:"Visible requests",logs:[...r],showBackLink:!1}:null}function Br(e){if(e===null)return"Unknown";const t=e*100;return t>=10?`${t.toFixed(0)}%`:t>=1?`${t.toFixed(1)}%`:t>0?"<1%":"0%"}function HO(e){return e===null?"n/a":Math.abs(e)<.1?"0%":`${e>0?"+":""}${e.toFixed(1)}%`}function Aa(e){return e===null||!Number.isFinite(e)?0:Math.min(Math.max(e*100,0),100)}function WO(e,t){if(t===null)return null;const n=Aa(e),r=Aa(t);return r<=0||Math.abs(r-n)<.5?null:r}function VO(e){switch(e){case"danger":return"bg-red-400";case"watch":return"bg-amber-300";case"unknown":return"bg-muted-foreground/50";case"ok":return"bg-emerald-400"}}function ZO(e){const t=e.latest.contextWindow.tokens;return t===null?"Context window unknown":`Context window ${wp(t)}`}const qO=["score","decision","final_status","validation_pass_ratio","semantic_memory_score","opencode_exit","actual_model","run_dir","workspace","project_dir","work_dir"];function vx(e){return typeof e=="string"?e.length>0?e:null:typeof e=="number"||typeof e=="boolean"?String(e):e===null?null:JSON.stringify(e)}function Oi(e,t){if(e===null)return null;const n=e.metadata[t];return n===void 0?null:vx(n)}function KO(e){const t=e.toLowerCase();return t.includes("reject")||t.includes("fail")||t.includes("error")?"border-red-400/35 bg-red-500/10 text-red-100":t.includes("partial")||t.includes("pending")||t.includes("slow")?"border-amber-300/35 bg-amber-400/10 text-amber-100":t.includes("pass")||t.includes("complete")||t.includes("accept")?"border-emerald-400/30 bg-emerald-500/10 text-emerald-100":"border-border/70 bg-background/70 text-muted-foreground"}function GO(e){const t=[];for(const n of qO){const r=e.metadata[n];if(r===void 0)continue;const o=vx(r);o!==null&&t.push({key:n,value:o})}return t}function Hd({memberships:e,defaultOpen:t=!1}){const[n,r]=g.useState(t);if(e.length===0)return null;const o=e[0],s=o?.member??null,a=Oi(s,"score"),l=Oi(s,"decision"),c=Oi(s,"final_status"),u=[a===null?null:{label:`score ${a}`,value:a},l===null?null:{label:l,value:l},c===null?null:{label:c,value:c},s?.model===null||s?.model===void 0?null:{label:s.model,value:s.model}].filter(d=>d!==null&&d.label.length>0&&d.value.length>0);return i.jsxs("div",{className:"mb-3 overflow-hidden rounded-md border border-border bg-[#0c0d0f] text-xs",children:[i.jsxs("button",{type:"button",onClick:()=>r(d=>!d),className:"flex w-full items-center gap-3 px-3 py-2 text-left transition-colors hover:bg-muted/30","aria-expanded":n,children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[i.jsx("span",{className:"font-semibold text-foreground",children:"Case File"}),o!==void 0&&i.jsx("span",{className:"truncate text-muted-foreground",title:o.groupTitle,children:o.groupTitle}),i.jsxs("span",{className:"font-mono text-[10px] uppercase text-muted-foreground",children:[e.length," group",e.length===1?"":"s"]})]}),u.length>0&&i.jsx("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:u.slice(0,4).map(d=>i.jsx("span",{className:xe("rounded border px-1.5 py-0.5 font-mono text-[10px]",KO(d.value)),children:d.label},d.label))})]}),n?i.jsx(Ja,{className:"size-4 shrink-0 text-muted-foreground"}):i.jsx(wt,{className:"size-4 shrink-0 text-muted-foreground"})]}),n&&i.jsx("div",{className:"space-y-2 border-t border-border/70 px-3 py-2",children:e.map(d=>{const f=d.member,h=GO(f);return i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[i.jsx("span",{className:"truncate font-medium text-foreground",title:d.groupTitle,children:d.groupTitle}),i.jsx("span",{className:"font-mono text-[10px] uppercase text-muted-foreground",children:d.groupStatus}),f.status!==null&&i.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:["member ",f.status]})]}),i.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground",children:[i.jsx("span",{className:"font-mono",title:f.sessionId,children:hn(f.sessionId)}),f.label!==null&&i.jsx("span",{children:f.label}),f.provider!==null&&i.jsx("span",{children:f.provider}),f.model!==null&&i.jsx("span",{className:"font-mono",children:f.model}),f.runId!==null&&i.jsxs("span",{className:"font-mono",title:f.runId,children:["run ",hn(f.runId)]})]}),h.length>0&&i.jsx("div",{className:"mt-2 grid gap-1 sm:grid-cols-2 xl:grid-cols-3",children:h.map(p=>i.jsxs("div",{className:"min-w-0 rounded border border-border/60 px-2 py-1",children:[i.jsx("div",{className:"font-mono text-[10px] text-muted-foreground",children:p.key}),i.jsx("div",{className:"truncate font-mono text-[11px] text-foreground",title:p.value,children:p.value})]},p.key))})]},`${d.groupId}:${f.id}`)})})]})}function JO({logs:e,pagination:t}){if(t.isLoading&&e.length===0)return"Loading logs...";if(e.length===0)return"No logs on this page";const n=e[0],r=e[e.length-1],o=n===void 0||r===void 0?"Current page":`#${n.id}-#${r.id}`,s=t.total===null?"logs":`${t.total} logs`;return`Showing ${o} of ${s}`}function Po({label:e,title:t,icon:n,disabled:r,onClick:o}){return i.jsxs("button",{type:"button",onClick:o,disabled:r,className:"inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-45",title:t,children:[n,i.jsx("span",{children:e})]})}function Wd({logs:e,pagination:t,embedded:n=!1}){if(t===void 0)return null;const r=t.isLoading;return i.jsxs("div",{className:xe("flex min-h-9 flex-col gap-2 px-1 py-1 sm:flex-row sm:items-center",n?"border-t border-border/70 pt-2":"mb-3 rounded-md border border-border bg-muted/10 px-2"),children:[i.jsxs("div",{className:"w-full min-w-0 px-1 font-mono text-[11px] text-muted-foreground sm:flex-1",children:[JO({logs:e,pagination:t}),t.isLoading&&e.length>0&&i.jsx("span",{className:"ml-2",children:"Loading..."})]}),i.jsxs("div",{className:"flex w-full items-center gap-1 overflow-x-auto sm:w-auto",children:[i.jsx(Po,{label:"Oldest",title:"Load the oldest logs in this session",icon:i.jsx(A2,{className:"size-3.5"}),disabled:r||!t.hasOlder,onClick:t.onOldest}),i.jsx(Po,{label:"Older",title:"Load older logs",icon:i.jsx(C2,{className:"size-3.5"}),disabled:r||!t.hasOlder,onClick:t.onOlder}),i.jsx(Po,{label:"Newer",title:"Load newer logs",icon:i.jsx(Kt,{className:"size-3.5"}),disabled:r||!t.hasNewer,onClick:t.onNewer}),i.jsx(Po,{label:"Newest",title:"Load the newest logs in this session",icon:i.jsx(z2,{className:"size-3.5"}),disabled:r||!t.hasNewer,onClick:t.onNewest})]})]})}function YO(e){return`${e} ${e===1?"request":"requests"}`}function Vd(e){return`#${String(e)}`}function Zd(e){switch(e){case"danger":return"text-red-300";case"watch":return"text-amber-200";case"unknown":return"text-muted-foreground";case"ok":return"text-emerald-300"}}function XO(e){switch(e){case"risk":return"border-red-400/30 bg-red-500/10 text-red-100";case"optimizable":return"border-amber-400/25 bg-amber-400/8 text-amber-100";case"ok":return"border-emerald-400/25 bg-emerald-400/8 text-emerald-100"}}function QO(e){switch(e){case"risk":return"Risk";case"optimizable":return"Optimizable";case"ok":return"OK"}}const e6=10,t6=80;function n6(e){e.setAttribute("data-deep-link-highlight","true"),window.setTimeout(()=>{e.removeAttribute("data-deep-link-highlight")},1800)}function r6(e){const t=document.getElementById(`log-${String(e)}`);return t instanceof HTMLElement?(t.scrollIntoView({block:"center",behavior:"smooth"}),t.focus({preventScroll:!0}),n6(t),!0):!1}function wx(e){ka({logId:e,tab:"anatomy"});let t=0;const n=()=>{ka({logId:e,tab:"anatomy"}),!r6(e)&&(t+=1,t<e6&&window.setTimeout(n,t6))};window.setTimeout(n,0)}function qd({command:e}){const[t,n]=g.useState(!1),r=g.useCallback(()=>{Ot(e).then(o=>{o&&(n(!0),setTimeout(()=>n(!1),2e3))})},[e]);return i.jsxs("div",{className:"inline-flex items-center gap-2 bg-muted rounded-md px-3 py-2",children:[i.jsx("pre",{className:"text-blue-500 font-mono text-sm m-0",children:e}),i.jsx("button",{type:"button",onClick:r,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 cursor-pointer","aria-label":"Copy command",children:t?i.jsx(et,{className:"size-4"}):i.jsx(kt,{className:"size-4"})})]})}function Kd(){return i.jsx(nt,{children:i.jsxs(Fe,{children:[i.jsx($e,{asChild:!0,children:i.jsxs("span",{className:"inline-flex h-7 items-center gap-2 rounded-md border border-cyan-400/30 bg-cyan-500/10 px-2.5 font-mono text-[11px] font-medium text-cyan-300 shadow-[0_0_16px_rgba(34,211,238,0.08)]",children:[i.jsx("span",{className:"size-1.5 rounded-full bg-emerald-300 shadow-[0_0_8px_rgba(110,231,183,0.8)]"}),"MCP Ready",i.jsx("span",{className:"hidden text-cyan-200/70 sm:inline",children:"/api/mcp"})]})}),i.jsx(Be,{sideOffset:8,className:"max-w-[320px] text-left leading-relaxed",children:"Coding agents can inspect logs, replay requests, test providers, and debug sessions through MCP at /api/mcp."})]})})}const o6=["text-amber-500","text-rose-500","text-sky-500","text-emerald-500","text-violet-500","text-orange-500","text-cyan-500","text-pink-500","text-lime-500","text-blue-500","text-yellow-500","text-fuchsia-500"];function Gd({compact:e,entrancePhase:t}){return e?i.jsx(pd,{className:"size-7 text-amber-500"}):i.jsxs("span",{className:"flex shrink-0 items-end gap-1 group cursor-default","aria-hidden":"true",children:[i.jsx(pd,{className:"size-10 text-amber-500 transition-all duration-300 group-hover:scale-125 group-hover:-translate-y-1.5"}),i.jsx("span",{className:"hidden items-end gap-0.5 sm:flex",children:Kr.map((n,r)=>{const o=o6[r]??"text-amber-500",s=t==="hidden"?"opacity-0 scale-0":t==="playing"?"animate-crab-piano-pop":"";return i.jsx(n,{className:`size-5 ${o} transition-all duration-300 ease-out group-hover:scale-125 group-hover:-translate-y-1 ${s}`,style:{transitionDelay:`${r*50}ms`,...t==="playing"?{animationDelay:`${r*400}ms`}:{}}},r)})})]})}function s6({compact:e,crabEntrancePhase:t}){return e?i.jsxs("div",{className:"pb-3",children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[i.jsx(Gd,{compact:!0,entrancePhase:t}),i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[i.jsx("span",{className:"truncate text-base font-bold",children:"Inspector"}),i.jsxs("span",{className:"hidden shrink-0 font-mono text-[11px] font-semibold text-muted-foreground sm:inline",children:["v",Oc.version]})]}),i.jsx("div",{className:"hidden text-[11px] font-semibold text-muted-foreground sm:block",children:"Local First. Evidence First."})]})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[i.jsx(hd,{}),i.jsx(Id,{})]})]}),i.jsx("div",{className:"mt-2 hidden sm:block",children:i.jsx(Kd,{})})]}):i.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] items-start gap-3 pb-6",children:[i.jsx("div",{}),i.jsxs("h1",{className:"flex min-w-0 flex-col items-center gap-2 text-center",children:[i.jsxs("span",{className:"flex max-w-[calc(100vw-7rem)] items-end gap-2 whitespace-nowrap",children:[i.jsx(Gd,{compact:!1,entrancePhase:t}),i.jsxs("span",{className:"flex min-w-0 items-baseline gap-2 pl-1",children:[i.jsx("span",{className:"truncate text-lg font-bold",children:"Agent Inspector"}),i.jsxs("span",{className:"shrink-0 font-mono text-xs font-semibold text-muted-foreground",children:["v",Oc.version]})]}),i.jsx(Hi,{className:"size-4 shrink-0 text-muted-foreground/70","aria-hidden":"true"}),i.jsx(fP,{className:"size-10 shrink-0"})]}),i.jsx("span",{className:"max-w-[calc(100vw-7rem)] text-sm font-semibold text-muted-foreground",children:"Local First. Evidence First."}),i.jsx(Kd,{})]}),i.jsxs("div",{className:"justify-self-end flex items-center gap-1",children:[i.jsx(hd,{}),i.jsx(Id,{})]})]})}function Jd({label:e,logId:t}){return i.jsxs("button",{type:"button",onClick:()=>wx(t),className:"inline-flex h-5 items-center rounded px-1 font-mono text-[10px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:`Open Context for ${Vd(t)}`,children:[e," ",Vd(t)]})}function i6({latestPercent:e,peakPercent:t,risk:n,onOpenContext:r}){const o=Aa(e),s=WO(e,t),a=t===null?`Latest context window usage ${Br(e)}`:`Latest context window usage ${Br(e)}, peak ${Br(t)}`;return i.jsx("button",{type:"button",onClick:r,className:"group block w-full rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1","aria-label":`${a}. Open latest Context details`,title:"Open latest Context details",children:i.jsxs("span",{className:"relative block h-2.5 overflow-hidden rounded-full border border-border/70 bg-background transition-colors group-hover:border-foreground/30",role:"meter","aria-label":a,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(o),children:[i.jsx("span",{className:xe("block h-full rounded-full transition-[width]",VO(n)),style:{width:`${o}%`}}),s!==null&&i.jsx("span",{className:"absolute top-0 h-full w-0.5 rounded-full bg-amber-100/75 shadow-[0_0_0_1px_rgba(0,0,0,0.25)]",style:{left:`calc(${s}% - 0.5px)`},"aria-hidden":"true"})]})})}function a6({summary:e}){const t=e.trendPercent,n=t===null||Math.abs(t)<.1?null:t>0?g2:u2,r=e.latest.diagnostics[0]??null,o=Br(e.latest.usagePercent),s=Br(e.peak.usagePercent),a=()=>{wx(e.latest.logId)};return i.jsxs("div",{className:"grid gap-x-4 gap-y-2 border-t border-border/60 py-2 first:border-t-0 lg:grid-cols-[minmax(180px,1fr)_minmax(260px,1fr)_minmax(260px,1.4fr)]",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("button",{type:"button",onClick:a,className:"min-w-0 truncate rounded-sm text-left font-mono font-semibold text-foreground transition-colors hover:text-cyan-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",title:`Open latest Context for ${e.model}`,children:e.model}),i.jsx("span",{className:xe("inline-flex h-5 shrink-0 items-center rounded border px-1.5 font-mono text-[10px]",XO(e.latest.health.level)),children:QO(e.latest.health.level)})]}),i.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground",children:[i.jsx("span",{children:YO(e.requestCount)}),i.jsx("span",{children:ZO(e)})]})]}),i.jsxs("div",{className:"min-w-0 space-y-2 text-xs",children:[i.jsx(i6,{latestPercent:e.latest.usagePercent,peakPercent:e.peak.usagePercent,risk:e.latest.riskLevel,onOpenContext:a}),i.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Latest"}),i.jsx("div",{className:xe("mt-0.5 font-mono",Zd(e.latest.riskLevel)),children:o}),i.jsx(Jd,{label:"Log",logId:e.latest.logId})]}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Peak"}),i.jsx("div",{className:xe("mt-0.5 font-mono",Zd(e.peak.riskLevel)),children:s}),i.jsx(Jd,{label:"Log",logId:e.peak.logId})]}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Trend"}),i.jsxs("div",{className:"mt-0.5 flex items-center gap-1 font-mono text-foreground",children:[n!==null&&i.jsx(n,{className:xe("size-3",t!==null&&t>0?"text-amber-300":"text-emerald-300")}),HO(t)]}),i.jsx("div",{className:"h-5","aria-hidden":"true"})]})]})]}),i.jsxs("div",{className:"min-w-0 space-y-1.5",children:[i.jsx(HR,{segments:e.latest.roleSegments,totalTokens:e.latest.roleTotalTokens,showLabels:!1}),i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground",children:[i.jsxs("span",{className:"font-mono",children:["~",Ue(e.latest.estimatedInputTokens)," input"]}),e.latest.windowUsedTokens!==null&&i.jsxs("span",{className:"font-mono",children:["~",Ue(e.latest.windowUsedTokens)," used"]}),r!==null&&i.jsx("span",{className:"truncate",children:r})]})]})]})}function l6({summary:e}){return e.models.length===0?null:i.jsxs("div",{className:"mt-3 border-t border-border/70 pt-2",children:[i.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[i.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-normal text-muted-foreground",children:"Session Context"}),i.jsxs("div",{className:"font-mono text-[10px] text-muted-foreground",children:[e.models.length," model",e.models.length===1?"":"s"]})]}),i.jsx("div",{className:"max-h-52 overflow-y-auto pr-1",children:e.models.map(t=>i.jsx(a6,{summary:t},t.model))})]})}function c6(e){const t=e.models.filter(r=>r.latest.health.level==="risk").length;if(t>0)return`${t} risk`;const n=e.models.filter(r=>r.latest.health.level==="optimizable").length;return n>0?`${n} optimizable`:`${e.models.length} model${e.models.length===1?"":"s"}`}function u6({label:e,logs:t,totalIn:n,totalOut:r,timeDisplayFormat:o,contextSummary:s,showBackLink:a}){const[l,c]=g.useState(!1),[u,d]=g.useState(!1),f=g.useMemo(()=>yx(t,o),[t,o]),h=g.useMemo(()=>MO(t),[t]),p=g.useMemo(()=>c6(s),[s]),y=g.useCallback(()=>{Ot(window.location.href).then(m=>{m&&(c(!0),setTimeout(()=>c(!1),2e3))})},[]);return i.jsxs("div",{className:"mb-3 rounded-md border border-border bg-muted/15 px-3 py-2 text-xs",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a&&i.jsx("a",{href:"/",className:"inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":"Back to all sessions",title:"Back to all sessions",children:i.jsx(h2,{className:"size-3.5"})}),i.jsxs("div",{className:"min-w-[180px] flex-1",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("span",{className:"font-mono font-semibold text-purple-400/90 truncate",title:e,children:hn(e)}),h!==null&&i.jsx("span",{className:"font-mono text-muted-foreground truncate max-w-[220px]",title:h,children:h})]}),i.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground",children:[i.jsxs("span",{children:[t.length," request",t.length!==1?"s":""]}),f!==null&&i.jsx("span",{children:f}),(n>0||r>0)&&i.jsxs("span",{className:"font-mono",children:[Ue(n)," in / ",Ue(r)," out"]})]})]}),s.models.length>0&&i.jsxs("button",{type:"button",onClick:()=>d(m=>!m),className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-border bg-background/60 px-2.5 font-mono text-[11px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-expanded":u,title:u?"Hide context details":"Show context details",children:[i.jsx("span",{children:p}),u?i.jsx(Ja,{className:"size-3.5"}):i.jsx(wt,{className:"size-3.5"})]}),i.jsx("button",{type:"button",onClick:y,className:"inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":l?"Copied session link":"Copy session link",title:l?"Copied session link":"Copy session link",children:l?i.jsx(et,{className:"size-3.5"}):i.jsx(kt,{className:"size-3.5"})})]}),u&&i.jsx(l6,{summary:s})]})}function d6({logs:e,sessions:t,models:n,selectedSession:r,selectedModel:o,onSessionChange:s,onModelChange:a,onClearAll:l,onClearGroup:c,viewMode:u,captureMode:d,strip:f,slowResponseThresholdSeconds:h,timeDisplayFormat:p,isLoading:y=!1,pagination:m,sessionMemberships:x=[],hideSessionFilter:b=!1,pinnedSessionId:v}){const{totalIn:w,totalOut:C}=g.useMemo(()=>Ud(e),[e]),{providers:S}=kp(),[j,E]=g.useState(null),[N,z]=g.useState(null),[M,B]=g.useState(null),[T,D]=g.useState("hidden"),k=g.useRef(null),L=g.useRef(null);LR(k,L,{pageWide:!0}),g.useEffect(()=>{const _=50+Kr.length*400,ee=setTimeout(()=>D("playing"),50),Q=setTimeout(()=>D("done"),_);return()=>{clearTimeout(ee),clearTimeout(Q)}},[]),g.useEffect(()=>{if(v===void 0){document.title="Agent Inspector";return}const fe=e.length===1?"1 req":`${e.length} req`;document.title=`${hn(v)} - ${fe} - Agent Inspector`},[e.length,v]);const W=g.useCallback(async fe=>{E(fe),z(null);try{const Se=await Ik(e,fe);Se.ok||z(Se.message)}finally{E(null)}},[e]);g.useEffect(()=>{B(null)},[r,o]);const U=g.useCallback(()=>{B(null)},[]),$=g.useMemo(()=>sE(e),[e]),G=g.useMemo(()=>UO({pinnedSessionId:v,selectedSession:r,sessions:t,logs:e}),[e,v,r,t]),A=G?.logs??[],K=G!==null&&A.length>0,{totalIn:q,totalOut:P}=g.useMemo(()=>Ud(A),[A]),ie=g.useMemo(()=>PO(A,S),[A,S]),le=g.useMemo(()=>jR($),[$]),ge=g.useMemo(()=>Rz($),[$]),ne=OO(d,e.length),ue=v!==void 0,de=K&&G!==null?hn(G.label):r==="__all__"?"All sessions":hn(r),he=g.useMemo(()=>FO({logs:e,isLoading:y,timeDisplayFormat:p,slowResponseThresholdSeconds:h}),[y,e,h,p]),me=g.useCallback(fe=>{const Se=ge.get(fe.id);Se!==void 0&&B([Se,fe])},[ge]);return i.jsxs("div",{className:"min-h-screen bg-[#070809] text-foreground",children:[i.jsxs("div",{className:"mx-auto grid min-h-screen max-w-[1920px] grid-cols-1 lg:grid-cols-[340px_minmax(0,1fr)] xl:grid-cols-[360px_minmax(0,1fr)]",children:[i.jsx("aside",{className:"border-b border-border bg-[#090a0c] lg:sticky lg:top-0 lg:h-screen lg:overflow-y-auto lg:border-b-0 lg:border-r",children:i.jsxs("div",{className:"space-y-4 p-4",children:[i.jsx(s6,{compact:!0,crabEntrancePhase:T}),i.jsxs("div",{className:"grid grid-cols-3 gap-2 border-y border-border/70 py-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"font-mono text-lg font-semibold text-foreground",children:e.length}),i.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Requests"})]}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"font-mono text-lg font-semibold text-foreground",children:Ue(K?q:w)}),i.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Input"})]}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"font-mono text-lg font-semibold text-foreground",children:Ue(K?P:C)}),i.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Output"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-normal text-muted-foreground",children:"Workspace"}),i.jsxs("div",{className:"rounded-md border border-border bg-[#0c0d0f] px-3 py-2",children:[i.jsx("div",{className:"font-mono text-xs font-semibold text-purple-300",title:de,children:de}),i.jsx("div",{className:"mt-1 text-[11px] text-muted-foreground",children:ue?"Session workspace":"Live workspace"})]})]}),K&&G!==null&&i.jsx(u6,{label:G.label,logs:A,totalIn:q,totalOut:P,timeDisplayFormat:p,contextSummary:ie,showBackLink:G.showBackLink}),K&&v!==void 0&&x.length>0&&i.jsx(Hd,{memberships:x}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-normal text-muted-foreground",children:"Filters"}),!b&&i.jsxs(ls,{value:r,onValueChange:s,children:[i.jsx(us,{className:"h-9 w-full text-xs",children:i.jsx(cs,{placeholder:"All sessions"})}),i.jsxs(ds,{children:[i.jsx(Ft,{value:"__all__",children:"All sessions"}),t.map(fe=>i.jsx(Ft,{value:fe,children:hn(fe)},fe))]})]}),i.jsxs(ls,{value:o,onValueChange:a,children:[i.jsx(us,{className:"h-9 w-full text-xs",children:i.jsx(cs,{placeholder:"All models"})}),i.jsxs(ds,{children:[i.jsx(Ft,{value:"__all__",children:"All models"}),n.map(fe=>i.jsx(Ft,{value:fe,children:fe},fe))]})]})]})]})}),i.jsxs("main",{className:"min-w-0",children:[i.jsxs("div",{className:"sticky top-0 z-30 border-b border-border bg-[#08090b]/95 px-4 py-3 shadow-[0_12px_40px_rgba(0,0,0,0.24)] backdrop-blur lg:px-5",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsxs("div",{className:"min-w-[180px] flex-1",children:[i.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Logs"}),i.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-muted-foreground",children:de})]}),ne.redacted&&i.jsx("button",{type:"button",onClick:()=>{W("redacted")},disabled:j!==null,className:"inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",title:"Export redacted logs as JSON ZIP",children:j==="redacted"?i.jsx("span",{children:"Exporting..."}):i.jsxs(i.Fragment,{children:[i.jsx(ws,{className:"size-3.5"}),i.jsx("span",{children:"Export"})]})}),ne.raw&&i.jsx("button",{type:"button",onClick:()=>{W("raw")},disabled:j!==null,className:"inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",title:"Export raw logs without redaction",children:j==="raw"?i.jsx("span",{children:"Exporting..."}):i.jsxs(i.Fragment,{children:[i.jsx(sw,{className:"size-3.5"}),i.jsx("span",{children:"Raw"})]})}),i.jsxs("button",{type:"button",onClick:l,className:"inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:"Clear all logs",children:[i.jsx(ur,{className:"size-3.5"}),i.jsx("span",{children:"Clear"})]})]}),i.jsx(Wd,{logs:e,pagination:m,embedded:!0}),N!==null&&i.jsx("div",{className:"mt-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:N})]}),i.jsxs("div",{className:"px-4 py-4 lg:px-5",children:[i.jsx(BO,{stats:he}),e.length===0?r!=="__all__"?i.jsx("div",{className:"py-16 text-center text-muted-foreground",children:i.jsxs("div",{className:"mx-auto max-w-xl space-y-4 rounded-md border border-border bg-muted/10 px-4 py-8",children:[i.jsx("p",{className:"text-sm font-medium",children:y?"Loading session data...":"Session not found"}),i.jsx("p",{className:"inline-block max-w-full rounded bg-muted px-3 py-1 font-mono text-xs break-all",children:hn(r)}),x.length>0&&i.jsx("div",{className:"text-left",children:i.jsx(Hd,{memberships:x})}),!y&&i.jsxs("p",{className:"text-xs",children:["This session may have been cleared or never existed."," ",b?i.jsx("a",{href:"/",className:"underline transition-colors hover:text-foreground",children:"Back to all sessions"}):i.jsx("button",{type:"button",onClick:()=>s("__all__"),className:"underline transition-colors hover:text-foreground",children:"Show all sessions"})]})]})}):i.jsx("div",{className:"py-16 text-center text-muted-foreground",children:i.jsxs("div",{className:"mx-auto max-w-2xl space-y-4 rounded-md border border-border bg-muted/10 px-4 py-8",children:[i.jsx("p",{className:"text-sm",children:"No requests captured yet."}),i.jsxs("div",{className:"flex flex-col items-center gap-2",children:[i.jsx(qd,{command:"ANTHROPIC_BASE_URL=http://localhost:25947/proxy <your-tool>"}),i.jsx(qd,{command:"OPENAI_BASE_URL=http://localhost:25947/proxy <your-tool>"})]}),i.jsx("p",{className:"mx-auto max-w-xl text-xs leading-relaxed text-muted-foreground",children:"Container note: if your AI tool runs in a different container or host than Agent Inspector, replace localhost with an address reachable from that tool and verify the network/firewall path."})]})}):i.jsxs("div",{ref:L,tabIndex:0,className:"flex flex-col gap-2 focus:outline-none",children:[i.jsx("div",{ref:k,children:i.jsx(IR,{groups:$,viewMode:u,strip:f,slowResponseThresholdSeconds:h,cacheTrends:le,onCompareWithPrevious:me,comparisonPredecessors:ge,onClearGroup:c,standalone:$.length===1,hasPinnedSessionContext:K,timeDisplayFormat:p})}),i.jsx("div",{className:"mt-3",children:i.jsx(Wd,{logs:e,pagination:m})})]})]})]})]}),M!==null&&i.jsx(g.Suspense,{fallback:null,children:i.jsx(UE,{left:M[0],right:M[1],onClose:U})})]})}const f6=sn([re({type:Ne("init"),logs:ye(Ho)}),re({type:Ne("update"),log:Ho})]),p6=re({logs:ye(Ho),total:se().int().nonnegative(),limit:se().int().positive(),hasOlder:He(),hasNewer:He(),oldestLogId:se().int().positive().nullable(),newestLogId:se().int().positive().nullable()});function h6(e,t){const n=[];for(const r of e)for(const o of r.members)o.sessionId===t&&n.push({groupId:r.id,groupTitle:r.title,groupKind:r.kind,groupStatus:r.status,groupTask:r.task,groupProject:r.project,groupEvidence:r.evidence,member:o});return n}function m6(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function g6(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function x6(e,t,n){return t==="__all__"&&n==="__all__"?e:e.filter(r=>!(t!=="__all__"&&r.sessionId!==t||n!=="__all__"&&r.model!==n))}const b6=50,y6=12,v6=1800,Yd=500,kx=100;function w6(e){const t=new URLSearchParams;e!==void 0&&(t.set("sessionId",e),t.set("compact","1"));const n=t.toString();return n.length>0?`/api/logs/stream?${n}`:"/api/logs/stream"}function k6(e,t){const n=new URLSearchParams({cursor:"1",compact:"1",limit:String(kx),sessionId:e});switch(t.kind){case"oldest":n.set("anchor","oldest");break;case"older":n.set("beforeLogId",String(t.beforeLogId));break;case"newer":n.set("afterLogId",String(t.afterLogId));break}return`/api/logs?${n.toString()}`}function Ro(e){const t=new Map;for(let n=0;n<e.length;n++){const r=e[n];r!==void 0&&t.set(r.id,n)}return t}function Xd(e){return e.length<=Yd?e:e.slice(e.length-Yd)}function N6({initialSessionId:e}={}){const[t,n]=g.useState([]),[r,o]=g.useState(e??"__all__"),[s,a]=g.useState("__all__"),[l,c]=g.useState(null),[u,d]=g.useState(e===void 0),[f,h]=g.useState(null),[p,y]=g.useState(e!==void 0),[m,x]=g.useState([]),b=g.useRef(null),v=g.useRef(null),w=g.useRef(null),C=g.useRef(0),S=g.useRef(new Map),j=g.useRef([]),E=g.useRef(null),N=g.useMemo(()=>x6(t,r,s),[t,r,s]),z=g.useMemo(()=>m6(t),[t]),M=g.useMemo(()=>g6(t),[t]),B=g.useCallback(()=>{E.current=null;const ne=j.current;j.current=[],ne.length!==0&&n(ue=>{let de=ue;for(const he of ne){const me=S.current.get(he.id);me!==void 0?de=[...de.slice(0,me),he,...de.slice(me+1)]:(S.current.set(he.id,de.length),de=[...de,he])}return de=Xd(de),S.current=Ro(de),de})},[]),T=g.useCallback(ne=>{j.current.push(ne),E.current===null&&(E.current=setTimeout(B,b6))},[B]),D=g.useCallback(()=>{b.current&&b.current.close(),d(!1);const ne=new EventSource(w6(e));b.current=ne,ne.onmessage=ue=>{try{const de=String(ue.data),he=JSON.parse(de),me=f6.safeParse(he);if(!me.success){c("Failed to parse SSE data");return}const fe=me.data;if(fe.type==="init"){E.current!==null&&(clearTimeout(E.current),E.current=null),j.current=[];const Se=Xd(fe.logs);S.current=Ro(Se),n(Se),d(!0),c(null)}else fe.type==="update"&&T(fe.log)}catch{c("Failed to parse SSE data")}},ne.onerror=()=>{c("SSE connection lost, reconnecting..."),d(!0),ne.close(),v.current!==null&&clearTimeout(v.current),v.current=setTimeout(D,3e3)}},[e,T]),k=g.useCallback(ne=>{if(e===void 0)return;const ue=C.current+1;C.current=ue,y(!0),c(null),an(k6(e,ne),p6).then(de=>{if(C.current!==ue)return;const he=de.logs;S.current=Ro(he),n(he),h(de),o(e),y(!1),c(null)}).catch(de=>{C.current===ue&&(n([]),h(null),y(!1),c(de instanceof Error?de.message:"Failed to load session logs"))})},[e]);g.useEffect(()=>{if(e===void 0){x([]);return}let ne=!1;return fetch("/api/groups").then(async ue=>{if(!ue.ok)return null;const de=await ue.json(),he=Xf.safeParse(de);return he.success?he.data.groups:null}).then(ue=>{ne||ue===null||x(h6(ue,e))}).catch(()=>{ne||x([])}),()=>{ne=!0}},[e]),g.useEffect(()=>{e!==void 0&&k({kind:"newest"})},[e,k]),g.useEffect(()=>{if(e===void 0)return D(),()=>{b.current&&(b.current.close(),b.current=null),v.current!==null&&(clearTimeout(v.current),v.current=null),E.current!==null&&(clearTimeout(E.current),E.current=null)}},[D,e]),g.useEffect(()=>{const ne=window.location.hash;if(!ne.startsWith("#log-")||w.current===ne)return;const ue=ne.slice(1),de=Number(ue.replace(/^log-/,""));Number.isInteger(de)&&de>0&&ka({logId:de,tab:"request"});let he=!1,me=0,fe=null,Se=null;const _=()=>{if(he)return;const ee=document.getElementById(ue);if(ee!==null){w.current=ne,ee.scrollIntoView({block:"center",behavior:"smooth"}),ee instanceof HTMLElement&&(fe=ee,ee.setAttribute("data-deep-link-highlight","true"),Se=window.setTimeout(()=>{ee.removeAttribute("data-deep-link-highlight")},v6),ee.focus({preventScroll:!0}),ee.getAttribute("data-nav-action")==="expand"&&ee.click());return}me+=1,me<y6&&window.setTimeout(_,100)};return _(),()=>{he=!0,Se!==null&&window.clearTimeout(Se),fe!==null&&fe.removeAttribute("data-deep-link-highlight")}},[N.length]);const L=g.useCallback(()=>{e!==void 0&&t.length===0||(async()=>{try{const ne=e===void 0?void 0:JSON.stringify({ids:t.map(de=>de.id)});if(!(await fetch("/api/logs",{method:"DELETE",...ne===void 0?{}:{headers:{"Content-Type":"application/json"},body:ne}})).ok){c("Failed to clear logs");return}S.current.clear(),n([]),c(null)}catch(ne){c(ne instanceof Error?ne.message:"Unknown error clearing logs")}})()},[t,e]),W=g.useCallback(ne=>{ne.length!==0&&(async()=>{try{if(!(await fetch("/api/logs",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:ne})})).ok){c("Failed to clear group");return}const de=new Set(ne);n(he=>{const me=he.filter(fe=>!de.has(fe.id));return S.current=Ro(me),me}),c(null)}catch(ue){c(ue instanceof Error?ue.message:"Unknown error clearing group")}})()},[]),{strip:U,captureMode:$,slowResponseThresholdSeconds:G,timeDisplayFormat:A}=Ga(),K=$,q=g.useCallback(()=>{k({kind:"oldest"})},[k]),P=g.useCallback(()=>{k({kind:"newest"})},[k]),ie=g.useCallback(()=>{const ne=t[0],ue=f?.oldestLogId??ne?.id??null;ue!==null&&k({kind:"older",beforeLogId:ue})},[t,k,f]),le=g.useCallback(()=>{const ne=t[t.length-1],ue=f?.newestLogId??ne?.id??null;ue!==null&&k({kind:"newer",afterLogId:ue})},[t,k,f]),ge=g.useMemo(()=>{if(e!==void 0)return{isLoading:p,total:f?.total??null,pageSize:f?.limit??kx,hasOlder:f?.hasOlder??!1,hasNewer:f?.hasNewer??!1,oldestLogId:f?.oldestLogId??null,newestLogId:f?.newestLogId??null,onOldest:q,onOlder:ie,onNewer:le,onNewest:P}},[e,P,le,ie,q,f,p]);return i.jsxs(i.Fragment,{children:[l!==null&&i.jsx("div",{className:"fixed top-4 right-4 bg-destructive text-destructive-foreground px-4 py-2 rounded-md text-sm z-50",children:l}),i.jsx(bk,{}),i.jsx(d6,{logs:N,sessions:z,models:M,selectedSession:r,selectedModel:s,onSessionChange:o,onModelChange:a,onClearAll:L,onClearGroup:W,isLoading:e===void 0?!u:p,pagination:ge,sessionMemberships:m,viewMode:K,captureMode:$,strip:U,slowResponseThresholdSeconds:G,timeDisplayFormat:A,hideSessionFilter:e!==void 0,pinnedSessionId:e})]})}export{tp as $,se as A,ot as B,J2 as C,Us as D,ye as E,ka as F,He as G,I as H,Ho as I,nz as J,jO as K,ww as L,Ew as M,FR as N,DR as O,N6 as P,wp as Q,Bw as R,HR as S,Xm as T,j6 as U,wt as V,Ae as W,nl as X,sd as Y,I3 as Z,C6 as _,oE as a,z3 as a0,rz as a1,tl as a2,Zl as a3,ss as a4,Vr as a5,tr as a6,C_ as a7,Vt as a8,xe as b,be as c,Hi as d,sp as e,Ue as f,Vm as g,Kt as h,et as i,kt as j,Ot as k,Hs as l,Ws as m,Vs as n,Dw as o,Qm as p,_t as q,Mn as r,St as s,Ie as t,kp as u,nt as v,Fe as w,$e as x,Be as y,re as z};
|
|
117
|
+
args = ["stdio", "--url", "${r}"]`}],[r]),s=g.useCallback((a,l)=>{Ot(l).then(c=>{c&&(t(a),setTimeout(()=>t(null),1600))})},[]);return i.jsxs("div",{className:"min-w-0 space-y-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(tl,{className:"size-4 text-muted-foreground"}),i.jsx("h3",{className:"text-sm font-semibold",children:"MCP access"})]}),i.jsxs("div",{className:"grid gap-2 rounded-md border border-border bg-background px-3 py-2 text-xs text-muted-foreground",children:[i.jsx("div",{children:"Use Streamable HTTP when the client supports URL-based MCP. Use the stdio bridge only for stdio-only clients. Configure one entry for the same Inspector instance."}),i.jsx("div",{children:"If the MCP client runs in another container or host, replace localhost with a reachable host/IP and verify the network path."})]}),i.jsx("div",{className:"grid gap-2",children:o.map(a=>i.jsx(hs,{id:a.id,label:a.label,value:a.value,copiedId:e,onCopy:s},a.id))})]})}function CR(){const{strip:e,slowResponseThresholdSeconds:t,providerTestTimeoutSeconds:n,timeDisplayFormat:r,isLoading:o,setStrip:s,setSlowResponseThresholdSeconds:a,setProviderTestTimeoutSeconds:l,setTimeDisplayFormat:c}=Ga(),[u,d]=g.useState(null),[f,h]=g.useState(!1),p=g.useCallback(async b=>{d(null),h(!0);try{await s(b)}catch(v){d(v instanceof Error?v.message:String(v))}finally{h(!1)}},[s]),y=g.useCallback(async b=>{d(null),h(!0);try{await a(b)}catch(v){d(v instanceof Error?v.message:String(v))}finally{h(!1)}},[a]),m=g.useCallback(async b=>{d(null),h(!0);try{await l(b)}catch(v){d(v instanceof Error?v.message:String(v))}finally{h(!1)}},[l]),x=g.useCallback(async b=>{d(null),h(!0);try{await c(b)}catch(v){d(v instanceof Error?v.message:String(v))}finally{h(!1)}},[c]);return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-1",children:[i.jsx("h3",{className:"text-sm font-semibold",children:"Claude Code billing header"}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["When enabled, the proxy strips the synthetic ",i.jsx("code",{children:"x-anthropic-billing-header"})," text block that Claude Code prepends to the system prompt before forwarding to upstream. Improves prefix-cache hit rates against third-party upstreams. The default at startup is controlled by the ",i.jsx("code",{children:"AGENT_INSPECTOR_STRIP_CLAUDE_CODE_BILLING_HEADER"})," ","environment variable; your choice is persisted to ",i.jsx("code",{children:"config.json"})," and overrides the env var for subsequent requests."]})]}),i.jsxs("label",{className:"flex items-center gap-3",children:[i.jsx("input",{type:"checkbox",role:"switch",checked:e,disabled:o||f,onChange:b=>{p(b.currentTarget.checked)},className:"size-4 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"}),i.jsx("span",{className:"text-sm",children:o?"Loading...":e?"Stripping enabled":"Stripping disabled"})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{htmlFor:"slow-response-threshold",className:"text-sm font-semibold",children:"Slow response threshold"}),i.jsxs("p",{className:"text-xs text-muted-foreground",children:["Logs whose elapsed time exceeds this many seconds show a warning icon next to the duration. Set to ",i.jsx("code",{children:"0"})," to disable the indicator."]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{id:"slow-response-threshold",type:"number",min:0,max:Bi,step:1,value:t,disabled:o||f,onChange:b=>{const v=Number(b.currentTarget.value);Number.isInteger(v)&&(v<0||v>Bi||y(v))},className:"h-8 w-24 rounded-md border border-input bg-transparent px-2 text-sm font-mono disabled:cursor-not-allowed disabled:opacity-50"}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"seconds"})]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{htmlFor:"provider-test-timeout",className:"text-sm font-semibold",children:"Provider test timeout"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Provider Test waits this many seconds per configured model before aborting slow probes. The full test window scales with model count."}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{id:"provider-test-timeout",type:"number",min:1,max:Ui,step:1,value:n,disabled:o||f,onChange:b=>{const v=Number(b.currentTarget.value);Number.isInteger(v)&&(v<1||v>Ui||m(v))},className:"h-8 w-24 rounded-md border border-input bg-transparent px-2 text-sm font-mono disabled:cursor-not-allowed disabled:opacity-50"}),i.jsx("span",{className:"text-xs text-muted-foreground",children:"seconds / model"})]})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("label",{htmlFor:"time-display-format",className:"text-sm font-semibold",children:"Time display"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Controls timestamps in session summaries, conversation headers, and log rows."}),i.jsxs("select",{id:"time-display-format",value:r,disabled:o||f,onChange:b=>{const v=Qf.safeParse(b.currentTarget.value);v.success&&x(v.data)},className:"h-8 rounded-md border border-input bg-background px-2 text-sm disabled:cursor-not-allowed disabled:opacity-50",children:[i.jsx("option",{value:"time",children:"Time only"}),i.jsx("option",{value:"full",children:"Full ISO"})]})]}),u!==null&&i.jsxs("p",{className:"text-xs text-destructive",children:["Failed to save: ",u]})]})}function jR(e){const t=new Map;for(const n of e){const r=n.logs;for(let o=1;o<r.length;o++){const s=r[o-1],a=r[o];s===void 0||a===void 0||t.set(a.id,{creation:Pd(s.cacheCreationInputTokens,a.cacheCreationInputTokens),read:Pd(s.cacheReadInputTokens,a.cacheReadInputTokens)})}}return t}function Pd(e,t){return t===null||e===null?null:t>e?{direction:"up",delta:t-e}:t<e?{direction:"down",delta:e-t}:null}const NR=30,ER=112,TR=6;function AR(e){return e>NR}function IR({groups:e,standalone:t,...n}){return AR(e.length)?i.jsx(zR,{groups:e,standalone:t,...n}):i.jsx(i.Fragment,{children:e.map(r=>i.jsx(ox,{group:r,standalone:t,...n},r.id))})}function zR({groups:e,standalone:t,...n}){const[r,o]=g.useState(()=>new Map),s=y3({count:e.length,estimateSize:()=>ER,overscan:TR,getItemKey:c=>e[c]?.id??c}),a=g.useCallback((c,u)=>{o(d=>{const f=new Map(d);return u?f.set(c,!0):f.delete(c),f})},[]),l=g.useMemo(()=>{const c=new Map;for(let u=0;u<e.length;u++){const d=e[u];if(d!==void 0)for(const f of d.logs)c.set(f.id,u)}return c},[e]);return g.useEffect(()=>{const c=u=>{const d=Ys(u);if(d===null)return;const f=l.get(d.logId);if(f===void 0)return;const h=e[f];h!==void 0&&(a(h.id,!0),s.scrollToIndex(f,{align:"center"}))};return window.addEventListener(on,c),()=>{window.removeEventListener(on,c)}},[e,l,a,s]),i.jsx("div",{className:"relative w-full",style:{height:`${s.getTotalSize()}px`},"data-virtualized-conversation-list":"true",children:s.getVirtualItems().map(c=>{const u=e[c.index];return u===void 0?null:i.jsx("div",{"data-index":c.index,ref:s.measureElement,className:"absolute left-0 top-0 w-full",style:{transform:`translateY(${c.start}px)`},children:i.jsx(ox,{group:u,standalone:t,expanded:r.get(u.id)??!1,onExpandedChange:d=>a(u.id,d),...n})},c.key)})})}const ms="data-nav-id",PR="data-nav-action";function Rd(e){return Array.from(e.querySelectorAll(`[${ms}]`))}function Od(e){return e instanceof HTMLElement}function RR(e,t){let n=e;for(;n!==null&&n!==t;){if(n.hasAttribute(ms))return n;n=n.parentElement}return e.hasAttribute(ms)?e:null}function Pi(e){const t=e.getAttribute(PR);return t==="toggle"||t==="expand"||t==="collapse"?t:null}function Pr(e){e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",behavior:"smooth"})}function Rr(e,t){return e[t]??null}function px(e){const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)}function Md(e){const t=e.tagName;return t==="BUTTON"||t==="A"||px(e)?!0:e.closest("[role='button'],[role='menuitem'],[role='option']")!==null}function OR(e){return e.closest("[role='dialog'],[role='menu'],[role='listbox']")!==null?!0:document.querySelector("[role='dialog'],[role='menu'],[role='listbox']")!==null}function MR(){const e=window.getSelection();return e===null?!1:e.type==="Range"&&e.toString().length>0}function Ao(e,t){return e.key===t&&e.shiftKey}function LR(e,t,n={}){const r=t??e,o=n.pageWide===!0,s=g.useCallback(a=>{const l=e.current,c=r.current;if(!l||!c)return;const u=a.target;if(!Od(u)||u!==c)return;const d=Rd(l),f=Rr(d,0);f!==null&&Pr(f)},[e,r]);g.useEffect(()=>{const a=l=>{if(l.altKey||l.ctrlKey||l.metaKey)return;const c=e.current;if(!c)return;const u=l.target;if(!Od(u)||px(u)||MR())return;const d=c.contains(u);if(d&&Md(u)&&!u.hasAttribute(ms)||!d&&(!o||Md(u)||OR(u)))return;const f=Rd(c);if(f.length===0)return;const h=RR(u,c),p=h!==null?f.indexOf(h):-1;let y=!1;switch(l.key){case"ArrowUp":case"W":{if(l.shiftKey&&l.key==="ArrowUp"||l.key==="W"&&!Ao(l,"W"))break;l.preventDefault();const m=p>0?p-1:p===-1?f.length-1:-1;if(m!==-1){const x=Rr(f,m);x!==null&&Pr(x)}y=!0;break}case"ArrowDown":case"S":{if(l.shiftKey&&l.key==="ArrowDown"||l.key==="S"&&!Ao(l,"S"))break;l.preventDefault();const m=p<f.length-1?p+1:p===-1?0:-1;if(m!==-1){const x=Rr(f,m);x!==null&&Pr(x)}y=!0;break}case"ArrowLeft":case"A":{if(l.shiftKey&&l.key==="ArrowLeft"||l.key==="A"&&!Ao(l,"A")||h===null)break;if(l.preventDefault(),Pi(h)==="collapse")h.click();else if(p>0){const x=Rr(f,p-1);x!==null&&Pr(x)}y=!0;break}case"ArrowRight":case"D":{if(l.shiftKey&&l.key==="ArrowRight"||l.key==="D"&&!Ao(l,"D")||h===null)break;if(l.preventDefault(),Pi(h)==="expand")h.click();else if(p<f.length-1){const x=Rr(f,p+1);x!==null&&Pr(x)}y=!0;break}case" ":{if(h===null)break;l.preventDefault(),Pi(h)!==null&&h.click(),y=!0;break}}y&&l.stopPropagation()};return document.addEventListener("keydown",a,{capture:!0}),()=>document.removeEventListener("keydown",a,{capture:!0})},[e,o,r]),g.useEffect(()=>(document.addEventListener("focusin",s),()=>document.removeEventListener("focusin",s)),[s])}const DR={system:"System",user:"User",assistant:"Assistant",tool:"Tool Results",tools:"Tool Definitions"},FR={system:"bg-sky-500/70",user:"bg-emerald-500/70",assistant:"bg-violet-500/70",tool:"bg-sky-400/55",tools:"bg-slate-500/70"},$R={system:"focus-visible:ring-sky-300",user:"focus-visible:ring-emerald-300",assistant:"focus-visible:ring-violet-300",tool:"focus-visible:ring-sky-300",tools:"focus-visible:ring-slate-300"},Ri=12,Io=1,Ld=80,Dd=24;function BR(e){return e.length<=Dd?e:`${e.slice(0,Dd-3)}...`}function UR(e){const t=e.replace(/\s+/g," ").trim();return t.length<=Ld?t:`${t.slice(0,Ld)}...`}function zo(e){return e>=10?`${e.toFixed(0)}%`:e>=1?`${e.toFixed(1)}%`:e>0?"<1%":"0%"}const HR=g.memo(function({segments:t,totalTokens:n,showLabels:r=!0,onActivate:o}){const s=g.useMemo(()=>n>0?n:t.reduce((x,b)=>x+b.size,0),[t,n]),a=t.slice(0,Ri),l=t.slice(Ri),c=l.reduce((x,b)=>x+b.size,0),u=l.length,d=Ri,f=d+u-1,h=u>0,p=o!==void 0,y=g.useMemo(()=>a.reduce((x,b)=>x+b.size,0),[a]),m=g.useMemo(()=>`Request context: ~${Ue(s)} tokens across ${t.length} segment${t.length===1?"":"s"}`,[t.length,s]);return t.length===0||s<=0?i.jsx("div",{role:"img","aria-label":m,className:"h-6"}):i.jsx(nt,{delayDuration:150,children:i.jsxs("div",{role:"img","aria-label":m,className:"flex flex-col gap-1.5",children:[i.jsxs("div",{className:"relative flex h-6 w-full overflow-hidden rounded border border-border/40 bg-muted/30","data-testid":"anatomy-segment-bar",children:[a.map((x,b)=>{const v=s>0?x.size/s*100:0,w=Math.max(Io,v),C=xe("h-full border-r border-background/80 last:border-r-0",p?"opacity-90 hover:opacity-100 focus:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-background":"opacity-90",FR[x.role],p?$R[x.role]:""),S={width:`${w}%`},j=`${x.label}, ${zo(v)}, ~${Ue(x.size)} tokens`;return i.jsxs(Fe,{children:[i.jsx($e,{asChild:!0,children:p?i.jsx("button",{type:"button",role:"button",tabIndex:0,onClick:()=>o(x),onKeyDown:E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),o(x))},"data-anatomy-path":x.path,"aria-label":j,className:C,style:S}):i.jsx("span",{"aria-label":j,className:C,style:S})}),i.jsxs(Be,{side:"bottom",className:"max-w-sm text-xs p-2 space-y-0.5",children:[i.jsxs("div",{className:"font-semibold",children:[x.label," - ",zo(v)," - ~",Ue(x.size)," ","tokens"]}),i.jsx("div",{className:"text-muted-foreground",children:DR[x.role]}),i.jsxs("div",{className:"text-muted-foreground",children:[x.characters.toLocaleString()," chars"]}),x.text.length>0&&i.jsx("div",{className:"text-muted-foreground/90 break-words whitespace-pre-wrap",children:UR(x.text)})]})]},`${x.path}-${b}`)}),h&&i.jsxs(Fe,{children:[i.jsx($e,{asChild:!0,children:i.jsxs("div",{role:"img","aria-label":`${u} additional segments`,className:"flex h-full items-center justify-center bg-muted-foreground/30 px-1.5 text-[10px] font-mono text-background",style:{width:`${Math.max(Io,c/s*100)}%`},children:["... +",u]})}),i.jsxs(Be,{side:"bottom",className:"text-xs",children:[u," more segment",u===1?"":"s"," (indices"," ",d,"-",f,")"]})]})]}),r&&i.jsxs("div",{className:"flex w-full gap-1 text-[10px] text-muted-foreground",children:[a.map((x,b)=>{const v=s>0?x.size/s*100:0,w=Math.max(Io,v);return i.jsxs("div",{className:"flex flex-col gap-0.5 truncate",style:{width:`${w}%`},title:`${x.label} - ${zo(v)} - ~${Ue(x.size)} tokens`,children:[i.jsx("span",{className:"truncate font-mono text-foreground/80",children:BR(x.label)}),i.jsxs("span",{className:"truncate font-mono text-muted-foreground/70",children:[zo(v)," - ~",Ue(x.size)]})]},`label-${x.path}-${b}`)}),h&&i.jsxs("div",{className:"flex flex-col gap-0.5 truncate text-muted-foreground",style:{width:`${Math.max(Io,c/s*100)}%`},children:[i.jsxs("span",{className:"truncate font-mono text-foreground/60",children:["... +",u]}),i.jsxs("span",{className:"truncate font-mono text-muted-foreground/60",children:["~",Ue(c)]})]})]}),y<s*.1&&i.jsx("div",{className:"h-0"})]})})}),hx=.75,mx=.9,Na=8e3,WR=.35,gx=40,xx=160,VR=5,ZR=8,qR=18,KR=6e4,GR=.7,Fd=3e3,JR=.3,$d=160,YR=new Set(["answer","body","content","data","error","message","markdown","output","response","result","stderr","stdout","text","transcript"]),XR=["context_window","contextWindow","context_length","contextLength","max_context_length","maxContextLength","max_input_tokens","maxInputTokens"],QR=["max_tokens","maxTokens","max_completion_tokens","maxCompletionTokens","max_output_tokens","maxOutputTokens"],eO=[{family:"OpenAI GPT-4.1",tokens:1047576,mode:"prefix",patterns:["gpt-4.1"]},{family:"OpenAI GPT-4o",tokens:128e3,mode:"prefix",patterns:["gpt-4o"]},{family:"OpenAI o-series",tokens:128e3,mode:"prefix",patterns:["o1","o3","o4"]},{family:"Anthropic Claude",tokens:2e5,mode:"prefix",patterns:["claude-"]},{family:"DeepSeek V4",tokens:1048576,mode:"prefix",patterns:["deepseek-v4-pro","deepseek-v4-flash"]},{family:"DeepSeek",tokens:64e3,mode:"prefix",patterns:["deepseek-"]},{family:"MiniMax M3",tokens:1048576,mode:"includes",patterns:["minimax-m3"]},{family:"MiniMax M2.7",tokens:204800,mode:"includes",patterns:["minimax-m2.7"]},{family:"MiniMax M2.5/M2.1",tokens:196608,mode:"includes",patterns:["minimax-m2.5","minimax-m2.1"]},{family:"GLM-5.2",tokens:1048576,mode:"prefix",patterns:["glm-5.2"]},{family:"GLM-5",tokens:202752,mode:"prefix",patterns:["glm-5","glm-5.1"]}],tO={system:"System",user:"User messages",assistant:"Assistant messages",tool:"Tool results",tools:"Tool definitions"};function nO(e){if(typeof e=="number")return Number.isFinite(e)&&e>0?Math.floor(e):null;if(typeof e=="string"){const t=Number(e);if(Number.isFinite(t)&&t>0)return Math.floor(t)}return null}function bx(e,t){for(const n of t){const r=nO(Me(e,n));if(r!==null)return r}return null}function rO(e){const t=Me(e,"model");if(typeof t!="string")return null;const n=t.trim();return n===""?null:n}function oO(e,t){switch(t.mode){case"prefix":return t.patterns.some(n=>e.startsWith(n));case"includes":return t.patterns.some(n=>e.includes(n))}}function sO(e,t,n=[]){const r=bx(t,XR);if(r!==null)return{tokens:r,label:"Request metadata",source:"request"};const o=ZP(e,n);if(o!==null)return{tokens:o.tokens,label:`${o.providerName} config`,source:"provider"};if(e===null)return{tokens:null,label:"Unknown model",source:"unknown"};const s=e.trim().toLowerCase().replace(/\s+/g,"-");for(const a of eO)if(oO(s,a))return{tokens:a.tokens,label:`${a.family} local rule`,source:"model-rule"};return{tokens:null,label:"No local rule",source:"unknown"}}function iO(e){return e<0?0:e>1?1:e}function aO(e){return e===null?"unknown":e>=mx?"danger":e>=hx?"watch":"ok"}function lO(e,t){return e.filter(n=>n.role===t).reduce((n,r)=>n+r.size,0)}function cO(e,t){return["system","user","assistant","tool","tools"].map(r=>{const o=lO(e,r);return{role:r,label:tO[r],tokens:o,percent:t>0?o/t:0}}).filter(r=>r.tokens>0).sort((r,o)=>o.tokens-r.tokens)}function Ea(e){return e.replace(/\s+/g," ").trim().toLowerCase()}function uO(e){const t=e.replace(/\s+/g," ").trim();return t.length<=$d?t:`${t.slice(0,$d-3)}...`}function dO(e){return{role:e.role,label:e.label,path:e.path,tokens:e.tokens,characters:e.characters}}function fO(e){return{role:e.role,label:e.label,path:e.path,tokens:e.size,characters:e.characters,text:e.text}}function pO(e){const t=e.trim();return t.startsWith("{")||t.startsWith("[")}function hO(e){if(!pO(e))return null;try{return JSON.parse(e)}catch{return null}}function mO(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function gO(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t]??"";if(!(n.startsWith("[")&&n.endsWith("]")))return n}return null}function xO(e){const t=gO(e);return t===null?!1:YR.has(mO(t))}function bO(e){return e.map(t=>t.startsWith("[")?t:`.${t}`).join("").replace(/^\./,"")}function yO(e,t,n){const r=Al(t);if(r<xx)return null;const o=Tl(t);return o<gx?null:{role:e.role,label:`${e.label} ${bO(n)}`,path:e.path,tokens:o,characters:r,text:t}}function Ta({value:e,segment:t,path:n,depth:r,candidates:o}){if(!(o.length>=ZR)&&!(r>VR)){if(typeof e=="string"){if(!xO(n))return;const s=yO(t,e,n);s!==null&&o.push(s);return}if(Array.isArray(e)){e.forEach((s,a)=>Ta({value:s,segment:t,path:[...n,`[${String(a)}]`],depth:r+1,candidates:o}));return}Il(e)&&Object.entries(e).forEach(([s,a])=>Ta({value:a,segment:t,path:[...n,s],depth:r+1,candidates:o}))}}function vO(e){const t=fO(e),n=hO(e.text);if(n===null)return[t];const r=[];Ta({value:n,segment:e,path:[],depth:0,candidates:r});const o=Ea(e.text),s=new Set([o]),a=r.filter(l=>{const c=Ea(l.text);return c===""||s.has(c)?!1:(s.add(c),!0)});return[t,...a]}function wO(e){const t=new Map;for(const r of e){const o=vO(r);for(const s of o){if(s.tokens<gx||s.characters<xx)continue;const a=Ea(s.text);if(a==="")continue;const l=t.get(a);if(l===void 0){t.set(a,{tokens:s.tokens,candidates:[s]});continue}t.set(a,{tokens:l.tokens+s.tokens,candidates:[...l.candidates,s]})}}const n=[];for(const r of t.values()){if(r.candidates.length<2)continue;const o=r.candidates[0]??null;if(o===null)continue;const s=r.tokens-o.tokens;n.push({key:`${o.path}:${o.label}:${String(r.candidates.length)}:${String(r.tokens)}`,count:r.candidates.length,totalTokens:r.tokens,repeatedTokens:s,preview:uO(o.text),firstLabel:o.label,segments:r.candidates.map(dO)})}return n.sort((r,o)=>o.repeatedTokens-r.repeatedTokens||o.totalTokens-r.totalTokens)}function kO(e){if(e.length===0)return null;const t=e.length,n=e.reduce((o,s)=>o+s.count,0),r=e.reduce((o,s)=>o+s.repeatedTokens,0);return{kind:"duplicate",severity:r>=Na?"danger":"watch",title:"Duplicate context",detail:`${String(n)} repeated blocks across ${String(t)} group${t===1?"":"s"}, ~${String(r)} repeated tokens.`}}function _O(e){return e.reduce((t,n)=>t+n.repeatedTokens,0)}function SO(e,t,n){const r=[],o=e.find(c=>c.role==="tools")??null;o!==null&&(o.tokens>=Na||o.percent>=WR&&o.tokens>=Fd)&&r.push({kind:"tool-schema",severity:o.tokens>=Na?"danger":"watch",title:"Large tool schema",detail:`Tool definitions take ${Math.round(o.percent*100)}% of request context.`});const s=e.find(c=>c.role==="system")??null;s!==null&&s.tokens>=Fd&&s.percent>=JR&&r.push({kind:"system-heavy",severity:"watch",title:"Large system prompt",detail:`System instructions take ${Math.round(s.percent*100)}% of request context.`});const a=e.filter(c=>c.role==="user"||c.role==="assistant"||c.role==="tool").reduce((c,u)=>c+u.tokens,0),l=t>0?a/t:0;return n>=qR&&(a>=KR||l>=GR)&&r.push({kind:"history-bloat",severity:l>=.85?"danger":"watch",title:"Conversation history growth",detail:`${String(n)} message blocks take ${Math.round(l*100)}% of request context.`}),r}function CO({risk:e,contextWindow:t,diagnostics:n,duplicateGroups:r}){let s=new Set(n.map(c=>c.kind)).size;(e==="watch"||e==="danger")&&(s+=1),t.source==="unknown"&&(s+=1);const a=n.some(c=>c.severity==="danger");return{level:e==="danger"||a?"risk":s>0?"optimizable":"ok",opportunityCount:s,reclaimableTokens:_O(r)}}function jO({segments:e,inputTokens:t,parsed:n,model:r,providers:o=[]}){const s=e.reduce((j,E)=>j+E.size,0),a=r??rO(n),l=t??s,c=bx(n,QR),u=sO(a,n,o),d=c??0,f=u.tokens===null?null:l+d,h=u.tokens===null?null:u.tokens-l,p=u.tokens===null?null:u.tokens-l-d,y=u.tokens===null||f===null?null:iO(f/u.tokens),m=cO(e,s),x=m[0]??null,b=e.filter(j=>j.role!=="tools").length,v=wO(e),w=kO(v),C=SO(m,s,b);w!==null&&C.unshift(w);const S=aO(y);return{model:a,contextWindow:u,estimatedInputTokens:l,outputReserveTokens:c,windowUsedTokens:f,remainingInputTokens:h,remainingAfterReserveTokens:p,usagePercent:y,riskLevel:S,roleUsages:m,largestRole:x,diagnostics:C,duplicateGroups:v,health:CO({risk:S,contextWindow:u,diagnostics:C,duplicateGroups:v})}}const j6={watch:hx,danger:mx};function NO(e){if(e===null)return null;try{return JSON.parse(e)}catch{return null}}function EO(e){return{role:e.role,label:e.label,size:e.tokens,characters:e.tokens*4,text:"",path:`role:${e.role}`}}function TO(e,t){const n=NO(e.rawRequestBody);if(n===null)return null;const o=Vm(Mn(e)).anatomySegments(n);if(o===null)return null;const s=jO({segments:o,inputTokens:e.inputTokens??null,parsed:n,model:e.model,providers:t}),a=s.model??e.model??"Unknown model",l=s.roleUsages.map(EO);return{logId:e.id,model:a,timestamp:e.timestamp,contextWindow:s.contextWindow,estimatedInputTokens:s.estimatedInputTokens,windowUsedTokens:s.windowUsedTokens,usagePercent:s.usagePercent,riskLevel:s.riskLevel,health:s.health,diagnostics:s.diagnostics.map(c=>c.title),roleSegments:l,roleTotalTokens:l.reduce((c,u)=>c+u.size,0)}}function AO(e,t){return e.usagePercent!==null&&t.usagePercent!==null?e.usagePercent>t.usagePercent:e.usagePercent!==null&&t.usagePercent===null?!0:e.usagePercent===null&&t.usagePercent!==null?!1:e.estimatedInputTokens>t.estimatedInputTokens}function Bd(e){switch(e){case"danger":return 4;case"watch":return 3;case"unknown":return 2;case"ok":return 1}}function IO(e,t){const n=Bd(t.latest.riskLevel)-Bd(e.latest.riskLevel);if(n!==0)return n;const r=e.peak.usagePercent??-1,s=(t.peak.usagePercent??-1)-r;return s!==0?s:t.latest.logId-e.latest.logId}function zO(e,t){return e.usagePercent===null||t.usagePercent===null?null:(t.usagePercent-e.usagePercent)*100}function PO(e,t=[]){const n=[...e].sort((s,a)=>s.id-a.id),r=new Map;for(const s of n){const a=TO(s,t);if(a===null)continue;const l=r.get(a.model);if(l===void 0){r.set(a.model,{model:a.model,requestCount:1,first:a,latest:a,peak:a});continue}r.set(a.model,{model:l.model,requestCount:l.requestCount+1,first:l.first,latest:a,peak:AO(a,l.peak)?a:l.peak})}return{models:[...r.values()].map(s=>({model:s.model,requestCount:s.requestCount,first:s.first,latest:s.latest,peak:s.peak,trendPercent:zO(s.first,s.latest)})).sort(IO)}}function hn(e){return e.length<=30?e:`${e.slice(0,12)}...${e.slice(-12)}`}function RO(e){return e==="full"}function OO(e,t){const n=t>0;return{redacted:n,raw:n&&RO(e)}}function Ud(e){let t=0,n=0;for(const r of e)r.inputTokens!==null&&(t+=r.inputTokens),r.outputTokens!==null&&(n+=r.outputTokens);return{totalIn:t,totalOut:n}}function yx(e,t){const n=e[0],r=e[e.length-1];return n===void 0||r===void 0?null:rl(n.timestamp,r.timestamp,t)}function MO(e){for(const t of e)if(t.userAgent!==null&&t.userAgent!==void 0&&t.userAgent!=="")return t.userAgent;return null}function LO(e){return e.error!==null&&e.error!==void 0&&e.error.length>0?!0:e.responseStatus!==null&&e.responseStatus>=400}function DO(e){const t=new Set;for(const r of e)r.model!==null&&r.model.length>0&&t.add(r.model);const n=[...t].sort();return n.length===0?"Model unknown":n.length===1?n[0]??"Model unknown":`${n.length} models`}function FO({logs:e,isLoading:t,timeDisplayFormat:n,slowResponseThresholdSeconds:r}){let o=0,s=0,a=0,l=0;const c=r*1e3;for(const f of e)LO(f)&&(o+=1),r>0&&f.elapsedMs!==null&&f.elapsedMs>=c&&(s+=1),f.inputTokens!==null&&(a+=f.inputTokens),f.outputTokens!==null&&(l+=f.outputTokens);const u=t?"rolling":o>0?"failed":s>0?"watch":"clear";return{status:u,statusLabel:u==="rolling"?"Rolling":u==="failed"?"Failure":u==="watch"?"Watch":"Clear",modelLabel:DO(e),requests:e.length,failures:o,slow:s,timeRange:yx(e,n),tokenLabel:`${Ue(a)} in / ${Ue(l)} out`}}function $O(e){switch(e){case"rolling":return"border-cyan-400/35 bg-cyan-500/10 text-cyan-200";case"failed":return"border-red-400/35 bg-red-500/10 text-red-100";case"watch":return"border-amber-300/35 bg-amber-400/10 text-amber-100";case"clear":return"border-emerald-400/30 bg-emerald-500/10 text-emerald-100"}}function BO({stats:e}){return e.requests===0?null:i.jsx("div",{className:"mb-4 rounded-md border border-border bg-[#0c0d0f] shadow-[0_14px_50px_rgba(0,0,0,0.25)]",children:i.jsxs("div",{className:"grid grid-cols-2 gap-0 md:grid-cols-[minmax(220px,1.2fr)_repeat(4,minmax(120px,1fr))]",children:[i.jsxs("div",{className:"col-span-2 border-b border-border/70 px-4 py-3 md:col-span-1 md:border-b-0 md:border-r",children:[i.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-semibold uppercase text-muted-foreground",children:[i.jsx(H2,{className:"size-3.5 text-cyan-300"}),"Opening Slate"]}),i.jsx("div",{className:"mt-2 min-w-0 truncate font-mono text-sm font-semibold text-foreground",children:e.modelLabel}),i.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",children:e.timeRange??"Timeline pending"})]}),i.jsxs("div",{className:"border-r border-b border-border/70 px-4 py-3 md:border-b-0",children:[i.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Status"}),i.jsx("div",{className:xe("mt-2 inline-flex h-7 items-center rounded-md border px-2.5 font-mono text-xs font-semibold",$O(e.status)),children:e.statusLabel})]}),i.jsxs("div",{className:"border-b border-border/70 px-4 py-3 md:border-b-0 md:border-r",children:[i.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Requests"}),i.jsx("div",{className:"mt-2 font-mono text-xl font-semibold text-foreground",children:e.requests})]}),i.jsxs("div",{className:"border-r border-border/70 px-4 py-3 md:border-r",children:[i.jsxs("div",{className:"flex items-center gap-1 text-[10px] uppercase text-muted-foreground",children:[i.jsx(ek,{className:"size-3 text-red-300"}),"Failure"]}),i.jsx("div",{className:"mt-2 font-mono text-xl font-semibold text-red-100",children:e.failures})]}),i.jsxs("div",{className:"px-4 py-3",children:[i.jsxs("div",{className:"flex items-center gap-1 text-[10px] uppercase text-muted-foreground",children:[i.jsx(el,{className:"size-3 text-amber-200"}),"Tempo"]}),i.jsxs("div",{className:"mt-2 font-mono text-sm font-semibold text-foreground",children:[e.slow," slow"]}),i.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",children:e.tokenLabel})]})]})})}function UO({pinnedSessionId:e,selectedSession:t,sessions:n,logs:r}){if(e!==void 0){const a=r.filter(l=>l.sessionId===e);return a.length===0?null:{label:e,logs:a,showBackLink:!0}}if(t!=="__all__"){const a=r.filter(l=>l.sessionId===t);return a.length===0?null:{label:t,logs:a,showBackLink:!0}}const o=n.length===1?n[0]??null:null;return o!==null&&r.every(l=>l.sessionId===o)?{label:o,logs:[...r],showBackLink:!1}:n.length===0&&r.length>0&&r.every(a=>a.sessionId===null)?{label:"Visible requests",logs:[...r],showBackLink:!1}:null}function Br(e){if(e===null)return"Unknown";const t=e*100;return t>=10?`${t.toFixed(0)}%`:t>=1?`${t.toFixed(1)}%`:t>0?"<1%":"0%"}function HO(e){return e===null?"n/a":Math.abs(e)<.1?"0%":`${e>0?"+":""}${e.toFixed(1)}%`}function Aa(e){return e===null||!Number.isFinite(e)?0:Math.min(Math.max(e*100,0),100)}function WO(e,t){if(t===null)return null;const n=Aa(e),r=Aa(t);return r<=0||Math.abs(r-n)<.5?null:r}function VO(e){switch(e){case"danger":return"bg-red-400";case"watch":return"bg-amber-300";case"unknown":return"bg-muted-foreground/50";case"ok":return"bg-emerald-400"}}function ZO(e){const t=e.latest.contextWindow.tokens;return t===null?"Context window unknown":`Context window ${wp(t)}`}const qO=["score","decision","final_status","validation_pass_ratio","semantic_memory_score","opencode_exit","actual_model","run_dir","workspace","project_dir","work_dir"];function vx(e){return typeof e=="string"?e.length>0?e:null:typeof e=="number"||typeof e=="boolean"?String(e):e===null?null:JSON.stringify(e)}function Oi(e,t){if(e===null)return null;const n=e.metadata[t];return n===void 0?null:vx(n)}function KO(e){const t=e.toLowerCase();return t.includes("reject")||t.includes("fail")||t.includes("error")?"border-red-400/35 bg-red-500/10 text-red-100":t.includes("partial")||t.includes("pending")||t.includes("slow")?"border-amber-300/35 bg-amber-400/10 text-amber-100":t.includes("pass")||t.includes("complete")||t.includes("accept")?"border-emerald-400/30 bg-emerald-500/10 text-emerald-100":"border-border/70 bg-background/70 text-muted-foreground"}function GO(e){const t=[];for(const n of qO){const r=e.metadata[n];if(r===void 0)continue;const o=vx(r);o!==null&&t.push({key:n,value:o})}return t}function Hd({memberships:e,defaultOpen:t=!1}){const[n,r]=g.useState(t);if(e.length===0)return null;const o=e[0],s=o?.member??null,a=Oi(s,"score"),l=Oi(s,"decision"),c=Oi(s,"final_status"),u=[a===null?null:{label:`score ${a}`,value:a},l===null?null:{label:l,value:l},c===null?null:{label:c,value:c},s?.model===null||s?.model===void 0?null:{label:s.model,value:s.model}].filter(d=>d!==null&&d.label.length>0&&d.value.length>0);return i.jsxs("div",{className:"mb-3 overflow-hidden rounded-md border border-border bg-[#0c0d0f] text-xs",children:[i.jsxs("button",{type:"button",onClick:()=>r(d=>!d),className:"flex w-full items-center gap-3 px-3 py-2 text-left transition-colors hover:bg-muted/30","aria-expanded":n,children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[i.jsx("span",{className:"font-semibold text-foreground",children:"Case File"}),o!==void 0&&i.jsx("span",{className:"truncate text-muted-foreground",title:o.groupTitle,children:o.groupTitle}),i.jsxs("span",{className:"font-mono text-[10px] uppercase text-muted-foreground",children:[e.length," group",e.length===1?"":"s"]})]}),u.length>0&&i.jsx("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:u.slice(0,4).map(d=>i.jsx("span",{className:xe("rounded border px-1.5 py-0.5 font-mono text-[10px]",KO(d.value)),children:d.label},d.label))})]}),n?i.jsx(Ja,{className:"size-4 shrink-0 text-muted-foreground"}):i.jsx(wt,{className:"size-4 shrink-0 text-muted-foreground"})]}),n&&i.jsx("div",{className:"space-y-2 border-t border-border/70 px-3 py-2",children:e.map(d=>{const f=d.member,h=GO(f);return i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[i.jsx("span",{className:"truncate font-medium text-foreground",title:d.groupTitle,children:d.groupTitle}),i.jsx("span",{className:"font-mono text-[10px] uppercase text-muted-foreground",children:d.groupStatus}),f.status!==null&&i.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:["member ",f.status]})]}),i.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground",children:[i.jsx("span",{className:"font-mono",title:f.sessionId,children:hn(f.sessionId)}),f.label!==null&&i.jsx("span",{children:f.label}),f.provider!==null&&i.jsx("span",{children:f.provider}),f.model!==null&&i.jsx("span",{className:"font-mono",children:f.model}),f.runId!==null&&i.jsxs("span",{className:"font-mono",title:f.runId,children:["run ",hn(f.runId)]})]}),h.length>0&&i.jsx("div",{className:"mt-2 grid gap-1 sm:grid-cols-2 xl:grid-cols-3",children:h.map(p=>i.jsxs("div",{className:"min-w-0 rounded border border-border/60 px-2 py-1",children:[i.jsx("div",{className:"font-mono text-[10px] text-muted-foreground",children:p.key}),i.jsx("div",{className:"truncate font-mono text-[11px] text-foreground",title:p.value,children:p.value})]},p.key))})]},`${d.groupId}:${f.id}`)})})]})}function JO({logs:e,pagination:t}){if(t.isLoading&&e.length===0)return"Loading logs...";if(e.length===0)return"No logs on this page";const n=e[0],r=e[e.length-1],o=n===void 0||r===void 0?"Current page":`#${n.id}-#${r.id}`,s=t.total===null?"logs":`${t.total} logs`;return`Showing ${o} of ${s}`}function Po({label:e,title:t,icon:n,disabled:r,onClick:o}){return i.jsxs("button",{type:"button",onClick:o,disabled:r,className:"inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-45",title:t,children:[n,i.jsx("span",{children:e})]})}function Wd({logs:e,pagination:t,embedded:n=!1}){if(t===void 0)return null;const r=t.isLoading;return i.jsxs("div",{className:xe("flex min-h-9 flex-col gap-2 px-1 py-1 sm:flex-row sm:items-center",n?"border-t border-border/70 pt-2":"mb-3 rounded-md border border-border bg-muted/10 px-2"),children:[i.jsxs("div",{className:"w-full min-w-0 px-1 font-mono text-[11px] text-muted-foreground sm:flex-1",children:[JO({logs:e,pagination:t}),t.isLoading&&e.length>0&&i.jsx("span",{className:"ml-2",children:"Loading..."})]}),i.jsxs("div",{className:"flex w-full items-center gap-1 overflow-x-auto sm:w-auto",children:[i.jsx(Po,{label:"Oldest",title:"Load the oldest logs in this session",icon:i.jsx(A2,{className:"size-3.5"}),disabled:r||!t.hasOlder,onClick:t.onOldest}),i.jsx(Po,{label:"Older",title:"Load older logs",icon:i.jsx(C2,{className:"size-3.5"}),disabled:r||!t.hasOlder,onClick:t.onOlder}),i.jsx(Po,{label:"Newer",title:"Load newer logs",icon:i.jsx(Kt,{className:"size-3.5"}),disabled:r||!t.hasNewer,onClick:t.onNewer}),i.jsx(Po,{label:"Newest",title:"Load the newest logs in this session",icon:i.jsx(z2,{className:"size-3.5"}),disabled:r||!t.hasNewer,onClick:t.onNewest})]})]})}function YO(e){return`${e} ${e===1?"request":"requests"}`}function Vd(e){return`#${String(e)}`}function Zd(e){switch(e){case"danger":return"text-red-300";case"watch":return"text-amber-200";case"unknown":return"text-muted-foreground";case"ok":return"text-emerald-300"}}function XO(e){switch(e){case"risk":return"border-red-400/30 bg-red-500/10 text-red-100";case"optimizable":return"border-amber-400/25 bg-amber-400/8 text-amber-100";case"ok":return"border-emerald-400/25 bg-emerald-400/8 text-emerald-100"}}function QO(e){switch(e){case"risk":return"Risk";case"optimizable":return"Optimizable";case"ok":return"OK"}}const e6=10,t6=80;function n6(e){e.setAttribute("data-deep-link-highlight","true"),window.setTimeout(()=>{e.removeAttribute("data-deep-link-highlight")},1800)}function r6(e){const t=document.getElementById(`log-${String(e)}`);return t instanceof HTMLElement?(t.scrollIntoView({block:"center",behavior:"smooth"}),t.focus({preventScroll:!0}),n6(t),!0):!1}function wx(e){ka({logId:e,tab:"anatomy"});let t=0;const n=()=>{ka({logId:e,tab:"anatomy"}),!r6(e)&&(t+=1,t<e6&&window.setTimeout(n,t6))};window.setTimeout(n,0)}function qd({command:e}){const[t,n]=g.useState(!1),r=g.useCallback(()=>{Ot(e).then(o=>{o&&(n(!0),setTimeout(()=>n(!1),2e3))})},[e]);return i.jsxs("div",{className:"inline-flex items-center gap-2 bg-muted rounded-md px-3 py-2",children:[i.jsx("pre",{className:"text-blue-500 font-mono text-sm m-0",children:e}),i.jsx("button",{type:"button",onClick:r,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 cursor-pointer","aria-label":"Copy command",children:t?i.jsx(et,{className:"size-4"}):i.jsx(kt,{className:"size-4"})})]})}function Kd(){return i.jsx(nt,{children:i.jsxs(Fe,{children:[i.jsx($e,{asChild:!0,children:i.jsxs("span",{className:"inline-flex h-7 items-center gap-2 rounded-md border border-cyan-400/30 bg-cyan-500/10 px-2.5 font-mono text-[11px] font-medium text-cyan-300 shadow-[0_0_16px_rgba(34,211,238,0.08)]",children:[i.jsx("span",{className:"size-1.5 rounded-full bg-emerald-300 shadow-[0_0_8px_rgba(110,231,183,0.8)]"}),"MCP Ready",i.jsx("span",{className:"hidden text-cyan-200/70 sm:inline",children:"/api/mcp"})]})}),i.jsx(Be,{sideOffset:8,className:"max-w-[320px] text-left leading-relaxed",children:"Coding agents can inspect logs, replay requests, test providers, and debug sessions through MCP at /api/mcp."})]})})}const o6=["text-amber-500","text-rose-500","text-sky-500","text-emerald-500","text-violet-500","text-orange-500","text-cyan-500","text-pink-500","text-lime-500","text-blue-500","text-yellow-500","text-fuchsia-500"];function Gd({compact:e,entrancePhase:t}){return e?i.jsx(pd,{className:"size-7 text-amber-500"}):i.jsxs("span",{className:"flex shrink-0 items-end gap-1 group cursor-default","aria-hidden":"true",children:[i.jsx(pd,{className:"size-10 text-amber-500 transition-all duration-300 group-hover:scale-125 group-hover:-translate-y-1.5"}),i.jsx("span",{className:"hidden items-end gap-0.5 sm:flex",children:Kr.map((n,r)=>{const o=o6[r]??"text-amber-500",s=t==="hidden"?"opacity-0 scale-0":t==="playing"?"animate-crab-piano-pop":"";return i.jsx(n,{className:`size-5 ${o} transition-all duration-300 ease-out group-hover:scale-125 group-hover:-translate-y-1 ${s}`,style:{transitionDelay:`${r*50}ms`,...t==="playing"?{animationDelay:`${r*400}ms`}:{}}},r)})})]})}function s6({compact:e,crabEntrancePhase:t}){return e?i.jsxs("div",{className:"pb-3",children:[i.jsxs("div",{className:"flex items-start justify-between gap-3",children:[i.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[i.jsx(Gd,{compact:!0,entrancePhase:t}),i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[i.jsx("span",{className:"truncate text-base font-bold",children:"Inspector"}),i.jsxs("span",{className:"hidden shrink-0 font-mono text-[11px] font-semibold text-muted-foreground sm:inline",children:["v",Oc.version]})]}),i.jsx("div",{className:"hidden text-[11px] font-semibold text-muted-foreground sm:block",children:"Local First. Evidence First."})]})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[i.jsx(hd,{}),i.jsx(Id,{})]})]}),i.jsx("div",{className:"mt-2 hidden sm:block",children:i.jsx(Kd,{})})]}):i.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] items-start gap-3 pb-6",children:[i.jsx("div",{}),i.jsxs("h1",{className:"flex min-w-0 flex-col items-center gap-2 text-center",children:[i.jsxs("span",{className:"flex max-w-[calc(100vw-7rem)] items-end gap-2 whitespace-nowrap",children:[i.jsx(Gd,{compact:!1,entrancePhase:t}),i.jsxs("span",{className:"flex min-w-0 items-baseline gap-2 pl-1",children:[i.jsx("span",{className:"truncate text-lg font-bold",children:"Agent Inspector"}),i.jsxs("span",{className:"shrink-0 font-mono text-xs font-semibold text-muted-foreground",children:["v",Oc.version]})]}),i.jsx(Hi,{className:"size-4 shrink-0 text-muted-foreground/70","aria-hidden":"true"}),i.jsx(fP,{className:"size-10 shrink-0"})]}),i.jsx("span",{className:"max-w-[calc(100vw-7rem)] text-sm font-semibold text-muted-foreground",children:"Local First. Evidence First."}),i.jsx(Kd,{})]}),i.jsxs("div",{className:"justify-self-end flex items-center gap-1",children:[i.jsx(hd,{}),i.jsx(Id,{})]})]})}function Jd({label:e,logId:t}){return i.jsxs("button",{type:"button",onClick:()=>wx(t),className:"inline-flex h-5 items-center rounded px-1 font-mono text-[10px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:`Open Context for ${Vd(t)}`,children:[e," ",Vd(t)]})}function i6({latestPercent:e,peakPercent:t,risk:n,onOpenContext:r}){const o=Aa(e),s=WO(e,t),a=t===null?`Latest context window usage ${Br(e)}`:`Latest context window usage ${Br(e)}, peak ${Br(t)}`;return i.jsx("button",{type:"button",onClick:r,className:"group block w-full rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1","aria-label":`${a}. Open latest Context details`,title:"Open latest Context details",children:i.jsxs("span",{className:"relative block h-2.5 overflow-hidden rounded-full border border-border/70 bg-background transition-colors group-hover:border-foreground/30",role:"meter","aria-label":a,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(o),children:[i.jsx("span",{className:xe("block h-full rounded-full transition-[width]",VO(n)),style:{width:`${o}%`}}),s!==null&&i.jsx("span",{className:"absolute top-0 h-full w-0.5 rounded-full bg-amber-100/75 shadow-[0_0_0_1px_rgba(0,0,0,0.25)]",style:{left:`calc(${s}% - 0.5px)`},"aria-hidden":"true"})]})})}function a6({summary:e}){const t=e.trendPercent,n=t===null||Math.abs(t)<.1?null:t>0?g2:u2,r=e.latest.diagnostics[0]??null,o=Br(e.latest.usagePercent),s=Br(e.peak.usagePercent),a=()=>{wx(e.latest.logId)};return i.jsxs("div",{className:"grid gap-x-4 gap-y-2 border-t border-border/60 py-2 first:border-t-0 lg:grid-cols-[minmax(180px,1fr)_minmax(260px,1fr)_minmax(260px,1.4fr)]",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("button",{type:"button",onClick:a,className:"min-w-0 truncate rounded-sm text-left font-mono font-semibold text-foreground transition-colors hover:text-cyan-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",title:`Open latest Context for ${e.model}`,children:e.model}),i.jsx("span",{className:xe("inline-flex h-5 shrink-0 items-center rounded border px-1.5 font-mono text-[10px]",XO(e.latest.health.level)),children:QO(e.latest.health.level)})]}),i.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground",children:[i.jsx("span",{children:YO(e.requestCount)}),i.jsx("span",{children:ZO(e)})]})]}),i.jsxs("div",{className:"min-w-0 space-y-2 text-xs",children:[i.jsx(i6,{latestPercent:e.latest.usagePercent,peakPercent:e.peak.usagePercent,risk:e.latest.riskLevel,onOpenContext:a}),i.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Latest"}),i.jsx("div",{className:xe("mt-0.5 font-mono",Zd(e.latest.riskLevel)),children:o}),i.jsx(Jd,{label:"Log",logId:e.latest.logId})]}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Peak"}),i.jsx("div",{className:xe("mt-0.5 font-mono",Zd(e.peak.riskLevel)),children:s}),i.jsx(Jd,{label:"Log",logId:e.peak.logId})]}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Trend"}),i.jsxs("div",{className:"mt-0.5 flex items-center gap-1 font-mono text-foreground",children:[n!==null&&i.jsx(n,{className:xe("size-3",t!==null&&t>0?"text-amber-300":"text-emerald-300")}),HO(t)]}),i.jsx("div",{className:"h-5","aria-hidden":"true"})]})]})]}),i.jsxs("div",{className:"min-w-0 space-y-1.5",children:[i.jsx(HR,{segments:e.latest.roleSegments,totalTokens:e.latest.roleTotalTokens,showLabels:!1}),i.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground",children:[i.jsxs("span",{className:"font-mono",children:["~",Ue(e.latest.estimatedInputTokens)," input"]}),e.latest.windowUsedTokens!==null&&i.jsxs("span",{className:"font-mono",children:["~",Ue(e.latest.windowUsedTokens)," used"]}),r!==null&&i.jsx("span",{className:"truncate",children:r})]})]})]})}function l6({summary:e}){return e.models.length===0?null:i.jsxs("div",{className:"mt-3 border-t border-border/70 pt-2",children:[i.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[i.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-normal text-muted-foreground",children:"Session Context"}),i.jsxs("div",{className:"font-mono text-[10px] text-muted-foreground",children:[e.models.length," model",e.models.length===1?"":"s"]})]}),i.jsx("div",{className:"max-h-52 overflow-y-auto pr-1",children:e.models.map(t=>i.jsx(a6,{summary:t},t.model))})]})}function c6(e){const t=e.models.filter(r=>r.latest.health.level==="risk").length;if(t>0)return`${t} risk`;const n=e.models.filter(r=>r.latest.health.level==="optimizable").length;return n>0?`${n} optimizable`:`${e.models.length} model${e.models.length===1?"":"s"}`}function u6({label:e,logs:t,totalIn:n,totalOut:r,timeDisplayFormat:o,contextSummary:s,showBackLink:a}){const[l,c]=g.useState(!1),[u,d]=g.useState(!1),f=g.useMemo(()=>yx(t,o),[t,o]),h=g.useMemo(()=>MO(t),[t]),p=g.useMemo(()=>c6(s),[s]),y=g.useCallback(()=>{Ot(window.location.href).then(m=>{m&&(c(!0),setTimeout(()=>c(!1),2e3))})},[]);return i.jsxs("div",{className:"mb-3 rounded-md border border-border bg-muted/15 px-3 py-2 text-xs",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a&&i.jsx("a",{href:"/",className:"inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":"Back to all sessions",title:"Back to all sessions",children:i.jsx(h2,{className:"size-3.5"})}),i.jsxs("div",{className:"min-w-[180px] flex-1",children:[i.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[i.jsx("span",{className:"font-mono font-semibold text-purple-400/90 truncate",title:e,children:hn(e)}),h!==null&&i.jsx("span",{className:"font-mono text-muted-foreground truncate max-w-[220px]",title:h,children:h})]}),i.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground",children:[i.jsxs("span",{children:[t.length," request",t.length!==1?"s":""]}),f!==null&&i.jsx("span",{children:f}),(n>0||r>0)&&i.jsxs("span",{className:"font-mono",children:[Ue(n)," in / ",Ue(r)," out"]})]})]}),s.models.length>0&&i.jsxs("button",{type:"button",onClick:()=>d(m=>!m),className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-border bg-background/60 px-2.5 font-mono text-[11px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-expanded":u,title:u?"Hide context details":"Show context details",children:[i.jsx("span",{children:p}),u?i.jsx(Ja,{className:"size-3.5"}):i.jsx(wt,{className:"size-3.5"})]}),i.jsx("button",{type:"button",onClick:y,className:"inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":l?"Copied session link":"Copy session link",title:l?"Copied session link":"Copy session link",children:l?i.jsx(et,{className:"size-3.5"}):i.jsx(kt,{className:"size-3.5"})})]}),u&&i.jsx(l6,{summary:s})]})}function d6({logs:e,sessions:t,models:n,selectedSession:r,selectedModel:o,onSessionChange:s,onModelChange:a,onClearAll:l,onClearGroup:c,viewMode:u,captureMode:d,strip:f,slowResponseThresholdSeconds:h,timeDisplayFormat:p,isLoading:y=!1,pagination:m,sessionMemberships:x=[],hideSessionFilter:b=!1,pinnedSessionId:v}){const{totalIn:w,totalOut:C}=g.useMemo(()=>Ud(e),[e]),{providers:S}=kp(),[j,E]=g.useState(null),[N,z]=g.useState(null),[M,B]=g.useState(null),[T,D]=g.useState("hidden"),k=g.useRef(null),L=g.useRef(null);LR(k,L,{pageWide:!0}),g.useEffect(()=>{const _=50+Kr.length*400,ee=setTimeout(()=>D("playing"),50),Q=setTimeout(()=>D("done"),_);return()=>{clearTimeout(ee),clearTimeout(Q)}},[]),g.useEffect(()=>{if(v===void 0){document.title="Agent Inspector";return}const fe=e.length===1?"1 req":`${e.length} req`;document.title=`${hn(v)} - ${fe} - Agent Inspector`},[e.length,v]);const W=g.useCallback(async fe=>{E(fe),z(null);try{const Se=await Ik(e,fe);Se.ok||z(Se.message)}finally{E(null)}},[e]);g.useEffect(()=>{B(null)},[r,o]);const U=g.useCallback(()=>{B(null)},[]),$=g.useMemo(()=>sE(e),[e]),G=g.useMemo(()=>UO({pinnedSessionId:v,selectedSession:r,sessions:t,logs:e}),[e,v,r,t]),A=G?.logs??[],K=G!==null&&A.length>0,{totalIn:q,totalOut:P}=g.useMemo(()=>Ud(A),[A]),ie=g.useMemo(()=>PO(A,S),[A,S]),le=g.useMemo(()=>jR($),[$]),ge=g.useMemo(()=>Rz($),[$]),ne=OO(d,e.length),ue=v!==void 0,de=K&&G!==null?hn(G.label):r==="__all__"?"All sessions":hn(r),he=g.useMemo(()=>FO({logs:e,isLoading:y,timeDisplayFormat:p,slowResponseThresholdSeconds:h}),[y,e,h,p]),me=g.useCallback(fe=>{const Se=ge.get(fe.id);Se!==void 0&&B([Se,fe])},[ge]);return i.jsxs("div",{className:"min-h-screen w-full bg-[#070809] text-foreground",children:[i.jsxs("div",{className:"grid min-h-screen w-full grid-cols-1 lg:grid-cols-[340px_minmax(0,1fr)] xl:grid-cols-[360px_minmax(0,1fr)]",children:[i.jsx("aside",{className:"border-b border-border bg-[#090a0c] lg:sticky lg:top-0 lg:h-screen lg:overflow-y-auto lg:border-b-0 lg:border-r",children:i.jsxs("div",{className:"space-y-4 p-4",children:[i.jsx(s6,{compact:!0,crabEntrancePhase:T}),i.jsxs("div",{className:"grid grid-cols-3 gap-2 border-y border-border/70 py-3",children:[i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"font-mono text-lg font-semibold text-foreground",children:e.length}),i.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Requests"})]}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"font-mono text-lg font-semibold text-foreground",children:Ue(K?q:w)}),i.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Input"})]}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("div",{className:"font-mono text-lg font-semibold text-foreground",children:Ue(K?P:C)}),i.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Output"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-normal text-muted-foreground",children:"Workspace"}),i.jsxs("div",{className:"rounded-md border border-border bg-[#0c0d0f] px-3 py-2",children:[i.jsx("div",{className:"font-mono text-xs font-semibold text-purple-300",title:de,children:de}),i.jsx("div",{className:"mt-1 text-[11px] text-muted-foreground",children:ue?"Session workspace":"Live workspace"})]})]}),K&&G!==null&&i.jsx(u6,{label:G.label,logs:A,totalIn:q,totalOut:P,timeDisplayFormat:p,contextSummary:ie,showBackLink:G.showBackLink}),K&&v!==void 0&&x.length>0&&i.jsx(Hd,{memberships:x}),i.jsxs("div",{className:"space-y-2",children:[i.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-normal text-muted-foreground",children:"Filters"}),!b&&i.jsxs(ls,{value:r,onValueChange:s,children:[i.jsx(us,{className:"h-9 w-full text-xs",children:i.jsx(cs,{placeholder:"All sessions"})}),i.jsxs(ds,{children:[i.jsx(Ft,{value:"__all__",children:"All sessions"}),t.map(fe=>i.jsx(Ft,{value:fe,children:hn(fe)},fe))]})]}),i.jsxs(ls,{value:o,onValueChange:a,children:[i.jsx(us,{className:"h-9 w-full text-xs",children:i.jsx(cs,{placeholder:"All models"})}),i.jsxs(ds,{children:[i.jsx(Ft,{value:"__all__",children:"All models"}),n.map(fe=>i.jsx(Ft,{value:fe,children:fe},fe))]})]})]})]})}),i.jsxs("main",{className:"min-w-0",children:[i.jsxs("div",{className:"sticky top-0 z-30 border-b border-border bg-[#08090b]/95 px-4 py-3 shadow-[0_12px_40px_rgba(0,0,0,0.24)] backdrop-blur lg:px-5",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsxs("div",{className:"min-w-[180px] flex-1",children:[i.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Logs"}),i.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-muted-foreground",children:de})]}),ne.redacted&&i.jsx("button",{type:"button",onClick:()=>{W("redacted")},disabled:j!==null,className:"inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",title:"Export redacted logs as JSON ZIP",children:j==="redacted"?i.jsx("span",{children:"Exporting..."}):i.jsxs(i.Fragment,{children:[i.jsx(ws,{className:"size-3.5"}),i.jsx("span",{children:"Export"})]})}),ne.raw&&i.jsx("button",{type:"button",onClick:()=>{W("raw")},disabled:j!==null,className:"inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",title:"Export raw logs without redaction",children:j==="raw"?i.jsx("span",{children:"Exporting..."}):i.jsxs(i.Fragment,{children:[i.jsx(sw,{className:"size-3.5"}),i.jsx("span",{children:"Raw"})]})}),i.jsxs("button",{type:"button",onClick:l,className:"inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:"Clear all logs",children:[i.jsx(ur,{className:"size-3.5"}),i.jsx("span",{children:"Clear"})]})]}),i.jsx(Wd,{logs:e,pagination:m,embedded:!0}),N!==null&&i.jsx("div",{className:"mt-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:N})]}),i.jsxs("div",{className:"px-4 py-4 lg:px-5",children:[i.jsx(BO,{stats:he}),e.length===0?r!=="__all__"?i.jsx("div",{className:"py-16 text-center text-muted-foreground",children:i.jsxs("div",{className:"mx-auto max-w-xl space-y-4 rounded-md border border-border bg-muted/10 px-4 py-8",children:[i.jsx("p",{className:"text-sm font-medium",children:y?"Loading session data...":"Session not found"}),i.jsx("p",{className:"inline-block max-w-full rounded bg-muted px-3 py-1 font-mono text-xs break-all",children:hn(r)}),x.length>0&&i.jsx("div",{className:"text-left",children:i.jsx(Hd,{memberships:x})}),!y&&i.jsxs("p",{className:"text-xs",children:["This session may have been cleared or never existed."," ",b?i.jsx("a",{href:"/",className:"underline transition-colors hover:text-foreground",children:"Back to all sessions"}):i.jsx("button",{type:"button",onClick:()=>s("__all__"),className:"underline transition-colors hover:text-foreground",children:"Show all sessions"})]})]})}):i.jsx("div",{className:"py-16 text-center text-muted-foreground",children:i.jsxs("div",{className:"mx-auto max-w-2xl space-y-4 rounded-md border border-border bg-muted/10 px-4 py-8",children:[i.jsx("p",{className:"text-sm",children:"No requests captured yet."}),i.jsxs("div",{className:"flex flex-col items-center gap-2",children:[i.jsx(qd,{command:"ANTHROPIC_BASE_URL=http://localhost:25947/proxy <your-tool>"}),i.jsx(qd,{command:"OPENAI_BASE_URL=http://localhost:25947/proxy <your-tool>"})]}),i.jsx("p",{className:"mx-auto max-w-xl text-xs leading-relaxed text-muted-foreground",children:"Container note: if your AI tool runs in a different container or host than Agent Inspector, replace localhost with an address reachable from that tool and verify the network/firewall path."})]})}):i.jsxs("div",{ref:L,tabIndex:0,className:"flex flex-col gap-2 focus:outline-none",children:[i.jsx("div",{ref:k,children:i.jsx(IR,{groups:$,viewMode:u,strip:f,slowResponseThresholdSeconds:h,cacheTrends:le,onCompareWithPrevious:me,comparisonPredecessors:ge,onClearGroup:c,standalone:$.length===1,hasPinnedSessionContext:K,timeDisplayFormat:p})}),i.jsx("div",{className:"mt-3",children:i.jsx(Wd,{logs:e,pagination:m})})]})]})]})]}),M!==null&&i.jsx(g.Suspense,{fallback:null,children:i.jsx(UE,{left:M[0],right:M[1],onClose:U})})]})}const f6=sn([re({type:Ne("init"),logs:ye(Ho)}),re({type:Ne("update"),log:Ho})]),p6=re({logs:ye(Ho),total:se().int().nonnegative(),limit:se().int().positive(),hasOlder:He(),hasNewer:He(),oldestLogId:se().int().positive().nullable(),newestLogId:se().int().positive().nullable()});function h6(e,t){const n=[];for(const r of e)for(const o of r.members)o.sessionId===t&&n.push({groupId:r.id,groupTitle:r.title,groupKind:r.kind,groupStatus:r.status,groupTask:r.task,groupProject:r.project,groupEvidence:r.evidence,member:o});return n}function m6(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function g6(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function x6(e,t,n){return t==="__all__"&&n==="__all__"?e:e.filter(r=>!(t!=="__all__"&&r.sessionId!==t||n!=="__all__"&&r.model!==n))}const b6=50,y6=12,v6=1800,Yd=500,kx=100;function w6(e){const t=new URLSearchParams;e!==void 0&&(t.set("sessionId",e),t.set("compact","1"));const n=t.toString();return n.length>0?`/api/logs/stream?${n}`:"/api/logs/stream"}function k6(e,t){const n=new URLSearchParams({cursor:"1",compact:"1",limit:String(kx),sessionId:e});switch(t.kind){case"oldest":n.set("anchor","oldest");break;case"older":n.set("beforeLogId",String(t.beforeLogId));break;case"newer":n.set("afterLogId",String(t.afterLogId));break}return`/api/logs?${n.toString()}`}function Ro(e){const t=new Map;for(let n=0;n<e.length;n++){const r=e[n];r!==void 0&&t.set(r.id,n)}return t}function Xd(e){return e.length<=Yd?e:e.slice(e.length-Yd)}function N6({initialSessionId:e}={}){const[t,n]=g.useState([]),[r,o]=g.useState(e??"__all__"),[s,a]=g.useState("__all__"),[l,c]=g.useState(null),[u,d]=g.useState(e===void 0),[f,h]=g.useState(null),[p,y]=g.useState(e!==void 0),[m,x]=g.useState([]),b=g.useRef(null),v=g.useRef(null),w=g.useRef(null),C=g.useRef(0),S=g.useRef(new Map),j=g.useRef([]),E=g.useRef(null),N=g.useMemo(()=>x6(t,r,s),[t,r,s]),z=g.useMemo(()=>m6(t),[t]),M=g.useMemo(()=>g6(t),[t]),B=g.useCallback(()=>{E.current=null;const ne=j.current;j.current=[],ne.length!==0&&n(ue=>{let de=ue;for(const he of ne){const me=S.current.get(he.id);me!==void 0?de=[...de.slice(0,me),he,...de.slice(me+1)]:(S.current.set(he.id,de.length),de=[...de,he])}return de=Xd(de),S.current=Ro(de),de})},[]),T=g.useCallback(ne=>{j.current.push(ne),E.current===null&&(E.current=setTimeout(B,b6))},[B]),D=g.useCallback(()=>{b.current&&b.current.close(),d(!1);const ne=new EventSource(w6(e));b.current=ne,ne.onmessage=ue=>{try{const de=String(ue.data),he=JSON.parse(de),me=f6.safeParse(he);if(!me.success){c("Failed to parse SSE data");return}const fe=me.data;if(fe.type==="init"){E.current!==null&&(clearTimeout(E.current),E.current=null),j.current=[];const Se=Xd(fe.logs);S.current=Ro(Se),n(Se),d(!0),c(null)}else fe.type==="update"&&T(fe.log)}catch{c("Failed to parse SSE data")}},ne.onerror=()=>{c("SSE connection lost, reconnecting..."),d(!0),ne.close(),v.current!==null&&clearTimeout(v.current),v.current=setTimeout(D,3e3)}},[e,T]),k=g.useCallback(ne=>{if(e===void 0)return;const ue=C.current+1;C.current=ue,y(!0),c(null),an(k6(e,ne),p6).then(de=>{if(C.current!==ue)return;const he=de.logs;S.current=Ro(he),n(he),h(de),o(e),y(!1),c(null)}).catch(de=>{C.current===ue&&(n([]),h(null),y(!1),c(de instanceof Error?de.message:"Failed to load session logs"))})},[e]);g.useEffect(()=>{if(e===void 0){x([]);return}let ne=!1;return fetch("/api/groups").then(async ue=>{if(!ue.ok)return null;const de=await ue.json(),he=Xf.safeParse(de);return he.success?he.data.groups:null}).then(ue=>{ne||ue===null||x(h6(ue,e))}).catch(()=>{ne||x([])}),()=>{ne=!0}},[e]),g.useEffect(()=>{e!==void 0&&k({kind:"newest"})},[e,k]),g.useEffect(()=>{if(e===void 0)return D(),()=>{b.current&&(b.current.close(),b.current=null),v.current!==null&&(clearTimeout(v.current),v.current=null),E.current!==null&&(clearTimeout(E.current),E.current=null)}},[D,e]),g.useEffect(()=>{const ne=window.location.hash;if(!ne.startsWith("#log-")||w.current===ne)return;const ue=ne.slice(1),de=Number(ue.replace(/^log-/,""));Number.isInteger(de)&&de>0&&ka({logId:de,tab:"request"});let he=!1,me=0,fe=null,Se=null;const _=()=>{if(he)return;const ee=document.getElementById(ue);if(ee!==null){w.current=ne,ee.scrollIntoView({block:"center",behavior:"smooth"}),ee instanceof HTMLElement&&(fe=ee,ee.setAttribute("data-deep-link-highlight","true"),Se=window.setTimeout(()=>{ee.removeAttribute("data-deep-link-highlight")},v6),ee.focus({preventScroll:!0}),ee.getAttribute("data-nav-action")==="expand"&&ee.click());return}me+=1,me<y6&&window.setTimeout(_,100)};return _(),()=>{he=!0,Se!==null&&window.clearTimeout(Se),fe!==null&&fe.removeAttribute("data-deep-link-highlight")}},[N.length]);const L=g.useCallback(()=>{e!==void 0&&t.length===0||(async()=>{try{const ne=e===void 0?void 0:JSON.stringify({ids:t.map(de=>de.id)});if(!(await fetch("/api/logs",{method:"DELETE",...ne===void 0?{}:{headers:{"Content-Type":"application/json"},body:ne}})).ok){c("Failed to clear logs");return}S.current.clear(),n([]),c(null)}catch(ne){c(ne instanceof Error?ne.message:"Unknown error clearing logs")}})()},[t,e]),W=g.useCallback(ne=>{ne.length!==0&&(async()=>{try{if(!(await fetch("/api/logs",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:ne})})).ok){c("Failed to clear group");return}const de=new Set(ne);n(he=>{const me=he.filter(fe=>!de.has(fe.id));return S.current=Ro(me),me}),c(null)}catch(ue){c(ue instanceof Error?ue.message:"Unknown error clearing group")}})()},[]),{strip:U,captureMode:$,slowResponseThresholdSeconds:G,timeDisplayFormat:A}=Ga(),K=$,q=g.useCallback(()=>{k({kind:"oldest"})},[k]),P=g.useCallback(()=>{k({kind:"newest"})},[k]),ie=g.useCallback(()=>{const ne=t[0],ue=f?.oldestLogId??ne?.id??null;ue!==null&&k({kind:"older",beforeLogId:ue})},[t,k,f]),le=g.useCallback(()=>{const ne=t[t.length-1],ue=f?.newestLogId??ne?.id??null;ue!==null&&k({kind:"newer",afterLogId:ue})},[t,k,f]),ge=g.useMemo(()=>{if(e!==void 0)return{isLoading:p,total:f?.total??null,pageSize:f?.limit??kx,hasOlder:f?.hasOlder??!1,hasNewer:f?.hasNewer??!1,oldestLogId:f?.oldestLogId??null,newestLogId:f?.newestLogId??null,onOldest:q,onOlder:ie,onNewer:le,onNewest:P}},[e,P,le,ie,q,f,p]);return i.jsxs(i.Fragment,{children:[l!==null&&i.jsx("div",{className:"fixed top-4 right-4 bg-destructive text-destructive-foreground px-4 py-2 rounded-md text-sm z-50",children:l}),i.jsx(bk,{}),i.jsx(d6,{logs:N,sessions:z,models:M,selectedSession:r,selectedModel:s,onSessionChange:o,onModelChange:a,onClearAll:L,onClearGroup:W,isLoading:e===void 0?!u:p,pagination:ge,sessionMemberships:m,viewMode:K,captureMode:$,strip:U,slowResponseThresholdSeconds:G,timeDisplayFormat:A,hideSessionFilter:e!==void 0,pinnedSessionId:e})]})}export{tp as $,se as A,ot as B,J2 as C,Us as D,ye as E,ka as F,He as G,I as H,Ho as I,nz as J,jO as K,ww as L,Ew as M,FR as N,DR as O,N6 as P,wp as Q,Bw as R,HR as S,Xm as T,j6 as U,wt as V,Ae as W,nl as X,sd as Y,I3 as Z,C6 as _,oE as a,z3 as a0,rz as a1,tl as a2,Zl as a3,ss as a4,Vr as a5,tr as a6,C_ as a7,Vt as a8,xe as b,be as c,Hi as d,sp as e,Ue as f,Vm as g,Kt as h,et as i,kt as j,Ot as k,Hs as l,Ws as m,Vs as n,Dw as o,Qm as p,_t as q,Mn as r,St as s,Ie as t,kp as u,nt as v,Fe as w,$e as x,Be as y,re as z};
|