@tonyclaw/agent-inspector 3.0.16 → 3.0.17
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-BJmxAiM0.js → CompareDrawer-Lx-WeJNC.js} +1 -1
- package/.output/public/assets/{ProxyViewerContainer-C40Nig73.js → ProxyViewerContainer-BNehwMI0.js} +31 -31
- package/.output/public/assets/{ReplayDialog-CkLdOMJr.js → ReplayDialog-CADaXFPE.js} +1 -1
- package/.output/public/assets/{RequestAnatomy-DemOFfSc.js → RequestAnatomy-CGoL8ACh.js} +1 -1
- package/.output/public/assets/{ResponseView-9LhpuDo7.js → ResponseView-BSwM1dCH.js} +2 -2
- package/.output/public/assets/{StreamingChunkSequence-RRWYBOdz.js → StreamingChunkSequence-qhWtSx3D.js} +1 -1
- package/.output/public/assets/{_sessionId-CWEh2Jsn.js → _sessionId-2uq_HB8p.js} +1 -1
- package/.output/public/assets/index-BHXN1Fsx.css +1 -0
- package/.output/public/assets/{index-Lwir70Rs.js → index-DPc2wzgW.js} +1 -1
- package/.output/public/assets/{index-hjNWJZGE.js → index-T0u1foYL.js} +1 -1
- package/.output/public/assets/{json-viewer-D8gvbDlB.js → json-viewer-uIwLntt-.js} +1 -1
- package/.output/public/assets/{main-ovrz0tyD.js → main-DuFBHsus.js} +2 -2
- package/.output/server/_libs/@opentelemetry/semantic-conventions+[...].mjs +2658 -0
- package/.output/server/_libs/agent-base.mjs +234 -0
- package/.output/server/_libs/anthropic-ai__sdk.mjs +6042 -0
- package/.output/server/_libs/atomically.mjs +3 -0
- package/.output/server/_libs/base64-js.mjs +102 -0
- package/.output/server/_libs/bignumber.js.mjs +1353 -0
- package/.output/server/_libs/buffer-equal-constant-time.mjs +38 -0
- package/.output/server/_libs/data-uri-to-buffer.mjs +39 -0
- package/.output/server/_libs/debug.mjs +547 -0
- package/.output/server/_libs/ecdsa-sig-formatter.mjs +162 -0
- package/.output/server/_libs/extend.mjs +2 -1
- package/.output/server/_libs/fetch-blob.mjs +287 -0
- package/.output/server/_libs/formdata-polyfill.mjs +88 -0
- package/.output/server/_libs/gaxios.mjs +927 -0
- package/.output/server/_libs/gcp-metadata.mjs +322 -0
- package/.output/server/_libs/google-auth-library.mjs +6339 -0
- package/.output/server/_libs/google-logging-utils.mjs +385 -0
- package/.output/server/_libs/google__genai.mjs +18034 -0
- package/.output/server/_libs/has-flag.mjs +16 -0
- package/.output/server/_libs/https-proxy-agent.mjs +280 -0
- package/.output/server/_libs/json-bigint.mjs +413 -0
- package/.output/server/_libs/jwa.mjs +233 -0
- package/.output/server/_libs/jws.mjs +298 -0
- package/.output/server/_libs/lucide-react.mjs +261 -226
- package/.output/server/_libs/mariozechner__pi-agent-core.mjs +824 -0
- package/.output/server/_libs/mariozechner__pi-ai.mjs +22889 -0
- package/.output/server/_libs/mistralai__mistralai.mjs +32045 -0
- package/.output/server/_libs/ms.mjs +120 -0
- package/.output/server/_libs/node-domexception.mjs +17 -0
- package/.output/server/_libs/node-fetch.mjs +1578 -0
- package/.output/server/_libs/ohash.mjs +1 -1
- package/.output/server/_libs/openai.mjs +6766 -0
- package/.output/server/_libs/opentelemetry__api.mjs +1678 -0
- package/.output/server/_libs/p-retry.mjs +87 -0
- package/.output/server/_libs/partial-json.mjs +244 -0
- package/.output/server/_libs/react-dom.mjs +5 -5
- package/.output/server/_libs/react-markdown.mjs +2 -2
- package/.output/server/_libs/react.mjs +30 -0
- package/.output/server/_libs/readable-stream.mjs +5 -5
- package/.output/server/_libs/retry.mjs +236 -0
- package/.output/server/_libs/safe-buffer.mjs +63 -1
- package/.output/server/_libs/srvx.mjs +2 -2
- package/.output/server/_libs/supports-color.mjs +108 -0
- package/.output/server/_libs/tanstack__router-core.mjs +1 -1
- package/.output/server/_libs/typebox.mjs +6596 -0
- package/.output/server/_libs/util-deprecate.mjs +2 -2
- package/.output/server/_libs/vfile.mjs +2 -2
- package/.output/server/_libs/web-streams-polyfill.mjs +4282 -0
- package/.output/server/_libs/ws.mjs +3715 -0
- package/.output/server/_libs/zod-to-json-schema.mjs +1207 -0
- package/.output/server/_libs/zod.mjs +597 -9
- package/.output/server/{_sessionId-zI_GFX_7.mjs → _sessionId-DL2JQJwR.mjs} +14 -13
- package/.output/server/_ssr/{CompareDrawer-Ckcx1RVu.mjs → CompareDrawer-hPTOTmyU.mjs} +14 -13
- package/.output/server/_ssr/{ProxyViewerContainer-BgXewlIr.mjs → ProxyViewerContainer-k0mFaufl.mjs} +153 -87
- package/.output/server/_ssr/{ReplayDialog-wx3nDtZn.mjs → ReplayDialog-t6QdwnZh.mjs} +15 -14
- package/.output/server/_ssr/{RequestAnatomy-DN80zt0G.mjs → RequestAnatomy-BnvWxyac.mjs} +14 -13
- package/.output/server/_ssr/{ResponseView-DD7rTu_l.mjs → ResponseView-BhhozRRl.mjs} +14 -13
- package/.output/server/_ssr/{StreamingChunkSequence-DAgz6Vvw.mjs → StreamingChunkSequence-Dl_laTbX.mjs} +14 -13
- package/.output/server/_ssr/{index-dcTjp8du.mjs → index-D1-t1D8F.mjs} +13 -12
- package/.output/server/_ssr/index.mjs +4 -4
- package/.output/server/_ssr/{json-viewer-N2cuzGWR.mjs → json-viewer-D5Lh2yBU.mjs} +14 -13
- package/.output/server/_ssr/{router-BfQ0QsD5.mjs → router-DaLFEeWW.mjs} +523 -97
- package/.output/server/_tanstack-start-manifest_v-DsSiD2gY.mjs +4 -0
- package/.output/server/index.mjs +76 -76
- package/package.json +4 -1
- package/src/components/ProxyViewer.tsx +3 -0
- package/src/components/pi-agent/PiAgentPanel.tsx +204 -0
- package/src/lib/piAgentContract.ts +21 -0
- package/src/routes/api/pi-agent.ts +29 -0
- package/src/services/piAgent.ts +390 -0
- package/.output/public/assets/index-HRfrFVYw.css +0 -1
- package/.output/server/_tanstack-start-manifest_v-BXnYrbcJ.mjs +0 -4
package/.output/public/assets/{ProxyViewerContainer-C40Nig73.js → ProxyViewerContainer-BNehwMI0.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CompareDrawer-
|
|
2
|
-
import{u as qt,a as Dd,r as p,j as r,c as vr,g as ig,b as $d,d as cr,e as ag,f as ht,h as Fd,_ as Vn}from"./main-ovrz0tyD.js";function te(e,t,n){function s(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 i extends o{}Object.defineProperty(i,"name",{value:e});function a(l){var c;const u=n?.Parent?new i:this;s(u,l),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(a,"init",{value:s}),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 hs extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Bd extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Ud={};function bn(e){return Ud}function Wd(e){const t=Object.values(e).filter(s=>typeof s=="number");return Object.entries(e).filter(([s,o])=>t.indexOf(+s)===-1).map(([s,o])=>o)}function oa(e,t){return typeof t=="bigint"?t.toString():t}function Bo(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function tl(e){return e==null}function nl(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function lg(e,t){const n=(e.toString().split(".")[1]||"").length,s=t.toString();let o=(s.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(s)){const c=s.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}const i=n>o?n:o,a=Number.parseInt(e.toFixed(i).replace(".","")),l=Number.parseInt(t.toFixed(i).replace(".",""));return a%l/10**i}const vc=Symbol("evaluating");function Pe(e,t,n){let s;Object.defineProperty(e,t,{get(){if(s!==vc)return s===void 0&&(s=vc,s=n()),s},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function qn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Sn(...e){const t={};for(const n of e){const s=Object.getOwnPropertyDescriptors(n);Object.assign(t,s)}return Object.defineProperties({},t)}function yc(e){return JSON.stringify(e)}function cg(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Hd="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Xs(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const ug=Bo(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function ys(e){if(Xs(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Xs(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Vd(e){return ys(e)?{...e}:Array.isArray(e)?[...e]:e}const dg=new Set(["string","number","symbol"]);function ws(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Cn(e,t,n){const s=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(s._zod.parent=e),s}function je(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 fg(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const pg={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 hg(e,t){const n=e._zod.def,s=n.checks;if(s&&s.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=Sn(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 qn(this,"shape",a),a},checks:[]});return Cn(e,i)}function mg(e,t){const n=e._zod.def,s=n.checks;if(s&&s.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=Sn(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 qn(this,"shape",a),a},checks:[]});return Cn(e,i)}function gg(e,t){if(!ys(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Sn(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return qn(this,"shape",i),i}});return Cn(e,o)}function xg(e,t){if(!ys(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Sn(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return qn(this,"shape",s),s}});return Cn(e,n)}function bg(e,t){const n=Sn(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t._zod.def.shape};return qn(this,"shape",s),s},get catchall(){return t._zod.def.catchall},checks:[]});return Cn(e,n)}function vg(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=Sn(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 qn(this,"shape",c),c},checks:[]});return Cn(t,a)}function yg(e,t,n){const s=Sn(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(n)for(const a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return qn(this,"shape",i),i}});return Cn(t,s)}function ds(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 fs(e,t){return t.map(n=>{var s;return(s=n).path??(s.path=[]),n.path.unshift(e),n})}function yr(e){return typeof e=="string"?e:e?.message}function vn(e,t,n){const s={...e,path:e.path??[]};if(!e.message){const o=yr(e.inst?._zod.def?.error?.(e))??yr(t?.error?.(e))??yr(n.customError?.(e))??yr(n.localeError?.(e))??"Invalid input";s.message=o}return delete s.inst,delete s.continue,t?.reportInput||delete s.input,s}function sl(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Qs(...e){const[t,n,s]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:s}:{...t}}const qd=(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,oa,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Zd=te("$ZodError",qd),Gd=te("$ZodError",qd,{Parent:Error});function wg(e,t=n=>n.message){const n={},s=[];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))):s.push(t(o));return{formErrors:s,fieldErrors:n}}function _g(e,t=n=>n.message){const n={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>s({issues:a}));else if(i.code==="invalid_key")s({issues:i.issues});else if(i.code==="invalid_element")s({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let a=n,l=0;for(;l<i.path.length;){const c=i.path[l];l===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(i))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return s(e),n}const rl=e=>(t,n,s,o)=>{const i=s?Object.assign(s,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new hs;if(a.issues.length){const l=new(o?.Err??e)(a.issues.map(c=>vn(c,i,bn())));throw Hd(l,o?.callee),l}return a.value},ol=e=>async(t,n,s,o)=>{const i=s?Object.assign(s,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){const l=new(o?.Err??e)(a.issues.map(c=>vn(c,i,bn())));throw Hd(l,o?.callee),l}return a.value},Uo=e=>(t,n,s)=>{const o=s?{...s,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new hs;return i.issues.length?{success:!1,error:new(e??Zd)(i.issues.map(a=>vn(a,o,bn())))}:{success:!0,data:i.value}},kg=Uo(Gd),Wo=e=>async(t,n,s)=>{const o=s?Object.assign(s,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>vn(a,o,bn())))}:{success:!0,data:i.value}},jg=Wo(Gd),Sg=e=>(t,n,s)=>{const o=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return rl(e)(t,n,o)},Cg=e=>(t,n,s)=>rl(e)(t,n,s),Ng=e=>async(t,n,s)=>{const o=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return ol(e)(t,n,o)},Tg=e=>async(t,n,s)=>ol(e)(t,n,s),Eg=e=>(t,n,s)=>{const o=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return Uo(e)(t,n,o)},Ag=e=>(t,n,s)=>Uo(e)(t,n,s),Rg=e=>async(t,n,s)=>{const o=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return Wo(e)(t,n,o)},Ig=e=>async(t,n,s)=>Wo(e)(t,n,s),zg=/^[cC][^\s-]{8,}$/,Og=/^[0-9a-z]+$/,Pg=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Mg=/^[0-9a-vA-V]{20}$/,Lg=/^[A-Za-z0-9]{27}$/,Dg=/^[a-zA-Z0-9_-]{21}$/,$g=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Fg=/^([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})$/,wc=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)$/,Bg=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ug="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Wg(){return new RegExp(Ug,"u")}const Hg=/^(?:(?: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])$/,Vg=/^(([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}|:))$/,qg=/^((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])$/,Zg=/^(([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])$/,Gg=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Kd=/^[A-Za-z0-9_-]*$/,Kg=/^\+[1-9]\d{6,14}$/,Jd="(?:(?:\\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])))",Jg=new RegExp(`^${Jd}$`);function Yd(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 Yg(e){return new RegExp(`^${Yd(e)}$`)}function Xg(e){const t=Yd({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const s=`${t}(?:${n.join("|")})`;return new RegExp(`^${Jd}T(?:${s})$`)}const Qg=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},ex=/^-?\d+$/,Xd=/^-?\d+(?:\.\d+)?$/,tx=/^(?:true|false)$/i,nx=/^null$/i,sx=/^[^A-Z]*$/,rx=/^[^a-z]*$/,mt=te("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Qd={number:"number",bigint:"bigint",object:"date"},ef=te("$ZodCheckLessThan",(e,t)=>{mt.init(e,t);const n=Qd[typeof t.value];e._zod.onattach.push(s=>{const o=s._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value<=t.value:s.value<t.value)||s.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),tf=te("$ZodCheckGreaterThan",(e,t)=>{mt.init(e,t);const n=Qd[typeof t.value];e._zod.onattach.push(s=>{const o=s._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value>=t.value:s.value>t.value)||s.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ox=te("$ZodCheckMultipleOf",(e,t)=>{mt.init(e,t),e._zod.onattach.push(n=>{var s;(s=n._zod.bag).multipleOf??(s.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):lg(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})}}),ix=te("$ZodCheckNumberFormat",(e,t)=>{mt.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),s=n?"int":"number",[o,i]=pg[t.format];e._zod.onattach.push(a=>{const l=a._zod.bag;l.format=t.format,l.minimum=o,l.maximum=i,n&&(l.pattern=ex)}),e._zod.check=a=>{const l=a.value;if(n){if(!Number.isInteger(l)){a.issues.push({expected:s,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:s,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:s,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>i&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),ax=te("$ZodCheckMaxLength",(e,t)=>{var n;mt.init(e,t),(n=e._zod.def).when??(n.when=s=>{const o=s.value;return!tl(o)&&o.length!==void 0}),e._zod.onattach.push(s=>{const o=s._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(s._zod.bag.maximum=t.maximum)}),e._zod.check=s=>{const o=s.value;if(o.length<=t.maximum)return;const a=sl(o);s.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),lx=te("$ZodCheckMinLength",(e,t)=>{var n;mt.init(e,t),(n=e._zod.def).when??(n.when=s=>{const o=s.value;return!tl(o)&&o.length!==void 0}),e._zod.onattach.push(s=>{const o=s._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(s._zod.bag.minimum=t.minimum)}),e._zod.check=s=>{const o=s.value;if(o.length>=t.minimum)return;const a=sl(o);s.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),cx=te("$ZodCheckLengthEquals",(e,t)=>{var n;mt.init(e,t),(n=e._zod.def).when??(n.when=s=>{const o=s.value;return!tl(o)&&o.length!==void 0}),e._zod.onattach.push(s=>{const o=s._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=s=>{const o=s.value,i=o.length;if(i===t.length)return;const a=sl(o),l=i>t.length;s.issues.push({origin:a,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:s.value,inst:e,continue:!t.abort})}}),Ho=te("$ZodCheckStringFormat",(e,t)=>{var n,s;mt.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.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})}):(s=e._zod).check??(s.check=()=>{})}),ux=te("$ZodCheckRegex",(e,t)=>{Ho.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})}}),dx=te("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=sx),Ho.init(e,t)}),fx=te("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=rx),Ho.init(e,t)}),px=te("$ZodCheckIncludes",(e,t)=>{mt.init(e,t);const n=ws(t.includes),s=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=s,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(s)}),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})}}),hx=te("$ZodCheckStartsWith",(e,t)=>{mt.init(e,t);const n=new RegExp(`^${ws(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=s=>{s.value.startsWith(t.prefix)||s.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:s.value,inst:e,continue:!t.abort})}}),mx=te("$ZodCheckEndsWith",(e,t)=>{mt.init(e,t);const n=new RegExp(`.*${ws(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=s=>{s.value.endsWith(t.suffix)||s.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:s.value,inst:e,continue:!t.abort})}}),gx=te("$ZodCheckOverwrite",(e,t)=>{mt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class xx{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 s=t.split(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CompareDrawer-Lx-WeJNC.js","assets/main-DuFBHsus.js","assets/ReplayDialog-CADaXFPE.js","assets/ResponseView-BSwM1dCH.js","assets/RequestAnatomy-CGoL8ACh.js","assets/StreamingChunkSequence-qhWtSx3D.js","assets/json-viewer-uIwLntt-.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as qt,a as Fd,r as p,j as r,c as kr,g as ig,b as Bd,d as pr,e as ag,f as mt,h as Ud,_ as Vn}from"./main-DuFBHsus.js";function te(e,t,n){function s(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 i extends o{}Object.defineProperty(i,"name",{value:e});function a(l){var c;const u=n?.Parent?new i:this;s(u,l),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(a,"init",{value:s}),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 hs extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Wd extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Hd={};function bn(e){return Hd}function Vd(e){const t=Object.values(e).filter(s=>typeof s=="number");return Object.entries(e).filter(([s,o])=>t.indexOf(+s)===-1).map(([s,o])=>o)}function oa(e,t){return typeof t=="bigint"?t.toString():t}function Bo(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function tl(e){return e==null}function nl(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function lg(e,t){const n=(e.toString().split(".")[1]||"").length,s=t.toString();let o=(s.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(s)){const c=s.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}const i=n>o?n:o,a=Number.parseInt(e.toFixed(i).replace(".","")),l=Number.parseInt(t.toFixed(i).replace(".",""));return a%l/10**i}const wc=Symbol("evaluating");function Oe(e,t,n){let s;Object.defineProperty(e,t,{get(){if(s!==wc)return s===void 0&&(s=wc,s=n()),s},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function qn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Sn(...e){const t={};for(const n of e){const s=Object.getOwnPropertyDescriptors(n);Object.assign(t,s)}return Object.defineProperties({},t)}function _c(e){return JSON.stringify(e)}function cg(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const qd="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function nr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const ug=Bo(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function ys(e){if(nr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(nr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Zd(e){return ys(e)?{...e}:Array.isArray(e)?[...e]:e}const dg=new Set(["string","number","symbol"]);function ws(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Cn(e,t,n){const s=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(s._zod.parent=e),s}function je(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 fg(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const pg={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 hg(e,t){const n=e._zod.def,s=n.checks;if(s&&s.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=Sn(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 qn(this,"shape",a),a},checks:[]});return Cn(e,i)}function mg(e,t){const n=e._zod.def,s=n.checks;if(s&&s.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=Sn(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 qn(this,"shape",a),a},checks:[]});return Cn(e,i)}function gg(e,t){if(!ys(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Sn(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return qn(this,"shape",i),i}});return Cn(e,o)}function xg(e,t){if(!ys(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Sn(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return qn(this,"shape",s),s}});return Cn(e,n)}function bg(e,t){const n=Sn(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t._zod.def.shape};return qn(this,"shape",s),s},get catchall(){return t._zod.def.catchall},checks:[]});return Cn(e,n)}function vg(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=Sn(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 qn(this,"shape",c),c},checks:[]});return Cn(t,a)}function yg(e,t,n){const s=Sn(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(n)for(const a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return qn(this,"shape",i),i}});return Cn(t,s)}function ds(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 fs(e,t){return t.map(n=>{var s;return(s=n).path??(s.path=[]),n.path.unshift(e),n})}function jr(e){return typeof e=="string"?e:e?.message}function vn(e,t,n){const s={...e,path:e.path??[]};if(!e.message){const o=jr(e.inst?._zod.def?.error?.(e))??jr(t?.error?.(e))??jr(n.customError?.(e))??jr(n.localeError?.(e))??"Invalid input";s.message=o}return delete s.inst,delete s.continue,t?.reportInput||delete s.input,s}function sl(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function sr(...e){const[t,n,s]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:s}:{...t}}const Gd=(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,oa,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Kd=te("$ZodError",Gd),Jd=te("$ZodError",Gd,{Parent:Error});function wg(e,t=n=>n.message){const n={},s=[];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))):s.push(t(o));return{formErrors:s,fieldErrors:n}}function _g(e,t=n=>n.message){const n={_errors:[]},s=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>s({issues:a}));else if(i.code==="invalid_key")s({issues:i.issues});else if(i.code==="invalid_element")s({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let a=n,l=0;for(;l<i.path.length;){const c=i.path[l];l===i.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(i))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return s(e),n}const rl=e=>(t,n,s,o)=>{const i=s?Object.assign(s,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new hs;if(a.issues.length){const l=new(o?.Err??e)(a.issues.map(c=>vn(c,i,bn())));throw qd(l,o?.callee),l}return a.value},ol=e=>async(t,n,s,o)=>{const i=s?Object.assign(s,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){const l=new(o?.Err??e)(a.issues.map(c=>vn(c,i,bn())));throw qd(l,o?.callee),l}return a.value},Uo=e=>(t,n,s)=>{const o=s?{...s,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new hs;return i.issues.length?{success:!1,error:new(e??Kd)(i.issues.map(a=>vn(a,o,bn())))}:{success:!0,data:i.value}},kg=Uo(Jd),Wo=e=>async(t,n,s)=>{const o=s?Object.assign(s,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>vn(a,o,bn())))}:{success:!0,data:i.value}},jg=Wo(Jd),Sg=e=>(t,n,s)=>{const o=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return rl(e)(t,n,o)},Cg=e=>(t,n,s)=>rl(e)(t,n,s),Ng=e=>async(t,n,s)=>{const o=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return ol(e)(t,n,o)},Tg=e=>async(t,n,s)=>ol(e)(t,n,s),Eg=e=>(t,n,s)=>{const o=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return Uo(e)(t,n,o)},Ag=e=>(t,n,s)=>Uo(e)(t,n,s),Rg=e=>async(t,n,s)=>{const o=s?Object.assign(s,{direction:"backward"}):{direction:"backward"};return Wo(e)(t,n,o)},Ig=e=>async(t,n,s)=>Wo(e)(t,n,s),zg=/^[cC][^\s-]{8,}$/,Pg=/^[0-9a-z]+$/,Og=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Mg=/^[0-9a-vA-V]{20}$/,Lg=/^[A-Za-z0-9]{27}$/,Dg=/^[a-zA-Z0-9_-]{21}$/,$g=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Fg=/^([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})$/,kc=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)$/,Bg=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ug="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Wg(){return new RegExp(Ug,"u")}const Hg=/^(?:(?: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])$/,Vg=/^(([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}|:))$/,qg=/^((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])$/,Zg=/^(([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])$/,Gg=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Yd=/^[A-Za-z0-9_-]*$/,Kg=/^\+[1-9]\d{6,14}$/,Xd="(?:(?:\\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])))",Jg=new RegExp(`^${Xd}$`);function Qd(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 Yg(e){return new RegExp(`^${Qd(e)}$`)}function Xg(e){const t=Qd({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const s=`${t}(?:${n.join("|")})`;return new RegExp(`^${Xd}T(?:${s})$`)}const Qg=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},ex=/^-?\d+$/,ef=/^-?\d+(?:\.\d+)?$/,tx=/^(?:true|false)$/i,nx=/^null$/i,sx=/^[^A-Z]*$/,rx=/^[^a-z]*$/,gt=te("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),tf={number:"number",bigint:"bigint",object:"date"},nf=te("$ZodCheckLessThan",(e,t)=>{gt.init(e,t);const n=tf[typeof t.value];e._zod.onattach.push(s=>{const o=s._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value<=t.value:s.value<t.value)||s.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),sf=te("$ZodCheckGreaterThan",(e,t)=>{gt.init(e,t);const n=tf[typeof t.value];e._zod.onattach.push(s=>{const o=s._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value>=t.value:s.value>t.value)||s.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ox=te("$ZodCheckMultipleOf",(e,t)=>{gt.init(e,t),e._zod.onattach.push(n=>{var s;(s=n._zod.bag).multipleOf??(s.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):lg(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})}}),ix=te("$ZodCheckNumberFormat",(e,t)=>{gt.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),s=n?"int":"number",[o,i]=pg[t.format];e._zod.onattach.push(a=>{const l=a._zod.bag;l.format=t.format,l.minimum=o,l.maximum=i,n&&(l.pattern=ex)}),e._zod.check=a=>{const l=a.value;if(n){if(!Number.isInteger(l)){a.issues.push({expected:s,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:s,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:s,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>i&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),ax=te("$ZodCheckMaxLength",(e,t)=>{var n;gt.init(e,t),(n=e._zod.def).when??(n.when=s=>{const o=s.value;return!tl(o)&&o.length!==void 0}),e._zod.onattach.push(s=>{const o=s._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(s._zod.bag.maximum=t.maximum)}),e._zod.check=s=>{const o=s.value;if(o.length<=t.maximum)return;const a=sl(o);s.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),lx=te("$ZodCheckMinLength",(e,t)=>{var n;gt.init(e,t),(n=e._zod.def).when??(n.when=s=>{const o=s.value;return!tl(o)&&o.length!==void 0}),e._zod.onattach.push(s=>{const o=s._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(s._zod.bag.minimum=t.minimum)}),e._zod.check=s=>{const o=s.value;if(o.length>=t.minimum)return;const a=sl(o);s.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),cx=te("$ZodCheckLengthEquals",(e,t)=>{var n;gt.init(e,t),(n=e._zod.def).when??(n.when=s=>{const o=s.value;return!tl(o)&&o.length!==void 0}),e._zod.onattach.push(s=>{const o=s._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=s=>{const o=s.value,i=o.length;if(i===t.length)return;const a=sl(o),l=i>t.length;s.issues.push({origin:a,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:s.value,inst:e,continue:!t.abort})}}),Ho=te("$ZodCheckStringFormat",(e,t)=>{var n,s;gt.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.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})}):(s=e._zod).check??(s.check=()=>{})}),ux=te("$ZodCheckRegex",(e,t)=>{Ho.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})}}),dx=te("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=sx),Ho.init(e,t)}),fx=te("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=rx),Ho.init(e,t)}),px=te("$ZodCheckIncludes",(e,t)=>{gt.init(e,t);const n=ws(t.includes),s=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=s,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(s)}),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})}}),hx=te("$ZodCheckStartsWith",(e,t)=>{gt.init(e,t);const n=new RegExp(`^${ws(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=s=>{s.value.startsWith(t.prefix)||s.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:s.value,inst:e,continue:!t.abort})}}),mx=te("$ZodCheckEndsWith",(e,t)=>{gt.init(e,t);const n=new RegExp(`.*${ws(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=s=>{s.value.endsWith(t.suffix)||s.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:s.value,inst:e,continue:!t.abort})}}),gx=te("$ZodCheckOverwrite",(e,t)=>{gt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class xx{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 s=t.split(`
|
|
3
3
|
`).filter(a=>a),o=Math.min(...s.map(a=>a.length-a.trimStart().length)),i=s.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(const a of i)this.content.push(a)}compile(){const t=Function,n=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...n,o.join(`
|
|
4
|
-
`))}}const bx={major:4,minor:3,patch:6},We=te("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=bx;const s=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&s.unshift(e);for(const o of s)for(const i of o._zod.onattach)i(e);if(s.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=ds(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,m=f._zod.check(a);if(m instanceof Promise&&c?.async===!1)throw new hs;if(d||m instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await m,a.issues.length!==h&&(u||(u=ds(a,h)))});else{if(a.issues.length===h)continue;u||(u=ds(a,h))}}return d?d.then(()=>a):a},i=(a,l,c)=>{if(ds(a))return a.aborted=!0,a;const u=o(l,s,c);if(u instanceof Promise){if(c.async===!1)throw new hs;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=>i(d,a,l)):i(u,a,l)}const c=e._zod.parse(a,l);if(c instanceof Promise){if(l.async===!1)throw new hs;return c.then(u=>o(u,s,l))}return o(c,s,l)}}
|
|
4
|
+
`))}}const bx={major:4,minor:3,patch:6},We=te("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=bx;const s=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&s.unshift(e);for(const o of s)for(const i of o._zod.onattach)i(e);if(s.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=ds(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,m=f._zod.check(a);if(m instanceof Promise&&c?.async===!1)throw new hs;if(d||m instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await m,a.issues.length!==h&&(u||(u=ds(a,h)))});else{if(a.issues.length===h)continue;u||(u=ds(a,h))}}return d?d.then(()=>a):a},i=(a,l,c)=>{if(ds(a))return a.aborted=!0,a;const u=o(l,s,c);if(u instanceof Promise){if(c.async===!1)throw new hs;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=>i(d,a,l)):i(u,a,l)}const c=e._zod.parse(a,l);if(c instanceof Promise){if(l.async===!1)throw new hs;return c.then(u=>o(u,s,l))}return o(c,s,l)}}Oe(e,"~standard",()=>({validate:o=>{try{const i=kg(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return jg(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),il=te("$ZodString",(e,t)=>{We.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Qg(e._zod.bag),e._zod.parse=(n,s)=>{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}}),Ve=te("$ZodStringFormat",(e,t)=>{Ho.init(e,t),il.init(e,t)}),vx=te("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Fg),Ve.init(e,t)}),yx=te("$ZodUUID",(e,t)=>{if(t.version){const s={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(s===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=kc(s))}else t.pattern??(t.pattern=kc());Ve.init(e,t)}),wx=te("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Bg),Ve.init(e,t)}),_x=te("$ZodURL",(e,t)=>{Ve.init(e,t),e._zod.check=n=>{try{const s=n.value.trim(),o=new URL(s);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=s;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),kx=te("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Wg()),Ve.init(e,t)}),jx=te("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Dg),Ve.init(e,t)}),Sx=te("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=zg),Ve.init(e,t)}),Cx=te("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Pg),Ve.init(e,t)}),Nx=te("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Og),Ve.init(e,t)}),Tx=te("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Mg),Ve.init(e,t)}),Ex=te("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Lg),Ve.init(e,t)}),Ax=te("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Xg(t)),Ve.init(e,t)}),Rx=te("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Jg),Ve.init(e,t)}),Ix=te("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Yg(t)),Ve.init(e,t)}),zx=te("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=$g),Ve.init(e,t)}),Px=te("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Hg),Ve.init(e,t),e._zod.bag.format="ipv4"}),Ox=te("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Vg),Ve.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})}}}),Mx=te("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=qg),Ve.init(e,t)}),Lx=te("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Zg),Ve.init(e,t),e._zod.check=n=>{const s=n.value.split("/");try{if(s.length!==2)throw new Error;const[o,i]=s;if(!i)throw new Error;const a=Number(i);if(`${a}`!==i)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 rf(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Dx=te("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Gg),Ve.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{rf(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function $x(e){if(!Yd.test(e))return!1;const t=e.replace(/[-_]/g,s=>s==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return rf(n)}const Fx=te("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Yd),Ve.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{$x(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Bx=te("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Kg),Ve.init(e,t)});function Ux(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[s]=n;if(!s)return!1;const o=JSON.parse(atob(s));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const Wx=te("$ZodJWT",(e,t)=>{Ve.init(e,t),e._zod.check=n=>{Ux(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),of=te("$ZodNumber",(e,t)=>{We.init(e,t),e._zod.pattern=e._zod.bag.pattern??ef,e._zod.parse=(n,s)=>{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 i=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,...i?{received:i}:{}}),n}}),Hx=te("$ZodNumberFormat",(e,t)=>{ix.init(e,t),of.init(e,t)}),Vx=te("$ZodBoolean",(e,t)=>{We.init(e,t),e._zod.pattern=tx,e._zod.parse=(n,s)=>{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}}),qx=te("$ZodNull",(e,t)=>{We.init(e,t),e._zod.pattern=nx,e._zod.values=new Set([null]),e._zod.parse=(n,s)=>{const o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),Zx=te("$ZodUnknown",(e,t)=>{We.init(e,t),e._zod.parse=n=>n}),Gx=te("$ZodNever",(e,t)=>{We.init(e,t),e._zod.parse=(n,s)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function jc(e,t,n){e.issues.length&&t.issues.push(...fs(n,e.issues)),t.value[n]=e.value}const Kx=te("$ZodArray",(e,t)=>{We.init(e,t),e._zod.parse=(n,s)=>{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 i=[];for(let a=0;a<o.length;a++){const l=o[a],c=t.element._zod.run({value:l,issues:[]},s);c instanceof Promise?i.push(c.then(u=>jc(u,n,a))):jc(c,n,a)}return i.length?Promise.all(i).then(()=>n):n}});function co(e,t,n,s,o){if(e.issues.length){if(o&&!(n in s))return;t.issues.push(...fs(n,e.issues))}e.value===void 0?n in s&&(t.value[n]=void 0):t.value[n]=e.value}function af(e){const t=Object.keys(e.shape);for(const s of t)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${s}": expected a Zod schema`);const n=fg(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function lf(e,t,n,s,o,i){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:[]},s);h instanceof Promise?e.push(h.then(m=>co(m,n,f,t,d))):co(h,n,f,t,d)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const Jx=te("$ZodObject",(e,t)=>{if(We.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 s=Bo(()=>af(t));Oe(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=nr,i=t.catchall;let a;e._zod.parse=(l,c)=>{a??(a=s.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 m=f[h],v=m._zod.optout==="optional",g=m._zod.run({value:u[h],issues:[]},c);g instanceof Promise?d.push(g.then(x=>co(x,l,h,u,v))):co(g,l,h,u,v)}return i?lf(d,u,l,c,s.value,e):d.length?Promise.all(d).then(()=>l):l}}),Yx=te("$ZodObjectJIT",(e,t)=>{Jx.init(e,t);const n=e._zod.parse,s=Bo(()=>af(t)),o=h=>{const m=new xx(["shape","payload","ctx"]),v=s.value,g=k=>{const j=_c(k);return`shape[${j}]._zod.run({ value: input[${j}], issues: [] }, ctx)`};m.write("const input = payload.value;");const x=Object.create(null);let b=0;for(const k of v.keys)x[k]=`key_${b++}`;m.write("const newResult = {};");for(const k of v.keys){const j=x[k],C=_c(k),N=h[k]?._zod?.optout==="optional";m.write(`const ${j} = ${g(k)};`),N?m.write(`
|
|
5
5
|
if (${j}.issues.length) {
|
|
6
6
|
if (${C} in input) {
|
|
7
7
|
payload.issues = payload.issues.concat(${j}.issues.map(iss => ({
|
|
@@ -35,11 +35,11 @@ import{u as qt,a as Dd,r as p,j as r,c as vr,g as ig,b as $d,d as cr,e as ag,f a
|
|
|
35
35
|
newResult[${C}] = ${j}.value;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
`)}m.write("payload.value = newResult;"),m.write("return payload;");const y=m.compile();return(k,j)=>y(h,k,j)};let i;const a=Xs,l=!Ud.jitless,u=l&&ug.value,d=t.catchall;let f;e._zod.parse=(h,m)=>{f??(f=s.value);const v=h.value;return a(v)?l&&u&&m?.async===!1&&m.jitless!==!0?(i||(i=o(t.shape)),h=i(h,m),d?of([],v,h,m,f,e):h):n(h,m):(h.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),h)}});function kc(e,t,n,s){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!ds(i));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(i=>i.issues.map(a=>vn(a,s,bn())))}),t)}const af=te("$ZodUnion",(e,t)=>{We.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(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>nl(i.source)).join("|")})$`)}});const n=t.options.length===1,s=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return s(o,i);let a=!1;const l=[];for(const c of t.options){const u=c._zod.run({value:o.value,issues:[]},i);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=>kc(c,o,e,i)):kc(l,o,e,i)}}),Xx=te("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,af.init(e,t);const n=e._zod.parse;Pe(e._zod,"propValues",()=>{const o={};for(const i of t.options){const a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);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 s=Bo(()=>{const o=t.options,i=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(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});e._zod.parse=(o,i)=>{const a=o.value;if(!Xs(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const l=s.value.get(a?.[t.discriminator]);return l?l._zod.run(o,i):t.unionFallback?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),Qx=te("$ZodIntersection",(e,t)=>{We.init(e,t),e._zod.parse=(n,s)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},s),a=t.right._zod.run({value:o,issues:[]},s);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>jc(n,c,u)):jc(n,i,a)}});function ia(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(ys(e)&&ys(t)){const n=Object.keys(t),s=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};for(const i of s){const a=ia(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=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 s=0;s<e.length;s++){const o=e[s],i=t[s],a=ia(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function jc(e,t,n){const s=new Map;let o;for(const l of t.issues)if(l.code==="unrecognized_keys"){o??(o=l);for(const c of l.keys)s.has(c)||s.set(c,{}),s.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)s.has(c)||s.set(c,{}),s.get(c).r=!0;else e.issues.push(l);const i=[...s].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(i.length&&o&&e.issues.push({...o,keys:i}),ds(e))return e;const a=ia(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 e1=te("$ZodRecord",(e,t)=>{We.init(e,t),e._zod.parse=(n,s)=>{const o=n.value;if(!ys(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],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:[]},s);d instanceof Promise?i.push(d.then(f=>{f.issues.length&&n.issues.push(...fs(u,f.issues)),n.value[u]=f.value})):(d.issues.length&&n.issues.push(...fs(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:[]},s);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&Xd.test(l)&&c.issues.length){const f=t.keyType._zod.run({value:Number(l),issues:[]},s);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=>vn(f,s,bn())),input:l,path:[l],inst:e});continue}const d=t.valueType._zod.run({value:o[l],issues:[]},s);d instanceof Promise?i.push(d.then(f=>{f.issues.length&&n.issues.push(...fs(l,f.issues)),n.value[c.value]=f.value})):(d.issues.length&&n.issues.push(...fs(l,d.issues)),n.value[c.value]=d.value)}}return i.length?Promise.all(i).then(()=>n):n}}),t1=te("$ZodEnum",(e,t)=>{We.init(e,t);const n=Wd(t.entries),s=new Set(n);e._zod.values=s,e._zod.pattern=new RegExp(`^(${n.filter(o=>dg.has(typeof o)).map(o=>typeof o=="string"?ws(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const a=o.value;return s.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),n1=te("$ZodLiteral",(e,t)=>{if(We.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(s=>typeof s=="string"?ws(s):s?ws(s.toString()):String(s)).join("|")})$`),e._zod.parse=(s,o)=>{const i=s.value;return n.has(i)||s.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),s}}),s1=te("$ZodTransform",(e,t)=>{We.init(e,t),e._zod.parse=(n,s)=>{if(s.direction==="backward")throw new Bd(e.constructor.name);const o=t.transform(n.value,n);if(s.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n));if(o instanceof Promise)throw new hs;return n.value=o,n}});function Sc(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const lf=te("$ZodOptional",(e,t)=>{We.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(`^(${nl(n.source)})?$`):void 0}),e._zod.parse=(n,s)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,s);return o instanceof Promise?o.then(i=>Sc(i,n.value)):Sc(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,s)}}),r1=te("$ZodExactOptional",(e,t)=>{lf.init(e,t),Pe(e._zod,"values",()=>t.innerType._zod.values),Pe(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,s)=>t.innerType._zod.run(n,s)}),o1=te("$ZodNullable",(e,t)=>{We.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(`^(${nl(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,s)=>n.value===null?n:t.innerType._zod.run(n,s)}),i1=te("$ZodDefault",(e,t)=>{We.init(e,t),e._zod.optin="optional",Pe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,s)=>{if(s.direction==="backward")return t.innerType._zod.run(n,s);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,s);return o instanceof Promise?o.then(i=>Cc(i,t)):Cc(o,t)}});function Cc(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const a1=te("$ZodPrefault",(e,t)=>{We.init(e,t),e._zod.optin="optional",Pe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,s)=>(s.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,s))}),l1=te("$ZodNonOptional",(e,t)=>{We.init(e,t),Pe(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(s=>s!==void 0)):void 0}),e._zod.parse=(n,s)=>{const o=t.innerType._zod.run(n,s);return o instanceof Promise?o.then(i=>Nc(i,e)):Nc(o,e)}});function Nc(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 c1=te("$ZodCatch",(e,t)=>{We.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,s)=>{if(s.direction==="backward")return t.innerType._zod.run(n,s);const o=t.innerType._zod.run(n,s);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(a=>vn(a,s,bn()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>vn(i,s,bn()))},input:n.value}),n.issues=[]),n)}}),u1=te("$ZodPipe",(e,t)=>{We.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,s)=>{if(s.direction==="backward"){const i=t.out._zod.run(n,s);return i instanceof Promise?i.then(a=>wr(a,t.in,s)):wr(i,t.in,s)}const o=t.in._zod.run(n,s);return o instanceof Promise?o.then(i=>wr(i,t.out,s)):wr(o,t.out,s)}});function wr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const d1=te("$ZodReadonly",(e,t)=>{We.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,s)=>{if(s.direction==="backward")return t.innerType._zod.run(n,s);const o=t.innerType._zod.run(n,s);return o instanceof Promise?o.then(Tc):Tc(o)}});function Tc(e){return e.value=Object.freeze(e.value),e}const f1=te("$ZodLazy",(e,t)=>{We.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,s)=>e._zod.innerType._zod.run(n,s)}),p1=te("$ZodCustom",(e,t)=>{mt.init(e,t),We.init(e,t),e._zod.parse=(n,s)=>n,e._zod.check=n=>{const s=n.value,o=t.fn(s);if(o instanceof Promise)return o.then(i=>Ec(i,n,s,e));Ec(o,n,s,e)}});function Ec(e,t,n,s){if(!e){const o={code:"custom",input:n,inst:s,path:[...s._zod.def.path??[]],continue:!s._zod.def.abort};s._zod.def.params&&(o.params=s._zod.def.params),t.issues.push(Qs(o))}}var Ac;class h1{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const s=n[0];return this._map.set(t,s),s&&typeof s=="object"&&"id"in s&&this._idmap.set(s.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 s={...this.get(n)??{}};delete s.id;const o={...s,...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 m1(){return new h1}(Ac=globalThis).__zod_globalRegistry??(Ac.__zod_globalRegistry=m1());const qs=globalThis.__zod_globalRegistry;function g1(e,t){return new e({type:"string",...je(t)})}function x1(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...je(t)})}function Rc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...je(t)})}function b1(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...je(t)})}function v1(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...je(t)})}function y1(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...je(t)})}function w1(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...je(t)})}function _1(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...je(t)})}function k1(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...je(t)})}function j1(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...je(t)})}function S1(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...je(t)})}function C1(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...je(t)})}function N1(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...je(t)})}function T1(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...je(t)})}function E1(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...je(t)})}function A1(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...je(t)})}function R1(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...je(t)})}function I1(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...je(t)})}function z1(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...je(t)})}function O1(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...je(t)})}function P1(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...je(t)})}function M1(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...je(t)})}function L1(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...je(t)})}function D1(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...je(t)})}function $1(e,t){return new e({type:"string",format:"date",check:"string_format",...je(t)})}function F1(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...je(t)})}function B1(e,t){return new e({type:"string",format:"duration",check:"string_format",...je(t)})}function U1(e,t){return new e({type:"number",checks:[],...je(t)})}function W1(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...je(t)})}function H1(e,t){return new e({type:"boolean",...je(t)})}function V1(e,t){return new e({type:"null",...je(t)})}function q1(e){return new e({type:"unknown"})}function Z1(e,t){return new e({type:"never",...je(t)})}function Ic(e,t){return new ef({check:"less_than",...je(t),value:e,inclusive:!1})}function _i(e,t){return new ef({check:"less_than",...je(t),value:e,inclusive:!0})}function zc(e,t){return new tf({check:"greater_than",...je(t),value:e,inclusive:!1})}function ki(e,t){return new tf({check:"greater_than",...je(t),value:e,inclusive:!0})}function Oc(e,t){return new ox({check:"multiple_of",...je(t),value:e})}function cf(e,t){return new ax({check:"max_length",...je(t),maximum:e})}function io(e,t){return new lx({check:"min_length",...je(t),minimum:e})}function uf(e,t){return new cx({check:"length_equals",...je(t),length:e})}function G1(e,t){return new ux({check:"string_format",format:"regex",...je(t),pattern:e})}function K1(e){return new dx({check:"string_format",format:"lowercase",...je(e)})}function J1(e){return new fx({check:"string_format",format:"uppercase",...je(e)})}function Y1(e,t){return new px({check:"string_format",format:"includes",...je(t),includes:e})}function X1(e,t){return new hx({check:"string_format",format:"starts_with",...je(t),prefix:e})}function Q1(e,t){return new mx({check:"string_format",format:"ends_with",...je(t),suffix:e})}function Ts(e){return new gx({check:"overwrite",tx:e})}function eb(e){return Ts(t=>t.normalize(e))}function tb(){return Ts(e=>e.trim())}function nb(){return Ts(e=>e.toLowerCase())}function sb(){return Ts(e=>e.toUpperCase())}function rb(){return Ts(e=>cg(e))}function ob(e,t,n){return new e({type:"array",element:t,...je(n)})}function ib(e,t,n){return new e({type:"custom",check:"custom",fn:t,...je(n)})}function ab(e){const t=lb(n=>(n.addIssue=s=>{if(typeof s=="string")n.issues.push(Qs(s,n.value,t._zod.def));else{const o=s;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(Qs(o))}},e(n.value,n)));return t}function lb(e,t){const n=new mt({check:"custom",...je(t)});return n._zod.check=e,n}function df(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??qs,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 Je(e,t,n={path:[],schemaPath:[]}){var s;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.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,m=t.processors[o.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,h,d)}const f=e._zod.parent;f&&(a.ref||(a.ref=f),Je(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"&<(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((s=a.schema).default??(s.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function ff(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=new Map;for(const a of e.seen.entries()){const l=e.metadataRegistry.get(a[0])?.id;if(l){const c=s.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.`);s.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??(v=>v);if(f)return{ref:h(f)};const m=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=m,{defId:m,ref:`${h("__shared")}#/${l}/${m}`}}if(a[1]===n)return{ref:"#"};const u=`#/${l}/`,d=a[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},i=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>
|
|
38
|
+
`)}m.write("payload.value = newResult;"),m.write("return payload;");const y=m.compile();return(k,j)=>y(h,k,j)};let i;const a=nr,l=!Hd.jitless,u=l&&ug.value,d=t.catchall;let f;e._zod.parse=(h,m)=>{f??(f=s.value);const v=h.value;return a(v)?l&&u&&m?.async===!1&&m.jitless!==!0?(i||(i=o(t.shape)),h=i(h,m),d?lf([],v,h,m,f,e):h):n(h,m):(h.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),h)}});function Sc(e,t,n,s){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!ds(i));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(i=>i.issues.map(a=>vn(a,s,bn())))}),t)}const cf=te("$ZodUnion",(e,t)=>{We.init(e,t),Oe(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Oe(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Oe(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Oe(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>nl(i.source)).join("|")})$`)}});const n=t.options.length===1,s=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return s(o,i);let a=!1;const l=[];for(const c of t.options){const u=c._zod.run({value:o.value,issues:[]},i);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=>Sc(c,o,e,i)):Sc(l,o,e,i)}}),Xx=te("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,cf.init(e,t);const n=e._zod.parse;Oe(e._zod,"propValues",()=>{const o={};for(const i of t.options){const a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);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 s=Bo(()=>{const o=t.options,i=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(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});e._zod.parse=(o,i)=>{const a=o.value;if(!nr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const l=s.value.get(a?.[t.discriminator]);return l?l._zod.run(o,i):t.unionFallback?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),Qx=te("$ZodIntersection",(e,t)=>{We.init(e,t),e._zod.parse=(n,s)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},s),a=t.right._zod.run({value:o,issues:[]},s);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>Cc(n,c,u)):Cc(n,i,a)}});function ia(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(ys(e)&&ys(t)){const n=Object.keys(t),s=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};for(const i of s){const a=ia(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=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 s=0;s<e.length;s++){const o=e[s],i=t[s],a=ia(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Cc(e,t,n){const s=new Map;let o;for(const l of t.issues)if(l.code==="unrecognized_keys"){o??(o=l);for(const c of l.keys)s.has(c)||s.set(c,{}),s.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)s.has(c)||s.set(c,{}),s.get(c).r=!0;else e.issues.push(l);const i=[...s].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(i.length&&o&&e.issues.push({...o,keys:i}),ds(e))return e;const a=ia(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 e1=te("$ZodRecord",(e,t)=>{We.init(e,t),e._zod.parse=(n,s)=>{const o=n.value;if(!ys(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],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:[]},s);d instanceof Promise?i.push(d.then(f=>{f.issues.length&&n.issues.push(...fs(u,f.issues)),n.value[u]=f.value})):(d.issues.length&&n.issues.push(...fs(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:[]},s);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&ef.test(l)&&c.issues.length){const f=t.keyType._zod.run({value:Number(l),issues:[]},s);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=>vn(f,s,bn())),input:l,path:[l],inst:e});continue}const d=t.valueType._zod.run({value:o[l],issues:[]},s);d instanceof Promise?i.push(d.then(f=>{f.issues.length&&n.issues.push(...fs(l,f.issues)),n.value[c.value]=f.value})):(d.issues.length&&n.issues.push(...fs(l,d.issues)),n.value[c.value]=d.value)}}return i.length?Promise.all(i).then(()=>n):n}}),t1=te("$ZodEnum",(e,t)=>{We.init(e,t);const n=Vd(t.entries),s=new Set(n);e._zod.values=s,e._zod.pattern=new RegExp(`^(${n.filter(o=>dg.has(typeof o)).map(o=>typeof o=="string"?ws(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const a=o.value;return s.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),n1=te("$ZodLiteral",(e,t)=>{if(We.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(s=>typeof s=="string"?ws(s):s?ws(s.toString()):String(s)).join("|")})$`),e._zod.parse=(s,o)=>{const i=s.value;return n.has(i)||s.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),s}}),s1=te("$ZodTransform",(e,t)=>{We.init(e,t),e._zod.parse=(n,s)=>{if(s.direction==="backward")throw new Wd(e.constructor.name);const o=t.transform(n.value,n);if(s.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n));if(o instanceof Promise)throw new hs;return n.value=o,n}});function Nc(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const uf=te("$ZodOptional",(e,t)=>{We.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Oe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Oe(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${nl(n.source)})?$`):void 0}),e._zod.parse=(n,s)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,s);return o instanceof Promise?o.then(i=>Nc(i,n.value)):Nc(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,s)}}),r1=te("$ZodExactOptional",(e,t)=>{uf.init(e,t),Oe(e._zod,"values",()=>t.innerType._zod.values),Oe(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,s)=>t.innerType._zod.run(n,s)}),o1=te("$ZodNullable",(e,t)=>{We.init(e,t),Oe(e._zod,"optin",()=>t.innerType._zod.optin),Oe(e._zod,"optout",()=>t.innerType._zod.optout),Oe(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${nl(n.source)}|null)$`):void 0}),Oe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,s)=>n.value===null?n:t.innerType._zod.run(n,s)}),i1=te("$ZodDefault",(e,t)=>{We.init(e,t),e._zod.optin="optional",Oe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,s)=>{if(s.direction==="backward")return t.innerType._zod.run(n,s);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,s);return o instanceof Promise?o.then(i=>Tc(i,t)):Tc(o,t)}});function Tc(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const a1=te("$ZodPrefault",(e,t)=>{We.init(e,t),e._zod.optin="optional",Oe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,s)=>(s.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,s))}),l1=te("$ZodNonOptional",(e,t)=>{We.init(e,t),Oe(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(s=>s!==void 0)):void 0}),e._zod.parse=(n,s)=>{const o=t.innerType._zod.run(n,s);return o instanceof Promise?o.then(i=>Ec(i,e)):Ec(o,e)}});function Ec(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 c1=te("$ZodCatch",(e,t)=>{We.init(e,t),Oe(e._zod,"optin",()=>t.innerType._zod.optin),Oe(e._zod,"optout",()=>t.innerType._zod.optout),Oe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,s)=>{if(s.direction==="backward")return t.innerType._zod.run(n,s);const o=t.innerType._zod.run(n,s);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(a=>vn(a,s,bn()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>vn(i,s,bn()))},input:n.value}),n.issues=[]),n)}}),u1=te("$ZodPipe",(e,t)=>{We.init(e,t),Oe(e._zod,"values",()=>t.in._zod.values),Oe(e._zod,"optin",()=>t.in._zod.optin),Oe(e._zod,"optout",()=>t.out._zod.optout),Oe(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,s)=>{if(s.direction==="backward"){const i=t.out._zod.run(n,s);return i instanceof Promise?i.then(a=>Sr(a,t.in,s)):Sr(i,t.in,s)}const o=t.in._zod.run(n,s);return o instanceof Promise?o.then(i=>Sr(i,t.out,s)):Sr(o,t.out,s)}});function Sr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const d1=te("$ZodReadonly",(e,t)=>{We.init(e,t),Oe(e._zod,"propValues",()=>t.innerType._zod.propValues),Oe(e._zod,"values",()=>t.innerType._zod.values),Oe(e._zod,"optin",()=>t.innerType?._zod?.optin),Oe(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,s)=>{if(s.direction==="backward")return t.innerType._zod.run(n,s);const o=t.innerType._zod.run(n,s);return o instanceof Promise?o.then(Ac):Ac(o)}});function Ac(e){return e.value=Object.freeze(e.value),e}const f1=te("$ZodLazy",(e,t)=>{We.init(e,t),Oe(e._zod,"innerType",()=>t.getter()),Oe(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Oe(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Oe(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Oe(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,s)=>e._zod.innerType._zod.run(n,s)}),p1=te("$ZodCustom",(e,t)=>{gt.init(e,t),We.init(e,t),e._zod.parse=(n,s)=>n,e._zod.check=n=>{const s=n.value,o=t.fn(s);if(o instanceof Promise)return o.then(i=>Rc(i,n,s,e));Rc(o,n,s,e)}});function Rc(e,t,n,s){if(!e){const o={code:"custom",input:n,inst:s,path:[...s._zod.def.path??[]],continue:!s._zod.def.abort};s._zod.def.params&&(o.params=s._zod.def.params),t.issues.push(sr(o))}}var Ic;class h1{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const s=n[0];return this._map.set(t,s),s&&typeof s=="object"&&"id"in s&&this._idmap.set(s.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 s={...this.get(n)??{}};delete s.id;const o={...s,...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 m1(){return new h1}(Ic=globalThis).__zod_globalRegistry??(Ic.__zod_globalRegistry=m1());const Js=globalThis.__zod_globalRegistry;function g1(e,t){return new e({type:"string",...je(t)})}function x1(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...je(t)})}function zc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...je(t)})}function b1(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...je(t)})}function v1(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...je(t)})}function y1(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...je(t)})}function w1(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...je(t)})}function _1(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...je(t)})}function k1(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...je(t)})}function j1(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...je(t)})}function S1(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...je(t)})}function C1(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...je(t)})}function N1(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...je(t)})}function T1(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...je(t)})}function E1(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...je(t)})}function A1(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...je(t)})}function R1(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...je(t)})}function I1(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...je(t)})}function z1(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...je(t)})}function P1(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...je(t)})}function O1(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...je(t)})}function M1(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...je(t)})}function L1(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...je(t)})}function D1(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...je(t)})}function $1(e,t){return new e({type:"string",format:"date",check:"string_format",...je(t)})}function F1(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...je(t)})}function B1(e,t){return new e({type:"string",format:"duration",check:"string_format",...je(t)})}function U1(e,t){return new e({type:"number",checks:[],...je(t)})}function W1(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...je(t)})}function H1(e,t){return new e({type:"boolean",...je(t)})}function V1(e,t){return new e({type:"null",...je(t)})}function q1(e){return new e({type:"unknown"})}function Z1(e,t){return new e({type:"never",...je(t)})}function Pc(e,t){return new nf({check:"less_than",...je(t),value:e,inclusive:!1})}function _i(e,t){return new nf({check:"less_than",...je(t),value:e,inclusive:!0})}function Oc(e,t){return new sf({check:"greater_than",...je(t),value:e,inclusive:!1})}function ki(e,t){return new sf({check:"greater_than",...je(t),value:e,inclusive:!0})}function Mc(e,t){return new ox({check:"multiple_of",...je(t),value:e})}function df(e,t){return new ax({check:"max_length",...je(t),maximum:e})}function uo(e,t){return new lx({check:"min_length",...je(t),minimum:e})}function ff(e,t){return new cx({check:"length_equals",...je(t),length:e})}function G1(e,t){return new ux({check:"string_format",format:"regex",...je(t),pattern:e})}function K1(e){return new dx({check:"string_format",format:"lowercase",...je(e)})}function J1(e){return new fx({check:"string_format",format:"uppercase",...je(e)})}function Y1(e,t){return new px({check:"string_format",format:"includes",...je(t),includes:e})}function X1(e,t){return new hx({check:"string_format",format:"starts_with",...je(t),prefix:e})}function Q1(e,t){return new mx({check:"string_format",format:"ends_with",...je(t),suffix:e})}function Is(e){return new gx({check:"overwrite",tx:e})}function eb(e){return Is(t=>t.normalize(e))}function tb(){return Is(e=>e.trim())}function nb(){return Is(e=>e.toLowerCase())}function sb(){return Is(e=>e.toUpperCase())}function rb(){return Is(e=>cg(e))}function ob(e,t,n){return new e({type:"array",element:t,...je(n)})}function ib(e,t,n){return new e({type:"custom",check:"custom",fn:t,...je(n)})}function ab(e){const t=lb(n=>(n.addIssue=s=>{if(typeof s=="string")n.issues.push(sr(s,n.value,t._zod.def));else{const o=s;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(sr(o))}},e(n.value,n)));return t}function lb(e,t){const n=new gt({check:"custom",...je(t)});return n._zod.check=e,n}function pf(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??Js,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 Je(e,t,n={path:[],schemaPath:[]}){var s;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.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,m=t.processors[o.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,h,d)}const f=e._zod.parent;f&&(a.ref||(a.ref=f),Je(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"&<(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((s=a.schema).default??(s.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function hf(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=new Map;for(const a of e.seen.entries()){const l=e.metadataRegistry.get(a[0])?.id;if(l){const c=s.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.`);s.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??(v=>v);if(f)return{ref:h(f)};const m=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=m,{defId:m,ref:`${h("__shared")}#/${l}/${m}`}}if(a[1]===n)return{ref:"#"};const u=`#/${l}/`,d=a[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},i=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
|
-
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]){i(a);continue}if(e.external){const u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(l.cycle){i(a);continue}if(l.count>1&&e.reused==="ref"){i(a);continue}}}function pf(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=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){s(d);const h=e.seen.get(d),m=h.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(m)):Object.assign(c,m),Object.assign(c,u),a._zod.parent===d)for(const g in c)g==="$ref"||g==="allOf"||g in u||delete c[g];if(m.$ref&&h.def)for(const g in c)g==="$ref"||g==="allOf"||g in h.def&&JSON.stringify(c[g])===JSON.stringify(h.def[g])&&delete c[g]}const f=a._zod.parent;if(f&&f!==d){s(f);const h=e.seen.get(f);if(h?.schema.$ref&&(c.$ref=h.schema.$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]}e.override({zodSchema:a,jsonSchema:c,path:l.path??[]})};for(const a of[...e.seen.entries()].reverse())s(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 i=e.external?.defs??{};for(const a of e.seen.entries()){const l=a[1];l.def&&l.defId&&(i[l.defId]=l.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:ao(t,"input",e.processors),output:ao(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function lt(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const s=e._zod.def;if(s.type==="transform")return!0;if(s.type==="array")return lt(s.element,n);if(s.type==="set")return lt(s.valueType,n);if(s.type==="lazy")return lt(s.getter(),n);if(s.type==="promise"||s.type==="optional"||s.type==="nonoptional"||s.type==="nullable"||s.type==="readonly"||s.type==="default"||s.type==="prefault")return lt(s.innerType,n);if(s.type==="intersection")return lt(s.left,n)||lt(s.right,n);if(s.type==="record"||s.type==="map")return lt(s.keyType,n)||lt(s.valueType,n);if(s.type==="pipe")return lt(s.in,n)||lt(s.out,n);if(s.type==="object"){for(const o in s.shape)if(lt(s.shape[o],n))return!0;return!1}if(s.type==="union"){for(const o of s.options)if(lt(o,n))return!0;return!1}if(s.type==="tuple"){for(const o of s.items)if(lt(o,n))return!0;return!!(s.rest&<(s.rest,n))}return!1}const cb=(e,t={})=>n=>{const s=df({...n,processors:t});return Je(e,s),ff(s,e),pf(s,e)},ao=(e,t,n={})=>s=>{const{libraryOptions:o,target:i}=s??{},a=df({...o??{},target:i,io:t,processors:n});return Je(e,a),ff(a,e),pf(a,e)},ub={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},db=(e,t,n,s)=>{const o=n;o.type="string";const{minimum:i,maximum:a,format:l,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),l&&(o.format=ub[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}))])}},fb=(e,t,n,s)=>{const o=n,{minimum:i,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 i=="number"&&(o.minimum=i,typeof d=="number"&&t.target!=="draft-04"&&(d>=i?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)},pb=(e,t,n,s)=>{n.type="boolean"},hb=(e,t,n,s)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},mb=(e,t,n,s)=>{n.not={}},gb=(e,t,n,s)=>{},xb=(e,t,n,s)=>{const o=e._zod.def,i=Wd(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},bb=(e,t,n,s)=>{const o=e._zod.def,i=[];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");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),i.every(a=>typeof a=="boolean")&&(n.type="boolean"),i.every(a=>a===null)&&(n.type="null"),n.enum=i},vb=(e,t,n,s)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},yb=(e,t,n,s)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},wb=(e,t,n,s)=>{const o=n,i=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=Je(i.element,t,{...s,path:[...s.path,"items"]})},_b=(e,t,n,s)=>{const o=n,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const u in a)o.properties[u]=Je(a[u],t,{...s,path:[...s.path,"properties",u]});const l=new Set(Object.keys(a)),c=new Set([...l].filter(u=>{const d=i.shape[u]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Je(i.catchall,t,{...s,path:[...s.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},kb=(e,t,n,s)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((l,c)=>Je(l,t,{...s,path:[...s.path,i?"oneOf":"anyOf",c]}));i?n.oneOf=a:n.anyOf=a},jb=(e,t,n,s)=>{const o=e._zod.def,i=Je(o.left,t,{...s,path:[...s.path,"allOf",0]}),a=Je(o.right,t,{...s,path:[...s.path,"allOf",1]}),l=u=>"allOf"in u&&Object.keys(u).length===1,c=[...l(i)?i.allOf:[i],...l(a)?a.allOf:[a]];n.allOf=c},Sb=(e,t,n,s)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){const d=Je(i.valueType,t,{...s,path:[...s.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=Je(i.keyType,t,{...s,path:[...s.path,"propertyNames"]})),o.additionalProperties=Je(i.valueType,t,{...s,path:[...s.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)}},Cb=(e,t,n,s)=>{const o=e._zod.def,i=Je(o.innerType,t,s),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},Nb=(e,t,n,s)=>{const o=e._zod.def;Je(o.innerType,t,s);const i=t.seen.get(e);i.ref=o.innerType},Tb=(e,t,n,s)=>{const o=e._zod.def;Je(o.innerType,t,s);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Eb=(e,t,n,s)=>{const o=e._zod.def;Je(o.innerType,t,s);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Ab=(e,t,n,s)=>{const o=e._zod.def;Je(o.innerType,t,s);const i=t.seen.get(e);i.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},Rb=(e,t,n,s)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Je(i,t,s);const a=t.seen.get(e);a.ref=i},Ib=(e,t,n,s)=>{const o=e._zod.def;Je(o.innerType,t,s);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},hf=(e,t,n,s)=>{const o=e._zod.def;Je(o.innerType,t,s);const i=t.seen.get(e);i.ref=o.innerType},zb=(e,t,n,s)=>{const o=e._zod.innerType;Je(o,t,s);const i=t.seen.get(e);i.ref=o},Ob=te("ZodISODateTime",(e,t)=>{Ax.init(e,t),qe.init(e,t)});function Pb(e){return D1(Ob,e)}const Mb=te("ZodISODate",(e,t)=>{Rx.init(e,t),qe.init(e,t)});function Lb(e){return $1(Mb,e)}const Db=te("ZodISOTime",(e,t)=>{Ix.init(e,t),qe.init(e,t)});function $b(e){return F1(Db,e)}const Fb=te("ZodISODuration",(e,t)=>{zx.init(e,t),qe.init(e,t)});function Bb(e){return B1(Fb,e)}const Ub=(e,t)=>{Zd.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>_g(e,n)},flatten:{value:n=>wg(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,oa,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,oa,2)}},isEmpty:{get(){return e.issues.length===0}}})},Et=te("ZodError",Ub,{Parent:Error}),Wb=rl(Et),Hb=ol(Et),Vb=Uo(Et),qb=Wo(Et),Zb=Sg(Et),Gb=Cg(Et),Kb=Ng(Et),Jb=Tg(Et),Yb=Eg(Et),Xb=Ag(Et),Qb=Rg(Et),ev=Ig(Et),He=te("ZodType",(e,t)=>(We.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ao(e,"input"),output:ao(e,"output")}}),e.toJSONSchema=cb(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Sn(t,{checks:[...t.checks??[],...n.map(s=>typeof s=="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0}),e.with=e.check,e.clone=(n,s)=>Cn(e,n,s),e.brand=()=>e,e.register=((n,s)=>(n.add(e,s),e)),e.parse=(n,s)=>Wb(e,n,s,{callee:e.parse}),e.safeParse=(n,s)=>Vb(e,n,s),e.parseAsync=async(n,s)=>Hb(e,n,s,{callee:e.parseAsync}),e.safeParseAsync=async(n,s)=>qb(e,n,s),e.spa=e.safeParseAsync,e.encode=(n,s)=>Zb(e,n,s),e.decode=(n,s)=>Gb(e,n,s),e.encodeAsync=async(n,s)=>Kb(e,n,s),e.decodeAsync=async(n,s)=>Jb(e,n,s),e.safeEncode=(n,s)=>Yb(e,n,s),e.safeDecode=(n,s)=>Xb(e,n,s),e.safeEncodeAsync=async(n,s)=>Qb(e,n,s),e.safeDecodeAsync=async(n,s)=>ev(e,n,s),e.refine=(n,s)=>e.check(Jv(n,s)),e.superRefine=n=>e.check(Yv(n)),e.overwrite=n=>e.check(Ts(n)),e.optional=()=>Lc(e),e.exactOptional=()=>Pv(e),e.nullable=()=>Dc(e),e.nullish=()=>Lc(Dc(e)),e.nonoptional=n=>Bv(e,n),e.array=()=>fe(e),e.or=n=>Yt([e,n]),e.and=n=>Ev(e,n),e.transform=n=>$c(e,zv(n)),e.default=n=>Dv(e,n),e.prefault=n=>Fv(e,n),e.catch=n=>Wv(e,n),e.pipe=n=>$c(e,n),e.readonly=()=>qv(e),e.describe=n=>{const s=e.clone();return qs.add(s,{description:n}),s},Object.defineProperty(e,"description",{get(){return qs.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return qs.get(e);const s=e.clone();return qs.add(s,n[0]),s},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),mf=te("_ZodString",(e,t)=>{il.init(e,t),He.init(e,t),e._zod.processJSONSchema=(s,o,i)=>db(e,s,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...s)=>e.check(G1(...s)),e.includes=(...s)=>e.check(Y1(...s)),e.startsWith=(...s)=>e.check(X1(...s)),e.endsWith=(...s)=>e.check(Q1(...s)),e.min=(...s)=>e.check(io(...s)),e.max=(...s)=>e.check(cf(...s)),e.length=(...s)=>e.check(uf(...s)),e.nonempty=(...s)=>e.check(io(1,...s)),e.lowercase=s=>e.check(K1(s)),e.uppercase=s=>e.check(J1(s)),e.trim=()=>e.check(tb()),e.normalize=(...s)=>e.check(eb(...s)),e.toLowerCase=()=>e.check(nb()),e.toUpperCase=()=>e.check(sb()),e.slugify=()=>e.check(rb())}),tv=te("ZodString",(e,t)=>{il.init(e,t),mf.init(e,t),e.email=n=>e.check(x1(nv,n)),e.url=n=>e.check(_1(sv,n)),e.jwt=n=>e.check(L1(bv,n)),e.emoji=n=>e.check(k1(rv,n)),e.guid=n=>e.check(Rc(Pc,n)),e.uuid=n=>e.check(b1(_r,n)),e.uuidv4=n=>e.check(v1(_r,n)),e.uuidv6=n=>e.check(y1(_r,n)),e.uuidv7=n=>e.check(w1(_r,n)),e.nanoid=n=>e.check(j1(ov,n)),e.guid=n=>e.check(Rc(Pc,n)),e.cuid=n=>e.check(S1(iv,n)),e.cuid2=n=>e.check(C1(av,n)),e.ulid=n=>e.check(N1(lv,n)),e.base64=n=>e.check(O1(mv,n)),e.base64url=n=>e.check(P1(gv,n)),e.xid=n=>e.check(T1(cv,n)),e.ksuid=n=>e.check(E1(uv,n)),e.ipv4=n=>e.check(A1(dv,n)),e.ipv6=n=>e.check(R1(fv,n)),e.cidrv4=n=>e.check(I1(pv,n)),e.cidrv6=n=>e.check(z1(hv,n)),e.e164=n=>e.check(M1(xv,n)),e.datetime=n=>e.check(Pb(n)),e.date=n=>e.check(Lb(n)),e.time=n=>e.check($b(n)),e.duration=n=>e.check(Bb(n))});function S(e){return g1(tv,e)}const qe=te("ZodStringFormat",(e,t)=>{Ve.init(e,t),mf.init(e,t)}),nv=te("ZodEmail",(e,t)=>{wx.init(e,t),qe.init(e,t)}),Pc=te("ZodGUID",(e,t)=>{vx.init(e,t),qe.init(e,t)}),_r=te("ZodUUID",(e,t)=>{yx.init(e,t),qe.init(e,t)}),sv=te("ZodURL",(e,t)=>{_x.init(e,t),qe.init(e,t)}),rv=te("ZodEmoji",(e,t)=>{kx.init(e,t),qe.init(e,t)}),ov=te("ZodNanoID",(e,t)=>{jx.init(e,t),qe.init(e,t)}),iv=te("ZodCUID",(e,t)=>{Sx.init(e,t),qe.init(e,t)}),av=te("ZodCUID2",(e,t)=>{Cx.init(e,t),qe.init(e,t)}),lv=te("ZodULID",(e,t)=>{Nx.init(e,t),qe.init(e,t)}),cv=te("ZodXID",(e,t)=>{Tx.init(e,t),qe.init(e,t)}),uv=te("ZodKSUID",(e,t)=>{Ex.init(e,t),qe.init(e,t)}),dv=te("ZodIPv4",(e,t)=>{Ox.init(e,t),qe.init(e,t)}),fv=te("ZodIPv6",(e,t)=>{Px.init(e,t),qe.init(e,t)}),pv=te("ZodCIDRv4",(e,t)=>{Mx.init(e,t),qe.init(e,t)}),hv=te("ZodCIDRv6",(e,t)=>{Lx.init(e,t),qe.init(e,t)}),mv=te("ZodBase64",(e,t)=>{Dx.init(e,t),qe.init(e,t)}),gv=te("ZodBase64URL",(e,t)=>{Fx.init(e,t),qe.init(e,t)}),xv=te("ZodE164",(e,t)=>{Bx.init(e,t),qe.init(e,t)}),bv=te("ZodJWT",(e,t)=>{Wx.init(e,t),qe.init(e,t)}),gf=te("ZodNumber",(e,t)=>{sf.init(e,t),He.init(e,t),e._zod.processJSONSchema=(s,o,i)=>fb(e,s,o),e.gt=(s,o)=>e.check(zc(s,o)),e.gte=(s,o)=>e.check(ki(s,o)),e.min=(s,o)=>e.check(ki(s,o)),e.lt=(s,o)=>e.check(Ic(s,o)),e.lte=(s,o)=>e.check(_i(s,o)),e.max=(s,o)=>e.check(_i(s,o)),e.int=s=>e.check(Mc(s)),e.safe=s=>e.check(Mc(s)),e.positive=s=>e.check(zc(0,s)),e.nonnegative=s=>e.check(ki(0,s)),e.negative=s=>e.check(Ic(0,s)),e.nonpositive=s=>e.check(_i(0,s)),e.multipleOf=(s,o)=>e.check(Oc(s,o)),e.step=(s,o)=>e.check(Oc(s,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 K(e){return U1(gf,e)}const vv=te("ZodNumberFormat",(e,t)=>{Hx.init(e,t),gf.init(e,t)});function Mc(e){return W1(vv,e)}const yv=te("ZodBoolean",(e,t)=>{Vx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>pb(e,n,s)});function Le(e){return H1(yv,e)}const wv=te("ZodNull",(e,t)=>{qx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>hb(e,n,s)});function lo(e){return V1(wv,e)}const _v=te("ZodUnknown",(e,t)=>{Zx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>gb()});function Ln(){return q1(_v)}const kv=te("ZodNever",(e,t)=>{Gx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>mb(e,n,s)});function jv(e){return Z1(kv,e)}const Sv=te("ZodArray",(e,t)=>{Kx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>wb(e,n,s,o),e.element=t.element,e.min=(n,s)=>e.check(io(n,s)),e.nonempty=n=>e.check(io(1,n)),e.max=(n,s)=>e.check(cf(n,s)),e.length=(n,s)=>e.check(uf(n,s)),e.unwrap=()=>e.element});function fe(e,t){return ob(Sv,e,t)}const Cv=te("ZodObject",(e,t)=>{Yx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>_b(e,n,s,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:Ln()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ln()}),e.strict=()=>e.clone({...e._zod.def,catchall:jv()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>gg(e,n),e.safeExtend=n=>xg(e,n),e.merge=n=>bg(e,n),e.pick=n=>hg(e,n),e.omit=n=>mg(e,n),e.partial=(...n)=>vg(bf,e,n[0]),e.required=(...n)=>yg(vf,e,n[0])});function J(e,t){const n={type:"object",shape:e??{},...je(t)};return new Cv(n)}const xf=te("ZodUnion",(e,t)=>{af.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>kb(e,n,s,o),e.options=t.options});function Yt(e,t){return new xf({type:"union",options:e,...je(t)})}const Nv=te("ZodDiscriminatedUnion",(e,t)=>{xf.init(e,t),Xx.init(e,t)});function Zn(e,t,n){return new Nv({type:"union",options:t,discriminator:e,...je(n)})}const Tv=te("ZodIntersection",(e,t)=>{Qx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>jb(e,n,s,o)});function Ev(e,t){return new Tv({type:"intersection",left:e,right:t})}const Av=te("ZodRecord",(e,t)=>{e1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Sb(e,n,s,o),e.keyType=t.keyType,e.valueType=t.valueType});function Ye(e,t,n){return new Av({type:"record",keyType:e,valueType:t,...je(n)})}const aa=te("ZodEnum",(e,t)=>{t1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(s,o,i)=>xb(e,s,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(s,o)=>{const i={};for(const a of s)if(n.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new aa({...t,checks:[],...je(o),entries:i})},e.exclude=(s,o)=>{const i={...t.entries};for(const a of s)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new aa({...t,checks:[],...je(o),entries:i})}});function Re(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(s=>[s,s])):e;return new aa({type:"enum",entries:n,...je(t)})}const Rv=te("ZodLiteral",(e,t)=>{n1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>bb(e,n,s),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 Ee(e,t){return new Rv({type:"literal",values:Array.isArray(e)?e:[e],...je(t)})}const Iv=te("ZodTransform",(e,t)=>{s1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>yb(e,n),e._zod.parse=(n,s)=>{if(s.direction==="backward")throw new Bd(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(Qs(i,n.value,t));else{const a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=e),n.issues.push(Qs(a))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function zv(e){return new Iv({type:"transform",transform:e})}const bf=te("ZodOptional",(e,t)=>{lf.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>hf(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function Lc(e){return new bf({type:"optional",innerType:e})}const Ov=te("ZodExactOptional",(e,t)=>{r1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>hf(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function Pv(e){return new Ov({type:"optional",innerType:e})}const Mv=te("ZodNullable",(e,t)=>{o1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Cb(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function Dc(e){return new Mv({type:"nullable",innerType:e})}const Lv=te("ZodDefault",(e,t)=>{i1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Tb(e,n,s,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Dv(e,t){return new Lv({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Vd(t)}})}const $v=te("ZodPrefault",(e,t)=>{a1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Eb(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function Fv(e,t){return new $v({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Vd(t)}})}const vf=te("ZodNonOptional",(e,t)=>{l1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Nb(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function Bv(e,t){return new vf({type:"nonoptional",innerType:e,...je(t)})}const Uv=te("ZodCatch",(e,t)=>{c1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Ab(e,n,s,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Wv(e,t){return new Uv({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Hv=te("ZodPipe",(e,t)=>{u1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Rb(e,n,s,o),e.in=t.in,e.out=t.out});function $c(e,t){return new Hv({type:"pipe",in:e,out:t})}const Vv=te("ZodReadonly",(e,t)=>{d1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Ib(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function qv(e){return new Vv({type:"readonly",innerType:e})}const Zv=te("ZodLazy",(e,t)=>{f1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>zb(e,n,s,o),e.unwrap=()=>e._zod.def.getter()});function Gv(e){return new Zv({type:"lazy",getter:e})}const Kv=te("ZodCustom",(e,t)=>{p1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>vb(e,n)});function Jv(e,t={}){return ib(Kv,e,t)}function Yv(e){return ab(e)}const nt=Gv(()=>Yt([S(),K(),Le(),lo(),fe(nt),Ye(S(),nt)]));const yf=J({index:K(),timestamp:K(),type:S(),data:nt}),Xv=J({chunks:fe(yf),truncated:Le().optional().default(!1)}),Qv=Re(["request","response"]),e2=J({logId:K().int().positive(),part:Qv,text:S(),offset:K().int().nonnegative(),limit:K().int().positive(),totalBytes:K().int().nonnegative(),textBytes:K().int().nonnegative(),nextOffset:K().int().nonnegative().nullable(),hasMore:Le(),contentMode:Re(["empty","partial","full"])}),er=J({id:K(),timestamp:S(),method:S(),path:S(),model:S().nullable(),sessionId:S().nullable(),rawRequestBody:S().nullable(),responseStatus:K().nullable(),responseText:S().nullable(),inputTokens:K().nullable(),outputTokens:K().nullable(),cacheCreationInputTokens:K().nullable(),cacheReadInputTokens:K().nullable(),elapsedMs:K().nullable(),firstChunkMs:K().nullable().optional(),totalStreamMs:K().nullable().optional(),tokensPerSecond:K().nullable().optional(),streaming:Le(),userAgent:S().nullable(),origin:S().nullable(),rawHeaders:Ye(S(),S()).optional(),headers:Ye(S(),S()).optional(),apiFormat:Re(["anthropic","openai","unknown"]).default("unknown"),isTest:Le().optional().default(!1),replayOfLogId:K().nullable().optional(),providerName:S().nullable().optional(),clientPort:K().nullable().optional(),clientPid:K().nullable().optional(),clientCwd:S().nullable().optional(),clientProjectFolder:S().nullable().optional(),streamingChunks:Xv.optional(),streamingChunksPath:S().nullable().optional(),rawRequestBodyBytes:K().int().nonnegative().nullable().optional(),responseTextBytes:K().int().nonnegative().nullable().optional(),bodyContentMode:Re(["full","compact","truncated"]).optional(),warnings:fe(S()).optional(),error:S().nullable().optional()}),al=J({type:S(),ttl:S().optional(),scope:S().optional()}),ll=J({type:Ee("text"),text:S(),cache_control:al.optional()}),wf=J({type:Ee("thinking"),thinking:S(),signature:S().optional()}),t2=J({type:Ee("think"),thinking:S(),signature:S().optional()}),n2=J({type:Ee("base64"),media_type:S(),data:S()}),_f=J({type:Ee("image"),source:n2}),kf=J({type:Ee("tool_use"),id:S(),name:S(),input:Ye(S(),nt)}),s2=Zn("type",[ll,_f]),r2=J({type:Ee("tool_result"),tool_use_id:S().optional(),content:Yt([S(),fe(s2)]),is_error:Le().optional()}),o2=Zn("type",[ll,wf,_f,kf,r2]),i2=Yt([S(),fe(o2)]),a2=J({role:Re(["user","assistant"]),content:i2}),l2=J({type:Ee("text"),text:S(),cache_control:al.optional()}),c2=J({type:S(),properties:Ye(S(),Ye(S(),nt)).optional(),required:fe(S()).optional(),additionalProperties:Le().optional(),$schema:S().optional()}),u2=J({name:S(),description:S().optional(),input_schema:c2.optional(),cache_control:al.optional()}),d2=Zn("type",[J({type:Ee("enabled"),budget_tokens:K()}),J({type:Ee("disabled")}),J({type:Ee("adaptive")})]),jf=J({model:S(),messages:fe(a2),system:fe(l2).optional(),tools:fe(u2).optional(),max_tokens:K().optional(),temperature:K().optional(),stream:Le().optional(),thinking:d2.optional(),metadata:J({user_id:S().optional()}).optional()}),cl=Zn("type",[ll,wf,t2,kf]),f2=J({input_tokens:K().nullable().optional(),output_tokens:K().nullable().optional(),cache_creation_input_tokens:K().nullable().optional(),cache_read_input_tokens:K().nullable().optional()}).passthrough(),Sf=J({id:S(),type:Ee("message"),model:S(),role:Ee("assistant"),content:fe(cl),stop_reason:S().nullable(),stop_sequence:S().nullable().optional(),usage:f2}).passthrough(),p2=J({type:Ee("message_start"),message:J({id:S(),type:Ee("message"),model:S(),role:Ee("assistant"),content:fe(cl),stop_reason:lo(),stop_sequence:lo(),usage:J({input_tokens:K(),cache_creation_input_tokens:K().optional(),cache_read_input_tokens:K().optional()}).passthrough()})}),h2=J({type:Ee("content_block_start"),index:K(),content_block:cl}),m2=Zn("type",[J({type:Ee("text_delta"),text:S()}),J({type:Ee("input_json_delta"),partial_json:S()}),J({type:Ee("thinking_delta"),thinking:S()}),J({type:Ee("signature_delta"),signature:S()})]),g2=J({type:Ee("content_block_delta"),index:K(),delta:m2}),x2=J({type:Ee("content_block_stop"),index:K()}),b2=J({type:Ee("message_delta"),delta:J({stop_reason:S().nullable(),stop_sequence:S().nullable().optional()}),usage:J({output_tokens:K(),input_tokens:K().optional(),cache_creation_input_tokens:K().optional(),cache_read_input_tokens:K().optional()}).passthrough()}),v2=J({type:Ee("message_stop")}),y2=J({type:Ee("ping")}),w2=J({type:Ee("error"),error:J({type:S(),message:S()})}),_2=Zn("type",[p2,h2,g2,x2,b2,v2,y2,w2]),k2=Yt([S(),fe(Zn("type",[J({type:Ee("text"),text:S()}),J({type:Ee("image_url"),image_url:J({url:S(),detail:S().optional()})})]))]),Cf=J({role:Re(["system","user","assistant","tool"]),content:k2,name:S().optional(),reasoning_content:S().optional(),thinking:S().optional(),think:S().optional()}),j2=J({name:S(),arguments:S()}),Nf=J({index:K().optional(),id:S().optional(),type:Ee("function").optional(),function:J({name:S().optional(),arguments:S().optional()})});Cf.extend({content:Yt([S(),fe(J({type:Ee("text"),text:S()}))]).optional(),function_call:j2.optional(),tool_calls:fe(Nf).optional()});const S2=J({type:Ee("function"),function:J({name:S(),description:S().optional(),parameters:Ye(S(),nt)})}),Tf=J({model:S(),messages:fe(Cf),temperature:K().optional(),max_tokens:K().optional(),stream:Le().optional(),tools:fe(S2).optional(),tool_choice:Yt([Re(["auto","none","required"]),J({type:Ee("auto")}),J({type:Ee("none")}),J({type:Ee("function"),function:J({name:S()})})]).optional(),user:S().optional()}),C2=J({type:S(),name:S().optional(),description:S().optional(),parameters:nt.optional(),function:J({name:S().optional(),description:S().optional(),parameters:nt.optional()}).optional()}).passthrough(),Ef=J({model:S(),input:Ln().optional(),instructions:Yt([S(),lo()]).optional(),stream:Le().optional(),tools:fe(C2).optional(),tool_choice:Ln().optional(),max_output_tokens:K().optional(),temperature:K().optional(),user:S().optional(),metadata:Ye(S(),Ln()).optional()}).passthrough(),Af=J({role:Re(["assistant"]).optional(),content:S().nullable().optional(),reasoning_content:S().nullable().optional(),thinking:S().nullable().optional(),think:S().nullable().optional(),function_call:J({name:S().optional(),arguments:S().optional()}).nullable().optional(),tool_calls:fe(J({index:K(),id:S().optional(),type:Ee("function").optional(),function:J({name:S().optional(),arguments:S().optional()})})).nullable().optional()}),N2=J({index:K(),message:J({role:Re(["assistant"]),content:S().nullable(),reasoning_content:S().optional(),thinking:S().optional(),think:S().optional(),function_call:J({name:S(),arguments:S()}).nullable().optional(),tool_calls:fe(Nf).optional()}).optional(),delta:Af.optional(),finish_reason:S().nullable()}),T2=J({id:S(),object:Ee("chat.completion"),created:K(),model:S(),choices:fe(N2),usage:J({prompt_tokens:K().nullable().optional(),completion_tokens:K().nullable().optional(),total_tokens:K().nullable().optional()}).passthrough(),service_tier:S().nullable().optional(),system_fingerprint:S().nullable().optional()}).passthrough(),E2=J({id:S(),object:Ee("chat.completion.chunk"),created:K(),model:S(),choices:fe(J({index:K(),delta:Af,finish_reason:S().nullable().optional()})),usage:J({prompt_tokens:K().nullable().optional(),completion_tokens:K().nullable().optional(),total_tokens:K().nullable().optional()}).passthrough().nullable().optional()}).passthrough(),A2=J({input_tokens:K().nullable().optional(),output_tokens:K().nullable().optional(),total_tokens:K().nullable().optional(),input_tokens_details:J({cached_tokens:K().nullable().optional()}).passthrough().nullable().optional(),output_tokens_details:J({reasoning_tokens:K().nullable().optional()}).passthrough().nullable().optional()}).passthrough(),R2=J({type:S()}).passthrough(),co=J({id:S(),object:Ee("response").optional(),created_at:K().optional(),status:S().nullable().optional(),model:S().optional(),output:fe(R2).optional(),output_text:S().optional(),usage:A2.nullable().optional(),error:Ln().optional()}).passthrough(),I2=J({type:S()}).passthrough();function Rf(e){try{const t=JSON.parse(e),n=T2.safeParse(t);return n.success?n.data:null}catch{return null}}function If(e){try{const t=JSON.parse(e),n=co.safeParse(t);return n.success?n.data:null}catch{return null}}const z2=J({error:S()});async function ul(e,t){const n=await e.json();return t.parse(n)}async function dl(e,t){try{const n=await e.json(),s=z2.safeParse(n);return s.success?s.data.error:t}catch{return t}}async function pt(e,t,n,s){const o=await fetch(e,n);if(!o.ok){const i=s?.(o)??`Request failed with status ${o.status}`;throw new Error(await dl(o,i))}return ul(o,t)}function O2(e){return e<1e3?`${String(e)}ms`:`${String(Math.round(e/1e3))}s`}class Vo extends Error{constructor(t){super(`Request timed out after ${O2(t)}`),this.name="ApiTimeoutError"}}async function Dn(e,t,n){const s=new AbortController;let o=!1;const i=setTimeout(()=>{o=!0,s.abort()},t),a=n?.signal??void 0,l=()=>s.abort();a!==void 0&&(a.aborted?s.abort():a.addEventListener("abort",l,{once:!0}));try{return await fetch(e,{...n,signal:s.signal})}catch(c){throw o&&c instanceof DOMException&&c.name==="AbortError"?new Vo(t):c}finally{clearTimeout(i),a?.removeEventListener("abort",l)}}async function Ke(e,t,n,s,o){const i=await Dn(e,n,s);if(!i.ok){const a=o?.(i)??`Request failed with status ${i.status}`;throw new Error(await dl(i,a))}return ul(i,t)}const zf=J({input:K().int().nonnegative(),output:K().int().nonnegative(),cacheCreate:K().int().nonnegative(),cacheRead:K().int().nonnegative(),total:K().int().nonnegative()}),P2=J({id:K().int().positive(),sessionLogNumber:K().int().positive().optional(),timestamp:S(),provider:S().nullable(),model:S().nullable(),apiFormat:Re(["anthropic","openai","unknown"]),method:S(),path:S(),status:K().nullable(),isStreaming:Le(),hasError:Le(),error:S().nullable(),latencyMs:K().nullable(),firstChunkMs:K().nullable().optional(),totalStreamMs:K().nullable().optional(),tokensPerSecond:K().nullable().optional(),tokens:J({input:K().nullable(),output:K().nullable(),cacheCreate:K().nullable(),cacheRead:K().nullable()}),sessionId:S().nullable(),userAgent:S().nullable().optional(),clientPid:K().nullable().optional(),clientProjectFolder:S().nullable().optional()}),Of=J({id:S(),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:S().nullable(),updatedAt:S().nullable(),requestCount:K().int().nonnegative(),activeRequests:K().int().nonnegative(),completedRequests:K().int().nonnegative(),failedRequests:K().int().nonnegative(),queuedTasks:K().int().nonnegative(),runningTasks:K().int().nonnegative(),lastTaskError:S().nullable(),logCount:K().int().nonnegative(),errorCount:K().int().nonnegative(),models:fe(S()),providers:fe(S()),tokenUsage:zf,lastLogId:K().nullable(),lastModel:S().nullable(),clientUserAgent:S().nullable().optional(),clientPid:K().nullable(),clientProjectFolder:S().nullable(),inspectorPath:S(),inspectorUrl:S(),apiPath:S(),apiUrl:S(),compactLogsPath:S(),compactLogsUrl:S(),latestLogLimit:K().int().positive(),latestLogs:fe(P2)}),ur=Re(["created","running","completed","failed","cancelled"]),fl=J({jsonPath:S(),markdownPath:S(),htmlPath:S(),exportedAt:S()}),M2=Re(["run-created","session-started","request","session-finished","evidence-exported"]),L2=Re(["info","success","warning","error"]),D2=J({timestamp:S(),kind:M2,severity:L2,title:S(),details:S(),logId:K().int().positive().nullable(),status:K().nullable(),model:S().nullable(),provider:S().nullable(),latencyMs:K().nullable(),isStreaming:Le().nullable()}),$2=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"]),Pf=J({outcome:Re(["success","failure","active","unknown"]),severity:Re(["none","low","medium","high"]),category:$2,summary:S(),evidenceLogIds:fe(K().int().positive()),hints:fe(S())}),pl=J({status:Re(["PASS","FAIL","RUNNING","UNKNOWN"]),summary:S(),markdown:S()}),Mf=pl,hl=J({id:S(),sessionId:S(),groupId:S().nullable().default(null),title:S(),task:S().nullable(),project:S().nullable(),agent:S().nullable(),status:ur,tags:fe(S()),metadata:Ye(S(),nt),evidence:fl.nullable(),createdAt:S(),updatedAt:S()});J({runId:S().min(1).optional(),sessionId:S().min(1).optional(),groupId:S().min(1).nullable().optional(),title:S().min(1).optional(),task:S().nullable().optional(),project:S().nullable().optional(),agent:S().nullable().optional(),status:ur.optional(),tags:fe(S()).optional(),metadata:Ye(S(),nt).optional()}).optional();J({sessionId:S().min(1).optional(),groupId:S().min(1).nullable().optional(),title:S().min(1).optional(),task:S().nullable().optional(),project:S().nullable().optional(),agent:S().nullable().optional(),status:ur.optional(),tags:fe(S()).optional(),metadata:Ye(S(),nt).optional()});J({includeHistory:Le().optional(),latestLogLimit:K().int().positive().max(50).optional()}).optional();J({run:hl,evidence:fl,session:Of.nullable(),timeline:fe(D2),classification:Pf,jenkinsReport:pl});const F2=J({run:hl,classification:Pf,evidence:fl.nullable(),jenkinsReport:pl.nullable(),sessionId:S(),inspectorUrl:S().nullable(),evidenceMarkdownPath:S().nullable(),updatedAt:S()});J({failures:fe(F2),total:K().int().nonnegative(),limit:K().int().positive()});const ml=Re(["created","running","completed","failed","cancelled"]),gl=Re(["evaluation","batch","manual"]),xl=J({jsonPath:S(),markdownPath:S(),htmlPath:S(),exportedAt:S()}),Lf=J({id:S(),groupId:S(),sessionId:S(),runId:S().nullable(),label:S().nullable(),agent:S().nullable(),provider:S().nullable(),model:S().nullable(),status:ur.nullable(),metadata:Ye(S(),nt),addedAt:S(),updatedAt:S()}),bl=J({id:S(),title:S(),kind:gl,task:S().nullable(),project:S().nullable(),status:ml,tags:fe(S()),metadata:Ye(S(),nt),evidence:xl.nullable(),members:fe(Lf),createdAt:S(),updatedAt:S()});J({groupId:S().min(1).optional(),title:S().min(1).optional(),kind:gl.optional(),task:S().nullable().optional(),project:S().nullable().optional(),status:ml.optional(),tags:fe(S()).optional(),metadata:Ye(S(),nt).optional()}).optional();J({title:S().min(1).optional(),kind:gl.optional(),task:S().nullable().optional(),project:S().nullable().optional(),status:ml.optional(),tags:fe(S()).optional(),metadata:Ye(S(),nt).optional()});J({memberId:S().min(1).optional(),sessionId:S().min(1),runId:S().min(1).nullable().optional(),label:S().min(1).nullable().optional(),agent:S().min(1).nullable().optional(),provider:S().min(1).nullable().optional(),model:S().min(1).nullable().optional(),status:ur.nullable().optional(),metadata:Ye(S(),nt).optional()});J({includeHistory:Le().optional(),latestLogLimit:K().int().positive().max(50).optional()}).optional();J({deleteEvidence:Le().optional()});const Df=J({groupId:S(),deleted:Le(),evidenceDeleted:Le(),evidencePath:S().nullable()}),$f=J({deleted:K().int().nonnegative(),groups:fe(Df)}),Ff=J({member:Lf,run:hl.nullable(),session:Of.nullable()}),Bf=J({memberCount:K().int().nonnegative(),sessionsWithData:K().int().nonnegative(),missingSessions:K().int().nonnegative(),requestCount:K().int().nonnegative(),errorCount:K().int().nonnegative(),tokenUsage:zf,models:fe(S()),providers:fe(S()),completedMembers:K().int().nonnegative(),failedMembers:K().int().nonnegative(),runningMembers:K().int().nonnegative()}),B2=J({group:bl,evidence:xl,members:fe(Ff).nullable(),markdown:S(),summary:Bf.nullable(),report:Mf.nullable()}),U2=J({group:bl,evidence:xl,members:fe(Ff),summary:Bf,jenkinsReport:Mf}),Uf=J({groups:fe(bl)}),W2=J({sessionId:S(),imported:K().int().nonnegative(),skipped:K().int().nonnegative(),warnings:fe(S()),logs:fe(er)}),uo=10,la=600,fo=60,ca=600,po="time",vl="simple",Wf=Re(["time","full"]),H2=Re(["simple","full"]),qo=J({stripClaudeCodeBillingHeader:Le(),hasSeenOnboarding:Le().default(!1),slowResponseThresholdSeconds:K().int().min(0).max(la).default(uo),providerTestTimeoutSeconds:K().int().min(1).max(ca).default(fo),timeDisplayFormat:Wf.default(po),captureMode:H2.default(vl)}),us="/api/config";async function V2(e){return pt(e,qo,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function kr(e){return pt(us,qo,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function yl(){const e=qt(us,V2,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=Dd(),n=e.data?.stripClaudeCodeBillingHeader??!1,s=e.data?.captureMode??vl,o=e.data?.slowResponseThresholdSeconds??uo,i=e.data?.providerTestTimeoutSeconds??fo,a=e.data?.timeDisplayFormat??po,l=h=>({stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:e.data?.hasSeenOnboarding??!1,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??uo,providerTestTimeoutSeconds:e.data?.providerTestTimeoutSeconds??fo,timeDisplayFormat:e.data?.timeDisplayFormat??po,captureMode:s,...h}),c=async h=>{await t(us,kr({stripClaudeCodeBillingHeader:h}),{optimisticData:l({stripClaudeCodeBillingHeader:h}),rollbackOnError:!0,revalidate:!1})},u=async h=>{await t(us,kr({slowResponseThresholdSeconds:h}),{optimisticData:l({slowResponseThresholdSeconds:h}),rollbackOnError:!0,revalidate:!1})},d=async h=>{await t(us,kr({timeDisplayFormat:h}),{optimisticData:l({timeDisplayFormat:h}),rollbackOnError:!0,revalidate:!1})},f=async h=>{await t(us,kr({providerTestTimeoutSeconds:h}),{optimisticData:l({providerTestTimeoutSeconds:h}),rollbackOnError:!0,revalidate:!1})};return{strip:n,captureMode:s,slowResponseThresholdSeconds:o,providerTestTimeoutSeconds:i,timeDisplayFormat:a,isLoading:e.isLoading,isError:e.error!==void 0,setStrip:c,setSlowResponseThresholdSeconds:u,setProviderTestTimeoutSeconds:f,setTimeDisplayFormat:d}}const Hf=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();const q2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Z2=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase());const Fc=e=>{const t=Z2(e);return t.charAt(0).toUpperCase()+t.slice(1)};var G2={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 K2=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const J2=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:o="",children:i,iconNode:a,...l},c)=>p.createElement("svg",{ref:c,...G2,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:Hf("lucide",o),...!i&&!K2(l)&&{"aria-hidden":"true"},...l},[...a.map(([u,d])=>p.createElement(u,d)),...Array.isArray(i)?i:[i]]));const de=(e,t)=>{const n=p.forwardRef(({className:s,...o},i)=>p.createElement(J2,{ref:i,iconNode:t,className:Hf(`lucide-${q2(Fc(e))}`,`lucide-${e}`,s),...o}));return n.displayName=Fc(e),n};const Y2=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],X2=de("activity",Y2);const Q2=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],ey=de("arrow-down-right",Q2);const ty=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ny=de("arrow-down",ty);const sy=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],ry=de("arrow-left",sy);const oy=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],iy=de("arrow-up-right",oy);const ay=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ly=de("arrow-up",ay);const cy=[["path",{d:"M4.5 3h15",key:"c7n0jr"}],["path",{d:"M6 3v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V3",key:"m1uhx7"}],["path",{d:"M6 14h12",key:"4cwo0f"}]],wl=de("beaker",cy);const uy=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],dy=de("bell",uy);const fy=[["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"}]],py=de("blocks",fy);const hy=[["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"}]],Vf=de("brain",hy);const my=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ge=de("check",my);const gy=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ot=de("chevron-down",gy);const xy=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],by=de("chevron-left",xy);const vy=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Tt=de("chevron-right",vy);const yy=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],_l=de("chevron-up",yy);const wy=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],_y=de("chevrons-down",wy);const ky=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],jy=de("chevrons-left",ky);const Sy=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Cy=de("chevrons-right",Sy);const Ny=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],Ty=de("chevrons-up",Ny);const Ey=[["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"}]],_s=de("circle-alert",Ey);const Ay=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],kl=de("circle-check-big",Ay);const Ry=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ua=de("circle-check",Ry);const Iy=[["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"}]],zy=de("circle-question-mark",Iy);const Oy=[["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"}]],qf=de("circle-x",Oy);const Py=[["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"}]],My=de("clapperboard",Py);const Ly=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Dy=de("clock-3",Ly);const $y=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],sn=de("clock",$y);const Fy=[["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"}]],By=de("cloud-upload",Fy);const Uy=[["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"}]],Wy=de("code-xml",Uy);const Hy=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Vy=de("columns-2",Hy);const qy=[["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"}]],At=de("copy",qy);const Zy=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],Gy=de("cpu",Zy);const Ky=[["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"}]],dr=de("download",Ky);const Jy=[["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"}]],Yy=de("ellipsis",Jy);const Xy=[["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"}]],jl=de("external-link",Xy);const Qy=[["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"}]],Sl=de("eye-off",Qy);const ew=[["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"}]],Cl=de("eye",ew);const tw=[["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"}]],nw=de("file-braces",tw);const sw=[["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"}]],rw=de("file-diff",sw);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"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],iw=de("file-search",ow);const aw=[["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"}]],lw=de("file-terminal",aw);const cw=[["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"}]],uw=de("file-text",cw);const dw=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],fw=de("flag",dw);const pw=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],Zf=de("flask-conical",pw);const hw=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],mw=de("folder-open",hw);const gw=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Nl=de("gauge",gw);const xw=[["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"}]],bw=de("git-compare-arrows",xw);const vw=[["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"}]],Gf=de("globe",vw);const yw=[["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"}]],Kf=de("history",yw);const ww=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],_w=de("info",ww);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"}]],Bc=de("layers",kw);const jw=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Qe=de("loader-circle",jw);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=de("lock",Sw);const Nw=[["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"}]],Zo=de("message-square",Nw);const Tw=[["path",{d:"M5 12h14",key:"1ays0h"}]],Jf=de("minus",Tw);const Ew=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Aw=de("monitor",Ew);const Rw=[["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"}]],Iw=de("mouse-pointer-click",Rw);const zw=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],Ow=de("network",zw);const Pw=[["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"}]],Mw=de("octagon-alert",Pw);const Lw=[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]],Dw=de("package-check",Lw);const $w=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],Fw=de("panel-right-close",$w);const Bw=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],Uw=de("panel-right-open",Bw);const Ww=[["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"}]],Yf=de("pencil",Ww);const Hw=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],da=de("plus",Hw);const Vw=[["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"}]],Uc=de("radio",Vw);const qw=[["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"}]],yn=de("refresh-cw",qw);const Zw=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],Xf=de("rocket",Zw);const Gw=[["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"}]],Kw=de("rotate-ccw",Gw);const Jw=[["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"}]],ho=de("rotate-cw",Jw);const Yw=[["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"}]],Xw=de("rows-3",Yw);const Qw=[["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"}]],e_=de("save",Qw);const t_=[["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"}]],n_=de("scan",t_);const s_=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Qf=de("search",s_);const r_=[["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"}]],o_=de("server",r_);const i_=[["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"}]],a_=de("settings",i_);const l_=[["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:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],c_=de("shield-alert",l_);const u_=[["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"}]],Wc=de("shield-check",u_);const d_=[["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"}]],fa=de("siren",d_);const f_=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Hc=de("sparkles",f_);const p_=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Es=de("terminal",p_);const h_=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],m_=de("timer",h_);const g_=[["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"}]],wn=de("trash-2",g_);const x_=[["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"}]],rn=de("triangle-alert",x_);const b_=[["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"}]],ep=de("upload",b_);const v_=[["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"}]],y_=de("wifi-off",v_);const w_=[["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"}]],__=de("wifi",w_);const k_=[["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"}]],As=de("wrench",k_);const j_=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],fr=de("x",j_);const S_=[["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"}]],tr=de("zap",S_),pa="/api/config";async function C_(e){return pt(e,qo,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function N_(e){return pt(pa,qo,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function T_(){const e=qt(pa,C_,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=Dd(),n=e.data?.hasSeenOnboarding??!1,s=e.data?.captureMode??vl,o=async()=>{await t(pa,N_({hasSeenOnboarding:!0}),{optimisticData:{stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:!0,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??uo,providerTestTimeoutSeconds:e.data?.providerTestTimeoutSeconds??fo,timeDisplayFormat:e.data?.timeDisplayFormat??po,captureMode:s},rollbackOnError:!0,revalidate:!1})};return{hasSeenOnboarding:n,captureMode:s,isLoading:e.isLoading,markSeen:o}}function E_(){const{hasSeenOnboarding:e,isLoading:t,markSeen:n}=T_(),[s,o]=p.useState(!1);if(t||e)return null;const i=s?"grid":"hidden sm:grid";return r.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:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(_w,{className:"mt-0.5 size-4 shrink-0 text-amber-300","aria-hidden":"true"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[r.jsx("span",{className:"font-medium text-amber-200",children:"Inspector ready"}),r.jsx("span",{className:"hidden truncate text-xs text-muted-foreground sm:inline",children:"Request, response, tool, timing, token, replay, and memory signals are active."})]}),r.jsx("div",{className:"mt-1 text-xs leading-relaxed text-muted-foreground sm:hidden",children:"Core capture is active."}),r.jsxs("div",{className:`${i} mt-2 gap-x-4 gap-y-1 text-xs leading-relaxed text-muted-foreground sm:grid-cols-2`,children:[r.jsxs("div",{children:[r.jsx("strong",{children:"Evidence"}),": logs, sessions, groups, and MCP exports are available."]}),r.jsxs("div",{children:[r.jsx("strong",{children:"Network"}),": replace ",r.jsx("code",{children:"localhost"})," if containers differ."]})]})]}),r.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":s,"aria-label":s?"Hide onboarding details":"Show onboarding details",children:r.jsx(ot,{className:`size-3.5 transition-transform ${s?"rotate-180":""}`})}),r.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:[r.jsx(Ge,{className:"size-3.5"}),"Got it"]}),r.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:r.jsx(fr,{className:"size-3.5"})})]})})}function jr(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 ji={exports:{}};var Vc;function A_(){return Vc||(Vc=1,(function(e,t){(function(n){e.exports=n()})(function(){return(function n(s,o,i){function a(u,d){if(!o[u]){if(!s[u]){var f=typeof jr=="function"&&jr;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 m=o[u]={exports:{}};s[u][0].call(m.exports,function(v){var g=s[u][1][v];return a(g||v)},m,m.exports,n,s,o,i)}return o[u].exports}for(var l=typeof jr=="function"&&jr,c=0;c<i.length;c++)a(i[c]);return a})({1:[function(n,s,o){var i=n("./utils"),a=n("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(c){for(var u,d,f,h,m,v,g,x=[],b=0,y=c.length,k=y,j=i.getTypeOf(c)!=="string";b<c.length;)k=y-b,f=j?(u=c[b++],d=b<y?c[b++]:0,b<y?c[b++]:0):(u=c.charCodeAt(b++),d=b<y?c.charCodeAt(b++):0,b<y?c.charCodeAt(b++):0),h=u>>2,m=(3&u)<<4|d>>4,v=1<k?(15&d)<<2|f>>6:64,g=2<k?63&f:64,x.push(l.charAt(h)+l.charAt(m)+l.charAt(v)+l.charAt(g));return x.join("")},o.decode=function(c){var u,d,f,h,m,v,g=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 y,k=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&k--,c.charAt(c.length-2)===l.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(y=a.uint8array?new Uint8Array(0|k):new Array(0|k);g<c.length;)u=l.indexOf(c.charAt(g++))<<2|(h=l.indexOf(c.charAt(g++)))>>4,d=(15&h)<<4|(m=l.indexOf(c.charAt(g++)))>>2,f=(3&m)<<6|(v=l.indexOf(c.charAt(g++))),y[x++]=u,m!==64&&(y[x++]=d),v!==64&&(y[x++]=f);return y}},{"./support":30,"./utils":32}],2:[function(n,s,o){var i=n("./external"),a=n("./stream/DataWorker"),l=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function u(d,f,h,m,v){this.compressedSize=d,this.uncompressedSize=f,this.crc32=h,this.compression=m,this.compressedContent=v}u.prototype={getContentWorker:function(){var d=new a(i.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(i.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)},s.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,s,o){var i=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,s,o){var i=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})();s.exports=function(l,c){return l!==void 0&&l.length?i.getTypeOf(l)!=="string"?(function(u,d,f,h){var m=a,v=h+f;u^=-1;for(var g=h;g<v;g++)u=u>>>8^m[255&(u^d[g])];return-1^u})(0|c,l,l.length,0):(function(u,d,f,h){var m=a,v=h+f;u^=-1;for(var g=h;g<v;g++)u=u>>>8^m[255&(u^d.charCodeAt(g))];return-1^u})(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(n,s,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,s,o){var i=null;i=typeof Promise<"u"?Promise:n("lie"),s.exports={Promise:i}},{lie:37}],7:[function(n,s,o){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=n("pako"),l=n("./utils"),c=n("./stream/GenericWorker"),u=i?"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,s,o){function i(m,v){var g,x="";for(g=0;g<v;g++)x+=String.fromCharCode(255&m),m>>>=8;return x}function a(m,v,g,x,b,y){var k,j,C=m.file,T=m.compression,N=y!==u.utf8encode,O=l.transformTo("string",y(C.name)),A=l.transformTo("string",u.utf8encode(C.name)),z=C.comment,D=l.transformTo("string",y(z)),E=l.transformTo("string",u.utf8encode(z)),L=A.length!==C.name.length,w=E.length!==z.length,$="",ee="",F="",W=C.dir,Z=C.date,ue={crc32:0,compressedSize:0,uncompressedSize:0};v&&!g||(ue.crc32=m.crc32,ue.compressedSize=m.compressedSize,ue.uncompressedSize=m.uncompressedSize);var V=0;v&&(V|=8),N||!L&&!w||(V|=2048);var H=0,le=0;W&&(H|=16),b==="UNIX"?(le=798,H|=(function(X,Ce){var ae=X;return X||(ae=Ce?16893:33204),(65535&ae)<<16})(C.unixPermissions,W)):(le=20,H|=(function(X){return 63&(X||0)})(C.dosPermissions)),k=Z.getUTCHours(),k<<=6,k|=Z.getUTCMinutes(),k<<=5,k|=Z.getUTCSeconds()/2,j=Z.getUTCFullYear()-1980,j<<=4,j|=Z.getUTCMonth()+1,j<<=5,j|=Z.getUTCDate(),L&&(ee=i(1,1)+i(d(O),4)+A,$+="up"+i(ee.length,2)+ee),w&&(F=i(1,1)+i(d(D),4)+E,$+="uc"+i(F.length,2)+F);var U="";return U+=`
|
|
41
|
-
\0`,U+=i(V,2),U+=T.magic,U+=i(k,2),U+=i(j,2),U+=i(ue.crc32,4),U+=i(ue.compressedSize,4),U+=i(ue.uncompressedSize,4),U+=i(O.length,2),U+=i($.length,2),{fileRecord:f.LOCAL_FILE_HEADER+U+O+$,dirRecord:f.CENTRAL_FILE_HEADER+i(le,2)+U+i(D.length,2)+"\0\0\0\0"+i(H,4)+i(x,4)+O+$+D}}var l=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function h(m,v,g,x){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=v,this.zipPlatform=g,this.encodeFileName=x,this.streamFiles=m,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(m){var v=m.meta.percent||0,g=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(m):(this.bytesWritten+=m.data.length,c.prototype.push.call(this,{data:m.data,meta:{currentFile:this.currentFile,percent:g?(v+100*(g-x-1))/g:100}}))},h.prototype.openedSource=function(m){this.currentSourceOffset=this.bytesWritten,this.currentFile=m.file.name;var v=this.streamFiles&&!m.file.dir;if(v){var g=a(m,v,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(m){this.accumulate=!1;var v=this.streamFiles&&!m.file.dir,g=a(m,v,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),v)this.push({data:(function(x){return f.DATA_DESCRIPTOR+i(x.crc32,4)+i(x.compressedSize,4)+i(x.uncompressedSize,4)})(m),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var m=this.bytesWritten,v=0;v<this.dirRecords.length;v++)this.push({data:this.dirRecords[v],meta:{percent:100}});var g=this.bytesWritten-m,x=(function(b,y,k,j,C){var T=l.transformTo("string",C(j));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(b,2)+i(b,2)+i(y,4)+i(k,4)+i(T.length,2)+T})(this.dirRecords.length,g,m,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(m){this._sources.push(m);var v=this;return m.on("data",function(g){v.processChunk(g)}),m.on("end",function(){v.closedSource(v.previous.streamInfo),v._sources.length?v.prepareNextSource():v.end()}),m.on("error",function(g){v.error(g)}),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(m){var v=this._sources;if(!c.prototype.error.call(this,m))return!1;for(var g=0;g<v.length;g++)try{v[g].error(m)}catch{}return!0},h.prototype.lock=function(){c.prototype.lock.call(this);for(var m=this._sources,v=0;v<m.length;v++)m[v].lock()},s.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,s,o){var i=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,m){f++;var v=(function(y,k){var j=y||k,C=i[j];if(!C)throw new Error(j+" is not a valid compression method !");return C})(m.options.compression,c.compression),g=m.options.compressionOptions||c.compressionOptions||{},x=m.dir,b=m.date;m._compressWorker(v,g).withStreamInfo("file",{name:h,dir:x,date:b,comment:m.comment||"",unixPermissions:m.unixPermissions,dosPermissions:m.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(h){d.error(h)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,s,o){function i(){if(!(this instanceof i))return new i;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 i;for(var l in this)typeof this[l]!="function"&&(a[l]=this[l]);return a}}(i.prototype=n("./object")).loadAsync=n("./load"),i.support=n("./support"),i.defaults=n("./defaults"),i.version="3.10.1",i.loadAsync=function(a,l){return new i().loadAsync(a,l)},i.external=n("./external"),s.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,s,o){var i=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(m,v){var g=h.decompressed.getContentWorker().pipe(new u);g.on("error",function(x){v(x)}).on("end",function(){g.streamInfo.crc32!==h.decompressed.crc32?v(new Error("Corrupted zip : CRC32 mismatch")):m()}).resume()})}s.exports=function(h,m){var v=this;return m=i.extend(m||{},{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.")):i.prepareContent("the loaded zip file",h,!0,m.optimizedBinaryString,m.base64).then(function(g){var x=new c(m);return x.load(g),x}).then(function(g){var x=[a.Promise.resolve(g)],b=g.files;if(m.checkCRC32)for(var y=0;y<b.length;y++)x.push(f(b[y]));return a.Promise.all(x)}).then(function(g){for(var x=g.shift(),b=x.files,y=0;y<b.length;y++){var k=b[y],j=k.fileNameStr,C=i.resolve(k.fileNameStr);v.file(C,k.decompressed,{binary:!0,optimizedBinaryString:!0,date:k.date,dir:k.dir,comment:k.fileCommentStr.length?k.fileCommentStr:null,unixPermissions:k.unixPermissions,dosPermissions:k.dosPermissions,createFolders:m.createFolders}),k.dir||(v.file(C).unsafeOriginalName=j)}return x.zipComment.length&&(v.comment=x.zipComment),v})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,s,o){var i=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)}i.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)},s.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,s,o){var i=n("readable-stream").Readable;function a(l,c,u){i.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,i),a.prototype._read=function(){this._helper.resume()},s.exports=a},{"../utils":32,"readable-stream":16}],14:[function(n,s,o){s.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,a){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,a);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,a)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var a=new Buffer(i);return a.fill(0),a},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(n,s,o){function i(C,T,N){var O,A=l.getTypeOf(T),z=l.extend(N||{},d);z.date=z.date||new Date,z.compression!==null&&(z.compression=z.compression.toUpperCase()),typeof z.unixPermissions=="string"&&(z.unixPermissions=parseInt(z.unixPermissions,8)),z.unixPermissions&&16384&z.unixPermissions&&(z.dir=!0),z.dosPermissions&&16&z.dosPermissions&&(z.dir=!0),z.dir&&(C=b(C)),z.createFolders&&(O=x(C))&&y.call(this,O,!0);var D=A==="string"&&z.binary===!1&&z.base64===!1;N&&N.binary!==void 0||(z.binary=!D),(T instanceof f&&T.uncompressedSize===0||z.dir||!T||T.length===0)&&(z.base64=!1,z.binary=!0,T="",z.compression="STORE",A="string");var E=null;E=T instanceof f||T instanceof c?T:v.isNode&&v.isStream(T)?new g(C,T):l.prepareContent(C,T,z.binary,z.optimizedBinaryString,z.base64);var L=new h(C,E,z);this.files[C]=L}var a=n("./utf8"),l=n("./utils"),c=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),h=n("./zipObject"),m=n("./generate"),v=n("./nodejsUtils"),g=n("./nodejs/NodejsStreamInputAdapter"),x=function(C){C.slice(-1)==="/"&&(C=C.substring(0,C.length-1));var T=C.lastIndexOf("/");return 0<T?C.substring(0,T):""},b=function(C){return C.slice(-1)!=="/"&&(C+="/"),C},y=function(C,T){return T=T!==void 0?T:d.createFolders,C=b(C),this.files[C]||i.call(this,C,null,{dir:!0,createFolders:T}),this.files[C]};function k(C){return Object.prototype.toString.call(C)==="[object RegExp]"}var j={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(C){var T,N,O;for(T in this.files)O=this.files[T],(N=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&C(N,O)},filter:function(C){var T=[];return this.forEach(function(N,O){C(N,O)&&T.push(O)}),T},file:function(C,T,N){if(arguments.length!==1)return C=this.root+C,i.call(this,C,T,N),this;if(k(C)){var O=C;return this.filter(function(z,D){return!D.dir&&O.test(z)})}var A=this.files[this.root+C];return A&&!A.dir?A:null},folder:function(C){if(!C)return this;if(k(C))return this.filter(function(A,z){return z.dir&&C.test(A)});var T=this.root+C,N=y.call(this,T),O=this.clone();return O.root=N.name,O},remove:function(C){C=this.root+C;var T=this.files[C];if(T||(C.slice(-1)!=="/"&&(C+="/"),T=this.files[C]),T&&!T.dir)delete this.files[C];else for(var N=this.filter(function(A,z){return z.name.slice(0,C.length)===C}),O=0;O<N.length;O++)delete this.files[N[O].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(C){var T,N={};try{if((N=l.extend(C||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:a.utf8encode})).type=N.type.toLowerCase(),N.compression=N.compression.toUpperCase(),N.type==="binarystring"&&(N.type="string"),!N.type)throw new Error("No output type specified.");l.checkSupport(N.type),N.platform!=="darwin"&&N.platform!=="freebsd"&&N.platform!=="linux"&&N.platform!=="sunos"||(N.platform="UNIX"),N.platform==="win32"&&(N.platform="DOS");var O=N.comment||this.comment||"";T=m.generateWorker(this,N,O)}catch(A){(T=new c("error")).error(A)}return new u(T,N.type||"string",N.mimeType)},generateAsync:function(C,T){return this.generateInternalStream(C).accumulate(T)},generateNodeStream:function(C,T){return(C=C||{}).type||(C.type="nodebuffer"),this.generateInternalStream(C).toNodejsStream(T)}};s.exports=j},{"./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,s,o){s.exports=n("stream")},{stream:void 0}],17:[function(n,s,o){var i=n("./DataReader");function a(l){i.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}n("../utils").inherits(a,i),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},s.exports=a},{"../utils":32,"./DataReader":18}],18:[function(n,s,o){var i=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 i.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))}},s.exports=a},{"../utils":32}],19:[function(n,s,o){var i=n("./Uint8ArrayReader");function a(l){i.call(this,l)}n("../utils").inherits(a,i),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},s.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,s,o){var i=n("./DataReader");function a(l){i.call(this,l)}n("../utils").inherits(a,i),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},s.exports=a},{"../utils":32,"./DataReader":18}],21:[function(n,s,o){var i=n("./ArrayReader");function a(l){i.call(this,l)}n("../utils").inherits(a,i),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},s.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(n,s,o){var i=n("../utils"),a=n("../support"),l=n("./ArrayReader"),c=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");s.exports=function(f){var h=i.getTypeOf(f);return i.checkSupport(h),h!=="string"||a.uint8array?h==="nodebuffer"?new u(f):a.uint8array?new d(i.transformTo("uint8array",f)):new l(i.transformTo("array",f)):new c(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,s,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,s,o){var i=n("./GenericWorker"),a=n("../utils");function l(c){i.call(this,"ConvertWorker to "+c),this.destType=c}a.inherits(l,i),l.prototype.processChunk=function(c){this.push({data:a.transformTo(this.destType,c.data),meta:c.meta})},s.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(n,s,o){var i=n("./GenericWorker"),a=n("../crc32");function l(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(l,i),l.prototype.processChunk=function(c){this.streamInfo.crc32=a(c.data,this.streamInfo.crc32||0),this.push(c)},s.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,s,o){var i=n("../utils"),a=n("./GenericWorker");function l(c){a.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}i.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)},s.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(n,s,o){var i=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=i.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}i.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,i.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.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}})},s.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(n,s,o){function i(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}i.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}},s.exports=i},{}],29:[function(n,s,o){var i=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(v,g){return new d.Promise(function(x,b){var y=[],k=v._internalType,j=v._outputType,C=v._mimeType;v.on("data",function(T,N){y.push(T),g&&g(N)}).on("error",function(T){y=[],b(T)}).on("end",function(){try{var T=(function(N,O,A){switch(N){case"blob":return i.newBlob(i.transformTo("arraybuffer",O),A);case"base64":return c.encode(O);default:return i.transformTo(N,O)}})(j,(function(N,O){var A,z=0,D=null,E=0;for(A=0;A<O.length;A++)E+=O[A].length;switch(N){case"string":return O.join("");case"array":return Array.prototype.concat.apply([],O);case"uint8array":for(D=new Uint8Array(E),A=0;A<O.length;A++)D.set(O[A],z),z+=O[A].length;return D;case"nodebuffer":return Buffer.concat(O);default:throw new Error("concat : unsupported type '"+N+"'")}})(k,y),C);x(T)}catch(N){b(N)}y=[]}).resume()})}function m(v,g,x){var b=g;switch(g){case"blob":case"arraybuffer":b="uint8array";break;case"base64":b="string"}try{this._internalType=b,this._outputType=g,this._mimeType=x,i.checkSupport(b),this._worker=v.pipe(new a(b)),v.lock()}catch(y){this._worker=new l("error"),this._worker.error(y)}}m.prototype={accumulate:function(v){return h(this,v)},on:function(v,g){var x=this;return v==="data"?this._worker.on(v,function(b){g.call(x,b.data,b.meta)}):this._worker.on(v,function(){i.delay(g,arguments,x)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(v){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},v)}},s.exports=m},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,s,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 i=new ArrayBuffer(0);try{o.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(i),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,s,o){for(var i=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(m){return a.nodebuffer?l.newBufferFrom(m,"utf-8"):(function(v){var g,x,b,y,k,j=v.length,C=0;for(y=0;y<j;y++)(64512&(x=v.charCodeAt(y)))==55296&&y+1<j&&(64512&(b=v.charCodeAt(y+1)))==56320&&(x=65536+(x-55296<<10)+(b-56320),y++),C+=x<128?1:x<2048?2:x<65536?3:4;for(g=a.uint8array?new Uint8Array(C):new Array(C),y=k=0;k<C;y++)(64512&(x=v.charCodeAt(y)))==55296&&y+1<j&&(64512&(b=v.charCodeAt(y+1)))==56320&&(x=65536+(x-55296<<10)+(b-56320),y++),x<128?g[k++]=x:(x<2048?g[k++]=192|x>>>6:(x<65536?g[k++]=224|x>>>12:(g[k++]=240|x>>>18,g[k++]=128|x>>>12&63),g[k++]=128|x>>>6&63),g[k++]=128|63&x);return g})(m)},o.utf8decode=function(m){return a.nodebuffer?i.transformTo("nodebuffer",m).toString("utf-8"):(function(v){var g,x,b,y,k=v.length,j=new Array(2*k);for(g=x=0;g<k;)if((b=v[g++])<128)j[x++]=b;else if(4<(y=u[b]))j[x++]=65533,g+=y-1;else{for(b&=y===2?31:y===3?15:7;1<y&&g<k;)b=b<<6|63&v[g++],y--;1<y?j[x++]=65533:b<65536?j[x++]=b:(b-=65536,j[x++]=55296|b>>10&1023,j[x++]=56320|1023&b)}return j.length!==x&&(j.subarray?j=j.subarray(0,x):j.length=x),i.applyFromCharCode(j)})(m=i.transformTo(a.uint8array?"uint8array":"array",m))},i.inherits(f,c),f.prototype.processChunk=function(m){var v=i.transformTo(a.uint8array?"uint8array":"array",m.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var g=v;(v=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),v.set(g,this.leftOver.length)}else v=this.leftOver.concat(v);this.leftOver=null}var x=(function(y,k){var j;for((k=k||y.length)>y.length&&(k=y.length),j=k-1;0<=j&&(192&y[j])==128;)j--;return j<0||j===0?k:j+u[y[j]]>k?j:k})(v),b=v;x!==v.length&&(a.uint8array?(b=v.subarray(0,x),this.leftOver=v.subarray(x,v.length)):(b=v.slice(0,x),this.leftOver=v.slice(x,v.length))),this.push({data:o.utf8decode(b),meta:m.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=f,i.inherits(h,c),h.prototype.processChunk=function(m){this.push({data:o.utf8encode(m.data),meta:m.meta})},o.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,s,o){var i=n("./support"),a=n("./base64"),l=n("./nodejsUtils"),c=n("./external");function u(g){return g}function d(g,x){for(var b=0;b<g.length;++b)x[b]=255&g.charCodeAt(b);return x}n("setimmediate"),o.newBlob=function(g,x){o.checkSupport("blob");try{return new Blob([g],{type:x})}catch{try{var b=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return b.append(g),b.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(g,x,b){var y=[],k=0,j=g.length;if(j<=b)return String.fromCharCode.apply(null,g);for(;k<j;)x==="array"||x==="nodebuffer"?y.push(String.fromCharCode.apply(null,g.slice(k,Math.min(k+b,j)))):y.push(String.fromCharCode.apply(null,g.subarray(k,Math.min(k+b,j)))),k+=b;return y.join("")},stringifyByChar:function(g){for(var x="",b=0;b<g.length;b++)x+=String.fromCharCode(g[b]);return x},applyCanBeUsed:{uint8array:(function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}})()}};function h(g){var x=65536,b=o.getTypeOf(g),y=!0;if(b==="uint8array"?y=f.applyCanBeUsed.uint8array:b==="nodebuffer"&&(y=f.applyCanBeUsed.nodebuffer),y)for(;1<x;)try{return f.stringifyByChunk(g,b,x)}catch{x=Math.floor(x/2)}return f.stringifyByChar(g)}function m(g,x){for(var b=0;b<g.length;b++)x[b]=g[b];return x}o.applyFromCharCode=h;var v={};v.string={string:u,array:function(g){return d(g,new Array(g.length))},arraybuffer:function(g){return v.string.uint8array(g).buffer},uint8array:function(g){return d(g,new Uint8Array(g.length))},nodebuffer:function(g){return d(g,l.allocBuffer(g.length))}},v.array={string:h,array:u,arraybuffer:function(g){return new Uint8Array(g).buffer},uint8array:function(g){return new Uint8Array(g)},nodebuffer:function(g){return l.newBufferFrom(g)}},v.arraybuffer={string:function(g){return h(new Uint8Array(g))},array:function(g){return m(new Uint8Array(g),new Array(g.byteLength))},arraybuffer:u,uint8array:function(g){return new Uint8Array(g)},nodebuffer:function(g){return l.newBufferFrom(new Uint8Array(g))}},v.uint8array={string:h,array:function(g){return m(g,new Array(g.length))},arraybuffer:function(g){return g.buffer},uint8array:u,nodebuffer:function(g){return l.newBufferFrom(g)}},v.nodebuffer={string:h,array:function(g){return m(g,new Array(g.length))},arraybuffer:function(g){return v.nodebuffer.uint8array(g).buffer},uint8array:function(g){return m(g,new Uint8Array(g.length))},nodebuffer:u},o.transformTo=function(g,x){if(x=x||"",!g)return x;o.checkSupport(g);var b=o.getTypeOf(x);return v[b][g](x)},o.resolve=function(g){for(var x=g.split("/"),b=[],y=0;y<x.length;y++){var k=x[y];k==="."||k===""&&y!==0&&y!==x.length-1||(k===".."?b.pop():b.push(k))}return b.join("/")},o.getTypeOf=function(g){return typeof g=="string"?"string":Object.prototype.toString.call(g)==="[object Array]"?"array":i.nodebuffer&&l.isBuffer(g)?"nodebuffer":i.uint8array&&g instanceof Uint8Array?"uint8array":i.arraybuffer&&g instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(g){if(!i[g.toLowerCase()])throw new Error(g+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(g){var x,b,y="";for(b=0;b<(g||"").length;b++)y+="\\x"+((x=g.charCodeAt(b))<16?"0":"")+x.toString(16).toUpperCase();return y},o.delay=function(g,x,b){setImmediate(function(){g.apply(b||null,x||[])})},o.inherits=function(g,x){function b(){}b.prototype=x.prototype,g.prototype=new b},o.extend=function(){var g,x,b={};for(g=0;g<arguments.length;g++)for(x in arguments[g])Object.prototype.hasOwnProperty.call(arguments[g],x)&&b[x]===void 0&&(b[x]=arguments[g][x]);return b},o.prepareContent=function(g,x,b,y,k){return c.Promise.resolve(x).then(function(j){return i.blob&&(j instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(j))!==-1)&&typeof FileReader<"u"?new c.Promise(function(C,T){var N=new FileReader;N.onload=function(O){C(O.target.result)},N.onerror=function(O){T(O.target.error)},N.readAsArrayBuffer(j)}):j}).then(function(j){var C=o.getTypeOf(j);return C?(C==="arraybuffer"?j=o.transformTo("uint8array",j):C==="string"&&(k?j=a.decode(j):b&&y!==!0&&(j=(function(T){return d(T,i.uint8array?new Uint8Array(T.length):new Array(T.length))})(j))),j):c.Promise.reject(new Error("Can't read the data of '"+g+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,s,o){var i=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 m=this.reader.index;this.reader.setIndex(f);var v=this.reader.readString(4)===h;return this.reader.setIndex(m),v},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",m=a.transformTo(h,f);this.zipComment=this.loadOptions.decodeFileName(m)},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,m,v=this.zip64EndOfCentralSize-44;0<v;)f=this.reader.readInt(2),h=this.reader.readInt(4),m=this.reader.readData(h),this.zip64ExtensibleData[f]={id:f,length:h,value:m}},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 m=this.centralDirOffset+this.centralDirSize;this.zip64&&(m+=20,m+=12+this.zip64EndOfCentralSize);var v=h-m;if(0<v)this.isSignature(h,l.CENTRAL_FILE_HEADER)||(this.reader.zero=v);else if(v<0)throw new Error("Corrupted zip: missing "+Math.abs(v)+" bytes.")},prepareReader:function(f){this.reader=i(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},s.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,s,o){var i=n("./reader/readerFor"),a=n("./utils"),l=n("./compressedObject"),c=n("./crc32"),u=n("./utf8"),d=n("./compressions"),f=n("./support");function h(m,v){this.options=m,this.loadOptions=v}h.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(m){var v,g;if(m.skip(22),this.fileNameLength=m.readInt(2),g=m.readInt(2),this.fileName=m.readData(this.fileNameLength),m.skip(g),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((v=(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,v,m.readData(this.compressedSize))},readCentralPart:function(m){this.versionMadeBy=m.readInt(2),m.skip(2),this.bitFlag=m.readInt(2),this.compressionMethod=m.readString(2),this.date=m.readDate(),this.crc32=m.readInt(4),this.compressedSize=m.readInt(4),this.uncompressedSize=m.readInt(4);var v=m.readInt(2);if(this.extraFieldsLength=m.readInt(2),this.fileCommentLength=m.readInt(2),this.diskNumberStart=m.readInt(2),this.internalFileAttributes=m.readInt(2),this.externalFileAttributes=m.readInt(4),this.localHeaderOffset=m.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");m.skip(v),this.readExtraFields(m),this.parseZIP64ExtraField(m),this.fileComment=m.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var m=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),m==0&&(this.dosPermissions=63&this.externalFileAttributes),m==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var m=i(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=m.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=m.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=m.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=m.readInt(4))}},readExtraFields:function(m){var v,g,x,b=m.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});m.index+4<b;)v=m.readInt(2),g=m.readInt(2),x=m.readData(g),this.extraFields[v]={id:v,length:g,value:x};m.setIndex(b)},handleUTF8:function(){var m=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var v=this.findExtraFieldUnicodePath();if(v!==null)this.fileNameStr=v;else{var g=a.transformTo(m,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(g)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var b=a.transformTo(m,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(b)}}},findExtraFieldUnicodePath:function(){var m=this.extraFields[28789];if(m){var v=i(m.value);return v.readInt(1)!==1||c(this.fileName)!==v.readInt(4)?null:u.utf8decode(v.readData(m.length-5))}return null},findExtraFieldUnicodeComment:function(){var m=this.extraFields[25461];if(m){var v=i(m.value);return v.readInt(1)!==1||c(this.fileComment)!==v.readInt(4)?null:u.utf8decode(v.readData(m.length-5))}return null}},s.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,s,o){function i(v,g,x){this.name=v,this.dir=x.dir,this.date=x.date,this.comment=x.comment,this.unixPermissions=x.unixPermissions,this.dosPermissions=x.dosPermissions,this._data=g,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");i.prototype={internalStream:function(v){var g=null,x="string";try{if(!v)throw new Error("No output type specified.");var b=(x=v.toLowerCase())==="string"||x==="text";x!=="binarystring"&&x!=="text"||(x="string"),g=this._decompressWorker();var y=!this._dataBinary;y&&!b&&(g=g.pipe(new c.Utf8EncodeWorker)),!y&&b&&(g=g.pipe(new c.Utf8DecodeWorker))}catch(k){(g=new d("error")).error(k)}return new a(g,x,"")},async:function(v,g){return this.internalStream(v).accumulate(g)},nodeStream:function(v,g){return this.internalStream(v||"nodebuffer").toNodejsStream(g)},_compressWorker:function(v,g){if(this._data instanceof u&&this._data.compression.magic===v.magic)return this._data.getCompressedWorker();var x=this._decompressWorker();return this._dataBinary||(x=x.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(x,v,g)},_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.")},m=0;m<f.length;m++)i.prototype[f[m]]=h;s.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,s,o){(function(i){var a,l,c=i.MutationObserver||i.WebKitMutationObserver;if(c){var u=0,d=new c(v),f=i.document.createTextNode("");d.observe(f,{characterData:!0}),a=function(){f.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)a="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var g=i.document.createElement("script");g.onreadystatechange=function(){v(),g.onreadystatechange=null,g.parentNode.removeChild(g),g=null},i.document.documentElement.appendChild(g)}:function(){setTimeout(v,0)};else{var h=new i.MessageChannel;h.port1.onmessage=v,a=function(){h.port2.postMessage(0)}}var m=[];function v(){var g,x;l=!0;for(var b=m.length;b;){for(x=m,m=[],g=-1;++g<b;)x[g]();b=m.length}l=!1}s.exports=function(g){m.push(g)!==1||l||a()}}).call(this,typeof vr<"u"?vr:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,s,o){var i=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&&g(this,b)}function h(b,y,k){this.promise=b,typeof y=="function"&&(this.onFulfilled=y,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function m(b,y,k){i(function(){var j;try{j=y(k)}catch(C){return l.reject(b,C)}j===b?l.reject(b,new TypeError("Cannot resolve promise with itself")):l.resolve(b,j)})}function v(b){var y=b&&b.then;if(b&&(typeof b=="object"||typeof b=="function")&&typeof y=="function")return function(){y.apply(b,arguments)}}function g(b,y){var k=!1;function j(N){k||(k=!0,l.reject(b,N))}function C(N){k||(k=!0,l.resolve(b,N))}var T=x(function(){y(C,j)});T.status==="error"&&j(T.value)}function x(b,y){var k={};try{k.value=b(y),k.status="success"}catch(j){k.status="error",k.value=j}return k}(s.exports=f).prototype.finally=function(b){if(typeof b!="function")return this;var y=this.constructor;return this.then(function(k){return y.resolve(b()).then(function(){return k})},function(k){return y.resolve(b()).then(function(){throw k})})},f.prototype.catch=function(b){return this.then(null,b)},f.prototype.then=function(b,y){if(typeof b!="function"&&this.state===u||typeof y!="function"&&this.state===c)return this;var k=new this.constructor(a);return this.state!==d?m(k,this.state===u?b:y,this.outcome):this.queue.push(new h(k,b,y)),k},h.prototype.callFulfilled=function(b){l.resolve(this.promise,b)},h.prototype.otherCallFulfilled=function(b){m(this.promise,this.onFulfilled,b)},h.prototype.callRejected=function(b){l.reject(this.promise,b)},h.prototype.otherCallRejected=function(b){m(this.promise,this.onRejected,b)},l.resolve=function(b,y){var k=x(v,y);if(k.status==="error")return l.reject(b,k.value);var j=k.value;if(j)g(b,j);else{b.state=u,b.outcome=y;for(var C=-1,T=b.queue.length;++C<T;)b.queue[C].callFulfilled(y)}return b},l.reject=function(b,y){b.state=c,b.outcome=y;for(var k=-1,j=b.queue.length;++k<j;)b.queue[k].callRejected(y);return b},f.resolve=function(b){return b instanceof this?b:l.resolve(new this(a),b)},f.reject=function(b){var y=new this(a);return l.reject(y,b)},f.all=function(b){var y=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=b.length,j=!1;if(!k)return this.resolve([]);for(var C=new Array(k),T=0,N=-1,O=new this(a);++N<k;)A(b[N],N);return O;function A(z,D){y.resolve(z).then(function(E){C[D]=E,++T!==k||j||(j=!0,l.resolve(O,C))},function(E){j||(j=!0,l.reject(O,E))})}},f.race=function(b){var y=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=b.length,j=!1;if(!k)return this.resolve([]);for(var C=-1,T=new this(a);++C<k;)N=b[C],y.resolve(N).then(function(O){j||(j=!0,l.resolve(T,O))},function(O){j||(j=!0,l.reject(T,O))});var N;return T}},{immediate:36}],38:[function(n,s,o){var i={};(0,n("./lib/utils/common").assign)(i,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),s.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,s,o){var i=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,m=0,v=8;function g(b){if(!(this instanceof g))return new g(b);this.options=a.assign({level:h,method:v,chunkSize:16384,windowBits:15,memLevel:8,strategy:m,to:""},b||{});var y=this.options;y.raw&&0<y.windowBits?y.windowBits=-y.windowBits:y.gzip&&0<y.windowBits&&y.windowBits<16&&(y.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var k=i.deflateInit2(this.strm,y.level,y.method,y.windowBits,y.memLevel,y.strategy);if(k!==f)throw new Error(c[k]);if(y.header&&i.deflateSetHeader(this.strm,y.header),y.dictionary){var j;if(j=typeof y.dictionary=="string"?l.string2buf(y.dictionary):d.call(y.dictionary)==="[object ArrayBuffer]"?new Uint8Array(y.dictionary):y.dictionary,(k=i.deflateSetDictionary(this.strm,j))!==f)throw new Error(c[k]);this._dict_set=!0}}function x(b,y){var k=new g(y);if(k.push(b,!0),k.err)throw k.msg||c[k.err];return k.result}g.prototype.push=function(b,y){var k,j,C=this.strm,T=this.options.chunkSize;if(this.ended)return!1;j=y===~~y?y:y===!0?4:0,typeof b=="string"?C.input=l.string2buf(b):d.call(b)==="[object ArrayBuffer]"?C.input=new Uint8Array(b):C.input=b,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new a.Buf8(T),C.next_out=0,C.avail_out=T),(k=i.deflate(C,j))!==1&&k!==f)return this.onEnd(k),!(this.ended=!0);C.avail_out!==0&&(C.avail_in!==0||j!==4&&j!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(a.shrinkBuf(C.output,C.next_out))):this.onData(a.shrinkBuf(C.output,C.next_out)))}while((0<C.avail_in||C.avail_out===0)&&k!==1);return j===4?(k=i.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===f):j!==2||(this.onEnd(f),!(C.avail_out=0))},g.prototype.onData=function(b){this.chunks.push(b)},g.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=g,o.deflate=x,o.deflateRaw=function(b,y){return(y=y||{}).raw=!0,x(b,y)},o.gzip=function(b,y){return(y=y||{}).gzip=!0,x(b,y)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,s,o){var i=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 m(g){if(!(this instanceof m))return new m(g);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},g||{});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)||g&&g.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=i.inflateInit2(this.strm,x.windowBits);if(b!==c.Z_OK)throw new Error(u[b]);this.header=new f,i.inflateGetHeader(this.strm,this.header)}function v(g,x){var b=new m(x);if(b.push(g,!0),b.err)throw b.msg||u[b.err];return b.result}m.prototype.push=function(g,x){var b,y,k,j,C,T,N=this.strm,O=this.options.chunkSize,A=this.options.dictionary,z=!1;if(this.ended)return!1;y=x===~~x?x:x===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof g=="string"?N.input=l.binstring2buf(g):h.call(g)==="[object ArrayBuffer]"?N.input=new Uint8Array(g):N.input=g,N.next_in=0,N.avail_in=N.input.length;do{if(N.avail_out===0&&(N.output=new a.Buf8(O),N.next_out=0,N.avail_out=O),(b=i.inflate(N,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&A&&(T=typeof A=="string"?l.string2buf(A):h.call(A)==="[object ArrayBuffer]"?new Uint8Array(A):A,b=i.inflateSetDictionary(this.strm,T)),b===c.Z_BUF_ERROR&&z===!0&&(b=c.Z_OK,z=!1),b!==c.Z_STREAM_END&&b!==c.Z_OK)return this.onEnd(b),!(this.ended=!0);N.next_out&&(N.avail_out!==0&&b!==c.Z_STREAM_END&&(N.avail_in!==0||y!==c.Z_FINISH&&y!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=l.utf8border(N.output,N.next_out),j=N.next_out-k,C=l.buf2string(N.output,k),N.next_out=j,N.avail_out=O-j,j&&a.arraySet(N.output,N.output,k,j,0),this.onData(C)):this.onData(a.shrinkBuf(N.output,N.next_out)))),N.avail_in===0&&N.avail_out===0&&(z=!0)}while((0<N.avail_in||N.avail_out===0)&&b!==c.Z_STREAM_END);return b===c.Z_STREAM_END&&(y=c.Z_FINISH),y===c.Z_FINISH?(b=i.inflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===c.Z_OK):y!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(N.avail_out=0))},m.prototype.onData=function(g){this.chunks.push(g)},m.prototype.onEnd=function(g){g===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},o.Inflate=m,o.inflate=v,o.inflateRaw=function(g,x){return(x=x||{}).raw=!0,v(g,x)},o.ungzip=v},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,s,o){var i=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 m=0;m<f;m++)c[h+m]=u[d+m]},flattenChunks:function(c){var u,d,f,h,m,v;for(u=f=0,d=c.length;u<d;u++)f+=c[u].length;for(v=new Uint8Array(f),u=h=0,d=c.length;u<d;u++)m=c[u],v.set(m,h),h+=m.length;return v}},l={arraySet:function(c,u,d,f,h){for(var m=0;m<f;m++)c[h+m]=u[d+m]},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(i)},{}],42:[function(n,s,o){var i=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 i.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,i.shrinkBuf(f,h));for(var m="",v=0;v<h;v++)m+=String.fromCharCode(f[v]);return m}c[254]=c[254]=1,o.string2buf=function(f){var h,m,v,g,x,b=f.length,y=0;for(g=0;g<b;g++)(64512&(m=f.charCodeAt(g)))==55296&&g+1<b&&(64512&(v=f.charCodeAt(g+1)))==56320&&(m=65536+(m-55296<<10)+(v-56320),g++),y+=m<128?1:m<2048?2:m<65536?3:4;for(h=new i.Buf8(y),g=x=0;x<y;g++)(64512&(m=f.charCodeAt(g)))==55296&&g+1<b&&(64512&(v=f.charCodeAt(g+1)))==56320&&(m=65536+(m-55296<<10)+(v-56320),g++),m<128?h[x++]=m:(m<2048?h[x++]=192|m>>>6:(m<65536?h[x++]=224|m>>>12:(h[x++]=240|m>>>18,h[x++]=128|m>>>12&63),h[x++]=128|m>>>6&63),h[x++]=128|63&m);return h},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var h=new i.Buf8(f.length),m=0,v=h.length;m<v;m++)h[m]=f.charCodeAt(m);return h},o.buf2string=function(f,h){var m,v,g,x,b=h||f.length,y=new Array(2*b);for(m=v=0;m<b;)if((g=f[m++])<128)y[v++]=g;else if(4<(x=c[g]))y[v++]=65533,m+=x-1;else{for(g&=x===2?31:x===3?15:7;1<x&&m<b;)g=g<<6|63&f[m++],x--;1<x?y[v++]=65533:g<65536?y[v++]=g:(g-=65536,y[v++]=55296|g>>10&1023,y[v++]=56320|1023&g)}return d(y,v)},o.utf8border=function(f,h){var m;for((h=h||f.length)>f.length&&(h=f.length),m=h-1;0<=m&&(192&f[m])==128;)m--;return m<0||m===0?h:m+c[f[m]]>h?m:h}},{"./common":41}],43:[function(n,s,o){s.exports=function(i,a,l,c){for(var u=65535&i|0,d=i>>>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,s,o){s.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,s,o){var i=(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})();s.exports=function(a,l,c,u){var d=i,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,s,o){var i,a=n("../utils/common"),l=n("./trees"),c=n("./adler32"),u=n("./crc32"),d=n("./messages"),f=0,h=4,m=0,v=-2,g=-1,x=4,b=2,y=8,k=9,j=286,C=30,T=19,N=2*j+1,O=15,A=3,z=258,D=z+A+1,E=42,L=113,w=1,$=2,ee=3,F=4;function W(_,Q){return _.msg=d[Q],Q}function Z(_){return(_<<1)-(4<_?9:0)}function ue(_){for(var Q=_.length;0<=--Q;)_[Q]=0}function V(_){var Q=_.state,G=Q.pending;G>_.avail_out&&(G=_.avail_out),G!==0&&(a.arraySet(_.output,Q.pending_buf,Q.pending_out,G,_.next_out),_.next_out+=G,Q.pending_out+=G,_.total_out+=G,_.avail_out-=G,Q.pending-=G,Q.pending===0&&(Q.pending_out=0))}function H(_,Q){l._tr_flush_block(_,0<=_.block_start?_.block_start:-1,_.strstart-_.block_start,Q),_.block_start=_.strstart,V(_.strm)}function le(_,Q){_.pending_buf[_.pending++]=Q}function U(_,Q){_.pending_buf[_.pending++]=Q>>>8&255,_.pending_buf[_.pending++]=255&Q}function X(_,Q){var G,P,R=_.max_chain_length,B=_.strstart,se=_.prev_length,ne=_.nice_match,q=_.strstart>_.w_size-D?_.strstart-(_.w_size-D):0,ce=_.window,I=_.w_mask,M=_.prev,Y=_.strstart+z,re=ce[B+se-1],oe=ce[B+se];_.prev_length>=_.good_match&&(R>>=2),ne>_.lookahead&&(ne=_.lookahead);do if(ce[(G=Q)+se]===oe&&ce[G+se-1]===re&&ce[G]===ce[B]&&ce[++G]===ce[B+1]){B+=2,G++;do;while(ce[++B]===ce[++G]&&ce[++B]===ce[++G]&&ce[++B]===ce[++G]&&ce[++B]===ce[++G]&&ce[++B]===ce[++G]&&ce[++B]===ce[++G]&&ce[++B]===ce[++G]&&ce[++B]===ce[++G]&&B<Y);if(P=z-(Y-B),B=Y-z,se<P){if(_.match_start=Q,ne<=(se=P))break;re=ce[B+se-1],oe=ce[B+se]}}while((Q=M[Q&I])>q&&--R!=0);return se<=_.lookahead?se:_.lookahead}function Ce(_){var Q,G,P,R,B,se,ne,q,ce,I,M=_.w_size;do{if(R=_.window_size-_.lookahead-_.strstart,_.strstart>=M+(M-D)){for(a.arraySet(_.window,_.window,M,M,0),_.match_start-=M,_.strstart-=M,_.block_start-=M,Q=G=_.hash_size;P=_.head[--Q],_.head[Q]=M<=P?P-M:0,--G;);for(Q=G=M;P=_.prev[--Q],_.prev[Q]=M<=P?P-M:0,--G;);R+=M}if(_.strm.avail_in===0)break;if(se=_.strm,ne=_.window,q=_.strstart+_.lookahead,ce=R,I=void 0,I=se.avail_in,ce<I&&(I=ce),G=I===0?0:(se.avail_in-=I,a.arraySet(ne,se.input,se.next_in,I,q),se.state.wrap===1?se.adler=c(se.adler,ne,I,q):se.state.wrap===2&&(se.adler=u(se.adler,ne,I,q)),se.next_in+=I,se.total_in+=I,I),_.lookahead+=G,_.lookahead+_.insert>=A)for(B=_.strstart-_.insert,_.ins_h=_.window[B],_.ins_h=(_.ins_h<<_.hash_shift^_.window[B+1])&_.hash_mask;_.insert&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[B+A-1])&_.hash_mask,_.prev[B&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=B,B++,_.insert--,!(_.lookahead+_.insert<A)););}while(_.lookahead<D&&_.strm.avail_in!==0)}function ae(_,Q){for(var G,P;;){if(_.lookahead<D){if(Ce(_),_.lookahead<D&&Q===f)return w;if(_.lookahead===0)break}if(G=0,_.lookahead>=A&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+A-1])&_.hash_mask,G=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),G!==0&&_.strstart-G<=_.w_size-D&&(_.match_length=X(_,G)),_.match_length>=A)if(P=l._tr_tally(_,_.strstart-_.match_start,_.match_length-A),_.lookahead-=_.match_length,_.match_length<=_.max_lazy_match&&_.lookahead>=A){for(_.match_length--;_.strstart++,_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+A-1])&_.hash_mask,G=_.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 P=l._tr_tally(_,0,_.window[_.strstart]),_.lookahead--,_.strstart++;if(P&&(H(_,!1),_.strm.avail_out===0))return w}return _.insert=_.strstart<A-1?_.strstart:A-1,Q===h?(H(_,!0),_.strm.avail_out===0?ee:F):_.last_lit&&(H(_,!1),_.strm.avail_out===0)?w:$}function ge(_,Q){for(var G,P,R;;){if(_.lookahead<D){if(Ce(_),_.lookahead<D&&Q===f)return w;if(_.lookahead===0)break}if(G=0,_.lookahead>=A&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+A-1])&_.hash_mask,G=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),_.prev_length=_.match_length,_.prev_match=_.match_start,_.match_length=A-1,G!==0&&_.prev_length<_.max_lazy_match&&_.strstart-G<=_.w_size-D&&(_.match_length=X(_,G),_.match_length<=5&&(_.strategy===1||_.match_length===A&&4096<_.strstart-_.match_start)&&(_.match_length=A-1)),_.prev_length>=A&&_.match_length<=_.prev_length){for(R=_.strstart+_.lookahead-A,P=l._tr_tally(_,_.strstart-1-_.prev_match,_.prev_length-A),_.lookahead-=_.prev_length-1,_.prev_length-=2;++_.strstart<=R&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+A-1])&_.hash_mask,G=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),--_.prev_length!=0;);if(_.match_available=0,_.match_length=A-1,_.strstart++,P&&(H(_,!1),_.strm.avail_out===0))return w}else if(_.match_available){if((P=l._tr_tally(_,0,_.window[_.strstart-1]))&&H(_,!1),_.strstart++,_.lookahead--,_.strm.avail_out===0)return w}else _.match_available=1,_.strstart++,_.lookahead--}return _.match_available&&(P=l._tr_tally(_,0,_.window[_.strstart-1]),_.match_available=0),_.insert=_.strstart<A-1?_.strstart:A-1,Q===h?(H(_,!0),_.strm.avail_out===0?ee:F):_.last_lit&&(H(_,!1),_.strm.avail_out===0)?w:$}function xe(_,Q,G,P,R){this.good_length=_,this.max_lazy=Q,this.nice_length=G,this.max_chain=P,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=y,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*N),this.dyn_dtree=new a.Buf16(2*(2*C+1)),this.bl_tree=new a.Buf16(2*(2*T+1)),ue(this.dyn_ltree),ue(this.dyn_dtree),ue(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new a.Buf16(O+1),this.heap=new a.Buf16(2*j+1),ue(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new a.Buf16(2*j+1),ue(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 be(_){var Q;return _&&_.state?(_.total_in=_.total_out=0,_.data_type=b,(Q=_.state).pending=0,Q.pending_out=0,Q.wrap<0&&(Q.wrap=-Q.wrap),Q.status=Q.wrap?E:L,_.adler=Q.wrap===2?0:1,Q.last_flush=f,l._tr_init(Q),m):W(_,v)}function Se(_){var Q=be(_);return Q===m&&(function(G){G.window_size=2*G.w_size,ue(G.head),G.max_lazy_match=i[G.level].max_lazy,G.good_match=i[G.level].good_length,G.nice_match=i[G.level].nice_length,G.max_chain_length=i[G.level].max_chain,G.strstart=0,G.block_start=0,G.lookahead=0,G.insert=0,G.match_length=G.prev_length=A-1,G.match_available=0,G.ins_h=0})(_.state),Q}function Ie(_,Q,G,P,R,B){if(!_)return v;var se=1;if(Q===g&&(Q=6),P<0?(se=0,P=-P):15<P&&(se=2,P-=16),R<1||k<R||G!==y||P<8||15<P||Q<0||9<Q||B<0||x<B)return W(_,v);P===8&&(P=9);var ne=new he;return(_.state=ne).strm=_,ne.wrap=se,ne.gzhead=null,ne.w_bits=P,ne.w_size=1<<ne.w_bits,ne.w_mask=ne.w_size-1,ne.hash_bits=R+7,ne.hash_size=1<<ne.hash_bits,ne.hash_mask=ne.hash_size-1,ne.hash_shift=~~((ne.hash_bits+A-1)/A),ne.window=new a.Buf8(2*ne.w_size),ne.head=new a.Buf16(ne.hash_size),ne.prev=new a.Buf16(ne.w_size),ne.lit_bufsize=1<<R+6,ne.pending_buf_size=4*ne.lit_bufsize,ne.pending_buf=new a.Buf8(ne.pending_buf_size),ne.d_buf=1*ne.lit_bufsize,ne.l_buf=3*ne.lit_bufsize,ne.level=Q,ne.strategy=B,ne.method=G,Se(_)}i=[new xe(0,0,0,0,function(_,Q){var G=65535;for(G>_.pending_buf_size-5&&(G=_.pending_buf_size-5);;){if(_.lookahead<=1){if(Ce(_),_.lookahead===0&&Q===f)return w;if(_.lookahead===0)break}_.strstart+=_.lookahead,_.lookahead=0;var P=_.block_start+G;if((_.strstart===0||_.strstart>=P)&&(_.lookahead=_.strstart-P,_.strstart=P,H(_,!1),_.strm.avail_out===0)||_.strstart-_.block_start>=_.w_size-D&&(H(_,!1),_.strm.avail_out===0))return w}return _.insert=0,Q===h?(H(_,!0),_.strm.avail_out===0?ee:F):(_.strstart>_.block_start&&(H(_,!1),_.strm.avail_out),w)}),new xe(4,4,8,4,ae),new xe(4,5,16,8,ae),new xe(4,6,32,32,ae),new xe(4,4,16,16,ge),new xe(8,16,32,32,ge),new xe(8,16,128,128,ge),new xe(8,32,128,256,ge),new xe(32,128,258,1024,ge),new xe(32,258,258,4096,ge)],o.deflateInit=function(_,Q){return Ie(_,Q,y,15,8,0)},o.deflateInit2=Ie,o.deflateReset=Se,o.deflateResetKeep=be,o.deflateSetHeader=function(_,Q){return _&&_.state?_.state.wrap!==2?v:(_.state.gzhead=Q,m):v},o.deflate=function(_,Q){var G,P,R,B;if(!_||!_.state||5<Q||Q<0)return _?W(_,v):v;if(P=_.state,!_.output||!_.input&&_.avail_in!==0||P.status===666&&Q!==h)return W(_,_.avail_out===0?-5:v);if(P.strm=_,G=P.last_flush,P.last_flush=Q,P.status===E)if(P.wrap===2)_.adler=0,le(P,31),le(P,139),le(P,8),P.gzhead?(le(P,(P.gzhead.text?1:0)+(P.gzhead.hcrc?2:0)+(P.gzhead.extra?4:0)+(P.gzhead.name?8:0)+(P.gzhead.comment?16:0)),le(P,255&P.gzhead.time),le(P,P.gzhead.time>>8&255),le(P,P.gzhead.time>>16&255),le(P,P.gzhead.time>>24&255),le(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),le(P,255&P.gzhead.os),P.gzhead.extra&&P.gzhead.extra.length&&(le(P,255&P.gzhead.extra.length),le(P,P.gzhead.extra.length>>8&255)),P.gzhead.hcrc&&(_.adler=u(_.adler,P.pending_buf,P.pending,0)),P.gzindex=0,P.status=69):(le(P,0),le(P,0),le(P,0),le(P,0),le(P,0),le(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),le(P,3),P.status=L);else{var se=y+(P.w_bits-8<<4)<<8;se|=(2<=P.strategy||P.level<2?0:P.level<6?1:P.level===6?2:3)<<6,P.strstart!==0&&(se|=32),se+=31-se%31,P.status=L,U(P,se),P.strstart!==0&&(U(P,_.adler>>>16),U(P,65535&_.adler)),_.adler=1}if(P.status===69)if(P.gzhead.extra){for(R=P.pending;P.gzindex<(65535&P.gzhead.extra.length)&&(P.pending!==P.pending_buf_size||(P.gzhead.hcrc&&P.pending>R&&(_.adler=u(_.adler,P.pending_buf,P.pending-R,R)),V(_),R=P.pending,P.pending!==P.pending_buf_size));)le(P,255&P.gzhead.extra[P.gzindex]),P.gzindex++;P.gzhead.hcrc&&P.pending>R&&(_.adler=u(_.adler,P.pending_buf,P.pending-R,R)),P.gzindex===P.gzhead.extra.length&&(P.gzindex=0,P.status=73)}else P.status=73;if(P.status===73)if(P.gzhead.name){R=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>R&&(_.adler=u(_.adler,P.pending_buf,P.pending-R,R)),V(_),R=P.pending,P.pending===P.pending_buf_size)){B=1;break}B=P.gzindex<P.gzhead.name.length?255&P.gzhead.name.charCodeAt(P.gzindex++):0,le(P,B)}while(B!==0);P.gzhead.hcrc&&P.pending>R&&(_.adler=u(_.adler,P.pending_buf,P.pending-R,R)),B===0&&(P.gzindex=0,P.status=91)}else P.status=91;if(P.status===91)if(P.gzhead.comment){R=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>R&&(_.adler=u(_.adler,P.pending_buf,P.pending-R,R)),V(_),R=P.pending,P.pending===P.pending_buf_size)){B=1;break}B=P.gzindex<P.gzhead.comment.length?255&P.gzhead.comment.charCodeAt(P.gzindex++):0,le(P,B)}while(B!==0);P.gzhead.hcrc&&P.pending>R&&(_.adler=u(_.adler,P.pending_buf,P.pending-R,R)),B===0&&(P.status=103)}else P.status=103;if(P.status===103&&(P.gzhead.hcrc?(P.pending+2>P.pending_buf_size&&V(_),P.pending+2<=P.pending_buf_size&&(le(P,255&_.adler),le(P,_.adler>>8&255),_.adler=0,P.status=L)):P.status=L),P.pending!==0){if(V(_),_.avail_out===0)return P.last_flush=-1,m}else if(_.avail_in===0&&Z(Q)<=Z(G)&&Q!==h)return W(_,-5);if(P.status===666&&_.avail_in!==0)return W(_,-5);if(_.avail_in!==0||P.lookahead!==0||Q!==f&&P.status!==666){var ne=P.strategy===2?(function(q,ce){for(var I;;){if(q.lookahead===0&&(Ce(q),q.lookahead===0)){if(ce===f)return w;break}if(q.match_length=0,I=l._tr_tally(q,0,q.window[q.strstart]),q.lookahead--,q.strstart++,I&&(H(q,!1),q.strm.avail_out===0))return w}return q.insert=0,ce===h?(H(q,!0),q.strm.avail_out===0?ee:F):q.last_lit&&(H(q,!1),q.strm.avail_out===0)?w:$})(P,Q):P.strategy===3?(function(q,ce){for(var I,M,Y,re,oe=q.window;;){if(q.lookahead<=z){if(Ce(q),q.lookahead<=z&&ce===f)return w;if(q.lookahead===0)break}if(q.match_length=0,q.lookahead>=A&&0<q.strstart&&(M=oe[Y=q.strstart-1])===oe[++Y]&&M===oe[++Y]&&M===oe[++Y]){re=q.strstart+z;do;while(M===oe[++Y]&&M===oe[++Y]&&M===oe[++Y]&&M===oe[++Y]&&M===oe[++Y]&&M===oe[++Y]&&M===oe[++Y]&&M===oe[++Y]&&Y<re);q.match_length=z-(re-Y),q.match_length>q.lookahead&&(q.match_length=q.lookahead)}if(q.match_length>=A?(I=l._tr_tally(q,1,q.match_length-A),q.lookahead-=q.match_length,q.strstart+=q.match_length,q.match_length=0):(I=l._tr_tally(q,0,q.window[q.strstart]),q.lookahead--,q.strstart++),I&&(H(q,!1),q.strm.avail_out===0))return w}return q.insert=0,ce===h?(H(q,!0),q.strm.avail_out===0?ee:F):q.last_lit&&(H(q,!1),q.strm.avail_out===0)?w:$})(P,Q):i[P.level].func(P,Q);if(ne!==ee&&ne!==F||(P.status=666),ne===w||ne===ee)return _.avail_out===0&&(P.last_flush=-1),m;if(ne===$&&(Q===1?l._tr_align(P):Q!==5&&(l._tr_stored_block(P,0,0,!1),Q===3&&(ue(P.head),P.lookahead===0&&(P.strstart=0,P.block_start=0,P.insert=0))),V(_),_.avail_out===0))return P.last_flush=-1,m}return Q!==h?m:P.wrap<=0?1:(P.wrap===2?(le(P,255&_.adler),le(P,_.adler>>8&255),le(P,_.adler>>16&255),le(P,_.adler>>24&255),le(P,255&_.total_in),le(P,_.total_in>>8&255),le(P,_.total_in>>16&255),le(P,_.total_in>>24&255)):(U(P,_.adler>>>16),U(P,65535&_.adler)),V(_),0<P.wrap&&(P.wrap=-P.wrap),P.pending!==0?m:1)},o.deflateEnd=function(_){var Q;return _&&_.state?(Q=_.state.status)!==E&&Q!==69&&Q!==73&&Q!==91&&Q!==103&&Q!==L&&Q!==666?W(_,v):(_.state=null,Q===L?W(_,-3):m):v},o.deflateSetDictionary=function(_,Q){var G,P,R,B,se,ne,q,ce,I=Q.length;if(!_||!_.state||(B=(G=_.state).wrap)===2||B===1&&G.status!==E||G.lookahead)return v;for(B===1&&(_.adler=c(_.adler,Q,I,0)),G.wrap=0,I>=G.w_size&&(B===0&&(ue(G.head),G.strstart=0,G.block_start=0,G.insert=0),ce=new a.Buf8(G.w_size),a.arraySet(ce,Q,I-G.w_size,G.w_size,0),Q=ce,I=G.w_size),se=_.avail_in,ne=_.next_in,q=_.input,_.avail_in=I,_.next_in=0,_.input=Q,Ce(G);G.lookahead>=A;){for(P=G.strstart,R=G.lookahead-(A-1);G.ins_h=(G.ins_h<<G.hash_shift^G.window[P+A-1])&G.hash_mask,G.prev[P&G.w_mask]=G.head[G.ins_h],G.head[G.ins_h]=P,P++,--R;);G.strstart=P,G.lookahead=A-1,Ce(G)}return G.strstart+=G.lookahead,G.block_start=G.strstart,G.insert=G.lookahead,G.lookahead=0,G.match_length=G.prev_length=A-1,G.match_available=0,_.next_in=ne,_.input=q,_.avail_in=se,G.wrap=B,m},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,s,o){s.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,s,o){s.exports=function(i,a){var l,c,u,d,f,h,m,v,g,x,b,y,k,j,C,T,N,O,A,z,D,E,L,w,$;l=i.state,c=i.next_in,w=i.input,u=c+(i.avail_in-5),d=i.next_out,$=i.output,f=d-(a-i.avail_out),h=d+(i.avail_out-257),m=l.dmax,v=l.wsize,g=l.whave,x=l.wnext,b=l.window,y=l.hold,k=l.bits,j=l.lencode,C=l.distcode,T=(1<<l.lenbits)-1,N=(1<<l.distbits)-1;e:do{k<15&&(y+=w[c++]<<k,k+=8,y+=w[c++]<<k,k+=8),O=j[y&T];t:for(;;){if(y>>>=A=O>>>24,k-=A,(A=O>>>16&255)===0)$[d++]=65535&O;else{if(!(16&A)){if((64&A)==0){O=j[(65535&O)+(y&(1<<A)-1)];continue t}if(32&A){l.mode=12;break e}i.msg="invalid literal/length code",l.mode=30;break e}z=65535&O,(A&=15)&&(k<A&&(y+=w[c++]<<k,k+=8),z+=y&(1<<A)-1,y>>>=A,k-=A),k<15&&(y+=w[c++]<<k,k+=8,y+=w[c++]<<k,k+=8),O=C[y&N];n:for(;;){if(y>>>=A=O>>>24,k-=A,!(16&(A=O>>>16&255))){if((64&A)==0){O=C[(65535&O)+(y&(1<<A)-1)];continue n}i.msg="invalid distance code",l.mode=30;break e}if(D=65535&O,k<(A&=15)&&(y+=w[c++]<<k,(k+=8)<A&&(y+=w[c++]<<k,k+=8)),m<(D+=y&(1<<A)-1)){i.msg="invalid distance too far back",l.mode=30;break e}if(y>>>=A,k-=A,(A=d-f)<D){if(g<(A=D-A)&&l.sane){i.msg="invalid distance too far back",l.mode=30;break e}if(L=b,(E=0)===x){if(E+=v-A,A<z){for(z-=A;$[d++]=b[E++],--A;);E=d-D,L=$}}else if(x<A){if(E+=v+x-A,(A-=x)<z){for(z-=A;$[d++]=b[E++],--A;);if(E=0,x<z){for(z-=A=x;$[d++]=b[E++],--A;);E=d-D,L=$}}}else if(E+=x-A,A<z){for(z-=A;$[d++]=b[E++],--A;);E=d-D,L=$}for(;2<z;)$[d++]=L[E++],$[d++]=L[E++],$[d++]=L[E++],z-=3;z&&($[d++]=L[E++],1<z&&($[d++]=L[E++]))}else{for(E=d-D;$[d++]=$[E++],$[d++]=$[E++],$[d++]=$[E++],2<(z-=3););z&&($[d++]=$[E++],1<z&&($[d++]=$[E++]))}break}}break}}while(c<u&&d<h);c-=z=k>>3,y&=(1<<(k-=z<<3))-1,i.next_in=c,i.next_out=d,i.avail_in=c<u?u-c+5:5-(c-u),i.avail_out=d<h?h-d+257:257-(d-h),l.hold=y,l.bits=k}},{}],49:[function(n,s,o){var i=n("../utils/common"),a=n("./adler32"),l=n("./crc32"),c=n("./inffast"),u=n("./inftrees"),d=1,f=2,h=0,m=-2,v=1,g=852,x=592;function b(E){return(E>>>24&255)+(E>>>8&65280)+((65280&E)<<8)+((255&E)<<24)}function y(){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 i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function k(E){var L;return E&&E.state?(L=E.state,E.total_in=E.total_out=L.total=0,E.msg="",L.wrap&&(E.adler=1&L.wrap),L.mode=v,L.last=0,L.havedict=0,L.dmax=32768,L.head=null,L.hold=0,L.bits=0,L.lencode=L.lendyn=new i.Buf32(g),L.distcode=L.distdyn=new i.Buf32(x),L.sane=1,L.back=-1,h):m}function j(E){var L;return E&&E.state?((L=E.state).wsize=0,L.whave=0,L.wnext=0,k(E)):m}function C(E,L){var w,$;return E&&E.state?($=E.state,L<0?(w=0,L=-L):(w=1+(L>>4),L<48&&(L&=15)),L&&(L<8||15<L)?m:($.window!==null&&$.wbits!==L&&($.window=null),$.wrap=w,$.wbits=L,j(E))):m}function T(E,L){var w,$;return E?($=new y,(E.state=$).window=null,(w=C(E,L))!==h&&(E.state=null),w):m}var N,O,A=!0;function z(E){if(A){var L;for(N=new i.Buf32(512),O=new i.Buf32(32),L=0;L<144;)E.lens[L++]=8;for(;L<256;)E.lens[L++]=9;for(;L<280;)E.lens[L++]=7;for(;L<288;)E.lens[L++]=8;for(u(d,E.lens,0,288,N,0,E.work,{bits:9}),L=0;L<32;)E.lens[L++]=5;u(f,E.lens,0,32,O,0,E.work,{bits:5}),A=!1}E.lencode=N,E.lenbits=9,E.distcode=O,E.distbits=5}function D(E,L,w,$){var ee,F=E.state;return F.window===null&&(F.wsize=1<<F.wbits,F.wnext=0,F.whave=0,F.window=new i.Buf8(F.wsize)),$>=F.wsize?(i.arraySet(F.window,L,w-F.wsize,F.wsize,0),F.wnext=0,F.whave=F.wsize):($<(ee=F.wsize-F.wnext)&&(ee=$),i.arraySet(F.window,L,w-$,ee,F.wnext),($-=ee)?(i.arraySet(F.window,L,w-$,$,0),F.wnext=$,F.whave=F.wsize):(F.wnext+=ee,F.wnext===F.wsize&&(F.wnext=0),F.whave<F.wsize&&(F.whave+=ee))),0}o.inflateReset=j,o.inflateReset2=C,o.inflateResetKeep=k,o.inflateInit=function(E){return T(E,15)},o.inflateInit2=T,o.inflate=function(E,L){var w,$,ee,F,W,Z,ue,V,H,le,U,X,Ce,ae,ge,xe,he,be,Se,Ie,_,Q,G,P,R=0,B=new i.Buf8(4),se=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!E||!E.state||!E.output||!E.input&&E.avail_in!==0)return m;(w=E.state).mode===12&&(w.mode=13),W=E.next_out,ee=E.output,ue=E.avail_out,F=E.next_in,$=E.input,Z=E.avail_in,V=w.hold,H=w.bits,le=Z,U=ue,Q=h;e:for(;;)switch(w.mode){case v:if(w.wrap===0){w.mode=13;break}for(;H<16;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}if(2&w.wrap&&V===35615){B[w.check=0]=255&V,B[1]=V>>>8&255,w.check=l(w.check,B,2,0),H=V=0,w.mode=2;break}if(w.flags=0,w.head&&(w.head.done=!1),!(1&w.wrap)||(((255&V)<<8)+(V>>8))%31){E.msg="incorrect header check",w.mode=30;break}if((15&V)!=8){E.msg="unknown compression method",w.mode=30;break}if(H-=4,_=8+(15&(V>>>=4)),w.wbits===0)w.wbits=_;else if(_>w.wbits){E.msg="invalid window size",w.mode=30;break}w.dmax=1<<_,E.adler=w.check=1,w.mode=512&V?10:12,H=V=0;break;case 2:for(;H<16;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}if(w.flags=V,(255&w.flags)!=8){E.msg="unknown compression method",w.mode=30;break}if(57344&w.flags){E.msg="unknown header flags set",w.mode=30;break}w.head&&(w.head.text=V>>8&1),512&w.flags&&(B[0]=255&V,B[1]=V>>>8&255,w.check=l(w.check,B,2,0)),H=V=0,w.mode=3;case 3:for(;H<32;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}w.head&&(w.head.time=V),512&w.flags&&(B[0]=255&V,B[1]=V>>>8&255,B[2]=V>>>16&255,B[3]=V>>>24&255,w.check=l(w.check,B,4,0)),H=V=0,w.mode=4;case 4:for(;H<16;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}w.head&&(w.head.xflags=255&V,w.head.os=V>>8),512&w.flags&&(B[0]=255&V,B[1]=V>>>8&255,w.check=l(w.check,B,2,0)),H=V=0,w.mode=5;case 5:if(1024&w.flags){for(;H<16;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}w.length=V,w.head&&(w.head.extra_len=V),512&w.flags&&(B[0]=255&V,B[1]=V>>>8&255,w.check=l(w.check,B,2,0)),H=V=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&(Z<(X=w.length)&&(X=Z),X&&(w.head&&(_=w.head.extra_len-w.length,w.head.extra||(w.head.extra=new Array(w.head.extra_len)),i.arraySet(w.head.extra,$,F,X,_)),512&w.flags&&(w.check=l(w.check,$,X,F)),Z-=X,F+=X,w.length-=X),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if(Z===0)break e;for(X=0;_=$[F+X++],w.head&&_&&w.length<65536&&(w.head.name+=String.fromCharCode(_)),_&&X<Z;);if(512&w.flags&&(w.check=l(w.check,$,X,F)),Z-=X,F+=X,_)break e}else w.head&&(w.head.name=null);w.length=0,w.mode=8;case 8:if(4096&w.flags){if(Z===0)break e;for(X=0;_=$[F+X++],w.head&&_&&w.length<65536&&(w.head.comment+=String.fromCharCode(_)),_&&X<Z;);if(512&w.flags&&(w.check=l(w.check,$,X,F)),Z-=X,F+=X,_)break e}else w.head&&(w.head.comment=null);w.mode=9;case 9:if(512&w.flags){for(;H<16;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}if(V!==(65535&w.check)){E.msg="header crc mismatch",w.mode=30;break}H=V=0}w.head&&(w.head.hcrc=w.flags>>9&1,w.head.done=!0),E.adler=w.check=0,w.mode=12;break;case 10:for(;H<32;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}E.adler=w.check=b(V),H=V=0,w.mode=11;case 11:if(w.havedict===0)return E.next_out=W,E.avail_out=ue,E.next_in=F,E.avail_in=Z,w.hold=V,w.bits=H,2;E.adler=w.check=1,w.mode=12;case 12:if(L===5||L===6)break e;case 13:if(w.last){V>>>=7&H,H-=7&H,w.mode=27;break}for(;H<3;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}switch(w.last=1&V,H-=1,3&(V>>>=1)){case 0:w.mode=14;break;case 1:if(z(w),w.mode=20,L!==6)break;V>>>=2,H-=2;break e;case 2:w.mode=17;break;case 3:E.msg="invalid block type",w.mode=30}V>>>=2,H-=2;break;case 14:for(V>>>=7&H,H-=7&H;H<32;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}if((65535&V)!=(V>>>16^65535)){E.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&V,H=V=0,w.mode=15,L===6)break e;case 15:w.mode=16;case 16:if(X=w.length){if(Z<X&&(X=Z),ue<X&&(X=ue),X===0)break e;i.arraySet(ee,$,F,X,W),Z-=X,F+=X,ue-=X,W+=X,w.length-=X;break}w.mode=12;break;case 17:for(;H<14;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}if(w.nlen=257+(31&V),V>>>=5,H-=5,w.ndist=1+(31&V),V>>>=5,H-=5,w.ncode=4+(15&V),V>>>=4,H-=4,286<w.nlen||30<w.ndist){E.msg="too many length or distance symbols",w.mode=30;break}w.have=0,w.mode=18;case 18:for(;w.have<w.ncode;){for(;H<3;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}w.lens[se[w.have++]]=7&V,V>>>=3,H-=3}for(;w.have<19;)w.lens[se[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,G={bits:w.lenbits},Q=u(0,w.lens,0,19,w.lencode,0,w.work,G),w.lenbits=G.bits,Q){E.msg="invalid code lengths set",w.mode=30;break}w.have=0,w.mode=19;case 19:for(;w.have<w.nlen+w.ndist;){for(;xe=(R=w.lencode[V&(1<<w.lenbits)-1])>>>16&255,he=65535&R,!((ge=R>>>24)<=H);){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}if(he<16)V>>>=ge,H-=ge,w.lens[w.have++]=he;else{if(he===16){for(P=ge+2;H<P;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}if(V>>>=ge,H-=ge,w.have===0){E.msg="invalid bit length repeat",w.mode=30;break}_=w.lens[w.have-1],X=3+(3&V),V>>>=2,H-=2}else if(he===17){for(P=ge+3;H<P;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}H-=ge,_=0,X=3+(7&(V>>>=ge)),V>>>=3,H-=3}else{for(P=ge+7;H<P;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}H-=ge,_=0,X=11+(127&(V>>>=ge)),V>>>=7,H-=7}if(w.have+X>w.nlen+w.ndist){E.msg="invalid bit length repeat",w.mode=30;break}for(;X--;)w.lens[w.have++]=_}}if(w.mode===30)break;if(w.lens[256]===0){E.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,G={bits:w.lenbits},Q=u(d,w.lens,0,w.nlen,w.lencode,0,w.work,G),w.lenbits=G.bits,Q){E.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,G={bits:w.distbits},Q=u(f,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,G),w.distbits=G.bits,Q){E.msg="invalid distances set",w.mode=30;break}if(w.mode=20,L===6)break e;case 20:w.mode=21;case 21:if(6<=Z&&258<=ue){E.next_out=W,E.avail_out=ue,E.next_in=F,E.avail_in=Z,w.hold=V,w.bits=H,c(E,U),W=E.next_out,ee=E.output,ue=E.avail_out,F=E.next_in,$=E.input,Z=E.avail_in,V=w.hold,H=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;xe=(R=w.lencode[V&(1<<w.lenbits)-1])>>>16&255,he=65535&R,!((ge=R>>>24)<=H);){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}if(xe&&(240&xe)==0){for(be=ge,Se=xe,Ie=he;xe=(R=w.lencode[Ie+((V&(1<<be+Se)-1)>>be)])>>>16&255,he=65535&R,!(be+(ge=R>>>24)<=H);){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}V>>>=be,H-=be,w.back+=be}if(V>>>=ge,H-=ge,w.back+=ge,w.length=he,xe===0){w.mode=26;break}if(32&xe){w.back=-1,w.mode=12;break}if(64&xe){E.msg="invalid literal/length code",w.mode=30;break}w.extra=15&xe,w.mode=22;case 22:if(w.extra){for(P=w.extra;H<P;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}w.length+=V&(1<<w.extra)-1,V>>>=w.extra,H-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;xe=(R=w.distcode[V&(1<<w.distbits)-1])>>>16&255,he=65535&R,!((ge=R>>>24)<=H);){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}if((240&xe)==0){for(be=ge,Se=xe,Ie=he;xe=(R=w.distcode[Ie+((V&(1<<be+Se)-1)>>be)])>>>16&255,he=65535&R,!(be+(ge=R>>>24)<=H);){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}V>>>=be,H-=be,w.back+=be}if(V>>>=ge,H-=ge,w.back+=ge,64&xe){E.msg="invalid distance code",w.mode=30;break}w.offset=he,w.extra=15&xe,w.mode=24;case 24:if(w.extra){for(P=w.extra;H<P;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}w.offset+=V&(1<<w.extra)-1,V>>>=w.extra,H-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){E.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(ue===0)break e;if(X=U-ue,w.offset>X){if((X=w.offset-X)>w.whave&&w.sane){E.msg="invalid distance too far back",w.mode=30;break}Ce=X>w.wnext?(X-=w.wnext,w.wsize-X):w.wnext-X,X>w.length&&(X=w.length),ae=w.window}else ae=ee,Ce=W-w.offset,X=w.length;for(ue<X&&(X=ue),ue-=X,w.length-=X;ee[W++]=ae[Ce++],--X;);w.length===0&&(w.mode=21);break;case 26:if(ue===0)break e;ee[W++]=w.length,ue--,w.mode=21;break;case 27:if(w.wrap){for(;H<32;){if(Z===0)break e;Z--,V|=$[F++]<<H,H+=8}if(U-=ue,E.total_out+=U,w.total+=U,U&&(E.adler=w.check=w.flags?l(w.check,ee,U,W-U):a(w.check,ee,U,W-U)),U=ue,(w.flags?V:b(V))!==w.check){E.msg="incorrect data check",w.mode=30;break}H=V=0}w.mode=28;case 28:if(w.wrap&&w.flags){for(;H<32;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}if(V!==(4294967295&w.total)){E.msg="incorrect length check",w.mode=30;break}H=V=0}w.mode=29;case 29:Q=1;break e;case 30:Q=-3;break e;case 31:return-4;default:return m}return E.next_out=W,E.avail_out=ue,E.next_in=F,E.avail_in=Z,w.hold=V,w.bits=H,(w.wsize||U!==E.avail_out&&w.mode<30&&(w.mode<27||L!==4))&&D(E,E.output,E.next_out,U-E.avail_out)?(w.mode=31,-4):(le-=E.avail_in,U-=E.avail_out,E.total_in+=le,E.total_out+=U,w.total+=U,w.wrap&&U&&(E.adler=w.check=w.flags?l(w.check,ee,U,E.next_out-U):a(w.check,ee,U,E.next_out-U)),E.data_type=w.bits+(w.last?64:0)+(w.mode===12?128:0)+(w.mode===20||w.mode===15?256:0),(le==0&&U===0||L===4)&&Q===h&&(Q=-5),Q)},o.inflateEnd=function(E){if(!E||!E.state)return m;var L=E.state;return L.window&&(L.window=null),E.state=null,h},o.inflateGetHeader=function(E,L){var w;return E&&E.state?(2&(w=E.state).wrap)==0?m:((w.head=L).done=!1,h):m},o.inflateSetDictionary=function(E,L){var w,$=L.length;return E&&E.state?(w=E.state).wrap!==0&&w.mode!==11?m:w.mode===11&&a(1,L,$,0)!==w.check?-3:D(E,L,$,$)?(w.mode=31,-4):(w.havedict=1,h):m},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,s,o){var i=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];s.exports=function(d,f,h,m,v,g,x,b){var y,k,j,C,T,N,O,A,z,D=b.bits,E=0,L=0,w=0,$=0,ee=0,F=0,W=0,Z=0,ue=0,V=0,H=null,le=0,U=new i.Buf16(16),X=new i.Buf16(16),Ce=null,ae=0;for(E=0;E<=15;E++)U[E]=0;for(L=0;L<m;L++)U[f[h+L]]++;for(ee=D,$=15;1<=$&&U[$]===0;$--);if($<ee&&(ee=$),$===0)return v[g++]=20971520,v[g++]=20971520,b.bits=1,0;for(w=1;w<$&&U[w]===0;w++);for(ee<w&&(ee=w),E=Z=1;E<=15;E++)if(Z<<=1,(Z-=U[E])<0)return-1;if(0<Z&&(d===0||$!==1))return-1;for(X[1]=0,E=1;E<15;E++)X[E+1]=X[E]+U[E];for(L=0;L<m;L++)f[h+L]!==0&&(x[X[f[h+L]]++]=L);if(N=d===0?(H=Ce=x,19):d===1?(H=a,le-=257,Ce=l,ae-=257,256):(H=c,Ce=u,-1),E=w,T=g,W=L=V=0,j=-1,C=(ue=1<<(F=ee))-1,d===1&&852<ue||d===2&&592<ue)return 1;for(;;){for(O=E-W,z=x[L]<N?(A=0,x[L]):x[L]>N?(A=Ce[ae+x[L]],H[le+x[L]]):(A=96,0),y=1<<E-W,w=k=1<<F;v[T+(V>>W)+(k-=y)]=O<<24|A<<16|z|0,k!==0;);for(y=1<<E-1;V&y;)y>>=1;if(y!==0?(V&=y-1,V+=y):V=0,L++,--U[E]==0){if(E===$)break;E=f[h+x[L]]}if(ee<E&&(V&C)!==j){for(W===0&&(W=ee),T+=w,Z=1<<(F=E-W);F+W<$&&!((Z-=U[F+W])<=0);)F++,Z<<=1;if(ue+=1<<F,d===1&&852<ue||d===2&&592<ue)return 1;v[j=V&C]=ee<<24|F<<16|T-g|0}}return V!==0&&(v[T+V]=E-W<<24|64<<16|0),b.bits=ee,0}},{"../utils/common":41}],51:[function(n,s,o){s.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,s,o){var i=n("../utils/common"),a=0,l=1;function c(R){for(var B=R.length;0<=--B;)R[B]=0}var u=0,d=29,f=256,h=f+1+d,m=30,v=19,g=2*h+1,x=15,b=16,y=7,k=256,j=16,C=17,T=18,N=[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],O=[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],A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],D=new Array(2*(h+2));c(D);var E=new Array(2*m);c(E);var L=new Array(512);c(L);var w=new Array(256);c(w);var $=new Array(d);c($);var ee,F,W,Z=new Array(m);function ue(R,B,se,ne,q){this.static_tree=R,this.extra_bits=B,this.extra_base=se,this.elems=ne,this.max_length=q,this.has_stree=R&&R.length}function V(R,B){this.dyn_tree=R,this.max_code=0,this.stat_desc=B}function H(R){return R<256?L[R]:L[256+(R>>>7)]}function le(R,B){R.pending_buf[R.pending++]=255&B,R.pending_buf[R.pending++]=B>>>8&255}function U(R,B,se){R.bi_valid>b-se?(R.bi_buf|=B<<R.bi_valid&65535,le(R,R.bi_buf),R.bi_buf=B>>b-R.bi_valid,R.bi_valid+=se-b):(R.bi_buf|=B<<R.bi_valid&65535,R.bi_valid+=se)}function X(R,B,se){U(R,se[2*B],se[2*B+1])}function Ce(R,B){for(var se=0;se|=1&R,R>>>=1,se<<=1,0<--B;);return se>>>1}function ae(R,B,se){var ne,q,ce=new Array(x+1),I=0;for(ne=1;ne<=x;ne++)ce[ne]=I=I+se[ne-1]<<1;for(q=0;q<=B;q++){var M=R[2*q+1];M!==0&&(R[2*q]=Ce(ce[M]++,M))}}function ge(R){var B;for(B=0;B<h;B++)R.dyn_ltree[2*B]=0;for(B=0;B<m;B++)R.dyn_dtree[2*B]=0;for(B=0;B<v;B++)R.bl_tree[2*B]=0;R.dyn_ltree[2*k]=1,R.opt_len=R.static_len=0,R.last_lit=R.matches=0}function xe(R){8<R.bi_valid?le(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,B,se,ne){var q=2*B,ce=2*se;return R[q]<R[ce]||R[q]===R[ce]&&ne[B]<=ne[se]}function be(R,B,se){for(var ne=R.heap[se],q=se<<1;q<=R.heap_len&&(q<R.heap_len&&he(B,R.heap[q+1],R.heap[q],R.depth)&&q++,!he(B,ne,R.heap[q],R.depth));)R.heap[se]=R.heap[q],se=q,q<<=1;R.heap[se]=ne}function Se(R,B,se){var ne,q,ce,I,M=0;if(R.last_lit!==0)for(;ne=R.pending_buf[R.d_buf+2*M]<<8|R.pending_buf[R.d_buf+2*M+1],q=R.pending_buf[R.l_buf+M],M++,ne===0?X(R,q,B):(X(R,(ce=w[q])+f+1,B),(I=N[ce])!==0&&U(R,q-=$[ce],I),X(R,ce=H(--ne),se),(I=O[ce])!==0&&U(R,ne-=Z[ce],I)),M<R.last_lit;);X(R,k,B)}function Ie(R,B){var se,ne,q,ce=B.dyn_tree,I=B.stat_desc.static_tree,M=B.stat_desc.has_stree,Y=B.stat_desc.elems,re=-1;for(R.heap_len=0,R.heap_max=g,se=0;se<Y;se++)ce[2*se]!==0?(R.heap[++R.heap_len]=re=se,R.depth[se]=0):ce[2*se+1]=0;for(;R.heap_len<2;)ce[2*(q=R.heap[++R.heap_len]=re<2?++re:0)]=1,R.depth[q]=0,R.opt_len--,M&&(R.static_len-=I[2*q+1]);for(B.max_code=re,se=R.heap_len>>1;1<=se;se--)be(R,ce,se);for(q=Y;se=R.heap[1],R.heap[1]=R.heap[R.heap_len--],be(R,ce,1),ne=R.heap[1],R.heap[--R.heap_max]=se,R.heap[--R.heap_max]=ne,ce[2*q]=ce[2*se]+ce[2*ne],R.depth[q]=(R.depth[se]>=R.depth[ne]?R.depth[se]:R.depth[ne])+1,ce[2*se+1]=ce[2*ne+1]=q,R.heap[1]=q++,be(R,ce,1),2<=R.heap_len;);R.heap[--R.heap_max]=R.heap[1],(function(oe,ve){var pe,me,Ae,$e,Bt,Rn,gt=ve.dyn_tree,it=ve.max_code,en=ve.stat_desc.static_tree,Ms=ve.stat_desc.has_stree,Be=ve.stat_desc.extra_bits,jt=ve.stat_desc.extra_base,et=ve.stat_desc.max_length,Ut=0;for($e=0;$e<=x;$e++)oe.bl_count[$e]=0;for(gt[2*oe.heap[oe.heap_max]+1]=0,pe=oe.heap_max+1;pe<g;pe++)et<($e=gt[2*gt[2*(me=oe.heap[pe])+1]+1]+1)&&($e=et,Ut++),gt[2*me+1]=$e,it<me||(oe.bl_count[$e]++,Bt=0,jt<=me&&(Bt=Be[me-jt]),Rn=gt[2*me],oe.opt_len+=Rn*($e+Bt),Ms&&(oe.static_len+=Rn*(en[2*me+1]+Bt)));if(Ut!==0){do{for($e=et-1;oe.bl_count[$e]===0;)$e--;oe.bl_count[$e]--,oe.bl_count[$e+1]+=2,oe.bl_count[et]--,Ut-=2}while(0<Ut);for($e=et;$e!==0;$e--)for(me=oe.bl_count[$e];me!==0;)it<(Ae=oe.heap[--pe])||(gt[2*Ae+1]!==$e&&(oe.opt_len+=($e-gt[2*Ae+1])*gt[2*Ae],gt[2*Ae+1]=$e),me--)}})(R,B),ae(ce,re,R.bl_count)}function _(R,B,se){var ne,q,ce=-1,I=B[1],M=0,Y=7,re=4;for(I===0&&(Y=138,re=3),B[2*(se+1)+1]=65535,ne=0;ne<=se;ne++)q=I,I=B[2*(ne+1)+1],++M<Y&&q===I||(M<re?R.bl_tree[2*q]+=M:q!==0?(q!==ce&&R.bl_tree[2*q]++,R.bl_tree[2*j]++):M<=10?R.bl_tree[2*C]++:R.bl_tree[2*T]++,ce=q,re=(M=0)===I?(Y=138,3):q===I?(Y=6,3):(Y=7,4))}function Q(R,B,se){var ne,q,ce=-1,I=B[1],M=0,Y=7,re=4;for(I===0&&(Y=138,re=3),ne=0;ne<=se;ne++)if(q=I,I=B[2*(ne+1)+1],!(++M<Y&&q===I)){if(M<re)for(;X(R,q,R.bl_tree),--M!=0;);else q!==0?(q!==ce&&(X(R,q,R.bl_tree),M--),X(R,j,R.bl_tree),U(R,M-3,2)):M<=10?(X(R,C,R.bl_tree),U(R,M-3,3)):(X(R,T,R.bl_tree),U(R,M-11,7));ce=q,re=(M=0)===I?(Y=138,3):q===I?(Y=6,3):(Y=7,4)}}c(Z);var G=!1;function P(R,B,se,ne){U(R,(u<<1)+(ne?1:0),3),(function(q,ce,I,M){xe(q),le(q,I),le(q,~I),i.arraySet(q.pending_buf,q.window,ce,I,q.pending),q.pending+=I})(R,B,se)}o._tr_init=function(R){G||((function(){var B,se,ne,q,ce,I=new Array(x+1);for(q=ne=0;q<d-1;q++)for($[q]=ne,B=0;B<1<<N[q];B++)w[ne++]=q;for(w[ne-1]=q,q=ce=0;q<16;q++)for(Z[q]=ce,B=0;B<1<<O[q];B++)L[ce++]=q;for(ce>>=7;q<m;q++)for(Z[q]=ce<<7,B=0;B<1<<O[q]-7;B++)L[256+ce++]=q;for(se=0;se<=x;se++)I[se]=0;for(B=0;B<=143;)D[2*B+1]=8,B++,I[8]++;for(;B<=255;)D[2*B+1]=9,B++,I[9]++;for(;B<=279;)D[2*B+1]=7,B++,I[7]++;for(;B<=287;)D[2*B+1]=8,B++,I[8]++;for(ae(D,h+1,I),B=0;B<m;B++)E[2*B+1]=5,E[2*B]=Ce(B,5);ee=new ue(D,N,f+1,h,x),F=new ue(E,O,0,m,x),W=new ue(new Array(0),A,0,v,y)})(),G=!0),R.l_desc=new V(R.dyn_ltree,ee),R.d_desc=new V(R.dyn_dtree,F),R.bl_desc=new V(R.bl_tree,W),R.bi_buf=0,R.bi_valid=0,ge(R)},o._tr_stored_block=P,o._tr_flush_block=function(R,B,se,ne){var q,ce,I=0;0<R.level?(R.strm.data_type===2&&(R.strm.data_type=(function(M){var Y,re=4093624447;for(Y=0;Y<=31;Y++,re>>>=1)if(1&re&&M.dyn_ltree[2*Y]!==0)return a;if(M.dyn_ltree[18]!==0||M.dyn_ltree[20]!==0||M.dyn_ltree[26]!==0)return l;for(Y=32;Y<f;Y++)if(M.dyn_ltree[2*Y]!==0)return l;return a})(R)),Ie(R,R.l_desc),Ie(R,R.d_desc),I=(function(M){var Y;for(_(M,M.dyn_ltree,M.l_desc.max_code),_(M,M.dyn_dtree,M.d_desc.max_code),Ie(M,M.bl_desc),Y=v-1;3<=Y&&M.bl_tree[2*z[Y]+1]===0;Y--);return M.opt_len+=3*(Y+1)+5+5+4,Y})(R),q=R.opt_len+3+7>>>3,(ce=R.static_len+3+7>>>3)<=q&&(q=ce)):q=ce=se+5,se+4<=q&&B!==-1?P(R,B,se,ne):R.strategy===4||ce===q?(U(R,2+(ne?1:0),3),Se(R,D,E)):(U(R,4+(ne?1:0),3),(function(M,Y,re,oe){var ve;for(U(M,Y-257,5),U(M,re-1,5),U(M,oe-4,4),ve=0;ve<oe;ve++)U(M,M.bl_tree[2*z[ve]+1],3);Q(M,M.dyn_ltree,Y-1),Q(M,M.dyn_dtree,re-1)})(R,R.l_desc.max_code+1,R.d_desc.max_code+1,I+1),Se(R,R.dyn_ltree,R.dyn_dtree)),ge(R),ne&&xe(R)},o._tr_tally=function(R,B,se){return R.pending_buf[R.d_buf+2*R.last_lit]=B>>>8&255,R.pending_buf[R.d_buf+2*R.last_lit+1]=255&B,R.pending_buf[R.l_buf+R.last_lit]=255&se,R.last_lit++,B===0?R.dyn_ltree[2*se]++:(R.matches++,B--,R.dyn_ltree[2*(w[se]+f+1)]++,R.dyn_dtree[2*H(B)]++),R.last_lit===R.lit_bufsize-1},o._tr_align=function(R){U(R,2,3),X(R,k,D),(function(B){B.bi_valid===16?(le(B,B.bi_buf),B.bi_buf=0,B.bi_valid=0):8<=B.bi_valid&&(B.pending_buf[B.pending++]=255&B.bi_buf,B.bi_buf>>=8,B.bi_valid-=8)})(R)}},{"../utils/common":41}],53:[function(n,s,o){s.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,s,o){(function(i){(function(a,l){if(!a.setImmediate){var c,u,d,f,h=1,m={},v=!1,g=a.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(a);x=x&&x.setTimeout?x:a,c={}.toString.call(a.process)==="[object process]"?function(j){process.nextTick(function(){y(j)})}:(function(){if(a.postMessage&&!a.importScripts){var j=!0,C=a.onmessage;return a.onmessage=function(){j=!1},a.postMessage("","*"),a.onmessage=C,j}})()?(f="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",k,!1):a.attachEvent("onmessage",k),function(j){a.postMessage(f+j,"*")}):a.MessageChannel?((d=new MessageChannel).port1.onmessage=function(j){y(j.data)},function(j){d.port2.postMessage(j)}):g&&"onreadystatechange"in g.createElement("script")?(u=g.documentElement,function(j){var C=g.createElement("script");C.onreadystatechange=function(){y(j),C.onreadystatechange=null,u.removeChild(C),C=null},u.appendChild(C)}):function(j){setTimeout(y,0,j)},x.setImmediate=function(j){typeof j!="function"&&(j=new Function(""+j));for(var C=new Array(arguments.length-1),T=0;T<C.length;T++)C[T]=arguments[T+1];var N={callback:j,args:C};return m[h]=N,c(h),h++},x.clearImmediate=b}function b(j){delete m[j]}function y(j){if(v)setTimeout(y,0,j);else{var C=m[j];if(C){v=!0;try{(function(T){var N=T.callback,O=T.args;switch(O.length){case 0:N();break;case 1:N(O[0]);break;case 2:N(O[0],O[1]);break;case 3:N(O[0],O[1],O[2]);break;default:N.apply(l,O)}})(C)}finally{b(j),v=!1}}}}function k(j){j.source===a&&typeof j.data=="string"&&j.data.indexOf(f)===0&&y(+j.data.slice(f.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof vr<"u"?vr:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(ji)),ji.exports}var R_=A_();const I_=ig(R_),z_="3.0.16",ha={version:z_},tp="[REDACTED]",O_=/(^|[-_])(api[-_]?key|authorization|cookie|token|secret|password|access[-_]?token|refresh[-_]?token)([-_]|$)/i,P_=[/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],qc=200,M_=25e6,np=50,L_=1e4;function D_(e){return e<1024?`${e} chars`:e<1024*1024?`${Math.ceil(e/1024)} KB`:`${Math.ceil(e/(1024*1024))} MB`}function $_(e){let t=0;for(const n of e)t+=n.rawRequestBody?.length??0,t+=n.responseText?.length??0;return t}function F_(e){if(e.length>qc)return`Export is limited to ${qc} logs at once. Narrow the filter and try again.`;const t=$_(e);return t>M_?`Export is too large (${D_(t)} of text). Narrow the filter and try again.`:null}function Sr(e){return e?.aborted===!0?{ok:!1,message:"Export canceled.",canceled:!0}:null}async function B_(e,t){try{const n=await Dn(`/api/logs/${e}/chunks`,L_,{signal:t});if(!n.ok)return null;const s=await n.json();return JSON.stringify(s,null,2)}catch{return null}}function U_(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ma(e){if(Array.isArray(e))return e.map(n=>ma(n));if(!U_(e))return e;const t={};for(const[n,s]of Object.entries(e))t[n]=O_.test(n)?tp:ma(s);return t}function W_(e){const t=n=>{let s=n;for(const o of P_)s=s.replace(o,tp);return s};try{const n=JSON.parse(e);return t(JSON.stringify(ma(n),null,2))}catch{return t(e)}}function Si(e,t){return t==="redacted"?W_(e):e}function H_(e,t){return{...e,rawRequestBody:null,responseText:null,rawHeaders:t==="raw"?e.rawHeaders:void 0,headers:t==="raw"?e.headers:void 0,streamingChunks:void 0,bodyContentMode:"compact"}}function V_(e,t,n,s=new Date().toISOString()){return{version:ha.version,exportedAt:s,mode:t,redacted:t==="redacted",logCount:e.length,logIds:e.map(o=>o.id),streamingChunkExportLimit:np,streamingChunkLogIds:n.map(o=>o.id)}}async function q_(e,t="redacted",n={}){const s=Sr(n.signal);if(s!==null)return s;const o=F_(e);if(o!==null)return{ok:!1,message:o};const i=new I_,a=t==="redacted"?"redacted":"raw",l=e.filter(h=>h.streaming).slice(0,np);i.file("manifest.json",JSON.stringify(V_(e,t,l),null,2)),i.file("logs.json",JSON.stringify(e.map(h=>H_(h,t)),null,2));for(const h of e){const m=Sr(n.signal);if(m!==null)return m;h.rawRequestBody!==null&&i.file(`#${h.id}.Request.json`,Si(h.rawRequestBody,t)),h.responseText!==null&&i.file(`#${h.id}.Response.json`,Si(h.responseText,t))}for(const h of l){const m=Sr(n.signal);if(m!==null)return m;const v=await B_(h.id,n.signal);v!==null&&i.file(`#${h.id}.SSE.Response.json`,Si(v,t))}const c=await i.generateAsync({type:"blob"}),u=Sr(n.signal);if(u!==null)return u;const d=URL.createObjectURL(c),f=document.createElement("a");return f.href=d,f.download=`agent-inspector-export-${a}-${new Date().toISOString().slice(0,10)}.zip`,document.body.appendChild(f),f.click(),document.body.removeChild(f),URL.revokeObjectURL(d),{ok:!0}}function Z_(e,t){if(e!==null){e.removeAllRanges();for(const n of t)e.addRange(n)}}function G_(e){if(e===null)return[];const t=[];for(let n=0;n<e.rangeCount;n++)t.push(e.getRangeAt(n));return t}function K_(e){if(typeof document>"u")return!1;const t=document.activeElement,n=document.getSelection(),s=G_(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 i=!1;try{i=document.execCommand("copy")}catch{}finally{document.body.removeChild(o),Z_(n,s),typeof HTMLElement<"u"&&t instanceof HTMLElement&&t.focus({preventScroll:!0})}return i}async function Nt(e){const t=globalThis.navigator?.clipboard;if(t!==void 0)try{return await t.writeText(e),!0}catch{}return K_(e)}function ga(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 Tl(e,t,n){return`${ga(e,n)} - ${ga(t,n)}`}function Cr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function J_(e){switch(e){case"end_turn":case"tool_use":return e;case"max_tokens":return"length";default:return null}}function Y_(e){switch(e){case"stop":case"length":return e;case"max_tokens":return"length";default:return null}}function X_(e){switch(e){case"max_output_tokens":case"max_tokens":return!0;default:return!1}}function sp(e){if(e.responseText===null)return null;try{let t=JSON.parse(e.responseText);if(typeof t=="string"&&(t=JSON.parse(t)),!Cr(t))return null;if(typeof t.stop_reason=="string")return J_(t.stop_reason);if(Array.isArray(t.choices))for(const n of t.choices){if(!Cr(n)||typeof n.finish_reason!="string")continue;const s=Y_(n.finish_reason);if(s!==null)return s}if(Array.isArray(t.output)){for(const n of t.output)if(Cr(n)&&n.type==="function_call")return"tool_use";if(t.status==="completed")return"stop"}if(t.status==="incomplete"&&Cr(t.incomplete_details)){const n=t.incomplete_details.reason;if(typeof n=="string"&&X_(n))return"length"}return null}catch{return null}}function El(e){return e==="end_turn"||e==="stop"||e==="length"}function rp(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=rp(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function op(){for(var e,t,n=0,s="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=rp(e))&&(s&&(s+=" "),s+=t);return s}const Q_=(e,t)=>{const n=new Array(e.length+t.length);for(let s=0;s<e.length;s++)n[s]=e[s];for(let s=0;s<t.length;s++)n[e.length+s]=t[s];return n},ek=(e,t)=>({classGroupId:e,validator:t}),ip=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),mo="-",Zc=[],tk="arbitrary..",nk=e=>{const t=rk(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return sk(a);const l=a.split(mo),c=l[0]===""&&l.length>1?1:0;return ap(l,c,t)},getConflictingClassGroupIds:(a,l)=>{if(l){const c=s[a],u=n[a];return c?u?Q_(u,c):c:u||Zc}return n[a]||Zc}}},ap=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],i=n.nextPart.get(o);if(i){const u=ap(e,t+1,i);if(u)return u}const a=n.validators;if(a===null)return;const l=t===0?e.join(mo):e.slice(t).join(mo),c=a.length;for(let u=0;u<c;u++){const d=a[u];if(d.validator(l))return d.classGroupId}},sk=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),s=t.slice(0,n);return s?tk+s:void 0})(),rk=e=>{const{theme:t,classGroups:n}=e;return ok(n,t)},ok=(e,t)=>{const n=ip();for(const s in e){const o=e[s];Al(o,n,s,t)}return n},Al=(e,t,n,s)=>{const o=e.length;for(let i=0;i<o;i++){const a=e[i];ik(a,t,n,s)}},ik=(e,t,n,s)=>{if(typeof e=="string"){ak(e,t,n);return}if(typeof e=="function"){lk(e,t,n,s);return}ck(e,t,n,s)},ak=(e,t,n)=>{const s=e===""?t:lp(t,e);s.classGroupId=n},lk=(e,t,n,s)=>{if(uk(e)){Al(e(s),t,n,s);return}t.validators===null&&(t.validators=[]),t.validators.push(ek(n,e))},ck=(e,t,n,s)=>{const o=Object.entries(e),i=o.length;for(let a=0;a<i;a++){const[l,c]=o[a];Al(c,lp(t,l),n,s)}},lp=(e,t)=>{let n=e;const s=t.split(mo),o=s.length;for(let i=0;i<o;i++){const a=s[i];let l=n.nextPart.get(a);l||(l=ip(),n.nextPart.set(a,l)),n=l}return n},uk=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,dk=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),s=Object.create(null);const o=(i,a)=>{n[i]=a,t++,t>e&&(t=0,s=n,n=Object.create(null))};return{get(i){let a=n[i];if(a!==void 0)return a;if((a=s[i])!==void 0)return o(i,a),a},set(i,a){i in n?n[i]=a:o(i,a)}}},xa="!",Gc=":",fk=[],Kc=(e,t,n,s,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:s,isExternal:o}),pk=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=o=>{const i=[];let a=0,l=0,c=0,u;const d=o.length;for(let g=0;g<d;g++){const x=o[g];if(a===0&&l===0){if(x===Gc){i.push(o.slice(c,g)),c=g+1;continue}if(x==="/"){u=g;continue}}x==="["?a++:x==="]"?a--:x==="("?l++:x===")"&&l--}const f=i.length===0?o:o.slice(c);let h=f,m=!1;f.endsWith(xa)?(h=f.slice(0,-1),m=!0):f.startsWith(xa)&&(h=f.slice(1),m=!0);const v=u&&u>c?u-c:void 0;return Kc(i,m,h,v)};if(t){const o=t+Gc,i=s;s=a=>a.startsWith(o)?i(a.slice(o.length)):Kc(fk,!1,a,void 0,!0)}if(n){const o=s;s=i=>n({className:i,parseClassName:o})}return s},hk=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,s)=>{t.set(n,1e6+s)}),n=>{const s=[];let o=[];for(let i=0;i<n.length;i++){const a=n[i],l=a[0]==="[",c=t.has(a);l||c?(o.length>0&&(o.sort(),s.push(...o),o=[]),s.push(a)):o.push(a)}return o.length>0&&(o.sort(),s.push(...o)),s}},mk=e=>({cache:dk(e.cacheSize),parseClassName:pk(e),sortModifiers:hk(e),...nk(e)}),gk=/\s+/,xk=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:o,sortModifiers:i}=t,a=[],l=e.trim().split(gk);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:f,modifiers:h,hasImportantModifier:m,baseClassName:v,maybePostfixModifierPosition:g}=n(d);if(f){c=d+(c.length>0?" "+c:c);continue}let x=!!g,b=s(x?v.substring(0,g):v);if(!b){if(!x){c=d+(c.length>0?" "+c:c);continue}if(b=s(v),!b){c=d+(c.length>0?" "+c:c);continue}x=!1}const y=h.length===0?"":h.length===1?h[0]:i(h).join(":"),k=m?y+xa:y,j=k+b;if(a.indexOf(j)>-1)continue;a.push(j);const C=o(b,x);for(let T=0;T<C.length;++T){const N=C[T];a.push(k+N)}c=d+(c.length>0?" "+c:c)}return c},bk=(...e)=>{let t=0,n,s,o="";for(;t<e.length;)(n=e[t++])&&(s=cp(n))&&(o&&(o+=" "),o+=s);return o},cp=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=cp(e[s]))&&(n&&(n+=" "),n+=t);return n},vk=(e,...t)=>{let n,s,o,i;const a=c=>{const u=t.reduce((d,f)=>f(d),e());return n=mk(u),s=n.cache.get,o=n.cache.set,i=l,l(c)},l=c=>{const u=s(c);if(u)return u;const d=xk(c,n);return o(c,d),d};return i=a,(...c)=>i(bk(...c))},yk=[],Xe=e=>{const t=n=>n[e]||yk;return t.isThemeGetter=!0,t},up=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,dp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,wk=/^\d+\/\d+$/,_k=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,kk=/\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$/,jk=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Sk=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ck=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,es=e=>wk.test(e),Oe=e=>!!e&&!Number.isNaN(Number(e)),un=e=>!!e&&Number.isInteger(Number(e)),Ci=e=>e.endsWith("%")&&Oe(e.slice(0,-1)),tn=e=>_k.test(e),Nk=()=>!0,Tk=e=>kk.test(e)&&!jk.test(e),fp=()=>!1,Ek=e=>Sk.test(e),Ak=e=>Ck.test(e),Rk=e=>!ye(e)&&!we(e),Ik=e=>Rs(e,mp,fp),ye=e=>up.test(e),In=e=>Rs(e,gp,Tk),Ni=e=>Rs(e,Lk,Oe),Jc=e=>Rs(e,pp,fp),zk=e=>Rs(e,hp,Ak),Nr=e=>Rs(e,xp,Ek),we=e=>dp.test(e),Ls=e=>Is(e,gp),Ok=e=>Is(e,Dk),Yc=e=>Is(e,pp),Pk=e=>Is(e,mp),Mk=e=>Is(e,hp),Tr=e=>Is(e,xp,!0),Rs=(e,t,n)=>{const s=up.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},Is=(e,t,n=!1)=>{const s=dp.exec(e);return s?s[1]?t(s[1]):n:!1},pp=e=>e==="position"||e==="percentage",hp=e=>e==="image"||e==="url",mp=e=>e==="length"||e==="size"||e==="bg-size",gp=e=>e==="length",Lk=e=>e==="number",Dk=e=>e==="family-name",xp=e=>e==="shadow",$k=()=>{const e=Xe("color"),t=Xe("font"),n=Xe("text"),s=Xe("font-weight"),o=Xe("tracking"),i=Xe("leading"),a=Xe("breakpoint"),l=Xe("container"),c=Xe("spacing"),u=Xe("radius"),d=Xe("shadow"),f=Xe("inset-shadow"),h=Xe("text-shadow"),m=Xe("drop-shadow"),v=Xe("blur"),g=Xe("perspective"),x=Xe("aspect"),b=Xe("ease"),y=Xe("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],j=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...j(),we,ye],T=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],O=()=>[we,ye,c],A=()=>[es,"full","auto",...O()],z=()=>[un,"none","subgrid",we,ye],D=()=>["auto",{span:["full",un,we,ye]},un,we,ye],E=()=>[un,"auto",we,ye],L=()=>["auto","min","max","fr",we,ye],w=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$=()=>["start","end","center","stretch","center-safe","end-safe"],ee=()=>["auto",...O()],F=()=>[es,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],W=()=>[e,we,ye],Z=()=>[...j(),Yc,Jc,{position:[we,ye]}],ue=()=>["no-repeat",{repeat:["","x","y","space","round"]}],V=()=>["auto","cover","contain",Pk,Ik,{size:[we,ye]}],H=()=>[Ci,Ls,In],le=()=>["","none","full",u,we,ye],U=()=>["",Oe,Ls,In],X=()=>["solid","dashed","dotted","double"],Ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[Oe,Ci,Yc,Jc],ge=()=>["","none",v,we,ye],xe=()=>["none",Oe,we,ye],he=()=>["none",Oe,we,ye],be=()=>[Oe,we,ye],Se=()=>[es,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[tn],breakpoint:[tn],color:[Nk],container:[tn],"drop-shadow":[tn],ease:["in","out","in-out"],font:[Rk],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[tn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[tn],shadow:[tn],spacing:["px",Oe],text:[tn],"text-shadow":[tn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",es,ye,we,x]}],container:["container"],columns:[{columns:[Oe,ye,we,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"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:C()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{start:A()}],end:[{end:A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[un,"auto",we,ye]}],basis:[{basis:[es,"full","auto",l,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Oe,es,"auto","initial","none",ye]}],grow:[{grow:["",Oe,we,ye]}],shrink:[{shrink:["",Oe,we,ye]}],order:[{order:[un,"first","last","none",we,ye]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":L()}],"auto-rows":[{"auto-rows":L()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...w(),"normal"]}],"justify-items":[{"justify-items":[...$(),"normal"]}],"justify-self":[{"justify-self":["auto",...$()]}],"align-content":[{content:["normal",...w()]}],"align-items":[{items:[...$(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$(),{baseline:["","last"]}]}],"place-content":[{"place-content":w()}],"place-items":[{"place-items":[...$(),"baseline"]}],"place-self":[{"place-self":["auto",...$()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:ee()}],mx:[{mx:ee()}],my:[{my:ee()}],ms:[{ms:ee()}],me:[{me:ee()}],mt:[{mt:ee()}],mr:[{mr:ee()}],mb:[{mb:ee()}],ml:[{ml:ee()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:F()}],w:[{w:[l,"screen",...F()]}],"min-w":[{"min-w":[l,"screen","none",...F()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[a]},...F()]}],h:[{h:["screen","lh",...F()]}],"min-h":[{"min-h":["screen","lh","none",...F()]}],"max-h":[{"max-h":["screen","lh",...F()]}],"font-size":[{text:["base",n,Ls,In]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,we,Ni]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ci,ye]}],"font-family":[{font:[Ok,ye,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,we,ye]}],"line-clamp":[{"line-clamp":[Oe,"none",we,Ni]}],leading:[{leading:[i,...O()]}],"list-image":[{"list-image":["none",we,ye]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",we,ye]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...X(),"wavy"]}],"text-decoration-thickness":[{decoration:[Oe,"from-font","auto",we,In]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[Oe,"auto",we,ye]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",we,ye]}],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",we,ye]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Z()}],"bg-repeat":[{bg:ue()}],"bg-size":[{bg:V()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},un,we,ye],radial:["",we,ye],conic:[un,we,ye]},Mk,zk]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:le()}],"rounded-s":[{"rounded-s":le()}],"rounded-e":[{"rounded-e":le()}],"rounded-t":[{"rounded-t":le()}],"rounded-r":[{"rounded-r":le()}],"rounded-b":[{"rounded-b":le()}],"rounded-l":[{"rounded-l":le()}],"rounded-ss":[{"rounded-ss":le()}],"rounded-se":[{"rounded-se":le()}],"rounded-ee":[{"rounded-ee":le()}],"rounded-es":[{"rounded-es":le()}],"rounded-tl":[{"rounded-tl":le()}],"rounded-tr":[{"rounded-tr":le()}],"rounded-br":[{"rounded-br":le()}],"rounded-bl":[{"rounded-bl":le()}],"border-w":[{border:U()}],"border-w-x":[{"border-x":U()}],"border-w-y":[{"border-y":U()}],"border-w-s":[{"border-s":U()}],"border-w-e":[{"border-e":U()}],"border-w-t":[{"border-t":U()}],"border-w-r":[{"border-r":U()}],"border-w-b":[{"border-b":U()}],"border-w-l":[{"border-l":U()}],"divide-x":[{"divide-x":U()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":U()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...X(),"hidden","none"]}],"divide-style":[{divide:[...X(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...X(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Oe,we,ye]}],"outline-w":[{outline:["",Oe,Ls,In]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",d,Tr,Nr]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",f,Tr,Nr]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[Oe,In]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":U()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",h,Tr,Nr]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[Oe,we,ye]}],"mix-blend":[{"mix-blend":[...Ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ce()}],"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":[Oe]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[we,ye]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"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":j()}],"mask-image-conic-pos":[{"mask-conic":[Oe]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Z()}],"mask-repeat":[{mask:ue()}],"mask-size":[{mask:V()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",we,ye]}],filter:[{filter:["","none",we,ye]}],blur:[{blur:ge()}],brightness:[{brightness:[Oe,we,ye]}],contrast:[{contrast:[Oe,we,ye]}],"drop-shadow":[{"drop-shadow":["","none",m,Tr,Nr]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",Oe,we,ye]}],"hue-rotate":[{"hue-rotate":[Oe,we,ye]}],invert:[{invert:["",Oe,we,ye]}],saturate:[{saturate:[Oe,we,ye]}],sepia:[{sepia:["",Oe,we,ye]}],"backdrop-filter":[{"backdrop-filter":["","none",we,ye]}],"backdrop-blur":[{"backdrop-blur":ge()}],"backdrop-brightness":[{"backdrop-brightness":[Oe,we,ye]}],"backdrop-contrast":[{"backdrop-contrast":[Oe,we,ye]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Oe,we,ye]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Oe,we,ye]}],"backdrop-invert":[{"backdrop-invert":["",Oe,we,ye]}],"backdrop-opacity":[{"backdrop-opacity":[Oe,we,ye]}],"backdrop-saturate":[{"backdrop-saturate":[Oe,we,ye]}],"backdrop-sepia":[{"backdrop-sepia":["",Oe,we,ye]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",we,ye]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Oe,"initial",we,ye]}],ease:[{ease:["linear","initial",b,we,ye]}],delay:[{delay:[Oe,we,ye]}],animate:[{animate:["none",y,we,ye]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,we,ye]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:xe()}],"rotate-x":[{"rotate-x":xe()}],"rotate-y":[{"rotate-y":xe()}],"rotate-z":[{"rotate-z":xe()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":["scale-3d"],skew:[{skew:be()}],"skew-x":[{"skew-x":be()}],"skew-y":[{"skew-y":be()}],transform:[{transform:[we,ye,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Se()}],"translate-x":[{"translate-x":Se()}],"translate-y":[{"translate-y":Se()}],"translate-z":[{"translate-z":Se()}],"translate-none":["translate-none"],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"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",we,ye]}],"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":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"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",we,ye]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[Oe,Ls,In,Ni]}],stroke:[{stroke:["none",...W()]}],"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"]}},Fk=vk($k);function ie(...e){return Fk(op(e))}function Fe(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":(e/1e3).toFixed(1).replace(/\.0$/,"")+"K"}function bp(e){return e>=1024*1024?(e/(1024*1024)).toFixed(1).replace(/\.0$/,"")+"M":(e/1024).toFixed(1).replace(/\.0$/,"")+"K"}function Xc(e,t,n){const s=e*10;return!Number.isSafeInteger(s)||s%t!==0?null:(s/t/10).toFixed(1).replace(/\.0$/,"")+n}function Bk(e){if(!Number.isSafeInteger(e)||e<=0)return e.toString();if(e>=1024*1024){const n=Xc(e,1048576,"M");if(n!==null)return n}const t=Xc(e,1024,"K");return t!==null?t:e.toString()}function Uk(e){if(e===void 0||e==="")return 1;switch(e.toLowerCase()){case"k":return 1024;case"m":return 1024*1024;default:return null}}function go(e){const t=e.trim().replaceAll(",","");if(t==="")return null;const n=/^(\d+(?:\.\d+)?)\s*([kKmM])?$/.exec(t);if(n===null)return null;const s=n[1];if(s===void 0)return null;const o=Number(s),i=n[2],a=Uk(i);if(!Number.isFinite(o)||o<=0||a===null||(i===void 0||i==="")&&!Number.isInteger(o))return null;const l=Math.round(o*a);return!Number.isSafeInteger(l)||l<=0?null:l}function Wk(e){return e===null?"pending":e>=200&&e<300?"success":e>=400&&e<500?"client_error":e>=500?"server_error":"pending"}const Hk=J({model:S().min(1),contextWindow:K().int().positive().optional(),outputLimit:K().int().positive().optional(),source:Re(["manual","registry"]).optional(),sourceUrl:S().optional(),updatedAt:S().optional()}),xo=J({id:S(),name:S(),apiKey:S(),model:S().optional(),models:fe(S()).min(1),format:Re(["anthropic","openai"]).optional(),baseUrl:S().optional(),anthropicBaseUrl:S().optional(),openaiBaseUrl:S().optional(),openaiResponsesBaseUrl:S().optional(),authHeader:Re(["bearer","x-api-key"]).optional().default("bearer"),apiDocsUrl:S().optional(),modelMetadataUrl:S().optional(),modelMetadata:fe(Hk).optional(),source:Re(["company","personal"]).optional(),createdAt:S(),updatedAt:S()});async function Vk(e){return pt(e,xo.array(),void 0,t=>`Failed to fetch ${e}: ${t.status}`)}function vp(){const e=qt("/api/providers?includeSecrets=1",Vk,{revalidateOnFocus:!1,revalidateIfStale:!1});return{providers:e.data??[],isLoading:e.isLoading,isError:e.error,mutate:e.mutate}}function Te(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}function Qc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function yp(...e){return t=>{let n=!1;const s=e.map(o=>{const i=Qc(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<s.length;o++){const i=s[o];typeof i=="function"?i():Qc(e[o],null)}}}}function De(...e){return p.useCallback(yp(...e),e)}function qk(e,t){const n=p.createContext(t),s=i=>{const{children:a,...l}=i,c=p.useMemo(()=>l,Object.values(l));return r.jsx(n.Provider,{value:c,children:a})};s.displayName=e+"Provider";function o(i){const a=p.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[s,o]}function cn(e,t=[]){let n=[];function s(i,a){const l=p.createContext(a),c=n.length;n=[...n,a];const u=f=>{const{scope:h,children:m,...v}=f,g=h?.[e]?.[c]||l,x=p.useMemo(()=>v,Object.values(v));return r.jsx(g.Provider,{value:x,children:m})};u.displayName=i+"Provider";function d(f,h){const m=h?.[e]?.[c]||l,v=p.useContext(m);if(v)return v;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[u,d]}const o=()=>{const i=n.map(a=>p.createContext(a));return function(l){const c=l?.[e]||i;return p.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[s,Zk(o,...t)]}function Zk(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const a=s.reduce((l,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...l,...f}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var tt=globalThis?.document?p.useLayoutEffect:()=>{},Gk=$d[" useId ".trim().toString()]||(()=>{}),Kk=0;function Zt(e){const[t,n]=p.useState(Gk());return tt(()=>{n(s=>s??String(Kk++))},[e]),e||(t?`radix-${t}`:"")}var Jk=$d[" useInsertionEffect ".trim().toString()]||tt;function Fn({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[o,i,a]=Yk({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:o;{const d=p.useRef(e!==void 0);p.useEffect(()=>{const f=d.current;f!==l&&console.warn(`${s} 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,s])}const u=p.useCallback(d=>{if(l){const f=Xk(d)?d(e):d;f!==e&&a.current?.(f)}else i(d)},[l,e,i,a]);return[c,u]}function Yk({defaultProp:e,onChange:t}){const[n,s]=p.useState(e),o=p.useRef(n),i=p.useRef(t);return Jk(()=>{i.current=t},[t]),p.useEffect(()=>{o.current!==n&&(i.current?.(n),o.current=n)},[n,o]),[n,s,i]}function Xk(e){return typeof e=="function"}function ks(e){const t=e5(e),n=p.forwardRef((s,o)=>{const{children:i,...a}=s,l=p.Children.toArray(i),c=l.find(n5);if(c){const u=c.props.children,d=l.map(f=>f===c?p.Children.count(u)>1?p.Children.only(null):p.isValidElement(u)?u.props.children:null:f);return r.jsx(t,{...a,ref:o,children:p.isValidElement(u)?p.cloneElement(u,void 0,d):null})}return r.jsx(t,{...a,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}var Qk=ks("Slot");function e5(e){const t=p.forwardRef((n,s)=>{const{children:o,...i}=n;if(p.isValidElement(o)){const a=r5(o),l=s5(i,o.props);return o.type!==p.Fragment&&(l.ref=s?yp(s,a):a),p.cloneElement(o,l)}return p.Children.count(o)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var wp=Symbol("radix.slottable");function t5(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=wp,t}function n5(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===wp}function s5(e,t){const n={...t};for(const s in t){const o=e[s],i=t[s];/^on[A-Z]/.test(s)?o&&i?n[s]=(...l)=>{const c=i(...l);return o(...l),c}:o&&(n[s]=o):s==="style"?n[s]={...o,...i}:s==="className"&&(n[s]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function r5(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 o5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ze=o5.reduce((e,t)=>{const n=ks(`Primitive.${t}`),s=p.forwardRef((o,i)=>{const{asChild:a,...l}=o,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(c,{...l,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function i5(e,t){e&&cr.flushSync(()=>e.dispatchEvent(t))}function ft(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>t.current?.(...n),[])}function a5(e,t=globalThis?.document){const n=ft(e);p.useEffect(()=>{const s=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var l5="DismissableLayer",ba="dismissableLayer.update",c5="dismissableLayer.pointerDownOutside",u5="dismissableLayer.focusOutside",eu,_p=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Go=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:l,...c}=e,u=p.useContext(_p),[d,f]=p.useState(null),h=d?.ownerDocument??globalThis?.document,[,m]=p.useState({}),v=De(t,N=>f(N)),g=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=g.indexOf(x),y=d?g.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,j=y>=b,C=p5(N=>{const O=N.target,A=[...u.branches].some(z=>z.contains(O));!j||A||(o?.(N),a?.(N),N.defaultPrevented||l?.())},h),T=h5(N=>{const O=N.target;[...u.branches].some(z=>z.contains(O))||(i?.(N),a?.(N),N.defaultPrevented||l?.())},h);return a5(N=>{y===u.layers.size-1&&(s?.(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},h),p.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(eu=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),tu(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=eu)}},[d,h,n,u]),p.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),tu())},[d,u]),p.useEffect(()=>{const N=()=>m({});return document.addEventListener(ba,N),()=>document.removeEventListener(ba,N)},[]),r.jsx(ze.div,{...c,ref:v,style:{pointerEvents:k?j?"auto":"none":void 0,...e.style},onFocusCapture:Te(e.onFocusCapture,T.onFocusCapture),onBlurCapture:Te(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Te(e.onPointerDownCapture,C.onPointerDownCapture)})});Go.displayName=l5;var d5="DismissableLayerBranch",f5=p.forwardRef((e,t)=>{const n=p.useContext(_p),s=p.useRef(null),o=De(t,s);return p.useEffect(()=>{const i=s.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),r.jsx(ze.div,{...e,ref:o})});f5.displayName=d5;function p5(e,t=globalThis?.document){const n=ft(e),s=p.useRef(!1),o=p.useRef(()=>{});return p.useEffect(()=>{const i=l=>{if(l.target&&!s.current){let c=function(){kp(c5,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);s.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function h5(e,t=globalThis?.document){const n=ft(e),s=p.useRef(!1);return p.useEffect(()=>{const o=i=>{i.target&&!s.current&&kp(u5,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function tu(){const e=new CustomEvent(ba);document.dispatchEvent(e)}function kp(e,t,n,{discrete:s}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),s?i5(o,i):o.dispatchEvent(i)}var Ti="focusScope.autoFocusOnMount",Ei="focusScope.autoFocusOnUnmount",nu={bubbles:!1,cancelable:!0},m5="FocusScope",Rl=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=e,[l,c]=p.useState(null),u=ft(o),d=ft(i),f=p.useRef(null),h=De(t,g=>c(g)),m=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(s){let g=function(k){if(m.paused||!l)return;const j=k.target;l.contains(j)?f.current=j:mn(f.current,{select:!0})},x=function(k){if(m.paused||!l)return;const j=k.relatedTarget;j!==null&&(l.contains(j)||mn(f.current,{select:!0}))},b=function(k){if(document.activeElement===document.body)for(const C of k)C.removedNodes.length>0&&mn(l)};document.addEventListener("focusin",g),document.addEventListener("focusout",x);const y=new MutationObserver(b);return l&&y.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",x),y.disconnect()}}},[s,l,m.paused]),p.useEffect(()=>{if(l){ru.add(m);const g=document.activeElement;if(!l.contains(g)){const b=new CustomEvent(Ti,nu);l.addEventListener(Ti,u),l.dispatchEvent(b),b.defaultPrevented||(g5(w5(jp(l)),{select:!0}),document.activeElement===g&&mn(l))}return()=>{l.removeEventListener(Ti,u),setTimeout(()=>{const b=new CustomEvent(Ei,nu);l.addEventListener(Ei,d),l.dispatchEvent(b),b.defaultPrevented||mn(g??document.body,{select:!0}),l.removeEventListener(Ei,d),ru.remove(m)},0)}}},[l,u,d,m]);const v=p.useCallback(g=>{if(!n&&!s||m.paused)return;const x=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,b=document.activeElement;if(x&&b){const y=g.currentTarget,[k,j]=x5(y);k&&j?!g.shiftKey&&b===j?(g.preventDefault(),n&&mn(k,{select:!0})):g.shiftKey&&b===k&&(g.preventDefault(),n&&mn(j,{select:!0})):b===y&&g.preventDefault()}},[n,s,m.paused]);return r.jsx(ze.div,{tabIndex:-1,...a,ref:h,onKeyDown:v})});Rl.displayName=m5;function g5(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(mn(s,{select:t}),document.activeElement!==n)return}function x5(e){const t=jp(e),n=su(t,e),s=su(t.reverse(),e);return[n,s]}function jp(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const o=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||o?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function su(e,t){for(const n of e)if(!b5(n,{upTo:t}))return n}function b5(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 v5(e){return e instanceof HTMLInputElement&&"select"in e}function mn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&v5(e)&&t&&e.select()}}var ru=y5();function y5(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=ou(e,t),e.unshift(t)},remove(t){e=ou(e,t),e[0]?.resume()}}}function ou(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function w5(e){return e.filter(t=>t.tagName!=="A")}var _5="Portal",Ko=p.forwardRef((e,t)=>{const{container:n,...s}=e,[o,i]=p.useState(!1);tt(()=>i(!0),[]);const a=n||o&&globalThis?.document?.body;return a?ag.createPortal(r.jsx(ze.div,{...s,ref:t}),a):null});Ko.displayName=_5;function k5(e,t){return p.useReducer((n,s)=>t[n][s]??n,e)}var Rt=e=>{const{present:t,children:n}=e,s=j5(t),o=typeof n=="function"?n({present:s.isPresent}):p.Children.only(n),i=De(s.ref,S5(o));return typeof n=="function"||s.isPresent?p.cloneElement(o,{ref:i}):null};Rt.displayName="Presence";function j5(e){const[t,n]=p.useState(),s=p.useRef(null),o=p.useRef(e),i=p.useRef("none"),a=e?"mounted":"unmounted",[l,c]=k5(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const u=Er(s.current);i.current=l==="mounted"?u:"none"},[l]),tt(()=>{const u=s.current,d=o.current;if(d!==e){const h=i.current,m=Er(u);e?c("MOUNT"):m==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&h!==m?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),tt(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=m=>{const g=Er(s.current).includes(CSS.escape(m.animationName));if(m.target===t&&g&&(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=m=>{m.target===t&&(i.current=Er(s.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:p.useCallback(u=>{s.current=u?getComputedStyle(u):null,n(u)},[])}}function Er(e){return e?.animationName||"none"}function S5(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 Ai=0;function Sp(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??iu()),document.body.insertAdjacentElement("beforeend",e[1]??iu()),Ai++,()=>{Ai===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ai--}},[])}function iu(){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 Ht=function(){return Ht=Object.assign||function(t){for(var n,s=1,o=arguments.length;s<o;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Ht.apply(this,arguments)};function Cp(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,s=Object.getOwnPropertySymbols(e);o<s.length;o++)t.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(e,s[o])&&(n[s[o]]=e[s[o]]);return n}function C5(e,t,n){if(n||arguments.length===2)for(var s=0,o=t.length,i;s<o;s++)(i||!(s in t))&&(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))}var Xr="right-scroll-bar-position",Qr="width-before-scroll-bar",N5="with-scroll-bars-hidden",T5="--removed-body-scroll-bar-size";function Ri(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function E5(e,t){var n=p.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var o=n.value;o!==s&&(n.value=s,n.callback(s,o))}}}})[0];return n.callback=t,n.facade}var A5=typeof window<"u"?p.useLayoutEffect:p.useEffect,au=new WeakMap;function R5(e,t){var n=E5(null,function(s){return e.forEach(function(o){return Ri(o,s)})});return A5(function(){var s=au.get(n);if(s){var o=new Set(s),i=new Set(e),a=n.current;o.forEach(function(l){i.has(l)||Ri(l,null)}),i.forEach(function(l){o.has(l)||Ri(l,a)})}au.set(n,e)},[e]),n}function I5(e){return e}function z5(e,t){t===void 0&&(t=I5);var n=[],s=!1,o={read:function(){if(s)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(i){var a=t(i,s);return n.push(a),function(){n=n.filter(function(l){return l!==a})}},assignSyncMedium:function(i){for(s=!0;n.length;){var a=n;n=[],a.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){s=!0;var a=[];if(n.length){var l=n;n=[],l.forEach(i),a=n}var c=function(){var d=a;a=[],d.forEach(i)},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 O5(e){e===void 0&&(e={});var t=z5(null);return t.options=Ht({async:!0,ssr:!1},e),t}var Np=function(e){var t=e.sideCar,n=Cp(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return p.createElement(s,Ht({},n))};Np.isSideCarExport=!0;function P5(e,t){return e.useMedium(t),Np}var Tp=O5(),Ii=function(){},Jo=p.forwardRef(function(e,t){var n=p.useRef(null),s=p.useState({onScrollCapture:Ii,onWheelCapture:Ii,onTouchMoveCapture:Ii}),o=s[0],i=s[1],a=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,h=e.sideCar,m=e.noRelative,v=e.noIsolation,g=e.inert,x=e.allowPinchZoom,b=e.as,y=b===void 0?"div":b,k=e.gapMode,j=Cp(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=h,T=R5([n,t]),N=Ht(Ht({},j),o);return p.createElement(p.Fragment,null,d&&p.createElement(C,{sideCar:Tp,removeScrollBar:u,shards:f,noRelative:m,noIsolation:v,inert:g,setCallbacks:i,allowPinchZoom:!!x,lockRef:n,gapMode:k}),a?p.cloneElement(p.Children.only(l),Ht(Ht({},N),{ref:T})):p.createElement(y,Ht({},N,{className:c,ref:T}),l))});Jo.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Jo.classNames={fullWidth:Qr,zeroRight:Xr};var M5=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function L5(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=M5();return t&&e.setAttribute("nonce",t),e}function D5(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function $5(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var F5=function(){var e=0,t=null;return{add:function(n){e==0&&(t=L5())&&(D5(t,n),$5(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},B5=function(){var e=F5();return function(t,n){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ep=function(){var e=B5(),t=function(n){var s=n.styles,o=n.dynamic;return e(s,o),null};return t},U5={left:0,top:0,right:0,gap:0},zi=function(e){return parseInt(e||"",10)||0},W5=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[zi(n),zi(s),zi(o)]},H5=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return U5;var t=W5(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},V5=Ep(),ms="data-scroll-locked",q5=function(e,t,n,s){var o=e.left,i=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
42
|
-
.`.concat(
|
|
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]){i(a);continue}if(e.external){const u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(l.cycle){i(a);continue}if(l.count>1&&e.reused==="ref"){i(a);continue}}}function mf(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=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){s(d);const h=e.seen.get(d),m=h.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(m)):Object.assign(c,m),Object.assign(c,u),a._zod.parent===d)for(const g in c)g==="$ref"||g==="allOf"||g in u||delete c[g];if(m.$ref&&h.def)for(const g in c)g==="$ref"||g==="allOf"||g in h.def&&JSON.stringify(c[g])===JSON.stringify(h.def[g])&&delete c[g]}const f=a._zod.parent;if(f&&f!==d){s(f);const h=e.seen.get(f);if(h?.schema.$ref&&(c.$ref=h.schema.$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]}e.override({zodSchema:a,jsonSchema:c,path:l.path??[]})};for(const a of[...e.seen.entries()].reverse())s(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 i=e.external?.defs??{};for(const a of e.seen.entries()){const l=a[1];l.def&&l.defId&&(i[l.defId]=l.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:fo(t,"input",e.processors),output:fo(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function lt(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const s=e._zod.def;if(s.type==="transform")return!0;if(s.type==="array")return lt(s.element,n);if(s.type==="set")return lt(s.valueType,n);if(s.type==="lazy")return lt(s.getter(),n);if(s.type==="promise"||s.type==="optional"||s.type==="nonoptional"||s.type==="nullable"||s.type==="readonly"||s.type==="default"||s.type==="prefault")return lt(s.innerType,n);if(s.type==="intersection")return lt(s.left,n)||lt(s.right,n);if(s.type==="record"||s.type==="map")return lt(s.keyType,n)||lt(s.valueType,n);if(s.type==="pipe")return lt(s.in,n)||lt(s.out,n);if(s.type==="object"){for(const o in s.shape)if(lt(s.shape[o],n))return!0;return!1}if(s.type==="union"){for(const o of s.options)if(lt(o,n))return!0;return!1}if(s.type==="tuple"){for(const o of s.items)if(lt(o,n))return!0;return!!(s.rest&<(s.rest,n))}return!1}const cb=(e,t={})=>n=>{const s=pf({...n,processors:t});return Je(e,s),hf(s,e),mf(s,e)},fo=(e,t,n={})=>s=>{const{libraryOptions:o,target:i}=s??{},a=pf({...o??{},target:i,io:t,processors:n});return Je(e,a),hf(a,e),mf(a,e)},ub={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},db=(e,t,n,s)=>{const o=n;o.type="string";const{minimum:i,maximum:a,format:l,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),l&&(o.format=ub[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}))])}},fb=(e,t,n,s)=>{const o=n,{minimum:i,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 i=="number"&&(o.minimum=i,typeof d=="number"&&t.target!=="draft-04"&&(d>=i?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)},pb=(e,t,n,s)=>{n.type="boolean"},hb=(e,t,n,s)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},mb=(e,t,n,s)=>{n.not={}},gb=(e,t,n,s)=>{},xb=(e,t,n,s)=>{const o=e._zod.def,i=Vd(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},bb=(e,t,n,s)=>{const o=e._zod.def,i=[];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");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),i.every(a=>typeof a=="boolean")&&(n.type="boolean"),i.every(a=>a===null)&&(n.type="null"),n.enum=i},vb=(e,t,n,s)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},yb=(e,t,n,s)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},wb=(e,t,n,s)=>{const o=n,i=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=Je(i.element,t,{...s,path:[...s.path,"items"]})},_b=(e,t,n,s)=>{const o=n,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const u in a)o.properties[u]=Je(a[u],t,{...s,path:[...s.path,"properties",u]});const l=new Set(Object.keys(a)),c=new Set([...l].filter(u=>{const d=i.shape[u]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Je(i.catchall,t,{...s,path:[...s.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},kb=(e,t,n,s)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((l,c)=>Je(l,t,{...s,path:[...s.path,i?"oneOf":"anyOf",c]}));i?n.oneOf=a:n.anyOf=a},jb=(e,t,n,s)=>{const o=e._zod.def,i=Je(o.left,t,{...s,path:[...s.path,"allOf",0]}),a=Je(o.right,t,{...s,path:[...s.path,"allOf",1]}),l=u=>"allOf"in u&&Object.keys(u).length===1,c=[...l(i)?i.allOf:[i],...l(a)?a.allOf:[a]];n.allOf=c},Sb=(e,t,n,s)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){const d=Je(i.valueType,t,{...s,path:[...s.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=Je(i.keyType,t,{...s,path:[...s.path,"propertyNames"]})),o.additionalProperties=Je(i.valueType,t,{...s,path:[...s.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)}},Cb=(e,t,n,s)=>{const o=e._zod.def,i=Je(o.innerType,t,s),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},Nb=(e,t,n,s)=>{const o=e._zod.def;Je(o.innerType,t,s);const i=t.seen.get(e);i.ref=o.innerType},Tb=(e,t,n,s)=>{const o=e._zod.def;Je(o.innerType,t,s);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Eb=(e,t,n,s)=>{const o=e._zod.def;Je(o.innerType,t,s);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Ab=(e,t,n,s)=>{const o=e._zod.def;Je(o.innerType,t,s);const i=t.seen.get(e);i.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},Rb=(e,t,n,s)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Je(i,t,s);const a=t.seen.get(e);a.ref=i},Ib=(e,t,n,s)=>{const o=e._zod.def;Je(o.innerType,t,s);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},gf=(e,t,n,s)=>{const o=e._zod.def;Je(o.innerType,t,s);const i=t.seen.get(e);i.ref=o.innerType},zb=(e,t,n,s)=>{const o=e._zod.innerType;Je(o,t,s);const i=t.seen.get(e);i.ref=o},Pb=te("ZodISODateTime",(e,t)=>{Ax.init(e,t),qe.init(e,t)});function Ob(e){return D1(Pb,e)}const Mb=te("ZodISODate",(e,t)=>{Rx.init(e,t),qe.init(e,t)});function Lb(e){return $1(Mb,e)}const Db=te("ZodISOTime",(e,t)=>{Ix.init(e,t),qe.init(e,t)});function $b(e){return F1(Db,e)}const Fb=te("ZodISODuration",(e,t)=>{zx.init(e,t),qe.init(e,t)});function Bb(e){return B1(Fb,e)}const Ub=(e,t)=>{Kd.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>_g(e,n)},flatten:{value:n=>wg(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,oa,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,oa,2)}},isEmpty:{get(){return e.issues.length===0}}})},At=te("ZodError",Ub,{Parent:Error}),Wb=rl(At),Hb=ol(At),Vb=Uo(At),qb=Wo(At),Zb=Sg(At),Gb=Cg(At),Kb=Ng(At),Jb=Tg(At),Yb=Eg(At),Xb=Ag(At),Qb=Rg(At),ev=Ig(At),He=te("ZodType",(e,t)=>(We.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:fo(e,"input"),output:fo(e,"output")}}),e.toJSONSchema=cb(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Sn(t,{checks:[...t.checks??[],...n.map(s=>typeof s=="function"?{_zod:{check:s,def:{check:"custom"},onattach:[]}}:s)]}),{parent:!0}),e.with=e.check,e.clone=(n,s)=>Cn(e,n,s),e.brand=()=>e,e.register=((n,s)=>(n.add(e,s),e)),e.parse=(n,s)=>Wb(e,n,s,{callee:e.parse}),e.safeParse=(n,s)=>Vb(e,n,s),e.parseAsync=async(n,s)=>Hb(e,n,s,{callee:e.parseAsync}),e.safeParseAsync=async(n,s)=>qb(e,n,s),e.spa=e.safeParseAsync,e.encode=(n,s)=>Zb(e,n,s),e.decode=(n,s)=>Gb(e,n,s),e.encodeAsync=async(n,s)=>Kb(e,n,s),e.decodeAsync=async(n,s)=>Jb(e,n,s),e.safeEncode=(n,s)=>Yb(e,n,s),e.safeDecode=(n,s)=>Xb(e,n,s),e.safeEncodeAsync=async(n,s)=>Qb(e,n,s),e.safeDecodeAsync=async(n,s)=>ev(e,n,s),e.refine=(n,s)=>e.check(Jv(n,s)),e.superRefine=n=>e.check(Yv(n)),e.overwrite=n=>e.check(Is(n)),e.optional=()=>$c(e),e.exactOptional=()=>Ov(e),e.nullable=()=>Fc(e),e.nullish=()=>$c(Fc(e)),e.nonoptional=n=>Bv(e,n),e.array=()=>fe(e),e.or=n=>Yt([e,n]),e.and=n=>Ev(e,n),e.transform=n=>Bc(e,zv(n)),e.default=n=>Dv(e,n),e.prefault=n=>Fv(e,n),e.catch=n=>Wv(e,n),e.pipe=n=>Bc(e,n),e.readonly=()=>qv(e),e.describe=n=>{const s=e.clone();return Js.add(s,{description:n}),s},Object.defineProperty(e,"description",{get(){return Js.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Js.get(e);const s=e.clone();return Js.add(s,n[0]),s},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),xf=te("_ZodString",(e,t)=>{il.init(e,t),He.init(e,t),e._zod.processJSONSchema=(s,o,i)=>db(e,s,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...s)=>e.check(G1(...s)),e.includes=(...s)=>e.check(Y1(...s)),e.startsWith=(...s)=>e.check(X1(...s)),e.endsWith=(...s)=>e.check(Q1(...s)),e.min=(...s)=>e.check(uo(...s)),e.max=(...s)=>e.check(df(...s)),e.length=(...s)=>e.check(ff(...s)),e.nonempty=(...s)=>e.check(uo(1,...s)),e.lowercase=s=>e.check(K1(s)),e.uppercase=s=>e.check(J1(s)),e.trim=()=>e.check(tb()),e.normalize=(...s)=>e.check(eb(...s)),e.toLowerCase=()=>e.check(nb()),e.toUpperCase=()=>e.check(sb()),e.slugify=()=>e.check(rb())}),tv=te("ZodString",(e,t)=>{il.init(e,t),xf.init(e,t),e.email=n=>e.check(x1(nv,n)),e.url=n=>e.check(_1(sv,n)),e.jwt=n=>e.check(L1(bv,n)),e.emoji=n=>e.check(k1(rv,n)),e.guid=n=>e.check(zc(Lc,n)),e.uuid=n=>e.check(b1(Cr,n)),e.uuidv4=n=>e.check(v1(Cr,n)),e.uuidv6=n=>e.check(y1(Cr,n)),e.uuidv7=n=>e.check(w1(Cr,n)),e.nanoid=n=>e.check(j1(ov,n)),e.guid=n=>e.check(zc(Lc,n)),e.cuid=n=>e.check(S1(iv,n)),e.cuid2=n=>e.check(C1(av,n)),e.ulid=n=>e.check(N1(lv,n)),e.base64=n=>e.check(P1(mv,n)),e.base64url=n=>e.check(O1(gv,n)),e.xid=n=>e.check(T1(cv,n)),e.ksuid=n=>e.check(E1(uv,n)),e.ipv4=n=>e.check(A1(dv,n)),e.ipv6=n=>e.check(R1(fv,n)),e.cidrv4=n=>e.check(I1(pv,n)),e.cidrv6=n=>e.check(z1(hv,n)),e.e164=n=>e.check(M1(xv,n)),e.datetime=n=>e.check(Ob(n)),e.date=n=>e.check(Lb(n)),e.time=n=>e.check($b(n)),e.duration=n=>e.check(Bb(n))});function S(e){return g1(tv,e)}const qe=te("ZodStringFormat",(e,t)=>{Ve.init(e,t),xf.init(e,t)}),nv=te("ZodEmail",(e,t)=>{wx.init(e,t),qe.init(e,t)}),Lc=te("ZodGUID",(e,t)=>{vx.init(e,t),qe.init(e,t)}),Cr=te("ZodUUID",(e,t)=>{yx.init(e,t),qe.init(e,t)}),sv=te("ZodURL",(e,t)=>{_x.init(e,t),qe.init(e,t)}),rv=te("ZodEmoji",(e,t)=>{kx.init(e,t),qe.init(e,t)}),ov=te("ZodNanoID",(e,t)=>{jx.init(e,t),qe.init(e,t)}),iv=te("ZodCUID",(e,t)=>{Sx.init(e,t),qe.init(e,t)}),av=te("ZodCUID2",(e,t)=>{Cx.init(e,t),qe.init(e,t)}),lv=te("ZodULID",(e,t)=>{Nx.init(e,t),qe.init(e,t)}),cv=te("ZodXID",(e,t)=>{Tx.init(e,t),qe.init(e,t)}),uv=te("ZodKSUID",(e,t)=>{Ex.init(e,t),qe.init(e,t)}),dv=te("ZodIPv4",(e,t)=>{Px.init(e,t),qe.init(e,t)}),fv=te("ZodIPv6",(e,t)=>{Ox.init(e,t),qe.init(e,t)}),pv=te("ZodCIDRv4",(e,t)=>{Mx.init(e,t),qe.init(e,t)}),hv=te("ZodCIDRv6",(e,t)=>{Lx.init(e,t),qe.init(e,t)}),mv=te("ZodBase64",(e,t)=>{Dx.init(e,t),qe.init(e,t)}),gv=te("ZodBase64URL",(e,t)=>{Fx.init(e,t),qe.init(e,t)}),xv=te("ZodE164",(e,t)=>{Bx.init(e,t),qe.init(e,t)}),bv=te("ZodJWT",(e,t)=>{Wx.init(e,t),qe.init(e,t)}),bf=te("ZodNumber",(e,t)=>{of.init(e,t),He.init(e,t),e._zod.processJSONSchema=(s,o,i)=>fb(e,s,o),e.gt=(s,o)=>e.check(Oc(s,o)),e.gte=(s,o)=>e.check(ki(s,o)),e.min=(s,o)=>e.check(ki(s,o)),e.lt=(s,o)=>e.check(Pc(s,o)),e.lte=(s,o)=>e.check(_i(s,o)),e.max=(s,o)=>e.check(_i(s,o)),e.int=s=>e.check(Dc(s)),e.safe=s=>e.check(Dc(s)),e.positive=s=>e.check(Oc(0,s)),e.nonnegative=s=>e.check(ki(0,s)),e.negative=s=>e.check(Pc(0,s)),e.nonpositive=s=>e.check(_i(0,s)),e.multipleOf=(s,o)=>e.check(Mc(s,o)),e.step=(s,o)=>e.check(Mc(s,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 K(e){return U1(bf,e)}const vv=te("ZodNumberFormat",(e,t)=>{Hx.init(e,t),bf.init(e,t)});function Dc(e){return W1(vv,e)}const yv=te("ZodBoolean",(e,t)=>{Vx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>pb(e,n,s)});function Le(e){return H1(yv,e)}const wv=te("ZodNull",(e,t)=>{qx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>hb(e,n,s)});function po(e){return V1(wv,e)}const _v=te("ZodUnknown",(e,t)=>{Zx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>gb()});function Ln(){return q1(_v)}const kv=te("ZodNever",(e,t)=>{Gx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>mb(e,n,s)});function jv(e){return Z1(kv,e)}const Sv=te("ZodArray",(e,t)=>{Kx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>wb(e,n,s,o),e.element=t.element,e.min=(n,s)=>e.check(uo(n,s)),e.nonempty=n=>e.check(uo(1,n)),e.max=(n,s)=>e.check(df(n,s)),e.length=(n,s)=>e.check(ff(n,s)),e.unwrap=()=>e.element});function fe(e,t){return ob(Sv,e,t)}const Cv=te("ZodObject",(e,t)=>{Yx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>_b(e,n,s,o),Oe(e,"shape",()=>t.shape),e.keyof=()=>Ee(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ln()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ln()}),e.strict=()=>e.clone({...e._zod.def,catchall:jv()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>gg(e,n),e.safeExtend=n=>xg(e,n),e.merge=n=>bg(e,n),e.pick=n=>hg(e,n),e.omit=n=>mg(e,n),e.partial=(...n)=>vg(yf,e,n[0]),e.required=(...n)=>yg(wf,e,n[0])});function J(e,t){const n={type:"object",shape:e??{},...je(t)};return new Cv(n)}const vf=te("ZodUnion",(e,t)=>{cf.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>kb(e,n,s,o),e.options=t.options});function Yt(e,t){return new vf({type:"union",options:e,...je(t)})}const Nv=te("ZodDiscriminatedUnion",(e,t)=>{vf.init(e,t),Xx.init(e,t)});function Zn(e,t,n){return new Nv({type:"union",options:t,discriminator:e,...je(n)})}const Tv=te("ZodIntersection",(e,t)=>{Qx.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>jb(e,n,s,o)});function Ev(e,t){return new Tv({type:"intersection",left:e,right:t})}const Av=te("ZodRecord",(e,t)=>{e1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Sb(e,n,s,o),e.keyType=t.keyType,e.valueType=t.valueType});function Ye(e,t,n){return new Av({type:"record",keyType:e,valueType:t,...je(n)})}const aa=te("ZodEnum",(e,t)=>{t1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(s,o,i)=>xb(e,s,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(s,o)=>{const i={};for(const a of s)if(n.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new aa({...t,checks:[],...je(o),entries:i})},e.exclude=(s,o)=>{const i={...t.entries};for(const a of s)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new aa({...t,checks:[],...je(o),entries:i})}});function Ee(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(s=>[s,s])):e;return new aa({type:"enum",entries:n,...je(t)})}const Rv=te("ZodLiteral",(e,t)=>{n1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>bb(e,n,s),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 Ae(e,t){return new Rv({type:"literal",values:Array.isArray(e)?e:[e],...je(t)})}const Iv=te("ZodTransform",(e,t)=>{s1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>yb(e,n),e._zod.parse=(n,s)=>{if(s.direction==="backward")throw new Wd(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(sr(i,n.value,t));else{const a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=e),n.issues.push(sr(a))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function zv(e){return new Iv({type:"transform",transform:e})}const yf=te("ZodOptional",(e,t)=>{uf.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>gf(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function $c(e){return new yf({type:"optional",innerType:e})}const Pv=te("ZodExactOptional",(e,t)=>{r1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>gf(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function Ov(e){return new Pv({type:"optional",innerType:e})}const Mv=te("ZodNullable",(e,t)=>{o1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Cb(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function Fc(e){return new Mv({type:"nullable",innerType:e})}const Lv=te("ZodDefault",(e,t)=>{i1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Tb(e,n,s,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Dv(e,t){return new Lv({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Zd(t)}})}const $v=te("ZodPrefault",(e,t)=>{a1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Eb(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function Fv(e,t){return new $v({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Zd(t)}})}const wf=te("ZodNonOptional",(e,t)=>{l1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Nb(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function Bv(e,t){return new wf({type:"nonoptional",innerType:e,...je(t)})}const Uv=te("ZodCatch",(e,t)=>{c1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Ab(e,n,s,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Wv(e,t){return new Uv({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Hv=te("ZodPipe",(e,t)=>{u1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Rb(e,n,s,o),e.in=t.in,e.out=t.out});function Bc(e,t){return new Hv({type:"pipe",in:e,out:t})}const Vv=te("ZodReadonly",(e,t)=>{d1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Ib(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function qv(e){return new Vv({type:"readonly",innerType:e})}const Zv=te("ZodLazy",(e,t)=>{f1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>zb(e,n,s,o),e.unwrap=()=>e._zod.def.getter()});function Gv(e){return new Zv({type:"lazy",getter:e})}const Kv=te("ZodCustom",(e,t)=>{p1.init(e,t),He.init(e,t),e._zod.processJSONSchema=(n,s,o)=>vb(e,n)});function Jv(e,t={}){return ib(Kv,e,t)}function Yv(e){return ab(e)}const nt=Gv(()=>Yt([S(),K(),Le(),po(),fe(nt),Ye(S(),nt)]));const _f=J({index:K(),timestamp:K(),type:S(),data:nt}),Xv=J({chunks:fe(_f),truncated:Le().optional().default(!1)}),Qv=Ee(["request","response"]),e2=J({logId:K().int().positive(),part:Qv,text:S(),offset:K().int().nonnegative(),limit:K().int().positive(),totalBytes:K().int().nonnegative(),textBytes:K().int().nonnegative(),nextOffset:K().int().nonnegative().nullable(),hasMore:Le(),contentMode:Ee(["empty","partial","full"])}),rr=J({id:K(),timestamp:S(),method:S(),path:S(),model:S().nullable(),sessionId:S().nullable(),rawRequestBody:S().nullable(),responseStatus:K().nullable(),responseText:S().nullable(),inputTokens:K().nullable(),outputTokens:K().nullable(),cacheCreationInputTokens:K().nullable(),cacheReadInputTokens:K().nullable(),elapsedMs:K().nullable(),firstChunkMs:K().nullable().optional(),totalStreamMs:K().nullable().optional(),tokensPerSecond:K().nullable().optional(),streaming:Le(),userAgent:S().nullable(),origin:S().nullable(),rawHeaders:Ye(S(),S()).optional(),headers:Ye(S(),S()).optional(),apiFormat:Ee(["anthropic","openai","unknown"]).default("unknown"),isTest:Le().optional().default(!1),replayOfLogId:K().nullable().optional(),providerName:S().nullable().optional(),clientPort:K().nullable().optional(),clientPid:K().nullable().optional(),clientCwd:S().nullable().optional(),clientProjectFolder:S().nullable().optional(),streamingChunks:Xv.optional(),streamingChunksPath:S().nullable().optional(),rawRequestBodyBytes:K().int().nonnegative().nullable().optional(),responseTextBytes:K().int().nonnegative().nullable().optional(),bodyContentMode:Ee(["full","compact","truncated"]).optional(),warnings:fe(S()).optional(),error:S().nullable().optional()}),al=J({type:S(),ttl:S().optional(),scope:S().optional()}),ll=J({type:Ae("text"),text:S(),cache_control:al.optional()}),kf=J({type:Ae("thinking"),thinking:S(),signature:S().optional()}),t2=J({type:Ae("think"),thinking:S(),signature:S().optional()}),n2=J({type:Ae("base64"),media_type:S(),data:S()}),jf=J({type:Ae("image"),source:n2}),Sf=J({type:Ae("tool_use"),id:S(),name:S(),input:Ye(S(),nt)}),s2=Zn("type",[ll,jf]),r2=J({type:Ae("tool_result"),tool_use_id:S().optional(),content:Yt([S(),fe(s2)]),is_error:Le().optional()}),o2=Zn("type",[ll,kf,jf,Sf,r2]),i2=Yt([S(),fe(o2)]),a2=J({role:Ee(["user","assistant"]),content:i2}),l2=J({type:Ae("text"),text:S(),cache_control:al.optional()}),c2=J({type:S(),properties:Ye(S(),Ye(S(),nt)).optional(),required:fe(S()).optional(),additionalProperties:Le().optional(),$schema:S().optional()}),u2=J({name:S(),description:S().optional(),input_schema:c2.optional(),cache_control:al.optional()}),d2=Zn("type",[J({type:Ae("enabled"),budget_tokens:K()}),J({type:Ae("disabled")}),J({type:Ae("adaptive")})]),Cf=J({model:S(),messages:fe(a2),system:fe(l2).optional(),tools:fe(u2).optional(),max_tokens:K().optional(),temperature:K().optional(),stream:Le().optional(),thinking:d2.optional(),metadata:J({user_id:S().optional()}).optional()}),cl=Zn("type",[ll,kf,t2,Sf]),f2=J({input_tokens:K().nullable().optional(),output_tokens:K().nullable().optional(),cache_creation_input_tokens:K().nullable().optional(),cache_read_input_tokens:K().nullable().optional()}).passthrough(),Nf=J({id:S(),type:Ae("message"),model:S(),role:Ae("assistant"),content:fe(cl),stop_reason:S().nullable(),stop_sequence:S().nullable().optional(),usage:f2}).passthrough(),p2=J({type:Ae("message_start"),message:J({id:S(),type:Ae("message"),model:S(),role:Ae("assistant"),content:fe(cl),stop_reason:po(),stop_sequence:po(),usage:J({input_tokens:K(),cache_creation_input_tokens:K().optional(),cache_read_input_tokens:K().optional()}).passthrough()})}),h2=J({type:Ae("content_block_start"),index:K(),content_block:cl}),m2=Zn("type",[J({type:Ae("text_delta"),text:S()}),J({type:Ae("input_json_delta"),partial_json:S()}),J({type:Ae("thinking_delta"),thinking:S()}),J({type:Ae("signature_delta"),signature:S()})]),g2=J({type:Ae("content_block_delta"),index:K(),delta:m2}),x2=J({type:Ae("content_block_stop"),index:K()}),b2=J({type:Ae("message_delta"),delta:J({stop_reason:S().nullable(),stop_sequence:S().nullable().optional()}),usage:J({output_tokens:K(),input_tokens:K().optional(),cache_creation_input_tokens:K().optional(),cache_read_input_tokens:K().optional()}).passthrough()}),v2=J({type:Ae("message_stop")}),y2=J({type:Ae("ping")}),w2=J({type:Ae("error"),error:J({type:S(),message:S()})}),_2=Zn("type",[p2,h2,g2,x2,b2,v2,y2,w2]),k2=Yt([S(),fe(Zn("type",[J({type:Ae("text"),text:S()}),J({type:Ae("image_url"),image_url:J({url:S(),detail:S().optional()})})]))]),Tf=J({role:Ee(["system","user","assistant","tool"]),content:k2,name:S().optional(),reasoning_content:S().optional(),thinking:S().optional(),think:S().optional()}),j2=J({name:S(),arguments:S()}),Ef=J({index:K().optional(),id:S().optional(),type:Ae("function").optional(),function:J({name:S().optional(),arguments:S().optional()})});Tf.extend({content:Yt([S(),fe(J({type:Ae("text"),text:S()}))]).optional(),function_call:j2.optional(),tool_calls:fe(Ef).optional()});const S2=J({type:Ae("function"),function:J({name:S(),description:S().optional(),parameters:Ye(S(),nt)})}),Af=J({model:S(),messages:fe(Tf),temperature:K().optional(),max_tokens:K().optional(),stream:Le().optional(),tools:fe(S2).optional(),tool_choice:Yt([Ee(["auto","none","required"]),J({type:Ae("auto")}),J({type:Ae("none")}),J({type:Ae("function"),function:J({name:S()})})]).optional(),user:S().optional()}),C2=J({type:S(),name:S().optional(),description:S().optional(),parameters:nt.optional(),function:J({name:S().optional(),description:S().optional(),parameters:nt.optional()}).optional()}).passthrough(),Rf=J({model:S(),input:Ln().optional(),instructions:Yt([S(),po()]).optional(),stream:Le().optional(),tools:fe(C2).optional(),tool_choice:Ln().optional(),max_output_tokens:K().optional(),temperature:K().optional(),user:S().optional(),metadata:Ye(S(),Ln()).optional()}).passthrough(),If=J({role:Ee(["assistant"]).optional(),content:S().nullable().optional(),reasoning_content:S().nullable().optional(),thinking:S().nullable().optional(),think:S().nullable().optional(),function_call:J({name:S().optional(),arguments:S().optional()}).nullable().optional(),tool_calls:fe(J({index:K(),id:S().optional(),type:Ae("function").optional(),function:J({name:S().optional(),arguments:S().optional()})})).nullable().optional()}),N2=J({index:K(),message:J({role:Ee(["assistant"]),content:S().nullable(),reasoning_content:S().optional(),thinking:S().optional(),think:S().optional(),function_call:J({name:S(),arguments:S()}).nullable().optional(),tool_calls:fe(Ef).optional()}).optional(),delta:If.optional(),finish_reason:S().nullable()}),T2=J({id:S(),object:Ae("chat.completion"),created:K(),model:S(),choices:fe(N2),usage:J({prompt_tokens:K().nullable().optional(),completion_tokens:K().nullable().optional(),total_tokens:K().nullable().optional()}).passthrough(),service_tier:S().nullable().optional(),system_fingerprint:S().nullable().optional()}).passthrough(),E2=J({id:S(),object:Ae("chat.completion.chunk"),created:K(),model:S(),choices:fe(J({index:K(),delta:If,finish_reason:S().nullable().optional()})),usage:J({prompt_tokens:K().nullable().optional(),completion_tokens:K().nullable().optional(),total_tokens:K().nullable().optional()}).passthrough().nullable().optional()}).passthrough(),A2=J({input_tokens:K().nullable().optional(),output_tokens:K().nullable().optional(),total_tokens:K().nullable().optional(),input_tokens_details:J({cached_tokens:K().nullable().optional()}).passthrough().nullable().optional(),output_tokens_details:J({reasoning_tokens:K().nullable().optional()}).passthrough().nullable().optional()}).passthrough(),R2=J({type:S()}).passthrough(),ho=J({id:S(),object:Ae("response").optional(),created_at:K().optional(),status:S().nullable().optional(),model:S().optional(),output:fe(R2).optional(),output_text:S().optional(),usage:A2.nullable().optional(),error:Ln().optional()}).passthrough(),I2=J({type:S()}).passthrough();function zf(e){try{const t=JSON.parse(e),n=T2.safeParse(t);return n.success?n.data:null}catch{return null}}function Pf(e){try{const t=JSON.parse(e),n=ho.safeParse(t);return n.success?n.data:null}catch{return null}}const z2=J({error:S()});async function ul(e,t){const n=await e.json();return t.parse(n)}async function dl(e,t){try{const n=await e.json(),s=z2.safeParse(n);return s.success?s.data.error:t}catch{return t}}async function ht(e,t,n,s){const o=await fetch(e,n);if(!o.ok){const i=s?.(o)??`Request failed with status ${o.status}`;throw new Error(await dl(o,i))}return ul(o,t)}function P2(e){return e<1e3?`${String(e)}ms`:`${String(Math.round(e/1e3))}s`}class Vo extends Error{constructor(t){super(`Request timed out after ${P2(t)}`),this.name="ApiTimeoutError"}}async function Dn(e,t,n){const s=new AbortController;let o=!1;const i=setTimeout(()=>{o=!0,s.abort()},t),a=n?.signal??void 0,l=()=>s.abort();a!==void 0&&(a.aborted?s.abort():a.addEventListener("abort",l,{once:!0}));try{return await fetch(e,{...n,signal:s.signal})}catch(c){throw o&&c instanceof DOMException&&c.name==="AbortError"?new Vo(t):c}finally{clearTimeout(i),a?.removeEventListener("abort",l)}}async function Ke(e,t,n,s,o){const i=await Dn(e,n,s);if(!i.ok){const a=o?.(i)??`Request failed with status ${i.status}`;throw new Error(await dl(i,a))}return ul(i,t)}const Of=J({input:K().int().nonnegative(),output:K().int().nonnegative(),cacheCreate:K().int().nonnegative(),cacheRead:K().int().nonnegative(),total:K().int().nonnegative()}),O2=J({id:K().int().positive(),sessionLogNumber:K().int().positive().optional(),timestamp:S(),provider:S().nullable(),model:S().nullable(),apiFormat:Ee(["anthropic","openai","unknown"]),method:S(),path:S(),status:K().nullable(),isStreaming:Le(),hasError:Le(),error:S().nullable(),latencyMs:K().nullable(),firstChunkMs:K().nullable().optional(),totalStreamMs:K().nullable().optional(),tokensPerSecond:K().nullable().optional(),tokens:J({input:K().nullable(),output:K().nullable(),cacheCreate:K().nullable(),cacheRead:K().nullable()}),sessionId:S().nullable(),userAgent:S().nullable().optional(),clientPid:K().nullable().optional(),clientProjectFolder:S().nullable().optional()}),Mf=J({id:S(),status:Ee(["active","failed","completed","empty"]),logCoverage:Ee(["recent","history"]),source:Ee(["explicit","client-process","client-connection","provider-test"]).nullable(),runtimeMode:Ee(["in-process","worker-thread","child-process"]).nullable(),createdAt:S().nullable(),updatedAt:S().nullable(),requestCount:K().int().nonnegative(),activeRequests:K().int().nonnegative(),completedRequests:K().int().nonnegative(),failedRequests:K().int().nonnegative(),queuedTasks:K().int().nonnegative(),runningTasks:K().int().nonnegative(),lastTaskError:S().nullable(),logCount:K().int().nonnegative(),errorCount:K().int().nonnegative(),models:fe(S()),providers:fe(S()),tokenUsage:Of,lastLogId:K().nullable(),lastModel:S().nullable(),clientUserAgent:S().nullable().optional(),clientPid:K().nullable(),clientProjectFolder:S().nullable(),inspectorPath:S(),inspectorUrl:S(),apiPath:S(),apiUrl:S(),compactLogsPath:S(),compactLogsUrl:S(),latestLogLimit:K().int().positive(),latestLogs:fe(O2)}),hr=Ee(["created","running","completed","failed","cancelled"]),fl=J({jsonPath:S(),markdownPath:S(),htmlPath:S(),exportedAt:S()}),M2=Ee(["run-created","session-started","request","session-finished","evidence-exported"]),L2=Ee(["info","success","warning","error"]),D2=J({timestamp:S(),kind:M2,severity:L2,title:S(),details:S(),logId:K().int().positive().nullable(),status:K().nullable(),model:S().nullable(),provider:S().nullable(),latencyMs:K().nullable(),isStreaming:Le().nullable()}),$2=Ee(["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"]),Lf=J({outcome:Ee(["success","failure","active","unknown"]),severity:Ee(["none","low","medium","high"]),category:$2,summary:S(),evidenceLogIds:fe(K().int().positive()),hints:fe(S())}),pl=J({status:Ee(["PASS","FAIL","RUNNING","UNKNOWN"]),summary:S(),markdown:S()}),Df=pl,hl=J({id:S(),sessionId:S(),groupId:S().nullable().default(null),title:S(),task:S().nullable(),project:S().nullable(),agent:S().nullable(),status:hr,tags:fe(S()),metadata:Ye(S(),nt),evidence:fl.nullable(),createdAt:S(),updatedAt:S()});J({runId:S().min(1).optional(),sessionId:S().min(1).optional(),groupId:S().min(1).nullable().optional(),title:S().min(1).optional(),task:S().nullable().optional(),project:S().nullable().optional(),agent:S().nullable().optional(),status:hr.optional(),tags:fe(S()).optional(),metadata:Ye(S(),nt).optional()}).optional();J({sessionId:S().min(1).optional(),groupId:S().min(1).nullable().optional(),title:S().min(1).optional(),task:S().nullable().optional(),project:S().nullable().optional(),agent:S().nullable().optional(),status:hr.optional(),tags:fe(S()).optional(),metadata:Ye(S(),nt).optional()});J({includeHistory:Le().optional(),latestLogLimit:K().int().positive().max(50).optional()}).optional();J({run:hl,evidence:fl,session:Mf.nullable(),timeline:fe(D2),classification:Lf,jenkinsReport:pl});const F2=J({run:hl,classification:Lf,evidence:fl.nullable(),jenkinsReport:pl.nullable(),sessionId:S(),inspectorUrl:S().nullable(),evidenceMarkdownPath:S().nullable(),updatedAt:S()});J({failures:fe(F2),total:K().int().nonnegative(),limit:K().int().positive()});const ml=Ee(["created","running","completed","failed","cancelled"]),gl=Ee(["evaluation","batch","manual"]),xl=J({jsonPath:S(),markdownPath:S(),htmlPath:S(),exportedAt:S()}),$f=J({id:S(),groupId:S(),sessionId:S(),runId:S().nullable(),label:S().nullable(),agent:S().nullable(),provider:S().nullable(),model:S().nullable(),status:hr.nullable(),metadata:Ye(S(),nt),addedAt:S(),updatedAt:S()}),bl=J({id:S(),title:S(),kind:gl,task:S().nullable(),project:S().nullable(),status:ml,tags:fe(S()),metadata:Ye(S(),nt),evidence:xl.nullable(),members:fe($f),createdAt:S(),updatedAt:S()});J({groupId:S().min(1).optional(),title:S().min(1).optional(),kind:gl.optional(),task:S().nullable().optional(),project:S().nullable().optional(),status:ml.optional(),tags:fe(S()).optional(),metadata:Ye(S(),nt).optional()}).optional();J({title:S().min(1).optional(),kind:gl.optional(),task:S().nullable().optional(),project:S().nullable().optional(),status:ml.optional(),tags:fe(S()).optional(),metadata:Ye(S(),nt).optional()});J({memberId:S().min(1).optional(),sessionId:S().min(1),runId:S().min(1).nullable().optional(),label:S().min(1).nullable().optional(),agent:S().min(1).nullable().optional(),provider:S().min(1).nullable().optional(),model:S().min(1).nullable().optional(),status:hr.nullable().optional(),metadata:Ye(S(),nt).optional()});J({includeHistory:Le().optional(),latestLogLimit:K().int().positive().max(50).optional()}).optional();J({deleteEvidence:Le().optional()});const Ff=J({groupId:S(),deleted:Le(),evidenceDeleted:Le(),evidencePath:S().nullable()}),Bf=J({deleted:K().int().nonnegative(),groups:fe(Ff)}),Uf=J({member:$f,run:hl.nullable(),session:Mf.nullable()}),Wf=J({memberCount:K().int().nonnegative(),sessionsWithData:K().int().nonnegative(),missingSessions:K().int().nonnegative(),requestCount:K().int().nonnegative(),errorCount:K().int().nonnegative(),tokenUsage:Of,models:fe(S()),providers:fe(S()),completedMembers:K().int().nonnegative(),failedMembers:K().int().nonnegative(),runningMembers:K().int().nonnegative()}),B2=J({group:bl,evidence:xl,members:fe(Uf).nullable(),markdown:S(),summary:Wf.nullable(),report:Df.nullable()}),U2=J({group:bl,evidence:xl,members:fe(Uf),summary:Wf,jenkinsReport:Df}),Hf=J({groups:fe(bl)}),W2=J({sessionId:S(),imported:K().int().nonnegative(),skipped:K().int().nonnegative(),warnings:fe(S()),logs:fe(rr)}),mo=10,la=600,go=60,ca=600,xo="time",vl="simple",Vf=Ee(["time","full"]),H2=Ee(["simple","full"]),qo=J({stripClaudeCodeBillingHeader:Le(),hasSeenOnboarding:Le().default(!1),slowResponseThresholdSeconds:K().int().min(0).max(la).default(mo),providerTestTimeoutSeconds:K().int().min(1).max(ca).default(go),timeDisplayFormat:Vf.default(xo),captureMode:H2.default(vl)}),us="/api/config";async function V2(e){return ht(e,qo,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function Nr(e){return ht(us,qo,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function yl(){const e=qt(us,V2,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=Fd(),n=e.data?.stripClaudeCodeBillingHeader??!1,s=e.data?.captureMode??vl,o=e.data?.slowResponseThresholdSeconds??mo,i=e.data?.providerTestTimeoutSeconds??go,a=e.data?.timeDisplayFormat??xo,l=h=>({stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:e.data?.hasSeenOnboarding??!1,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??mo,providerTestTimeoutSeconds:e.data?.providerTestTimeoutSeconds??go,timeDisplayFormat:e.data?.timeDisplayFormat??xo,captureMode:s,...h}),c=async h=>{await t(us,Nr({stripClaudeCodeBillingHeader:h}),{optimisticData:l({stripClaudeCodeBillingHeader:h}),rollbackOnError:!0,revalidate:!1})},u=async h=>{await t(us,Nr({slowResponseThresholdSeconds:h}),{optimisticData:l({slowResponseThresholdSeconds:h}),rollbackOnError:!0,revalidate:!1})},d=async h=>{await t(us,Nr({timeDisplayFormat:h}),{optimisticData:l({timeDisplayFormat:h}),rollbackOnError:!0,revalidate:!1})},f=async h=>{await t(us,Nr({providerTestTimeoutSeconds:h}),{optimisticData:l({providerTestTimeoutSeconds:h}),rollbackOnError:!0,revalidate:!1})};return{strip:n,captureMode:s,slowResponseThresholdSeconds:o,providerTestTimeoutSeconds:i,timeDisplayFormat:a,isLoading:e.isLoading,isError:e.error!==void 0,setStrip:c,setSlowResponseThresholdSeconds:u,setProviderTestTimeoutSeconds:f,setTimeDisplayFormat:d}}const qf=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===n).join(" ").trim();const q2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Z2=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,s)=>s?s.toUpperCase():n.toLowerCase());const Uc=e=>{const t=Z2(e);return t.charAt(0).toUpperCase()+t.slice(1)};var G2={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 K2=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const J2=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:o="",children:i,iconNode:a,...l},c)=>p.createElement("svg",{ref:c,...G2,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:qf("lucide",o),...!i&&!K2(l)&&{"aria-hidden":"true"},...l},[...a.map(([u,d])=>p.createElement(u,d)),...Array.isArray(i)?i:[i]]));const de=(e,t)=>{const n=p.forwardRef(({className:s,...o},i)=>p.createElement(J2,{ref:i,iconNode:t,className:qf(`lucide-${q2(Uc(e))}`,`lucide-${e}`,s),...o}));return n.displayName=Uc(e),n};const Y2=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],X2=de("activity",Y2);const Q2=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],ey=de("arrow-down-right",Q2);const ty=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],ny=de("arrow-down",ty);const sy=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],ry=de("arrow-left",sy);const oy=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],iy=de("arrow-up-right",oy);const ay=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ly=de("arrow-up",ay);const cy=[["path",{d:"M4.5 3h15",key:"c7n0jr"}],["path",{d:"M6 3v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V3",key:"m1uhx7"}],["path",{d:"M6 14h12",key:"4cwo0f"}]],wl=de("beaker",cy);const uy=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],dy=de("bell",uy);const fy=[["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"}]],py=de("blocks",fy);const hy=[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]],my=de("brain-circuit",hy);const gy=[["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"}]],Zf=de("brain",gy);const xy=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ge=de("check",xy);const by=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ot=de("chevron-down",by);const vy=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],yy=de("chevron-left",vy);const wy=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Et=de("chevron-right",wy);const _y=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],_l=de("chevron-up",_y);const ky=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],jy=de("chevrons-down",ky);const Sy=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],Cy=de("chevrons-left",Sy);const Ny=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],Ty=de("chevrons-right",Ny);const Ey=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],Ay=de("chevrons-up",Ey);const Ry=[["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"}]],_s=de("circle-alert",Ry);const Iy=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],kl=de("circle-check-big",Iy);const zy=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],ua=de("circle-check",zy);const Py=[["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"}]],Oy=de("circle-question-mark",Py);const My=[["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"}]],Gf=de("circle-x",My);const Ly=[["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"}]],Dy=de("clapperboard",Ly);const $y=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Fy=de("clock-3",$y);const By=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],sn=de("clock",By);const Uy=[["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"}]],Wy=de("cloud-upload",Uy);const Hy=[["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"}]],Vy=de("code-xml",Hy);const qy=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Zy=de("columns-2",qy);const Gy=[["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"}]],Rt=de("copy",Gy);const Ky=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],Jy=de("cpu",Ky);const Yy=[["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"}]],mr=de("download",Yy);const Xy=[["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"}]],Qy=de("ellipsis",Xy);const ew=[["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"}]],jl=de("external-link",ew);const tw=[["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"}]],Sl=de("eye-off",tw);const nw=[["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"}]],Cl=de("eye",nw);const sw=[["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"}]],rw=de("file-braces",sw);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:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]],iw=de("file-diff",ow);const aw=[["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"}]],lw=de("file-search",aw);const cw=[["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"}]],uw=de("file-terminal",cw);const dw=[["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"}]],fw=de("file-text",dw);const pw=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],hw=de("flag",pw);const mw=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],Kf=de("flask-conical",mw);const gw=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],xw=de("folder-open",gw);const bw=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Nl=de("gauge",bw);const vw=[["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"}]],yw=de("git-compare-arrows",vw);const ww=[["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"}]],Jf=de("globe",ww);const _w=[["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"}]],Yf=de("history",_w);const kw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],jw=de("info",kw);const Sw=[["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"}]],Wc=de("layers",Sw);const Cw=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Xe=de("loader-circle",Cw);const Nw=[["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"}]],Tw=de("lock",Nw);const Ew=[["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"}]],Zo=de("message-square",Ew);const Aw=[["path",{d:"M5 12h14",key:"1ays0h"}]],Xf=de("minus",Aw);const Rw=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Iw=de("monitor",Rw);const zw=[["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"}]],Pw=de("mouse-pointer-click",zw);const Ow=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],Mw=de("network",Ow);const Lw=[["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"}]],Dw=de("octagon-alert",Lw);const $w=[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]],Fw=de("package-check",$w);const Bw=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],Uw=de("panel-right-close",Bw);const Ww=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],Hw=de("panel-right-open",Ww);const Vw=[["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"}]],Qf=de("pencil",Vw);const qw=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],da=de("plus",qw);const Zw=[["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"}]],Hc=de("radio",Zw);const Gw=[["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"}]],yn=de("refresh-cw",Gw);const Kw=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],ep=de("rocket",Kw);const Jw=[["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"}]],Yw=de("rotate-ccw",Jw);const Xw=[["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"}]],bo=de("rotate-cw",Xw);const Qw=[["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"}]],e_=de("rows-3",Qw);const t_=[["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"}]],n_=de("save",t_);const s_=[["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"}]],r_=de("scan",s_);const o_=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],tp=de("search",o_);const i_=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],a_=de("send",i_);const l_=[["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"}]],c_=de("server",l_);const u_=[["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"}]],d_=de("settings",u_);const f_=[["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:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],p_=de("shield-alert",f_);const h_=[["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"}]],Vc=de("shield-check",h_);const m_=[["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"}]],fa=de("siren",m_);const g_=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],qc=de("sparkles",g_);const x_=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],zs=de("terminal",x_);const b_=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],v_=de("timer",b_);const y_=[["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"}]],wn=de("trash-2",y_);const w_=[["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"}]],rn=de("triangle-alert",w_);const __=[["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"}]],np=de("upload",__);const k_=[["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"}]],j_=de("wifi-off",k_);const S_=[["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"}]],C_=de("wifi",S_);const N_=[["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"}]],Ps=de("wrench",N_);const T_=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],gr=de("x",T_);const E_=[["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"}]],or=de("zap",E_),pa="/api/config";async function A_(e){return ht(e,qo,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function R_(e){return ht(pa,qo,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function I_(){const e=qt(pa,A_,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=Fd(),n=e.data?.hasSeenOnboarding??!1,s=e.data?.captureMode??vl,o=async()=>{await t(pa,R_({hasSeenOnboarding:!0}),{optimisticData:{stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:!0,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??mo,providerTestTimeoutSeconds:e.data?.providerTestTimeoutSeconds??go,timeDisplayFormat:e.data?.timeDisplayFormat??xo,captureMode:s},rollbackOnError:!0,revalidate:!1})};return{hasSeenOnboarding:n,captureMode:s,isLoading:e.isLoading,markSeen:o}}function z_(){const{hasSeenOnboarding:e,isLoading:t,markSeen:n}=I_(),[s,o]=p.useState(!1);if(t||e)return null;const i=s?"grid":"hidden sm:grid";return r.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:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(jw,{className:"mt-0.5 size-4 shrink-0 text-amber-300","aria-hidden":"true"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[r.jsx("span",{className:"font-medium text-amber-200",children:"Inspector ready"}),r.jsx("span",{className:"hidden truncate text-xs text-muted-foreground sm:inline",children:"Request, response, tool, timing, token, replay, and memory signals are active."})]}),r.jsx("div",{className:"mt-1 text-xs leading-relaxed text-muted-foreground sm:hidden",children:"Core capture is active."}),r.jsxs("div",{className:`${i} mt-2 gap-x-4 gap-y-1 text-xs leading-relaxed text-muted-foreground sm:grid-cols-2`,children:[r.jsxs("div",{children:[r.jsx("strong",{children:"Evidence"}),": logs, sessions, groups, and MCP exports are available."]}),r.jsxs("div",{children:[r.jsx("strong",{children:"Network"}),": replace ",r.jsx("code",{children:"localhost"})," if containers differ."]})]})]}),r.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":s,"aria-label":s?"Hide onboarding details":"Show onboarding details",children:r.jsx(ot,{className:`size-3.5 transition-transform ${s?"rotate-180":""}`})}),r.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:[r.jsx(Ge,{className:"size-3.5"}),"Got it"]}),r.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:r.jsx(gr,{className:"size-3.5"})})]})})}function Tr(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 ji={exports:{}};var Zc;function P_(){return Zc||(Zc=1,(function(e,t){(function(n){e.exports=n()})(function(){return(function n(s,o,i){function a(u,d){if(!o[u]){if(!s[u]){var f=typeof Tr=="function"&&Tr;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 m=o[u]={exports:{}};s[u][0].call(m.exports,function(v){var g=s[u][1][v];return a(g||v)},m,m.exports,n,s,o,i)}return o[u].exports}for(var l=typeof Tr=="function"&&Tr,c=0;c<i.length;c++)a(i[c]);return a})({1:[function(n,s,o){var i=n("./utils"),a=n("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(c){for(var u,d,f,h,m,v,g,x=[],b=0,y=c.length,k=y,j=i.getTypeOf(c)!=="string";b<c.length;)k=y-b,f=j?(u=c[b++],d=b<y?c[b++]:0,b<y?c[b++]:0):(u=c.charCodeAt(b++),d=b<y?c.charCodeAt(b++):0,b<y?c.charCodeAt(b++):0),h=u>>2,m=(3&u)<<4|d>>4,v=1<k?(15&d)<<2|f>>6:64,g=2<k?63&f:64,x.push(l.charAt(h)+l.charAt(m)+l.charAt(v)+l.charAt(g));return x.join("")},o.decode=function(c){var u,d,f,h,m,v,g=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 y,k=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&k--,c.charAt(c.length-2)===l.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(y=a.uint8array?new Uint8Array(0|k):new Array(0|k);g<c.length;)u=l.indexOf(c.charAt(g++))<<2|(h=l.indexOf(c.charAt(g++)))>>4,d=(15&h)<<4|(m=l.indexOf(c.charAt(g++)))>>2,f=(3&m)<<6|(v=l.indexOf(c.charAt(g++))),y[x++]=u,m!==64&&(y[x++]=d),v!==64&&(y[x++]=f);return y}},{"./support":30,"./utils":32}],2:[function(n,s,o){var i=n("./external"),a=n("./stream/DataWorker"),l=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function u(d,f,h,m,v){this.compressedSize=d,this.uncompressedSize=f,this.crc32=h,this.compression=m,this.compressedContent=v}u.prototype={getContentWorker:function(){var d=new a(i.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(i.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)},s.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,s,o){var i=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,s,o){var i=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})();s.exports=function(l,c){return l!==void 0&&l.length?i.getTypeOf(l)!=="string"?(function(u,d,f,h){var m=a,v=h+f;u^=-1;for(var g=h;g<v;g++)u=u>>>8^m[255&(u^d[g])];return-1^u})(0|c,l,l.length,0):(function(u,d,f,h){var m=a,v=h+f;u^=-1;for(var g=h;g<v;g++)u=u>>>8^m[255&(u^d.charCodeAt(g))];return-1^u})(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(n,s,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,s,o){var i=null;i=typeof Promise<"u"?Promise:n("lie"),s.exports={Promise:i}},{lie:37}],7:[function(n,s,o){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=n("pako"),l=n("./utils"),c=n("./stream/GenericWorker"),u=i?"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,s,o){function i(m,v){var g,x="";for(g=0;g<v;g++)x+=String.fromCharCode(255&m),m>>>=8;return x}function a(m,v,g,x,b,y){var k,j,C=m.file,T=m.compression,N=y!==u.utf8encode,P=l.transformTo("string",y(C.name)),A=l.transformTo("string",u.utf8encode(C.name)),z=C.comment,D=l.transformTo("string",y(z)),E=l.transformTo("string",u.utf8encode(z)),L=A.length!==C.name.length,w=E.length!==z.length,$="",ee="",F="",W=C.dir,Z=C.date,ue={crc32:0,compressedSize:0,uncompressedSize:0};v&&!g||(ue.crc32=m.crc32,ue.compressedSize=m.compressedSize,ue.uncompressedSize=m.uncompressedSize);var V=0;v&&(V|=8),N||!L&&!w||(V|=2048);var H=0,le=0;W&&(H|=16),b==="UNIX"?(le=798,H|=(function(X,Ce){var ae=X;return X||(ae=Ce?16893:33204),(65535&ae)<<16})(C.unixPermissions,W)):(le=20,H|=(function(X){return 63&(X||0)})(C.dosPermissions)),k=Z.getUTCHours(),k<<=6,k|=Z.getUTCMinutes(),k<<=5,k|=Z.getUTCSeconds()/2,j=Z.getUTCFullYear()-1980,j<<=4,j|=Z.getUTCMonth()+1,j<<=5,j|=Z.getUTCDate(),L&&(ee=i(1,1)+i(d(P),4)+A,$+="up"+i(ee.length,2)+ee),w&&(F=i(1,1)+i(d(D),4)+E,$+="uc"+i(F.length,2)+F);var U="";return U+=`
|
|
41
|
+
\0`,U+=i(V,2),U+=T.magic,U+=i(k,2),U+=i(j,2),U+=i(ue.crc32,4),U+=i(ue.compressedSize,4),U+=i(ue.uncompressedSize,4),U+=i(P.length,2),U+=i($.length,2),{fileRecord:f.LOCAL_FILE_HEADER+U+P+$,dirRecord:f.CENTRAL_FILE_HEADER+i(le,2)+U+i(D.length,2)+"\0\0\0\0"+i(H,4)+i(x,4)+P+$+D}}var l=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function h(m,v,g,x){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=v,this.zipPlatform=g,this.encodeFileName=x,this.streamFiles=m,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(m){var v=m.meta.percent||0,g=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(m):(this.bytesWritten+=m.data.length,c.prototype.push.call(this,{data:m.data,meta:{currentFile:this.currentFile,percent:g?(v+100*(g-x-1))/g:100}}))},h.prototype.openedSource=function(m){this.currentSourceOffset=this.bytesWritten,this.currentFile=m.file.name;var v=this.streamFiles&&!m.file.dir;if(v){var g=a(m,v,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(m){this.accumulate=!1;var v=this.streamFiles&&!m.file.dir,g=a(m,v,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),v)this.push({data:(function(x){return f.DATA_DESCRIPTOR+i(x.crc32,4)+i(x.compressedSize,4)+i(x.uncompressedSize,4)})(m),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var m=this.bytesWritten,v=0;v<this.dirRecords.length;v++)this.push({data:this.dirRecords[v],meta:{percent:100}});var g=this.bytesWritten-m,x=(function(b,y,k,j,C){var T=l.transformTo("string",C(j));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(b,2)+i(b,2)+i(y,4)+i(k,4)+i(T.length,2)+T})(this.dirRecords.length,g,m,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(m){this._sources.push(m);var v=this;return m.on("data",function(g){v.processChunk(g)}),m.on("end",function(){v.closedSource(v.previous.streamInfo),v._sources.length?v.prepareNextSource():v.end()}),m.on("error",function(g){v.error(g)}),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(m){var v=this._sources;if(!c.prototype.error.call(this,m))return!1;for(var g=0;g<v.length;g++)try{v[g].error(m)}catch{}return!0},h.prototype.lock=function(){c.prototype.lock.call(this);for(var m=this._sources,v=0;v<m.length;v++)m[v].lock()},s.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,s,o){var i=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,m){f++;var v=(function(y,k){var j=y||k,C=i[j];if(!C)throw new Error(j+" is not a valid compression method !");return C})(m.options.compression,c.compression),g=m.options.compressionOptions||c.compressionOptions||{},x=m.dir,b=m.date;m._compressWorker(v,g).withStreamInfo("file",{name:h,dir:x,date:b,comment:m.comment||"",unixPermissions:m.unixPermissions,dosPermissions:m.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(h){d.error(h)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,s,o){function i(){if(!(this instanceof i))return new i;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 i;for(var l in this)typeof this[l]!="function"&&(a[l]=this[l]);return a}}(i.prototype=n("./object")).loadAsync=n("./load"),i.support=n("./support"),i.defaults=n("./defaults"),i.version="3.10.1",i.loadAsync=function(a,l){return new i().loadAsync(a,l)},i.external=n("./external"),s.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,s,o){var i=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(m,v){var g=h.decompressed.getContentWorker().pipe(new u);g.on("error",function(x){v(x)}).on("end",function(){g.streamInfo.crc32!==h.decompressed.crc32?v(new Error("Corrupted zip : CRC32 mismatch")):m()}).resume()})}s.exports=function(h,m){var v=this;return m=i.extend(m||{},{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.")):i.prepareContent("the loaded zip file",h,!0,m.optimizedBinaryString,m.base64).then(function(g){var x=new c(m);return x.load(g),x}).then(function(g){var x=[a.Promise.resolve(g)],b=g.files;if(m.checkCRC32)for(var y=0;y<b.length;y++)x.push(f(b[y]));return a.Promise.all(x)}).then(function(g){for(var x=g.shift(),b=x.files,y=0;y<b.length;y++){var k=b[y],j=k.fileNameStr,C=i.resolve(k.fileNameStr);v.file(C,k.decompressed,{binary:!0,optimizedBinaryString:!0,date:k.date,dir:k.dir,comment:k.fileCommentStr.length?k.fileCommentStr:null,unixPermissions:k.unixPermissions,dosPermissions:k.dosPermissions,createFolders:m.createFolders}),k.dir||(v.file(C).unsafeOriginalName=j)}return x.zipComment.length&&(v.comment=x.zipComment),v})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,s,o){var i=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)}i.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)},s.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,s,o){var i=n("readable-stream").Readable;function a(l,c,u){i.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,i),a.prototype._read=function(){this._helper.resume()},s.exports=a},{"../utils":32,"readable-stream":16}],14:[function(n,s,o){s.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,a){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,a);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,a)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var a=new Buffer(i);return a.fill(0),a},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(n,s,o){function i(C,T,N){var P,A=l.getTypeOf(T),z=l.extend(N||{},d);z.date=z.date||new Date,z.compression!==null&&(z.compression=z.compression.toUpperCase()),typeof z.unixPermissions=="string"&&(z.unixPermissions=parseInt(z.unixPermissions,8)),z.unixPermissions&&16384&z.unixPermissions&&(z.dir=!0),z.dosPermissions&&16&z.dosPermissions&&(z.dir=!0),z.dir&&(C=b(C)),z.createFolders&&(P=x(C))&&y.call(this,P,!0);var D=A==="string"&&z.binary===!1&&z.base64===!1;N&&N.binary!==void 0||(z.binary=!D),(T instanceof f&&T.uncompressedSize===0||z.dir||!T||T.length===0)&&(z.base64=!1,z.binary=!0,T="",z.compression="STORE",A="string");var E=null;E=T instanceof f||T instanceof c?T:v.isNode&&v.isStream(T)?new g(C,T):l.prepareContent(C,T,z.binary,z.optimizedBinaryString,z.base64);var L=new h(C,E,z);this.files[C]=L}var a=n("./utf8"),l=n("./utils"),c=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),h=n("./zipObject"),m=n("./generate"),v=n("./nodejsUtils"),g=n("./nodejs/NodejsStreamInputAdapter"),x=function(C){C.slice(-1)==="/"&&(C=C.substring(0,C.length-1));var T=C.lastIndexOf("/");return 0<T?C.substring(0,T):""},b=function(C){return C.slice(-1)!=="/"&&(C+="/"),C},y=function(C,T){return T=T!==void 0?T:d.createFolders,C=b(C),this.files[C]||i.call(this,C,null,{dir:!0,createFolders:T}),this.files[C]};function k(C){return Object.prototype.toString.call(C)==="[object RegExp]"}var j={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(C){var T,N,P;for(T in this.files)P=this.files[T],(N=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&C(N,P)},filter:function(C){var T=[];return this.forEach(function(N,P){C(N,P)&&T.push(P)}),T},file:function(C,T,N){if(arguments.length!==1)return C=this.root+C,i.call(this,C,T,N),this;if(k(C)){var P=C;return this.filter(function(z,D){return!D.dir&&P.test(z)})}var A=this.files[this.root+C];return A&&!A.dir?A:null},folder:function(C){if(!C)return this;if(k(C))return this.filter(function(A,z){return z.dir&&C.test(A)});var T=this.root+C,N=y.call(this,T),P=this.clone();return P.root=N.name,P},remove:function(C){C=this.root+C;var T=this.files[C];if(T||(C.slice(-1)!=="/"&&(C+="/"),T=this.files[C]),T&&!T.dir)delete this.files[C];else for(var N=this.filter(function(A,z){return z.name.slice(0,C.length)===C}),P=0;P<N.length;P++)delete this.files[N[P].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(C){var T,N={};try{if((N=l.extend(C||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:a.utf8encode})).type=N.type.toLowerCase(),N.compression=N.compression.toUpperCase(),N.type==="binarystring"&&(N.type="string"),!N.type)throw new Error("No output type specified.");l.checkSupport(N.type),N.platform!=="darwin"&&N.platform!=="freebsd"&&N.platform!=="linux"&&N.platform!=="sunos"||(N.platform="UNIX"),N.platform==="win32"&&(N.platform="DOS");var P=N.comment||this.comment||"";T=m.generateWorker(this,N,P)}catch(A){(T=new c("error")).error(A)}return new u(T,N.type||"string",N.mimeType)},generateAsync:function(C,T){return this.generateInternalStream(C).accumulate(T)},generateNodeStream:function(C,T){return(C=C||{}).type||(C.type="nodebuffer"),this.generateInternalStream(C).toNodejsStream(T)}};s.exports=j},{"./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,s,o){s.exports=n("stream")},{stream:void 0}],17:[function(n,s,o){var i=n("./DataReader");function a(l){i.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}n("../utils").inherits(a,i),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},s.exports=a},{"../utils":32,"./DataReader":18}],18:[function(n,s,o){var i=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 i.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))}},s.exports=a},{"../utils":32}],19:[function(n,s,o){var i=n("./Uint8ArrayReader");function a(l){i.call(this,l)}n("../utils").inherits(a,i),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},s.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,s,o){var i=n("./DataReader");function a(l){i.call(this,l)}n("../utils").inherits(a,i),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},s.exports=a},{"../utils":32,"./DataReader":18}],21:[function(n,s,o){var i=n("./ArrayReader");function a(l){i.call(this,l)}n("../utils").inherits(a,i),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},s.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(n,s,o){var i=n("../utils"),a=n("../support"),l=n("./ArrayReader"),c=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");s.exports=function(f){var h=i.getTypeOf(f);return i.checkSupport(h),h!=="string"||a.uint8array?h==="nodebuffer"?new u(f):a.uint8array?new d(i.transformTo("uint8array",f)):new l(i.transformTo("array",f)):new c(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,s,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,s,o){var i=n("./GenericWorker"),a=n("../utils");function l(c){i.call(this,"ConvertWorker to "+c),this.destType=c}a.inherits(l,i),l.prototype.processChunk=function(c){this.push({data:a.transformTo(this.destType,c.data),meta:c.meta})},s.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(n,s,o){var i=n("./GenericWorker"),a=n("../crc32");function l(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(l,i),l.prototype.processChunk=function(c){this.streamInfo.crc32=a(c.data,this.streamInfo.crc32||0),this.push(c)},s.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,s,o){var i=n("../utils"),a=n("./GenericWorker");function l(c){a.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}i.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)},s.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(n,s,o){var i=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=i.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}i.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,i.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.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}})},s.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(n,s,o){function i(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}i.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}},s.exports=i},{}],29:[function(n,s,o){var i=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(v,g){return new d.Promise(function(x,b){var y=[],k=v._internalType,j=v._outputType,C=v._mimeType;v.on("data",function(T,N){y.push(T),g&&g(N)}).on("error",function(T){y=[],b(T)}).on("end",function(){try{var T=(function(N,P,A){switch(N){case"blob":return i.newBlob(i.transformTo("arraybuffer",P),A);case"base64":return c.encode(P);default:return i.transformTo(N,P)}})(j,(function(N,P){var A,z=0,D=null,E=0;for(A=0;A<P.length;A++)E+=P[A].length;switch(N){case"string":return P.join("");case"array":return Array.prototype.concat.apply([],P);case"uint8array":for(D=new Uint8Array(E),A=0;A<P.length;A++)D.set(P[A],z),z+=P[A].length;return D;case"nodebuffer":return Buffer.concat(P);default:throw new Error("concat : unsupported type '"+N+"'")}})(k,y),C);x(T)}catch(N){b(N)}y=[]}).resume()})}function m(v,g,x){var b=g;switch(g){case"blob":case"arraybuffer":b="uint8array";break;case"base64":b="string"}try{this._internalType=b,this._outputType=g,this._mimeType=x,i.checkSupport(b),this._worker=v.pipe(new a(b)),v.lock()}catch(y){this._worker=new l("error"),this._worker.error(y)}}m.prototype={accumulate:function(v){return h(this,v)},on:function(v,g){var x=this;return v==="data"?this._worker.on(v,function(b){g.call(x,b.data,b.meta)}):this._worker.on(v,function(){i.delay(g,arguments,x)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(v){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},v)}},s.exports=m},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,s,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 i=new ArrayBuffer(0);try{o.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(i),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,s,o){for(var i=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(m){return a.nodebuffer?l.newBufferFrom(m,"utf-8"):(function(v){var g,x,b,y,k,j=v.length,C=0;for(y=0;y<j;y++)(64512&(x=v.charCodeAt(y)))==55296&&y+1<j&&(64512&(b=v.charCodeAt(y+1)))==56320&&(x=65536+(x-55296<<10)+(b-56320),y++),C+=x<128?1:x<2048?2:x<65536?3:4;for(g=a.uint8array?new Uint8Array(C):new Array(C),y=k=0;k<C;y++)(64512&(x=v.charCodeAt(y)))==55296&&y+1<j&&(64512&(b=v.charCodeAt(y+1)))==56320&&(x=65536+(x-55296<<10)+(b-56320),y++),x<128?g[k++]=x:(x<2048?g[k++]=192|x>>>6:(x<65536?g[k++]=224|x>>>12:(g[k++]=240|x>>>18,g[k++]=128|x>>>12&63),g[k++]=128|x>>>6&63),g[k++]=128|63&x);return g})(m)},o.utf8decode=function(m){return a.nodebuffer?i.transformTo("nodebuffer",m).toString("utf-8"):(function(v){var g,x,b,y,k=v.length,j=new Array(2*k);for(g=x=0;g<k;)if((b=v[g++])<128)j[x++]=b;else if(4<(y=u[b]))j[x++]=65533,g+=y-1;else{for(b&=y===2?31:y===3?15:7;1<y&&g<k;)b=b<<6|63&v[g++],y--;1<y?j[x++]=65533:b<65536?j[x++]=b:(b-=65536,j[x++]=55296|b>>10&1023,j[x++]=56320|1023&b)}return j.length!==x&&(j.subarray?j=j.subarray(0,x):j.length=x),i.applyFromCharCode(j)})(m=i.transformTo(a.uint8array?"uint8array":"array",m))},i.inherits(f,c),f.prototype.processChunk=function(m){var v=i.transformTo(a.uint8array?"uint8array":"array",m.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var g=v;(v=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),v.set(g,this.leftOver.length)}else v=this.leftOver.concat(v);this.leftOver=null}var x=(function(y,k){var j;for((k=k||y.length)>y.length&&(k=y.length),j=k-1;0<=j&&(192&y[j])==128;)j--;return j<0||j===0?k:j+u[y[j]]>k?j:k})(v),b=v;x!==v.length&&(a.uint8array?(b=v.subarray(0,x),this.leftOver=v.subarray(x,v.length)):(b=v.slice(0,x),this.leftOver=v.slice(x,v.length))),this.push({data:o.utf8decode(b),meta:m.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=f,i.inherits(h,c),h.prototype.processChunk=function(m){this.push({data:o.utf8encode(m.data),meta:m.meta})},o.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,s,o){var i=n("./support"),a=n("./base64"),l=n("./nodejsUtils"),c=n("./external");function u(g){return g}function d(g,x){for(var b=0;b<g.length;++b)x[b]=255&g.charCodeAt(b);return x}n("setimmediate"),o.newBlob=function(g,x){o.checkSupport("blob");try{return new Blob([g],{type:x})}catch{try{var b=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return b.append(g),b.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(g,x,b){var y=[],k=0,j=g.length;if(j<=b)return String.fromCharCode.apply(null,g);for(;k<j;)x==="array"||x==="nodebuffer"?y.push(String.fromCharCode.apply(null,g.slice(k,Math.min(k+b,j)))):y.push(String.fromCharCode.apply(null,g.subarray(k,Math.min(k+b,j)))),k+=b;return y.join("")},stringifyByChar:function(g){for(var x="",b=0;b<g.length;b++)x+=String.fromCharCode(g[b]);return x},applyCanBeUsed:{uint8array:(function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}})()}};function h(g){var x=65536,b=o.getTypeOf(g),y=!0;if(b==="uint8array"?y=f.applyCanBeUsed.uint8array:b==="nodebuffer"&&(y=f.applyCanBeUsed.nodebuffer),y)for(;1<x;)try{return f.stringifyByChunk(g,b,x)}catch{x=Math.floor(x/2)}return f.stringifyByChar(g)}function m(g,x){for(var b=0;b<g.length;b++)x[b]=g[b];return x}o.applyFromCharCode=h;var v={};v.string={string:u,array:function(g){return d(g,new Array(g.length))},arraybuffer:function(g){return v.string.uint8array(g).buffer},uint8array:function(g){return d(g,new Uint8Array(g.length))},nodebuffer:function(g){return d(g,l.allocBuffer(g.length))}},v.array={string:h,array:u,arraybuffer:function(g){return new Uint8Array(g).buffer},uint8array:function(g){return new Uint8Array(g)},nodebuffer:function(g){return l.newBufferFrom(g)}},v.arraybuffer={string:function(g){return h(new Uint8Array(g))},array:function(g){return m(new Uint8Array(g),new Array(g.byteLength))},arraybuffer:u,uint8array:function(g){return new Uint8Array(g)},nodebuffer:function(g){return l.newBufferFrom(new Uint8Array(g))}},v.uint8array={string:h,array:function(g){return m(g,new Array(g.length))},arraybuffer:function(g){return g.buffer},uint8array:u,nodebuffer:function(g){return l.newBufferFrom(g)}},v.nodebuffer={string:h,array:function(g){return m(g,new Array(g.length))},arraybuffer:function(g){return v.nodebuffer.uint8array(g).buffer},uint8array:function(g){return m(g,new Uint8Array(g.length))},nodebuffer:u},o.transformTo=function(g,x){if(x=x||"",!g)return x;o.checkSupport(g);var b=o.getTypeOf(x);return v[b][g](x)},o.resolve=function(g){for(var x=g.split("/"),b=[],y=0;y<x.length;y++){var k=x[y];k==="."||k===""&&y!==0&&y!==x.length-1||(k===".."?b.pop():b.push(k))}return b.join("/")},o.getTypeOf=function(g){return typeof g=="string"?"string":Object.prototype.toString.call(g)==="[object Array]"?"array":i.nodebuffer&&l.isBuffer(g)?"nodebuffer":i.uint8array&&g instanceof Uint8Array?"uint8array":i.arraybuffer&&g instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(g){if(!i[g.toLowerCase()])throw new Error(g+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(g){var x,b,y="";for(b=0;b<(g||"").length;b++)y+="\\x"+((x=g.charCodeAt(b))<16?"0":"")+x.toString(16).toUpperCase();return y},o.delay=function(g,x,b){setImmediate(function(){g.apply(b||null,x||[])})},o.inherits=function(g,x){function b(){}b.prototype=x.prototype,g.prototype=new b},o.extend=function(){var g,x,b={};for(g=0;g<arguments.length;g++)for(x in arguments[g])Object.prototype.hasOwnProperty.call(arguments[g],x)&&b[x]===void 0&&(b[x]=arguments[g][x]);return b},o.prepareContent=function(g,x,b,y,k){return c.Promise.resolve(x).then(function(j){return i.blob&&(j instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(j))!==-1)&&typeof FileReader<"u"?new c.Promise(function(C,T){var N=new FileReader;N.onload=function(P){C(P.target.result)},N.onerror=function(P){T(P.target.error)},N.readAsArrayBuffer(j)}):j}).then(function(j){var C=o.getTypeOf(j);return C?(C==="arraybuffer"?j=o.transformTo("uint8array",j):C==="string"&&(k?j=a.decode(j):b&&y!==!0&&(j=(function(T){return d(T,i.uint8array?new Uint8Array(T.length):new Array(T.length))})(j))),j):c.Promise.reject(new Error("Can't read the data of '"+g+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,s,o){var i=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 m=this.reader.index;this.reader.setIndex(f);var v=this.reader.readString(4)===h;return this.reader.setIndex(m),v},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",m=a.transformTo(h,f);this.zipComment=this.loadOptions.decodeFileName(m)},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,m,v=this.zip64EndOfCentralSize-44;0<v;)f=this.reader.readInt(2),h=this.reader.readInt(4),m=this.reader.readData(h),this.zip64ExtensibleData[f]={id:f,length:h,value:m}},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 m=this.centralDirOffset+this.centralDirSize;this.zip64&&(m+=20,m+=12+this.zip64EndOfCentralSize);var v=h-m;if(0<v)this.isSignature(h,l.CENTRAL_FILE_HEADER)||(this.reader.zero=v);else if(v<0)throw new Error("Corrupted zip: missing "+Math.abs(v)+" bytes.")},prepareReader:function(f){this.reader=i(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},s.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,s,o){var i=n("./reader/readerFor"),a=n("./utils"),l=n("./compressedObject"),c=n("./crc32"),u=n("./utf8"),d=n("./compressions"),f=n("./support");function h(m,v){this.options=m,this.loadOptions=v}h.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(m){var v,g;if(m.skip(22),this.fileNameLength=m.readInt(2),g=m.readInt(2),this.fileName=m.readData(this.fileNameLength),m.skip(g),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((v=(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,v,m.readData(this.compressedSize))},readCentralPart:function(m){this.versionMadeBy=m.readInt(2),m.skip(2),this.bitFlag=m.readInt(2),this.compressionMethod=m.readString(2),this.date=m.readDate(),this.crc32=m.readInt(4),this.compressedSize=m.readInt(4),this.uncompressedSize=m.readInt(4);var v=m.readInt(2);if(this.extraFieldsLength=m.readInt(2),this.fileCommentLength=m.readInt(2),this.diskNumberStart=m.readInt(2),this.internalFileAttributes=m.readInt(2),this.externalFileAttributes=m.readInt(4),this.localHeaderOffset=m.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");m.skip(v),this.readExtraFields(m),this.parseZIP64ExtraField(m),this.fileComment=m.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var m=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),m==0&&(this.dosPermissions=63&this.externalFileAttributes),m==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var m=i(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=m.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=m.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=m.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=m.readInt(4))}},readExtraFields:function(m){var v,g,x,b=m.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});m.index+4<b;)v=m.readInt(2),g=m.readInt(2),x=m.readData(g),this.extraFields[v]={id:v,length:g,value:x};m.setIndex(b)},handleUTF8:function(){var m=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var v=this.findExtraFieldUnicodePath();if(v!==null)this.fileNameStr=v;else{var g=a.transformTo(m,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(g)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var b=a.transformTo(m,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(b)}}},findExtraFieldUnicodePath:function(){var m=this.extraFields[28789];if(m){var v=i(m.value);return v.readInt(1)!==1||c(this.fileName)!==v.readInt(4)?null:u.utf8decode(v.readData(m.length-5))}return null},findExtraFieldUnicodeComment:function(){var m=this.extraFields[25461];if(m){var v=i(m.value);return v.readInt(1)!==1||c(this.fileComment)!==v.readInt(4)?null:u.utf8decode(v.readData(m.length-5))}return null}},s.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,s,o){function i(v,g,x){this.name=v,this.dir=x.dir,this.date=x.date,this.comment=x.comment,this.unixPermissions=x.unixPermissions,this.dosPermissions=x.dosPermissions,this._data=g,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");i.prototype={internalStream:function(v){var g=null,x="string";try{if(!v)throw new Error("No output type specified.");var b=(x=v.toLowerCase())==="string"||x==="text";x!=="binarystring"&&x!=="text"||(x="string"),g=this._decompressWorker();var y=!this._dataBinary;y&&!b&&(g=g.pipe(new c.Utf8EncodeWorker)),!y&&b&&(g=g.pipe(new c.Utf8DecodeWorker))}catch(k){(g=new d("error")).error(k)}return new a(g,x,"")},async:function(v,g){return this.internalStream(v).accumulate(g)},nodeStream:function(v,g){return this.internalStream(v||"nodebuffer").toNodejsStream(g)},_compressWorker:function(v,g){if(this._data instanceof u&&this._data.compression.magic===v.magic)return this._data.getCompressedWorker();var x=this._decompressWorker();return this._dataBinary||(x=x.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(x,v,g)},_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.")},m=0;m<f.length;m++)i.prototype[f[m]]=h;s.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,s,o){(function(i){var a,l,c=i.MutationObserver||i.WebKitMutationObserver;if(c){var u=0,d=new c(v),f=i.document.createTextNode("");d.observe(f,{characterData:!0}),a=function(){f.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)a="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var g=i.document.createElement("script");g.onreadystatechange=function(){v(),g.onreadystatechange=null,g.parentNode.removeChild(g),g=null},i.document.documentElement.appendChild(g)}:function(){setTimeout(v,0)};else{var h=new i.MessageChannel;h.port1.onmessage=v,a=function(){h.port2.postMessage(0)}}var m=[];function v(){var g,x;l=!0;for(var b=m.length;b;){for(x=m,m=[],g=-1;++g<b;)x[g]();b=m.length}l=!1}s.exports=function(g){m.push(g)!==1||l||a()}}).call(this,typeof kr<"u"?kr:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,s,o){var i=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&&g(this,b)}function h(b,y,k){this.promise=b,typeof y=="function"&&(this.onFulfilled=y,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function m(b,y,k){i(function(){var j;try{j=y(k)}catch(C){return l.reject(b,C)}j===b?l.reject(b,new TypeError("Cannot resolve promise with itself")):l.resolve(b,j)})}function v(b){var y=b&&b.then;if(b&&(typeof b=="object"||typeof b=="function")&&typeof y=="function")return function(){y.apply(b,arguments)}}function g(b,y){var k=!1;function j(N){k||(k=!0,l.reject(b,N))}function C(N){k||(k=!0,l.resolve(b,N))}var T=x(function(){y(C,j)});T.status==="error"&&j(T.value)}function x(b,y){var k={};try{k.value=b(y),k.status="success"}catch(j){k.status="error",k.value=j}return k}(s.exports=f).prototype.finally=function(b){if(typeof b!="function")return this;var y=this.constructor;return this.then(function(k){return y.resolve(b()).then(function(){return k})},function(k){return y.resolve(b()).then(function(){throw k})})},f.prototype.catch=function(b){return this.then(null,b)},f.prototype.then=function(b,y){if(typeof b!="function"&&this.state===u||typeof y!="function"&&this.state===c)return this;var k=new this.constructor(a);return this.state!==d?m(k,this.state===u?b:y,this.outcome):this.queue.push(new h(k,b,y)),k},h.prototype.callFulfilled=function(b){l.resolve(this.promise,b)},h.prototype.otherCallFulfilled=function(b){m(this.promise,this.onFulfilled,b)},h.prototype.callRejected=function(b){l.reject(this.promise,b)},h.prototype.otherCallRejected=function(b){m(this.promise,this.onRejected,b)},l.resolve=function(b,y){var k=x(v,y);if(k.status==="error")return l.reject(b,k.value);var j=k.value;if(j)g(b,j);else{b.state=u,b.outcome=y;for(var C=-1,T=b.queue.length;++C<T;)b.queue[C].callFulfilled(y)}return b},l.reject=function(b,y){b.state=c,b.outcome=y;for(var k=-1,j=b.queue.length;++k<j;)b.queue[k].callRejected(y);return b},f.resolve=function(b){return b instanceof this?b:l.resolve(new this(a),b)},f.reject=function(b){var y=new this(a);return l.reject(y,b)},f.all=function(b){var y=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=b.length,j=!1;if(!k)return this.resolve([]);for(var C=new Array(k),T=0,N=-1,P=new this(a);++N<k;)A(b[N],N);return P;function A(z,D){y.resolve(z).then(function(E){C[D]=E,++T!==k||j||(j=!0,l.resolve(P,C))},function(E){j||(j=!0,l.reject(P,E))})}},f.race=function(b){var y=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=b.length,j=!1;if(!k)return this.resolve([]);for(var C=-1,T=new this(a);++C<k;)N=b[C],y.resolve(N).then(function(P){j||(j=!0,l.resolve(T,P))},function(P){j||(j=!0,l.reject(T,P))});var N;return T}},{immediate:36}],38:[function(n,s,o){var i={};(0,n("./lib/utils/common").assign)(i,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),s.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,s,o){var i=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,m=0,v=8;function g(b){if(!(this instanceof g))return new g(b);this.options=a.assign({level:h,method:v,chunkSize:16384,windowBits:15,memLevel:8,strategy:m,to:""},b||{});var y=this.options;y.raw&&0<y.windowBits?y.windowBits=-y.windowBits:y.gzip&&0<y.windowBits&&y.windowBits<16&&(y.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var k=i.deflateInit2(this.strm,y.level,y.method,y.windowBits,y.memLevel,y.strategy);if(k!==f)throw new Error(c[k]);if(y.header&&i.deflateSetHeader(this.strm,y.header),y.dictionary){var j;if(j=typeof y.dictionary=="string"?l.string2buf(y.dictionary):d.call(y.dictionary)==="[object ArrayBuffer]"?new Uint8Array(y.dictionary):y.dictionary,(k=i.deflateSetDictionary(this.strm,j))!==f)throw new Error(c[k]);this._dict_set=!0}}function x(b,y){var k=new g(y);if(k.push(b,!0),k.err)throw k.msg||c[k.err];return k.result}g.prototype.push=function(b,y){var k,j,C=this.strm,T=this.options.chunkSize;if(this.ended)return!1;j=y===~~y?y:y===!0?4:0,typeof b=="string"?C.input=l.string2buf(b):d.call(b)==="[object ArrayBuffer]"?C.input=new Uint8Array(b):C.input=b,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new a.Buf8(T),C.next_out=0,C.avail_out=T),(k=i.deflate(C,j))!==1&&k!==f)return this.onEnd(k),!(this.ended=!0);C.avail_out!==0&&(C.avail_in!==0||j!==4&&j!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(a.shrinkBuf(C.output,C.next_out))):this.onData(a.shrinkBuf(C.output,C.next_out)))}while((0<C.avail_in||C.avail_out===0)&&k!==1);return j===4?(k=i.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===f):j!==2||(this.onEnd(f),!(C.avail_out=0))},g.prototype.onData=function(b){this.chunks.push(b)},g.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=g,o.deflate=x,o.deflateRaw=function(b,y){return(y=y||{}).raw=!0,x(b,y)},o.gzip=function(b,y){return(y=y||{}).gzip=!0,x(b,y)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,s,o){var i=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 m(g){if(!(this instanceof m))return new m(g);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},g||{});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)||g&&g.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=i.inflateInit2(this.strm,x.windowBits);if(b!==c.Z_OK)throw new Error(u[b]);this.header=new f,i.inflateGetHeader(this.strm,this.header)}function v(g,x){var b=new m(x);if(b.push(g,!0),b.err)throw b.msg||u[b.err];return b.result}m.prototype.push=function(g,x){var b,y,k,j,C,T,N=this.strm,P=this.options.chunkSize,A=this.options.dictionary,z=!1;if(this.ended)return!1;y=x===~~x?x:x===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof g=="string"?N.input=l.binstring2buf(g):h.call(g)==="[object ArrayBuffer]"?N.input=new Uint8Array(g):N.input=g,N.next_in=0,N.avail_in=N.input.length;do{if(N.avail_out===0&&(N.output=new a.Buf8(P),N.next_out=0,N.avail_out=P),(b=i.inflate(N,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&A&&(T=typeof A=="string"?l.string2buf(A):h.call(A)==="[object ArrayBuffer]"?new Uint8Array(A):A,b=i.inflateSetDictionary(this.strm,T)),b===c.Z_BUF_ERROR&&z===!0&&(b=c.Z_OK,z=!1),b!==c.Z_STREAM_END&&b!==c.Z_OK)return this.onEnd(b),!(this.ended=!0);N.next_out&&(N.avail_out!==0&&b!==c.Z_STREAM_END&&(N.avail_in!==0||y!==c.Z_FINISH&&y!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=l.utf8border(N.output,N.next_out),j=N.next_out-k,C=l.buf2string(N.output,k),N.next_out=j,N.avail_out=P-j,j&&a.arraySet(N.output,N.output,k,j,0),this.onData(C)):this.onData(a.shrinkBuf(N.output,N.next_out)))),N.avail_in===0&&N.avail_out===0&&(z=!0)}while((0<N.avail_in||N.avail_out===0)&&b!==c.Z_STREAM_END);return b===c.Z_STREAM_END&&(y=c.Z_FINISH),y===c.Z_FINISH?(b=i.inflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===c.Z_OK):y!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(N.avail_out=0))},m.prototype.onData=function(g){this.chunks.push(g)},m.prototype.onEnd=function(g){g===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},o.Inflate=m,o.inflate=v,o.inflateRaw=function(g,x){return(x=x||{}).raw=!0,v(g,x)},o.ungzip=v},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,s,o){var i=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 m=0;m<f;m++)c[h+m]=u[d+m]},flattenChunks:function(c){var u,d,f,h,m,v;for(u=f=0,d=c.length;u<d;u++)f+=c[u].length;for(v=new Uint8Array(f),u=h=0,d=c.length;u<d;u++)m=c[u],v.set(m,h),h+=m.length;return v}},l={arraySet:function(c,u,d,f,h){for(var m=0;m<f;m++)c[h+m]=u[d+m]},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(i)},{}],42:[function(n,s,o){var i=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 i.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,i.shrinkBuf(f,h));for(var m="",v=0;v<h;v++)m+=String.fromCharCode(f[v]);return m}c[254]=c[254]=1,o.string2buf=function(f){var h,m,v,g,x,b=f.length,y=0;for(g=0;g<b;g++)(64512&(m=f.charCodeAt(g)))==55296&&g+1<b&&(64512&(v=f.charCodeAt(g+1)))==56320&&(m=65536+(m-55296<<10)+(v-56320),g++),y+=m<128?1:m<2048?2:m<65536?3:4;for(h=new i.Buf8(y),g=x=0;x<y;g++)(64512&(m=f.charCodeAt(g)))==55296&&g+1<b&&(64512&(v=f.charCodeAt(g+1)))==56320&&(m=65536+(m-55296<<10)+(v-56320),g++),m<128?h[x++]=m:(m<2048?h[x++]=192|m>>>6:(m<65536?h[x++]=224|m>>>12:(h[x++]=240|m>>>18,h[x++]=128|m>>>12&63),h[x++]=128|m>>>6&63),h[x++]=128|63&m);return h},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var h=new i.Buf8(f.length),m=0,v=h.length;m<v;m++)h[m]=f.charCodeAt(m);return h},o.buf2string=function(f,h){var m,v,g,x,b=h||f.length,y=new Array(2*b);for(m=v=0;m<b;)if((g=f[m++])<128)y[v++]=g;else if(4<(x=c[g]))y[v++]=65533,m+=x-1;else{for(g&=x===2?31:x===3?15:7;1<x&&m<b;)g=g<<6|63&f[m++],x--;1<x?y[v++]=65533:g<65536?y[v++]=g:(g-=65536,y[v++]=55296|g>>10&1023,y[v++]=56320|1023&g)}return d(y,v)},o.utf8border=function(f,h){var m;for((h=h||f.length)>f.length&&(h=f.length),m=h-1;0<=m&&(192&f[m])==128;)m--;return m<0||m===0?h:m+c[f[m]]>h?m:h}},{"./common":41}],43:[function(n,s,o){s.exports=function(i,a,l,c){for(var u=65535&i|0,d=i>>>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,s,o){s.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,s,o){var i=(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})();s.exports=function(a,l,c,u){var d=i,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,s,o){var i,a=n("../utils/common"),l=n("./trees"),c=n("./adler32"),u=n("./crc32"),d=n("./messages"),f=0,h=4,m=0,v=-2,g=-1,x=4,b=2,y=8,k=9,j=286,C=30,T=19,N=2*j+1,P=15,A=3,z=258,D=z+A+1,E=42,L=113,w=1,$=2,ee=3,F=4;function W(_,Q){return _.msg=d[Q],Q}function Z(_){return(_<<1)-(4<_?9:0)}function ue(_){for(var Q=_.length;0<=--Q;)_[Q]=0}function V(_){var Q=_.state,G=Q.pending;G>_.avail_out&&(G=_.avail_out),G!==0&&(a.arraySet(_.output,Q.pending_buf,Q.pending_out,G,_.next_out),_.next_out+=G,Q.pending_out+=G,_.total_out+=G,_.avail_out-=G,Q.pending-=G,Q.pending===0&&(Q.pending_out=0))}function H(_,Q){l._tr_flush_block(_,0<=_.block_start?_.block_start:-1,_.strstart-_.block_start,Q),_.block_start=_.strstart,V(_.strm)}function le(_,Q){_.pending_buf[_.pending++]=Q}function U(_,Q){_.pending_buf[_.pending++]=Q>>>8&255,_.pending_buf[_.pending++]=255&Q}function X(_,Q){var G,O,R=_.max_chain_length,B=_.strstart,se=_.prev_length,ne=_.nice_match,q=_.strstart>_.w_size-D?_.strstart-(_.w_size-D):0,ce=_.window,I=_.w_mask,M=_.prev,Y=_.strstart+z,re=ce[B+se-1],oe=ce[B+se];_.prev_length>=_.good_match&&(R>>=2),ne>_.lookahead&&(ne=_.lookahead);do if(ce[(G=Q)+se]===oe&&ce[G+se-1]===re&&ce[G]===ce[B]&&ce[++G]===ce[B+1]){B+=2,G++;do;while(ce[++B]===ce[++G]&&ce[++B]===ce[++G]&&ce[++B]===ce[++G]&&ce[++B]===ce[++G]&&ce[++B]===ce[++G]&&ce[++B]===ce[++G]&&ce[++B]===ce[++G]&&ce[++B]===ce[++G]&&B<Y);if(O=z-(Y-B),B=Y-z,se<O){if(_.match_start=Q,ne<=(se=O))break;re=ce[B+se-1],oe=ce[B+se]}}while((Q=M[Q&I])>q&&--R!=0);return se<=_.lookahead?se:_.lookahead}function Ce(_){var Q,G,O,R,B,se,ne,q,ce,I,M=_.w_size;do{if(R=_.window_size-_.lookahead-_.strstart,_.strstart>=M+(M-D)){for(a.arraySet(_.window,_.window,M,M,0),_.match_start-=M,_.strstart-=M,_.block_start-=M,Q=G=_.hash_size;O=_.head[--Q],_.head[Q]=M<=O?O-M:0,--G;);for(Q=G=M;O=_.prev[--Q],_.prev[Q]=M<=O?O-M:0,--G;);R+=M}if(_.strm.avail_in===0)break;if(se=_.strm,ne=_.window,q=_.strstart+_.lookahead,ce=R,I=void 0,I=se.avail_in,ce<I&&(I=ce),G=I===0?0:(se.avail_in-=I,a.arraySet(ne,se.input,se.next_in,I,q),se.state.wrap===1?se.adler=c(se.adler,ne,I,q):se.state.wrap===2&&(se.adler=u(se.adler,ne,I,q)),se.next_in+=I,se.total_in+=I,I),_.lookahead+=G,_.lookahead+_.insert>=A)for(B=_.strstart-_.insert,_.ins_h=_.window[B],_.ins_h=(_.ins_h<<_.hash_shift^_.window[B+1])&_.hash_mask;_.insert&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[B+A-1])&_.hash_mask,_.prev[B&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=B,B++,_.insert--,!(_.lookahead+_.insert<A)););}while(_.lookahead<D&&_.strm.avail_in!==0)}function ae(_,Q){for(var G,O;;){if(_.lookahead<D){if(Ce(_),_.lookahead<D&&Q===f)return w;if(_.lookahead===0)break}if(G=0,_.lookahead>=A&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+A-1])&_.hash_mask,G=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),G!==0&&_.strstart-G<=_.w_size-D&&(_.match_length=X(_,G)),_.match_length>=A)if(O=l._tr_tally(_,_.strstart-_.match_start,_.match_length-A),_.lookahead-=_.match_length,_.match_length<=_.max_lazy_match&&_.lookahead>=A){for(_.match_length--;_.strstart++,_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+A-1])&_.hash_mask,G=_.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&&(H(_,!1),_.strm.avail_out===0))return w}return _.insert=_.strstart<A-1?_.strstart:A-1,Q===h?(H(_,!0),_.strm.avail_out===0?ee:F):_.last_lit&&(H(_,!1),_.strm.avail_out===0)?w:$}function ge(_,Q){for(var G,O,R;;){if(_.lookahead<D){if(Ce(_),_.lookahead<D&&Q===f)return w;if(_.lookahead===0)break}if(G=0,_.lookahead>=A&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+A-1])&_.hash_mask,G=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),_.prev_length=_.match_length,_.prev_match=_.match_start,_.match_length=A-1,G!==0&&_.prev_length<_.max_lazy_match&&_.strstart-G<=_.w_size-D&&(_.match_length=X(_,G),_.match_length<=5&&(_.strategy===1||_.match_length===A&&4096<_.strstart-_.match_start)&&(_.match_length=A-1)),_.prev_length>=A&&_.match_length<=_.prev_length){for(R=_.strstart+_.lookahead-A,O=l._tr_tally(_,_.strstart-1-_.prev_match,_.prev_length-A),_.lookahead-=_.prev_length-1,_.prev_length-=2;++_.strstart<=R&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+A-1])&_.hash_mask,G=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),--_.prev_length!=0;);if(_.match_available=0,_.match_length=A-1,_.strstart++,O&&(H(_,!1),_.strm.avail_out===0))return w}else if(_.match_available){if((O=l._tr_tally(_,0,_.window[_.strstart-1]))&&H(_,!1),_.strstart++,_.lookahead--,_.strm.avail_out===0)return w}else _.match_available=1,_.strstart++,_.lookahead--}return _.match_available&&(O=l._tr_tally(_,0,_.window[_.strstart-1]),_.match_available=0),_.insert=_.strstart<A-1?_.strstart:A-1,Q===h?(H(_,!0),_.strm.avail_out===0?ee:F):_.last_lit&&(H(_,!1),_.strm.avail_out===0)?w:$}function xe(_,Q,G,O,R){this.good_length=_,this.max_lazy=Q,this.nice_length=G,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=y,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*N),this.dyn_dtree=new a.Buf16(2*(2*C+1)),this.bl_tree=new a.Buf16(2*(2*T+1)),ue(this.dyn_ltree),ue(this.dyn_dtree),ue(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new a.Buf16(P+1),this.heap=new a.Buf16(2*j+1),ue(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new a.Buf16(2*j+1),ue(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 be(_){var Q;return _&&_.state?(_.total_in=_.total_out=0,_.data_type=b,(Q=_.state).pending=0,Q.pending_out=0,Q.wrap<0&&(Q.wrap=-Q.wrap),Q.status=Q.wrap?E:L,_.adler=Q.wrap===2?0:1,Q.last_flush=f,l._tr_init(Q),m):W(_,v)}function Se(_){var Q=be(_);return Q===m&&(function(G){G.window_size=2*G.w_size,ue(G.head),G.max_lazy_match=i[G.level].max_lazy,G.good_match=i[G.level].good_length,G.nice_match=i[G.level].nice_length,G.max_chain_length=i[G.level].max_chain,G.strstart=0,G.block_start=0,G.lookahead=0,G.insert=0,G.match_length=G.prev_length=A-1,G.match_available=0,G.ins_h=0})(_.state),Q}function Ie(_,Q,G,O,R,B){if(!_)return v;var se=1;if(Q===g&&(Q=6),O<0?(se=0,O=-O):15<O&&(se=2,O-=16),R<1||k<R||G!==y||O<8||15<O||Q<0||9<Q||B<0||x<B)return W(_,v);O===8&&(O=9);var ne=new he;return(_.state=ne).strm=_,ne.wrap=se,ne.gzhead=null,ne.w_bits=O,ne.w_size=1<<ne.w_bits,ne.w_mask=ne.w_size-1,ne.hash_bits=R+7,ne.hash_size=1<<ne.hash_bits,ne.hash_mask=ne.hash_size-1,ne.hash_shift=~~((ne.hash_bits+A-1)/A),ne.window=new a.Buf8(2*ne.w_size),ne.head=new a.Buf16(ne.hash_size),ne.prev=new a.Buf16(ne.w_size),ne.lit_bufsize=1<<R+6,ne.pending_buf_size=4*ne.lit_bufsize,ne.pending_buf=new a.Buf8(ne.pending_buf_size),ne.d_buf=1*ne.lit_bufsize,ne.l_buf=3*ne.lit_bufsize,ne.level=Q,ne.strategy=B,ne.method=G,Se(_)}i=[new xe(0,0,0,0,function(_,Q){var G=65535;for(G>_.pending_buf_size-5&&(G=_.pending_buf_size-5);;){if(_.lookahead<=1){if(Ce(_),_.lookahead===0&&Q===f)return w;if(_.lookahead===0)break}_.strstart+=_.lookahead,_.lookahead=0;var O=_.block_start+G;if((_.strstart===0||_.strstart>=O)&&(_.lookahead=_.strstart-O,_.strstart=O,H(_,!1),_.strm.avail_out===0)||_.strstart-_.block_start>=_.w_size-D&&(H(_,!1),_.strm.avail_out===0))return w}return _.insert=0,Q===h?(H(_,!0),_.strm.avail_out===0?ee:F):(_.strstart>_.block_start&&(H(_,!1),_.strm.avail_out),w)}),new xe(4,4,8,4,ae),new xe(4,5,16,8,ae),new xe(4,6,32,32,ae),new xe(4,4,16,16,ge),new xe(8,16,32,32,ge),new xe(8,16,128,128,ge),new xe(8,32,128,256,ge),new xe(32,128,258,1024,ge),new xe(32,258,258,4096,ge)],o.deflateInit=function(_,Q){return Ie(_,Q,y,15,8,0)},o.deflateInit2=Ie,o.deflateReset=Se,o.deflateResetKeep=be,o.deflateSetHeader=function(_,Q){return _&&_.state?_.state.wrap!==2?v:(_.state.gzhead=Q,m):v},o.deflate=function(_,Q){var G,O,R,B;if(!_||!_.state||5<Q||Q<0)return _?W(_,v):v;if(O=_.state,!_.output||!_.input&&_.avail_in!==0||O.status===666&&Q!==h)return W(_,_.avail_out===0?-5:v);if(O.strm=_,G=O.last_flush,O.last_flush=Q,O.status===E)if(O.wrap===2)_.adler=0,le(O,31),le(O,139),le(O,8),O.gzhead?(le(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)),le(O,255&O.gzhead.time),le(O,O.gzhead.time>>8&255),le(O,O.gzhead.time>>16&255),le(O,O.gzhead.time>>24&255),le(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),le(O,255&O.gzhead.os),O.gzhead.extra&&O.gzhead.extra.length&&(le(O,255&O.gzhead.extra.length),le(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):(le(O,0),le(O,0),le(O,0),le(O,0),le(O,0),le(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),le(O,3),O.status=L);else{var se=y+(O.w_bits-8<<4)<<8;se|=(2<=O.strategy||O.level<2?0:O.level<6?1:O.level===6?2:3)<<6,O.strstart!==0&&(se|=32),se+=31-se%31,O.status=L,U(O,se),O.strstart!==0&&(U(O,_.adler>>>16),U(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)),V(_),R=O.pending,O.pending!==O.pending_buf_size));)le(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)),V(_),R=O.pending,O.pending===O.pending_buf_size)){B=1;break}B=O.gzindex<O.gzhead.name.length?255&O.gzhead.name.charCodeAt(O.gzindex++):0,le(O,B)}while(B!==0);O.gzhead.hcrc&&O.pending>R&&(_.adler=u(_.adler,O.pending_buf,O.pending-R,R)),B===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)),V(_),R=O.pending,O.pending===O.pending_buf_size)){B=1;break}B=O.gzindex<O.gzhead.comment.length?255&O.gzhead.comment.charCodeAt(O.gzindex++):0,le(O,B)}while(B!==0);O.gzhead.hcrc&&O.pending>R&&(_.adler=u(_.adler,O.pending_buf,O.pending-R,R)),B===0&&(O.status=103)}else O.status=103;if(O.status===103&&(O.gzhead.hcrc?(O.pending+2>O.pending_buf_size&&V(_),O.pending+2<=O.pending_buf_size&&(le(O,255&_.adler),le(O,_.adler>>8&255),_.adler=0,O.status=L)):O.status=L),O.pending!==0){if(V(_),_.avail_out===0)return O.last_flush=-1,m}else if(_.avail_in===0&&Z(Q)<=Z(G)&&Q!==h)return W(_,-5);if(O.status===666&&_.avail_in!==0)return W(_,-5);if(_.avail_in!==0||O.lookahead!==0||Q!==f&&O.status!==666){var ne=O.strategy===2?(function(q,ce){for(var I;;){if(q.lookahead===0&&(Ce(q),q.lookahead===0)){if(ce===f)return w;break}if(q.match_length=0,I=l._tr_tally(q,0,q.window[q.strstart]),q.lookahead--,q.strstart++,I&&(H(q,!1),q.strm.avail_out===0))return w}return q.insert=0,ce===h?(H(q,!0),q.strm.avail_out===0?ee:F):q.last_lit&&(H(q,!1),q.strm.avail_out===0)?w:$})(O,Q):O.strategy===3?(function(q,ce){for(var I,M,Y,re,oe=q.window;;){if(q.lookahead<=z){if(Ce(q),q.lookahead<=z&&ce===f)return w;if(q.lookahead===0)break}if(q.match_length=0,q.lookahead>=A&&0<q.strstart&&(M=oe[Y=q.strstart-1])===oe[++Y]&&M===oe[++Y]&&M===oe[++Y]){re=q.strstart+z;do;while(M===oe[++Y]&&M===oe[++Y]&&M===oe[++Y]&&M===oe[++Y]&&M===oe[++Y]&&M===oe[++Y]&&M===oe[++Y]&&M===oe[++Y]&&Y<re);q.match_length=z-(re-Y),q.match_length>q.lookahead&&(q.match_length=q.lookahead)}if(q.match_length>=A?(I=l._tr_tally(q,1,q.match_length-A),q.lookahead-=q.match_length,q.strstart+=q.match_length,q.match_length=0):(I=l._tr_tally(q,0,q.window[q.strstart]),q.lookahead--,q.strstart++),I&&(H(q,!1),q.strm.avail_out===0))return w}return q.insert=0,ce===h?(H(q,!0),q.strm.avail_out===0?ee:F):q.last_lit&&(H(q,!1),q.strm.avail_out===0)?w:$})(O,Q):i[O.level].func(O,Q);if(ne!==ee&&ne!==F||(O.status=666),ne===w||ne===ee)return _.avail_out===0&&(O.last_flush=-1),m;if(ne===$&&(Q===1?l._tr_align(O):Q!==5&&(l._tr_stored_block(O,0,0,!1),Q===3&&(ue(O.head),O.lookahead===0&&(O.strstart=0,O.block_start=0,O.insert=0))),V(_),_.avail_out===0))return O.last_flush=-1,m}return Q!==h?m:O.wrap<=0?1:(O.wrap===2?(le(O,255&_.adler),le(O,_.adler>>8&255),le(O,_.adler>>16&255),le(O,_.adler>>24&255),le(O,255&_.total_in),le(O,_.total_in>>8&255),le(O,_.total_in>>16&255),le(O,_.total_in>>24&255)):(U(O,_.adler>>>16),U(O,65535&_.adler)),V(_),0<O.wrap&&(O.wrap=-O.wrap),O.pending!==0?m:1)},o.deflateEnd=function(_){var Q;return _&&_.state?(Q=_.state.status)!==E&&Q!==69&&Q!==73&&Q!==91&&Q!==103&&Q!==L&&Q!==666?W(_,v):(_.state=null,Q===L?W(_,-3):m):v},o.deflateSetDictionary=function(_,Q){var G,O,R,B,se,ne,q,ce,I=Q.length;if(!_||!_.state||(B=(G=_.state).wrap)===2||B===1&&G.status!==E||G.lookahead)return v;for(B===1&&(_.adler=c(_.adler,Q,I,0)),G.wrap=0,I>=G.w_size&&(B===0&&(ue(G.head),G.strstart=0,G.block_start=0,G.insert=0),ce=new a.Buf8(G.w_size),a.arraySet(ce,Q,I-G.w_size,G.w_size,0),Q=ce,I=G.w_size),se=_.avail_in,ne=_.next_in,q=_.input,_.avail_in=I,_.next_in=0,_.input=Q,Ce(G);G.lookahead>=A;){for(O=G.strstart,R=G.lookahead-(A-1);G.ins_h=(G.ins_h<<G.hash_shift^G.window[O+A-1])&G.hash_mask,G.prev[O&G.w_mask]=G.head[G.ins_h],G.head[G.ins_h]=O,O++,--R;);G.strstart=O,G.lookahead=A-1,Ce(G)}return G.strstart+=G.lookahead,G.block_start=G.strstart,G.insert=G.lookahead,G.lookahead=0,G.match_length=G.prev_length=A-1,G.match_available=0,_.next_in=ne,_.input=q,_.avail_in=se,G.wrap=B,m},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,s,o){s.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,s,o){s.exports=function(i,a){var l,c,u,d,f,h,m,v,g,x,b,y,k,j,C,T,N,P,A,z,D,E,L,w,$;l=i.state,c=i.next_in,w=i.input,u=c+(i.avail_in-5),d=i.next_out,$=i.output,f=d-(a-i.avail_out),h=d+(i.avail_out-257),m=l.dmax,v=l.wsize,g=l.whave,x=l.wnext,b=l.window,y=l.hold,k=l.bits,j=l.lencode,C=l.distcode,T=(1<<l.lenbits)-1,N=(1<<l.distbits)-1;e:do{k<15&&(y+=w[c++]<<k,k+=8,y+=w[c++]<<k,k+=8),P=j[y&T];t:for(;;){if(y>>>=A=P>>>24,k-=A,(A=P>>>16&255)===0)$[d++]=65535&P;else{if(!(16&A)){if((64&A)==0){P=j[(65535&P)+(y&(1<<A)-1)];continue t}if(32&A){l.mode=12;break e}i.msg="invalid literal/length code",l.mode=30;break e}z=65535&P,(A&=15)&&(k<A&&(y+=w[c++]<<k,k+=8),z+=y&(1<<A)-1,y>>>=A,k-=A),k<15&&(y+=w[c++]<<k,k+=8,y+=w[c++]<<k,k+=8),P=C[y&N];n:for(;;){if(y>>>=A=P>>>24,k-=A,!(16&(A=P>>>16&255))){if((64&A)==0){P=C[(65535&P)+(y&(1<<A)-1)];continue n}i.msg="invalid distance code",l.mode=30;break e}if(D=65535&P,k<(A&=15)&&(y+=w[c++]<<k,(k+=8)<A&&(y+=w[c++]<<k,k+=8)),m<(D+=y&(1<<A)-1)){i.msg="invalid distance too far back",l.mode=30;break e}if(y>>>=A,k-=A,(A=d-f)<D){if(g<(A=D-A)&&l.sane){i.msg="invalid distance too far back",l.mode=30;break e}if(L=b,(E=0)===x){if(E+=v-A,A<z){for(z-=A;$[d++]=b[E++],--A;);E=d-D,L=$}}else if(x<A){if(E+=v+x-A,(A-=x)<z){for(z-=A;$[d++]=b[E++],--A;);if(E=0,x<z){for(z-=A=x;$[d++]=b[E++],--A;);E=d-D,L=$}}}else if(E+=x-A,A<z){for(z-=A;$[d++]=b[E++],--A;);E=d-D,L=$}for(;2<z;)$[d++]=L[E++],$[d++]=L[E++],$[d++]=L[E++],z-=3;z&&($[d++]=L[E++],1<z&&($[d++]=L[E++]))}else{for(E=d-D;$[d++]=$[E++],$[d++]=$[E++],$[d++]=$[E++],2<(z-=3););z&&($[d++]=$[E++],1<z&&($[d++]=$[E++]))}break}}break}}while(c<u&&d<h);c-=z=k>>3,y&=(1<<(k-=z<<3))-1,i.next_in=c,i.next_out=d,i.avail_in=c<u?u-c+5:5-(c-u),i.avail_out=d<h?h-d+257:257-(d-h),l.hold=y,l.bits=k}},{}],49:[function(n,s,o){var i=n("../utils/common"),a=n("./adler32"),l=n("./crc32"),c=n("./inffast"),u=n("./inftrees"),d=1,f=2,h=0,m=-2,v=1,g=852,x=592;function b(E){return(E>>>24&255)+(E>>>8&65280)+((65280&E)<<8)+((255&E)<<24)}function y(){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 i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function k(E){var L;return E&&E.state?(L=E.state,E.total_in=E.total_out=L.total=0,E.msg="",L.wrap&&(E.adler=1&L.wrap),L.mode=v,L.last=0,L.havedict=0,L.dmax=32768,L.head=null,L.hold=0,L.bits=0,L.lencode=L.lendyn=new i.Buf32(g),L.distcode=L.distdyn=new i.Buf32(x),L.sane=1,L.back=-1,h):m}function j(E){var L;return E&&E.state?((L=E.state).wsize=0,L.whave=0,L.wnext=0,k(E)):m}function C(E,L){var w,$;return E&&E.state?($=E.state,L<0?(w=0,L=-L):(w=1+(L>>4),L<48&&(L&=15)),L&&(L<8||15<L)?m:($.window!==null&&$.wbits!==L&&($.window=null),$.wrap=w,$.wbits=L,j(E))):m}function T(E,L){var w,$;return E?($=new y,(E.state=$).window=null,(w=C(E,L))!==h&&(E.state=null),w):m}var N,P,A=!0;function z(E){if(A){var L;for(N=new i.Buf32(512),P=new i.Buf32(32),L=0;L<144;)E.lens[L++]=8;for(;L<256;)E.lens[L++]=9;for(;L<280;)E.lens[L++]=7;for(;L<288;)E.lens[L++]=8;for(u(d,E.lens,0,288,N,0,E.work,{bits:9}),L=0;L<32;)E.lens[L++]=5;u(f,E.lens,0,32,P,0,E.work,{bits:5}),A=!1}E.lencode=N,E.lenbits=9,E.distcode=P,E.distbits=5}function D(E,L,w,$){var ee,F=E.state;return F.window===null&&(F.wsize=1<<F.wbits,F.wnext=0,F.whave=0,F.window=new i.Buf8(F.wsize)),$>=F.wsize?(i.arraySet(F.window,L,w-F.wsize,F.wsize,0),F.wnext=0,F.whave=F.wsize):($<(ee=F.wsize-F.wnext)&&(ee=$),i.arraySet(F.window,L,w-$,ee,F.wnext),($-=ee)?(i.arraySet(F.window,L,w-$,$,0),F.wnext=$,F.whave=F.wsize):(F.wnext+=ee,F.wnext===F.wsize&&(F.wnext=0),F.whave<F.wsize&&(F.whave+=ee))),0}o.inflateReset=j,o.inflateReset2=C,o.inflateResetKeep=k,o.inflateInit=function(E){return T(E,15)},o.inflateInit2=T,o.inflate=function(E,L){var w,$,ee,F,W,Z,ue,V,H,le,U,X,Ce,ae,ge,xe,he,be,Se,Ie,_,Q,G,O,R=0,B=new i.Buf8(4),se=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!E||!E.state||!E.output||!E.input&&E.avail_in!==0)return m;(w=E.state).mode===12&&(w.mode=13),W=E.next_out,ee=E.output,ue=E.avail_out,F=E.next_in,$=E.input,Z=E.avail_in,V=w.hold,H=w.bits,le=Z,U=ue,Q=h;e:for(;;)switch(w.mode){case v:if(w.wrap===0){w.mode=13;break}for(;H<16;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}if(2&w.wrap&&V===35615){B[w.check=0]=255&V,B[1]=V>>>8&255,w.check=l(w.check,B,2,0),H=V=0,w.mode=2;break}if(w.flags=0,w.head&&(w.head.done=!1),!(1&w.wrap)||(((255&V)<<8)+(V>>8))%31){E.msg="incorrect header check",w.mode=30;break}if((15&V)!=8){E.msg="unknown compression method",w.mode=30;break}if(H-=4,_=8+(15&(V>>>=4)),w.wbits===0)w.wbits=_;else if(_>w.wbits){E.msg="invalid window size",w.mode=30;break}w.dmax=1<<_,E.adler=w.check=1,w.mode=512&V?10:12,H=V=0;break;case 2:for(;H<16;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}if(w.flags=V,(255&w.flags)!=8){E.msg="unknown compression method",w.mode=30;break}if(57344&w.flags){E.msg="unknown header flags set",w.mode=30;break}w.head&&(w.head.text=V>>8&1),512&w.flags&&(B[0]=255&V,B[1]=V>>>8&255,w.check=l(w.check,B,2,0)),H=V=0,w.mode=3;case 3:for(;H<32;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}w.head&&(w.head.time=V),512&w.flags&&(B[0]=255&V,B[1]=V>>>8&255,B[2]=V>>>16&255,B[3]=V>>>24&255,w.check=l(w.check,B,4,0)),H=V=0,w.mode=4;case 4:for(;H<16;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}w.head&&(w.head.xflags=255&V,w.head.os=V>>8),512&w.flags&&(B[0]=255&V,B[1]=V>>>8&255,w.check=l(w.check,B,2,0)),H=V=0,w.mode=5;case 5:if(1024&w.flags){for(;H<16;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}w.length=V,w.head&&(w.head.extra_len=V),512&w.flags&&(B[0]=255&V,B[1]=V>>>8&255,w.check=l(w.check,B,2,0)),H=V=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&(Z<(X=w.length)&&(X=Z),X&&(w.head&&(_=w.head.extra_len-w.length,w.head.extra||(w.head.extra=new Array(w.head.extra_len)),i.arraySet(w.head.extra,$,F,X,_)),512&w.flags&&(w.check=l(w.check,$,X,F)),Z-=X,F+=X,w.length-=X),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if(Z===0)break e;for(X=0;_=$[F+X++],w.head&&_&&w.length<65536&&(w.head.name+=String.fromCharCode(_)),_&&X<Z;);if(512&w.flags&&(w.check=l(w.check,$,X,F)),Z-=X,F+=X,_)break e}else w.head&&(w.head.name=null);w.length=0,w.mode=8;case 8:if(4096&w.flags){if(Z===0)break e;for(X=0;_=$[F+X++],w.head&&_&&w.length<65536&&(w.head.comment+=String.fromCharCode(_)),_&&X<Z;);if(512&w.flags&&(w.check=l(w.check,$,X,F)),Z-=X,F+=X,_)break e}else w.head&&(w.head.comment=null);w.mode=9;case 9:if(512&w.flags){for(;H<16;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}if(V!==(65535&w.check)){E.msg="header crc mismatch",w.mode=30;break}H=V=0}w.head&&(w.head.hcrc=w.flags>>9&1,w.head.done=!0),E.adler=w.check=0,w.mode=12;break;case 10:for(;H<32;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}E.adler=w.check=b(V),H=V=0,w.mode=11;case 11:if(w.havedict===0)return E.next_out=W,E.avail_out=ue,E.next_in=F,E.avail_in=Z,w.hold=V,w.bits=H,2;E.adler=w.check=1,w.mode=12;case 12:if(L===5||L===6)break e;case 13:if(w.last){V>>>=7&H,H-=7&H,w.mode=27;break}for(;H<3;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}switch(w.last=1&V,H-=1,3&(V>>>=1)){case 0:w.mode=14;break;case 1:if(z(w),w.mode=20,L!==6)break;V>>>=2,H-=2;break e;case 2:w.mode=17;break;case 3:E.msg="invalid block type",w.mode=30}V>>>=2,H-=2;break;case 14:for(V>>>=7&H,H-=7&H;H<32;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}if((65535&V)!=(V>>>16^65535)){E.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&V,H=V=0,w.mode=15,L===6)break e;case 15:w.mode=16;case 16:if(X=w.length){if(Z<X&&(X=Z),ue<X&&(X=ue),X===0)break e;i.arraySet(ee,$,F,X,W),Z-=X,F+=X,ue-=X,W+=X,w.length-=X;break}w.mode=12;break;case 17:for(;H<14;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}if(w.nlen=257+(31&V),V>>>=5,H-=5,w.ndist=1+(31&V),V>>>=5,H-=5,w.ncode=4+(15&V),V>>>=4,H-=4,286<w.nlen||30<w.ndist){E.msg="too many length or distance symbols",w.mode=30;break}w.have=0,w.mode=18;case 18:for(;w.have<w.ncode;){for(;H<3;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}w.lens[se[w.have++]]=7&V,V>>>=3,H-=3}for(;w.have<19;)w.lens[se[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,G={bits:w.lenbits},Q=u(0,w.lens,0,19,w.lencode,0,w.work,G),w.lenbits=G.bits,Q){E.msg="invalid code lengths set",w.mode=30;break}w.have=0,w.mode=19;case 19:for(;w.have<w.nlen+w.ndist;){for(;xe=(R=w.lencode[V&(1<<w.lenbits)-1])>>>16&255,he=65535&R,!((ge=R>>>24)<=H);){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}if(he<16)V>>>=ge,H-=ge,w.lens[w.have++]=he;else{if(he===16){for(O=ge+2;H<O;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}if(V>>>=ge,H-=ge,w.have===0){E.msg="invalid bit length repeat",w.mode=30;break}_=w.lens[w.have-1],X=3+(3&V),V>>>=2,H-=2}else if(he===17){for(O=ge+3;H<O;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}H-=ge,_=0,X=3+(7&(V>>>=ge)),V>>>=3,H-=3}else{for(O=ge+7;H<O;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}H-=ge,_=0,X=11+(127&(V>>>=ge)),V>>>=7,H-=7}if(w.have+X>w.nlen+w.ndist){E.msg="invalid bit length repeat",w.mode=30;break}for(;X--;)w.lens[w.have++]=_}}if(w.mode===30)break;if(w.lens[256]===0){E.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,G={bits:w.lenbits},Q=u(d,w.lens,0,w.nlen,w.lencode,0,w.work,G),w.lenbits=G.bits,Q){E.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,G={bits:w.distbits},Q=u(f,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,G),w.distbits=G.bits,Q){E.msg="invalid distances set",w.mode=30;break}if(w.mode=20,L===6)break e;case 20:w.mode=21;case 21:if(6<=Z&&258<=ue){E.next_out=W,E.avail_out=ue,E.next_in=F,E.avail_in=Z,w.hold=V,w.bits=H,c(E,U),W=E.next_out,ee=E.output,ue=E.avail_out,F=E.next_in,$=E.input,Z=E.avail_in,V=w.hold,H=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;xe=(R=w.lencode[V&(1<<w.lenbits)-1])>>>16&255,he=65535&R,!((ge=R>>>24)<=H);){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}if(xe&&(240&xe)==0){for(be=ge,Se=xe,Ie=he;xe=(R=w.lencode[Ie+((V&(1<<be+Se)-1)>>be)])>>>16&255,he=65535&R,!(be+(ge=R>>>24)<=H);){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}V>>>=be,H-=be,w.back+=be}if(V>>>=ge,H-=ge,w.back+=ge,w.length=he,xe===0){w.mode=26;break}if(32&xe){w.back=-1,w.mode=12;break}if(64&xe){E.msg="invalid literal/length code",w.mode=30;break}w.extra=15&xe,w.mode=22;case 22:if(w.extra){for(O=w.extra;H<O;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}w.length+=V&(1<<w.extra)-1,V>>>=w.extra,H-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;xe=(R=w.distcode[V&(1<<w.distbits)-1])>>>16&255,he=65535&R,!((ge=R>>>24)<=H);){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}if((240&xe)==0){for(be=ge,Se=xe,Ie=he;xe=(R=w.distcode[Ie+((V&(1<<be+Se)-1)>>be)])>>>16&255,he=65535&R,!(be+(ge=R>>>24)<=H);){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}V>>>=be,H-=be,w.back+=be}if(V>>>=ge,H-=ge,w.back+=ge,64&xe){E.msg="invalid distance code",w.mode=30;break}w.offset=he,w.extra=15&xe,w.mode=24;case 24:if(w.extra){for(O=w.extra;H<O;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}w.offset+=V&(1<<w.extra)-1,V>>>=w.extra,H-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){E.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(ue===0)break e;if(X=U-ue,w.offset>X){if((X=w.offset-X)>w.whave&&w.sane){E.msg="invalid distance too far back",w.mode=30;break}Ce=X>w.wnext?(X-=w.wnext,w.wsize-X):w.wnext-X,X>w.length&&(X=w.length),ae=w.window}else ae=ee,Ce=W-w.offset,X=w.length;for(ue<X&&(X=ue),ue-=X,w.length-=X;ee[W++]=ae[Ce++],--X;);w.length===0&&(w.mode=21);break;case 26:if(ue===0)break e;ee[W++]=w.length,ue--,w.mode=21;break;case 27:if(w.wrap){for(;H<32;){if(Z===0)break e;Z--,V|=$[F++]<<H,H+=8}if(U-=ue,E.total_out+=U,w.total+=U,U&&(E.adler=w.check=w.flags?l(w.check,ee,U,W-U):a(w.check,ee,U,W-U)),U=ue,(w.flags?V:b(V))!==w.check){E.msg="incorrect data check",w.mode=30;break}H=V=0}w.mode=28;case 28:if(w.wrap&&w.flags){for(;H<32;){if(Z===0)break e;Z--,V+=$[F++]<<H,H+=8}if(V!==(4294967295&w.total)){E.msg="incorrect length check",w.mode=30;break}H=V=0}w.mode=29;case 29:Q=1;break e;case 30:Q=-3;break e;case 31:return-4;default:return m}return E.next_out=W,E.avail_out=ue,E.next_in=F,E.avail_in=Z,w.hold=V,w.bits=H,(w.wsize||U!==E.avail_out&&w.mode<30&&(w.mode<27||L!==4))&&D(E,E.output,E.next_out,U-E.avail_out)?(w.mode=31,-4):(le-=E.avail_in,U-=E.avail_out,E.total_in+=le,E.total_out+=U,w.total+=U,w.wrap&&U&&(E.adler=w.check=w.flags?l(w.check,ee,U,E.next_out-U):a(w.check,ee,U,E.next_out-U)),E.data_type=w.bits+(w.last?64:0)+(w.mode===12?128:0)+(w.mode===20||w.mode===15?256:0),(le==0&&U===0||L===4)&&Q===h&&(Q=-5),Q)},o.inflateEnd=function(E){if(!E||!E.state)return m;var L=E.state;return L.window&&(L.window=null),E.state=null,h},o.inflateGetHeader=function(E,L){var w;return E&&E.state?(2&(w=E.state).wrap)==0?m:((w.head=L).done=!1,h):m},o.inflateSetDictionary=function(E,L){var w,$=L.length;return E&&E.state?(w=E.state).wrap!==0&&w.mode!==11?m:w.mode===11&&a(1,L,$,0)!==w.check?-3:D(E,L,$,$)?(w.mode=31,-4):(w.havedict=1,h):m},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,s,o){var i=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];s.exports=function(d,f,h,m,v,g,x,b){var y,k,j,C,T,N,P,A,z,D=b.bits,E=0,L=0,w=0,$=0,ee=0,F=0,W=0,Z=0,ue=0,V=0,H=null,le=0,U=new i.Buf16(16),X=new i.Buf16(16),Ce=null,ae=0;for(E=0;E<=15;E++)U[E]=0;for(L=0;L<m;L++)U[f[h+L]]++;for(ee=D,$=15;1<=$&&U[$]===0;$--);if($<ee&&(ee=$),$===0)return v[g++]=20971520,v[g++]=20971520,b.bits=1,0;for(w=1;w<$&&U[w]===0;w++);for(ee<w&&(ee=w),E=Z=1;E<=15;E++)if(Z<<=1,(Z-=U[E])<0)return-1;if(0<Z&&(d===0||$!==1))return-1;for(X[1]=0,E=1;E<15;E++)X[E+1]=X[E]+U[E];for(L=0;L<m;L++)f[h+L]!==0&&(x[X[f[h+L]]++]=L);if(N=d===0?(H=Ce=x,19):d===1?(H=a,le-=257,Ce=l,ae-=257,256):(H=c,Ce=u,-1),E=w,T=g,W=L=V=0,j=-1,C=(ue=1<<(F=ee))-1,d===1&&852<ue||d===2&&592<ue)return 1;for(;;){for(P=E-W,z=x[L]<N?(A=0,x[L]):x[L]>N?(A=Ce[ae+x[L]],H[le+x[L]]):(A=96,0),y=1<<E-W,w=k=1<<F;v[T+(V>>W)+(k-=y)]=P<<24|A<<16|z|0,k!==0;);for(y=1<<E-1;V&y;)y>>=1;if(y!==0?(V&=y-1,V+=y):V=0,L++,--U[E]==0){if(E===$)break;E=f[h+x[L]]}if(ee<E&&(V&C)!==j){for(W===0&&(W=ee),T+=w,Z=1<<(F=E-W);F+W<$&&!((Z-=U[F+W])<=0);)F++,Z<<=1;if(ue+=1<<F,d===1&&852<ue||d===2&&592<ue)return 1;v[j=V&C]=ee<<24|F<<16|T-g|0}}return V!==0&&(v[T+V]=E-W<<24|64<<16|0),b.bits=ee,0}},{"../utils/common":41}],51:[function(n,s,o){s.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,s,o){var i=n("../utils/common"),a=0,l=1;function c(R){for(var B=R.length;0<=--B;)R[B]=0}var u=0,d=29,f=256,h=f+1+d,m=30,v=19,g=2*h+1,x=15,b=16,y=7,k=256,j=16,C=17,T=18,N=[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],P=[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],A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],z=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],D=new Array(2*(h+2));c(D);var E=new Array(2*m);c(E);var L=new Array(512);c(L);var w=new Array(256);c(w);var $=new Array(d);c($);var ee,F,W,Z=new Array(m);function ue(R,B,se,ne,q){this.static_tree=R,this.extra_bits=B,this.extra_base=se,this.elems=ne,this.max_length=q,this.has_stree=R&&R.length}function V(R,B){this.dyn_tree=R,this.max_code=0,this.stat_desc=B}function H(R){return R<256?L[R]:L[256+(R>>>7)]}function le(R,B){R.pending_buf[R.pending++]=255&B,R.pending_buf[R.pending++]=B>>>8&255}function U(R,B,se){R.bi_valid>b-se?(R.bi_buf|=B<<R.bi_valid&65535,le(R,R.bi_buf),R.bi_buf=B>>b-R.bi_valid,R.bi_valid+=se-b):(R.bi_buf|=B<<R.bi_valid&65535,R.bi_valid+=se)}function X(R,B,se){U(R,se[2*B],se[2*B+1])}function Ce(R,B){for(var se=0;se|=1&R,R>>>=1,se<<=1,0<--B;);return se>>>1}function ae(R,B,se){var ne,q,ce=new Array(x+1),I=0;for(ne=1;ne<=x;ne++)ce[ne]=I=I+se[ne-1]<<1;for(q=0;q<=B;q++){var M=R[2*q+1];M!==0&&(R[2*q]=Ce(ce[M]++,M))}}function ge(R){var B;for(B=0;B<h;B++)R.dyn_ltree[2*B]=0;for(B=0;B<m;B++)R.dyn_dtree[2*B]=0;for(B=0;B<v;B++)R.bl_tree[2*B]=0;R.dyn_ltree[2*k]=1,R.opt_len=R.static_len=0,R.last_lit=R.matches=0}function xe(R){8<R.bi_valid?le(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,B,se,ne){var q=2*B,ce=2*se;return R[q]<R[ce]||R[q]===R[ce]&&ne[B]<=ne[se]}function be(R,B,se){for(var ne=R.heap[se],q=se<<1;q<=R.heap_len&&(q<R.heap_len&&he(B,R.heap[q+1],R.heap[q],R.depth)&&q++,!he(B,ne,R.heap[q],R.depth));)R.heap[se]=R.heap[q],se=q,q<<=1;R.heap[se]=ne}function Se(R,B,se){var ne,q,ce,I,M=0;if(R.last_lit!==0)for(;ne=R.pending_buf[R.d_buf+2*M]<<8|R.pending_buf[R.d_buf+2*M+1],q=R.pending_buf[R.l_buf+M],M++,ne===0?X(R,q,B):(X(R,(ce=w[q])+f+1,B),(I=N[ce])!==0&&U(R,q-=$[ce],I),X(R,ce=H(--ne),se),(I=P[ce])!==0&&U(R,ne-=Z[ce],I)),M<R.last_lit;);X(R,k,B)}function Ie(R,B){var se,ne,q,ce=B.dyn_tree,I=B.stat_desc.static_tree,M=B.stat_desc.has_stree,Y=B.stat_desc.elems,re=-1;for(R.heap_len=0,R.heap_max=g,se=0;se<Y;se++)ce[2*se]!==0?(R.heap[++R.heap_len]=re=se,R.depth[se]=0):ce[2*se+1]=0;for(;R.heap_len<2;)ce[2*(q=R.heap[++R.heap_len]=re<2?++re:0)]=1,R.depth[q]=0,R.opt_len--,M&&(R.static_len-=I[2*q+1]);for(B.max_code=re,se=R.heap_len>>1;1<=se;se--)be(R,ce,se);for(q=Y;se=R.heap[1],R.heap[1]=R.heap[R.heap_len--],be(R,ce,1),ne=R.heap[1],R.heap[--R.heap_max]=se,R.heap[--R.heap_max]=ne,ce[2*q]=ce[2*se]+ce[2*ne],R.depth[q]=(R.depth[se]>=R.depth[ne]?R.depth[se]:R.depth[ne])+1,ce[2*se+1]=ce[2*ne+1]=q,R.heap[1]=q++,be(R,ce,1),2<=R.heap_len;);R.heap[--R.heap_max]=R.heap[1],(function(oe,ve){var pe,me,Re,$e,Bt,Rn,xt=ve.dyn_tree,it=ve.max_code,en=ve.stat_desc.static_tree,Fs=ve.stat_desc.has_stree,Be=ve.stat_desc.extra_bits,St=ve.stat_desc.extra_base,et=ve.stat_desc.max_length,Ut=0;for($e=0;$e<=x;$e++)oe.bl_count[$e]=0;for(xt[2*oe.heap[oe.heap_max]+1]=0,pe=oe.heap_max+1;pe<g;pe++)et<($e=xt[2*xt[2*(me=oe.heap[pe])+1]+1]+1)&&($e=et,Ut++),xt[2*me+1]=$e,it<me||(oe.bl_count[$e]++,Bt=0,St<=me&&(Bt=Be[me-St]),Rn=xt[2*me],oe.opt_len+=Rn*($e+Bt),Fs&&(oe.static_len+=Rn*(en[2*me+1]+Bt)));if(Ut!==0){do{for($e=et-1;oe.bl_count[$e]===0;)$e--;oe.bl_count[$e]--,oe.bl_count[$e+1]+=2,oe.bl_count[et]--,Ut-=2}while(0<Ut);for($e=et;$e!==0;$e--)for(me=oe.bl_count[$e];me!==0;)it<(Re=oe.heap[--pe])||(xt[2*Re+1]!==$e&&(oe.opt_len+=($e-xt[2*Re+1])*xt[2*Re],xt[2*Re+1]=$e),me--)}})(R,B),ae(ce,re,R.bl_count)}function _(R,B,se){var ne,q,ce=-1,I=B[1],M=0,Y=7,re=4;for(I===0&&(Y=138,re=3),B[2*(se+1)+1]=65535,ne=0;ne<=se;ne++)q=I,I=B[2*(ne+1)+1],++M<Y&&q===I||(M<re?R.bl_tree[2*q]+=M:q!==0?(q!==ce&&R.bl_tree[2*q]++,R.bl_tree[2*j]++):M<=10?R.bl_tree[2*C]++:R.bl_tree[2*T]++,ce=q,re=(M=0)===I?(Y=138,3):q===I?(Y=6,3):(Y=7,4))}function Q(R,B,se){var ne,q,ce=-1,I=B[1],M=0,Y=7,re=4;for(I===0&&(Y=138,re=3),ne=0;ne<=se;ne++)if(q=I,I=B[2*(ne+1)+1],!(++M<Y&&q===I)){if(M<re)for(;X(R,q,R.bl_tree),--M!=0;);else q!==0?(q!==ce&&(X(R,q,R.bl_tree),M--),X(R,j,R.bl_tree),U(R,M-3,2)):M<=10?(X(R,C,R.bl_tree),U(R,M-3,3)):(X(R,T,R.bl_tree),U(R,M-11,7));ce=q,re=(M=0)===I?(Y=138,3):q===I?(Y=6,3):(Y=7,4)}}c(Z);var G=!1;function O(R,B,se,ne){U(R,(u<<1)+(ne?1:0),3),(function(q,ce,I,M){xe(q),le(q,I),le(q,~I),i.arraySet(q.pending_buf,q.window,ce,I,q.pending),q.pending+=I})(R,B,se)}o._tr_init=function(R){G||((function(){var B,se,ne,q,ce,I=new Array(x+1);for(q=ne=0;q<d-1;q++)for($[q]=ne,B=0;B<1<<N[q];B++)w[ne++]=q;for(w[ne-1]=q,q=ce=0;q<16;q++)for(Z[q]=ce,B=0;B<1<<P[q];B++)L[ce++]=q;for(ce>>=7;q<m;q++)for(Z[q]=ce<<7,B=0;B<1<<P[q]-7;B++)L[256+ce++]=q;for(se=0;se<=x;se++)I[se]=0;for(B=0;B<=143;)D[2*B+1]=8,B++,I[8]++;for(;B<=255;)D[2*B+1]=9,B++,I[9]++;for(;B<=279;)D[2*B+1]=7,B++,I[7]++;for(;B<=287;)D[2*B+1]=8,B++,I[8]++;for(ae(D,h+1,I),B=0;B<m;B++)E[2*B+1]=5,E[2*B]=Ce(B,5);ee=new ue(D,N,f+1,h,x),F=new ue(E,P,0,m,x),W=new ue(new Array(0),A,0,v,y)})(),G=!0),R.l_desc=new V(R.dyn_ltree,ee),R.d_desc=new V(R.dyn_dtree,F),R.bl_desc=new V(R.bl_tree,W),R.bi_buf=0,R.bi_valid=0,ge(R)},o._tr_stored_block=O,o._tr_flush_block=function(R,B,se,ne){var q,ce,I=0;0<R.level?(R.strm.data_type===2&&(R.strm.data_type=(function(M){var Y,re=4093624447;for(Y=0;Y<=31;Y++,re>>>=1)if(1&re&&M.dyn_ltree[2*Y]!==0)return a;if(M.dyn_ltree[18]!==0||M.dyn_ltree[20]!==0||M.dyn_ltree[26]!==0)return l;for(Y=32;Y<f;Y++)if(M.dyn_ltree[2*Y]!==0)return l;return a})(R)),Ie(R,R.l_desc),Ie(R,R.d_desc),I=(function(M){var Y;for(_(M,M.dyn_ltree,M.l_desc.max_code),_(M,M.dyn_dtree,M.d_desc.max_code),Ie(M,M.bl_desc),Y=v-1;3<=Y&&M.bl_tree[2*z[Y]+1]===0;Y--);return M.opt_len+=3*(Y+1)+5+5+4,Y})(R),q=R.opt_len+3+7>>>3,(ce=R.static_len+3+7>>>3)<=q&&(q=ce)):q=ce=se+5,se+4<=q&&B!==-1?O(R,B,se,ne):R.strategy===4||ce===q?(U(R,2+(ne?1:0),3),Se(R,D,E)):(U(R,4+(ne?1:0),3),(function(M,Y,re,oe){var ve;for(U(M,Y-257,5),U(M,re-1,5),U(M,oe-4,4),ve=0;ve<oe;ve++)U(M,M.bl_tree[2*z[ve]+1],3);Q(M,M.dyn_ltree,Y-1),Q(M,M.dyn_dtree,re-1)})(R,R.l_desc.max_code+1,R.d_desc.max_code+1,I+1),Se(R,R.dyn_ltree,R.dyn_dtree)),ge(R),ne&&xe(R)},o._tr_tally=function(R,B,se){return R.pending_buf[R.d_buf+2*R.last_lit]=B>>>8&255,R.pending_buf[R.d_buf+2*R.last_lit+1]=255&B,R.pending_buf[R.l_buf+R.last_lit]=255&se,R.last_lit++,B===0?R.dyn_ltree[2*se]++:(R.matches++,B--,R.dyn_ltree[2*(w[se]+f+1)]++,R.dyn_dtree[2*H(B)]++),R.last_lit===R.lit_bufsize-1},o._tr_align=function(R){U(R,2,3),X(R,k,D),(function(B){B.bi_valid===16?(le(B,B.bi_buf),B.bi_buf=0,B.bi_valid=0):8<=B.bi_valid&&(B.pending_buf[B.pending++]=255&B.bi_buf,B.bi_buf>>=8,B.bi_valid-=8)})(R)}},{"../utils/common":41}],53:[function(n,s,o){s.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,s,o){(function(i){(function(a,l){if(!a.setImmediate){var c,u,d,f,h=1,m={},v=!1,g=a.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(a);x=x&&x.setTimeout?x:a,c={}.toString.call(a.process)==="[object process]"?function(j){process.nextTick(function(){y(j)})}:(function(){if(a.postMessage&&!a.importScripts){var j=!0,C=a.onmessage;return a.onmessage=function(){j=!1},a.postMessage("","*"),a.onmessage=C,j}})()?(f="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",k,!1):a.attachEvent("onmessage",k),function(j){a.postMessage(f+j,"*")}):a.MessageChannel?((d=new MessageChannel).port1.onmessage=function(j){y(j.data)},function(j){d.port2.postMessage(j)}):g&&"onreadystatechange"in g.createElement("script")?(u=g.documentElement,function(j){var C=g.createElement("script");C.onreadystatechange=function(){y(j),C.onreadystatechange=null,u.removeChild(C),C=null},u.appendChild(C)}):function(j){setTimeout(y,0,j)},x.setImmediate=function(j){typeof j!="function"&&(j=new Function(""+j));for(var C=new Array(arguments.length-1),T=0;T<C.length;T++)C[T]=arguments[T+1];var N={callback:j,args:C};return m[h]=N,c(h),h++},x.clearImmediate=b}function b(j){delete m[j]}function y(j){if(v)setTimeout(y,0,j);else{var C=m[j];if(C){v=!0;try{(function(T){var N=T.callback,P=T.args;switch(P.length){case 0:N();break;case 1:N(P[0]);break;case 2:N(P[0],P[1]);break;case 3:N(P[0],P[1],P[2]);break;default:N.apply(l,P)}})(C)}finally{b(j),v=!1}}}}function k(j){j.source===a&&typeof j.data=="string"&&j.data.indexOf(f)===0&&y(+j.data.slice(f.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof kr<"u"?kr:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(ji)),ji.exports}var O_=P_();const M_=ig(O_),L_="3.0.17",ha={version:L_},sp="[REDACTED]",D_=/(^|[-_])(api[-_]?key|authorization|cookie|token|secret|password|access[-_]?token|refresh[-_]?token)([-_]|$)/i,$_=[/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],Gc=200,F_=25e6,rp=50,B_=1e4;function U_(e){return e<1024?`${e} chars`:e<1024*1024?`${Math.ceil(e/1024)} KB`:`${Math.ceil(e/(1024*1024))} MB`}function W_(e){let t=0;for(const n of e)t+=n.rawRequestBody?.length??0,t+=n.responseText?.length??0;return t}function H_(e){if(e.length>Gc)return`Export is limited to ${Gc} logs at once. Narrow the filter and try again.`;const t=W_(e);return t>F_?`Export is too large (${U_(t)} of text). Narrow the filter and try again.`:null}function Er(e){return e?.aborted===!0?{ok:!1,message:"Export canceled.",canceled:!0}:null}async function V_(e,t){try{const n=await Dn(`/api/logs/${e}/chunks`,B_,{signal:t});if(!n.ok)return null;const s=await n.json();return JSON.stringify(s,null,2)}catch{return null}}function q_(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ma(e){if(Array.isArray(e))return e.map(n=>ma(n));if(!q_(e))return e;const t={};for(const[n,s]of Object.entries(e))t[n]=D_.test(n)?sp:ma(s);return t}function Z_(e){const t=n=>{let s=n;for(const o of $_)s=s.replace(o,sp);return s};try{const n=JSON.parse(e);return t(JSON.stringify(ma(n),null,2))}catch{return t(e)}}function Si(e,t){return t==="redacted"?Z_(e):e}function G_(e,t){return{...e,rawRequestBody:null,responseText:null,rawHeaders:t==="raw"?e.rawHeaders:void 0,headers:t==="raw"?e.headers:void 0,streamingChunks:void 0,bodyContentMode:"compact"}}function K_(e,t,n,s=new Date().toISOString()){return{version:ha.version,exportedAt:s,mode:t,redacted:t==="redacted",logCount:e.length,logIds:e.map(o=>o.id),streamingChunkExportLimit:rp,streamingChunkLogIds:n.map(o=>o.id)}}async function J_(e,t="redacted",n={}){const s=Er(n.signal);if(s!==null)return s;const o=H_(e);if(o!==null)return{ok:!1,message:o};const i=new M_,a=t==="redacted"?"redacted":"raw",l=e.filter(h=>h.streaming).slice(0,rp);i.file("manifest.json",JSON.stringify(K_(e,t,l),null,2)),i.file("logs.json",JSON.stringify(e.map(h=>G_(h,t)),null,2));for(const h of e){const m=Er(n.signal);if(m!==null)return m;h.rawRequestBody!==null&&i.file(`#${h.id}.Request.json`,Si(h.rawRequestBody,t)),h.responseText!==null&&i.file(`#${h.id}.Response.json`,Si(h.responseText,t))}for(const h of l){const m=Er(n.signal);if(m!==null)return m;const v=await V_(h.id,n.signal);v!==null&&i.file(`#${h.id}.SSE.Response.json`,Si(v,t))}const c=await i.generateAsync({type:"blob"}),u=Er(n.signal);if(u!==null)return u;const d=URL.createObjectURL(c),f=document.createElement("a");return f.href=d,f.download=`agent-inspector-export-${a}-${new Date().toISOString().slice(0,10)}.zip`,document.body.appendChild(f),f.click(),document.body.removeChild(f),URL.revokeObjectURL(d),{ok:!0}}function Y_(e,t){if(e!==null){e.removeAllRanges();for(const n of t)e.addRange(n)}}function X_(e){if(e===null)return[];const t=[];for(let n=0;n<e.rangeCount;n++)t.push(e.getRangeAt(n));return t}function Q_(e){if(typeof document>"u")return!1;const t=document.activeElement,n=document.getSelection(),s=X_(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 i=!1;try{i=document.execCommand("copy")}catch{}finally{document.body.removeChild(o),Y_(n,s),typeof HTMLElement<"u"&&t instanceof HTMLElement&&t.focus({preventScroll:!0})}return i}async function Tt(e){const t=globalThis.navigator?.clipboard;if(t!==void 0)try{return await t.writeText(e),!0}catch{}return Q_(e)}function ga(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 Tl(e,t,n){return`${ga(e,n)} - ${ga(t,n)}`}function Ar(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function e5(e){switch(e){case"end_turn":case"tool_use":return e;case"max_tokens":return"length";default:return null}}function t5(e){switch(e){case"stop":case"length":return e;case"max_tokens":return"length";default:return null}}function n5(e){switch(e){case"max_output_tokens":case"max_tokens":return!0;default:return!1}}function op(e){if(e.responseText===null)return null;try{let t=JSON.parse(e.responseText);if(typeof t=="string"&&(t=JSON.parse(t)),!Ar(t))return null;if(typeof t.stop_reason=="string")return e5(t.stop_reason);if(Array.isArray(t.choices))for(const n of t.choices){if(!Ar(n)||typeof n.finish_reason!="string")continue;const s=t5(n.finish_reason);if(s!==null)return s}if(Array.isArray(t.output)){for(const n of t.output)if(Ar(n)&&n.type==="function_call")return"tool_use";if(t.status==="completed")return"stop"}if(t.status==="incomplete"&&Ar(t.incomplete_details)){const n=t.incomplete_details.reason;if(typeof n=="string"&&n5(n))return"length"}return null}catch{return null}}function El(e){return e==="end_turn"||e==="stop"||e==="length"}function ip(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=ip(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}function ap(){for(var e,t,n=0,s="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=ip(e))&&(s&&(s+=" "),s+=t);return s}const s5=(e,t)=>{const n=new Array(e.length+t.length);for(let s=0;s<e.length;s++)n[s]=e[s];for(let s=0;s<t.length;s++)n[e.length+s]=t[s];return n},r5=(e,t)=>({classGroupId:e,validator:t}),lp=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),vo="-",Kc=[],o5="arbitrary..",i5=e=>{const t=l5(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return a5(a);const l=a.split(vo),c=l[0]===""&&l.length>1?1:0;return cp(l,c,t)},getConflictingClassGroupIds:(a,l)=>{if(l){const c=s[a],u=n[a];return c?u?s5(u,c):c:u||Kc}return n[a]||Kc}}},cp=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],i=n.nextPart.get(o);if(i){const u=cp(e,t+1,i);if(u)return u}const a=n.validators;if(a===null)return;const l=t===0?e.join(vo):e.slice(t).join(vo),c=a.length;for(let u=0;u<c;u++){const d=a[u];if(d.validator(l))return d.classGroupId}},a5=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),s=t.slice(0,n);return s?o5+s:void 0})(),l5=e=>{const{theme:t,classGroups:n}=e;return c5(n,t)},c5=(e,t)=>{const n=lp();for(const s in e){const o=e[s];Al(o,n,s,t)}return n},Al=(e,t,n,s)=>{const o=e.length;for(let i=0;i<o;i++){const a=e[i];u5(a,t,n,s)}},u5=(e,t,n,s)=>{if(typeof e=="string"){d5(e,t,n);return}if(typeof e=="function"){f5(e,t,n,s);return}p5(e,t,n,s)},d5=(e,t,n)=>{const s=e===""?t:up(t,e);s.classGroupId=n},f5=(e,t,n,s)=>{if(h5(e)){Al(e(s),t,n,s);return}t.validators===null&&(t.validators=[]),t.validators.push(r5(n,e))},p5=(e,t,n,s)=>{const o=Object.entries(e),i=o.length;for(let a=0;a<i;a++){const[l,c]=o[a];Al(c,up(t,l),n,s)}},up=(e,t)=>{let n=e;const s=t.split(vo),o=s.length;for(let i=0;i<o;i++){const a=s[i];let l=n.nextPart.get(a);l||(l=lp(),n.nextPart.set(a,l)),n=l}return n},h5=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,m5=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),s=Object.create(null);const o=(i,a)=>{n[i]=a,t++,t>e&&(t=0,s=n,n=Object.create(null))};return{get(i){let a=n[i];if(a!==void 0)return a;if((a=s[i])!==void 0)return o(i,a),a},set(i,a){i in n?n[i]=a:o(i,a)}}},xa="!",Jc=":",g5=[],Yc=(e,t,n,s,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:s,isExternal:o}),x5=e=>{const{prefix:t,experimentalParseClassName:n}=e;let s=o=>{const i=[];let a=0,l=0,c=0,u;const d=o.length;for(let g=0;g<d;g++){const x=o[g];if(a===0&&l===0){if(x===Jc){i.push(o.slice(c,g)),c=g+1;continue}if(x==="/"){u=g;continue}}x==="["?a++:x==="]"?a--:x==="("?l++:x===")"&&l--}const f=i.length===0?o:o.slice(c);let h=f,m=!1;f.endsWith(xa)?(h=f.slice(0,-1),m=!0):f.startsWith(xa)&&(h=f.slice(1),m=!0);const v=u&&u>c?u-c:void 0;return Yc(i,m,h,v)};if(t){const o=t+Jc,i=s;s=a=>a.startsWith(o)?i(a.slice(o.length)):Yc(g5,!1,a,void 0,!0)}if(n){const o=s;s=i=>n({className:i,parseClassName:o})}return s},b5=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,s)=>{t.set(n,1e6+s)}),n=>{const s=[];let o=[];for(let i=0;i<n.length;i++){const a=n[i],l=a[0]==="[",c=t.has(a);l||c?(o.length>0&&(o.sort(),s.push(...o),o=[]),s.push(a)):o.push(a)}return o.length>0&&(o.sort(),s.push(...o)),s}},v5=e=>({cache:m5(e.cacheSize),parseClassName:x5(e),sortModifiers:b5(e),...i5(e)}),y5=/\s+/,w5=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:o,sortModifiers:i}=t,a=[],l=e.trim().split(y5);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:f,modifiers:h,hasImportantModifier:m,baseClassName:v,maybePostfixModifierPosition:g}=n(d);if(f){c=d+(c.length>0?" "+c:c);continue}let x=!!g,b=s(x?v.substring(0,g):v);if(!b){if(!x){c=d+(c.length>0?" "+c:c);continue}if(b=s(v),!b){c=d+(c.length>0?" "+c:c);continue}x=!1}const y=h.length===0?"":h.length===1?h[0]:i(h).join(":"),k=m?y+xa:y,j=k+b;if(a.indexOf(j)>-1)continue;a.push(j);const C=o(b,x);for(let T=0;T<C.length;++T){const N=C[T];a.push(k+N)}c=d+(c.length>0?" "+c:c)}return c},_5=(...e)=>{let t=0,n,s,o="";for(;t<e.length;)(n=e[t++])&&(s=dp(n))&&(o&&(o+=" "),o+=s);return o},dp=e=>{if(typeof e=="string")return e;let t,n="";for(let s=0;s<e.length;s++)e[s]&&(t=dp(e[s]))&&(n&&(n+=" "),n+=t);return n},k5=(e,...t)=>{let n,s,o,i;const a=c=>{const u=t.reduce((d,f)=>f(d),e());return n=v5(u),s=n.cache.get,o=n.cache.set,i=l,l(c)},l=c=>{const u=s(c);if(u)return u;const d=w5(c,n);return o(c,d),d};return i=a,(...c)=>i(_5(...c))},j5=[],Qe=e=>{const t=n=>n[e]||j5;return t.isThemeGetter=!0,t},fp=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,pp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,S5=/^\d+\/\d+$/,C5=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,N5=/\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$/,T5=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,E5=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,A5=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,es=e=>S5.test(e),Pe=e=>!!e&&!Number.isNaN(Number(e)),un=e=>!!e&&Number.isInteger(Number(e)),Ci=e=>e.endsWith("%")&&Pe(e.slice(0,-1)),tn=e=>C5.test(e),R5=()=>!0,I5=e=>N5.test(e)&&!T5.test(e),hp=()=>!1,z5=e=>E5.test(e),P5=e=>A5.test(e),O5=e=>!ye(e)&&!we(e),M5=e=>Os(e,xp,hp),ye=e=>fp.test(e),In=e=>Os(e,bp,I5),Ni=e=>Os(e,B5,Pe),Xc=e=>Os(e,mp,hp),L5=e=>Os(e,gp,P5),Rr=e=>Os(e,vp,z5),we=e=>pp.test(e),Bs=e=>Ms(e,bp),D5=e=>Ms(e,U5),Qc=e=>Ms(e,mp),$5=e=>Ms(e,xp),F5=e=>Ms(e,gp),Ir=e=>Ms(e,vp,!0),Os=(e,t,n)=>{const s=fp.exec(e);return s?s[1]?t(s[1]):n(s[2]):!1},Ms=(e,t,n=!1)=>{const s=pp.exec(e);return s?s[1]?t(s[1]):n:!1},mp=e=>e==="position"||e==="percentage",gp=e=>e==="image"||e==="url",xp=e=>e==="length"||e==="size"||e==="bg-size",bp=e=>e==="length",B5=e=>e==="number",U5=e=>e==="family-name",vp=e=>e==="shadow",W5=()=>{const e=Qe("color"),t=Qe("font"),n=Qe("text"),s=Qe("font-weight"),o=Qe("tracking"),i=Qe("leading"),a=Qe("breakpoint"),l=Qe("container"),c=Qe("spacing"),u=Qe("radius"),d=Qe("shadow"),f=Qe("inset-shadow"),h=Qe("text-shadow"),m=Qe("drop-shadow"),v=Qe("blur"),g=Qe("perspective"),x=Qe("aspect"),b=Qe("ease"),y=Qe("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],j=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...j(),we,ye],T=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],P=()=>[we,ye,c],A=()=>[es,"full","auto",...P()],z=()=>[un,"none","subgrid",we,ye],D=()=>["auto",{span:["full",un,we,ye]},un,we,ye],E=()=>[un,"auto",we,ye],L=()=>["auto","min","max","fr",we,ye],w=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],$=()=>["start","end","center","stretch","center-safe","end-safe"],ee=()=>["auto",...P()],F=()=>[es,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...P()],W=()=>[e,we,ye],Z=()=>[...j(),Qc,Xc,{position:[we,ye]}],ue=()=>["no-repeat",{repeat:["","x","y","space","round"]}],V=()=>["auto","cover","contain",$5,M5,{size:[we,ye]}],H=()=>[Ci,Bs,In],le=()=>["","none","full",u,we,ye],U=()=>["",Pe,Bs,In],X=()=>["solid","dashed","dotted","double"],Ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[Pe,Ci,Qc,Xc],ge=()=>["","none",v,we,ye],xe=()=>["none",Pe,we,ye],he=()=>["none",Pe,we,ye],be=()=>[Pe,we,ye],Se=()=>[es,"full",...P()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[tn],breakpoint:[tn],color:[R5],container:[tn],"drop-shadow":[tn],ease:["in","out","in-out"],font:[O5],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[tn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[tn],shadow:[tn],spacing:["px",Pe],text:[tn],"text-shadow":[tn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",es,ye,we,x]}],container:["container"],columns:[{columns:[Pe,ye,we,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"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:C()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{start:A()}],end:[{end:A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[un,"auto",we,ye]}],basis:[{basis:[es,"full","auto",l,...P()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Pe,es,"auto","initial","none",ye]}],grow:[{grow:["",Pe,we,ye]}],shrink:[{shrink:["",Pe,we,ye]}],order:[{order:[un,"first","last","none",we,ye]}],"grid-cols":[{"grid-cols":z()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":z()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":L()}],"auto-rows":[{"auto-rows":L()}],gap:[{gap:P()}],"gap-x":[{"gap-x":P()}],"gap-y":[{"gap-y":P()}],"justify-content":[{justify:[...w(),"normal"]}],"justify-items":[{"justify-items":[...$(),"normal"]}],"justify-self":[{"justify-self":["auto",...$()]}],"align-content":[{content:["normal",...w()]}],"align-items":[{items:[...$(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...$(),{baseline:["","last"]}]}],"place-content":[{"place-content":w()}],"place-items":[{"place-items":[...$(),"baseline"]}],"place-self":[{"place-self":["auto",...$()]}],p:[{p:P()}],px:[{px:P()}],py:[{py:P()}],ps:[{ps:P()}],pe:[{pe:P()}],pt:[{pt:P()}],pr:[{pr:P()}],pb:[{pb:P()}],pl:[{pl:P()}],m:[{m:ee()}],mx:[{mx:ee()}],my:[{my:ee()}],ms:[{ms:ee()}],me:[{me:ee()}],mt:[{mt:ee()}],mr:[{mr:ee()}],mb:[{mb:ee()}],ml:[{ml:ee()}],"space-x":[{"space-x":P()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":P()}],"space-y-reverse":["space-y-reverse"],size:[{size:F()}],w:[{w:[l,"screen",...F()]}],"min-w":[{"min-w":[l,"screen","none",...F()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[a]},...F()]}],h:[{h:["screen","lh",...F()]}],"min-h":[{"min-h":["screen","lh","none",...F()]}],"max-h":[{"max-h":["screen","lh",...F()]}],"font-size":[{text:["base",n,Bs,In]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,we,Ni]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ci,ye]}],"font-family":[{font:[D5,ye,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,we,ye]}],"line-clamp":[{"line-clamp":[Pe,"none",we,Ni]}],leading:[{leading:[i,...P()]}],"list-image":[{"list-image":["none",we,ye]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",we,ye]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...X(),"wavy"]}],"text-decoration-thickness":[{decoration:[Pe,"from-font","auto",we,In]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[Pe,"auto",we,ye]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",we,ye]}],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",we,ye]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Z()}],"bg-repeat":[{bg:ue()}],"bg-size":[{bg:V()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},un,we,ye],radial:["",we,ye],conic:[un,we,ye]},F5,L5]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:H()}],"gradient-via-pos":[{via:H()}],"gradient-to-pos":[{to:H()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:le()}],"rounded-s":[{"rounded-s":le()}],"rounded-e":[{"rounded-e":le()}],"rounded-t":[{"rounded-t":le()}],"rounded-r":[{"rounded-r":le()}],"rounded-b":[{"rounded-b":le()}],"rounded-l":[{"rounded-l":le()}],"rounded-ss":[{"rounded-ss":le()}],"rounded-se":[{"rounded-se":le()}],"rounded-ee":[{"rounded-ee":le()}],"rounded-es":[{"rounded-es":le()}],"rounded-tl":[{"rounded-tl":le()}],"rounded-tr":[{"rounded-tr":le()}],"rounded-br":[{"rounded-br":le()}],"rounded-bl":[{"rounded-bl":le()}],"border-w":[{border:U()}],"border-w-x":[{"border-x":U()}],"border-w-y":[{"border-y":U()}],"border-w-s":[{"border-s":U()}],"border-w-e":[{"border-e":U()}],"border-w-t":[{"border-t":U()}],"border-w-r":[{"border-r":U()}],"border-w-b":[{"border-b":U()}],"border-w-l":[{"border-l":U()}],"divide-x":[{"divide-x":U()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":U()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...X(),"hidden","none"]}],"divide-style":[{divide:[...X(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...X(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Pe,we,ye]}],"outline-w":[{outline:["",Pe,Bs,In]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",d,Ir,Rr]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",f,Ir,Rr]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[Pe,In]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":U()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",h,Ir,Rr]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[Pe,we,ye]}],"mix-blend":[{"mix-blend":[...Ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ce()}],"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":[Pe]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[we,ye]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"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":j()}],"mask-image-conic-pos":[{"mask-conic":[Pe]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Z()}],"mask-repeat":[{mask:ue()}],"mask-size":[{mask:V()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",we,ye]}],filter:[{filter:["","none",we,ye]}],blur:[{blur:ge()}],brightness:[{brightness:[Pe,we,ye]}],contrast:[{contrast:[Pe,we,ye]}],"drop-shadow":[{"drop-shadow":["","none",m,Ir,Rr]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",Pe,we,ye]}],"hue-rotate":[{"hue-rotate":[Pe,we,ye]}],invert:[{invert:["",Pe,we,ye]}],saturate:[{saturate:[Pe,we,ye]}],sepia:[{sepia:["",Pe,we,ye]}],"backdrop-filter":[{"backdrop-filter":["","none",we,ye]}],"backdrop-blur":[{"backdrop-blur":ge()}],"backdrop-brightness":[{"backdrop-brightness":[Pe,we,ye]}],"backdrop-contrast":[{"backdrop-contrast":[Pe,we,ye]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Pe,we,ye]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Pe,we,ye]}],"backdrop-invert":[{"backdrop-invert":["",Pe,we,ye]}],"backdrop-opacity":[{"backdrop-opacity":[Pe,we,ye]}],"backdrop-saturate":[{"backdrop-saturate":[Pe,we,ye]}],"backdrop-sepia":[{"backdrop-sepia":["",Pe,we,ye]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":P()}],"border-spacing-x":[{"border-spacing-x":P()}],"border-spacing-y":[{"border-spacing-y":P()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",we,ye]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Pe,"initial",we,ye]}],ease:[{ease:["linear","initial",b,we,ye]}],delay:[{delay:[Pe,we,ye]}],animate:[{animate:["none",y,we,ye]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,we,ye]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:xe()}],"rotate-x":[{"rotate-x":xe()}],"rotate-y":[{"rotate-y":xe()}],"rotate-z":[{"rotate-z":xe()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":["scale-3d"],skew:[{skew:be()}],"skew-x":[{"skew-x":be()}],"skew-y":[{"skew-y":be()}],transform:[{transform:[we,ye,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Se()}],"translate-x":[{"translate-x":Se()}],"translate-y":[{"translate-y":Se()}],"translate-z":[{"translate-z":Se()}],"translate-none":["translate-none"],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"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",we,ye]}],"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":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"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",we,ye]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[Pe,Bs,In,Ni]}],stroke:[{stroke:["none",...W()]}],"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"]}},H5=k5(W5);function ie(...e){return H5(ap(e))}function Fe(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":(e/1e3).toFixed(1).replace(/\.0$/,"")+"K"}function yp(e){return e>=1024*1024?(e/(1024*1024)).toFixed(1).replace(/\.0$/,"")+"M":(e/1024).toFixed(1).replace(/\.0$/,"")+"K"}function eu(e,t,n){const s=e*10;return!Number.isSafeInteger(s)||s%t!==0?null:(s/t/10).toFixed(1).replace(/\.0$/,"")+n}function V5(e){if(!Number.isSafeInteger(e)||e<=0)return e.toString();if(e>=1024*1024){const n=eu(e,1048576,"M");if(n!==null)return n}const t=eu(e,1024,"K");return t!==null?t:e.toString()}function q5(e){if(e===void 0||e==="")return 1;switch(e.toLowerCase()){case"k":return 1024;case"m":return 1024*1024;default:return null}}function yo(e){const t=e.trim().replaceAll(",","");if(t==="")return null;const n=/^(\d+(?:\.\d+)?)\s*([kKmM])?$/.exec(t);if(n===null)return null;const s=n[1];if(s===void 0)return null;const o=Number(s),i=n[2],a=q5(i);if(!Number.isFinite(o)||o<=0||a===null||(i===void 0||i==="")&&!Number.isInteger(o))return null;const l=Math.round(o*a);return!Number.isSafeInteger(l)||l<=0?null:l}function Z5(e){return e===null?"pending":e>=200&&e<300?"success":e>=400&&e<500?"client_error":e>=500?"server_error":"pending"}const G5=J({model:S().min(1),contextWindow:K().int().positive().optional(),outputLimit:K().int().positive().optional(),source:Ee(["manual","registry"]).optional(),sourceUrl:S().optional(),updatedAt:S().optional()}),wo=J({id:S(),name:S(),apiKey:S(),model:S().optional(),models:fe(S()).min(1),format:Ee(["anthropic","openai"]).optional(),baseUrl:S().optional(),anthropicBaseUrl:S().optional(),openaiBaseUrl:S().optional(),openaiResponsesBaseUrl:S().optional(),authHeader:Ee(["bearer","x-api-key"]).optional().default("bearer"),apiDocsUrl:S().optional(),modelMetadataUrl:S().optional(),modelMetadata:fe(G5).optional(),source:Ee(["company","personal"]).optional(),createdAt:S(),updatedAt:S()});async function K5(e){return ht(e,wo.array(),void 0,t=>`Failed to fetch ${e}: ${t.status}`)}function Rl(){const e=qt("/api/providers?includeSecrets=1",K5,{revalidateOnFocus:!1,revalidateIfStale:!1});return{providers:e.data??[],isLoading:e.isLoading,isError:e.error,mutate:e.mutate}}function Te(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}function tu(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function wp(...e){return t=>{let n=!1;const s=e.map(o=>{const i=tu(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<s.length;o++){const i=s[o];typeof i=="function"?i():tu(e[o],null)}}}}function De(...e){return p.useCallback(wp(...e),e)}function J5(e,t){const n=p.createContext(t),s=i=>{const{children:a,...l}=i,c=p.useMemo(()=>l,Object.values(l));return r.jsx(n.Provider,{value:c,children:a})};s.displayName=e+"Provider";function o(i){const a=p.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[s,o]}function cn(e,t=[]){let n=[];function s(i,a){const l=p.createContext(a),c=n.length;n=[...n,a];const u=f=>{const{scope:h,children:m,...v}=f,g=h?.[e]?.[c]||l,x=p.useMemo(()=>v,Object.values(v));return r.jsx(g.Provider,{value:x,children:m})};u.displayName=i+"Provider";function d(f,h){const m=h?.[e]?.[c]||l,v=p.useContext(m);if(v)return v;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[u,d]}const o=()=>{const i=n.map(a=>p.createContext(a));return function(l){const c=l?.[e]||i;return p.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[s,Y5(o,...t)]}function Y5(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const a=s.reduce((l,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...l,...f}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}var tt=globalThis?.document?p.useLayoutEffect:()=>{},X5=Bd[" useId ".trim().toString()]||(()=>{}),Q5=0;function Zt(e){const[t,n]=p.useState(X5());return tt(()=>{n(s=>s??String(Q5++))},[e]),e||(t?`radix-${t}`:"")}var ek=Bd[" useInsertionEffect ".trim().toString()]||tt;function Fn({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[o,i,a]=tk({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:o;{const d=p.useRef(e!==void 0);p.useEffect(()=>{const f=d.current;f!==l&&console.warn(`${s} 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,s])}const u=p.useCallback(d=>{if(l){const f=nk(d)?d(e):d;f!==e&&a.current?.(f)}else i(d)},[l,e,i,a]);return[c,u]}function tk({defaultProp:e,onChange:t}){const[n,s]=p.useState(e),o=p.useRef(n),i=p.useRef(t);return ek(()=>{i.current=t},[t]),p.useEffect(()=>{o.current!==n&&(i.current?.(n),o.current=n)},[n,o]),[n,s,i]}function nk(e){return typeof e=="function"}function ks(e){const t=rk(e),n=p.forwardRef((s,o)=>{const{children:i,...a}=s,l=p.Children.toArray(i),c=l.find(ik);if(c){const u=c.props.children,d=l.map(f=>f===c?p.Children.count(u)>1?p.Children.only(null):p.isValidElement(u)?u.props.children:null:f);return r.jsx(t,{...a,ref:o,children:p.isValidElement(u)?p.cloneElement(u,void 0,d):null})}return r.jsx(t,{...a,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}var sk=ks("Slot");function rk(e){const t=p.forwardRef((n,s)=>{const{children:o,...i}=n;if(p.isValidElement(o)){const a=lk(o),l=ak(i,o.props);return o.type!==p.Fragment&&(l.ref=s?wp(s,a):a),p.cloneElement(o,l)}return p.Children.count(o)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var _p=Symbol("radix.slottable");function ok(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=_p,t}function ik(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===_p}function ak(e,t){const n={...t};for(const s in t){const o=e[s],i=t[s];/^on[A-Z]/.test(s)?o&&i?n[s]=(...l)=>{const c=i(...l);return o(...l),c}:o&&(n[s]=o):s==="style"?n[s]={...o,...i}:s==="className"&&(n[s]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function lk(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 ck=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ze=ck.reduce((e,t)=>{const n=ks(`Primitive.${t}`),s=p.forwardRef((o,i)=>{const{asChild:a,...l}=o,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(c,{...l,ref:i})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function uk(e,t){e&&pr.flushSync(()=>e.dispatchEvent(t))}function pt(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>t.current?.(...n),[])}function dk(e,t=globalThis?.document){const n=pt(e);p.useEffect(()=>{const s=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var fk="DismissableLayer",ba="dismissableLayer.update",pk="dismissableLayer.pointerDownOutside",hk="dismissableLayer.focusOutside",nu,kp=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Go=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:l,...c}=e,u=p.useContext(kp),[d,f]=p.useState(null),h=d?.ownerDocument??globalThis?.document,[,m]=p.useState({}),v=De(t,N=>f(N)),g=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=g.indexOf(x),y=d?g.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,j=y>=b,C=xk(N=>{const P=N.target,A=[...u.branches].some(z=>z.contains(P));!j||A||(o?.(N),a?.(N),N.defaultPrevented||l?.())},h),T=bk(N=>{const P=N.target;[...u.branches].some(z=>z.contains(P))||(i?.(N),a?.(N),N.defaultPrevented||l?.())},h);return dk(N=>{y===u.layers.size-1&&(s?.(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},h),p.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(nu=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),su(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=nu)}},[d,h,n,u]),p.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),su())},[d,u]),p.useEffect(()=>{const N=()=>m({});return document.addEventListener(ba,N),()=>document.removeEventListener(ba,N)},[]),r.jsx(ze.div,{...c,ref:v,style:{pointerEvents:k?j?"auto":"none":void 0,...e.style},onFocusCapture:Te(e.onFocusCapture,T.onFocusCapture),onBlurCapture:Te(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:Te(e.onPointerDownCapture,C.onPointerDownCapture)})});Go.displayName=fk;var mk="DismissableLayerBranch",gk=p.forwardRef((e,t)=>{const n=p.useContext(kp),s=p.useRef(null),o=De(t,s);return p.useEffect(()=>{const i=s.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),r.jsx(ze.div,{...e,ref:o})});gk.displayName=mk;function xk(e,t=globalThis?.document){const n=pt(e),s=p.useRef(!1),o=p.useRef(()=>{});return p.useEffect(()=>{const i=l=>{if(l.target&&!s.current){let c=function(){jp(pk,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);s.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function bk(e,t=globalThis?.document){const n=pt(e),s=p.useRef(!1);return p.useEffect(()=>{const o=i=>{i.target&&!s.current&&jp(hk,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function su(){const e=new CustomEvent(ba);document.dispatchEvent(e)}function jp(e,t,n,{discrete:s}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),s?uk(o,i):o.dispatchEvent(i)}var Ti="focusScope.autoFocusOnMount",Ei="focusScope.autoFocusOnUnmount",ru={bubbles:!1,cancelable:!0},vk="FocusScope",Il=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=e,[l,c]=p.useState(null),u=pt(o),d=pt(i),f=p.useRef(null),h=De(t,g=>c(g)),m=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(s){let g=function(k){if(m.paused||!l)return;const j=k.target;l.contains(j)?f.current=j:mn(f.current,{select:!0})},x=function(k){if(m.paused||!l)return;const j=k.relatedTarget;j!==null&&(l.contains(j)||mn(f.current,{select:!0}))},b=function(k){if(document.activeElement===document.body)for(const C of k)C.removedNodes.length>0&&mn(l)};document.addEventListener("focusin",g),document.addEventListener("focusout",x);const y=new MutationObserver(b);return l&&y.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",x),y.disconnect()}}},[s,l,m.paused]),p.useEffect(()=>{if(l){iu.add(m);const g=document.activeElement;if(!l.contains(g)){const b=new CustomEvent(Ti,ru);l.addEventListener(Ti,u),l.dispatchEvent(b),b.defaultPrevented||(yk(Sk(Sp(l)),{select:!0}),document.activeElement===g&&mn(l))}return()=>{l.removeEventListener(Ti,u),setTimeout(()=>{const b=new CustomEvent(Ei,ru);l.addEventListener(Ei,d),l.dispatchEvent(b),b.defaultPrevented||mn(g??document.body,{select:!0}),l.removeEventListener(Ei,d),iu.remove(m)},0)}}},[l,u,d,m]);const v=p.useCallback(g=>{if(!n&&!s||m.paused)return;const x=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,b=document.activeElement;if(x&&b){const y=g.currentTarget,[k,j]=wk(y);k&&j?!g.shiftKey&&b===j?(g.preventDefault(),n&&mn(k,{select:!0})):g.shiftKey&&b===k&&(g.preventDefault(),n&&mn(j,{select:!0})):b===y&&g.preventDefault()}},[n,s,m.paused]);return r.jsx(ze.div,{tabIndex:-1,...a,ref:h,onKeyDown:v})});Il.displayName=vk;function yk(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(mn(s,{select:t}),document.activeElement!==n)return}function wk(e){const t=Sp(e),n=ou(t,e),s=ou(t.reverse(),e);return[n,s]}function Sp(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const o=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||o?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ou(e,t){for(const n of e)if(!_k(n,{upTo:t}))return n}function _k(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 kk(e){return e instanceof HTMLInputElement&&"select"in e}function mn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&kk(e)&&t&&e.select()}}var iu=jk();function jk(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=au(e,t),e.unshift(t)},remove(t){e=au(e,t),e[0]?.resume()}}}function au(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function Sk(e){return e.filter(t=>t.tagName!=="A")}var Ck="Portal",Ko=p.forwardRef((e,t)=>{const{container:n,...s}=e,[o,i]=p.useState(!1);tt(()=>i(!0),[]);const a=n||o&&globalThis?.document?.body;return a?ag.createPortal(r.jsx(ze.div,{...s,ref:t}),a):null});Ko.displayName=Ck;function Nk(e,t){return p.useReducer((n,s)=>t[n][s]??n,e)}var It=e=>{const{present:t,children:n}=e,s=Tk(t),o=typeof n=="function"?n({present:s.isPresent}):p.Children.only(n),i=De(s.ref,Ek(o));return typeof n=="function"||s.isPresent?p.cloneElement(o,{ref:i}):null};It.displayName="Presence";function Tk(e){const[t,n]=p.useState(),s=p.useRef(null),o=p.useRef(e),i=p.useRef("none"),a=e?"mounted":"unmounted",[l,c]=Nk(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const u=zr(s.current);i.current=l==="mounted"?u:"none"},[l]),tt(()=>{const u=s.current,d=o.current;if(d!==e){const h=i.current,m=zr(u);e?c("MOUNT"):m==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&h!==m?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),tt(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=m=>{const g=zr(s.current).includes(CSS.escape(m.animationName));if(m.target===t&&g&&(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=m=>{m.target===t&&(i.current=zr(s.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:p.useCallback(u=>{s.current=u?getComputedStyle(u):null,n(u)},[])}}function zr(e){return e?.animationName||"none"}function Ek(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 Ai=0;function Cp(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??lu()),document.body.insertAdjacentElement("beforeend",e[1]??lu()),Ai++,()=>{Ai===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ai--}},[])}function lu(){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 Ht=function(){return Ht=Object.assign||function(t){for(var n,s=1,o=arguments.length;s<o;s++){n=arguments[s];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Ht.apply(this,arguments)};function Np(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,s=Object.getOwnPropertySymbols(e);o<s.length;o++)t.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(e,s[o])&&(n[s[o]]=e[s[o]]);return n}function Ak(e,t,n){if(n||arguments.length===2)for(var s=0,o=t.length,i;s<o;s++)(i||!(s in t))&&(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))}var no="right-scroll-bar-position",so="width-before-scroll-bar",Rk="with-scroll-bars-hidden",Ik="--removed-body-scroll-bar-size";function Ri(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function zk(e,t){var n=p.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var o=n.value;o!==s&&(n.value=s,n.callback(s,o))}}}})[0];return n.callback=t,n.facade}var Pk=typeof window<"u"?p.useLayoutEffect:p.useEffect,cu=new WeakMap;function Ok(e,t){var n=zk(null,function(s){return e.forEach(function(o){return Ri(o,s)})});return Pk(function(){var s=cu.get(n);if(s){var o=new Set(s),i=new Set(e),a=n.current;o.forEach(function(l){i.has(l)||Ri(l,null)}),i.forEach(function(l){o.has(l)||Ri(l,a)})}cu.set(n,e)},[e]),n}function Mk(e){return e}function Lk(e,t){t===void 0&&(t=Mk);var n=[],s=!1,o={read:function(){if(s)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(i){var a=t(i,s);return n.push(a),function(){n=n.filter(function(l){return l!==a})}},assignSyncMedium:function(i){for(s=!0;n.length;){var a=n;n=[],a.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){s=!0;var a=[];if(n.length){var l=n;n=[],l.forEach(i),a=n}var c=function(){var d=a;a=[],d.forEach(i)},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 Dk(e){e===void 0&&(e={});var t=Lk(null);return t.options=Ht({async:!0,ssr:!1},e),t}var Tp=function(e){var t=e.sideCar,n=Np(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return p.createElement(s,Ht({},n))};Tp.isSideCarExport=!0;function $k(e,t){return e.useMedium(t),Tp}var Ep=Dk(),Ii=function(){},Jo=p.forwardRef(function(e,t){var n=p.useRef(null),s=p.useState({onScrollCapture:Ii,onWheelCapture:Ii,onTouchMoveCapture:Ii}),o=s[0],i=s[1],a=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,h=e.sideCar,m=e.noRelative,v=e.noIsolation,g=e.inert,x=e.allowPinchZoom,b=e.as,y=b===void 0?"div":b,k=e.gapMode,j=Np(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=h,T=Ok([n,t]),N=Ht(Ht({},j),o);return p.createElement(p.Fragment,null,d&&p.createElement(C,{sideCar:Ep,removeScrollBar:u,shards:f,noRelative:m,noIsolation:v,inert:g,setCallbacks:i,allowPinchZoom:!!x,lockRef:n,gapMode:k}),a?p.cloneElement(p.Children.only(l),Ht(Ht({},N),{ref:T})):p.createElement(y,Ht({},N,{className:c,ref:T}),l))});Jo.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Jo.classNames={fullWidth:so,zeroRight:no};var Fk=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Bk(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Fk();return t&&e.setAttribute("nonce",t),e}function Uk(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Wk(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Hk=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Bk())&&(Uk(t,n),Wk(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Vk=function(){var e=Hk();return function(t,n){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ap=function(){var e=Vk(),t=function(n){var s=n.styles,o=n.dynamic;return e(s,o),null};return t},qk={left:0,top:0,right:0,gap:0},zi=function(e){return parseInt(e||"",10)||0},Zk=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[zi(n),zi(s),zi(o)]},Gk=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return qk;var t=Zk(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},Kk=Ap(),ms="data-scroll-locked",Jk=function(e,t,n,s){var o=e.left,i=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
42
|
+
.`.concat(Rk,` {
|
|
43
43
|
overflow: hidden `).concat(s,`;
|
|
44
44
|
padding-right: `).concat(l,"px ").concat(s,`;
|
|
45
45
|
}
|
|
@@ -56,51 +56,51 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
56
56
|
`),n==="padding"&&"padding-right: ".concat(l,"px ").concat(s,";")].filter(Boolean).join(""),`
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
.`).concat(
|
|
59
|
+
.`).concat(no,` {
|
|
60
60
|
right: `).concat(l,"px ").concat(s,`;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
.`).concat(
|
|
63
|
+
.`).concat(so,` {
|
|
64
64
|
margin-right: `).concat(l,"px ").concat(s,`;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
.`).concat(
|
|
67
|
+
.`).concat(no," .").concat(no,` {
|
|
68
68
|
right: 0 `).concat(s,`;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
.`).concat(
|
|
71
|
+
.`).concat(so," .").concat(so,` {
|
|
72
72
|
margin-right: 0 `).concat(s,`;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
body[`).concat(ms,`] {
|
|
76
|
-
`).concat(
|
|
76
|
+
`).concat(Ik,": ").concat(l,`px;
|
|
77
77
|
}
|
|
78
|
-
`)},
|
|
78
|
+
`)},uu=function(){var e=parseInt(document.body.getAttribute(ms)||"0",10);return isFinite(e)?e:0},Yk=function(){p.useEffect(function(){return document.body.setAttribute(ms,(uu()+1).toString()),function(){var e=uu()-1;e<=0?document.body.removeAttribute(ms):document.body.setAttribute(ms,e.toString())}},[])},Xk=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,o=s===void 0?"margin":s;Yk();var i=p.useMemo(function(){return Gk(o)},[o]);return p.createElement(Kk,{styles:Jk(i,!t,o,n?"":"!important")})},va=!1;if(typeof window<"u")try{var Pr=Object.defineProperty({},"passive",{get:function(){return va=!0,!0}});window.addEventListener("test",Pr,Pr),window.removeEventListener("test",Pr,Pr)}catch{va=!1}var ts=va?{passive:!1}:!1,Qk=function(e){return e.tagName==="TEXTAREA"},Rp=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Qk(e)&&n[t]==="visible")},ej=function(e){return Rp(e,"overflowY")},tj=function(e){return Rp(e,"overflowX")},du=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var o=Ip(e,s);if(o){var i=zp(e,s),a=i[1],l=i[2];if(a>l)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},nj=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},sj=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},Ip=function(e,t){return e==="v"?ej(t):tj(t)},zp=function(e,t){return e==="v"?nj(t):sj(t)},rj=function(e,t){return e==="h"&&t==="rtl"?-1:1},oj=function(e,t,n,s,o){var i=rj(e,window.getComputedStyle(t).direction),a=i*s,l=n.target,c=t.contains(l),u=!1,d=a>0,f=0,h=0;do{if(!l)break;var m=zp(e,l),v=m[0],g=m[1],x=m[2],b=g-x-i*v;(v||b)&&Ip(e,l)&&(f+=b,h+=v);var y=l.parentNode;l=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&Math.abs(f)<1||!d&&Math.abs(h)<1)&&(u=!0),u},Or=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},fu=function(e){return[e.deltaX,e.deltaY]},pu=function(e){return e&&"current"in e?e.current:e},ij=function(e,t){return e[0]===t[0]&&e[1]===t[1]},aj=function(e){return`
|
|
79
79
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
80
80
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
81
|
-
`)},
|
|
81
|
+
`)},lj=0,ns=[];function cj(e){var t=p.useRef([]),n=p.useRef([0,0]),s=p.useRef(),o=p.useState(lj++)[0],i=p.useState(Ap)[0],a=p.useRef(e);p.useEffect(function(){a.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var g=Ak([e.lockRef.current],(e.shards||[]).map(pu),!0).filter(Boolean);return g.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),g.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=p.useCallback(function(g,x){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!a.current.allowPinchZoom;var b=Or(g),y=n.current,k="deltaX"in g?g.deltaX:y[0]-b[0],j="deltaY"in g?g.deltaY:y[1]-b[1],C,T=g.target,N=Math.abs(k)>Math.abs(j)?"h":"v";if("touches"in g&&N==="h"&&T.type==="range")return!1;var P=window.getSelection(),A=P&&P.anchorNode,z=A?A===T||A.contains(T):!1;if(z)return!1;var D=du(N,T);if(!D)return!0;if(D?C=N:(C=N==="v"?"h":"v",D=du(N,T)),!D)return!1;if(!s.current&&"changedTouches"in g&&(k||j)&&(s.current=C),!C)return!0;var E=s.current||C;return oj(E,x,g,E==="h"?k:j)},[]),c=p.useCallback(function(g){var x=g;if(!(!ns.length||ns[ns.length-1]!==i)){var b="deltaY"in x?fu(x):Or(x),y=t.current.filter(function(C){return C.name===x.type&&(C.target===x.target||x.target===C.shadowParent)&&ij(C.delta,b)})[0];if(y&&y.should){x.cancelable&&x.preventDefault();return}if(!y){var k=(a.current.shards||[]).map(pu).filter(Boolean).filter(function(C){return C.contains(x.target)}),j=k.length>0?l(x,k[0]):!a.current.noIsolation;j&&x.cancelable&&x.preventDefault()}}},[]),u=p.useCallback(function(g,x,b,y){var k={name:g,delta:x,target:b,should:y,shadowParent:uj(b)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(j){return j!==k})},1)},[]),d=p.useCallback(function(g){n.current=Or(g),s.current=void 0},[]),f=p.useCallback(function(g){u(g.type,fu(g),g.target,l(g,e.lockRef.current))},[]),h=p.useCallback(function(g){u(g.type,Or(g),g.target,l(g,e.lockRef.current))},[]);p.useEffect(function(){return ns.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,ts),document.addEventListener("touchmove",c,ts),document.addEventListener("touchstart",d,ts),function(){ns=ns.filter(function(g){return g!==i}),document.removeEventListener("wheel",c,ts),document.removeEventListener("touchmove",c,ts),document.removeEventListener("touchstart",d,ts)}},[]);var m=e.removeScrollBar,v=e.inert;return p.createElement(p.Fragment,null,v?p.createElement(i,{styles:aj(o)}):null,m?p.createElement(Xk,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function uj(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const dj=$k(Ep,cj);var zl=p.forwardRef(function(e,t){return p.createElement(Jo,Ht({},e,{ref:t,sideCar:dj}))});zl.classNames=Jo.classNames;var fj=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ss=new WeakMap,Mr=new WeakMap,Lr={},Pi=0,Pp=function(e){return e&&(e.host||Pp(e.parentNode))},pj=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=Pp(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},hj=function(e,t,n,s){var o=pj(t,Array.isArray(e)?e:[e]);Lr[n]||(Lr[n]=new WeakMap);var i=Lr[n],a=[],l=new Set,c=new Set(o),u=function(f){!f||l.has(f)||(l.add(f),u(f.parentNode))};o.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(l.has(h))d(h);else try{var m=h.getAttribute(s),v=m!==null&&m!=="false",g=(ss.get(h)||0)+1,x=(i.get(h)||0)+1;ss.set(h,g),i.set(h,x),a.push(h),g===1&&v&&Mr.set(h,!0),x===1&&h.setAttribute(n,"true"),v||h.setAttribute(s,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return d(t),l.clear(),Pi++,function(){a.forEach(function(f){var h=ss.get(f)-1,m=i.get(f)-1;ss.set(f,h),i.set(f,m),h||(Mr.has(f)||f.removeAttribute(s),Mr.delete(f)),m||f.removeAttribute(n)}),Pi--,Pi||(ss=new WeakMap,ss=new WeakMap,Mr=new WeakMap,Lr={})}},Op=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),o=fj(e);return o?(s.push.apply(s,Array.from(o.querySelectorAll("[aria-live], script"))),hj(s,o,n,"aria-hidden")):function(){return null}},Yo="Dialog",[Mp]=cn(Yo),[mj,Ft]=Mp(Yo),Lp=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:o,onOpenChange:i,modal:a=!0}=e,l=p.useRef(null),c=p.useRef(null),[u,d]=Fn({prop:s,defaultProp:o??!1,onChange:i,caller:Yo});return r.jsx(mj,{scope:t,triggerRef:l,contentRef:c,contentId:Zt(),titleId:Zt(),descriptionId:Zt(),open:u,onOpenChange:d,onOpenToggle:p.useCallback(()=>d(f=>!f),[d]),modal:a,children:n})};Lp.displayName=Yo;var Dp="DialogTrigger",$p=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=Ft(Dp,n),i=De(t,o.triggerRef);return r.jsx(ze.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Ml(o.open),...s,ref:i,onClick:Te(e.onClick,o.onOpenToggle)})});$p.displayName=Dp;var Pl="DialogPortal",[gj,Fp]=Mp(Pl,{forceMount:void 0}),Bp=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:o}=e,i=Ft(Pl,t);return r.jsx(gj,{scope:t,forceMount:n,children:p.Children.map(s,a=>r.jsx(It,{present:n||i.open,children:r.jsx(Ko,{asChild:!0,container:o,children:a})}))})};Bp.displayName=Pl;var _o="DialogOverlay",Up=p.forwardRef((e,t)=>{const n=Fp(_o,e.__scopeDialog),{forceMount:s=n.forceMount,...o}=e,i=Ft(_o,e.__scopeDialog);return i.modal?r.jsx(It,{present:s||i.open,children:r.jsx(bj,{...o,ref:t})}):null});Up.displayName=_o;var xj=ks("DialogOverlay.RemoveScroll"),bj=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=Ft(_o,n);return r.jsx(zl,{as:xj,allowPinchZoom:!0,shards:[o.contentRef],children:r.jsx(ze.div,{"data-state":Ml(o.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),Bn="DialogContent",Wp=p.forwardRef((e,t)=>{const n=Fp(Bn,e.__scopeDialog),{forceMount:s=n.forceMount,...o}=e,i=Ft(Bn,e.__scopeDialog);return r.jsx(It,{present:s||i.open,children:i.modal?r.jsx(vj,{...o,ref:t}):r.jsx(yj,{...o,ref:t})})});Wp.displayName=Bn;var vj=p.forwardRef((e,t)=>{const n=Ft(Bn,e.__scopeDialog),s=p.useRef(null),o=De(t,n.contentRef,s);return p.useEffect(()=>{const i=s.current;if(i)return Op(i)},[]),r.jsx(Hp,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Te(e.onCloseAutoFocus,i=>{i.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Te(e.onPointerDownOutside,i=>{const a=i.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0;(a.button===2||l)&&i.preventDefault()}),onFocusOutside:Te(e.onFocusOutside,i=>i.preventDefault())})}),yj=p.forwardRef((e,t)=>{const n=Ft(Bn,e.__scopeDialog),s=p.useRef(!1),o=p.useRef(!1);return r.jsx(Hp,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(s.current||n.triggerRef.current?.focus(),i.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(s.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const a=i.target;n.triggerRef.current?.contains(a)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),Hp=p.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=e,l=Ft(Bn,n),c=p.useRef(null),u=De(t,c);return Cp(),r.jsxs(r.Fragment,{children:[r.jsx(Il,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:i,children:r.jsx(Go,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Ml(l.open),...a,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(wj,{titleId:l.titleId}),r.jsx(kj,{contentRef:c,descriptionId:l.descriptionId})]})]})}),Ol="DialogTitle",Vp=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=Ft(Ol,n);return r.jsx(ze.h2,{id:o.titleId,...s,ref:t})});Vp.displayName=Ol;var qp="DialogDescription",Zp=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=Ft(qp,n);return r.jsx(ze.p,{id:o.descriptionId,...s,ref:t})});Zp.displayName=qp;var Gp="DialogClose",Kp=p.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=Ft(Gp,n);return r.jsx(ze.button,{type:"button",...s,ref:t,onClick:Te(e.onClick,()=>o.onOpenChange(!1))})});Kp.displayName=Gp;function Ml(e){return e?"open":"closed"}var Jp="DialogTitleWarning",[Iz,Yp]=J5(Jp,{contentName:Bn,titleName:Ol,docsSlug:"dialog"}),wj=({titleId:e})=>{const t=Yp(Jp),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
82
82
|
|
|
83
83
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
84
84
|
|
|
85
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},bj="DialogDescriptionWarning",vj=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Jp(bj).contentName}}.`;return p.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},yj=Mp,wj=Dp,_j=Fp,kj=Bp,jj=Up,Sj=Hp,Cj=qp,Nj=Gp;function Gn({...e}){return r.jsx(yj,{"data-slot":"dialog",...e})}function Xo({...e}){return r.jsx(wj,{"data-slot":"dialog-trigger",...e})}function Tj({...e}){return r.jsx(_j,{"data-slot":"dialog-portal",...e})}function Ej({className:e,...t}){return r.jsx(kj,{"data-slot":"dialog-overlay",className:ie("fixed inset-0 z-40 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t})}function Kn({className:e,children:t,...n}){return r.jsxs(Tj,{children:[r.jsx(Ej,{}),r.jsxs(jj,{"data-slot":"dialog-content",className:ie("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",e),...n,children:[t,r.jsxs(Nj,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[r.jsx(fr,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Jn({className:e,...t}){return r.jsx("div",{"data-slot":"dialog-header",className:ie("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function Yn({className:e,...t}){return r.jsx(Sj,{"data-slot":"dialog-title",className:ie("text-lg font-semibold leading-none tracking-tight",e),...t})}function Yp({className:e,...t}){return r.jsx(Cj,{"data-slot":"dialog-description",className:ie("text-sm text-muted-foreground",e),...t})}const fu=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,pu=op,Ml=(e,t)=>n=>{var s;if(t?.variants==null)return pu(e,n?.class,n?.className);const{variants:o,defaultVariants:i}=t,a=Object.keys(o).map(u=>{const d=n?.[u],f=i?.[u];if(d===null)return null;const h=fu(d)||fu(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||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((u,d)=>{let{class:f,className:h,...m}=d;return Object.entries(m).every(v=>{let[g,x]=v;return Array.isArray(x)?x.includes({...i,...l}[g]):{...i,...l}[g]===x})?[...u,f,h]:u},[]);return pu(e,a,c,n?.class,n?.className)},Aj=Ml("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function ke({className:e,variant:t,size:n,...s}){return r.jsx("button",{"data-slot":"button",className:ie(Aj({variant:t,size:n,className:e})),...s})}function Xp({open:e,onOpenChange:t,title:n,description:s,confirmLabel:o="Confirm",variant:i="default",onConfirm:a}){return r.jsx(Gn,{open:e,onOpenChange:t,children:r.jsxs(Kn,{children:[r.jsx(Jn,{children:r.jsx(Yn,{children:n})}),r.jsx("p",{className:"text-sm text-muted-foreground",children:s}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(ke,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Cancel"}),r.jsx(ke,{variant:i,size:"sm",onClick:()=>{a(),t(!1)},children:o})]})]})})}const Rj="data:image/svg+xml,%3csvg%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eClaude%20Code%3c/title%3e%3cpath%20clip-rule='evenodd'%20d='M20.998%2010.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6%2010.949h1.488V8.102H6v2.847zm10.51%200H18V8.102h-1.49v2.847z'%20fill='%23D97757'%20fill-rule='evenodd'%3e%3c/path%3e%3c/svg%3e",Ij="data:image/svg+xml,%3csvg%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eCodex%3c/title%3e%3cpath%20d='M19.503%200H4.496A4.496%204.496%200%20000%204.496v15.007A4.496%204.496%200%20004.496%2024h15.007A4.496%204.496%200%200024%2019.503V4.496A4.496%204.496%200%200019.503%200z'%20fill='%23fff'%3e%3c/path%3e%3cpath%20d='M9.064%203.344a4.578%204.578%200%20012.285-.312c1%20.115%201.891.54%202.673%201.275.01.01.024.017.037.021a.09.09%200%2000.043%200%204.55%204.55%200%20013.046.275l.047.022.116.057a4.581%204.581%200%20012.188%202.399c.209.51.313%201.041.315%201.595a4.24%204.24%200%2001-.134%201.223.123.123%200%2000.03.115c.594.607.988%201.33%201.183%202.17.289%201.425-.007%202.71-.887%203.854l-.136.166a4.548%204.548%200%2001-2.201%201.388.123.123%200%2000-.081.076c-.191.551-.383%201.023-.74%201.494-.9%201.187-2.222%201.846-3.711%201.838-1.187-.006-2.239-.44-3.157-1.302a.107.107%200%2000-.105-.024c-.388.125-.78.143-1.204.138a4.441%204.441%200%2001-1.945-.466%204.544%204.544%200%2001-1.61-1.335c-.152-.202-.303-.392-.414-.617a5.81%205.81%200%2001-.37-.961%204.582%204.582%200%2001-.014-2.298.124.124%200%2000.006-.056.085.085%200%2000-.027-.048%204.467%204.467%200%2001-1.034-1.651%203.896%203.896%200%2001-.251-1.192%205.189%205.189%200%2001.141-1.6c.337-1.112.982-1.985%201.933-2.618.212-.141.413-.251.601-.33.215-.089.43-.164.646-.227a.098.098%200%2000.065-.066%204.51%204.51%200%2001.829-1.615%204.535%204.535%200%20011.837-1.388zm3.482%2010.565a.637.637%200%20000%201.272h3.636a.637.637%200%20100-1.272h-3.636zM8.462%209.23a.637.637%200%2000-1.106.631l1.272%202.224-1.266%202.136a.636.636%200%20101.095.649l1.454-2.455a.636.636%200%2000.005-.64L8.462%209.23z'%20fill='url(%23lobe-icons-codex-_R_0_)'%3e%3c/path%3e%3cdefs%3e%3clinearGradient%20gradientUnits='userSpaceOnUse'%20id='lobe-icons-codex-_R_0_'%20x1='12'%20x2='12'%20y1='3'%20y2='21'%3e%3cstop%20stop-color='%23B1A7FF'%3e%3c/stop%3e%3cstop%20offset='.5'%20stop-color='%237A9DFF'%3e%3c/stop%3e%3cstop%20offset='1'%20stop-color='%233941FF'%3e%3c/stop%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",zj="data:image/svg+xml,%3csvg%20fill='%237dd3fc'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eOpenCode%3c/title%3e%3cpath%20d='M16%206H8v12h8V6zm4%2016H4V2h16v20z'%3e%3c/path%3e%3c/svg%3e",Oj="data:image/svg+xml,%3csvg%20fill='%23ff6900'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eMiMo%20Code%3c/title%3e%3cpath%20d='M.958%2015.936a.459.459%200%2001.459.44v2.729a.46.46%200%2001-.918%200v-2.729a.459.459%200%2001.459-.44zm4.814-2.035a.46.46%200%2001.553.45v4.754a.458.458%200%2011-.918%200V15.48L3.74%2017.202a.462.462%200%2001-.655.016.462.462%200%2001-.065-.082L.628%2014.67a.459.459%200%2001.658-.637l2.124%202.187%202.127-2.188a.46.46%200%2001.235-.13zm2.068.004a.46.46%200%2001.458.445v4.755a.46.46%200%2001-.458.458.459.459%200%2001-.458-.458V14.35a.459.459%200%2001.458-.445zm1.973%202.014a.46.46%200%2001.46.457v2.729a.46.46%200%2001-.784.324.46.46%200%2001-.134-.324v-2.729a.46.46%200%2001.458-.458zm.002-2.045a.458.458%200%2001.328.157l2.127%202.19%202.125-2.19a.459.459%200%2001.784.318v4.756a.46.46%200%2001-.455.458.46.46%200%2001-.458-.458V15.48l-1.667%201.723a.46.46%200%2001-.65.008l-.005-.005c0-.002-.002-.002-.004-.003l-2.455-2.534a.46.46%200%2001-.008-.667.461.461%200%2001.338-.128zm6.797%201.206a.46.46%200%2001.53.651A1.966%201.966%200%200019.81%2018.4a.462.462%200%2001.623.18.46.46%200%2001-.181.624%202.863%202.863%200%2001-1.38.353l-.142-.004a2.88%202.88%200%2001-2.393-4.263.461.461%200%2001.274-.21zm.864-.931a2.884%202.884%200%20013.915%203.914.46.46%200%2001-.402.24l-.057-.004a.458.458%200%2001-.164-.055.46.46%200%2001-.182-.622%201.967%201.967%200%2000-2.669-2.67.459.459%200%2011-.441-.803zM9.59%206.368c1.481%200%201.696%201.202%201.696%201.654v2.648h-.917v-.432c-.26.346-.792.535-1.36.535-.133%200-1.289-.03-1.384-1.136-.082-.932.675-1.61%202.053-1.61h.691c0-.563-.367-.886-.983-.886-.44.013-.864.174-1.2.458l-.36-.664c.484-.379%201.012-.567%201.764-.567zm4.427.1c1.263%200%202.082.97%202.083%202.15%200%201.181-.824%202.154-2.083%202.154-1.26%200-2.084-.972-2.084-2.152%200-1.18.82-2.153%202.084-2.153zm6.801.015c.68%200%201.202.465%201.197%201.548v2.642H21.1V8.29c0-.312-.002-.98-.63-.98s-.628.667-.628.838v2.524h-.89V8.148c0-.17-.001-.838-.63-.838-.628%200-.628.668-.628.98v2.383h-.917v-4.03h.917V7a1.22%201.22%200%2001.947-.516c.398%200%20.76.193.982.686a1.321%201.321%200%20011.195-.686zm-18.093.872l1.457-1.772H5.32L3.311%208.07l2.14%202.602H4.24L2.725%208.796%201.21%2010.672H0L2.138%208.07.13%205.583h1.138l1.458%201.772zm4.149%203.317h-.916V6.644h.916v4.028zm16.99%200h-.916V6.644h.916v4.028zM9.925%208.71c-1.055%200-1.359.412-1.326.742.032.329.324.537.757.537a1.013%201.013%200%20001.014-.968l.002-.31h-.447zM14.018%207.3c-.663%200-1.184.487-1.184%201.32%200%20.832.52%201.32%201.184%201.32.662%200%201.182-.49%201.182-1.32%200-.832-.52-1.32-1.182-1.32zM6.417%205.001a.568.568%200%2001.587.582.588.588%200%2001-1.175%200A.57.57%200%20016.417%205zm16.991%200a.57.57%200%2001.592.582.588.588%200%2001-1.174%200%20.57.57%200%2001.357-.542.572.572%200%2001.225-.04z'%3e%3c/path%3e%3c/svg%3e",Pj="/assets/agent-inspector-58K1_MsC.ico",Mj={"agent-inspector":"Inspector",codex:"Codex",opencode:"OpenCode","mimo-code":"MiMo Code","claude-code":"Claude Code"};function Pi(e){return e?.toLowerCase()??""}function Ds(e,t){for(const n of t)if(e.includes(n))return!0;return!1}function Ll(e){const t=[Pi(e.userAgent),Pi(e.conversationId),Pi(e.clientProjectFolder)].join(" ");return Ds(t,["agent-inspector","agent inspector","provider-test"])?"agent-inspector":Ds(t,["mimocode","mimo-code","mimo code"])?"mimo-code":Ds(t,["opencode","open-code","open code"])?"opencode":Ds(t,["claude-code","claude code","claudecode"])?"claude-code":Ds(t,["codex desktop","codex-cli","openai-codex","codex"])?"codex":"unknown"}function Qo(e){switch(e){case"agent-inspector":case"codex":case"opencode":case"mimo-code":case"claude-code":return Mj[e];case"unknown":return null}}const Lj={"agent-inspector":Pj,codex:Ij,opencode:zj,"mimo-code":Oj,"claude-code":Rj},Dj={"agent-inspector":"border-orange-200/25 bg-orange-300/[0.12]",codex:"border-cyan-200/20 bg-cyan-300/[0.08]",opencode:"border-sky-200/25 bg-sky-300/[0.12]","mimo-code":"border-orange-200/25 bg-orange-400/[0.12]","claude-code":"border-amber-100/20 bg-amber-300/[0.09]"},$j={"agent-inspector":"p-0.5 drop-shadow-[0_0_8px_rgba(251,146,60,0.35)]",codex:"p-0.5",opencode:"p-1 drop-shadow-[0_0_8px_rgba(125,211,252,0.35)]","mimo-code":"p-0.5 drop-shadow-[0_0_8px_rgba(255,105,0,0.35)]","claude-code":"p-0.5"};function ei({client:e,className:t}){if(e==="unknown")return null;const n=Qo(e);if(n===null)return null;const s=Lj[e];return r.jsx("span",{className:ie("inline-flex size-6 shrink-0 items-center justify-center rounded-md border p-0 shadow-sm",Dj[e],t),"aria-label":n,title:n,children:r.jsx("img",{src:s,alt:"",className:ie("size-full object-contain",$j[e]),"aria-hidden":"true"})})}const Fj="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",Bj="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",Uj="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",Wj="/assets/minimax-BPMzvuL-.jpeg",Hj="/assets/alibaba-TTwafVwX.svg",Vj="/assets/qwen-CONDcHqt.png",qj="/assets/zhipuai-BPNAnxo-.svg",Zj={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen"};function Gj(e){return e.replace(/[_\s]+/g,"-").split(/[/:@]/).some(n=>n.startsWith("glm-"))}function Kj(e){if(e===null)return"unknown";const t=e.toLowerCase();if(Gj(t))return"zhipuai";for(const[n,s]of Object.entries(Zj))if(t.startsWith(n.toLowerCase()))return s;return"unknown"}const Xn={width:24,height:24,objectFit:"contain"},Jj=ht.memo(({className:e})=>r.jsx("img",{src:Fj,alt:"Anthropic",className:e,style:Xn})),Yj=ht.memo(({className:e})=>r.jsx("img",{src:Bj,alt:"OpenAI",className:e,style:{...Xn,background:"white",borderRadius:"4px"}})),Xj=ht.memo(({className:e})=>r.jsx("img",{src:Uj,alt:"DeepSeek",className:e,style:Xn})),Qj=ht.memo(({className:e})=>r.jsx("img",{src:Wj,alt:"MiniMax",className:e,style:Xn})),eS=ht.memo(({className:e})=>r.jsx("img",{src:Hj,alt:"Alibaba",className:e,style:Xn})),tS=ht.memo(({className:e})=>r.jsx("img",{src:Vj,alt:"Qwen",className:e,style:Xn})),nS=ht.memo(({className:e})=>r.jsx("img",{src:qj,alt:"ZhipuAI",className:e,style:Xn}));function sS({provider:e,className:t}){switch(e){case"anthropic":return r.jsx(Jj,{className:t});case"openai":return r.jsx(Yj,{className:t});case"deepseek":return r.jsx(Xj,{className:t});case"minimax":return r.jsx(Qj,{className:t});case"alibaba":return r.jsx(eS,{className:t});case"qwen":return r.jsx(tS,{className:t});case"zhipuai":return r.jsx(nS,{className:t});case"unknown":return null}}var Qp=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"}),rS="VisuallyHidden",eh=p.forwardRef((e,t)=>r.jsx(ze.span,{...e,ref:t,style:{...Qp,...e.style}}));eh.displayName=rS;var oS=eh;function th(e){const t=e+"CollectionProvider",[n,s]=cn(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=g=>{const{scope:x,children:b}=g,y=ht.useRef(null),k=ht.useRef(new Map).current;return r.jsx(o,{scope:x,itemMap:k,collectionRef:y,children:b})};a.displayName=t;const l=e+"CollectionSlot",c=ks(l),u=ht.forwardRef((g,x)=>{const{scope:b,children:y}=g,k=i(l,b),j=De(x,k.collectionRef);return r.jsx(c,{ref:j,children:y})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=ks(d),m=ht.forwardRef((g,x)=>{const{scope:b,children:y,...k}=g,j=ht.useRef(null),C=De(x,j),T=i(d,b);return ht.useEffect(()=>(T.itemMap.set(j,{ref:j,...k}),()=>{T.itemMap.delete(j)})),r.jsx(h,{[f]:"",ref:C,children:y})});m.displayName=d;function v(g){const x=i(e+"CollectionConsumer",g);return ht.useCallback(()=>{const y=x.collectionRef.current;if(!y)return[];const k=Array.from(y.querySelectorAll(`[${f}]`));return Array.from(x.itemMap.values()).sort((T,N)=>k.indexOf(T.ref.current)-k.indexOf(N.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:a,Slot:u,ItemSlot:m},v,s]}var ti="Collapsible",[iS]=cn(ti),[aS,Dl]=iS(ti),nh=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:s,defaultOpen:o,disabled:i,onOpenChange:a,...l}=e,[c,u]=Fn({prop:s,defaultProp:o??!1,onChange:a,caller:ti});return r.jsx(aS,{scope:n,disabled:i,contentId:Zt(),open:c,onOpenToggle:p.useCallback(()=>u(d=>!d),[u]),children:r.jsx(ze.div,{"data-state":Fl(c),"data-disabled":i?"":void 0,...l,ref:t})})});nh.displayName=ti;var sh="CollapsibleTrigger",rh=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...s}=e,o=Dl(sh,n);return r.jsx(ze.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":Fl(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...s,ref:t,onClick:Te(e.onClick,o.onOpenToggle)})});rh.displayName=sh;var $l="CollapsibleContent",oh=p.forwardRef((e,t)=>{const{forceMount:n,...s}=e,o=Dl($l,e.__scopeCollapsible);return r.jsx(Rt,{present:n||o.open,children:({present:i})=>r.jsx(lS,{...s,ref:t,present:i})})});oh.displayName=$l;var lS=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:s,children:o,...i}=e,a=Dl($l,n),[l,c]=p.useState(s),u=p.useRef(null),d=De(t,u),f=p.useRef(0),h=f.current,m=p.useRef(0),v=m.current,g=a.open||l,x=p.useRef(g),b=p.useRef(void 0);return p.useEffect(()=>{const y=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(y)},[]),tt(()=>{const y=u.current;if(y){b.current=b.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";const k=y.getBoundingClientRect();f.current=k.height,m.current=k.width,x.current||(y.style.transitionDuration=b.current.transitionDuration,y.style.animationName=b.current.animationName),c(s)}},[a.open,s]),r.jsx(ze.div,{"data-state":Fl(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!g,...i,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...e.style},children:g&&o})});function Fl(e){return e?"open":"closed"}var cS=nh,uS=p.createContext(void 0);function ni(e){const t=p.useContext(uS);return e||t||"ltr"}function dS(e){const t=p.useRef({value:e,previous:e});return p.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function fS(e){const[t,n]=p.useState(void 0);return tt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let a,l;if("borderBoxSize"in i){const c=i.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}const pS=["top","right","bottom","left"],_n=Math.min,yt=Math.max,vo=Math.round,Or=Math.floor,Gt=e=>({x:e,y:e}),hS={left:"right",right:"left",bottom:"top",top:"bottom"},mS={start:"end",end:"start"};function ya(e,t,n){return yt(e,_n(t,n))}function on(e,t){return typeof e=="function"?e(t):e}function an(e){return e.split("-")[0]}function zs(e){return e.split("-")[1]}function Bl(e){return e==="x"?"y":"x"}function Ul(e){return e==="y"?"height":"width"}const gS=new Set(["top","bottom"]);function Vt(e){return gS.has(an(e))?"y":"x"}function Wl(e){return Bl(Vt(e))}function xS(e,t,n){n===void 0&&(n=!1);const s=zs(e),o=Wl(e),i=Ul(o);let a=o==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=yo(a)),[a,yo(a)]}function bS(e){const t=yo(e);return[wa(e),t,wa(t)]}function wa(e){return e.replace(/start|end/g,t=>mS[t])}const hu=["left","right"],mu=["right","left"],vS=["top","bottom"],yS=["bottom","top"];function wS(e,t,n){switch(e){case"top":case"bottom":return n?t?mu:hu:t?hu:mu;case"left":case"right":return t?vS:yS;default:return[]}}function _S(e,t,n,s){const o=zs(e);let i=wS(an(e),n==="start",s);return o&&(i=i.map(a=>a+"-"+o),t&&(i=i.concat(i.map(wa)))),i}function yo(e){return e.replace(/left|right|bottom|top/g,t=>hS[t])}function kS(e){return{top:0,right:0,bottom:0,left:0,...e}}function ih(e){return typeof e!="number"?kS(e):{top:e,right:e,bottom:e,left:e}}function wo(e){const{x:t,y:n,width:s,height:o}=e;return{width:s,height:o,top:n,left:t,right:t+s,bottom:n+o,x:t,y:n}}function gu(e,t,n){let{reference:s,floating:o}=e;const i=Vt(t),a=Wl(t),l=Ul(a),c=an(t),u=i==="y",d=s.x+s.width/2-o.width/2,f=s.y+s.height/2-o.height/2,h=s[l]/2-o[l]/2;let m;switch(c){case"top":m={x:d,y:s.y-o.height};break;case"bottom":m={x:d,y:s.y+s.height};break;case"right":m={x:s.x+s.width,y:f};break;case"left":m={x:s.x-o.width,y:f};break;default:m={x:s.x,y:s.y}}switch(zs(t)){case"start":m[a]-=h*(n&&u?-1:1);break;case"end":m[a]+=h*(n&&u?-1:1);break}return m}async function jS(e,t){var n;t===void 0&&(t={});const{x:s,y:o,platform:i,rects:a,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=on(t,e),v=ih(m),x=l[h?f==="floating"?"reference":"floating":f],b=wo(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(x)))==null||n?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),y=f==="floating"?{x:s,y:o,width:a.floating.width,height:a.floating.height}:a.reference,k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),j=await(i.isElement==null?void 0:i.isElement(k))?await(i.getScale==null?void 0:i.getScale(k))||{x:1,y:1}:{x:1,y:1},C=wo(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:k,strategy:c}):y);return{top:(b.top-C.top+v.top)/j.y,bottom:(C.bottom-b.bottom+v.bottom)/j.y,left:(b.left-C.left+v.left)/j.x,right:(C.right-b.right+v.right)/j.x}}const SS=async(e,t,n)=>{const{placement:s="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=i.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:f}=gu(u,s,c),h=s,m={},v=0;for(let x=0;x<l.length;x++){var g;const{name:b,fn:y}=l[x],{x:k,y:j,data:C,reset:T}=await y({x:d,y:f,initialPlacement:s,placement:h,strategy:o,middlewareData:m,rects:u,platform:{...a,detectOverflow:(g=a.detectOverflow)!=null?g:jS},elements:{reference:e,floating:t}});d=k??d,f=j??f,m={...m,[b]:{...m[b],...C}},T&&v<=50&&(v++,typeof T=="object"&&(T.placement&&(h=T.placement),T.rects&&(u=T.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):T.rects),{x:d,y:f}=gu(u,h,c)),x=-1)}return{x:d,y:f,placement:h,strategy:o,middlewareData:m}},CS=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:o,rects:i,platform:a,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=on(e,t)||{};if(u==null)return{};const f=ih(d),h={x:n,y:s},m=Wl(o),v=Ul(m),g=await a.getDimensions(u),x=m==="y",b=x?"top":"left",y=x?"bottom":"right",k=x?"clientHeight":"clientWidth",j=i.reference[v]+i.reference[m]-h[m]-i.floating[v],C=h[m]-i.reference[m],T=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let N=T?T[k]:0;(!N||!await(a.isElement==null?void 0:a.isElement(T)))&&(N=l.floating[k]||i.floating[v]);const O=j/2-C/2,A=N/2-g[v]/2-1,z=_n(f[b],A),D=_n(f[y],A),E=z,L=N-g[v]-D,w=N/2-g[v]/2+O,$=ya(E,w,L),ee=!c.arrow&&zs(o)!=null&&w!==$&&i.reference[v]/2-(w<E?z:D)-g[v]/2<0,F=ee?w<E?w-E:w-L:0;return{[m]:h[m]+F,data:{[m]:$,centerOffset:w-$-F,...ee&&{alignmentOffset:F}},reset:ee}}}),NS=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:o,middlewareData:i,rects:a,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:g=!0,...x}=on(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=an(o),y=Vt(l),k=an(l)===l,j=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=h||(k||!g?[yo(l)]:bS(l)),T=v!=="none";!h&&T&&C.push(..._S(l,g,v,j));const N=[l,...C],O=await c.detectOverflow(t,x),A=[];let z=((s=i.flip)==null?void 0:s.overflows)||[];if(d&&A.push(O[b]),f){const w=xS(o,a,j);A.push(O[w[0]],O[w[1]])}if(z=[...z,{placement:o,overflows:A}],!A.every(w=>w<=0)){var D,E;const w=(((D=i.flip)==null?void 0:D.index)||0)+1,$=N[w];if($&&(!(f==="alignment"?y!==Vt($):!1)||z.every(W=>Vt(W.placement)===y?W.overflows[0]>0:!0)))return{data:{index:w,overflows:z},reset:{placement:$}};let ee=(E=z.filter(F=>F.overflows[0]<=0).sort((F,W)=>F.overflows[1]-W.overflows[1])[0])==null?void 0:E.placement;if(!ee)switch(m){case"bestFit":{var L;const F=(L=z.filter(W=>{if(T){const Z=Vt(W.placement);return Z===y||Z==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(Z=>Z>0).reduce((Z,ue)=>Z+ue,0)]).sort((W,Z)=>W[1]-Z[1])[0])==null?void 0:L[0];F&&(ee=F);break}case"initialPlacement":ee=l;break}if(o!==ee)return{reset:{placement:ee}}}return{}}}};function xu(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function bu(e){return pS.some(t=>e[t]>=0)}const TS=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:o="referenceHidden",...i}=on(e,t);switch(o){case"referenceHidden":{const a=await s.detectOverflow(t,{...i,elementContext:"reference"}),l=xu(a,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:bu(l)}}}case"escaped":{const a=await s.detectOverflow(t,{...i,altBoundary:!0}),l=xu(a,n.floating);return{data:{escapedOffsets:l,escaped:bu(l)}}}default:return{}}}}},ah=new Set(["left","top"]);async function ES(e,t){const{placement:n,platform:s,elements:o}=e,i=await(s.isRTL==null?void 0:s.isRTL(o.floating)),a=an(n),l=zs(n),c=Vt(n)==="y",u=ah.has(a)?-1:1,d=i&&c?-1:1,f=on(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof v=="number"&&(m=l==="end"?v*-1:v),c?{x:m*d,y:h*u}:{x:h*u,y:m*d}}const AS=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:o,y:i,placement:a,middlewareData:l}=t,c=await ES(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(s=l.arrow)!=null&&s.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:a}}}}},RS=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:o,platform:i}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:b=>{let{x:y,y:k}=b;return{x:y,y:k}}},...u}=on(e,t),d={x:n,y:s},f=await i.detectOverflow(t,u),h=Vt(an(o)),m=Bl(h);let v=d[m],g=d[h];if(a){const b=m==="y"?"top":"left",y=m==="y"?"bottom":"right",k=v+f[b],j=v-f[y];v=ya(k,v,j)}if(l){const b=h==="y"?"top":"left",y=h==="y"?"bottom":"right",k=g+f[b],j=g-f[y];g=ya(k,g,j)}const x=c.fn({...t,[m]:v,[h]:g});return{...x,data:{x:x.x-n,y:x.y-s,enabled:{[m]:a,[h]:l}}}}}},IS=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:o,rects:i,middlewareData:a}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=on(e,t),d={x:n,y:s},f=Vt(o),h=Bl(f);let m=d[h],v=d[f];const g=on(l,t),x=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const k=h==="y"?"height":"width",j=i.reference[h]-i.floating[k]+x.mainAxis,C=i.reference[h]+i.reference[k]-x.mainAxis;m<j?m=j:m>C&&(m=C)}if(u){var b,y;const k=h==="y"?"width":"height",j=ah.has(an(o)),C=i.reference[f]-i.floating[k]+(j&&((b=a.offset)==null?void 0:b[f])||0)+(j?0:x.crossAxis),T=i.reference[f]+i.reference[k]+(j?0:((y=a.offset)==null?void 0:y[f])||0)-(j?x.crossAxis:0);v<C?v=C:v>T&&(v=T)}return{[h]:m,[f]:v}}}},zS=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:o,rects:i,platform:a,elements:l}=t,{apply:c=()=>{},...u}=on(e,t),d=await a.detectOverflow(t,u),f=an(o),h=zs(o),m=Vt(o)==="y",{width:v,height:g}=i.floating;let x,b;f==="top"||f==="bottom"?(x=f,b=h===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(b=f,x=h==="end"?"top":"bottom");const y=g-d.top-d.bottom,k=v-d.left-d.right,j=_n(g-d[x],y),C=_n(v-d[b],k),T=!t.middlewareData.shift;let N=j,O=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=k),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(N=y),T&&!h){const z=yt(d.left,0),D=yt(d.right,0),E=yt(d.top,0),L=yt(d.bottom,0);m?O=v-2*(z!==0||D!==0?z+D:yt(d.left,d.right)):N=g-2*(E!==0||L!==0?E+L:yt(d.top,d.bottom))}await c({...t,availableWidth:O,availableHeight:N});const A=await a.getDimensions(l.floating);return v!==A.width||g!==A.height?{reset:{rects:!0}}:{}}}};function si(){return typeof window<"u"}function Os(e){return lh(e)?(e.nodeName||"").toLowerCase():"#document"}function kt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Xt(e){var t;return(t=(lh(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function lh(e){return si()?e instanceof Node||e instanceof kt(e).Node:!1}function Dt(e){return si()?e instanceof Element||e instanceof kt(e).Element:!1}function Kt(e){return si()?e instanceof HTMLElement||e instanceof kt(e).HTMLElement:!1}function vu(e){return!si()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof kt(e).ShadowRoot}const OS=new Set(["inline","contents"]);function pr(e){const{overflow:t,overflowX:n,overflowY:s,display:o}=$t(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!OS.has(o)}const PS=new Set(["table","td","th"]);function MS(e){return PS.has(Os(e))}const LS=[":popover-open",":modal"];function ri(e){return LS.some(t=>{try{return e.matches(t)}catch{return!1}})}const DS=["transform","translate","scale","rotate","perspective"],$S=["transform","translate","scale","rotate","perspective","filter"],FS=["paint","layout","strict","content"];function Hl(e){const t=Vl(),n=Dt(e)?$t(e):e;return DS.some(s=>n[s]?n[s]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||$S.some(s=>(n.willChange||"").includes(s))||FS.some(s=>(n.contain||"").includes(s))}function BS(e){let t=kn(e);for(;Kt(t)&&!js(t);){if(Hl(t))return t;if(ri(t))return null;t=kn(t)}return null}function Vl(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const US=new Set(["html","body","#document"]);function js(e){return US.has(Os(e))}function $t(e){return kt(e).getComputedStyle(e)}function oi(e){return Dt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function kn(e){if(Os(e)==="html")return e;const t=e.assignedSlot||e.parentNode||vu(e)&&e.host||Xt(e);return vu(t)?t.host:t}function ch(e){const t=kn(e);return js(t)?e.ownerDocument?e.ownerDocument.body:e.body:Kt(t)&&pr(t)?t:ch(t)}function nr(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=ch(e),i=o===((s=e.ownerDocument)==null?void 0:s.body),a=kt(o);if(i){const l=_a(a);return t.concat(a,a.visualViewport||[],pr(o)?o:[],l&&n?nr(l):[])}return t.concat(o,nr(o,[],n))}function _a(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function uh(e){const t=$t(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const o=Kt(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:s,l=vo(n)!==i||vo(s)!==a;return l&&(n=i,s=a),{width:n,height:s,$:l}}function ql(e){return Dt(e)?e:e.contextElement}function gs(e){const t=ql(e);if(!Kt(t))return Gt(1);const n=t.getBoundingClientRect(),{width:s,height:o,$:i}=uh(t);let a=(i?vo(n.width):n.width)/s,l=(i?vo(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const WS=Gt(0);function dh(e){const t=kt(e);return!Vl()||!t.visualViewport?WS:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function HS(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==kt(e)?!1:t}function Un(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=ql(e);let a=Gt(1);t&&(s?Dt(s)&&(a=gs(s)):a=gs(e));const l=HS(i,n,s)?dh(i):Gt(0);let c=(o.left+l.x)/a.x,u=(o.top+l.y)/a.y,d=o.width/a.x,f=o.height/a.y;if(i){const h=kt(i),m=s&&Dt(s)?kt(s):s;let v=h,g=_a(v);for(;g&&s&&m!==v;){const x=gs(g),b=g.getBoundingClientRect(),y=$t(g),k=b.left+(g.clientLeft+parseFloat(y.paddingLeft))*x.x,j=b.top+(g.clientTop+parseFloat(y.paddingTop))*x.y;c*=x.x,u*=x.y,d*=x.x,f*=x.y,c+=k,u+=j,v=kt(g),g=_a(v)}}return wo({width:d,height:f,x:c,y:u})}function ii(e,t){const n=oi(e).scrollLeft;return t?t.left+n:Un(Xt(e)).left+n}function fh(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-ii(e,n),o=n.top+t.scrollTop;return{x:s,y:o}}function VS(e){let{elements:t,rect:n,offsetParent:s,strategy:o}=e;const i=o==="fixed",a=Xt(s),l=t?ri(t.floating):!1;if(s===a||l&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Gt(1);const d=Gt(0),f=Kt(s);if((f||!f&&!i)&&((Os(s)!=="body"||pr(a))&&(c=oi(s)),Kt(s))){const m=Un(s);u=gs(s),d.x=m.x+s.clientLeft,d.y=m.y+s.clientTop}const h=a&&!f&&!i?fh(a,c):Gt(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+h.x,y:n.y*u.y-c.scrollTop*u.y+d.y+h.y}}function qS(e){return Array.from(e.getClientRects())}function ZS(e){const t=Xt(e),n=oi(e),s=e.ownerDocument.body,o=yt(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),i=yt(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let a=-n.scrollLeft+ii(e);const l=-n.scrollTop;return $t(s).direction==="rtl"&&(a+=yt(t.clientWidth,s.clientWidth)-o),{width:o,height:i,x:a,y:l}}const yu=25;function GS(e,t){const n=kt(e),s=Xt(e),o=n.visualViewport;let i=s.clientWidth,a=s.clientHeight,l=0,c=0;if(o){i=o.width,a=o.height;const d=Vl();(!d||d&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}const u=ii(s);if(u<=0){const d=s.ownerDocument,f=d.body,h=getComputedStyle(f),m=d.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,v=Math.abs(s.clientWidth-f.clientWidth-m);v<=yu&&(i-=v)}else u<=yu&&(i+=u);return{width:i,height:a,x:l,y:c}}const KS=new Set(["absolute","fixed"]);function JS(e,t){const n=Un(e,!0,t==="fixed"),s=n.top+e.clientTop,o=n.left+e.clientLeft,i=Kt(e)?gs(e):Gt(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,c=o*i.x,u=s*i.y;return{width:a,height:l,x:c,y:u}}function wu(e,t,n){let s;if(t==="viewport")s=GS(e,n);else if(t==="document")s=ZS(Xt(e));else if(Dt(t))s=JS(t,n);else{const o=dh(e);s={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return wo(s)}function ph(e,t){const n=kn(e);return n===t||!Dt(n)||js(n)?!1:$t(n).position==="fixed"||ph(n,t)}function YS(e,t){const n=t.get(e);if(n)return n;let s=nr(e,[],!1).filter(l=>Dt(l)&&Os(l)!=="body"),o=null;const i=$t(e).position==="fixed";let a=i?kn(e):e;for(;Dt(a)&&!js(a);){const l=$t(a),c=Hl(a);!c&&l.position==="fixed"&&(o=null),(i?!c&&!o:!c&&l.position==="static"&&!!o&&KS.has(o.position)||pr(a)&&!c&&ph(e,a))?s=s.filter(d=>d!==a):o=l,a=kn(a)}return t.set(e,s),s}function XS(e){let{element:t,boundary:n,rootBoundary:s,strategy:o}=e;const a=[...n==="clippingAncestors"?ri(t)?[]:YS(t,this._c):[].concat(n),s],l=a[0],c=a.reduce((u,d)=>{const f=wu(t,d,o);return u.top=yt(f.top,u.top),u.right=_n(f.right,u.right),u.bottom=_n(f.bottom,u.bottom),u.left=yt(f.left,u.left),u},wu(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function QS(e){const{width:t,height:n}=uh(e);return{width:t,height:n}}function eC(e,t,n){const s=Kt(t),o=Xt(t),i=n==="fixed",a=Un(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=Gt(0);function u(){c.x=ii(o)}if(s||!s&&!i)if((Os(t)!=="body"||pr(o))&&(l=oi(t)),s){const m=Un(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else o&&u();i&&!s&&o&&u();const d=o&&!s&&!i?fh(o,l):Gt(0),f=a.left+l.scrollLeft-c.x-d.x,h=a.top+l.scrollTop-c.y-d.y;return{x:f,y:h,width:a.width,height:a.height}}function Mi(e){return $t(e).position==="static"}function _u(e,t){if(!Kt(e)||$t(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Xt(e)===n&&(n=n.ownerDocument.body),n}function hh(e,t){const n=kt(e);if(ri(e))return n;if(!Kt(e)){let o=kn(e);for(;o&&!js(o);){if(Dt(o)&&!Mi(o))return o;o=kn(o)}return n}let s=_u(e,t);for(;s&&MS(s)&&Mi(s);)s=_u(s,t);return s&&js(s)&&Mi(s)&&!Hl(s)?n:s||BS(e)||n}const tC=async function(e){const t=this.getOffsetParent||hh,n=this.getDimensions,s=await n(e.floating);return{reference:eC(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function nC(e){return $t(e).direction==="rtl"}const sC={convertOffsetParentRelativeRectToViewportRelativeRect:VS,getDocumentElement:Xt,getClippingRect:XS,getOffsetParent:hh,getElementRects:tC,getClientRects:qS,getDimensions:QS,getScale:gs,isElement:Dt,isRTL:nC};function mh(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function rC(e,t){let n=null,s;const o=Xt(e);function i(){var l;clearTimeout(s),(l=n)==null||l.disconnect(),n=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const u=e.getBoundingClientRect(),{left:d,top:f,width:h,height:m}=u;if(l||t(),!h||!m)return;const v=Or(f),g=Or(o.clientWidth-(d+h)),x=Or(o.clientHeight-(f+m)),b=Or(d),k={rootMargin:-v+"px "+-g+"px "+-x+"px "+-b+"px",threshold:yt(0,_n(1,c))||1};let j=!0;function C(T){const N=T[0].intersectionRatio;if(N!==c){if(!j)return a();N?a(!1,N):s=setTimeout(()=>{a(!1,1e-7)},1e3)}N===1&&!mh(u,e.getBoundingClientRect())&&a(),j=!1}try{n=new IntersectionObserver(C,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,k)}n.observe(e)}return a(!0),i}function oC(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,u=ql(e),d=o||i?[...u?nr(u):[],...nr(t)]:[];d.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const f=u&&l?rC(u,n):null;let h=-1,m=null;a&&(m=new ResizeObserver(b=>{let[y]=b;y&&y.target===u&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var k;(k=m)==null||k.observe(t)})),n()}),u&&!c&&m.observe(u),m.observe(t));let v,g=c?Un(e):null;c&&x();function x(){const b=Un(e);g&&!mh(g,b)&&n(),g=b,v=requestAnimationFrame(x)}return n(),()=>{var b;d.forEach(y=>{o&&y.removeEventListener("scroll",n),i&&y.removeEventListener("resize",n)}),f?.(),(b=m)==null||b.disconnect(),m=null,c&&cancelAnimationFrame(v)}}const iC=AS,aC=RS,lC=NS,cC=zS,uC=TS,ku=CS,dC=IS,fC=(e,t,n)=>{const s=new Map,o={platform:sC,...n},i={...o.platform,_c:s};return SS(e,t,{...o,platform:i})};var pC=typeof document<"u",hC=function(){},eo=pC?p.useLayoutEffect:hC;function _o(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!_o(e[s],t[s]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,o[s]))return!1;for(s=n;s--!==0;){const i=o[s];if(!(i==="_owner"&&e.$$typeof)&&!_o(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function gh(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ju(e,t){const n=gh(e);return Math.round(t*n)/n}function Li(e){const t=p.useRef(e);return eo(()=>{t.current=e}),t}function mC(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:o,elements:{reference:i,floating:a}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=p.useState(s);_o(h,s)||m(s);const[v,g]=p.useState(null),[x,b]=p.useState(null),y=p.useCallback(W=>{W!==T.current&&(T.current=W,g(W))},[]),k=p.useCallback(W=>{W!==N.current&&(N.current=W,b(W))},[]),j=i||v,C=a||x,T=p.useRef(null),N=p.useRef(null),O=p.useRef(d),A=c!=null,z=Li(c),D=Li(o),E=Li(u),L=p.useCallback(()=>{if(!T.current||!N.current)return;const W={placement:t,strategy:n,middleware:h};D.current&&(W.platform=D.current),fC(T.current,N.current,W).then(Z=>{const ue={...Z,isPositioned:E.current!==!1};w.current&&!_o(O.current,ue)&&(O.current=ue,cr.flushSync(()=>{f(ue)}))})},[h,t,n,D,E]);eo(()=>{u===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,f(W=>({...W,isPositioned:!1})))},[u]);const w=p.useRef(!1);eo(()=>(w.current=!0,()=>{w.current=!1}),[]),eo(()=>{if(j&&(T.current=j),C&&(N.current=C),j&&C){if(z.current)return z.current(j,C,L);L()}},[j,C,L,z,A]);const $=p.useMemo(()=>({reference:T,floating:N,setReference:y,setFloating:k}),[y,k]),ee=p.useMemo(()=>({reference:j,floating:C}),[j,C]),F=p.useMemo(()=>{const W={position:n,left:0,top:0};if(!ee.floating)return W;const Z=ju(ee.floating,d.x),ue=ju(ee.floating,d.y);return l?{...W,transform:"translate("+Z+"px, "+ue+"px)",...gh(ee.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Z,top:ue}},[n,l,ee.floating,d.x,d.y]);return p.useMemo(()=>({...d,update:L,refs:$,elements:ee,floatingStyles:F}),[d,L,$,ee,F])}const gC=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:o}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?ku({element:s.current,padding:o}).fn(n):{}:s?ku({element:s,padding:o}).fn(n):{}}}},xC=(e,t)=>({...iC(e),options:[e,t]}),bC=(e,t)=>({...aC(e),options:[e,t]}),vC=(e,t)=>({...dC(e),options:[e,t]}),yC=(e,t)=>({...lC(e),options:[e,t]}),wC=(e,t)=>({...cC(e),options:[e,t]}),_C=(e,t)=>({...uC(e),options:[e,t]}),kC=(e,t)=>({...gC(e),options:[e,t]});var jC="Arrow",xh=p.forwardRef((e,t)=>{const{children:n,width:s=10,height:o=5,...i}=e;return r.jsx(ze.svg,{...i,ref:t,width:s,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});xh.displayName=jC;var SC=xh,Zl="Popper",[bh,ai]=cn(Zl),[CC,vh]=bh(Zl),yh=e=>{const{__scopePopper:t,children:n}=e,[s,o]=p.useState(null);return r.jsx(CC,{scope:t,anchor:s,onAnchorChange:o,children:n})};yh.displayName=Zl;var wh="PopperAnchor",_h=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...o}=e,i=vh(wh,n),a=p.useRef(null),l=De(t,a),c=p.useRef(null);return p.useEffect(()=>{const u=c.current;c.current=s?.current||a.current,u!==c.current&&i.onAnchorChange(c.current)}),s?null:r.jsx(ze.div,{...o,ref:l})});_h.displayName=wh;var Gl="PopperContent",[NC,TC]=bh(Gl),kh=p.forwardRef((e,t)=>{const{__scopePopper:n,side:s="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:m="optimized",onPlaced:v,...g}=e,x=vh(Gl,n),[b,y]=p.useState(null),k=De(t,ae=>y(ae)),[j,C]=p.useState(null),T=fS(j),N=T?.width??0,O=T?.height??0,A=s+(i!=="center"?"-"+i:""),z=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},D=Array.isArray(u)?u:[u],E=D.length>0,L={padding:z,boundary:D.filter(AC),altBoundary:E},{refs:w,floatingStyles:$,placement:ee,isPositioned:F,middlewareData:W}=mC({strategy:"fixed",placement:A,whileElementsMounted:(...ae)=>oC(...ae,{animationFrame:m==="always"}),elements:{reference:x.anchor},middleware:[xC({mainAxis:o+O,alignmentAxis:a}),c&&bC({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?vC():void 0,...L}),c&&yC({...L}),wC({...L,apply:({elements:ae,rects:ge,availableWidth:xe,availableHeight:he})=>{const{width:be,height:Se}=ge.reference,Ie=ae.floating.style;Ie.setProperty("--radix-popper-available-width",`${xe}px`),Ie.setProperty("--radix-popper-available-height",`${he}px`),Ie.setProperty("--radix-popper-anchor-width",`${be}px`),Ie.setProperty("--radix-popper-anchor-height",`${Se}px`)}}),j&&kC({element:j,padding:l}),RC({arrowWidth:N,arrowHeight:O}),h&&_C({strategy:"referenceHidden",...L})]}),[Z,ue]=Ch(ee),V=ft(v);tt(()=>{F&&V?.()},[F,V]);const H=W.arrow?.x,le=W.arrow?.y,U=W.arrow?.centerOffset!==0,[X,Ce]=p.useState();return tt(()=>{b&&Ce(window.getComputedStyle(b).zIndex)},[b]),r.jsx("div",{ref:w.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:F?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:X,"--radix-popper-transform-origin":[W.transformOrigin?.x,W.transformOrigin?.y].join(" "),...W.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(NC,{scope:n,placedSide:Z,onArrowChange:C,arrowX:H,arrowY:le,shouldHideArrow:U,children:r.jsx(ze.div,{"data-side":Z,"data-align":ue,...g,ref:k,style:{...g.style,animation:F?void 0:"none"}})})})});kh.displayName=Gl;var jh="PopperArrow",EC={top:"bottom",right:"left",bottom:"top",left:"right"},Sh=p.forwardRef(function(t,n){const{__scopePopper:s,...o}=t,i=TC(jh,s),a=EC[i.placedSide];return r.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:r.jsx(SC,{...o,ref:n,style:{...o.style,display:"block"}})})});Sh.displayName=jh;function AC(e){return e!==null}var RC=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:s,middlewareData:o}=t,a=o.arrow?.centerOffset!==0,l=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[u,d]=Ch(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(o.arrow?.x??0)+l/2,m=(o.arrow?.y??0)+c/2;let v="",g="";return u==="bottom"?(v=a?f:`${h}px`,g=`${-c}px`):u==="top"?(v=a?f:`${h}px`,g=`${s.floating.height+c}px`):u==="right"?(v=`${-c}px`,g=a?f:`${m}px`):u==="left"&&(v=`${s.floating.width+c}px`,g=a?f:`${m}px`),{data:{x:v,y:g}}}});function Ch(e){const[t,n="center"]=e.split("-");return[t,n]}var Nh=yh,Th=_h,Eh=kh,Ah=Sh,Di="rovingFocusGroup.onEntryFocus",IC={bubbles:!1,cancelable:!0},hr="RovingFocusGroup",[ka,Rh,zC]=th(hr),[OC,Ih]=cn(hr,[zC]),[PC,MC]=OC(hr),zh=p.forwardRef((e,t)=>r.jsx(ka.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(ka.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(LC,{...e,ref:t})})}));zh.displayName=hr;var LC=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:o=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,h=p.useRef(null),m=De(t,h),v=ni(i),[g,x]=Fn({prop:a,defaultProp:l??null,onChange:c,caller:hr}),[b,y]=p.useState(!1),k=ft(u),j=Rh(n),C=p.useRef(!1),[T,N]=p.useState(0);return p.useEffect(()=>{const O=h.current;if(O)return O.addEventListener(Di,k),()=>O.removeEventListener(Di,k)},[k]),r.jsx(PC,{scope:n,orientation:s,dir:v,loop:o,currentTabStopId:g,onItemFocus:p.useCallback(O=>x(O),[x]),onItemShiftTab:p.useCallback(()=>y(!0),[]),onFocusableItemAdd:p.useCallback(()=>N(O=>O+1),[]),onFocusableItemRemove:p.useCallback(()=>N(O=>O-1),[]),children:r.jsx(ze.div,{tabIndex:b||T===0?-1:0,"data-orientation":s,...f,ref:m,style:{outline:"none",...e.style},onMouseDown:Te(e.onMouseDown,()=>{C.current=!0}),onFocus:Te(e.onFocus,O=>{const A=!C.current;if(O.target===O.currentTarget&&A&&!b){const z=new CustomEvent(Di,IC);if(O.currentTarget.dispatchEvent(z),!z.defaultPrevented){const D=j().filter(ee=>ee.focusable),E=D.find(ee=>ee.active),L=D.find(ee=>ee.id===g),$=[E,L,...D].filter(Boolean).map(ee=>ee.ref.current);Mh($,d)}}C.current=!1}),onBlur:Te(e.onBlur,()=>y(!1))})})}),Oh="RovingFocusGroupItem",Ph=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:o=!1,tabStopId:i,children:a,...l}=e,c=Zt(),u=i||c,d=MC(Oh,n),f=d.currentTabStopId===u,h=Rh(n),{onFocusableItemAdd:m,onFocusableItemRemove:v,currentTabStopId:g}=d;return p.useEffect(()=>{if(s)return m(),()=>v()},[s,m,v]),r.jsx(ka.ItemSlot,{scope:n,id:u,focusable:s,active:o,children:r.jsx(ze.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:Te(e.onMouseDown,x=>{s?d.onItemFocus(u):x.preventDefault()}),onFocus:Te(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:Te(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){d.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const b=FC(x,d.orientation,d.dir);if(b!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let k=h().filter(j=>j.focusable).map(j=>j.ref.current);if(b==="last")k.reverse();else if(b==="prev"||b==="next"){b==="prev"&&k.reverse();const j=k.indexOf(x.currentTarget);k=d.loop?BC(k,j+1):k.slice(j+1)}setTimeout(()=>Mh(k))}}),children:typeof a=="function"?a({isCurrentTabStop:f,hasTabStop:g!=null}):a})})});Ph.displayName=Oh;var DC={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function $C(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function FC(e,t,n){const s=$C(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return DC[s]}function Mh(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function BC(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var UC=zh,WC=Ph;function ja(e,[t,n]){return Math.min(n,Math.max(t,e))}function HC(e,t){return p.useReducer((n,s)=>t[n][s]??n,e)}var Kl="ScrollArea",[Lh]=cn(Kl),[VC,It]=Lh(Kl),Dh=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:s="hover",dir:o,scrollHideDelay:i=600,...a}=e,[l,c]=p.useState(null),[u,d]=p.useState(null),[f,h]=p.useState(null),[m,v]=p.useState(null),[g,x]=p.useState(null),[b,y]=p.useState(0),[k,j]=p.useState(0),[C,T]=p.useState(!1),[N,O]=p.useState(!1),A=De(t,D=>c(D)),z=ni(o);return r.jsx(VC,{scope:n,type:s,dir:z,scrollHideDelay:i,scrollArea:l,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:m,onScrollbarXChange:v,scrollbarXEnabled:C,onScrollbarXEnabledChange:T,scrollbarY:g,onScrollbarYChange:x,scrollbarYEnabled:N,onScrollbarYEnabledChange:O,onCornerWidthChange:y,onCornerHeightChange:j,children:r.jsx(ze.div,{dir:z,...a,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})});Dh.displayName=Kl;var $h="ScrollAreaViewport",Fh=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:s,nonce:o,...i}=e,a=It($h,n),l=p.useRef(null),c=De(t,l,a.onViewportChange);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),r.jsx(ze.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...e.style},children:r.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});Fh.displayName=$h;var Qt="ScrollAreaScrollbar",Bh=p.forwardRef((e,t)=>{const{forceMount:n,...s}=e,o=It(Qt,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=o,l=e.orientation==="horizontal";return p.useEffect(()=>(l?i(!0):a(!0),()=>{l?i(!1):a(!1)}),[l,i,a]),o.type==="hover"?r.jsx(qC,{...s,ref:t,forceMount:n}):o.type==="scroll"?r.jsx(ZC,{...s,ref:t,forceMount:n}):o.type==="auto"?r.jsx(Uh,{...s,ref:t,forceMount:n}):o.type==="always"?r.jsx(Jl,{...s,ref:t}):null});Bh.displayName=Qt;var qC=p.forwardRef((e,t)=>{const{forceMount:n,...s}=e,o=It(Qt,e.__scopeScrollArea),[i,a]=p.useState(!1);return p.useEffect(()=>{const l=o.scrollArea;let c=0;if(l){const u=()=>{window.clearTimeout(c),a(!0)},d=()=>{c=window.setTimeout(()=>a(!1),o.scrollHideDelay)};return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",d)}}},[o.scrollArea,o.scrollHideDelay]),r.jsx(Rt,{present:n||i,children:r.jsx(Uh,{"data-state":i?"visible":"hidden",...s,ref:t})})}),ZC=p.forwardRef((e,t)=>{const{forceMount:n,...s}=e,o=It(Qt,e.__scopeScrollArea),i=e.orientation==="horizontal",a=ci(()=>c("SCROLL_END"),100),[l,c]=HC("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return p.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,o.scrollHideDelay,c]),p.useEffect(()=>{const u=o.viewport,d=i?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const m=u[d];f!==m&&(c("SCROLL"),a()),f=m};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[o.viewport,i,c,a]),r.jsx(Rt,{present:n||l!=="hidden",children:r.jsx(Jl,{"data-state":l==="hidden"?"hidden":"visible",...s,ref:t,onPointerEnter:Te(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Te(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Uh=p.forwardRef((e,t)=>{const n=It(Qt,e.__scopeScrollArea),{forceMount:s,...o}=e,[i,a]=p.useState(!1),l=e.orientation==="horizontal",c=ci(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;a(l?u:d)}},10);return Ss(n.viewport,c),Ss(n.content,c),r.jsx(Rt,{present:s||i,children:r.jsx(Jl,{"data-state":i?"visible":"hidden",...o,ref:t})})}),Jl=p.forwardRef((e,t)=>{const{orientation:n="vertical",...s}=e,o=It(Qt,e.__scopeScrollArea),i=p.useRef(null),a=p.useRef(0),[l,c]=p.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Zh(l.viewport,l.content),d={...s,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:h=>i.current=h,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:h=>a.current=h};function f(h,m){return QC(h,a.current,l,m)}return n==="horizontal"?r.jsx(GC,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const h=o.viewport.scrollLeft,m=Su(h,l,o.dir);i.current.style.transform=`translate3d(${m}px, 0, 0)`}},onWheelScroll:h=>{o.viewport&&(o.viewport.scrollLeft=h)},onDragScroll:h=>{o.viewport&&(o.viewport.scrollLeft=f(h,o.dir))}}):n==="vertical"?r.jsx(KC,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const h=o.viewport.scrollTop,m=Su(h,l);i.current.style.transform=`translate3d(0, ${m}px, 0)`}},onWheelScroll:h=>{o.viewport&&(o.viewport.scrollTop=h)},onDragScroll:h=>{o.viewport&&(o.viewport.scrollTop=f(h))}}):null}),GC=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:s,...o}=e,i=It(Qt,e.__scopeScrollArea),[a,l]=p.useState(),c=p.useRef(null),u=De(t,c,i.onScrollbarXChange);return p.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),r.jsx(Hh,{"data-orientation":"horizontal",...o,ref:u,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":li(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(i.viewport){const h=i.viewport.scrollLeft+d.deltaX;e.onWheelScroll(h),Kh(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&s({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:jo(a.paddingLeft),paddingEnd:jo(a.paddingRight)}})}})}),KC=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:s,...o}=e,i=It(Qt,e.__scopeScrollArea),[a,l]=p.useState(),c=p.useRef(null),u=De(t,c,i.onScrollbarYChange);return p.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),r.jsx(Hh,{"data-orientation":"vertical",...o,ref:u,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":li(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(i.viewport){const h=i.viewport.scrollTop+d.deltaY;e.onWheelScroll(h),Kh(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&s({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:jo(a.paddingTop),paddingEnd:jo(a.paddingBottom)}})}})}),[JC,Wh]=Lh(Qt),Hh=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:s,hasThumb:o,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...h}=e,m=It(Qt,n),[v,g]=p.useState(null),x=De(t,A=>g(A)),b=p.useRef(null),y=p.useRef(""),k=m.viewport,j=s.content-s.viewport,C=ft(d),T=ft(c),N=ci(f,10);function O(A){if(b.current){const z=A.clientX-b.current.left,D=A.clientY-b.current.top;u({x:z,y:D})}}return p.useEffect(()=>{const A=z=>{const D=z.target;v?.contains(D)&&C(z,j)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[k,v,j,C]),p.useEffect(T,[s,T]),Ss(v,N),Ss(m.content,N),r.jsx(JC,{scope:n,scrollbar:v,hasThumb:o,onThumbChange:ft(i),onThumbPointerUp:ft(a),onThumbPositionChange:T,onThumbPointerDown:ft(l),children:r.jsx(ze.div,{...h,ref:x,style:{position:"absolute",...h.style},onPointerDown:Te(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),b.current=v.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),O(A))}),onPointerMove:Te(e.onPointerMove,O),onPointerUp:Te(e.onPointerUp,A=>{const z=A.target;z.hasPointerCapture(A.pointerId)&&z.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=y.current,m.viewport&&(m.viewport.style.scrollBehavior=""),b.current=null})})})}),ko="ScrollAreaThumb",Vh=p.forwardRef((e,t)=>{const{forceMount:n,...s}=e,o=Wh(ko,e.__scopeScrollArea);return r.jsx(Rt,{present:n||o.hasThumb,children:r.jsx(YC,{ref:t,...s})})}),YC=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:s,...o}=e,i=It(ko,n),a=Wh(ko,n),{onThumbPositionChange:l}=a,c=De(t,f=>a.onThumbChange(f)),u=p.useRef(void 0),d=ci(()=>{u.current&&(u.current(),u.current=void 0)},100);return p.useEffect(()=>{const f=i.viewport;if(f){const h=()=>{if(d(),!u.current){const m=eN(f,l);u.current=m,l()}};return l(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[i.viewport,d,l]),r.jsx(ze.div,{"data-state":a.hasThumb?"visible":"hidden",...o,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:Te(e.onPointerDownCapture,f=>{const m=f.target.getBoundingClientRect(),v=f.clientX-m.left,g=f.clientY-m.top;a.onThumbPointerDown({x:v,y:g})}),onPointerUp:Te(e.onPointerUp,a.onThumbPointerUp)})});Vh.displayName=ko;var Yl="ScrollAreaCorner",qh=p.forwardRef((e,t)=>{const n=It(Yl,e.__scopeScrollArea),s=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&s?r.jsx(XC,{...e,ref:t}):null});qh.displayName=Yl;var XC=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,...s}=e,o=It(Yl,n),[i,a]=p.useState(0),[l,c]=p.useState(0),u=!!(i&&l);return Ss(o.scrollbarX,()=>{const d=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(d),c(d)}),Ss(o.scrollbarY,()=>{const d=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(d),a(d)}),u?r.jsx(ze.div,{...s,ref:t,style:{width:i,height:l,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function jo(e){return e?parseInt(e,10):0}function Zh(e,t){const n=e/t;return isNaN(n)?0:n}function li(e){const t=Zh(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=(e.scrollbar.size-n)*t;return Math.max(s,18)}function QC(e,t,n,s="ltr"){const o=li(n),i=o/2,a=t||i,l=o-a,c=n.scrollbar.paddingStart+a,u=n.scrollbar.size-n.scrollbar.paddingEnd-l,d=n.content-n.viewport,f=s==="ltr"?[0,d]:[d*-1,0];return Gh([c,u],f)(e)}function Su(e,t,n="ltr"){const s=li(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-o,a=t.content-t.viewport,l=i-s,c=n==="ltr"?[0,a]:[a*-1,0],u=ja(e,c);return Gh([0,a],[0,l])(u)}function Gh(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const s=(t[1]-t[0])/(e[1]-e[0]);return t[0]+s*(n-e[0])}}function Kh(e,t){return e>0&&e<t}var eN=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},s=0;return(function o(){const i={left:e.scrollLeft,top:e.scrollTop},a=n.left!==i.left,l=n.top!==i.top;(a||l)&&t(),n=i,s=window.requestAnimationFrame(o)})(),()=>window.cancelAnimationFrame(s)};function ci(e,t){const n=ft(e),s=p.useRef(0);return p.useEffect(()=>()=>window.clearTimeout(s.current),[]),p.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(n,t)},[n,t])}function Ss(e,t){const n=ft(t);tt(()=>{let s=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(s),o.unobserve(e)}}},[e,n])}var tN=Dh,nN=Fh,sN=qh,rN=[" ","Enter","ArrowUp","ArrowDown"],oN=[" ","Enter"],Wn="Select",[ui,di,iN]=th(Wn),[Ps]=cn(Wn,[iN,ai]),fi=ai(),[aN,Nn]=Ps(Wn),[lN,cN]=Ps(Wn),Jh=e=>{const{__scopeSelect:t,children:n,open:s,defaultOpen:o,onOpenChange:i,value:a,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:h,required:m,form:v}=e,g=fi(t),[x,b]=p.useState(null),[y,k]=p.useState(null),[j,C]=p.useState(!1),T=ni(u),[N,O]=Fn({prop:s,defaultProp:o??!1,onChange:i,caller:Wn}),[A,z]=Fn({prop:a,defaultProp:l,onChange:c,caller:Wn}),D=p.useRef(null),E=x?v||!!x.closest("form"):!0,[L,w]=p.useState(new Set),$=Array.from(L).map(ee=>ee.props.value).join(";");return r.jsx(Nh,{...g,children:r.jsxs(aN,{required:m,scope:t,trigger:x,onTriggerChange:b,valueNode:y,onValueNodeChange:k,valueNodeHasChildren:j,onValueNodeHasChildrenChange:C,contentId:Zt(),value:A,onValueChange:z,open:N,onOpenChange:O,dir:T,triggerPointerDownPosRef:D,disabled:h,children:[r.jsx(ui.Provider,{scope:t,children:r.jsx(lN,{scope:e.__scopeSelect,onNativeOptionAdd:p.useCallback(ee=>{w(F=>new Set(F).add(ee))},[]),onNativeOptionRemove:p.useCallback(ee=>{w(F=>{const W=new Set(F);return W.delete(ee),W})},[]),children:n})}),E?r.jsxs(bm,{"aria-hidden":!0,required:m,tabIndex:-1,name:d,autoComplete:f,value:A,onChange:ee=>z(ee.target.value),disabled:h,form:v,children:[A===void 0?r.jsx("option",{value:""}):null,Array.from(L)]},$):null]})})};Jh.displayName=Wn;var Yh="SelectTrigger",Xh=p.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...o}=e,i=fi(n),a=Nn(Yh,n),l=a.disabled||s,c=De(t,a.onTriggerChange),u=di(n),d=p.useRef("touch"),[f,h,m]=ym(g=>{const x=u().filter(k=>!k.disabled),b=x.find(k=>k.value===a.value),y=wm(x,g,b);y!==void 0&&a.onValueChange(y.value)}),v=g=>{l||(a.onOpenChange(!0),m()),g&&(a.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return r.jsx(Th,{asChild:!0,...i,children:r.jsx(ze.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":vm(a.value)?"":void 0,...o,ref:c,onClick:Te(o.onClick,g=>{g.currentTarget.focus(),d.current!=="mouse"&&v(g)}),onPointerDown:Te(o.onPointerDown,g=>{d.current=g.pointerType;const x=g.target;x.hasPointerCapture(g.pointerId)&&x.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(v(g),g.preventDefault())}),onKeyDown:Te(o.onKeyDown,g=>{const x=f.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&h(g.key),!(x&&g.key===" ")&&rN.includes(g.key)&&(v(),g.preventDefault())})})})});Xh.displayName=Yh;var Qh="SelectValue",em=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:o,children:i,placeholder:a="",...l}=e,c=Nn(Qh,n),{onValueNodeHasChildrenChange:u}=c,d=i!==void 0,f=De(t,c.onValueNodeChange);return tt(()=>{u(d)},[u,d]),r.jsx(ze.span,{...l,ref:f,style:{pointerEvents:"none"},children:vm(c.value)?r.jsx(r.Fragment,{children:a}):i})});em.displayName=Qh;var uN="SelectIcon",tm=p.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...o}=e;return r.jsx(ze.span,{"aria-hidden":!0,...o,ref:t,children:s||"▼"})});tm.displayName=uN;var dN="SelectPortal",nm=e=>r.jsx(Ko,{asChild:!0,...e});nm.displayName=dN;var Hn="SelectContent",sm=p.forwardRef((e,t)=>{const n=Nn(Hn,e.__scopeSelect),[s,o]=p.useState();if(tt(()=>{o(new DocumentFragment)},[]),!n.open){const i=s;return i?cr.createPortal(r.jsx(rm,{scope:e.__scopeSelect,children:r.jsx(ui.Slot,{scope:e.__scopeSelect,children:r.jsx("div",{children:e.children})})}),i):null}return r.jsx(om,{...e,ref:t})});sm.displayName=Hn;var Mt=10,[rm,Tn]=Ps(Hn),fN="SelectContentImpl",pN=ks("SelectContent.RemoveScroll"),om=p.forwardRef((e,t)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:a,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:v,hideWhenDetached:g,avoidCollisions:x,...b}=e,y=Nn(Hn,n),[k,j]=p.useState(null),[C,T]=p.useState(null),N=De(t,ae=>j(ae)),[O,A]=p.useState(null),[z,D]=p.useState(null),E=di(n),[L,w]=p.useState(!1),$=p.useRef(!1);p.useEffect(()=>{if(k)return Op(k)},[k]),Sp();const ee=p.useCallback(ae=>{const[ge,...xe]=E().map(Se=>Se.ref.current),[he]=xe.slice(-1),be=document.activeElement;for(const Se of ae)if(Se===be||(Se?.scrollIntoView({block:"nearest"}),Se===ge&&C&&(C.scrollTop=0),Se===he&&C&&(C.scrollTop=C.scrollHeight),Se?.focus(),document.activeElement!==be))return},[E,C]),F=p.useCallback(()=>ee([O,k]),[ee,O,k]);p.useEffect(()=>{L&&F()},[L,F]);const{onOpenChange:W,triggerPointerDownPosRef:Z}=y;p.useEffect(()=>{if(k){let ae={x:0,y:0};const ge=he=>{ae={x:Math.abs(Math.round(he.pageX)-(Z.current?.x??0)),y:Math.abs(Math.round(he.pageY)-(Z.current?.y??0))}},xe=he=>{ae.x<=10&&ae.y<=10?he.preventDefault():k.contains(he.target)||W(!1),document.removeEventListener("pointermove",ge),Z.current=null};return Z.current!==null&&(document.addEventListener("pointermove",ge),document.addEventListener("pointerup",xe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ge),document.removeEventListener("pointerup",xe,{capture:!0})}}},[k,W,Z]),p.useEffect(()=>{const ae=()=>W(!1);return window.addEventListener("blur",ae),window.addEventListener("resize",ae),()=>{window.removeEventListener("blur",ae),window.removeEventListener("resize",ae)}},[W]);const[ue,V]=ym(ae=>{const ge=E().filter(be=>!be.disabled),xe=ge.find(be=>be.ref.current===document.activeElement),he=wm(ge,ae,xe);he&&setTimeout(()=>he.ref.current.focus())}),H=p.useCallback((ae,ge,xe)=>{const he=!$.current&&!xe;(y.value!==void 0&&y.value===ge||he)&&(A(ae),he&&($.current=!0))},[y.value]),le=p.useCallback(()=>k?.focus(),[k]),U=p.useCallback((ae,ge,xe)=>{const he=!$.current&&!xe;(y.value!==void 0&&y.value===ge||he)&&D(ae)},[y.value]),X=s==="popper"?Sa:im,Ce=X===Sa?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:v,hideWhenDetached:g,avoidCollisions:x}:{};return r.jsx(rm,{scope:n,content:k,viewport:C,onViewportChange:T,itemRefCallback:H,selectedItem:O,onItemLeave:le,itemTextRefCallback:U,focusSelectedItem:F,selectedItemText:z,position:s,isPositioned:L,searchRef:ue,children:r.jsx(Il,{as:pN,allowPinchZoom:!0,children:r.jsx(Rl,{asChild:!0,trapped:y.open,onMountAutoFocus:ae=>{ae.preventDefault()},onUnmountAutoFocus:Te(o,ae=>{y.trigger?.focus({preventScroll:!0}),ae.preventDefault()}),children:r.jsx(Go,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:ae=>ae.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:r.jsx(X,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:ae=>ae.preventDefault(),...b,...Ce,onPlaced:()=>w(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Te(b.onKeyDown,ae=>{const ge=ae.ctrlKey||ae.altKey||ae.metaKey;if(ae.key==="Tab"&&ae.preventDefault(),!ge&&ae.key.length===1&&V(ae.key),["ArrowUp","ArrowDown","Home","End"].includes(ae.key)){let he=E().filter(be=>!be.disabled).map(be=>be.ref.current);if(["ArrowUp","End"].includes(ae.key)&&(he=he.slice().reverse()),["ArrowUp","ArrowDown"].includes(ae.key)){const be=ae.target,Se=he.indexOf(be);he=he.slice(Se+1)}setTimeout(()=>ee(he)),ae.preventDefault()}})})})})})})});om.displayName=fN;var hN="SelectItemAlignedPosition",im=p.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...o}=e,i=Nn(Hn,n),a=Tn(Hn,n),[l,c]=p.useState(null),[u,d]=p.useState(null),f=De(t,N=>d(N)),h=di(n),m=p.useRef(!1),v=p.useRef(!0),{viewport:g,selectedItem:x,selectedItemText:b,focusSelectedItem:y}=a,k=p.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&g&&x&&b){const N=i.trigger.getBoundingClientRect(),O=u.getBoundingClientRect(),A=i.valueNode.getBoundingClientRect(),z=b.getBoundingClientRect();if(i.dir!=="rtl"){const be=z.left-O.left,Se=A.left-be,Ie=N.left-Se,_=N.width+Ie,Q=Math.max(_,O.width),G=window.innerWidth-Mt,P=ja(Se,[Mt,Math.max(Mt,G-Q)]);l.style.minWidth=_+"px",l.style.left=P+"px"}else{const be=O.right-z.right,Se=window.innerWidth-A.right-be,Ie=window.innerWidth-N.right-Se,_=N.width+Ie,Q=Math.max(_,O.width),G=window.innerWidth-Mt,P=ja(Se,[Mt,Math.max(Mt,G-Q)]);l.style.minWidth=_+"px",l.style.right=P+"px"}const D=h(),E=window.innerHeight-Mt*2,L=g.scrollHeight,w=window.getComputedStyle(u),$=parseInt(w.borderTopWidth,10),ee=parseInt(w.paddingTop,10),F=parseInt(w.borderBottomWidth,10),W=parseInt(w.paddingBottom,10),Z=$+ee+L+W+F,ue=Math.min(x.offsetHeight*5,Z),V=window.getComputedStyle(g),H=parseInt(V.paddingTop,10),le=parseInt(V.paddingBottom,10),U=N.top+N.height/2-Mt,X=E-U,Ce=x.offsetHeight/2,ae=x.offsetTop+Ce,ge=$+ee+ae,xe=Z-ge;if(ge<=U){const be=D.length>0&&x===D[D.length-1].ref.current;l.style.bottom="0px";const Se=u.clientHeight-g.offsetTop-g.offsetHeight,Ie=Math.max(X,Ce+(be?le:0)+Se+F),_=ge+Ie;l.style.height=_+"px"}else{const be=D.length>0&&x===D[0].ref.current;l.style.top="0px";const Ie=Math.max(U,$+g.offsetTop+(be?H:0)+Ce)+xe;l.style.height=Ie+"px",g.scrollTop=ge-U+g.offsetTop}l.style.margin=`${Mt}px 0`,l.style.minHeight=ue+"px",l.style.maxHeight=E+"px",s?.(),requestAnimationFrame(()=>m.current=!0)}},[h,i.trigger,i.valueNode,l,u,g,x,b,i.dir,s]);tt(()=>k(),[k]);const[j,C]=p.useState();tt(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const T=p.useCallback(N=>{N&&v.current===!0&&(k(),y?.(),v.current=!1)},[k,y]);return r.jsx(gN,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:m,onScrollButtonChange:T,children:r.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:j},children:r.jsx(ze.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});im.displayName=hN;var mN="SelectPopperPosition",Sa=p.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:o=Mt,...i}=e,a=fi(n);return r.jsx(Eh,{...a,...i,ref:t,align:s,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Sa.displayName=mN;var[gN,Xl]=Ps(Hn,{}),Ca="SelectViewport",am=p.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...o}=e,i=Tn(Ca,n),a=Xl(Ca,n),l=De(t,i.onViewportChange),c=p.useRef(0);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),r.jsx(ui.Slot,{scope:n,children:r.jsx(ze.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Te(o.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=a;if(h?.current&&f){const m=Math.abs(c.current-d.scrollTop);if(m>0){const v=window.innerHeight-Mt*2,g=parseFloat(f.style.minHeight),x=parseFloat(f.style.height),b=Math.max(g,x);if(b<v){const y=b+m,k=Math.min(v,y),j=y-k;f.style.height=k+"px",f.style.bottom==="0px"&&(d.scrollTop=j>0?j:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});am.displayName=Ca;var lm="SelectGroup",[xN,bN]=Ps(lm),vN=p.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=Zt();return r.jsx(xN,{scope:n,id:o,children:r.jsx(ze.div,{role:"group","aria-labelledby":o,...s,ref:t})})});vN.displayName=lm;var cm="SelectLabel",yN=p.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=bN(cm,n);return r.jsx(ze.div,{id:o.id,...s,ref:t})});yN.displayName=cm;var So="SelectItem",[wN,um]=Ps(So),dm=p.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:o=!1,textValue:i,...a}=e,l=Nn(So,n),c=Tn(So,n),u=l.value===s,[d,f]=p.useState(i??""),[h,m]=p.useState(!1),v=De(t,y=>c.itemRefCallback?.(y,s,o)),g=Zt(),x=p.useRef("touch"),b=()=>{o||(l.onValueChange(s),l.onOpenChange(!1))};if(s==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return r.jsx(wN,{scope:n,value:s,disabled:o,textId:g,isSelected:u,onItemTextChange:p.useCallback(y=>{f(k=>k||(y?.textContent??"").trim())},[]),children:r.jsx(ui.ItemSlot,{scope:n,value:s,disabled:o,textValue:d,children:r.jsx(ze.div,{role:"option","aria-labelledby":g,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...a,ref:v,onFocus:Te(a.onFocus,()=>m(!0)),onBlur:Te(a.onBlur,()=>m(!1)),onClick:Te(a.onClick,()=>{x.current!=="mouse"&&b()}),onPointerUp:Te(a.onPointerUp,()=>{x.current==="mouse"&&b()}),onPointerDown:Te(a.onPointerDown,y=>{x.current=y.pointerType}),onPointerMove:Te(a.onPointerMove,y=>{x.current=y.pointerType,o?c.onItemLeave?.():x.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Te(a.onPointerLeave,y=>{y.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:Te(a.onKeyDown,y=>{c.searchRef?.current!==""&&y.key===" "||(oN.includes(y.key)&&b(),y.key===" "&&y.preventDefault())})})})})});dm.displayName=So;var Zs="SelectItemText",fm=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:o,...i}=e,a=Nn(Zs,n),l=Tn(Zs,n),c=um(Zs,n),u=cN(Zs,n),[d,f]=p.useState(null),h=De(t,b=>f(b),c.onItemTextChange,b=>l.itemTextRefCallback?.(b,c.value,c.disabled)),m=d?.textContent,v=p.useMemo(()=>r.jsx("option",{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:x}=u;return tt(()=>(g(v),()=>x(v)),[g,x,v]),r.jsxs(r.Fragment,{children:[r.jsx(ze.span,{id:c.textId,...i,ref:h}),c.isSelected&&a.valueNode&&!a.valueNodeHasChildren?cr.createPortal(i.children,a.valueNode):null]})});fm.displayName=Zs;var pm="SelectItemIndicator",hm=p.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return um(pm,n).isSelected?r.jsx(ze.span,{"aria-hidden":!0,...s,ref:t}):null});hm.displayName=pm;var Na="SelectScrollUpButton",mm=p.forwardRef((e,t)=>{const n=Tn(Na,e.__scopeSelect),s=Xl(Na,e.__scopeSelect),[o,i]=p.useState(!1),a=De(t,s.onScrollButtonChange);return tt(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;i(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?r.jsx(xm,{...e,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});mm.displayName=Na;var Ta="SelectScrollDownButton",gm=p.forwardRef((e,t)=>{const n=Tn(Ta,e.__scopeSelect),s=Xl(Ta,e.__scopeSelect),[o,i]=p.useState(!1),a=De(t,s.onScrollButtonChange);return tt(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;i(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?r.jsx(xm,{...e,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});gm.displayName=Ta;var xm=p.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...o}=e,i=Tn("SelectScrollButton",n),a=p.useRef(null),l=di(n),c=p.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return p.useEffect(()=>()=>c(),[c]),tt(()=>{l().find(d=>d.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),r.jsx(ze.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:Te(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(s,50))}),onPointerMove:Te(o.onPointerMove,()=>{i.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(s,50))}),onPointerLeave:Te(o.onPointerLeave,()=>{c()})})}),_N="SelectSeparator",kN=p.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return r.jsx(ze.div,{"aria-hidden":!0,...s,ref:t})});kN.displayName=_N;var Ea="SelectArrow",jN=p.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=fi(n),i=Nn(Ea,n),a=Tn(Ea,n);return i.open&&a.position==="popper"?r.jsx(Ah,{...o,...s,ref:t}):null});jN.displayName=Ea;var SN="SelectBubbleInput",bm=p.forwardRef(({__scopeSelect:e,value:t,...n},s)=>{const o=p.useRef(null),i=De(s,o),a=dS(t);return p.useEffect(()=>{const l=o.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==t&&d){const f=new Event("change",{bubbles:!0});d.call(l,t),l.dispatchEvent(f)}},[a,t]),r.jsx(ze.select,{...n,style:{...Qp,...n.style},ref:i,defaultValue:t})});bm.displayName=SN;function vm(e){return e===""||e===void 0}function ym(e){const t=ft(e),n=p.useRef(""),s=p.useRef(0),o=p.useCallback(a=>{const l=n.current+a;t(l),(function c(u){n.current=u,window.clearTimeout(s.current),u!==""&&(s.current=window.setTimeout(()=>c(""),1e3))})(l)},[t]),i=p.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return p.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,o,i]}function wm(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let a=CN(e,Math.max(i,0));o.length===1&&(a=a.filter(u=>u!==n));const c=a.find(u=>u.textValue.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function CN(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var NN=Jh,TN=Xh,EN=em,AN=tm,RN=nm,IN=sm,zN=am,ON=dm,PN=fm,MN=hm,LN=mm,DN=gm,pi="Tabs",[$N]=cn(pi,[Ih]),_m=Ih(),[FN,Ql]=$N(pi),km=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:o,defaultValue:i,orientation:a="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=ni(l),[f,h]=Fn({prop:s,onChange:o,defaultProp:i??"",caller:pi});return r.jsx(FN,{scope:n,baseId:Zt(),value:f,onValueChange:h,orientation:a,dir:d,activationMode:c,children:r.jsx(ze.div,{dir:d,"data-orientation":a,...u,ref:t})})});km.displayName=pi;var jm="TabsList",Sm=p.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...o}=e,i=Ql(jm,n),a=_m(n);return r.jsx(UC,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:s,children:r.jsx(ze.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});Sm.displayName=jm;var Cm="TabsTrigger",Nm=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:o=!1,...i}=e,a=Ql(Cm,n),l=_m(n),c=Am(a.baseId,s),u=Rm(a.baseId,s),d=s===a.value;return r.jsx(WC,{asChild:!0,...l,focusable:!o,active:d,children:r.jsx(ze.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...i,ref:t,onMouseDown:Te(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?a.onValueChange(s):f.preventDefault()}),onKeyDown:Te(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&a.onValueChange(s)}),onFocus:Te(e.onFocus,()=>{const f=a.activationMode!=="manual";!d&&!o&&f&&a.onValueChange(s)})})})});Nm.displayName=Cm;var Tm="TabsContent",Em=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:o,children:i,...a}=e,l=Ql(Tm,n),c=Am(l.baseId,s),u=Rm(l.baseId,s),d=s===l.value,f=p.useRef(d);return p.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),r.jsx(Rt,{present:o||d,children:({present:h})=>r.jsx(ze.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:u,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:h&&i})})});Em.displayName=Tm;function Am(e,t){return`${e}-trigger-${t}`}function Rm(e,t){return`${e}-content-${t}`}var BN=km,UN=Sm,WN=Nm,HN=Em,[hi]=cn("Tooltip",[ai]),mi=ai(),Im="TooltipProvider",VN=700,Aa="tooltip.open",[qN,ec]=hi(Im),zm=e=>{const{__scopeTooltip:t,delayDuration:n=VN,skipDelayDuration:s=300,disableHoverableContent:o=!1,children:i}=e,a=p.useRef(!0),l=p.useRef(!1),c=p.useRef(0);return p.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),r.jsx(qN,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(c.current),a.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,s)},[s]),isPointerInTransitRef:l,onPointerInTransitChange:p.useCallback(u=>{l.current=u},[]),disableHoverableContent:o,children:i})};zm.displayName=Im;var sr="Tooltip",[ZN,mr]=hi(sr),Om=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:o,onOpenChange:i,disableHoverableContent:a,delayDuration:l}=e,c=ec(sr,e.__scopeTooltip),u=mi(t),[d,f]=p.useState(null),h=Zt(),m=p.useRef(0),v=a??c.disableHoverableContent,g=l??c.delayDuration,x=p.useRef(!1),[b,y]=Fn({prop:s,defaultProp:o??!1,onChange:N=>{N?(c.onOpen(),document.dispatchEvent(new CustomEvent(Aa))):c.onClose(),i?.(N)},caller:sr}),k=p.useMemo(()=>b?x.current?"delayed-open":"instant-open":"closed",[b]),j=p.useCallback(()=>{window.clearTimeout(m.current),m.current=0,x.current=!1,y(!0)},[y]),C=p.useCallback(()=>{window.clearTimeout(m.current),m.current=0,y(!1)},[y]),T=p.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{x.current=!0,y(!0),m.current=0},g)},[g,y]);return p.useEffect(()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)},[]),r.jsx(Nh,{...u,children:r.jsx(ZN,{scope:t,contentId:h,open:b,stateAttribute:k,trigger:d,onTriggerChange:f,onTriggerEnter:p.useCallback(()=>{c.isOpenDelayedRef.current?T():j()},[c.isOpenDelayedRef,T,j]),onTriggerLeave:p.useCallback(()=>{v?C():(window.clearTimeout(m.current),m.current=0)},[C,v]),onOpen:j,onClose:C,disableHoverableContent:v,children:n})})};Om.displayName=sr;var Ra="TooltipTrigger",Pm=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,o=mr(Ra,n),i=ec(Ra,n),a=mi(n),l=p.useRef(null),c=De(t,l,o.onTriggerChange),u=p.useRef(!1),d=p.useRef(!1),f=p.useCallback(()=>u.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),r.jsx(Th,{asChild:!0,...a,children:r.jsx(ze.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...s,ref:c,onPointerMove:Te(e.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:Te(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:Te(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Te(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:Te(e.onBlur,o.onClose),onClick:Te(e.onClick,o.onClose)})})});Pm.displayName=Ra;var tc="TooltipPortal",[GN,KN]=hi(tc,{forceMount:void 0}),Mm=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:o}=e,i=mr(tc,t);return r.jsx(GN,{scope:t,forceMount:n,children:r.jsx(Rt,{present:n||i.open,children:r.jsx(Ko,{asChild:!0,container:o,children:s})})})};Mm.displayName=tc;var Cs="TooltipContent",Lm=p.forwardRef((e,t)=>{const n=KN(Cs,e.__scopeTooltip),{forceMount:s=n.forceMount,side:o="top",...i}=e,a=mr(Cs,e.__scopeTooltip);return r.jsx(Rt,{present:s||a.open,children:a.disableHoverableContent?r.jsx(Dm,{side:o,...i,ref:t}):r.jsx(JN,{side:o,...i,ref:t})})}),JN=p.forwardRef((e,t)=>{const n=mr(Cs,e.__scopeTooltip),s=ec(Cs,e.__scopeTooltip),o=p.useRef(null),i=De(t,o),[a,l]=p.useState(null),{trigger:c,onClose:u}=n,d=o.current,{onPointerInTransitChange:f}=s,h=p.useCallback(()=>{l(null),f(!1)},[f]),m=p.useCallback((v,g)=>{const x=v.currentTarget,b={x:v.clientX,y:v.clientY},y=e3(b,x.getBoundingClientRect()),k=t3(b,y),j=n3(g.getBoundingClientRect()),C=r3([...k,...j]);l(C),f(!0)},[f]);return p.useEffect(()=>()=>h(),[h]),p.useEffect(()=>{if(c&&d){const v=x=>m(x,d),g=x=>m(x,c);return c.addEventListener("pointerleave",v),d.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",v),d.removeEventListener("pointerleave",g)}}},[c,d,m,h]),p.useEffect(()=>{if(a){const v=g=>{const x=g.target,b={x:g.clientX,y:g.clientY},y=c?.contains(x)||d?.contains(x),k=!s3(b,a);y?h():k&&(h(),u())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[c,d,a,u,h]),r.jsx(Dm,{...e,ref:i})}),[YN,XN]=hi(sr,{isInside:!1}),QN=t5("TooltipContent"),Dm=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...l}=e,c=mr(Cs,n),u=mi(n),{onClose:d}=c;return p.useEffect(()=>(document.addEventListener(Aa,d),()=>document.removeEventListener(Aa,d)),[d]),p.useEffect(()=>{if(c.trigger){const f=h=>{h.target?.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),r.jsx(Go,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:r.jsxs(Eh,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[r.jsx(QN,{children:s}),r.jsx(YN,{scope:n,isInside:!0,children:r.jsx(oS,{id:c.contentId,role:"tooltip",children:o||s})})]})})});Lm.displayName=Cs;var $m="TooltipArrow",Fm=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,o=mi(n);return XN($m,n).isInside?null:r.jsx(Ah,{...o,...s,ref:t})});Fm.displayName=$m;function e3(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,s,o,i)){case i:return"left";case o:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function t3(e,t,n=5){const s=[];switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function n3(e){const{top:t,right:n,bottom:s,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:s},{x:o,y:s}]}function s3(e,t){const{x:n,y:s}=e;let o=!1;for(let i=0,a=t.length-1;i<t.length;a=i++){const l=t[i],c=t[a],u=l.x,d=l.y,f=c.x,h=c.y;d>s!=h>s&&n<(f-u)*(s-d)/(h-d)+u&&(o=!o)}return o}function r3(e){const t=e.slice();return t.sort((n,s)=>n.x<s.x?-1:n.x>s.x?1:n.y<s.y?-1:n.y>s.y?1:0),o3(t)}function o3(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const o=e[s];for(;t.length>=2;){const i=t[t.length-1],a=t[t.length-2];if((i.x-a.x)*(o.y-a.y)>=(i.y-a.y)*(o.x-a.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const o=e[s];for(;n.length>=2;){const i=n[n.length-1],a=n[n.length-2];if((i.x-a.x)*(o.y-a.y)>=(i.y-a.y)*(o.x-a.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var i3=zm,a3=Om,l3=Pm,c3=Mm,u3=Lm,d3=Fm;function jn({delayDuration:e=600,...t}){return r.jsx(i3,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function ct({...e}){return r.jsx(a3,{"data-slot":"tooltip",...e})}function ut({...e}){return r.jsx(l3,{"data-slot":"tooltip-trigger",...e})}function dt({className:e,sideOffset:t=0,children:n,...s}){return r.jsx(c3,{children:r.jsxs(u3,{"data-slot":"tooltip-content",sideOffset:t,className:ie("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),...s,children:[n,r.jsx(d3,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const f3=3;function p3({items:e,ariaLabel:t,className:n}){if(e.length===0)return r.jsx("span",{className:ie("flex h-8 w-12 shrink-0 items-center",n),"aria-hidden":"true"});const s=e.slice(0,f3),o=e.length-s.length;return r.jsx(jn,{delayDuration:150,children:r.jsxs("span",{className:ie("flex h-8 w-12 shrink-0 items-center",n),"aria-label":t,children:[s.map((i,a)=>r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsx("span",{className:ie("border border-border bg-muted/40 inline-flex size-6 shrink-0 items-center justify-center rounded-md",a>0&&"-ml-2"),children:r.jsx(sS,{provider:i.provider,className:"size-4"})})}),r.jsx(dt,{children:i.tooltip})]},`${i.provider}-${String(a)}`)),o>0&&r.jsxs("span",{className:"border border-border bg-muted/40 -ml-2 inline-flex h-6 min-w-6 shrink-0 items-center justify-center rounded-md px-1 font-mono text-[10px] text-muted-foreground",children:["+",o]})]})})}const h3="/v1/chat/completions",m3="/chat/completions",g3="/v1/responses",x3="/responses",b3="/v1/messages";class v3{handlers=new Map;pathMap=new Map;register(t){this.handlers.set(t.format,t)}registerPath(t,n){this.pathMap.set(t,n)}get(t){return this.handlers.get(t)}getByPath(t){const n=t.split("?")[0]??"",s=this.pathMap.get(n);return s===void 0?void 0:this.handlers.get(s)}getApiFormatByPath(t){const n=t.split("?")[0]??"";return this.pathMap.get(n)}detectFormat(t){if(t===null)return"unknown";for(const n of this.handlers.values())if(n.detectFormat(t))return n.format;return"unknown"}}const En=new v3;function y3(e){return En.getApiFormatByPath(e)??"unknown"}En.registerPath(b3,"anthropic");En.registerPath(h3,"openai");En.registerPath(m3,"openai");En.registerPath(g3,"openai");En.registerPath(x3,"openai");function w3(e){if(e==="")return{};try{const t=JSON.parse(e);return t!==null&&typeof t=="object"&&!Array.isArray(t)?{...t}:{}}catch{return{}}}function _3(e){switch(e.type){case"text":return{type:"text",text:e.text};case"thinking":{const t={type:"thinking",thinking:e.thinking};return e.signature!==""&&(t.signature=e.signature),t}case"think":{const t={type:"think",thinking:e.thinking};return e.signature!==""&&(t.signature=e.signature),t}case"tool_use":return{type:"tool_use",id:e.id,name:e.name,input:w3(e.inputJson)}}}function Bm(e,t,n,s){const o=new Map;let i="",a="",l=null,c=null,u=0,d=0;const f=1e3;let h=0,m=0;const v=[];for(const x of e.split(`
|
|
86
|
-
`)){const b=x.trim();if(b.startsWith("data: "))try{const y=JSON.parse(b.slice(6)),k=_2.safeParse(y);if(!k.success)continue;const j=k.data;switch(h===0&&(m=Date.now()),s===!0&&v.length<f&&v.push({index:h,timestamp:Date.now()-m,type:j.type,data:j}),h++,j.type){case"message_start":i=j.message.id,a=j.message.model,u=j.message.usage.input_tokens,t.inputTokens=u,t.cacheCreationInputTokens=j.message.usage.cache_creation_input_tokens??null,t.cacheReadInputTokens=j.message.usage.cache_read_input_tokens??null,t.model===null&&(t.model=a);break;case"content_block_start":{const C=j.content_block;switch(C.type){case"text":o.set(j.index,{type:"text",text:C.text??""});break;case"thinking":o.set(j.index,{type:"thinking",thinking:C.thinking??"",signature:C.signature??""});break;case"think":o.set(j.index,{type:"think",thinking:C.thinking??"",signature:C.signature??""});break;case"tool_use":o.set(j.index,{type:"tool_use",id:C.id,name:C.name,inputJson:""});break}break}case"content_block_delta":{const C=o.get(j.index);if(C===void 0)break;const T=j.delta;T.type==="text_delta"&&C.type==="text"?C.text+=T.text:T.type==="thinking_delta"&&(C.type==="thinking"||C.type==="think")?C.thinking+=T.thinking:T.type==="signature_delta"&&(C.type==="thinking"||C.type==="think")?C.signature+=T.signature:T.type==="input_json_delta"&&C.type==="tool_use"&&(C.inputJson+=T.partial_json);break}case"message_delta":l=j.delta.stop_reason,c=j.delta.stop_sequence??null,d=j.usage.output_tokens,t.outputTokens=d,j.usage.cache_creation_input_tokens!==void 0&&(t.cacheCreationInputTokens=j.usage.cache_creation_input_tokens),j.usage.cache_read_input_tokens!==void 0&&(t.cacheReadInputTokens=j.usage.cache_read_input_tokens);break;case"error":t.error=j.error.message;break;case"content_block_stop":case"message_stop":case"ping":break}}catch{}}s===!0&&(t.streamingChunks={chunks:v,truncated:h>f});const g=[...o.entries()].sort(([x],[b])=>x-b).map(([,x])=>
|
|
85
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},_j="DialogDescriptionWarning",kj=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Yp(_j).contentName}}.`;return p.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},jj=Lp,Sj=$p,Cj=Bp,Nj=Up,Tj=Wp,Ej=Vp,Aj=Zp,Rj=Kp;function Gn({...e}){return r.jsx(jj,{"data-slot":"dialog",...e})}function Xo({...e}){return r.jsx(Sj,{"data-slot":"dialog-trigger",...e})}function Ij({...e}){return r.jsx(Cj,{"data-slot":"dialog-portal",...e})}function zj({className:e,...t}){return r.jsx(Nj,{"data-slot":"dialog-overlay",className:ie("fixed inset-0 z-40 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t})}function Kn({className:e,children:t,...n}){return r.jsxs(Ij,{children:[r.jsx(zj,{}),r.jsxs(Tj,{"data-slot":"dialog-content",className:ie("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",e),...n,children:[t,r.jsxs(Rj,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[r.jsx(gr,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Jn({className:e,...t}){return r.jsx("div",{"data-slot":"dialog-header",className:ie("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function Yn({className:e,...t}){return r.jsx(Ej,{"data-slot":"dialog-title",className:ie("text-lg font-semibold leading-none tracking-tight",e),...t})}function Xp({className:e,...t}){return r.jsx(Aj,{"data-slot":"dialog-description",className:ie("text-sm text-muted-foreground",e),...t})}const hu=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,mu=ap,Ll=(e,t)=>n=>{var s;if(t?.variants==null)return mu(e,n?.class,n?.className);const{variants:o,defaultVariants:i}=t,a=Object.keys(o).map(u=>{const d=n?.[u],f=i?.[u];if(d===null)return null;const h=hu(d)||hu(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||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((u,d)=>{let{class:f,className:h,...m}=d;return Object.entries(m).every(v=>{let[g,x]=v;return Array.isArray(x)?x.includes({...i,...l}[g]):{...i,...l}[g]===x})?[...u,f,h]:u},[]);return mu(e,a,c,n?.class,n?.className)},Pj=Ll("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function ke({className:e,variant:t,size:n,...s}){return r.jsx("button",{"data-slot":"button",className:ie(Pj({variant:t,size:n,className:e})),...s})}function Qp({open:e,onOpenChange:t,title:n,description:s,confirmLabel:o="Confirm",variant:i="default",onConfirm:a}){return r.jsx(Gn,{open:e,onOpenChange:t,children:r.jsxs(Kn,{children:[r.jsx(Jn,{children:r.jsx(Yn,{children:n})}),r.jsx("p",{className:"text-sm text-muted-foreground",children:s}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(ke,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Cancel"}),r.jsx(ke,{variant:i,size:"sm",onClick:()=>{a(),t(!1)},children:o})]})]})})}const Oj="data:image/svg+xml,%3csvg%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eClaude%20Code%3c/title%3e%3cpath%20clip-rule='evenodd'%20d='M20.998%2010.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6%2010.949h1.488V8.102H6v2.847zm10.51%200H18V8.102h-1.49v2.847z'%20fill='%23D97757'%20fill-rule='evenodd'%3e%3c/path%3e%3c/svg%3e",Mj="data:image/svg+xml,%3csvg%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eCodex%3c/title%3e%3cpath%20d='M19.503%200H4.496A4.496%204.496%200%20000%204.496v15.007A4.496%204.496%200%20004.496%2024h15.007A4.496%204.496%200%200024%2019.503V4.496A4.496%204.496%200%200019.503%200z'%20fill='%23fff'%3e%3c/path%3e%3cpath%20d='M9.064%203.344a4.578%204.578%200%20012.285-.312c1%20.115%201.891.54%202.673%201.275.01.01.024.017.037.021a.09.09%200%2000.043%200%204.55%204.55%200%20013.046.275l.047.022.116.057a4.581%204.581%200%20012.188%202.399c.209.51.313%201.041.315%201.595a4.24%204.24%200%2001-.134%201.223.123.123%200%2000.03.115c.594.607.988%201.33%201.183%202.17.289%201.425-.007%202.71-.887%203.854l-.136.166a4.548%204.548%200%2001-2.201%201.388.123.123%200%2000-.081.076c-.191.551-.383%201.023-.74%201.494-.9%201.187-2.222%201.846-3.711%201.838-1.187-.006-2.239-.44-3.157-1.302a.107.107%200%2000-.105-.024c-.388.125-.78.143-1.204.138a4.441%204.441%200%2001-1.945-.466%204.544%204.544%200%2001-1.61-1.335c-.152-.202-.303-.392-.414-.617a5.81%205.81%200%2001-.37-.961%204.582%204.582%200%2001-.014-2.298.124.124%200%2000.006-.056.085.085%200%2000-.027-.048%204.467%204.467%200%2001-1.034-1.651%203.896%203.896%200%2001-.251-1.192%205.189%205.189%200%2001.141-1.6c.337-1.112.982-1.985%201.933-2.618.212-.141.413-.251.601-.33.215-.089.43-.164.646-.227a.098.098%200%2000.065-.066%204.51%204.51%200%2001.829-1.615%204.535%204.535%200%20011.837-1.388zm3.482%2010.565a.637.637%200%20000%201.272h3.636a.637.637%200%20100-1.272h-3.636zM8.462%209.23a.637.637%200%2000-1.106.631l1.272%202.224-1.266%202.136a.636.636%200%20101.095.649l1.454-2.455a.636.636%200%2000.005-.64L8.462%209.23z'%20fill='url(%23lobe-icons-codex-_R_0_)'%3e%3c/path%3e%3cdefs%3e%3clinearGradient%20gradientUnits='userSpaceOnUse'%20id='lobe-icons-codex-_R_0_'%20x1='12'%20x2='12'%20y1='3'%20y2='21'%3e%3cstop%20stop-color='%23B1A7FF'%3e%3c/stop%3e%3cstop%20offset='.5'%20stop-color='%237A9DFF'%3e%3c/stop%3e%3cstop%20offset='1'%20stop-color='%233941FF'%3e%3c/stop%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",Lj="data:image/svg+xml,%3csvg%20fill='%237dd3fc'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eOpenCode%3c/title%3e%3cpath%20d='M16%206H8v12h8V6zm4%2016H4V2h16v20z'%3e%3c/path%3e%3c/svg%3e",Dj="data:image/svg+xml,%3csvg%20fill='%23ff6900'%20fill-rule='evenodd'%20height='1em'%20style='flex:none;line-height:1'%20viewBox='0%200%2024%2024'%20width='1em'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eMiMo%20Code%3c/title%3e%3cpath%20d='M.958%2015.936a.459.459%200%2001.459.44v2.729a.46.46%200%2001-.918%200v-2.729a.459.459%200%2001.459-.44zm4.814-2.035a.46.46%200%2001.553.45v4.754a.458.458%200%2011-.918%200V15.48L3.74%2017.202a.462.462%200%2001-.655.016.462.462%200%2001-.065-.082L.628%2014.67a.459.459%200%2001.658-.637l2.124%202.187%202.127-2.188a.46.46%200%2001.235-.13zm2.068.004a.46.46%200%2001.458.445v4.755a.46.46%200%2001-.458.458.459.459%200%2001-.458-.458V14.35a.459.459%200%2001.458-.445zm1.973%202.014a.46.46%200%2001.46.457v2.729a.46.46%200%2001-.784.324.46.46%200%2001-.134-.324v-2.729a.46.46%200%2001.458-.458zm.002-2.045a.458.458%200%2001.328.157l2.127%202.19%202.125-2.19a.459.459%200%2001.784.318v4.756a.46.46%200%2001-.455.458.46.46%200%2001-.458-.458V15.48l-1.667%201.723a.46.46%200%2001-.65.008l-.005-.005c0-.002-.002-.002-.004-.003l-2.455-2.534a.46.46%200%2001-.008-.667.461.461%200%2001.338-.128zm6.797%201.206a.46.46%200%2001.53.651A1.966%201.966%200%200019.81%2018.4a.462.462%200%2001.623.18.46.46%200%2001-.181.624%202.863%202.863%200%2001-1.38.353l-.142-.004a2.88%202.88%200%2001-2.393-4.263.461.461%200%2001.274-.21zm.864-.931a2.884%202.884%200%20013.915%203.914.46.46%200%2001-.402.24l-.057-.004a.458.458%200%2001-.164-.055.46.46%200%2001-.182-.622%201.967%201.967%200%2000-2.669-2.67.459.459%200%2011-.441-.803zM9.59%206.368c1.481%200%201.696%201.202%201.696%201.654v2.648h-.917v-.432c-.26.346-.792.535-1.36.535-.133%200-1.289-.03-1.384-1.136-.082-.932.675-1.61%202.053-1.61h.691c0-.563-.367-.886-.983-.886-.44.013-.864.174-1.2.458l-.36-.664c.484-.379%201.012-.567%201.764-.567zm4.427.1c1.263%200%202.082.97%202.083%202.15%200%201.181-.824%202.154-2.083%202.154-1.26%200-2.084-.972-2.084-2.152%200-1.18.82-2.153%202.084-2.153zm6.801.015c.68%200%201.202.465%201.197%201.548v2.642H21.1V8.29c0-.312-.002-.98-.63-.98s-.628.667-.628.838v2.524h-.89V8.148c0-.17-.001-.838-.63-.838-.628%200-.628.668-.628.98v2.383h-.917v-4.03h.917V7a1.22%201.22%200%2001.947-.516c.398%200%20.76.193.982.686a1.321%201.321%200%20011.195-.686zm-18.093.872l1.457-1.772H5.32L3.311%208.07l2.14%202.602H4.24L2.725%208.796%201.21%2010.672H0L2.138%208.07.13%205.583h1.138l1.458%201.772zm4.149%203.317h-.916V6.644h.916v4.028zm16.99%200h-.916V6.644h.916v4.028zM9.925%208.71c-1.055%200-1.359.412-1.326.742.032.329.324.537.757.537a1.013%201.013%200%20001.014-.968l.002-.31h-.447zM14.018%207.3c-.663%200-1.184.487-1.184%201.32%200%20.832.52%201.32%201.184%201.32.662%200%201.182-.49%201.182-1.32%200-.832-.52-1.32-1.182-1.32zM6.417%205.001a.568.568%200%2001.587.582.588.588%200%2001-1.175%200A.57.57%200%20016.417%205zm16.991%200a.57.57%200%2001.592.582.588.588%200%2001-1.174%200%20.57.57%200%2001.357-.542.572.572%200%2001.225-.04z'%3e%3c/path%3e%3c/svg%3e",$j="/assets/agent-inspector-58K1_MsC.ico",Fj={"agent-inspector":"Inspector",codex:"Codex",opencode:"OpenCode","mimo-code":"MiMo Code","claude-code":"Claude Code"};function Oi(e){return e?.toLowerCase()??""}function Us(e,t){for(const n of t)if(e.includes(n))return!0;return!1}function Dl(e){const t=[Oi(e.userAgent),Oi(e.conversationId),Oi(e.clientProjectFolder)].join(" ");return Us(t,["agent-inspector","agent inspector","provider-test"])?"agent-inspector":Us(t,["mimocode","mimo-code","mimo code"])?"mimo-code":Us(t,["opencode","open-code","open code"])?"opencode":Us(t,["claude-code","claude code","claudecode"])?"claude-code":Us(t,["codex desktop","codex-cli","openai-codex","codex"])?"codex":"unknown"}function Qo(e){switch(e){case"agent-inspector":case"codex":case"opencode":case"mimo-code":case"claude-code":return Fj[e];case"unknown":return null}}const Bj={"agent-inspector":$j,codex:Mj,opencode:Lj,"mimo-code":Dj,"claude-code":Oj},Uj={"agent-inspector":"border-orange-200/25 bg-orange-300/[0.12]",codex:"border-cyan-200/20 bg-cyan-300/[0.08]",opencode:"border-sky-200/25 bg-sky-300/[0.12]","mimo-code":"border-orange-200/25 bg-orange-400/[0.12]","claude-code":"border-amber-100/20 bg-amber-300/[0.09]"},Wj={"agent-inspector":"p-0.5 drop-shadow-[0_0_8px_rgba(251,146,60,0.35)]",codex:"p-0.5",opencode:"p-1 drop-shadow-[0_0_8px_rgba(125,211,252,0.35)]","mimo-code":"p-0.5 drop-shadow-[0_0_8px_rgba(255,105,0,0.35)]","claude-code":"p-0.5"};function ei({client:e,className:t}){if(e==="unknown")return null;const n=Qo(e);if(n===null)return null;const s=Bj[e];return r.jsx("span",{className:ie("inline-flex size-6 shrink-0 items-center justify-center rounded-md border p-0 shadow-sm",Uj[e],t),"aria-label":n,title:n,children:r.jsx("img",{src:s,alt:"",className:ie("size-full object-contain",Wj[e]),"aria-hidden":"true"})})}const Hj="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",Vj="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",qj="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",Zj="/assets/minimax-BPMzvuL-.jpeg",Gj="/assets/alibaba-TTwafVwX.svg",Kj="/assets/qwen-CONDcHqt.png",Jj="/assets/zhipuai-BPNAnxo-.svg",Yj={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen"};function Xj(e){return e.replace(/[_\s]+/g,"-").split(/[/:@]/).some(n=>n.startsWith("glm-"))}function Qj(e){if(e===null)return"unknown";const t=e.toLowerCase();if(Xj(t))return"zhipuai";for(const[n,s]of Object.entries(Yj))if(t.startsWith(n.toLowerCase()))return s;return"unknown"}const Xn={width:24,height:24,objectFit:"contain"},eS=mt.memo(({className:e})=>r.jsx("img",{src:Hj,alt:"Anthropic",className:e,style:Xn})),tS=mt.memo(({className:e})=>r.jsx("img",{src:Vj,alt:"OpenAI",className:e,style:{...Xn,background:"white",borderRadius:"4px"}})),nS=mt.memo(({className:e})=>r.jsx("img",{src:qj,alt:"DeepSeek",className:e,style:Xn})),sS=mt.memo(({className:e})=>r.jsx("img",{src:Zj,alt:"MiniMax",className:e,style:Xn})),rS=mt.memo(({className:e})=>r.jsx("img",{src:Gj,alt:"Alibaba",className:e,style:Xn})),oS=mt.memo(({className:e})=>r.jsx("img",{src:Kj,alt:"Qwen",className:e,style:Xn})),iS=mt.memo(({className:e})=>r.jsx("img",{src:Jj,alt:"ZhipuAI",className:e,style:Xn}));function aS({provider:e,className:t}){switch(e){case"anthropic":return r.jsx(eS,{className:t});case"openai":return r.jsx(tS,{className:t});case"deepseek":return r.jsx(nS,{className:t});case"minimax":return r.jsx(sS,{className:t});case"alibaba":return r.jsx(rS,{className:t});case"qwen":return r.jsx(oS,{className:t});case"zhipuai":return r.jsx(iS,{className:t});case"unknown":return null}}var eh=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"}),lS="VisuallyHidden",th=p.forwardRef((e,t)=>r.jsx(ze.span,{...e,ref:t,style:{...eh,...e.style}}));th.displayName=lS;var cS=th;function nh(e){const t=e+"CollectionProvider",[n,s]=cn(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=g=>{const{scope:x,children:b}=g,y=mt.useRef(null),k=mt.useRef(new Map).current;return r.jsx(o,{scope:x,itemMap:k,collectionRef:y,children:b})};a.displayName=t;const l=e+"CollectionSlot",c=ks(l),u=mt.forwardRef((g,x)=>{const{scope:b,children:y}=g,k=i(l,b),j=De(x,k.collectionRef);return r.jsx(c,{ref:j,children:y})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=ks(d),m=mt.forwardRef((g,x)=>{const{scope:b,children:y,...k}=g,j=mt.useRef(null),C=De(x,j),T=i(d,b);return mt.useEffect(()=>(T.itemMap.set(j,{ref:j,...k}),()=>{T.itemMap.delete(j)})),r.jsx(h,{[f]:"",ref:C,children:y})});m.displayName=d;function v(g){const x=i(e+"CollectionConsumer",g);return mt.useCallback(()=>{const y=x.collectionRef.current;if(!y)return[];const k=Array.from(y.querySelectorAll(`[${f}]`));return Array.from(x.itemMap.values()).sort((T,N)=>k.indexOf(T.ref.current)-k.indexOf(N.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:a,Slot:u,ItemSlot:m},v,s]}var ti="Collapsible",[uS]=cn(ti),[dS,$l]=uS(ti),sh=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:s,defaultOpen:o,disabled:i,onOpenChange:a,...l}=e,[c,u]=Fn({prop:s,defaultProp:o??!1,onChange:a,caller:ti});return r.jsx(dS,{scope:n,disabled:i,contentId:Zt(),open:c,onOpenToggle:p.useCallback(()=>u(d=>!d),[u]),children:r.jsx(ze.div,{"data-state":Bl(c),"data-disabled":i?"":void 0,...l,ref:t})})});sh.displayName=ti;var rh="CollapsibleTrigger",oh=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,...s}=e,o=$l(rh,n);return r.jsx(ze.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":Bl(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...s,ref:t,onClick:Te(e.onClick,o.onOpenToggle)})});oh.displayName=rh;var Fl="CollapsibleContent",ih=p.forwardRef((e,t)=>{const{forceMount:n,...s}=e,o=$l(Fl,e.__scopeCollapsible);return r.jsx(It,{present:n||o.open,children:({present:i})=>r.jsx(fS,{...s,ref:t,present:i})})});ih.displayName=Fl;var fS=p.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:s,children:o,...i}=e,a=$l(Fl,n),[l,c]=p.useState(s),u=p.useRef(null),d=De(t,u),f=p.useRef(0),h=f.current,m=p.useRef(0),v=m.current,g=a.open||l,x=p.useRef(g),b=p.useRef(void 0);return p.useEffect(()=>{const y=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(y)},[]),tt(()=>{const y=u.current;if(y){b.current=b.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";const k=y.getBoundingClientRect();f.current=k.height,m.current=k.width,x.current||(y.style.transitionDuration=b.current.transitionDuration,y.style.animationName=b.current.animationName),c(s)}},[a.open,s]),r.jsx(ze.div,{"data-state":Bl(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!g,...i,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...e.style},children:g&&o})});function Bl(e){return e?"open":"closed"}var pS=sh,hS=p.createContext(void 0);function ni(e){const t=p.useContext(hS);return e||t||"ltr"}function mS(e){const t=p.useRef({value:e,previous:e});return p.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function gS(e){const[t,n]=p.useState(void 0);return tt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let a,l;if("borderBoxSize"in i){const c=i.borderBoxSize,u=Array.isArray(c)?c[0]:c;a=u.inlineSize,l=u.blockSize}else a=e.offsetWidth,l=e.offsetHeight;n({width:a,height:l})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}const xS=["top","right","bottom","left"],_n=Math.min,wt=Math.max,ko=Math.round,Dr=Math.floor,Gt=e=>({x:e,y:e}),bS={left:"right",right:"left",bottom:"top",top:"bottom"},vS={start:"end",end:"start"};function ya(e,t,n){return wt(e,_n(t,n))}function on(e,t){return typeof e=="function"?e(t):e}function an(e){return e.split("-")[0]}function Ls(e){return e.split("-")[1]}function Ul(e){return e==="x"?"y":"x"}function Wl(e){return e==="y"?"height":"width"}const yS=new Set(["top","bottom"]);function Vt(e){return yS.has(an(e))?"y":"x"}function Hl(e){return Ul(Vt(e))}function wS(e,t,n){n===void 0&&(n=!1);const s=Ls(e),o=Hl(e),i=Wl(o);let a=o==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=jo(a)),[a,jo(a)]}function _S(e){const t=jo(e);return[wa(e),t,wa(t)]}function wa(e){return e.replace(/start|end/g,t=>vS[t])}const gu=["left","right"],xu=["right","left"],kS=["top","bottom"],jS=["bottom","top"];function SS(e,t,n){switch(e){case"top":case"bottom":return n?t?xu:gu:t?gu:xu;case"left":case"right":return t?kS:jS;default:return[]}}function CS(e,t,n,s){const o=Ls(e);let i=SS(an(e),n==="start",s);return o&&(i=i.map(a=>a+"-"+o),t&&(i=i.concat(i.map(wa)))),i}function jo(e){return e.replace(/left|right|bottom|top/g,t=>bS[t])}function NS(e){return{top:0,right:0,bottom:0,left:0,...e}}function ah(e){return typeof e!="number"?NS(e):{top:e,right:e,bottom:e,left:e}}function So(e){const{x:t,y:n,width:s,height:o}=e;return{width:s,height:o,top:n,left:t,right:t+s,bottom:n+o,x:t,y:n}}function bu(e,t,n){let{reference:s,floating:o}=e;const i=Vt(t),a=Hl(t),l=Wl(a),c=an(t),u=i==="y",d=s.x+s.width/2-o.width/2,f=s.y+s.height/2-o.height/2,h=s[l]/2-o[l]/2;let m;switch(c){case"top":m={x:d,y:s.y-o.height};break;case"bottom":m={x:d,y:s.y+s.height};break;case"right":m={x:s.x+s.width,y:f};break;case"left":m={x:s.x-o.width,y:f};break;default:m={x:s.x,y:s.y}}switch(Ls(t)){case"start":m[a]-=h*(n&&u?-1:1);break;case"end":m[a]+=h*(n&&u?-1:1);break}return m}async function TS(e,t){var n;t===void 0&&(t={});const{x:s,y:o,platform:i,rects:a,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:m=0}=on(t,e),v=ah(m),x=l[h?f==="floating"?"reference":"floating":f],b=So(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(x)))==null||n?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),y=f==="floating"?{x:s,y:o,width:a.floating.width,height:a.floating.height}:a.reference,k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),j=await(i.isElement==null?void 0:i.isElement(k))?await(i.getScale==null?void 0:i.getScale(k))||{x:1,y:1}:{x:1,y:1},C=So(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:k,strategy:c}):y);return{top:(b.top-C.top+v.top)/j.y,bottom:(C.bottom-b.bottom+v.bottom)/j.y,left:(b.left-C.left+v.left)/j.x,right:(C.right-b.right+v.right)/j.x}}const ES=async(e,t,n)=>{const{placement:s="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=i.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:f}=bu(u,s,c),h=s,m={},v=0;for(let x=0;x<l.length;x++){var g;const{name:b,fn:y}=l[x],{x:k,y:j,data:C,reset:T}=await y({x:d,y:f,initialPlacement:s,placement:h,strategy:o,middlewareData:m,rects:u,platform:{...a,detectOverflow:(g=a.detectOverflow)!=null?g:TS},elements:{reference:e,floating:t}});d=k??d,f=j??f,m={...m,[b]:{...m[b],...C}},T&&v<=50&&(v++,typeof T=="object"&&(T.placement&&(h=T.placement),T.rects&&(u=T.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):T.rects),{x:d,y:f}=bu(u,h,c)),x=-1)}return{x:d,y:f,placement:h,strategy:o,middlewareData:m}},AS=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:o,rects:i,platform:a,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=on(e,t)||{};if(u==null)return{};const f=ah(d),h={x:n,y:s},m=Hl(o),v=Wl(m),g=await a.getDimensions(u),x=m==="y",b=x?"top":"left",y=x?"bottom":"right",k=x?"clientHeight":"clientWidth",j=i.reference[v]+i.reference[m]-h[m]-i.floating[v],C=h[m]-i.reference[m],T=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let N=T?T[k]:0;(!N||!await(a.isElement==null?void 0:a.isElement(T)))&&(N=l.floating[k]||i.floating[v]);const P=j/2-C/2,A=N/2-g[v]/2-1,z=_n(f[b],A),D=_n(f[y],A),E=z,L=N-g[v]-D,w=N/2-g[v]/2+P,$=ya(E,w,L),ee=!c.arrow&&Ls(o)!=null&&w!==$&&i.reference[v]/2-(w<E?z:D)-g[v]/2<0,F=ee?w<E?w-E:w-L:0;return{[m]:h[m]+F,data:{[m]:$,centerOffset:w-$-F,...ee&&{alignmentOffset:F}},reset:ee}}}),RS=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:o,middlewareData:i,rects:a,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:g=!0,...x}=on(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=an(o),y=Vt(l),k=an(l)===l,j=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=h||(k||!g?[jo(l)]:_S(l)),T=v!=="none";!h&&T&&C.push(...CS(l,g,v,j));const N=[l,...C],P=await c.detectOverflow(t,x),A=[];let z=((s=i.flip)==null?void 0:s.overflows)||[];if(d&&A.push(P[b]),f){const w=wS(o,a,j);A.push(P[w[0]],P[w[1]])}if(z=[...z,{placement:o,overflows:A}],!A.every(w=>w<=0)){var D,E;const w=(((D=i.flip)==null?void 0:D.index)||0)+1,$=N[w];if($&&(!(f==="alignment"?y!==Vt($):!1)||z.every(W=>Vt(W.placement)===y?W.overflows[0]>0:!0)))return{data:{index:w,overflows:z},reset:{placement:$}};let ee=(E=z.filter(F=>F.overflows[0]<=0).sort((F,W)=>F.overflows[1]-W.overflows[1])[0])==null?void 0:E.placement;if(!ee)switch(m){case"bestFit":{var L;const F=(L=z.filter(W=>{if(T){const Z=Vt(W.placement);return Z===y||Z==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(Z=>Z>0).reduce((Z,ue)=>Z+ue,0)]).sort((W,Z)=>W[1]-Z[1])[0])==null?void 0:L[0];F&&(ee=F);break}case"initialPlacement":ee=l;break}if(o!==ee)return{reset:{placement:ee}}}return{}}}};function vu(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function yu(e){return xS.some(t=>e[t]>=0)}const IS=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:o="referenceHidden",...i}=on(e,t);switch(o){case"referenceHidden":{const a=await s.detectOverflow(t,{...i,elementContext:"reference"}),l=vu(a,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:yu(l)}}}case"escaped":{const a=await s.detectOverflow(t,{...i,altBoundary:!0}),l=vu(a,n.floating);return{data:{escapedOffsets:l,escaped:yu(l)}}}default:return{}}}}},lh=new Set(["left","top"]);async function zS(e,t){const{placement:n,platform:s,elements:o}=e,i=await(s.isRTL==null?void 0:s.isRTL(o.floating)),a=an(n),l=Ls(n),c=Vt(n)==="y",u=lh.has(a)?-1:1,d=i&&c?-1:1,f=on(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof v=="number"&&(m=l==="end"?v*-1:v),c?{x:m*d,y:h*u}:{x:h*u,y:m*d}}const PS=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:o,y:i,placement:a,middlewareData:l}=t,c=await zS(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(s=l.arrow)!=null&&s.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:a}}}}},OS=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:o,platform:i}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:b=>{let{x:y,y:k}=b;return{x:y,y:k}}},...u}=on(e,t),d={x:n,y:s},f=await i.detectOverflow(t,u),h=Vt(an(o)),m=Ul(h);let v=d[m],g=d[h];if(a){const b=m==="y"?"top":"left",y=m==="y"?"bottom":"right",k=v+f[b],j=v-f[y];v=ya(k,v,j)}if(l){const b=h==="y"?"top":"left",y=h==="y"?"bottom":"right",k=g+f[b],j=g-f[y];g=ya(k,g,j)}const x=c.fn({...t,[m]:v,[h]:g});return{...x,data:{x:x.x-n,y:x.y-s,enabled:{[m]:a,[h]:l}}}}}},MS=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:o,rects:i,middlewareData:a}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=on(e,t),d={x:n,y:s},f=Vt(o),h=Ul(f);let m=d[h],v=d[f];const g=on(l,t),x=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const k=h==="y"?"height":"width",j=i.reference[h]-i.floating[k]+x.mainAxis,C=i.reference[h]+i.reference[k]-x.mainAxis;m<j?m=j:m>C&&(m=C)}if(u){var b,y;const k=h==="y"?"width":"height",j=lh.has(an(o)),C=i.reference[f]-i.floating[k]+(j&&((b=a.offset)==null?void 0:b[f])||0)+(j?0:x.crossAxis),T=i.reference[f]+i.reference[k]+(j?0:((y=a.offset)==null?void 0:y[f])||0)-(j?x.crossAxis:0);v<C?v=C:v>T&&(v=T)}return{[h]:m,[f]:v}}}},LS=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:o,rects:i,platform:a,elements:l}=t,{apply:c=()=>{},...u}=on(e,t),d=await a.detectOverflow(t,u),f=an(o),h=Ls(o),m=Vt(o)==="y",{width:v,height:g}=i.floating;let x,b;f==="top"||f==="bottom"?(x=f,b=h===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(b=f,x=h==="end"?"top":"bottom");const y=g-d.top-d.bottom,k=v-d.left-d.right,j=_n(g-d[x],y),C=_n(v-d[b],k),T=!t.middlewareData.shift;let N=j,P=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=k),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(N=y),T&&!h){const z=wt(d.left,0),D=wt(d.right,0),E=wt(d.top,0),L=wt(d.bottom,0);m?P=v-2*(z!==0||D!==0?z+D:wt(d.left,d.right)):N=g-2*(E!==0||L!==0?E+L:wt(d.top,d.bottom))}await c({...t,availableWidth:P,availableHeight:N});const A=await a.getDimensions(l.floating);return v!==A.width||g!==A.height?{reset:{rects:!0}}:{}}}};function si(){return typeof window<"u"}function Ds(e){return ch(e)?(e.nodeName||"").toLowerCase():"#document"}function jt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Xt(e){var t;return(t=(ch(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ch(e){return si()?e instanceof Node||e instanceof jt(e).Node:!1}function Dt(e){return si()?e instanceof Element||e instanceof jt(e).Element:!1}function Kt(e){return si()?e instanceof HTMLElement||e instanceof jt(e).HTMLElement:!1}function wu(e){return!si()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof jt(e).ShadowRoot}const DS=new Set(["inline","contents"]);function xr(e){const{overflow:t,overflowX:n,overflowY:s,display:o}=$t(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!DS.has(o)}const $S=new Set(["table","td","th"]);function FS(e){return $S.has(Ds(e))}const BS=[":popover-open",":modal"];function ri(e){return BS.some(t=>{try{return e.matches(t)}catch{return!1}})}const US=["transform","translate","scale","rotate","perspective"],WS=["transform","translate","scale","rotate","perspective","filter"],HS=["paint","layout","strict","content"];function Vl(e){const t=ql(),n=Dt(e)?$t(e):e;return US.some(s=>n[s]?n[s]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||WS.some(s=>(n.willChange||"").includes(s))||HS.some(s=>(n.contain||"").includes(s))}function VS(e){let t=kn(e);for(;Kt(t)&&!js(t);){if(Vl(t))return t;if(ri(t))return null;t=kn(t)}return null}function ql(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const qS=new Set(["html","body","#document"]);function js(e){return qS.has(Ds(e))}function $t(e){return jt(e).getComputedStyle(e)}function oi(e){return Dt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function kn(e){if(Ds(e)==="html")return e;const t=e.assignedSlot||e.parentNode||wu(e)&&e.host||Xt(e);return wu(t)?t.host:t}function uh(e){const t=kn(e);return js(t)?e.ownerDocument?e.ownerDocument.body:e.body:Kt(t)&&xr(t)?t:uh(t)}function ir(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=uh(e),i=o===((s=e.ownerDocument)==null?void 0:s.body),a=jt(o);if(i){const l=_a(a);return t.concat(a,a.visualViewport||[],xr(o)?o:[],l&&n?ir(l):[])}return t.concat(o,ir(o,[],n))}function _a(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dh(e){const t=$t(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const o=Kt(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:s,l=ko(n)!==i||ko(s)!==a;return l&&(n=i,s=a),{width:n,height:s,$:l}}function Zl(e){return Dt(e)?e:e.contextElement}function gs(e){const t=Zl(e);if(!Kt(t))return Gt(1);const n=t.getBoundingClientRect(),{width:s,height:o,$:i}=dh(t);let a=(i?ko(n.width):n.width)/s,l=(i?ko(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const ZS=Gt(0);function fh(e){const t=jt(e);return!ql()||!t.visualViewport?ZS:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function GS(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==jt(e)?!1:t}function Un(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Zl(e);let a=Gt(1);t&&(s?Dt(s)&&(a=gs(s)):a=gs(e));const l=GS(i,n,s)?fh(i):Gt(0);let c=(o.left+l.x)/a.x,u=(o.top+l.y)/a.y,d=o.width/a.x,f=o.height/a.y;if(i){const h=jt(i),m=s&&Dt(s)?jt(s):s;let v=h,g=_a(v);for(;g&&s&&m!==v;){const x=gs(g),b=g.getBoundingClientRect(),y=$t(g),k=b.left+(g.clientLeft+parseFloat(y.paddingLeft))*x.x,j=b.top+(g.clientTop+parseFloat(y.paddingTop))*x.y;c*=x.x,u*=x.y,d*=x.x,f*=x.y,c+=k,u+=j,v=jt(g),g=_a(v)}}return So({width:d,height:f,x:c,y:u})}function ii(e,t){const n=oi(e).scrollLeft;return t?t.left+n:Un(Xt(e)).left+n}function ph(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-ii(e,n),o=n.top+t.scrollTop;return{x:s,y:o}}function KS(e){let{elements:t,rect:n,offsetParent:s,strategy:o}=e;const i=o==="fixed",a=Xt(s),l=t?ri(t.floating):!1;if(s===a||l&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Gt(1);const d=Gt(0),f=Kt(s);if((f||!f&&!i)&&((Ds(s)!=="body"||xr(a))&&(c=oi(s)),Kt(s))){const m=Un(s);u=gs(s),d.x=m.x+s.clientLeft,d.y=m.y+s.clientTop}const h=a&&!f&&!i?ph(a,c):Gt(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+h.x,y:n.y*u.y-c.scrollTop*u.y+d.y+h.y}}function JS(e){return Array.from(e.getClientRects())}function YS(e){const t=Xt(e),n=oi(e),s=e.ownerDocument.body,o=wt(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),i=wt(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let a=-n.scrollLeft+ii(e);const l=-n.scrollTop;return $t(s).direction==="rtl"&&(a+=wt(t.clientWidth,s.clientWidth)-o),{width:o,height:i,x:a,y:l}}const _u=25;function XS(e,t){const n=jt(e),s=Xt(e),o=n.visualViewport;let i=s.clientWidth,a=s.clientHeight,l=0,c=0;if(o){i=o.width,a=o.height;const d=ql();(!d||d&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}const u=ii(s);if(u<=0){const d=s.ownerDocument,f=d.body,h=getComputedStyle(f),m=d.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,v=Math.abs(s.clientWidth-f.clientWidth-m);v<=_u&&(i-=v)}else u<=_u&&(i+=u);return{width:i,height:a,x:l,y:c}}const QS=new Set(["absolute","fixed"]);function eC(e,t){const n=Un(e,!0,t==="fixed"),s=n.top+e.clientTop,o=n.left+e.clientLeft,i=Kt(e)?gs(e):Gt(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,c=o*i.x,u=s*i.y;return{width:a,height:l,x:c,y:u}}function ku(e,t,n){let s;if(t==="viewport")s=XS(e,n);else if(t==="document")s=YS(Xt(e));else if(Dt(t))s=eC(t,n);else{const o=fh(e);s={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return So(s)}function hh(e,t){const n=kn(e);return n===t||!Dt(n)||js(n)?!1:$t(n).position==="fixed"||hh(n,t)}function tC(e,t){const n=t.get(e);if(n)return n;let s=ir(e,[],!1).filter(l=>Dt(l)&&Ds(l)!=="body"),o=null;const i=$t(e).position==="fixed";let a=i?kn(e):e;for(;Dt(a)&&!js(a);){const l=$t(a),c=Vl(a);!c&&l.position==="fixed"&&(o=null),(i?!c&&!o:!c&&l.position==="static"&&!!o&&QS.has(o.position)||xr(a)&&!c&&hh(e,a))?s=s.filter(d=>d!==a):o=l,a=kn(a)}return t.set(e,s),s}function nC(e){let{element:t,boundary:n,rootBoundary:s,strategy:o}=e;const a=[...n==="clippingAncestors"?ri(t)?[]:tC(t,this._c):[].concat(n),s],l=a[0],c=a.reduce((u,d)=>{const f=ku(t,d,o);return u.top=wt(f.top,u.top),u.right=_n(f.right,u.right),u.bottom=_n(f.bottom,u.bottom),u.left=wt(f.left,u.left),u},ku(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function sC(e){const{width:t,height:n}=dh(e);return{width:t,height:n}}function rC(e,t,n){const s=Kt(t),o=Xt(t),i=n==="fixed",a=Un(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=Gt(0);function u(){c.x=ii(o)}if(s||!s&&!i)if((Ds(t)!=="body"||xr(o))&&(l=oi(t)),s){const m=Un(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else o&&u();i&&!s&&o&&u();const d=o&&!s&&!i?ph(o,l):Gt(0),f=a.left+l.scrollLeft-c.x-d.x,h=a.top+l.scrollTop-c.y-d.y;return{x:f,y:h,width:a.width,height:a.height}}function Mi(e){return $t(e).position==="static"}function ju(e,t){if(!Kt(e)||$t(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Xt(e)===n&&(n=n.ownerDocument.body),n}function mh(e,t){const n=jt(e);if(ri(e))return n;if(!Kt(e)){let o=kn(e);for(;o&&!js(o);){if(Dt(o)&&!Mi(o))return o;o=kn(o)}return n}let s=ju(e,t);for(;s&&FS(s)&&Mi(s);)s=ju(s,t);return s&&js(s)&&Mi(s)&&!Vl(s)?n:s||VS(e)||n}const oC=async function(e){const t=this.getOffsetParent||mh,n=this.getDimensions,s=await n(e.floating);return{reference:rC(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function iC(e){return $t(e).direction==="rtl"}const aC={convertOffsetParentRelativeRectToViewportRelativeRect:KS,getDocumentElement:Xt,getClippingRect:nC,getOffsetParent:mh,getElementRects:oC,getClientRects:JS,getDimensions:sC,getScale:gs,isElement:Dt,isRTL:iC};function gh(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function lC(e,t){let n=null,s;const o=Xt(e);function i(){var l;clearTimeout(s),(l=n)==null||l.disconnect(),n=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const u=e.getBoundingClientRect(),{left:d,top:f,width:h,height:m}=u;if(l||t(),!h||!m)return;const v=Dr(f),g=Dr(o.clientWidth-(d+h)),x=Dr(o.clientHeight-(f+m)),b=Dr(d),k={rootMargin:-v+"px "+-g+"px "+-x+"px "+-b+"px",threshold:wt(0,_n(1,c))||1};let j=!0;function C(T){const N=T[0].intersectionRatio;if(N!==c){if(!j)return a();N?a(!1,N):s=setTimeout(()=>{a(!1,1e-7)},1e3)}N===1&&!gh(u,e.getBoundingClientRect())&&a(),j=!1}try{n=new IntersectionObserver(C,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,k)}n.observe(e)}return a(!0),i}function cC(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,u=Zl(e),d=o||i?[...u?ir(u):[],...ir(t)]:[];d.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const f=u&&l?lC(u,n):null;let h=-1,m=null;a&&(m=new ResizeObserver(b=>{let[y]=b;y&&y.target===u&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var k;(k=m)==null||k.observe(t)})),n()}),u&&!c&&m.observe(u),m.observe(t));let v,g=c?Un(e):null;c&&x();function x(){const b=Un(e);g&&!gh(g,b)&&n(),g=b,v=requestAnimationFrame(x)}return n(),()=>{var b;d.forEach(y=>{o&&y.removeEventListener("scroll",n),i&&y.removeEventListener("resize",n)}),f?.(),(b=m)==null||b.disconnect(),m=null,c&&cancelAnimationFrame(v)}}const uC=PS,dC=OS,fC=RS,pC=LS,hC=IS,Su=AS,mC=MS,gC=(e,t,n)=>{const s=new Map,o={platform:aC,...n},i={...o.platform,_c:s};return ES(e,t,{...o,platform:i})};var xC=typeof document<"u",bC=function(){},ro=xC?p.useLayoutEffect:bC;function Co(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!Co(e[s],t[s]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,o[s]))return!1;for(s=n;s--!==0;){const i=o[s];if(!(i==="_owner"&&e.$$typeof)&&!Co(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function xh(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Cu(e,t){const n=xh(e);return Math.round(t*n)/n}function Li(e){const t=p.useRef(e);return ro(()=>{t.current=e}),t}function vC(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:o,elements:{reference:i,floating:a}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=p.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=p.useState(s);Co(h,s)||m(s);const[v,g]=p.useState(null),[x,b]=p.useState(null),y=p.useCallback(W=>{W!==T.current&&(T.current=W,g(W))},[]),k=p.useCallback(W=>{W!==N.current&&(N.current=W,b(W))},[]),j=i||v,C=a||x,T=p.useRef(null),N=p.useRef(null),P=p.useRef(d),A=c!=null,z=Li(c),D=Li(o),E=Li(u),L=p.useCallback(()=>{if(!T.current||!N.current)return;const W={placement:t,strategy:n,middleware:h};D.current&&(W.platform=D.current),gC(T.current,N.current,W).then(Z=>{const ue={...Z,isPositioned:E.current!==!1};w.current&&!Co(P.current,ue)&&(P.current=ue,pr.flushSync(()=>{f(ue)}))})},[h,t,n,D,E]);ro(()=>{u===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,f(W=>({...W,isPositioned:!1})))},[u]);const w=p.useRef(!1);ro(()=>(w.current=!0,()=>{w.current=!1}),[]),ro(()=>{if(j&&(T.current=j),C&&(N.current=C),j&&C){if(z.current)return z.current(j,C,L);L()}},[j,C,L,z,A]);const $=p.useMemo(()=>({reference:T,floating:N,setReference:y,setFloating:k}),[y,k]),ee=p.useMemo(()=>({reference:j,floating:C}),[j,C]),F=p.useMemo(()=>{const W={position:n,left:0,top:0};if(!ee.floating)return W;const Z=Cu(ee.floating,d.x),ue=Cu(ee.floating,d.y);return l?{...W,transform:"translate("+Z+"px, "+ue+"px)",...xh(ee.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Z,top:ue}},[n,l,ee.floating,d.x,d.y]);return p.useMemo(()=>({...d,update:L,refs:$,elements:ee,floatingStyles:F}),[d,L,$,ee,F])}const yC=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:o}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?Su({element:s.current,padding:o}).fn(n):{}:s?Su({element:s,padding:o}).fn(n):{}}}},wC=(e,t)=>({...uC(e),options:[e,t]}),_C=(e,t)=>({...dC(e),options:[e,t]}),kC=(e,t)=>({...mC(e),options:[e,t]}),jC=(e,t)=>({...fC(e),options:[e,t]}),SC=(e,t)=>({...pC(e),options:[e,t]}),CC=(e,t)=>({...hC(e),options:[e,t]}),NC=(e,t)=>({...yC(e),options:[e,t]});var TC="Arrow",bh=p.forwardRef((e,t)=>{const{children:n,width:s=10,height:o=5,...i}=e;return r.jsx(ze.svg,{...i,ref:t,width:s,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});bh.displayName=TC;var EC=bh,Gl="Popper",[vh,ai]=cn(Gl),[AC,yh]=vh(Gl),wh=e=>{const{__scopePopper:t,children:n}=e,[s,o]=p.useState(null);return r.jsx(AC,{scope:t,anchor:s,onAnchorChange:o,children:n})};wh.displayName=Gl;var _h="PopperAnchor",kh=p.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...o}=e,i=yh(_h,n),a=p.useRef(null),l=De(t,a),c=p.useRef(null);return p.useEffect(()=>{const u=c.current;c.current=s?.current||a.current,u!==c.current&&i.onAnchorChange(c.current)}),s?null:r.jsx(ze.div,{...o,ref:l})});kh.displayName=_h;var Kl="PopperContent",[RC,IC]=vh(Kl),jh=p.forwardRef((e,t)=>{const{__scopePopper:n,side:s="bottom",sideOffset:o=0,align:i="center",alignOffset:a=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:m="optimized",onPlaced:v,...g}=e,x=yh(Kl,n),[b,y]=p.useState(null),k=De(t,ae=>y(ae)),[j,C]=p.useState(null),T=gS(j),N=T?.width??0,P=T?.height??0,A=s+(i!=="center"?"-"+i:""),z=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},D=Array.isArray(u)?u:[u],E=D.length>0,L={padding:z,boundary:D.filter(PC),altBoundary:E},{refs:w,floatingStyles:$,placement:ee,isPositioned:F,middlewareData:W}=vC({strategy:"fixed",placement:A,whileElementsMounted:(...ae)=>cC(...ae,{animationFrame:m==="always"}),elements:{reference:x.anchor},middleware:[wC({mainAxis:o+P,alignmentAxis:a}),c&&_C({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?kC():void 0,...L}),c&&jC({...L}),SC({...L,apply:({elements:ae,rects:ge,availableWidth:xe,availableHeight:he})=>{const{width:be,height:Se}=ge.reference,Ie=ae.floating.style;Ie.setProperty("--radix-popper-available-width",`${xe}px`),Ie.setProperty("--radix-popper-available-height",`${he}px`),Ie.setProperty("--radix-popper-anchor-width",`${be}px`),Ie.setProperty("--radix-popper-anchor-height",`${Se}px`)}}),j&&NC({element:j,padding:l}),OC({arrowWidth:N,arrowHeight:P}),h&&CC({strategy:"referenceHidden",...L})]}),[Z,ue]=Nh(ee),V=pt(v);tt(()=>{F&&V?.()},[F,V]);const H=W.arrow?.x,le=W.arrow?.y,U=W.arrow?.centerOffset!==0,[X,Ce]=p.useState();return tt(()=>{b&&Ce(window.getComputedStyle(b).zIndex)},[b]),r.jsx("div",{ref:w.setFloating,"data-radix-popper-content-wrapper":"",style:{...$,transform:F?$.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:X,"--radix-popper-transform-origin":[W.transformOrigin?.x,W.transformOrigin?.y].join(" "),...W.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(RC,{scope:n,placedSide:Z,onArrowChange:C,arrowX:H,arrowY:le,shouldHideArrow:U,children:r.jsx(ze.div,{"data-side":Z,"data-align":ue,...g,ref:k,style:{...g.style,animation:F?void 0:"none"}})})})});jh.displayName=Kl;var Sh="PopperArrow",zC={top:"bottom",right:"left",bottom:"top",left:"right"},Ch=p.forwardRef(function(t,n){const{__scopePopper:s,...o}=t,i=IC(Sh,s),a=zC[i.placedSide];return r.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:r.jsx(EC,{...o,ref:n,style:{...o.style,display:"block"}})})});Ch.displayName=Sh;function PC(e){return e!==null}var OC=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:s,middlewareData:o}=t,a=o.arrow?.centerOffset!==0,l=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[u,d]=Nh(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(o.arrow?.x??0)+l/2,m=(o.arrow?.y??0)+c/2;let v="",g="";return u==="bottom"?(v=a?f:`${h}px`,g=`${-c}px`):u==="top"?(v=a?f:`${h}px`,g=`${s.floating.height+c}px`):u==="right"?(v=`${-c}px`,g=a?f:`${m}px`):u==="left"&&(v=`${s.floating.width+c}px`,g=a?f:`${m}px`),{data:{x:v,y:g}}}});function Nh(e){const[t,n="center"]=e.split("-");return[t,n]}var Th=wh,Eh=kh,Ah=jh,Rh=Ch,Di="rovingFocusGroup.onEntryFocus",MC={bubbles:!1,cancelable:!0},br="RovingFocusGroup",[ka,Ih,LC]=nh(br),[DC,zh]=cn(br,[LC]),[$C,FC]=DC(br),Ph=p.forwardRef((e,t)=>r.jsx(ka.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(ka.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(BC,{...e,ref:t})})}));Ph.displayName=br;var BC=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:o=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,h=p.useRef(null),m=De(t,h),v=ni(i),[g,x]=Fn({prop:a,defaultProp:l??null,onChange:c,caller:br}),[b,y]=p.useState(!1),k=pt(u),j=Ih(n),C=p.useRef(!1),[T,N]=p.useState(0);return p.useEffect(()=>{const P=h.current;if(P)return P.addEventListener(Di,k),()=>P.removeEventListener(Di,k)},[k]),r.jsx($C,{scope:n,orientation:s,dir:v,loop:o,currentTabStopId:g,onItemFocus:p.useCallback(P=>x(P),[x]),onItemShiftTab:p.useCallback(()=>y(!0),[]),onFocusableItemAdd:p.useCallback(()=>N(P=>P+1),[]),onFocusableItemRemove:p.useCallback(()=>N(P=>P-1),[]),children:r.jsx(ze.div,{tabIndex:b||T===0?-1:0,"data-orientation":s,...f,ref:m,style:{outline:"none",...e.style},onMouseDown:Te(e.onMouseDown,()=>{C.current=!0}),onFocus:Te(e.onFocus,P=>{const A=!C.current;if(P.target===P.currentTarget&&A&&!b){const z=new CustomEvent(Di,MC);if(P.currentTarget.dispatchEvent(z),!z.defaultPrevented){const D=j().filter(ee=>ee.focusable),E=D.find(ee=>ee.active),L=D.find(ee=>ee.id===g),$=[E,L,...D].filter(Boolean).map(ee=>ee.ref.current);Lh($,d)}}C.current=!1}),onBlur:Te(e.onBlur,()=>y(!1))})})}),Oh="RovingFocusGroupItem",Mh=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:o=!1,tabStopId:i,children:a,...l}=e,c=Zt(),u=i||c,d=FC(Oh,n),f=d.currentTabStopId===u,h=Ih(n),{onFocusableItemAdd:m,onFocusableItemRemove:v,currentTabStopId:g}=d;return p.useEffect(()=>{if(s)return m(),()=>v()},[s,m,v]),r.jsx(ka.ItemSlot,{scope:n,id:u,focusable:s,active:o,children:r.jsx(ze.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:Te(e.onMouseDown,x=>{s?d.onItemFocus(u):x.preventDefault()}),onFocus:Te(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:Te(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){d.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const b=HC(x,d.orientation,d.dir);if(b!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let k=h().filter(j=>j.focusable).map(j=>j.ref.current);if(b==="last")k.reverse();else if(b==="prev"||b==="next"){b==="prev"&&k.reverse();const j=k.indexOf(x.currentTarget);k=d.loop?VC(k,j+1):k.slice(j+1)}setTimeout(()=>Lh(k))}}),children:typeof a=="function"?a({isCurrentTabStop:f,hasTabStop:g!=null}):a})})});Mh.displayName=Oh;var UC={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function WC(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function HC(e,t,n){const s=WC(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return UC[s]}function Lh(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function VC(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var qC=Ph,ZC=Mh;function ja(e,[t,n]){return Math.min(n,Math.max(t,e))}function GC(e,t){return p.useReducer((n,s)=>t[n][s]??n,e)}var Jl="ScrollArea",[Dh]=cn(Jl),[KC,zt]=Dh(Jl),$h=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:s="hover",dir:o,scrollHideDelay:i=600,...a}=e,[l,c]=p.useState(null),[u,d]=p.useState(null),[f,h]=p.useState(null),[m,v]=p.useState(null),[g,x]=p.useState(null),[b,y]=p.useState(0),[k,j]=p.useState(0),[C,T]=p.useState(!1),[N,P]=p.useState(!1),A=De(t,D=>c(D)),z=ni(o);return r.jsx(KC,{scope:n,type:s,dir:z,scrollHideDelay:i,scrollArea:l,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:m,onScrollbarXChange:v,scrollbarXEnabled:C,onScrollbarXEnabledChange:T,scrollbarY:g,onScrollbarYChange:x,scrollbarYEnabled:N,onScrollbarYEnabledChange:P,onCornerWidthChange:y,onCornerHeightChange:j,children:r.jsx(ze.div,{dir:z,...a,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})});$h.displayName=Jl;var Fh="ScrollAreaViewport",Bh=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:s,nonce:o,...i}=e,a=zt(Fh,n),l=p.useRef(null),c=De(t,l,a.onViewportChange);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),r.jsx(ze.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...e.style},children:r.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});Bh.displayName=Fh;var Qt="ScrollAreaScrollbar",Uh=p.forwardRef((e,t)=>{const{forceMount:n,...s}=e,o=zt(Qt,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=o,l=e.orientation==="horizontal";return p.useEffect(()=>(l?i(!0):a(!0),()=>{l?i(!1):a(!1)}),[l,i,a]),o.type==="hover"?r.jsx(JC,{...s,ref:t,forceMount:n}):o.type==="scroll"?r.jsx(YC,{...s,ref:t,forceMount:n}):o.type==="auto"?r.jsx(Wh,{...s,ref:t,forceMount:n}):o.type==="always"?r.jsx(Yl,{...s,ref:t}):null});Uh.displayName=Qt;var JC=p.forwardRef((e,t)=>{const{forceMount:n,...s}=e,o=zt(Qt,e.__scopeScrollArea),[i,a]=p.useState(!1);return p.useEffect(()=>{const l=o.scrollArea;let c=0;if(l){const u=()=>{window.clearTimeout(c),a(!0)},d=()=>{c=window.setTimeout(()=>a(!1),o.scrollHideDelay)};return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",d)}}},[o.scrollArea,o.scrollHideDelay]),r.jsx(It,{present:n||i,children:r.jsx(Wh,{"data-state":i?"visible":"hidden",...s,ref:t})})}),YC=p.forwardRef((e,t)=>{const{forceMount:n,...s}=e,o=zt(Qt,e.__scopeScrollArea),i=e.orientation==="horizontal",a=ci(()=>c("SCROLL_END"),100),[l,c]=GC("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return p.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,o.scrollHideDelay,c]),p.useEffect(()=>{const u=o.viewport,d=i?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const m=u[d];f!==m&&(c("SCROLL"),a()),f=m};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[o.viewport,i,c,a]),r.jsx(It,{present:n||l!=="hidden",children:r.jsx(Yl,{"data-state":l==="hidden"?"hidden":"visible",...s,ref:t,onPointerEnter:Te(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Te(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Wh=p.forwardRef((e,t)=>{const n=zt(Qt,e.__scopeScrollArea),{forceMount:s,...o}=e,[i,a]=p.useState(!1),l=e.orientation==="horizontal",c=ci(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;a(l?u:d)}},10);return Ss(n.viewport,c),Ss(n.content,c),r.jsx(It,{present:s||i,children:r.jsx(Yl,{"data-state":i?"visible":"hidden",...o,ref:t})})}),Yl=p.forwardRef((e,t)=>{const{orientation:n="vertical",...s}=e,o=zt(Qt,e.__scopeScrollArea),i=p.useRef(null),a=p.useRef(0),[l,c]=p.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Gh(l.viewport,l.content),d={...s,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:h=>i.current=h,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:h=>a.current=h};function f(h,m){return s3(h,a.current,l,m)}return n==="horizontal"?r.jsx(XC,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const h=o.viewport.scrollLeft,m=Nu(h,l,o.dir);i.current.style.transform=`translate3d(${m}px, 0, 0)`}},onWheelScroll:h=>{o.viewport&&(o.viewport.scrollLeft=h)},onDragScroll:h=>{o.viewport&&(o.viewport.scrollLeft=f(h,o.dir))}}):n==="vertical"?r.jsx(QC,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const h=o.viewport.scrollTop,m=Nu(h,l);i.current.style.transform=`translate3d(0, ${m}px, 0)`}},onWheelScroll:h=>{o.viewport&&(o.viewport.scrollTop=h)},onDragScroll:h=>{o.viewport&&(o.viewport.scrollTop=f(h))}}):null}),XC=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:s,...o}=e,i=zt(Qt,e.__scopeScrollArea),[a,l]=p.useState(),c=p.useRef(null),u=De(t,c,i.onScrollbarXChange);return p.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),r.jsx(Vh,{"data-orientation":"horizontal",...o,ref:u,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":li(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(i.viewport){const h=i.viewport.scrollLeft+d.deltaX;e.onWheelScroll(h),Jh(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&s({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:To(a.paddingLeft),paddingEnd:To(a.paddingRight)}})}})}),QC=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:s,...o}=e,i=zt(Qt,e.__scopeScrollArea),[a,l]=p.useState(),c=p.useRef(null),u=De(t,c,i.onScrollbarYChange);return p.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),r.jsx(Vh,{"data-orientation":"vertical",...o,ref:u,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":li(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(i.viewport){const h=i.viewport.scrollTop+d.deltaY;e.onWheelScroll(h),Jh(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&s({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:To(a.paddingTop),paddingEnd:To(a.paddingBottom)}})}})}),[e3,Hh]=Dh(Qt),Vh=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:s,hasThumb:o,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...h}=e,m=zt(Qt,n),[v,g]=p.useState(null),x=De(t,A=>g(A)),b=p.useRef(null),y=p.useRef(""),k=m.viewport,j=s.content-s.viewport,C=pt(d),T=pt(c),N=ci(f,10);function P(A){if(b.current){const z=A.clientX-b.current.left,D=A.clientY-b.current.top;u({x:z,y:D})}}return p.useEffect(()=>{const A=z=>{const D=z.target;v?.contains(D)&&C(z,j)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[k,v,j,C]),p.useEffect(T,[s,T]),Ss(v,N),Ss(m.content,N),r.jsx(e3,{scope:n,scrollbar:v,hasThumb:o,onThumbChange:pt(i),onThumbPointerUp:pt(a),onThumbPositionChange:T,onThumbPointerDown:pt(l),children:r.jsx(ze.div,{...h,ref:x,style:{position:"absolute",...h.style},onPointerDown:Te(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),b.current=v.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",m.viewport&&(m.viewport.style.scrollBehavior="auto"),P(A))}),onPointerMove:Te(e.onPointerMove,P),onPointerUp:Te(e.onPointerUp,A=>{const z=A.target;z.hasPointerCapture(A.pointerId)&&z.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=y.current,m.viewport&&(m.viewport.style.scrollBehavior=""),b.current=null})})})}),No="ScrollAreaThumb",qh=p.forwardRef((e,t)=>{const{forceMount:n,...s}=e,o=Hh(No,e.__scopeScrollArea);return r.jsx(It,{present:n||o.hasThumb,children:r.jsx(t3,{ref:t,...s})})}),t3=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:s,...o}=e,i=zt(No,n),a=Hh(No,n),{onThumbPositionChange:l}=a,c=De(t,f=>a.onThumbChange(f)),u=p.useRef(void 0),d=ci(()=>{u.current&&(u.current(),u.current=void 0)},100);return p.useEffect(()=>{const f=i.viewport;if(f){const h=()=>{if(d(),!u.current){const m=r3(f,l);u.current=m,l()}};return l(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[i.viewport,d,l]),r.jsx(ze.div,{"data-state":a.hasThumb?"visible":"hidden",...o,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:Te(e.onPointerDownCapture,f=>{const m=f.target.getBoundingClientRect(),v=f.clientX-m.left,g=f.clientY-m.top;a.onThumbPointerDown({x:v,y:g})}),onPointerUp:Te(e.onPointerUp,a.onThumbPointerUp)})});qh.displayName=No;var Xl="ScrollAreaCorner",Zh=p.forwardRef((e,t)=>{const n=zt(Xl,e.__scopeScrollArea),s=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&s?r.jsx(n3,{...e,ref:t}):null});Zh.displayName=Xl;var n3=p.forwardRef((e,t)=>{const{__scopeScrollArea:n,...s}=e,o=zt(Xl,n),[i,a]=p.useState(0),[l,c]=p.useState(0),u=!!(i&&l);return Ss(o.scrollbarX,()=>{const d=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(d),c(d)}),Ss(o.scrollbarY,()=>{const d=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(d),a(d)}),u?r.jsx(ze.div,{...s,ref:t,style:{width:i,height:l,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function To(e){return e?parseInt(e,10):0}function Gh(e,t){const n=e/t;return isNaN(n)?0:n}function li(e){const t=Gh(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=(e.scrollbar.size-n)*t;return Math.max(s,18)}function s3(e,t,n,s="ltr"){const o=li(n),i=o/2,a=t||i,l=o-a,c=n.scrollbar.paddingStart+a,u=n.scrollbar.size-n.scrollbar.paddingEnd-l,d=n.content-n.viewport,f=s==="ltr"?[0,d]:[d*-1,0];return Kh([c,u],f)(e)}function Nu(e,t,n="ltr"){const s=li(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-o,a=t.content-t.viewport,l=i-s,c=n==="ltr"?[0,a]:[a*-1,0],u=ja(e,c);return Kh([0,a],[0,l])(u)}function Kh(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const s=(t[1]-t[0])/(e[1]-e[0]);return t[0]+s*(n-e[0])}}function Jh(e,t){return e>0&&e<t}var r3=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},s=0;return(function o(){const i={left:e.scrollLeft,top:e.scrollTop},a=n.left!==i.left,l=n.top!==i.top;(a||l)&&t(),n=i,s=window.requestAnimationFrame(o)})(),()=>window.cancelAnimationFrame(s)};function ci(e,t){const n=pt(e),s=p.useRef(0);return p.useEffect(()=>()=>window.clearTimeout(s.current),[]),p.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(n,t)},[n,t])}function Ss(e,t){const n=pt(t);tt(()=>{let s=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(s),o.unobserve(e)}}},[e,n])}var o3=$h,i3=Bh,a3=Zh,l3=[" ","Enter","ArrowUp","ArrowDown"],c3=[" ","Enter"],Wn="Select",[ui,di,u3]=nh(Wn),[$s]=cn(Wn,[u3,ai]),fi=ai(),[d3,Nn]=$s(Wn),[f3,p3]=$s(Wn),Yh=e=>{const{__scopeSelect:t,children:n,open:s,defaultOpen:o,onOpenChange:i,value:a,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:h,required:m,form:v}=e,g=fi(t),[x,b]=p.useState(null),[y,k]=p.useState(null),[j,C]=p.useState(!1),T=ni(u),[N,P]=Fn({prop:s,defaultProp:o??!1,onChange:i,caller:Wn}),[A,z]=Fn({prop:a,defaultProp:l,onChange:c,caller:Wn}),D=p.useRef(null),E=x?v||!!x.closest("form"):!0,[L,w]=p.useState(new Set),$=Array.from(L).map(ee=>ee.props.value).join(";");return r.jsx(Th,{...g,children:r.jsxs(d3,{required:m,scope:t,trigger:x,onTriggerChange:b,valueNode:y,onValueNodeChange:k,valueNodeHasChildren:j,onValueNodeHasChildrenChange:C,contentId:Zt(),value:A,onValueChange:z,open:N,onOpenChange:P,dir:T,triggerPointerDownPosRef:D,disabled:h,children:[r.jsx(ui.Provider,{scope:t,children:r.jsx(f3,{scope:e.__scopeSelect,onNativeOptionAdd:p.useCallback(ee=>{w(F=>new Set(F).add(ee))},[]),onNativeOptionRemove:p.useCallback(ee=>{w(F=>{const W=new Set(F);return W.delete(ee),W})},[]),children:n})}),E?r.jsxs(vm,{"aria-hidden":!0,required:m,tabIndex:-1,name:d,autoComplete:f,value:A,onChange:ee=>z(ee.target.value),disabled:h,form:v,children:[A===void 0?r.jsx("option",{value:""}):null,Array.from(L)]},$):null]})})};Yh.displayName=Wn;var Xh="SelectTrigger",Qh=p.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...o}=e,i=fi(n),a=Nn(Xh,n),l=a.disabled||s,c=De(t,a.onTriggerChange),u=di(n),d=p.useRef("touch"),[f,h,m]=wm(g=>{const x=u().filter(k=>!k.disabled),b=x.find(k=>k.value===a.value),y=_m(x,g,b);y!==void 0&&a.onValueChange(y.value)}),v=g=>{l||(a.onOpenChange(!0),m()),g&&(a.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return r.jsx(Eh,{asChild:!0,...i,children:r.jsx(ze.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":ym(a.value)?"":void 0,...o,ref:c,onClick:Te(o.onClick,g=>{g.currentTarget.focus(),d.current!=="mouse"&&v(g)}),onPointerDown:Te(o.onPointerDown,g=>{d.current=g.pointerType;const x=g.target;x.hasPointerCapture(g.pointerId)&&x.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(v(g),g.preventDefault())}),onKeyDown:Te(o.onKeyDown,g=>{const x=f.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&h(g.key),!(x&&g.key===" ")&&l3.includes(g.key)&&(v(),g.preventDefault())})})})});Qh.displayName=Xh;var em="SelectValue",tm=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:o,children:i,placeholder:a="",...l}=e,c=Nn(em,n),{onValueNodeHasChildrenChange:u}=c,d=i!==void 0,f=De(t,c.onValueNodeChange);return tt(()=>{u(d)},[u,d]),r.jsx(ze.span,{...l,ref:f,style:{pointerEvents:"none"},children:ym(c.value)?r.jsx(r.Fragment,{children:a}):i})});tm.displayName=em;var h3="SelectIcon",nm=p.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...o}=e;return r.jsx(ze.span,{"aria-hidden":!0,...o,ref:t,children:s||"▼"})});nm.displayName=h3;var m3="SelectPortal",sm=e=>r.jsx(Ko,{asChild:!0,...e});sm.displayName=m3;var Hn="SelectContent",rm=p.forwardRef((e,t)=>{const n=Nn(Hn,e.__scopeSelect),[s,o]=p.useState();if(tt(()=>{o(new DocumentFragment)},[]),!n.open){const i=s;return i?pr.createPortal(r.jsx(om,{scope:e.__scopeSelect,children:r.jsx(ui.Slot,{scope:e.__scopeSelect,children:r.jsx("div",{children:e.children})})}),i):null}return r.jsx(im,{...e,ref:t})});rm.displayName=Hn;var Lt=10,[om,Tn]=$s(Hn),g3="SelectContentImpl",x3=ks("SelectContent.RemoveScroll"),im=p.forwardRef((e,t)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:a,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:v,hideWhenDetached:g,avoidCollisions:x,...b}=e,y=Nn(Hn,n),[k,j]=p.useState(null),[C,T]=p.useState(null),N=De(t,ae=>j(ae)),[P,A]=p.useState(null),[z,D]=p.useState(null),E=di(n),[L,w]=p.useState(!1),$=p.useRef(!1);p.useEffect(()=>{if(k)return Op(k)},[k]),Cp();const ee=p.useCallback(ae=>{const[ge,...xe]=E().map(Se=>Se.ref.current),[he]=xe.slice(-1),be=document.activeElement;for(const Se of ae)if(Se===be||(Se?.scrollIntoView({block:"nearest"}),Se===ge&&C&&(C.scrollTop=0),Se===he&&C&&(C.scrollTop=C.scrollHeight),Se?.focus(),document.activeElement!==be))return},[E,C]),F=p.useCallback(()=>ee([P,k]),[ee,P,k]);p.useEffect(()=>{L&&F()},[L,F]);const{onOpenChange:W,triggerPointerDownPosRef:Z}=y;p.useEffect(()=>{if(k){let ae={x:0,y:0};const ge=he=>{ae={x:Math.abs(Math.round(he.pageX)-(Z.current?.x??0)),y:Math.abs(Math.round(he.pageY)-(Z.current?.y??0))}},xe=he=>{ae.x<=10&&ae.y<=10?he.preventDefault():k.contains(he.target)||W(!1),document.removeEventListener("pointermove",ge),Z.current=null};return Z.current!==null&&(document.addEventListener("pointermove",ge),document.addEventListener("pointerup",xe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ge),document.removeEventListener("pointerup",xe,{capture:!0})}}},[k,W,Z]),p.useEffect(()=>{const ae=()=>W(!1);return window.addEventListener("blur",ae),window.addEventListener("resize",ae),()=>{window.removeEventListener("blur",ae),window.removeEventListener("resize",ae)}},[W]);const[ue,V]=wm(ae=>{const ge=E().filter(be=>!be.disabled),xe=ge.find(be=>be.ref.current===document.activeElement),he=_m(ge,ae,xe);he&&setTimeout(()=>he.ref.current.focus())}),H=p.useCallback((ae,ge,xe)=>{const he=!$.current&&!xe;(y.value!==void 0&&y.value===ge||he)&&(A(ae),he&&($.current=!0))},[y.value]),le=p.useCallback(()=>k?.focus(),[k]),U=p.useCallback((ae,ge,xe)=>{const he=!$.current&&!xe;(y.value!==void 0&&y.value===ge||he)&&D(ae)},[y.value]),X=s==="popper"?Sa:am,Ce=X===Sa?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:m,sticky:v,hideWhenDetached:g,avoidCollisions:x}:{};return r.jsx(om,{scope:n,content:k,viewport:C,onViewportChange:T,itemRefCallback:H,selectedItem:P,onItemLeave:le,itemTextRefCallback:U,focusSelectedItem:F,selectedItemText:z,position:s,isPositioned:L,searchRef:ue,children:r.jsx(zl,{as:x3,allowPinchZoom:!0,children:r.jsx(Il,{asChild:!0,trapped:y.open,onMountAutoFocus:ae=>{ae.preventDefault()},onUnmountAutoFocus:Te(o,ae=>{y.trigger?.focus({preventScroll:!0}),ae.preventDefault()}),children:r.jsx(Go,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:ae=>ae.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:r.jsx(X,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:ae=>ae.preventDefault(),...b,...Ce,onPlaced:()=>w(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Te(b.onKeyDown,ae=>{const ge=ae.ctrlKey||ae.altKey||ae.metaKey;if(ae.key==="Tab"&&ae.preventDefault(),!ge&&ae.key.length===1&&V(ae.key),["ArrowUp","ArrowDown","Home","End"].includes(ae.key)){let he=E().filter(be=>!be.disabled).map(be=>be.ref.current);if(["ArrowUp","End"].includes(ae.key)&&(he=he.slice().reverse()),["ArrowUp","ArrowDown"].includes(ae.key)){const be=ae.target,Se=he.indexOf(be);he=he.slice(Se+1)}setTimeout(()=>ee(he)),ae.preventDefault()}})})})})})})});im.displayName=g3;var b3="SelectItemAlignedPosition",am=p.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...o}=e,i=Nn(Hn,n),a=Tn(Hn,n),[l,c]=p.useState(null),[u,d]=p.useState(null),f=De(t,N=>d(N)),h=di(n),m=p.useRef(!1),v=p.useRef(!0),{viewport:g,selectedItem:x,selectedItemText:b,focusSelectedItem:y}=a,k=p.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&g&&x&&b){const N=i.trigger.getBoundingClientRect(),P=u.getBoundingClientRect(),A=i.valueNode.getBoundingClientRect(),z=b.getBoundingClientRect();if(i.dir!=="rtl"){const be=z.left-P.left,Se=A.left-be,Ie=N.left-Se,_=N.width+Ie,Q=Math.max(_,P.width),G=window.innerWidth-Lt,O=ja(Se,[Lt,Math.max(Lt,G-Q)]);l.style.minWidth=_+"px",l.style.left=O+"px"}else{const be=P.right-z.right,Se=window.innerWidth-A.right-be,Ie=window.innerWidth-N.right-Se,_=N.width+Ie,Q=Math.max(_,P.width),G=window.innerWidth-Lt,O=ja(Se,[Lt,Math.max(Lt,G-Q)]);l.style.minWidth=_+"px",l.style.right=O+"px"}const D=h(),E=window.innerHeight-Lt*2,L=g.scrollHeight,w=window.getComputedStyle(u),$=parseInt(w.borderTopWidth,10),ee=parseInt(w.paddingTop,10),F=parseInt(w.borderBottomWidth,10),W=parseInt(w.paddingBottom,10),Z=$+ee+L+W+F,ue=Math.min(x.offsetHeight*5,Z),V=window.getComputedStyle(g),H=parseInt(V.paddingTop,10),le=parseInt(V.paddingBottom,10),U=N.top+N.height/2-Lt,X=E-U,Ce=x.offsetHeight/2,ae=x.offsetTop+Ce,ge=$+ee+ae,xe=Z-ge;if(ge<=U){const be=D.length>0&&x===D[D.length-1].ref.current;l.style.bottom="0px";const Se=u.clientHeight-g.offsetTop-g.offsetHeight,Ie=Math.max(X,Ce+(be?le:0)+Se+F),_=ge+Ie;l.style.height=_+"px"}else{const be=D.length>0&&x===D[0].ref.current;l.style.top="0px";const Ie=Math.max(U,$+g.offsetTop+(be?H:0)+Ce)+xe;l.style.height=Ie+"px",g.scrollTop=ge-U+g.offsetTop}l.style.margin=`${Lt}px 0`,l.style.minHeight=ue+"px",l.style.maxHeight=E+"px",s?.(),requestAnimationFrame(()=>m.current=!0)}},[h,i.trigger,i.valueNode,l,u,g,x,b,i.dir,s]);tt(()=>k(),[k]);const[j,C]=p.useState();tt(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const T=p.useCallback(N=>{N&&v.current===!0&&(k(),y?.(),v.current=!1)},[k,y]);return r.jsx(y3,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:m,onScrollButtonChange:T,children:r.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:j},children:r.jsx(ze.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});am.displayName=b3;var v3="SelectPopperPosition",Sa=p.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:o=Lt,...i}=e,a=fi(n);return r.jsx(Ah,{...a,...i,ref:t,align:s,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Sa.displayName=v3;var[y3,Ql]=$s(Hn,{}),Ca="SelectViewport",lm=p.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...o}=e,i=Tn(Ca,n),a=Ql(Ca,n),l=De(t,i.onViewportChange),c=p.useRef(0);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),r.jsx(ui.Slot,{scope:n,children:r.jsx(ze.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Te(o.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=a;if(h?.current&&f){const m=Math.abs(c.current-d.scrollTop);if(m>0){const v=window.innerHeight-Lt*2,g=parseFloat(f.style.minHeight),x=parseFloat(f.style.height),b=Math.max(g,x);if(b<v){const y=b+m,k=Math.min(v,y),j=y-k;f.style.height=k+"px",f.style.bottom==="0px"&&(d.scrollTop=j>0?j:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});lm.displayName=Ca;var cm="SelectGroup",[w3,_3]=$s(cm),k3=p.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=Zt();return r.jsx(w3,{scope:n,id:o,children:r.jsx(ze.div,{role:"group","aria-labelledby":o,...s,ref:t})})});k3.displayName=cm;var um="SelectLabel",j3=p.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=_3(um,n);return r.jsx(ze.div,{id:o.id,...s,ref:t})});j3.displayName=um;var Eo="SelectItem",[S3,dm]=$s(Eo),fm=p.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:o=!1,textValue:i,...a}=e,l=Nn(Eo,n),c=Tn(Eo,n),u=l.value===s,[d,f]=p.useState(i??""),[h,m]=p.useState(!1),v=De(t,y=>c.itemRefCallback?.(y,s,o)),g=Zt(),x=p.useRef("touch"),b=()=>{o||(l.onValueChange(s),l.onOpenChange(!1))};if(s==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return r.jsx(S3,{scope:n,value:s,disabled:o,textId:g,isSelected:u,onItemTextChange:p.useCallback(y=>{f(k=>k||(y?.textContent??"").trim())},[]),children:r.jsx(ui.ItemSlot,{scope:n,value:s,disabled:o,textValue:d,children:r.jsx(ze.div,{role:"option","aria-labelledby":g,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...a,ref:v,onFocus:Te(a.onFocus,()=>m(!0)),onBlur:Te(a.onBlur,()=>m(!1)),onClick:Te(a.onClick,()=>{x.current!=="mouse"&&b()}),onPointerUp:Te(a.onPointerUp,()=>{x.current==="mouse"&&b()}),onPointerDown:Te(a.onPointerDown,y=>{x.current=y.pointerType}),onPointerMove:Te(a.onPointerMove,y=>{x.current=y.pointerType,o?c.onItemLeave?.():x.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Te(a.onPointerLeave,y=>{y.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:Te(a.onKeyDown,y=>{c.searchRef?.current!==""&&y.key===" "||(c3.includes(y.key)&&b(),y.key===" "&&y.preventDefault())})})})})});fm.displayName=Eo;var Ys="SelectItemText",pm=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:o,...i}=e,a=Nn(Ys,n),l=Tn(Ys,n),c=dm(Ys,n),u=p3(Ys,n),[d,f]=p.useState(null),h=De(t,b=>f(b),c.onItemTextChange,b=>l.itemTextRefCallback?.(b,c.value,c.disabled)),m=d?.textContent,v=p.useMemo(()=>r.jsx("option",{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:x}=u;return tt(()=>(g(v),()=>x(v)),[g,x,v]),r.jsxs(r.Fragment,{children:[r.jsx(ze.span,{id:c.textId,...i,ref:h}),c.isSelected&&a.valueNode&&!a.valueNodeHasChildren?pr.createPortal(i.children,a.valueNode):null]})});pm.displayName=Ys;var hm="SelectItemIndicator",mm=p.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return dm(hm,n).isSelected?r.jsx(ze.span,{"aria-hidden":!0,...s,ref:t}):null});mm.displayName=hm;var Na="SelectScrollUpButton",gm=p.forwardRef((e,t)=>{const n=Tn(Na,e.__scopeSelect),s=Ql(Na,e.__scopeSelect),[o,i]=p.useState(!1),a=De(t,s.onScrollButtonChange);return tt(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;i(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?r.jsx(bm,{...e,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});gm.displayName=Na;var Ta="SelectScrollDownButton",xm=p.forwardRef((e,t)=>{const n=Tn(Ta,e.__scopeSelect),s=Ql(Ta,e.__scopeSelect),[o,i]=p.useState(!1),a=De(t,s.onScrollButtonChange);return tt(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;i(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?r.jsx(bm,{...e,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});xm.displayName=Ta;var bm=p.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...o}=e,i=Tn("SelectScrollButton",n),a=p.useRef(null),l=di(n),c=p.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return p.useEffect(()=>()=>c(),[c]),tt(()=>{l().find(d=>d.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),r.jsx(ze.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:Te(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(s,50))}),onPointerMove:Te(o.onPointerMove,()=>{i.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(s,50))}),onPointerLeave:Te(o.onPointerLeave,()=>{c()})})}),C3="SelectSeparator",N3=p.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return r.jsx(ze.div,{"aria-hidden":!0,...s,ref:t})});N3.displayName=C3;var Ea="SelectArrow",T3=p.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=fi(n),i=Nn(Ea,n),a=Tn(Ea,n);return i.open&&a.position==="popper"?r.jsx(Rh,{...o,...s,ref:t}):null});T3.displayName=Ea;var E3="SelectBubbleInput",vm=p.forwardRef(({__scopeSelect:e,value:t,...n},s)=>{const o=p.useRef(null),i=De(s,o),a=mS(t);return p.useEffect(()=>{const l=o.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==t&&d){const f=new Event("change",{bubbles:!0});d.call(l,t),l.dispatchEvent(f)}},[a,t]),r.jsx(ze.select,{...n,style:{...eh,...n.style},ref:i,defaultValue:t})});vm.displayName=E3;function ym(e){return e===""||e===void 0}function wm(e){const t=pt(e),n=p.useRef(""),s=p.useRef(0),o=p.useCallback(a=>{const l=n.current+a;t(l),(function c(u){n.current=u,window.clearTimeout(s.current),u!==""&&(s.current=window.setTimeout(()=>c(""),1e3))})(l)},[t]),i=p.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return p.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,o,i]}function _m(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let a=A3(e,Math.max(i,0));o.length===1&&(a=a.filter(u=>u!==n));const c=a.find(u=>u.textValue.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function A3(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var R3=Yh,I3=Qh,z3=tm,P3=nm,O3=sm,M3=rm,L3=lm,D3=fm,$3=pm,F3=mm,B3=gm,U3=xm,pi="Tabs",[W3]=cn(pi,[zh]),km=zh(),[H3,ec]=W3(pi),jm=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:o,defaultValue:i,orientation:a="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=ni(l),[f,h]=Fn({prop:s,onChange:o,defaultProp:i??"",caller:pi});return r.jsx(H3,{scope:n,baseId:Zt(),value:f,onValueChange:h,orientation:a,dir:d,activationMode:c,children:r.jsx(ze.div,{dir:d,"data-orientation":a,...u,ref:t})})});jm.displayName=pi;var Sm="TabsList",Cm=p.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...o}=e,i=ec(Sm,n),a=km(n);return r.jsx(qC,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:s,children:r.jsx(ze.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});Cm.displayName=Sm;var Nm="TabsTrigger",Tm=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:o=!1,...i}=e,a=ec(Nm,n),l=km(n),c=Rm(a.baseId,s),u=Im(a.baseId,s),d=s===a.value;return r.jsx(ZC,{asChild:!0,...l,focusable:!o,active:d,children:r.jsx(ze.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...i,ref:t,onMouseDown:Te(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?a.onValueChange(s):f.preventDefault()}),onKeyDown:Te(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&a.onValueChange(s)}),onFocus:Te(e.onFocus,()=>{const f=a.activationMode!=="manual";!d&&!o&&f&&a.onValueChange(s)})})})});Tm.displayName=Nm;var Em="TabsContent",Am=p.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:o,children:i,...a}=e,l=ec(Em,n),c=Rm(l.baseId,s),u=Im(l.baseId,s),d=s===l.value,f=p.useRef(d);return p.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),r.jsx(It,{present:o||d,children:({present:h})=>r.jsx(ze.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:u,tabIndex:0,...a,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:h&&i})})});Am.displayName=Em;function Rm(e,t){return`${e}-trigger-${t}`}function Im(e,t){return`${e}-content-${t}`}var V3=jm,q3=Cm,Z3=Tm,G3=Am,[hi]=cn("Tooltip",[ai]),mi=ai(),zm="TooltipProvider",K3=700,Aa="tooltip.open",[J3,tc]=hi(zm),Pm=e=>{const{__scopeTooltip:t,delayDuration:n=K3,skipDelayDuration:s=300,disableHoverableContent:o=!1,children:i}=e,a=p.useRef(!0),l=p.useRef(!1),c=p.useRef(0);return p.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),r.jsx(J3,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:p.useCallback(()=>{window.clearTimeout(c.current),a.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,s)},[s]),isPointerInTransitRef:l,onPointerInTransitChange:p.useCallback(u=>{l.current=u},[]),disableHoverableContent:o,children:i})};Pm.displayName=zm;var ar="Tooltip",[Y3,vr]=hi(ar),Om=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:o,onOpenChange:i,disableHoverableContent:a,delayDuration:l}=e,c=tc(ar,e.__scopeTooltip),u=mi(t),[d,f]=p.useState(null),h=Zt(),m=p.useRef(0),v=a??c.disableHoverableContent,g=l??c.delayDuration,x=p.useRef(!1),[b,y]=Fn({prop:s,defaultProp:o??!1,onChange:N=>{N?(c.onOpen(),document.dispatchEvent(new CustomEvent(Aa))):c.onClose(),i?.(N)},caller:ar}),k=p.useMemo(()=>b?x.current?"delayed-open":"instant-open":"closed",[b]),j=p.useCallback(()=>{window.clearTimeout(m.current),m.current=0,x.current=!1,y(!0)},[y]),C=p.useCallback(()=>{window.clearTimeout(m.current),m.current=0,y(!1)},[y]),T=p.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{x.current=!0,y(!0),m.current=0},g)},[g,y]);return p.useEffect(()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)},[]),r.jsx(Th,{...u,children:r.jsx(Y3,{scope:t,contentId:h,open:b,stateAttribute:k,trigger:d,onTriggerChange:f,onTriggerEnter:p.useCallback(()=>{c.isOpenDelayedRef.current?T():j()},[c.isOpenDelayedRef,T,j]),onTriggerLeave:p.useCallback(()=>{v?C():(window.clearTimeout(m.current),m.current=0)},[C,v]),onOpen:j,onClose:C,disableHoverableContent:v,children:n})})};Om.displayName=ar;var Ra="TooltipTrigger",Mm=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,o=vr(Ra,n),i=tc(Ra,n),a=mi(n),l=p.useRef(null),c=De(t,l,o.onTriggerChange),u=p.useRef(!1),d=p.useRef(!1),f=p.useCallback(()=>u.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),r.jsx(Eh,{asChild:!0,...a,children:r.jsx(ze.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...s,ref:c,onPointerMove:Te(e.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:Te(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:Te(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Te(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:Te(e.onBlur,o.onClose),onClick:Te(e.onClick,o.onClose)})})});Mm.displayName=Ra;var nc="TooltipPortal",[X3,Q3]=hi(nc,{forceMount:void 0}),Lm=e=>{const{__scopeTooltip:t,forceMount:n,children:s,container:o}=e,i=vr(nc,t);return r.jsx(X3,{scope:t,forceMount:n,children:r.jsx(It,{present:n||i.open,children:r.jsx(Ko,{asChild:!0,container:o,children:s})})})};Lm.displayName=nc;var Cs="TooltipContent",Dm=p.forwardRef((e,t)=>{const n=Q3(Cs,e.__scopeTooltip),{forceMount:s=n.forceMount,side:o="top",...i}=e,a=vr(Cs,e.__scopeTooltip);return r.jsx(It,{present:s||a.open,children:a.disableHoverableContent?r.jsx($m,{side:o,...i,ref:t}):r.jsx(eN,{side:o,...i,ref:t})})}),eN=p.forwardRef((e,t)=>{const n=vr(Cs,e.__scopeTooltip),s=tc(Cs,e.__scopeTooltip),o=p.useRef(null),i=De(t,o),[a,l]=p.useState(null),{trigger:c,onClose:u}=n,d=o.current,{onPointerInTransitChange:f}=s,h=p.useCallback(()=>{l(null),f(!1)},[f]),m=p.useCallback((v,g)=>{const x=v.currentTarget,b={x:v.clientX,y:v.clientY},y=rN(b,x.getBoundingClientRect()),k=oN(b,y),j=iN(g.getBoundingClientRect()),C=lN([...k,...j]);l(C),f(!0)},[f]);return p.useEffect(()=>()=>h(),[h]),p.useEffect(()=>{if(c&&d){const v=x=>m(x,d),g=x=>m(x,c);return c.addEventListener("pointerleave",v),d.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",v),d.removeEventListener("pointerleave",g)}}},[c,d,m,h]),p.useEffect(()=>{if(a){const v=g=>{const x=g.target,b={x:g.clientX,y:g.clientY},y=c?.contains(x)||d?.contains(x),k=!aN(b,a);y?h():k&&(h(),u())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[c,d,a,u,h]),r.jsx($m,{...e,ref:i})}),[tN,nN]=hi(ar,{isInside:!1}),sN=ok("TooltipContent"),$m=p.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...l}=e,c=vr(Cs,n),u=mi(n),{onClose:d}=c;return p.useEffect(()=>(document.addEventListener(Aa,d),()=>document.removeEventListener(Aa,d)),[d]),p.useEffect(()=>{if(c.trigger){const f=h=>{h.target?.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),r.jsx(Go,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:r.jsxs(Ah,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[r.jsx(sN,{children:s}),r.jsx(tN,{scope:n,isInside:!0,children:r.jsx(cS,{id:c.contentId,role:"tooltip",children:o||s})})]})})});Dm.displayName=Cs;var Fm="TooltipArrow",Bm=p.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,o=mi(n);return nN(Fm,n).isInside?null:r.jsx(Rh,{...o,...s,ref:t})});Bm.displayName=Fm;function rN(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,s,o,i)){case i:return"left";case o:return"right";case n:return"top";case s:return"bottom";default:throw new Error("unreachable")}}function oN(e,t,n=5){const s=[];switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function iN(e){const{top:t,right:n,bottom:s,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:s},{x:o,y:s}]}function aN(e,t){const{x:n,y:s}=e;let o=!1;for(let i=0,a=t.length-1;i<t.length;a=i++){const l=t[i],c=t[a],u=l.x,d=l.y,f=c.x,h=c.y;d>s!=h>s&&n<(f-u)*(s-d)/(h-d)+u&&(o=!o)}return o}function lN(e){const t=e.slice();return t.sort((n,s)=>n.x<s.x?-1:n.x>s.x?1:n.y<s.y?-1:n.y>s.y?1:0),cN(t)}function cN(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s<e.length;s++){const o=e[s];for(;t.length>=2;){const i=t[t.length-1],a=t[t.length-2];if((i.x-a.x)*(o.y-a.y)>=(i.y-a.y)*(o.x-a.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const o=e[s];for(;n.length>=2;){const i=n[n.length-1],a=n[n.length-2];if((i.x-a.x)*(o.y-a.y)>=(i.y-a.y)*(o.x-a.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var uN=Pm,dN=Om,fN=Mm,pN=Lm,hN=Dm,mN=Bm;function jn({delayDuration:e=600,...t}){return r.jsx(uN,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function ct({...e}){return r.jsx(dN,{"data-slot":"tooltip",...e})}function ut({...e}){return r.jsx(fN,{"data-slot":"tooltip-trigger",...e})}function dt({className:e,sideOffset:t=0,children:n,...s}){return r.jsx(pN,{children:r.jsxs(hN,{"data-slot":"tooltip-content",sideOffset:t,className:ie("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),...s,children:[n,r.jsx(mN,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const gN=3;function xN({items:e,ariaLabel:t,className:n}){if(e.length===0)return r.jsx("span",{className:ie("flex h-8 w-12 shrink-0 items-center",n),"aria-hidden":"true"});const s=e.slice(0,gN),o=e.length-s.length;return r.jsx(jn,{delayDuration:150,children:r.jsxs("span",{className:ie("flex h-8 w-12 shrink-0 items-center",n),"aria-label":t,children:[s.map((i,a)=>r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsx("span",{className:ie("border border-border bg-muted/40 inline-flex size-6 shrink-0 items-center justify-center rounded-md",a>0&&"-ml-2"),children:r.jsx(aS,{provider:i.provider,className:"size-4"})})}),r.jsx(dt,{children:i.tooltip})]},`${i.provider}-${String(a)}`)),o>0&&r.jsxs("span",{className:"border border-border bg-muted/40 -ml-2 inline-flex h-6 min-w-6 shrink-0 items-center justify-center rounded-md px-1 font-mono text-[10px] text-muted-foreground",children:["+",o]})]})})}const bN="/v1/chat/completions",vN="/chat/completions",yN="/v1/responses",wN="/responses",_N="/v1/messages";class kN{handlers=new Map;pathMap=new Map;register(t){this.handlers.set(t.format,t)}registerPath(t,n){this.pathMap.set(t,n)}get(t){return this.handlers.get(t)}getByPath(t){const n=t.split("?")[0]??"",s=this.pathMap.get(n);return s===void 0?void 0:this.handlers.get(s)}getApiFormatByPath(t){const n=t.split("?")[0]??"";return this.pathMap.get(n)}detectFormat(t){if(t===null)return"unknown";for(const n of this.handlers.values())if(n.detectFormat(t))return n.format;return"unknown"}}const En=new kN;function jN(e){return En.getApiFormatByPath(e)??"unknown"}En.registerPath(_N,"anthropic");En.registerPath(bN,"openai");En.registerPath(vN,"openai");En.registerPath(yN,"openai");En.registerPath(wN,"openai");function SN(e){if(e==="")return{};try{const t=JSON.parse(e);return t!==null&&typeof t=="object"&&!Array.isArray(t)?{...t}:{}}catch{return{}}}function CN(e){switch(e.type){case"text":return{type:"text",text:e.text};case"thinking":{const t={type:"thinking",thinking:e.thinking};return e.signature!==""&&(t.signature=e.signature),t}case"think":{const t={type:"think",thinking:e.thinking};return e.signature!==""&&(t.signature=e.signature),t}case"tool_use":return{type:"tool_use",id:e.id,name:e.name,input:SN(e.inputJson)}}}function Um(e,t,n,s){const o=new Map;let i="",a="",l=null,c=null,u=0,d=0;const f=1e3;let h=0,m=0;const v=[];for(const x of e.split(`
|
|
86
|
+
`)){const b=x.trim();if(b.startsWith("data: "))try{const y=JSON.parse(b.slice(6)),k=_2.safeParse(y);if(!k.success)continue;const j=k.data;switch(h===0&&(m=Date.now()),s===!0&&v.length<f&&v.push({index:h,timestamp:Date.now()-m,type:j.type,data:j}),h++,j.type){case"message_start":i=j.message.id,a=j.message.model,u=j.message.usage.input_tokens,t.inputTokens=u,t.cacheCreationInputTokens=j.message.usage.cache_creation_input_tokens??null,t.cacheReadInputTokens=j.message.usage.cache_read_input_tokens??null,t.model===null&&(t.model=a);break;case"content_block_start":{const C=j.content_block;switch(C.type){case"text":o.set(j.index,{type:"text",text:C.text??""});break;case"thinking":o.set(j.index,{type:"thinking",thinking:C.thinking??"",signature:C.signature??""});break;case"think":o.set(j.index,{type:"think",thinking:C.thinking??"",signature:C.signature??""});break;case"tool_use":o.set(j.index,{type:"tool_use",id:C.id,name:C.name,inputJson:""});break}break}case"content_block_delta":{const C=o.get(j.index);if(C===void 0)break;const T=j.delta;T.type==="text_delta"&&C.type==="text"?C.text+=T.text:T.type==="thinking_delta"&&(C.type==="thinking"||C.type==="think")?C.thinking+=T.thinking:T.type==="signature_delta"&&(C.type==="thinking"||C.type==="think")?C.signature+=T.signature:T.type==="input_json_delta"&&C.type==="tool_use"&&(C.inputJson+=T.partial_json);break}case"message_delta":l=j.delta.stop_reason,c=j.delta.stop_sequence??null,d=j.usage.output_tokens,t.outputTokens=d,j.usage.cache_creation_input_tokens!==void 0&&(t.cacheCreationInputTokens=j.usage.cache_creation_input_tokens),j.usage.cache_read_input_tokens!==void 0&&(t.cacheReadInputTokens=j.usage.cache_read_input_tokens);break;case"error":t.error=j.error.message;break;case"content_block_stop":case"message_stop":case"ping":break}}catch{}}s===!0&&(t.streamingChunks={chunks:v,truncated:h>f});const g=[...o.entries()].sort(([x],[b])=>x-b).map(([,x])=>CN(x));return JSON.stringify({id:i,type:"message",model:a!==""?a:n??"",role:"assistant",content:g,stop_reason:l,stop_sequence:c,usage:{input_tokens:u,output_tokens:d}})}const NN={format:"anthropic",parseRequest(e,t){try{const n=JSON.parse(e),s=Cf.safeParse(n);return s.success?{model:s.data.model,sessionId:s.data.metadata?.user_id??t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){try{const t=JSON.parse(e),n=Nf.safeParse(t);if(n.success)return{inputTokens:n.data.usage.input_tokens??null,outputTokens:n.data.usage.output_tokens??null,cacheCreationInputTokens:n.data.usage.cache_creation_input_tokens??null,cacheReadInputTokens:n.data.usage.cache_read_input_tokens??null}}catch{}return{inputTokens:null,outputTokens:null,cacheCreationInputTokens:null,cacheReadInputTokens:null}},extractStream(e,t,n,s){return Um(e,t,n,s)},detectFormat(e){if(e===null)return!1;try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=Object.keys(t);return n.includes("model")&&n.includes("messages")&&n.includes("system")}return!1}catch{return!1}}};En.register(NN);class TN{providers=[];register(t){this.providers.push(t)}findProvider(t){let n=null;for(const s of this.providers)if(s.matches(t)){if(s.name!=="anthropic")return s;n=s}return n}getAll(){return[...this.providers]}}const gi=new TN,EN="https://api.anthropic.com",AN={MiniMax:"https://api.minimaxi.com/anthropic"},RN={name:"anthropic",matches(e){const t=e.toLowerCase();if(t.startsWith("openai-"))return!1;if(t.includes("claude")||t.includes("anthropic"))return!0;for(const n of Object.keys(AN))if(t.startsWith(n.toLowerCase()))return!0;return!0},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:EN},extractStream(e,t,n,s){return Um(e,t,n,s)}};gi.register(RN);const sc=1e3;function yr(e,t){if(!(e===null||typeof e!="object"||Array.isArray(e)))return Object.getOwnPropertyDescriptor(e,t)?.value}function rt(e,t){const n=yr(e,t);return typeof n=="string"?n:null}function Wm(e,t){const n=yr(e,t);return typeof n=="number"&&Number.isFinite(n)?n:null}function Ao(e,t){const n=yr(e,t);return n!==null&&typeof n=="object"&&!Array.isArray(n)?n:null}function IN(e,t){const n=yr(e,t);return Array.isArray(n)?n:[]}function zN(e){const t=[];let n=null,s=[];const o=()=>{n===null&&s.length===0||(t.push({event:n,data:s.join(`
|
|
87
87
|
`)}),n=null,s=[])};for(const i of e.split(`
|
|
88
|
-
`)){const a=i.endsWith("\r")?i.slice(0,-1):i;if(a===""){o();continue}if(a.startsWith(":"))continue;const l=a.indexOf(":"),c=l===-1?a:a.slice(0,l),u=l===-1?"":a.slice(l+1),d=u.startsWith(" ")?u.slice(1):u;switch(c){case"event":n=d;break;case"data":n===null&&s.length>0&&(d.startsWith("{")||d==="[DONE]")&&o(),s.push(d);break}}return o(),t}function
|
|
89
|
-
`)}function Cu(e,t){const n=e.usage,s=n?.input_tokens??null,o=n?.output_tokens??null;s!==null&&(t.inputTokens=s),o!==null&&(t.outputTokens=o);const i=n?.input_tokens_details?.cached_tokens??null;return i!==null&&(t.cacheReadInputTokens=i),{inputTokens:s,outputTokens:o}}function $i(e,t){const n=rt(e,"item_id");if(n!==null&&n.length>0)return n;const s=Um(e,"output_index");return s!==null?String(s):`function-${String(t)}`}function za(e,t){const n=e.get(t);if(n!==void 0)return n;const s={type:"function_call",arguments:""};return e.set(t,s),s}function z3(e,t,n){if(rt(n,"type")!=="function_call")return;const s=za(e,t),o=rt(n,"id"),i=rt(n,"call_id"),a=rt(n,"name"),l=rt(n,"arguments"),c=rt(n,"status");o!==null&&(s.id=o),i!==null&&(s.call_id=i),a!==null&&(s.name=a),l!==null&&(s.arguments=l),c!==null&&(s.status=c)}function O3(e,t){const n=[];e.length>0&&n.push({type:"message",role:"assistant",content:[{type:"output_text",text:e,annotations:[]}]});for(const s of t.values())n.push(s);return n}function P3(e,t,n){const s=t??Math.ceil(n.length/4);return{input_tokens:e,output_tokens:s,total_tokens:e===null?s:e+s}}function M3(e){const t=e.completedResponse===null?"":Vm(e.completedResponse),n=t.length>0?t:e.outputText,s=e.completedResponse?.output,o=s!==void 0&&s.length>0?s:O3(n,e.calls),i=e.completedResponse?.usage??P3(e.inputTokens,e.outputTokens,n);return{...e.completedResponse??{},id:e.completedResponse?.id??e.responseId,object:"response",created_at:e.completedResponse?.created_at??Math.floor(Date.now()/1e3),status:e.completedResponse?.status??e.status??"completed",model:e.completedResponse?.model??e.model,output:o,output_text:n,usage:i}}function L3(e,t,n,s){let o=null,i="",a=n??"",l=null,c="",u=null,d=null,f=0,h=0;const m=[],v=new Map;for(const b of e){if(b.data==="[DONE]")break;const y=sc(b.data);if(y===null)continue;const k=Wm(b,y);if(f===0&&(h=Date.now()),s&&Hm(m,f,h,k===""?"response.event":k,y),f++,Ia(t,y),k==="error")continue;const j=I3(y);if(j!==null){o=j,i=j.id,a=j.model??a,l=j.status??l;const T=Cu(j,t);u=T.inputTokens??u,d=T.outputTokens??d,Ia(t,j)}const C=rt(y,"delta");switch(k){case"response.output_text.delta":C!==null&&(c+=C);break;case"response.output_text.done":{const T=rt(y,"text");c.length===0&&T!==null&&(c=T);break}case"response.function_call_arguments.delta":{if(C!==null){const T=za(v,$i(y,v.size));T.arguments+=C}break}case"response.function_call_arguments.done":{const T=rt(y,"arguments");if(T!==null){const N=za(v,$i(y,v.size));N.arguments=T}break}case"response.output_item.added":case"response.output_item.done":{const T=Co(y,"item");z3(v,$i(y,v.size),T);break}case"response.failed":case"response.incomplete":l=k.slice(9);break;case"response.completed":l="completed";break}}s&&(t.streamingChunks={chunks:m,truncated:f>nc});const g=M3({completedResponse:o,responseId:i,model:a,status:l,outputText:c,calls:v,inputTokens:u,outputTokens:d}),x=co.safeParse(g);if(x.success){if(Cu(x.data,t).outputTokens===null){const y=Vm(x.data),k=Math.ceil(y.length/4);t.outputTokens=k}return JSON.stringify(x.data)}if(t.outputTokens===null){const b=rt(g,"output_text")??c,y=Math.ceil(b.length/4);t.outputTokens=y}return JSON.stringify(g)}function xi(e,t,n,s=!0){const o=E3(e);return o.some(A3)?L3(o,t,n,s):R3(o,t,n,s)}const D3={sessionId:null,threadId:null,turnId:null,installationId:null,windowId:null};function Oa(e,t){if(!(typeof e!="object"||e===null||Array.isArray(e)))return Object.getOwnPropertyDescriptor(e,t)?.value}function Wt(e,t){const n=Oa(e,t);return typeof n=="string"&&n.length>0?n:null}function $3(e){if(typeof e!="string"||e.length===0)return null;try{return JSON.parse(e)}catch{return null}}function F3(e){const t=Oa(e,"client_metadata");if(t===void 0)return D3;const n=$3(Oa(t,"x-codex-turn-metadata"));return{sessionId:Wt(t,"session_id")??Wt(n,"session_id"),threadId:Wt(t,"thread_id")??Wt(n,"thread_id"),turnId:Wt(t,"turn_id")??Wt(n,"turn_id"),installationId:Wt(t,"x-codex-installation-id")??Wt(n,"installation_id"),windowId:Wt(t,"x-codex-window-id")??Wt(n,"window_id")}}function Nu(e){return F3(e).sessionId}function B3(){return{inputTokens:null,outputTokens:null,cacheCreationInputTokens:null,cacheReadInputTokens:null}}function Tu(e){return e===void 0?null:e.get("x-agent-inspector-session-id")??e.get("x-session-affinity")}const U3={format:"openai",parseRequest(e,t){try{const n=JSON.parse(e),s=Tf.safeParse(n);if(s.success)return{model:s.data.model,sessionId:Nu(n)??Tu(t)};const o=Ef.safeParse(n);return o.success?{model:o.data.model,sessionId:Nu(n)??Tu(t)}:null}catch{return null}},extractTokens(e){const t=Rf(e);if(t){let s=null;try{const o=JSON.parse(e);if(o!==null&&typeof o=="object"&&!Array.isArray(o)){const i=Object.getOwnPropertyDescriptor(o,"usage");if(i!==void 0&&typeof i.value=="object"&&i.value!==null){const a=Object.getOwnPropertyDescriptor(i.value,"prompt_tokens_details");if(a!==void 0&&typeof a.value=="object"&&a.value!==null){const l=Object.getOwnPropertyDescriptor(a.value,"cached_tokens");l!==void 0&&typeof l.value=="number"&&(s=l.value)}}}}catch{}return{inputTokens:t.usage.prompt_tokens??null,outputTokens:t.usage.completion_tokens??null,cacheCreationInputTokens:null,cacheReadInputTokens:s}}const n=If(e);if(n!==null){const s=n.usage;return{inputTokens:s?.input_tokens??null,outputTokens:s?.output_tokens??null,cacheCreationInputTokens:null,cacheReadInputTokens:s?.input_tokens_details?.cached_tokens??null}}return B3()},extractStream(e,t,n,s){return xi(e,t,n,s)},detectFormat(e){if(e===null)return!1;try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=Object.keys(t);return n.includes("model")&&(n.includes("messages")||n.includes("input"))&&!n.includes("system")}return!1}catch{return!1}}};En.register(U3);const W3="https://api.openai.com/v1",H3={name:"openai",matches(e){const t=e.toLowerCase();return!!(t.startsWith("openai-")||t.includes("gpt-")||t.includes("o1")||t.includes("o2")||t.includes("o3"))},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:W3},extractStream(e,t,n,s){return xi(e,t,n,s)}};gi.register(H3);const V3="https://open.bigmodel.cn/api/paas/v4",q3=["glm-","charglm-","cogview-","embedding-","rerank-"],Z3={name:"zhipu",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return q3.some(n=>t.startsWith(n))},getUpstreamBase(e,t){return t?.baseUrl??V3},extractStream(e,t,n,s){return xi(e,t,n,s)}};gi.register(Z3);const G3="https://dashscope.aliyuncs.com/compatible-mode/v1",K3={name:"alibaba",matches(e){return!!e.toLowerCase().replace(/\s+/g,"-").startsWith("qwen")},getUpstreamBase(e,t){return G3},extractStream(e,t,n){return xi(e,t,n)}};gi.register(K3);function qm(e,t){for(const n of Array.from(e))t(n)}const J3=/[\u3000-\u9FFF\uAC00-\uD7FF\uF900-\uFAFF\uFF00-\uFFEF\u{1F300}-\u{1FAFF}]/u;function rc(e){if(e.length===0)return 0;let t=0,n=0;return qm(e,s=>{J3.test(s)?t+=1:n+=1}),Math.ceil(t*1)+Math.ceil(n/4)}function oc(e){if(e.length===0)return 0;let t=0;return qm(e,()=>{t+=1}),t}function ic(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function _e(e,t){return e===null||typeof e!="object"||Array.isArray(e)?void 0:Object.getOwnPropertyDescriptor(e,t)?.value}const Y3=["file","shell","browser","web","mcp","code","other"];function Pa(e){const t=e.replace(/\s+/g," ").trim();return t.length<=120?t:`${t.slice(0,119)}...`}function Zm(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?Pa(t.slice(0,n+1)):Pa(t)}function X3(e,t){return`${e} ${t??""}`.toLowerCase()}function rs(e,t){return t.some(n=>e.includes(n))}function Gm(e,t){const n=X3(e,t);return e.startsWith("mcp__")||e.startsWith("inspector_")||rs(n,[" mcp","model context protocol"])?"mcp":rs(n,["bash","shell","terminal","command","powershell","exec","process"])?"shell":rs(n,["browser","playwright","screenshot","click","navigate","page","tab"])?"browser":rs(n,["read","write","edit","file","glob","grep","patch","filesystem","directory"])?"file":rs(n,["web","search","http","url","fetch"])?"web":rs(n,["code","typescript","javascript","python","repl"])?"code":"other"}function Km(e){const t=_e(e,"properties");return t===null||typeof t!="object"||Array.isArray(t)?[]:Object.keys(t).sort((n,s)=>n.localeCompare(s))}function Jm(e){const t=_e(e,"required");if(!Array.isArray(t))return[];const n=[];for(const s of t)typeof s=="string"&&s.length>0&&n.push(s);return n.sort((s,o)=>s.localeCompare(o))}function Q3(e){const t=_e(e,"name");if(typeof t!="string"||t.length===0)return null;const n=_e(e,"description"),s=_e(e,"input_schema")??null,o=typeof n=="string"?n:null;return{name:t,description:o,descriptionPreview:Zm(o),category:Gm(t,o),parameterCount:Km(s).length,requiredParameters:Jm(s),schema:s}}function e4(e){const t=_e(e,"function"),n=_e(e,"type");if(t===void 0&&typeof n!="string")return null;const s=_e(t,"name")??_e(e,"name")??(typeof n=="string"?n:void 0);if(typeof s!="string"||s.length===0)return null;const o=_e(t,"description")??_e(e,"description"),i=_e(t,"parameters")??_e(e,"parameters")??null,a=typeof o=="string"?o:null;return{name:s,description:a,descriptionPreview:Zm(a),category:Gm(s,a),parameterCount:Km(i).length,requiredParameters:Jm(i),schema:i}}function t4(e){const t=e4(e);return t!==null?t:Q3(e)}function n4(e){if(e==null)return null;if(typeof e=="string")return e;const t=_e(e,"type"),n=_e(e,"name"),s=_e(_e(e,"function"),"name");if(typeof t=="string"&&typeof s=="string"&&s.length>0)return`${t}: ${s}`;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:Pa(o)}function s4(e){const t=new Map;for(const n of e)t.set(n.category,(t.get(n.category)??0)+1);return Y3.flatMap(n=>{const s=t.get(n)??0;return s>0?[{category:n,count:s}]:[]})}function ac(e){const t=_e(e,"tools");if(!Array.isArray(t)||t.length===0)return null;const n=[];for(const s of t){const o=t4(s);o!==null&&n.push(o)}return n.length===0?null:{tools:n,toolChoiceLabel:n4(_e(e,"tool_choice")),categories:s4(n)}}function $n(e){return{parsed:null,comparisonValue:e,messageCount:null,toolCount:null}}const xs={parsed:null,toolNames:null};function r4(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 s=n;switch(s.type){case"text":typeof s.text=="string"&&t.push(s.text);break;case"thinking":case"think":typeof s.thinking=="string"&&t.push(s.thinking);break;case"tool_use":{const i=typeof s.name=="string"?s.name:"",a=s.input!==void 0?JSON.stringify(s.input):"";t.push(`${i} ${a}`.trim());break}case"tool_result":{const i=s.content;if(typeof i=="string")t.push(i);else if(Array.isArray(i)){for(const a of i)if(a!==null&&typeof a=="object"){const l=a.text;typeof l=="string"&&t.push(l)}}break}case"image":t.push("[image]");break}}return t.join(`
|
|
90
|
-
`)}function
|
|
91
|
-
`)}function
|
|
92
|
-
`)}function Fi(e,t,n,s){return{role:e,label:t,text:n,size:
|
|
93
|
-
`)}function
|
|
94
|
-
`)}function
|
|
95
|
-
`)}function u4(e){return typeof e=="string"?e.length>0?1:0:Array.isArray(e)?e.length:e==null?null:1}function d4(e){if(typeof e=="string")return e;const t=_e(e,"text");if(typeof t=="string")return t;const n=Ma(_e(e,"content"));if(n.length>0)return n;const s=Ma(_e(e,"output"));if(s.length>0)return s;const o=_e(e,"arguments");return typeof o=="string"?o:""}function f4(e){const t=_e(e,"role");if(t==="system"||t==="user"||t==="assistant"||t==="tool")return t;const n=_e(e,"type");return n==="function_call_output"?"tool":"user"}function p4(e){const t=_e(e,"output");if(!Array.isArray(t))return[];const n=[];for(const s of t){if(_e(s,"type")!=="function_call")continue;const o=_e(s,"name");typeof o=="string"&&o.length>0&&n.push(o)}return n}function $s(e,t,n,s){return{role:e,label:t,text:n,size:rc(n),characters:oc(n),path:s}}const h4={format:"openai",analyzeRequest(e){if(e===null)return $n(e);try{const t=JSON.parse(e),n=ac(t)?.tools.length??null,s=Tf.safeParse(t);if(!s.success){const o=Ef.safeParse(t);return o.success?{parsed:o.data,comparisonValue:o.data,messageCount:u4(o.data.input),toolCount:n}:$n(e)}return{parsed:s.data,comparisonValue:s.data,messageCount:s.data.messages.length,toolCount:n}}catch{return $n(e)}},analyzeResponse(e){if(e===null)return xs;const t=Rf(e);if(t===null){const s=If(e);if(s===null)return xs;const o=p4(s);return{parsed:s,toolNames:o.length>0?o:null}}const n=t.choices[0]?.message?.tool_calls?.map(s=>s.function?.name??"").filter(s=>s!=="")??[];return{parsed:t,toolNames:n.length>0?n:null}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(typeof t.instructions=="string"&&t.instructions.length>0&&n.push($s("system","instructions",t.instructions,"/instructions")),Array.isArray(t.messages)&&t.messages.forEach((s,o)=>{if(s===null||typeof s!="object")return;const i=s,a=i.role==="user"||i.role==="assistant"||i.role==="system"||i.role==="tool"?i.role:"user",l=l4(i);n.push($s(a,`[${o}] ${a}`,l,`/messages/${o}`))}),Array.isArray(t.messages)||(typeof t.input=="string"&&t.input.length>0?n.push($s("user","input",t.input,"/input")):Array.isArray(t.input)&&t.input.forEach((s,o)=>{const i=f4(s),a=d4(s);n.push($s(i,`[${o}] ${i}`,a,`/input/${o}`))})),Array.isArray(t.tools)&&t.tools.length>0){const s=c4(t.tools);n.push($s("tools","tools",s,"/tools"))}return n.length>0?n:null}},m4={format:"unknown",analyzeRequest(e){return $n(e)},analyzeResponse(){return xs},anatomySegments(){return null}},g4={anthropic:a4,openai:h4,unknown:m4};function Ym(e){return g4[e]}function rr(e){const t=y3(e.path);return t==="unknown"?e.apiFormat:t}const Eu="bg-white/[0.045] hover:bg-white/[0.075] inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground";function Bi({icon:e,children:t,title:n,className:s}){return r.jsxs("span",{className:ie("bg-white/[0.045] inline-flex h-7 min-w-0 items-center gap-1.5 rounded-md px-2 text-xs text-muted-foreground",s),title:n,children:[e,r.jsx("span",{className:"min-w-0 font-mono tabular-nums",children:t})]})}function x4(){return r.jsxs("span",{className:"inline-flex h-6 shrink-0 items-center gap-1.5 rounded-md bg-amber-300/[0.10] px-1.5 font-mono text-[10px] uppercase tracking-[0.14em] text-amber-100/90 ring-1 ring-amber-200/10",title:"This session has a turn that has not finished yet",children:[r.jsx(Qe,{className:"size-3 animate-spin"}),"Turn open"]})}function b4({conversationId:e,startTime:t,endTime:n,totalCalls:s,totalInputTokens:o,totalOutputTokens:i,expanded:a,onToggle:l,providers:c,isLoading:u=!1,userAgent:d,clientPid:f,clientProjectFolder:h,showClientIdentity:m=!0,showProcessMetadata:v=!0,timeDisplayFormat:g,onClear:x}){const[b,y]=p.useState(!1),k=$=>{$.stopPropagation(),x!==void 0&&y(!0)},j=p.useCallback($=>{$.stopPropagation(),window.open(Fd(e),"_blank","noopener,noreferrer")},[e]),C=c?.map(({provider:$,models:ee})=>({provider:$,tooltip:ee.length===1?ee[0]??$:ee.join(", ")}))??[],T=Ll({userAgent:d,conversationId:e,clientProjectFolder:h}),N=Qo(T),O=d!=null&&d!=="",A=N??d??null,z=N!==null&&O?`${N} - ${d}`:null,D=e.startsWith("PID:")||e.includes("|"),E=e.length>24?e.slice(0,12)+"..."+e.slice(-12):e,L=Tl(t,n,g),w=`${s} call${s!==1?"s":""}`;return r.jsxs("div",{role:"button",tabIndex:0,"data-nav-id":`conv-${e}`,"data-nav-action":a?"collapse":"expand",className:ie("bg-card/80 shadow-sm relative flex cursor-pointer items-start gap-3 overflow-hidden rounded-[8px] px-3 py-2.5 transition-colors","hover:bg-card","select-none","sticky top-0 z-10 mb-2","focus-visible:ring-1 focus-visible:ring-cyan-300/35 focus-visible:outline-none"),onClick:l,onKeyDown:$=>{$.target===$.currentTarget&&($.key==="Enter"||$.key===" ")&&($.preventDefault(),l())},children:[r.jsx(p3,{items:C,ariaLabel:"Models used in this session",className:"mt-0.5"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[D&&v?f!=null?r.jsxs("span",{className:"min-w-0 max-w-full truncate font-mono text-xs font-semibold text-violet-200",title:`PID ${f}`,children:["PID ",f]}):r.jsx("span",{className:"min-w-0 max-w-full truncate font-mono text-xs font-semibold text-violet-200",title:e,children:e}):r.jsx("span",{className:"min-w-0 max-w-full truncate font-mono text-xs font-semibold text-violet-200",title:e,children:D?"sessionless":E}),!D&&v&&f!==null&&f!==void 0&&r.jsxs("span",{className:"bg-white/[0.045] shrink-0 rounded px-1.5 py-0.5 font-mono text-xs tabular-nums text-muted-foreground",title:`Client process ID ${f}`,children:["PID ",f]}),D&&v&&h!==null&&h!==void 0&&h!==""&&r.jsx("span",{className:"min-w-0 max-w-[240px] truncate font-mono text-xs text-muted-foreground",title:h,children:h}),m&&A!==null&&A!==""&&r.jsxs("span",{className:"bg-white/[0.045] inline-flex min-h-6 shrink-0 flex-wrap items-center gap-1 rounded-md px-1.5 py-0.5 text-xs text-muted-foreground",title:z??A,children:[r.jsx(ei,{client:T,className:"size-4 shrink-0"}),r.jsx("span",{className:"font-mono leading-snug tabular-nums",children:A})]}),u&&r.jsx(x4,{})]}),r.jsxs("span",{className:"mt-1.5 flex min-w-0 flex-wrap items-center gap-1.5",children:[r.jsx(Bi,{icon:r.jsx(sn,{className:"size-3 shrink-0"}),title:L,children:L}),r.jsx(Bi,{icon:r.jsx(Zo,{className:"size-3 shrink-0"}),children:w}),r.jsxs(Bi,{icon:r.jsx(tr,{className:"size-3 shrink-0"}),className:"max-w-full",children:[r.jsx("span",{className:"text-blue-400",children:Fe(o)})," / ",r.jsx("span",{className:"text-amber-400",children:Fe(i)})]})]})]}),r.jsxs("span",{className:"flex shrink-0 items-start gap-1.5",children:[r.jsx("button",{type:"button",onClick:j,onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&j($)},"aria-label":`Open session ${e} in a new tab`,title:"Open this session in a new tab",className:Eu,children:r.jsx(jl,{className:"size-3.5"})}),x!==void 0&&r.jsx("button",{type:"button",onClick:k,"aria-label":`Clear group (${s} request${s!==1?"s":""})`,title:"Clear this group from the current view",className:Eu,children:r.jsx(wn,{className:"size-3.5"})}),r.jsx("span",{className:"bg-white/[0.045] hover:bg-white/[0.075] inline-flex size-8 shrink-0 items-center justify-center rounded-md text-slate-200","aria-hidden":"true",children:a?r.jsx(ot,{className:"size-4 shrink-0"}):u?r.jsx(Qe,{className:"size-4 shrink-0 animate-spin"}):r.jsx(Tt,{className:"size-4 shrink-0"})})]}),u&&r.jsx("span",{className:"pointer-events-none absolute inset-x-3 bottom-0 h-px overflow-hidden rounded-full bg-white/[0.06]","aria-hidden":"true",children:r.jsx("span",{className:"absolute inset-y-0 left-0 w-1/3 animate-pulse rounded-full bg-amber-200/65 shadow-[0_0_14px_rgba(252,211,77,0.32)]"})}),r.jsx(Xp,{open:b,onOpenChange:y,title:"Clear this group from the current view?",description:`This will hide ${s} request${s!==1?"s":""} from the current view. Stored logs remain reloadable.`,confirmLabel:"Clear",variant:"destructive",onConfirm:()=>{x?.()}})]})}function v4(e){if(e.sessionId!==null&&e.sessionId!==""&&e.sessionId!==void 0)return e.sessionId;if(e.isTest===!0)return"provider-test";const t=e.clientPid!==null&&e.clientPid!==void 0,n=e.clientProjectFolder!==null&&e.clientProjectFolder!==void 0;if(!t&&!n)return"default";const s=t?`PID:${e.clientPid}`:"unknown",o=n?e.clientProjectFolder:"no-folder";return`${s}|${o}`}function y4(e){const t=new Map;for(const s of e){const o=v4(s),i=t.get(o);i!==void 0?i.push(s):t.set(o,[s])}const n=[];for(const[s,o]of t){const i=[...o].sort((a,l)=>a.timestamp.localeCompare(l.timestamp));n.push({id:s,conversationId:s,logs:i})}return n.sort((s,o)=>(s.logs[0]?.timestamp??"").localeCompare(o.logs[0]?.timestamp??"")),n}function w4(e,t,n){const s=new Array(e);return new Proxy(s,{get(o,i,a){if(typeof i=="string"){const l=i.charCodeAt(0);if(l>=48&&l<=57){const c=+i;if(Number.isInteger(c)&&c>=0&&c<e){let u=o[c];if(!u){const d=t[c*2];u=o[c]={index:c,key:n(c),start:d,size:t[c*2+1],end:d+t[c*2+1],lane:0}}return u}}if(i==="length")return e}return Reflect.get(o,i,a)}})}function os(e,t,n){let s=n.initialDeps??[],o,i=!0;function a(){const l=e();return(l.length!==s.length||l.some((u,d)=>s[d]!==u))&&(s=l,o=t(...l),n?.onChange&&!(i&&n.skipInitialOnChange)&&n.onChange(o),i=!1),o}return a.updateDeps=l=>{s=l},a}function Au(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const Ru=(e,t)=>Math.abs(e-t)<1.01,_4=(e,t,n)=>{let s;return function(...o){e.clearTimeout(s),s=e.setTimeout(()=>t.apply(this,o),n)}};let Fs;const Iu=()=>{if(Fs!==void 0)return Fs;if(typeof navigator>"u")return Fs=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Fs=!0;const e=navigator.maxTouchPoints;return Fs=navigator.platform==="MacIntel"&&e!==void 0&&e>0},zu=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},k4=e=>e,j4=e=>{const t=Math.max(e.startIndex-e.overscan,0),s=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,o=new Array(s);for(let i=0;i<s;i++)o[i]=t+i;return o},S4=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;const o=a=>{const{width:l,height:c}=a;t({width:Math.round(l),height:Math.round(c)})};if(o(zu(n)),!s.ResizeObserver)return()=>{};const i=new s.ResizeObserver(a=>{const l=()=>{const c=a[0];if(c?.borderBoxSize){const u=c.borderBoxSize[0];if(u){o({width:u.inlineSize,height:u.blockSize});return}}o(zu(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},or={passive:!0},C4=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=()=>{t({width:n.innerWidth,height:n.innerHeight})};return s(),n.addEventListener("resize",s,or),()=>{n.removeEventListener("resize",s)}},N4=typeof window>"u"?!0:"onscrollend"in window,Xm=(e,t,n)=>{const s=e.scrollElement;if(!s)return;const o=e.targetWindow;if(!o)return;const i=e.options.useScrollendEvent&&N4;let a=0;const l=i?null:_4(o,()=>t(a,!1),e.options.isScrollingResetDelay),c=f=>()=>{a=n(s),l?.(),t(a,f)},u=c(!0),d=c(!1);return s.addEventListener("scroll",u,or),i&&s.addEventListener("scrollend",d,or),()=>{s.removeEventListener("scroll",u),i&&s.removeEventListener("scrollend",d)}},T4=(e,t)=>Xm(e,t,n=>{const{horizontal:s,isRtl:o}=e.options;return s?n.scrollLeft*(o&&-1||1):n.scrollTop}),E4=(e,t)=>Xm(e,t,n=>e.options.horizontal?n.scrollX:n.scrollY),A4=(e,t,n)=>{if(t?.borderBoxSize){const s=t.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},Qm=(e,{adjustments:t=0,behavior:n},s)=>{var o,i;(i=(o=s.scrollElement)==null?void 0:o.scrollTo)==null||i.call(o,{[s.options.horizontal?"left":"top"]:e+t,behavior:n})},R4=Qm,I4=Qm;class z4{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,s,o;return((o=(s=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:s.now)==null?void 0:o.call(s))??Date.now()},this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(o=>{o.forEach(i=>{const a=()=>{const l=i.target,c=this.indexFromElement(l);if(!l.isConnected){this.observer.unobserve(l);for(const[u,d]of this.elementsCache)if(d===l){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(l,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var o;(o=s())==null||o.disconnect(),n=null},observe:o=>{var i;return(i=s())==null?void 0:i.observe(o,{box:"border-box"})},unobserve:o=>{var i;return(i=s())==null?void 0:i.unobserve(o)}}})(),this.range=null,this.setOptions=n=>{var s,o;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:k4,rangeExtractor:j4,onChange:()=>{},measureElement:A4,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate"};for(const u in n){const d=n[u];d!==void 0&&(i[u]=d)}const a=this.options;let l=null,c=null;if(a!==void 0&&a.enabled&&i.enabled&&i.anchorTo==="end"&&this.scrollElement!==null){const u=a.count,d=i.count,f=this.getMeasurements(),h=u>0?((s=f[0])==null?void 0:s.key)??a.getItemKey(0):null,m=u>0?((o=f[u-1])==null?void 0:o.key)??a.getItemKey(u-1):null;if(d!==u||u>0&&d>0&&(i.getItemKey(0)!==h||i.getItemKey(d-1)!==m)){const x=u>0?this.getVirtualItemForOffset(this.getScrollOffset())??f[0]:null;x&&(l=[x.key,this.getScrollOffset()-x.start]);const b=i.followOnAppend===!0?"auto":i.followOnAppend||null;b&&d>u&&this.isAtEnd(a.scrollEndThreshold)&&(u===0||i.getItemKey(d-1)!==m)&&(c=b)}}this.options=i,(l||c)&&(this.pendingScrollAnchor=[l?.[0]??null,l?.[1]??0,c])},this.notify=n=>{var s,o;(o=(s=this.options).onChange)==null||o.call(s,this,n)},this.maybeNotify=os(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}if(this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,a)=>{this._intendedScrollOffset!==null&&Math.abs(i-this._intendedScrollOffset)<1.5&&(i=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=a?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=a,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const i=this.scrollElement,a=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},l=()=>{this._iosTouching=!1,!(!Iu()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",a,or),i.addEventListener("touchend",l,or),this.unsubs.push(()=>{i.removeEventListener("touchstart",a),i.removeEventListener("touchend",l),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const o=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled){const[i,a,l]=o;if(i!==null){const{count:c,getItemKey:u}=this.options;let d=0;for(;d<c&&u(d)!==i;)d++;const f=d<c?this.getMeasurements()[d]:void 0;if(f){const h=f.start+a-this.getScrollOffset();Ru(h,0)||this.applyScrollAdjustment(h)}}l&&this.scrollToEnd({behavior:l})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),s=this.getMaxScrollOffset();if(n<0||n>s)return;const o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=o,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,s)=>{const o=new Map,i=new Map;for(let a=s-1;a>=0;a--){const l=n[a];if(o.has(l.lane))continue;const c=i.get(l.lane);if(c==null||l.end>c.end?i.set(l.lane,l):l.end<c.end&&o.set(l.lane,!0),o.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((a,l)=>a.end===l.end?a.index-l.index:a.end-l.end)[0]:void 0},this.getMeasurementOptions=os(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,s,o,i,a,l,c)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMin=null,{count:n,paddingStart:s,scrollMargin:o,getItemKey:i,enabled:a,lanes:l,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=os(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:s,scrollMargin:o,getItemKey:i,enabled:a,lanes:l,laneAssignmentMode:c},u)=>{const d=this.itemSizeCache;if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const v of this.laneAssignments.keys())v>=n&&this.laneAssignments.delete(v);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(v=>{this.itemSizeCache.set(v.key,v.size)}));const f=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),l===1){const v=this.options.gap,g=n*2;let x=this._flatMeasurements;if(!x||x.length<g){const k=new Float64Array(g);x&&f>0&&k.set(x.subarray(0,f*2)),x=k,this._flatMeasurements=x}let b;if(f===0)b=s+o;else{const k=f-1;b=x[k*2]+x[k*2+1]+v}for(let k=f;k<n;k++){const j=i(k),C=d.get(j),T=typeof C=="number"?C:this.options.estimateSize(k);x[k*2]=b,x[k*2+1]=T,b+=T+v}const y=w4(n,x,i);return this.measurementsCache=y,y}const h=this.measurementsCache.slice(0,f),m=new Array(l).fill(void 0);for(let v=0;v<f;v++){const g=h[v];g&&(m[g.lane]=v)}for(let v=f;v<n;v++){const g=i(v),x=this.laneAssignments.get(v);let b,y;const k=c==="estimate"||d.has(g);if(x!==void 0&&this.options.lanes>1){b=x;const N=m[b],O=N!==void 0?h[N]:void 0;y=O?O.end+this.options.gap:s+o}else{const N=this.options.lanes===1?h[v-1]:this.getFurthestMeasurement(h,v);y=N?N.end+this.options.gap:s+o,b=N?N.lane:v%this.options.lanes,this.options.lanes>1&&k&&this.laneAssignments.set(v,b)}const j=d.get(g),C=typeof j=="number"?j:this.options.estimateSize(v),T=y+C;h[v]={index:v,start:y,size:C,end:T,key:g,lane:b},m[b]=v}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=os(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,o,i)=>this.range=n.length>0&&s>0?O4({measurements:n,outerSize:s,scrollOffset:o,lanes:i,flat:i===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=os(()=>{let n=null,s=null;const o=this.calculateRange();return o&&(n=o.startIndex,s=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,s]},(n,s,o,i,a)=>i===null||a===null?[]:n({startIndex:i,endIndex:a,overscan:s,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,o=n.getAttribute(s);return o?parseInt(o,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(o!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,o-i),l=Math.min(this.options.count-1,o+i);return n>=a&&n<=l}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((a,l)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(l))});return}const s=this.indexFromElement(n),o=this.options.getItemKey(s),i=this.elementsCache.get(o);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(o,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,s)=>{var o,i;if(n<0||n>=this.options.count)return;let a,l,c;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)c=this.options.getItemKey(n),l=u[n*2],a=u[n*2+1];else{const h=this.measurementsCache[n];if(!h)return;c=h.key,l=h.start,a=h.size}const d=this.itemSizeCache.get(c)??a,f=s-d;if(f!==0){const h=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,m=h?this.getTotalSize():0,v=((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:c,start:l,size:a,end:l+a,lane:0},f,this):l<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(c,s),this.itemSizeCacheVersion++,h?this.applyScrollAdjustment(this.getTotalSize()-m):v&&this.applyScrollAdjustment(f),this.notify(!1)}},this.getVirtualItems=os(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,s)=>{const o=[];for(let i=0,a=n.length;i<a;i++){const l=n[i],c=s[l];o.push(c)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length===0)return;const o=this._flatMeasurements,i=this.options.lanes===1&&o!=null,a=e0(0,s.length-1,i?l=>o[l*2]:l=>Au(s[l]).start,n);return Au(s[a])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,s,o=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),a=this.getScrollOffset();s==="auto"&&(s=n>=a+i?"end":"start"),s==="center"?n+=(o-i)/2:s==="end"&&(n-=i);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const o=this.getSize(),i=this.getScrollOffset(),a=this.measurementsCache[n];if(!a)return;if(s==="auto")if(a.end>=i+o-this.options.scrollPaddingEnd)s="end";else if(a.start<=i+this.options.scrollPaddingStart)s="start";else return[i,s];if(s==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),s];const l=s==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,s,a.size),s]},this.scrollToOffset=(n,{align:s="start",behavior:o="auto"}={})=>{const i=this.getOffsetForAlignment(n,s),a=this.now();this.scrollState={index:null,align:s,behavior:o,startedAt:a,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:s="auto",behavior:o="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getOffsetForIndex(n,s);if(!i)return;const[a,l]=i,c=this.now();this.scrollState={index:n,align:l,behavior:o,startedAt:c,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:s="auto"}={})=>{const o=this.getScrollOffset()+n,i=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:i,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const s=this.getMeasurements();let o;if(s.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const i=s.length-1,a=this._flatMeasurements;a!=null?o=a[i*2]+a[i*2+1]:o=((n=s[i])==null?void 0:n.end)??0}else{const i=Array(this.options.lanes).fill(null);let a=s.length-1;for(;a>=0&&i.some(l=>l===null);){const l=s[a];i[l.lane]===null&&(i[l.lane]=l.end),a--}o=Math.max(...i.filter(l=>l!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const s=this.getMeasurements();for(const o of s)o&&this.itemSizeCache.has(o.key)&&n.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return n},this._scrollToOffset=(n,{adjustments:s,behavior:o})=>{this._intendedScrollOffset=n+(s??0),this.options.scrollToFn(n,{behavior:o,adjustments:s},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,n){t!==0&&(Iu()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:n}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=s?s[0]:this.scrollState.lastTargetOffset,i=1,a=o!==this.scrollState.lastTargetOffset;if(!a&&Ru(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,a){const l=this.getSize()||600,c=Math.abs(o-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&c>l;this.scrollState.lastTargetOffset=o,u||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const e0=(e,t,n,s)=>{for(;e<=t;){const o=(e+t)/2|0,i=n(o);if(i<s)e=o+1;else if(i>s)t=o-1;else return o}return e>0?e-1:0};function O4({measurements:e,outerSize:t,scrollOffset:n,lanes:s,flat:o}){const i=e.length-1,a=o?d=>o[d*2]:d=>e[d].start,l=o?d=>o[d*2]+o[d*2+1]:d=>e[d].end;if(e.length<=s)return{startIndex:0,endIndex:i};let c=e0(0,i,a,n),u=c;if(s===1)for(;u<i&&l(u)<n+t;)u++;else if(s>1){const d=Array(s).fill(0);for(;u<i&&d.some(h=>h<n+t);){const h=e[u];d[h.lane]=h.end,u++}const f=Array(s).fill(n+t);for(;c>=0&&f.some(h=>h>=n);){const h=e[c];f[h.lane]=h.start,c--}c=Math.max(0,c-c%s),u=Math.min(i,u+(s-1-u%s))}return{startIndex:c,endIndex:u}}const Ou=typeof document<"u"?p.useLayoutEffect:p.useEffect;function t0({useFlushSync:e=!0,...t}){const n=p.useReducer(i=>i+1,0)[1],s={...t,onChange:(i,a)=>{var l;e&&a?cr.flushSync(n):n(),(l=t.onChange)==null||l.call(t,i,a)}},[o]=p.useState(()=>new z4(s));return o.setOptions(s),Ou(()=>o._didMount(),[]),Ou(()=>o._willUpdate()),o}function P4(e){return t0({observeElementRect:S4,observeElementOffset:T4,scrollToFn:I4,...e})}function M4(e){return t0({getScrollElement:()=>typeof document<"u"?window:null,observeElementRect:C4,observeElementOffset:E4,scrollToFn:R4,initialOffset:()=>typeof document<"u"?window.scrollY:0,...e})}const ln="agent-inspector:focus-log";function ir(e){window.dispatchEvent(new CustomEvent(ln,{detail:e}))}function bi(e){if(typeof CustomEvent>"u"||!(e instanceof CustomEvent))return null;const t=e.detail,n=_e(t,"logId");if(typeof n!="number"||!Number.isInteger(n)||n<0)return null;const s=_e(t,"tab");switch(s){case"anatomy":case"request":case"response":break;case void 0:break;default:return null}const o=_e(t,"source"),i=_e(t,"toolCallIndex"),a=typeof i=="number"&&Number.isInteger(i)&&i>=0?{logId:n,tab:s??"request",toolCallIndex:i}:{logId:n,tab:s??"request"};switch(o){case"virtualizer":return{...a,source:o};case void 0:return a;default:return null}}function zt({className:e,style:t,d:n,eyeStalks:s,eyes:o,legs:i,extras:a}){return r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:t,className:ie("inline-block size-5",e),children:[r.jsx("path",{d:n}),s,o,i,a]})}const An=r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),r.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),r.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),r.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]}),n0=r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"7",y1:"16",x2:"5.5",y2:"18.5"}),r.jsx("line",{x1:"9.5",y1:"17",x2:"8.5",y2:"19.5"}),r.jsx("line",{x1:"14.5",y1:"17",x2:"15.5",y2:"19.5"}),r.jsx("line",{x1:"17",y1:"16",x2:"18.5",y2:"18.5"})]});function s0({className:e}){return r.jsx(zt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),r.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"})]}),legs:An,extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),r.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 L4({className:e}){return r.jsx(zt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"9.5",y1:"6.5",x2:"9.5",y2:"4.5"}),r.jsx("line",{x1:"14.5",y1:"6.5",x2:"14.5",y2:"4.5"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"9.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"14.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"})]}),legs:n0,extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M5 11 C4 9.5 2.5 10 3 12 C3.5 13.5 4.5 13 5 12"}),r.jsx("path",{d:"M19 11 C20 9.5 21.5 10 21 12 C20.5 13.5 19.5 13 19 12"})]})})}function D4({className:e}){return r.jsx(zt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"7",y1:"7",x2:"6.5",y2:"4.5"}),r.jsx("line",{x1:"17",y1:"7",x2:"17.5",y2:"4.5"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"6.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"17.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:An,extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M4 12 C2.5 10.5 1 11 1.5 13 C2 14.5 3.5 14 4.5 13"}),r.jsx("path",{d:"M20 12 C21.5 10.5 23 11 22.5 13 C22 14.5 20.5 14 19.5 13"})]})})}function $4({className:e}){return r.jsx(zt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"10",y1:"6.5",x2:"10",y2:"3.5"}),r.jsx("line",{x1:"14",y1:"6.5",x2:"14",y2:"3.5"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"10",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"14",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"7",y1:"17",x2:"5",y2:"20.5"}),r.jsx("line",{x1:"9.5",y1:"18.5",x2:"8.5",y2:"21.5"}),r.jsx("line",{x1:"14.5",y1:"18.5",x2:"15.5",y2:"21.5"}),r.jsx("line",{x1:"17",y1:"17",x2:"19",y2:"20.5"})]}),extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M6.5 11 C5 8.5 3 9 3.5 11.5 C4 13.5 5 13 6 12"}),r.jsx("path",{d:"M17.5 11 C19 8.5 21 9 20.5 11.5 C20 13.5 19 13 18 12"})]})})}function F4({className:e}){return r.jsx(zt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),r.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:An,extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),r.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 B4({className:e}){return r.jsx(zt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),r.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),r.jsx("line",{x1:"13.5",y1:"4",x2:"15.5",y2:"5"})]}),legs:An,extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),r.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 U4({className:e}){return r.jsx(zt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"10",y1:"8",x2:"10",y2:"6"}),r.jsx("line",{x1:"14",y1:"8",x2:"14",y2:"6"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"9",y1:"6",x2:"11",y2:"6.5"}),r.jsx("line",{x1:"13",y1:"6",x2:"15",y2:"6.5"})]}),legs:n0,extras:r.jsxs(r.Fragment,{children:[r.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"}),r.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 W4({className:e}){return r.jsx(zt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),r.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:An,extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),r.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),r.jsx("line",{x1:"8.5",y1:"4",x2:"10.5",y2:"4.5"}),r.jsx("line",{x1:"15.5",y1:"4",x2:"13.5",y2:"4.5"}),r.jsx("path",{d:"M9 15.5 C10 14.5 14 14.5 15 15.5"})]})})}function H4({className:e}){return r.jsx(zt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),r.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"9.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"}),r.jsx("circle",{cx:"14.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"})]}),legs:An,extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),r.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),r.jsx("ellipse",{cx:"12",cy:"15",rx:"2",ry:"1.5",fill:"currentColor",stroke:"none"})]})})}function V4({className:e}){return r.jsx(zt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"9.5",y1:"7",x2:"9",y2:"5"}),r.jsx("line",{x1:"14.5",y1:"7",x2:"15",y2:"5"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"9",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"15",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"})]}),legs:An,extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M5 11 C3.5 9 2 9.5 2.5 12 C3 14 4 13 5 12"}),r.jsx("path",{d:"M19 11 C20.5 9 22 9.5 21.5 12 C21 14 20 13 19 12"}),r.jsx("path",{d:"M9 14.5 C10 16 14 16 15 14.5"}),r.jsx("circle",{cx:"7",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"}),r.jsx("circle",{cx:"17",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"})]})})}function q4({className:e}){return r.jsx(zt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5.5"}),r.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5.5"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"7.5",y1:"5.5",x2:"16.5",y2:"5.5"}),r.jsx("rect",{x:"7",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"}),r.jsx("rect",{x:"13",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"})]}),legs:An,extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),r.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),r.jsx("path",{d:"M9.5 15 C10.5 16 13.5 16 14.5 15"})]})})}function Z4({className:e}){return r.jsx(zt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"10.5",y1:"9.5",x2:"10.5",y2:"8"}),r.jsx("line",{x1:"13.5",y1:"9.5",x2:"13.5",y2:"8"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"10.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"13.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"8",y1:"16",x2:"6.5",y2:"18"}),r.jsx("line",{x1:"10",y1:"17",x2:"9.5",y2:"19"}),r.jsx("line",{x1:"14",y1:"17",x2:"14.5",y2:"19"}),r.jsx("line",{x1:"16",y1:"16",x2:"17.5",y2:"18"})]}),extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M7.5 12 C6.5 11 5.5 11.5 6 13 C6.5 14 7 13.5 7.5 13"}),r.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 ar=[s0,L4,D4,$4,F4,B4,U4,W4,H4,V4,q4,Z4];function lc(e){return ar[Math.abs(e)%ar.length]??s0}function G4(e){const t=ar.length-2;return t<=0?0:1+((Number.isFinite(e)?Math.trunc(e):0)%t+t)%t}function K4(e){return lc(G4(e))}const J4="x-anthropic-billing-header:";function Y4(e){return e.trimStart().toLowerCase().startsWith(J4)}function X4(e){return ic(e)?Object.prototype.hasOwnProperty.call(e,"system"):!1}function Q4(e){if(!ic(e))return!1;const t=_e(e,"type"),n=_e(e,"text");return typeof t!="string"||t!=="text"||typeof n!="string"?!1:Y4(n)}function eT(e){let t;try{t=JSON.parse(e)}catch{return{body:e,removed:0}}if(!X4(t))return{body:e,removed:0};const n=t.system;if(!Array.isArray(n)||n.length===0)return{body:e,removed:0};const s=[];let o=0;for(const i of n){if(Q4(i)){o+=1;continue}s.push(i)}return o===0?{body:e,removed:0}:(s.length===0?delete t.system:t.system=s,{body:JSON.stringify(t),removed:o})}const tT=400,Pu=2e3;function nT(e){return Array.isArray(e)}function sT(e,t){const n=[e];let s=0;for(;n.length>0;){const o=n.pop();if(o!==void 0){if(s+=1,s>t)return s;if(!(o===null||typeof o!="object")){if(nT(o)){for(const i of o)n.push(i);continue}for(const i of Object.keys(o)){const a=o[i];a!==void 0&&n.push(a)}}}}return s}function rT(e){const t=sT(e,Pu+1);return t<=tT?{depth:Number.POSITIVE_INFINITY}:t<=Pu?{depth:3}:{depth:2}}function oT(e){try{const t=JSON.parse(e);return{kind:"json",data:No(t)}}catch{return{kind:"text"}}}function Ui(e){const t=p.useMemo(()=>e===null?null:oT(e),[e]),n=t?.kind==="json"?t.data:null,s=p.useMemo(()=>n===null?null:rT(n),[n]),[o,i]=p.useState(!1),[a,l]=p.useState(0),[c,u]=p.useState(0),[d,f]=p.useTransition(),h=p.useCallback(()=>{const m=!o,v=m&&s!==null?s.depth:0;f(()=>{i(m),l(v),u(g=>g+1)})},[o,s]);return{parsedData:n,policy:s,isExpanded:o,toggle:h,isPending:d,bulkDepth:a,bulkRevision:c}}function No(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=>No(n));const t={};for(const n of Object.keys(e)){const s=Object.getOwnPropertyDescriptor(e,n);t[n]=No(s?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function r0({className:e,orientation:t="horizontal",...n}){return r.jsx(BN,{"data-slot":"tabs","data-orientation":t,orientation:t,className:ie("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",e),...n})}const iT=Ml("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 o0({className:e,variant:t="default",...n}){return r.jsx(UN,{"data-slot":"tabs-list","data-variant":t,className:ie(iT({variant:t}),e),...n})}function St({className:e,...t}){return r.jsx(WN,{"data-slot":"tabs-trigger",className:ie("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 Ct({className:e,...t}){return r.jsx(HN,{"data-slot":"tabs-content",className:ie("flex-1 outline-none",e),...t})}function gn(e){const[t,n]=p.useState(!1),s=p.useRef(null);p.useEffect(()=>()=>{s.current!==null&&clearTimeout(s.current)},[]);const o=p.useCallback(i=>{i.stopPropagation(),e!==null&&Nt(e).then(a=>{a&&(n(!0),s.current!==null&&clearTimeout(s.current),s.current=setTimeout(()=>n(!1),2e3))})},[e]);return{copied:t,copy:o}}const aT=p.lazy(()=>Vn(()=>import("./CompareDrawer-BJmxAiM0.js"),__vite__mapDeps([0,1])).then(e=>({default:e.CompareDrawer}))),lT=p.lazy(()=>Vn(()=>import("./ReplayDialog-CkLdOMJr.js"),__vite__mapDeps([2,1,3])).then(e=>({default:e.ReplayDialog}))),cT=p.lazy(()=>Vn(()=>import("./RequestAnatomy-DemOFfSc.js"),__vite__mapDeps([4,1])).then(e=>({default:e.RequestAnatomy}))),uT=p.lazy(()=>Vn(()=>import("./ResponseView-9LhpuDo7.js"),__vite__mapDeps([3,1])).then(e=>({default:e.ResponseView}))),dT=p.lazy(()=>Vn(()=>import("./StreamingChunkSequence-RRWYBOdz.js"),__vite__mapDeps([5,1])).then(e=>({default:e.StreamingChunkSequence}))),La=p.lazy(()=>Vn(()=>import("./json-viewer-D8gvbDlB.js"),__vite__mapDeps([6,1])).then(e=>({default:e.JsonViewer}))),fT=p.lazy(()=>Vn(()=>import("./json-viewer-D8gvbDlB.js"),__vite__mapDeps([6,1])).then(e=>({default:e.JsonViewerFromString}))),pT=1200,hT=12;function mT(e){const{containerRef:t,setExpandToPath:n,ensureTabActive:s,highlightMs:o}=e,i=p.useRef(null);return p.useCallback(a=>{s?.(),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"),i.current!==null&&clearTimeout(i.current),i.current=setTimeout(()=>{f.classList.remove("ring-2","ring-primary/60","ring-offset-1","ring-offset-background","rounded-sm","transition-shadow"),n(null)},o??pT)},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 m=h.querySelector(u);if(m!==null){l(m);return}}f>0?window.requestAnimationFrame(()=>d(f-1)):n(null)};window.requestAnimationFrame(()=>d(hT))},[t,s,o,n])}const Mu="The compact log metadata is still available. Retry if the local server was restarting or the body store was briefly unavailable.";function ps(e){return e<1024?`${e.toLocaleString()} 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 gT(e,t){const n=[];return e!=null&&n.push(`Request ${ps(e)}`),t!=null&&n.push(`Response ${ps(t)}`),n.length===0?null:n.join(" · ")}function xT(e){if(e instanceof Vo)return{title:"Full bodies timed out",detail:"The log store did not answer before the UI timeout. Compact metadata is still available; retry loading the bodies."};if(e instanceof Error){const t=e.message.trim();return{title:"Full bodies could not be loaded",detail:t===""?Mu:t}}return{title:"Full bodies could not be loaded",detail:Mu}}class i0{diff(t,n,s={}){let o;typeof s=="function"?(o=s,s={}):"callback"in s&&(o=s.callback);const i=this.castInput(t,s),a=this.castInput(n,s),l=this.removeEmpty(this.tokenize(i,s)),c=this.removeEmpty(this.tokenize(a,s));return this.diffWithOptionsObj(l,c,s,o)}diffWithOptionsObj(t,n,s,o){var i;const a=y=>{if(y=this.postProcess(y,s),o){setTimeout(function(){o(y)},0);return}else return y},l=n.length,c=t.length;let u=1,d=l+c;s.maxEditLength!=null&&(d=Math.min(d,s.maxEditLength));const f=(i=s.timeout)!==null&&i!==void 0?i:1/0,h=Date.now()+f,m=[{oldPos:-1,lastComponent:void 0}];let v=this.extractCommon(m[0],n,t,0,s);if(m[0].oldPos+1>=c&&v+1>=l)return a(this.buildValues(m[0].lastComponent,n,t));let g=-1/0,x=1/0;const b=()=>{for(let y=Math.max(g,-u);y<=Math.min(x,u);y+=2){let k;const j=m[y-1],C=m[y+1];j&&(m[y-1]=void 0);let T=!1;if(C){const O=C.oldPos-y;T=C&&0<=O&&O<l}const N=j&&j.oldPos+1<c;if(!T&&!N){m[y]=void 0;continue}if(!N||T&&j.oldPos<C.oldPos?k=this.addToPath(C,!0,!1,0,s):k=this.addToPath(j,!1,!0,1,s),v=this.extractCommon(k,n,t,y,s),k.oldPos+1>=c&&v+1>=l)return a(this.buildValues(k.lastComponent,n,t))||!0;m[y]=k,k.oldPos+1>=c&&(x=Math.min(x,y-1)),v+1>=l&&(g=Math.max(g,y+1))}u++};if(o)(function y(){setTimeout(function(){if(u>d||Date.now()>h)return o(void 0);b()||y()},0)})();else for(;u<=d&&Date.now()<=h;){const y=b();if(y)return y}}addToPath(t,n,s,o,i){const a=t.lastComponent;return a&&!i.oneChangePerToken&&a.added===n&&a.removed===s?{oldPos:t.oldPos+o,lastComponent:{count:a.count+1,added:n,removed:s,previousComponent:a.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:n,removed:s,previousComponent:a}}}extractCommon(t,n,s,o,i){const a=n.length,l=s.length;let c=t.oldPos,u=c-o,d=0;for(;u+1<a&&c+1<l&&this.equals(s[c+1],n[u+1],i);)u++,c++,d++,i.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!i.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,s){return s.comparator?s.comparator(t,n):t===n||!!s.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let s=0;s<t.length;s++)t[s]&&n.push(t[s]);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,s){const o=[];let i;for(;t;)o.push(t),i=t.previousComponent,delete t.previousComponent,t=i;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(s.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,m){const v=s[u+m];return v.length>h.length?v: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 bT extends i0{constructor(){super(...arguments),this.tokenize=l0}equals(t,n,s){return s.ignoreWhitespace?((!s.newlineIsToken||!t.includes(`
|
|
88
|
+
`)){const a=i.endsWith("\r")?i.slice(0,-1):i;if(a===""){o();continue}if(a.startsWith(":"))continue;const l=a.indexOf(":"),c=l===-1?a:a.slice(0,l),u=l===-1?"":a.slice(l+1),d=u.startsWith(" ")?u.slice(1):u;switch(c){case"event":n=d;break;case"data":n===null&&s.length>0&&(d.startsWith("{")||d==="[DONE]")&&o(),s.push(d);break}}return o(),t}function rc(e){try{return JSON.parse(e)}catch{return null}}function Hm(e,t){if(e.event!==null&&e.event!=="")return e.event;const n=I2.safeParse(t);return n.success?n.data.type:""}function PN(e){if(e.data==="[DONE]")return!1;const t=rc(e.data),n=Hm(e,t);return n.startsWith("response.")||n==="error"}function Vm(e,t,n,s,o){e.length>=sc||e.push({index:t,timestamp:Date.now()-n,type:s,data:o})}function Ia(e,t){const n=Ao(t,"error"),s=rt(n,"message")??rt(t,"message")??rt(t,"error");s!==null&&s.length>0&&(e.error=s)}function ON(e,t,n,s){let o="",i="",a="",l="",c=null,u=0,d=0,f=!1,h=!1;const m=new Map;let v=0,g=0;const x=[];for(const y of e){if(y.data==="[DONE]")break;const k=rc(y.data);if(k===null)continue;Ia(t,k);const j=E2.safeParse(k);if(!j.success)continue;const C=j.data;if(v===0&&(g=Date.now()),s&&Vm(x,v,g,"chat.completion.chunk",C),v++,h||(o=C.id,i=C.model,h=!0),!f&&C.usage!==void 0&&C.usage!==null){u=C.usage.prompt_tokens??0,d=C.usage.completion_tokens??0,t.inputTokens=u;const T=Ao(k,"usage"),N=Ao(T,"prompt_tokens_details"),P=Wm(N,"cached_tokens");P!==null&&(t.cacheReadInputTokens=P),f=!0}for(const T of C.choices){const N=T.delta;N.content!==void 0&&N.content!==null&&(a+=N.content),N.reasoning_content!==void 0&&N.reasoning_content!==null&&(l+=N.reasoning_content),N.thinking!==void 0&&N.thinking!==null&&(l+=N.thinking);const P=N.think;if(P!=null&&(l+=P),T.finish_reason!==void 0&&T.finish_reason!==null&&(c=T.finish_reason),N.tool_calls!==void 0&&N.tool_calls!==null)for(const A of N.tool_calls){let z=m.get(A.index);z===void 0&&(z={index:A.index,type:"function",function:{name:"",arguments:""}},m.set(A.index,z)),A.id!==void 0&&(z.id=A.id),A.function?.name!==void 0&&(z.function.name+=A.function.name),A.function?.arguments!==void 0&&(z.function.arguments+=A.function.arguments)}}}s&&(t.streamingChunks={chunks:x,truncated:v>sc}),f||(d=Math.ceil(a.length/4)),t.outputTokens=d;const b={role:"assistant",content:a};return l.length>0&&(b.reasoning_content=l),m.size>0&&(b.tool_calls=[...m.values()]),JSON.stringify({id:o,object:"chat.completion",created:Math.floor(Date.now()/1e3),model:i!==""?i:n??"",choices:[{index:0,message:b,finish_reason:c}],usage:{prompt_tokens:u,completion_tokens:d,total_tokens:u+d}})}function MN(e){const t=ho.safeParse(yr(e,"response"));if(t.success)return t.data;const n=ho.safeParse(e);return n.success?n.data:null}function qm(e){if(e.output_text!==void 0&&e.output_text.length>0)return e.output_text;const t=[];for(const n of e.output??[]){const s=IN(n,"content");for(const o of s){const i=rt(o,"type"),a=rt(o,"text");(i==="output_text"||i==="text")&&a!==null&&a.length>0&&t.push(a)}}return t.join(`
|
|
89
|
+
`)}function Tu(e,t){const n=e.usage,s=n?.input_tokens??null,o=n?.output_tokens??null;s!==null&&(t.inputTokens=s),o!==null&&(t.outputTokens=o);const i=n?.input_tokens_details?.cached_tokens??null;return i!==null&&(t.cacheReadInputTokens=i),{inputTokens:s,outputTokens:o}}function $i(e,t){const n=rt(e,"item_id");if(n!==null&&n.length>0)return n;const s=Wm(e,"output_index");return s!==null?String(s):`function-${String(t)}`}function za(e,t){const n=e.get(t);if(n!==void 0)return n;const s={type:"function_call",arguments:""};return e.set(t,s),s}function LN(e,t,n){if(rt(n,"type")!=="function_call")return;const s=za(e,t),o=rt(n,"id"),i=rt(n,"call_id"),a=rt(n,"name"),l=rt(n,"arguments"),c=rt(n,"status");o!==null&&(s.id=o),i!==null&&(s.call_id=i),a!==null&&(s.name=a),l!==null&&(s.arguments=l),c!==null&&(s.status=c)}function DN(e,t){const n=[];e.length>0&&n.push({type:"message",role:"assistant",content:[{type:"output_text",text:e,annotations:[]}]});for(const s of t.values())n.push(s);return n}function $N(e,t,n){const s=t??Math.ceil(n.length/4);return{input_tokens:e,output_tokens:s,total_tokens:e===null?s:e+s}}function FN(e){const t=e.completedResponse===null?"":qm(e.completedResponse),n=t.length>0?t:e.outputText,s=e.completedResponse?.output,o=s!==void 0&&s.length>0?s:DN(n,e.calls),i=e.completedResponse?.usage??$N(e.inputTokens,e.outputTokens,n);return{...e.completedResponse??{},id:e.completedResponse?.id??e.responseId,object:"response",created_at:e.completedResponse?.created_at??Math.floor(Date.now()/1e3),status:e.completedResponse?.status??e.status??"completed",model:e.completedResponse?.model??e.model,output:o,output_text:n,usage:i}}function BN(e,t,n,s){let o=null,i="",a=n??"",l=null,c="",u=null,d=null,f=0,h=0;const m=[],v=new Map;for(const b of e){if(b.data==="[DONE]")break;const y=rc(b.data);if(y===null)continue;const k=Hm(b,y);if(f===0&&(h=Date.now()),s&&Vm(m,f,h,k===""?"response.event":k,y),f++,Ia(t,y),k==="error")continue;const j=MN(y);if(j!==null){o=j,i=j.id,a=j.model??a,l=j.status??l;const T=Tu(j,t);u=T.inputTokens??u,d=T.outputTokens??d,Ia(t,j)}const C=rt(y,"delta");switch(k){case"response.output_text.delta":C!==null&&(c+=C);break;case"response.output_text.done":{const T=rt(y,"text");c.length===0&&T!==null&&(c=T);break}case"response.function_call_arguments.delta":{if(C!==null){const T=za(v,$i(y,v.size));T.arguments+=C}break}case"response.function_call_arguments.done":{const T=rt(y,"arguments");if(T!==null){const N=za(v,$i(y,v.size));N.arguments=T}break}case"response.output_item.added":case"response.output_item.done":{const T=Ao(y,"item");LN(v,$i(y,v.size),T);break}case"response.failed":case"response.incomplete":l=k.slice(9);break;case"response.completed":l="completed";break}}s&&(t.streamingChunks={chunks:m,truncated:f>sc});const g=FN({completedResponse:o,responseId:i,model:a,status:l,outputText:c,calls:v,inputTokens:u,outputTokens:d}),x=ho.safeParse(g);if(x.success){if(Tu(x.data,t).outputTokens===null){const y=qm(x.data),k=Math.ceil(y.length/4);t.outputTokens=k}return JSON.stringify(x.data)}if(t.outputTokens===null){const b=rt(g,"output_text")??c,y=Math.ceil(b.length/4);t.outputTokens=y}return JSON.stringify(g)}function xi(e,t,n,s=!0){const o=zN(e);return o.some(PN)?BN(o,t,n,s):ON(o,t,n,s)}const UN={sessionId:null,threadId:null,turnId:null,installationId:null,windowId:null};function Pa(e,t){if(!(typeof e!="object"||e===null||Array.isArray(e)))return Object.getOwnPropertyDescriptor(e,t)?.value}function Wt(e,t){const n=Pa(e,t);return typeof n=="string"&&n.length>0?n:null}function WN(e){if(typeof e!="string"||e.length===0)return null;try{return JSON.parse(e)}catch{return null}}function HN(e){const t=Pa(e,"client_metadata");if(t===void 0)return UN;const n=WN(Pa(t,"x-codex-turn-metadata"));return{sessionId:Wt(t,"session_id")??Wt(n,"session_id"),threadId:Wt(t,"thread_id")??Wt(n,"thread_id"),turnId:Wt(t,"turn_id")??Wt(n,"turn_id"),installationId:Wt(t,"x-codex-installation-id")??Wt(n,"installation_id"),windowId:Wt(t,"x-codex-window-id")??Wt(n,"window_id")}}function Eu(e){return HN(e).sessionId}function VN(){return{inputTokens:null,outputTokens:null,cacheCreationInputTokens:null,cacheReadInputTokens:null}}function Au(e){return e===void 0?null:e.get("x-agent-inspector-session-id")??e.get("x-session-affinity")}const qN={format:"openai",parseRequest(e,t){try{const n=JSON.parse(e),s=Af.safeParse(n);if(s.success)return{model:s.data.model,sessionId:Eu(n)??Au(t)};const o=Rf.safeParse(n);return o.success?{model:o.data.model,sessionId:Eu(n)??Au(t)}:null}catch{return null}},extractTokens(e){const t=zf(e);if(t){let s=null;try{const o=JSON.parse(e);if(o!==null&&typeof o=="object"&&!Array.isArray(o)){const i=Object.getOwnPropertyDescriptor(o,"usage");if(i!==void 0&&typeof i.value=="object"&&i.value!==null){const a=Object.getOwnPropertyDescriptor(i.value,"prompt_tokens_details");if(a!==void 0&&typeof a.value=="object"&&a.value!==null){const l=Object.getOwnPropertyDescriptor(a.value,"cached_tokens");l!==void 0&&typeof l.value=="number"&&(s=l.value)}}}}catch{}return{inputTokens:t.usage.prompt_tokens??null,outputTokens:t.usage.completion_tokens??null,cacheCreationInputTokens:null,cacheReadInputTokens:s}}const n=Pf(e);if(n!==null){const s=n.usage;return{inputTokens:s?.input_tokens??null,outputTokens:s?.output_tokens??null,cacheCreationInputTokens:null,cacheReadInputTokens:s?.input_tokens_details?.cached_tokens??null}}return VN()},extractStream(e,t,n,s){return xi(e,t,n,s)},detectFormat(e){if(e===null)return!1;try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=Object.keys(t);return n.includes("model")&&(n.includes("messages")||n.includes("input"))&&!n.includes("system")}return!1}catch{return!1}}};En.register(qN);const ZN="https://api.openai.com/v1",GN={name:"openai",matches(e){const t=e.toLowerCase();return!!(t.startsWith("openai-")||t.includes("gpt-")||t.includes("o1")||t.includes("o2")||t.includes("o3"))},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:ZN},extractStream(e,t,n,s){return xi(e,t,n,s)}};gi.register(GN);const KN="https://open.bigmodel.cn/api/paas/v4",JN=["glm-","charglm-","cogview-","embedding-","rerank-"],YN={name:"zhipu",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return JN.some(n=>t.startsWith(n))},getUpstreamBase(e,t){return t?.baseUrl??KN},extractStream(e,t,n,s){return xi(e,t,n,s)}};gi.register(YN);const XN="https://dashscope.aliyuncs.com/compatible-mode/v1",QN={name:"alibaba",matches(e){return!!e.toLowerCase().replace(/\s+/g,"-").startsWith("qwen")},getUpstreamBase(e,t){return XN},extractStream(e,t,n){return xi(e,t,n)}};gi.register(QN);function Zm(e,t){for(const n of Array.from(e))t(n)}const e4=/[\u3000-\u9FFF\uAC00-\uD7FF\uF900-\uFAFF\uFF00-\uFFEF\u{1F300}-\u{1FAFF}]/u;function oc(e){if(e.length===0)return 0;let t=0,n=0;return Zm(e,s=>{e4.test(s)?t+=1:n+=1}),Math.ceil(t*1)+Math.ceil(n/4)}function ic(e){if(e.length===0)return 0;let t=0;return Zm(e,()=>{t+=1}),t}function ac(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function _e(e,t){return e===null||typeof e!="object"||Array.isArray(e)?void 0:Object.getOwnPropertyDescriptor(e,t)?.value}const t4=["file","shell","browser","web","mcp","code","other"];function Oa(e){const t=e.replace(/\s+/g," ").trim();return t.length<=120?t:`${t.slice(0,119)}...`}function Gm(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?Oa(t.slice(0,n+1)):Oa(t)}function n4(e,t){return`${e} ${t??""}`.toLowerCase()}function rs(e,t){return t.some(n=>e.includes(n))}function Km(e,t){const n=n4(e,t);return e.startsWith("mcp__")||e.startsWith("inspector_")||rs(n,[" mcp","model context protocol"])?"mcp":rs(n,["bash","shell","terminal","command","powershell","exec","process"])?"shell":rs(n,["browser","playwright","screenshot","click","navigate","page","tab"])?"browser":rs(n,["read","write","edit","file","glob","grep","patch","filesystem","directory"])?"file":rs(n,["web","search","http","url","fetch"])?"web":rs(n,["code","typescript","javascript","python","repl"])?"code":"other"}function Jm(e){const t=_e(e,"properties");return t===null||typeof t!="object"||Array.isArray(t)?[]:Object.keys(t).sort((n,s)=>n.localeCompare(s))}function Ym(e){const t=_e(e,"required");if(!Array.isArray(t))return[];const n=[];for(const s of t)typeof s=="string"&&s.length>0&&n.push(s);return n.sort((s,o)=>s.localeCompare(o))}function s4(e){const t=_e(e,"name");if(typeof t!="string"||t.length===0)return null;const n=_e(e,"description"),s=_e(e,"input_schema")??null,o=typeof n=="string"?n:null;return{name:t,description:o,descriptionPreview:Gm(o),category:Km(t,o),parameterCount:Jm(s).length,requiredParameters:Ym(s),schema:s}}function r4(e){const t=_e(e,"function"),n=_e(e,"type");if(t===void 0&&typeof n!="string")return null;const s=_e(t,"name")??_e(e,"name")??(typeof n=="string"?n:void 0);if(typeof s!="string"||s.length===0)return null;const o=_e(t,"description")??_e(e,"description"),i=_e(t,"parameters")??_e(e,"parameters")??null,a=typeof o=="string"?o:null;return{name:s,description:a,descriptionPreview:Gm(a),category:Km(s,a),parameterCount:Jm(i).length,requiredParameters:Ym(i),schema:i}}function o4(e){const t=r4(e);return t!==null?t:s4(e)}function i4(e){if(e==null)return null;if(typeof e=="string")return e;const t=_e(e,"type"),n=_e(e,"name"),s=_e(_e(e,"function"),"name");if(typeof t=="string"&&typeof s=="string"&&s.length>0)return`${t}: ${s}`;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:Oa(o)}function a4(e){const t=new Map;for(const n of e)t.set(n.category,(t.get(n.category)??0)+1);return t4.flatMap(n=>{const s=t.get(n)??0;return s>0?[{category:n,count:s}]:[]})}function lc(e){const t=_e(e,"tools");if(!Array.isArray(t)||t.length===0)return null;const n=[];for(const s of t){const o=o4(s);o!==null&&n.push(o)}return n.length===0?null:{tools:n,toolChoiceLabel:i4(_e(e,"tool_choice")),categories:a4(n)}}function $n(e){return{parsed:null,comparisonValue:e,messageCount:null,toolCount:null}}const xs={parsed:null,toolNames:null};function l4(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 s=n;switch(s.type){case"text":typeof s.text=="string"&&t.push(s.text);break;case"thinking":case"think":typeof s.thinking=="string"&&t.push(s.thinking);break;case"tool_use":{const i=typeof s.name=="string"?s.name:"",a=s.input!==void 0?JSON.stringify(s.input):"";t.push(`${i} ${a}`.trim());break}case"tool_result":{const i=s.content;if(typeof i=="string")t.push(i);else if(Array.isArray(i)){for(const a of i)if(a!==null&&typeof a=="object"){const l=a.text;typeof l=="string"&&t.push(l)}}break}case"image":t.push("[image]");break}}return t.join(`
|
|
90
|
+
`)}function c4(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"){const s=n.text;n.type==="text"&&typeof s=="string"&&t.push(s)}return t.join(`
|
|
91
|
+
`)}function u4(e){if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const s=n;typeof s.name=="string"&&t.push(s.name),typeof s.description=="string"&&t.push(s.description),s.input_schema!==void 0&&t.push(JSON.stringify(s.input_schema))}return t.join(`
|
|
92
|
+
`)}function Fi(e,t,n,s){return{role:e,label:t,text:n,size:oc(n),characters:ic(n),path:s}}const d4={format:"anthropic",analyzeRequest(e){if(e===null)return $n(e);try{const t=JSON.parse(e),n=lc(t)?.tools.length??null,s=Cf.safeParse(t);return s.success?{parsed:s.data,comparisonValue:s.data,messageCount:s.data.messages.length,toolCount:n}:$n(e)}catch{return $n(e)}},analyzeResponse(e){if(e===null)return xs;try{let t=JSON.parse(e);typeof t=="string"&&(t=JSON.parse(t));const n=Nf.safeParse(t);if(!n.success)return xs;const s=n.data.content.filter(o=>o.type==="tool_use").map(o=>o.name);return{parsed:n.data,toolNames:s.length>0?s:null}}catch{return xs}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(t.system!==void 0){const s=c4(t.system);s.length>0&&n.push(Fi("system","system",s,"/system"))}if(Array.isArray(t.messages)&&t.messages.forEach((s,o)=>{if(s===null||typeof s!="object")return;const i=s,a=i.role==="user"||i.role==="assistant"?i.role:"user",l=l4(i.content);n.push(Fi(a,`[${o}] ${a}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const s=u4(t.tools);n.push(Fi("tools","tools",s,"/tools"))}return n.length>0?n:null}};function Ma(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 s=n,o=s.type;(o==="text"||o==="input_text"||o==="output_text")&&typeof s.text=="string"?t.push(s.text):(o==="image_url"||o==="input_image")&&t.push("[image]")}return t.join(`
|
|
93
|
+
`)}function f4(e){const t=[],n=Ma(e.content);n.length>0&&t.push(n);const s=typeof e.reasoning_content=="string"?e.reasoning_content:typeof e.thinking=="string"?e.thinking:typeof e.think=="string"?e.think:"";s.length>0&&t.push(s);const o=e.tool_calls;if(Array.isArray(o))for(const i of o){if(i===null||typeof i!="object")continue;const a=i.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(`
|
|
94
|
+
`)}function p4(e){if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const s=_e(n,"function"),o=_e(s,"name")??_e(n,"name"),i=_e(s,"description")??_e(n,"description"),a=_e(s,"parameters")??_e(n,"parameters");typeof o=="string"&&t.push(o),typeof i=="string"&&t.push(i),a!==void 0&&t.push(JSON.stringify(a))}return t.join(`
|
|
95
|
+
`)}function h4(e){return typeof e=="string"?e.length>0?1:0:Array.isArray(e)?e.length:e==null?null:1}function m4(e){if(typeof e=="string")return e;const t=_e(e,"text");if(typeof t=="string")return t;const n=Ma(_e(e,"content"));if(n.length>0)return n;const s=Ma(_e(e,"output"));if(s.length>0)return s;const o=_e(e,"arguments");return typeof o=="string"?o:""}function g4(e){const t=_e(e,"role");if(t==="system"||t==="user"||t==="assistant"||t==="tool")return t;const n=_e(e,"type");return n==="function_call_output"?"tool":"user"}function x4(e){const t=_e(e,"output");if(!Array.isArray(t))return[];const n=[];for(const s of t){if(_e(s,"type")!=="function_call")continue;const o=_e(s,"name");typeof o=="string"&&o.length>0&&n.push(o)}return n}function Ws(e,t,n,s){return{role:e,label:t,text:n,size:oc(n),characters:ic(n),path:s}}const b4={format:"openai",analyzeRequest(e){if(e===null)return $n(e);try{const t=JSON.parse(e),n=lc(t)?.tools.length??null,s=Af.safeParse(t);if(!s.success){const o=Rf.safeParse(t);return o.success?{parsed:o.data,comparisonValue:o.data,messageCount:h4(o.data.input),toolCount:n}:$n(e)}return{parsed:s.data,comparisonValue:s.data,messageCount:s.data.messages.length,toolCount:n}}catch{return $n(e)}},analyzeResponse(e){if(e===null)return xs;const t=zf(e);if(t===null){const s=Pf(e);if(s===null)return xs;const o=x4(s);return{parsed:s,toolNames:o.length>0?o:null}}const n=t.choices[0]?.message?.tool_calls?.map(s=>s.function?.name??"").filter(s=>s!=="")??[];return{parsed:t,toolNames:n.length>0?n:null}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(typeof t.instructions=="string"&&t.instructions.length>0&&n.push(Ws("system","instructions",t.instructions,"/instructions")),Array.isArray(t.messages)&&t.messages.forEach((s,o)=>{if(s===null||typeof s!="object")return;const i=s,a=i.role==="user"||i.role==="assistant"||i.role==="system"||i.role==="tool"?i.role:"user",l=f4(i);n.push(Ws(a,`[${o}] ${a}`,l,`/messages/${o}`))}),Array.isArray(t.messages)||(typeof t.input=="string"&&t.input.length>0?n.push(Ws("user","input",t.input,"/input")):Array.isArray(t.input)&&t.input.forEach((s,o)=>{const i=g4(s),a=m4(s);n.push(Ws(i,`[${o}] ${i}`,a,`/input/${o}`))})),Array.isArray(t.tools)&&t.tools.length>0){const s=p4(t.tools);n.push(Ws("tools","tools",s,"/tools"))}return n.length>0?n:null}},v4={format:"unknown",analyzeRequest(e){return $n(e)},analyzeResponse(){return xs},anatomySegments(){return null}},y4={anthropic:d4,openai:b4,unknown:v4};function Xm(e){return y4[e]}function lr(e){const t=jN(e.path);return t==="unknown"?e.apiFormat:t}const Ru="bg-white/[0.045] hover:bg-white/[0.075] inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground transition-colors hover:text-foreground";function Bi({icon:e,children:t,title:n,className:s}){return r.jsxs("span",{className:ie("bg-white/[0.045] inline-flex h-7 min-w-0 items-center gap-1.5 rounded-md px-2 text-xs text-muted-foreground",s),title:n,children:[e,r.jsx("span",{className:"min-w-0 font-mono tabular-nums",children:t})]})}function w4(){return r.jsxs("span",{className:"inline-flex h-6 shrink-0 items-center gap-1.5 rounded-md bg-amber-300/[0.10] px-1.5 font-mono text-[10px] uppercase tracking-[0.14em] text-amber-100/90 ring-1 ring-amber-200/10",title:"This session has a turn that has not finished yet",children:[r.jsx(Xe,{className:"size-3 animate-spin"}),"Turn open"]})}function _4({conversationId:e,startTime:t,endTime:n,totalCalls:s,totalInputTokens:o,totalOutputTokens:i,expanded:a,onToggle:l,providers:c,isLoading:u=!1,userAgent:d,clientPid:f,clientProjectFolder:h,showClientIdentity:m=!0,showProcessMetadata:v=!0,timeDisplayFormat:g,onClear:x}){const[b,y]=p.useState(!1),k=$=>{$.stopPropagation(),x!==void 0&&y(!0)},j=p.useCallback($=>{$.stopPropagation(),window.open(Ud(e),"_blank","noopener,noreferrer")},[e]),C=c?.map(({provider:$,models:ee})=>({provider:$,tooltip:ee.length===1?ee[0]??$:ee.join(", ")}))??[],T=Dl({userAgent:d,conversationId:e,clientProjectFolder:h}),N=Qo(T),P=d!=null&&d!=="",A=N??d??null,z=N!==null&&P?`${N} - ${d}`:null,D=e.startsWith("PID:")||e.includes("|"),E=e.length>24?e.slice(0,12)+"..."+e.slice(-12):e,L=Tl(t,n,g),w=`${s} call${s!==1?"s":""}`;return r.jsxs("div",{role:"button",tabIndex:0,"data-nav-id":`conv-${e}`,"data-nav-action":a?"collapse":"expand",className:ie("bg-card/80 shadow-sm relative flex cursor-pointer items-start gap-3 overflow-hidden rounded-[8px] px-3 py-2.5 transition-colors","hover:bg-card","select-none","sticky top-0 z-10 mb-2","focus-visible:ring-1 focus-visible:ring-cyan-300/35 focus-visible:outline-none"),onClick:l,onKeyDown:$=>{$.target===$.currentTarget&&($.key==="Enter"||$.key===" ")&&($.preventDefault(),l())},children:[r.jsx(xN,{items:C,ariaLabel:"Models used in this session",className:"mt-0.5"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[D&&v?f!=null?r.jsxs("span",{className:"min-w-0 max-w-full truncate font-mono text-xs font-semibold text-violet-200",title:`PID ${f}`,children:["PID ",f]}):r.jsx("span",{className:"min-w-0 max-w-full truncate font-mono text-xs font-semibold text-violet-200",title:e,children:e}):r.jsx("span",{className:"min-w-0 max-w-full truncate font-mono text-xs font-semibold text-violet-200",title:e,children:D?"sessionless":E}),!D&&v&&f!==null&&f!==void 0&&r.jsxs("span",{className:"bg-white/[0.045] shrink-0 rounded px-1.5 py-0.5 font-mono text-xs tabular-nums text-muted-foreground",title:`Client process ID ${f}`,children:["PID ",f]}),D&&v&&h!==null&&h!==void 0&&h!==""&&r.jsx("span",{className:"min-w-0 max-w-[240px] truncate font-mono text-xs text-muted-foreground",title:h,children:h}),m&&A!==null&&A!==""&&r.jsxs("span",{className:"bg-white/[0.045] inline-flex min-h-6 shrink-0 flex-wrap items-center gap-1 rounded-md px-1.5 py-0.5 text-xs text-muted-foreground",title:z??A,children:[r.jsx(ei,{client:T,className:"size-4 shrink-0"}),r.jsx("span",{className:"font-mono leading-snug tabular-nums",children:A})]}),u&&r.jsx(w4,{})]}),r.jsxs("span",{className:"mt-1.5 flex min-w-0 flex-wrap items-center gap-1.5",children:[r.jsx(Bi,{icon:r.jsx(sn,{className:"size-3 shrink-0"}),title:L,children:L}),r.jsx(Bi,{icon:r.jsx(Zo,{className:"size-3 shrink-0"}),children:w}),r.jsxs(Bi,{icon:r.jsx(or,{className:"size-3 shrink-0"}),className:"max-w-full",children:[r.jsx("span",{className:"text-blue-400",children:Fe(o)})," / ",r.jsx("span",{className:"text-amber-400",children:Fe(i)})]})]})]}),r.jsxs("span",{className:"flex shrink-0 items-start gap-1.5",children:[r.jsx("button",{type:"button",onClick:j,onKeyDown:$=>{($.key==="Enter"||$.key===" ")&&j($)},"aria-label":`Open session ${e} in a new tab`,title:"Open this session in a new tab",className:Ru,children:r.jsx(jl,{className:"size-3.5"})}),x!==void 0&&r.jsx("button",{type:"button",onClick:k,"aria-label":`Clear group (${s} request${s!==1?"s":""})`,title:"Clear this group from the current view",className:Ru,children:r.jsx(wn,{className:"size-3.5"})}),r.jsx("span",{className:"bg-white/[0.045] hover:bg-white/[0.075] inline-flex size-8 shrink-0 items-center justify-center rounded-md text-slate-200","aria-hidden":"true",children:a?r.jsx(ot,{className:"size-4 shrink-0"}):u?r.jsx(Xe,{className:"size-4 shrink-0 animate-spin"}):r.jsx(Et,{className:"size-4 shrink-0"})})]}),u&&r.jsx("span",{className:"pointer-events-none absolute inset-x-3 bottom-0 h-px overflow-hidden rounded-full bg-white/[0.06]","aria-hidden":"true",children:r.jsx("span",{className:"absolute inset-y-0 left-0 w-1/3 animate-pulse rounded-full bg-amber-200/65 shadow-[0_0_14px_rgba(252,211,77,0.32)]"})}),r.jsx(Qp,{open:b,onOpenChange:y,title:"Clear this group from the current view?",description:`This will hide ${s} request${s!==1?"s":""} from the current view. Stored logs remain reloadable.`,confirmLabel:"Clear",variant:"destructive",onConfirm:()=>{x?.()}})]})}function k4(e){if(e.sessionId!==null&&e.sessionId!==""&&e.sessionId!==void 0)return e.sessionId;if(e.isTest===!0)return"provider-test";const t=e.clientPid!==null&&e.clientPid!==void 0,n=e.clientProjectFolder!==null&&e.clientProjectFolder!==void 0;if(!t&&!n)return"default";const s=t?`PID:${e.clientPid}`:"unknown",o=n?e.clientProjectFolder:"no-folder";return`${s}|${o}`}function j4(e){const t=new Map;for(const s of e){const o=k4(s),i=t.get(o);i!==void 0?i.push(s):t.set(o,[s])}const n=[];for(const[s,o]of t){const i=[...o].sort((a,l)=>a.timestamp.localeCompare(l.timestamp));n.push({id:s,conversationId:s,logs:i})}return n.sort((s,o)=>(s.logs[0]?.timestamp??"").localeCompare(o.logs[0]?.timestamp??"")),n}function S4(e,t,n){const s=new Array(e);return new Proxy(s,{get(o,i,a){if(typeof i=="string"){const l=i.charCodeAt(0);if(l>=48&&l<=57){const c=+i;if(Number.isInteger(c)&&c>=0&&c<e){let u=o[c];if(!u){const d=t[c*2];u=o[c]={index:c,key:n(c),start:d,size:t[c*2+1],end:d+t[c*2+1],lane:0}}return u}}if(i==="length")return e}return Reflect.get(o,i,a)}})}function os(e,t,n){let s=n.initialDeps??[],o,i=!0;function a(){const l=e();return(l.length!==s.length||l.some((u,d)=>s[d]!==u))&&(s=l,o=t(...l),n?.onChange&&!(i&&n.skipInitialOnChange)&&n.onChange(o),i=!1),o}return a.updateDeps=l=>{s=l},a}function Iu(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const zu=(e,t)=>Math.abs(e-t)<1.01,C4=(e,t,n)=>{let s;return function(...o){e.clearTimeout(s),s=e.setTimeout(()=>t.apply(this,o),n)}};let Hs;const Pu=()=>{if(Hs!==void 0)return Hs;if(typeof navigator>"u")return Hs=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Hs=!0;const e=navigator.maxTouchPoints;return Hs=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Ou=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},N4=e=>e,T4=e=>{const t=Math.max(e.startIndex-e.overscan,0),s=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,o=new Array(s);for(let i=0;i<s;i++)o[i]=t+i;return o},E4=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;const o=a=>{const{width:l,height:c}=a;t({width:Math.round(l),height:Math.round(c)})};if(o(Ou(n)),!s.ResizeObserver)return()=>{};const i=new s.ResizeObserver(a=>{const l=()=>{const c=a[0];if(c?.borderBoxSize){const u=c.borderBoxSize[0];if(u){o({width:u.inlineSize,height:u.blockSize});return}}o(Ou(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},cr={passive:!0},A4=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=()=>{t({width:n.innerWidth,height:n.innerHeight})};return s(),n.addEventListener("resize",s,cr),()=>{n.removeEventListener("resize",s)}},R4=typeof window>"u"?!0:"onscrollend"in window,Qm=(e,t,n)=>{const s=e.scrollElement;if(!s)return;const o=e.targetWindow;if(!o)return;const i=e.options.useScrollendEvent&&R4;let a=0;const l=i?null:C4(o,()=>t(a,!1),e.options.isScrollingResetDelay),c=f=>()=>{a=n(s),l?.(),t(a,f)},u=c(!0),d=c(!1);return s.addEventListener("scroll",u,cr),i&&s.addEventListener("scrollend",d,cr),()=>{s.removeEventListener("scroll",u),i&&s.removeEventListener("scrollend",d)}},I4=(e,t)=>Qm(e,t,n=>{const{horizontal:s,isRtl:o}=e.options;return s?n.scrollLeft*(o&&-1||1):n.scrollTop}),z4=(e,t)=>Qm(e,t,n=>e.options.horizontal?n.scrollX:n.scrollY),P4=(e,t,n)=>{if(t?.borderBoxSize){const s=t.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},e0=(e,{adjustments:t=0,behavior:n},s)=>{var o,i;(i=(o=s.scrollElement)==null?void 0:o.scrollTo)==null||i.call(o,{[s.options.horizontal?"left":"top"]:e+t,behavior:n})},O4=e0,M4=e0;class L4{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,s,o;return((o=(s=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:s.now)==null?void 0:o.call(s))??Date.now()},this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(o=>{o.forEach(i=>{const a=()=>{const l=i.target,c=this.indexFromElement(l);if(!l.isConnected){this.observer.unobserve(l);for(const[u,d]of this.elementsCache)if(d===l){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(l,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var o;(o=s())==null||o.disconnect(),n=null},observe:o=>{var i;return(i=s())==null?void 0:i.observe(o,{box:"border-box"})},unobserve:o=>{var i;return(i=s())==null?void 0:i.unobserve(o)}}})(),this.range=null,this.setOptions=n=>{var s,o;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:N4,rangeExtractor:T4,onChange:()=>{},measureElement:P4,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate"};for(const u in n){const d=n[u];d!==void 0&&(i[u]=d)}const a=this.options;let l=null,c=null;if(a!==void 0&&a.enabled&&i.enabled&&i.anchorTo==="end"&&this.scrollElement!==null){const u=a.count,d=i.count,f=this.getMeasurements(),h=u>0?((s=f[0])==null?void 0:s.key)??a.getItemKey(0):null,m=u>0?((o=f[u-1])==null?void 0:o.key)??a.getItemKey(u-1):null;if(d!==u||u>0&&d>0&&(i.getItemKey(0)!==h||i.getItemKey(d-1)!==m)){const x=u>0?this.getVirtualItemForOffset(this.getScrollOffset())??f[0]:null;x&&(l=[x.key,this.getScrollOffset()-x.start]);const b=i.followOnAppend===!0?"auto":i.followOnAppend||null;b&&d>u&&this.isAtEnd(a.scrollEndThreshold)&&(u===0||i.getItemKey(d-1)!==m)&&(c=b)}}this.options=i,(l||c)&&(this.pendingScrollAnchor=[l?.[0]??null,l?.[1]??0,c])},this.notify=n=>{var s,o;(o=(s=this.options).onChange)==null||o.call(s,this,n)},this.maybeNotify=os(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}if(this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,a)=>{this._intendedScrollOffset!==null&&Math.abs(i-this._intendedScrollOffset)<1.5&&(i=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=a?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=a,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const i=this.scrollElement,a=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},l=()=>{this._iosTouching=!1,!(!Pu()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",a,cr),i.addEventListener("touchend",l,cr),this.unsubs.push(()=>{i.removeEventListener("touchstart",a),i.removeEventListener("touchend",l),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const o=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled){const[i,a,l]=o;if(i!==null){const{count:c,getItemKey:u}=this.options;let d=0;for(;d<c&&u(d)!==i;)d++;const f=d<c?this.getMeasurements()[d]:void 0;if(f){const h=f.start+a-this.getScrollOffset();zu(h,0)||this.applyScrollAdjustment(h)}}l&&this.scrollToEnd({behavior:l})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),s=this.getMaxScrollOffset();if(n<0||n>s)return;const o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=o,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,s)=>{const o=new Map,i=new Map;for(let a=s-1;a>=0;a--){const l=n[a];if(o.has(l.lane))continue;const c=i.get(l.lane);if(c==null||l.end>c.end?i.set(l.lane,l):l.end<c.end&&o.set(l.lane,!0),o.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((a,l)=>a.end===l.end?a.index-l.index:a.end-l.end)[0]:void 0},this.getMeasurementOptions=os(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,s,o,i,a,l,c)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMin=null,{count:n,paddingStart:s,scrollMargin:o,getItemKey:i,enabled:a,lanes:l,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=os(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:s,scrollMargin:o,getItemKey:i,enabled:a,lanes:l,laneAssignmentMode:c},u)=>{const d=this.itemSizeCache;if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const v of this.laneAssignments.keys())v>=n&&this.laneAssignments.delete(v);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(v=>{this.itemSizeCache.set(v.key,v.size)}));const f=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),l===1){const v=this.options.gap,g=n*2;let x=this._flatMeasurements;if(!x||x.length<g){const k=new Float64Array(g);x&&f>0&&k.set(x.subarray(0,f*2)),x=k,this._flatMeasurements=x}let b;if(f===0)b=s+o;else{const k=f-1;b=x[k*2]+x[k*2+1]+v}for(let k=f;k<n;k++){const j=i(k),C=d.get(j),T=typeof C=="number"?C:this.options.estimateSize(k);x[k*2]=b,x[k*2+1]=T,b+=T+v}const y=S4(n,x,i);return this.measurementsCache=y,y}const h=this.measurementsCache.slice(0,f),m=new Array(l).fill(void 0);for(let v=0;v<f;v++){const g=h[v];g&&(m[g.lane]=v)}for(let v=f;v<n;v++){const g=i(v),x=this.laneAssignments.get(v);let b,y;const k=c==="estimate"||d.has(g);if(x!==void 0&&this.options.lanes>1){b=x;const N=m[b],P=N!==void 0?h[N]:void 0;y=P?P.end+this.options.gap:s+o}else{const N=this.options.lanes===1?h[v-1]:this.getFurthestMeasurement(h,v);y=N?N.end+this.options.gap:s+o,b=N?N.lane:v%this.options.lanes,this.options.lanes>1&&k&&this.laneAssignments.set(v,b)}const j=d.get(g),C=typeof j=="number"?j:this.options.estimateSize(v),T=y+C;h[v]={index:v,start:y,size:C,end:T,key:g,lane:b},m[b]=v}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=os(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,o,i)=>this.range=n.length>0&&s>0?D4({measurements:n,outerSize:s,scrollOffset:o,lanes:i,flat:i===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=os(()=>{let n=null,s=null;const o=this.calculateRange();return o&&(n=o.startIndex,s=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,s]},(n,s,o,i,a)=>i===null||a===null?[]:n({startIndex:i,endIndex:a,overscan:s,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,o=n.getAttribute(s);return o?parseInt(o,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var s;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((s=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:s.index);if(o!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,o-i),l=Math.min(this.options.count-1,o+i);return n>=a&&n<=l}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((a,l)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(l))});return}const s=this.indexFromElement(n),o=this.options.getItemKey(s),i=this.elementsCache.get(o);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(o,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(s)&&this.resizeItem(s,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,s)=>{var o,i;if(n<0||n>=this.options.count)return;let a,l,c;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)c=this.options.getItemKey(n),l=u[n*2],a=u[n*2+1];else{const h=this.measurementsCache[n];if(!h)return;c=h.key,l=h.start,a=h.size}const d=this.itemSizeCache.get(c)??a,f=s-d;if(f!==0){const h=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,m=h?this.getTotalSize():0,v=((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:c,start:l,size:a,end:l+a,lane:0},f,this):l<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(c,s),this.itemSizeCacheVersion++,h?this.applyScrollAdjustment(this.getTotalSize()-m):v&&this.applyScrollAdjustment(f),this.notify(!1)}},this.getVirtualItems=os(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,s)=>{const o=[];for(let i=0,a=n.length;i<a;i++){const l=n[i],c=s[l];o.push(c)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length===0)return;const o=this._flatMeasurements,i=this.options.lanes===1&&o!=null,a=t0(0,s.length-1,i?l=>o[l*2]:l=>Iu(s[l]).start,n);return Iu(s[a])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,s,o=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),a=this.getScrollOffset();s==="auto"&&(s=n>=a+i?"end":"start"),s==="center"?n+=(o-i)/2:s==="end"&&(n-=i);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const o=this.getSize(),i=this.getScrollOffset(),a=this.measurementsCache[n];if(!a)return;if(s==="auto")if(a.end>=i+o-this.options.scrollPaddingEnd)s="end";else if(a.start<=i+this.options.scrollPaddingStart)s="start";else return[i,s];if(s==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),s];const l=s==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,s,a.size),s]},this.scrollToOffset=(n,{align:s="start",behavior:o="auto"}={})=>{const i=this.getOffsetForAlignment(n,s),a=this.now();this.scrollState={index:null,align:s,behavior:o,startedAt:a,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:s="auto",behavior:o="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getOffsetForIndex(n,s);if(!i)return;const[a,l]=i,c=this.now();this.scrollState={index:n,align:l,behavior:o,startedAt:c,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:s="auto"}={})=>{const o=this.getScrollOffset()+n,i=this.now();this.scrollState={index:null,align:"start",behavior:s,startedAt:i,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:s}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const s=this.getMeasurements();let o;if(s.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const i=s.length-1,a=this._flatMeasurements;a!=null?o=a[i*2]+a[i*2+1]:o=((n=s[i])==null?void 0:n.end)??0}else{const i=Array(this.options.lanes).fill(null);let a=s.length-1;for(;a>=0&&i.some(l=>l===null);){const l=s[a];i[l.lane]===null&&(i[l.lane]=l.end),a--}o=Math.max(...i.filter(l=>l!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const s=this.getMeasurements();for(const o of s)o&&this.itemSizeCache.has(o.key)&&n.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return n},this._scrollToOffset=(n,{adjustments:s,behavior:o})=>{this._intendedScrollOffset=n+(s??0),this.options.scrollToFn(n,{behavior:o,adjustments:s},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,n){t!==0&&(Pu()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:n}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const s=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=s?s[0]:this.scrollState.lastTargetOffset,i=1,a=o!==this.scrollState.lastTargetOffset;if(!a&&zu(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,a){const l=this.getSize()||600,c=Math.abs(o-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&c>l;this.scrollState.lastTargetOffset=o,u||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const t0=(e,t,n,s)=>{for(;e<=t;){const o=(e+t)/2|0,i=n(o);if(i<s)e=o+1;else if(i>s)t=o-1;else return o}return e>0?e-1:0};function D4({measurements:e,outerSize:t,scrollOffset:n,lanes:s,flat:o}){const i=e.length-1,a=o?d=>o[d*2]:d=>e[d].start,l=o?d=>o[d*2]+o[d*2+1]:d=>e[d].end;if(e.length<=s)return{startIndex:0,endIndex:i};let c=t0(0,i,a,n),u=c;if(s===1)for(;u<i&&l(u)<n+t;)u++;else if(s>1){const d=Array(s).fill(0);for(;u<i&&d.some(h=>h<n+t);){const h=e[u];d[h.lane]=h.end,u++}const f=Array(s).fill(n+t);for(;c>=0&&f.some(h=>h>=n);){const h=e[c];f[h.lane]=h.start,c--}c=Math.max(0,c-c%s),u=Math.min(i,u+(s-1-u%s))}return{startIndex:c,endIndex:u}}const Mu=typeof document<"u"?p.useLayoutEffect:p.useEffect;function n0({useFlushSync:e=!0,...t}){const n=p.useReducer(i=>i+1,0)[1],s={...t,onChange:(i,a)=>{var l;e&&a?pr.flushSync(n):n(),(l=t.onChange)==null||l.call(t,i,a)}},[o]=p.useState(()=>new L4(s));return o.setOptions(s),Mu(()=>o._didMount(),[]),Mu(()=>o._willUpdate()),o}function $4(e){return n0({observeElementRect:E4,observeElementOffset:I4,scrollToFn:M4,...e})}function F4(e){return n0({getScrollElement:()=>typeof document<"u"?window:null,observeElementRect:A4,observeElementOffset:z4,scrollToFn:O4,initialOffset:()=>typeof document<"u"?window.scrollY:0,...e})}const ln="agent-inspector:focus-log";function ur(e){window.dispatchEvent(new CustomEvent(ln,{detail:e}))}function bi(e){if(typeof CustomEvent>"u"||!(e instanceof CustomEvent))return null;const t=e.detail,n=_e(t,"logId");if(typeof n!="number"||!Number.isInteger(n)||n<0)return null;const s=_e(t,"tab");switch(s){case"anatomy":case"request":case"response":break;case void 0:break;default:return null}const o=_e(t,"source"),i=_e(t,"toolCallIndex"),a=typeof i=="number"&&Number.isInteger(i)&&i>=0?{logId:n,tab:s??"request",toolCallIndex:i}:{logId:n,tab:s??"request"};switch(o){case"virtualizer":return{...a,source:o};case void 0:return a;default:return null}}function Pt({className:e,style:t,d:n,eyeStalks:s,eyes:o,legs:i,extras:a}){return r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:t,className:ie("inline-block size-5",e),children:[r.jsx("path",{d:n}),s,o,i,a]})}const An=r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),r.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),r.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),r.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]}),s0=r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"7",y1:"16",x2:"5.5",y2:"18.5"}),r.jsx("line",{x1:"9.5",y1:"17",x2:"8.5",y2:"19.5"}),r.jsx("line",{x1:"14.5",y1:"17",x2:"15.5",y2:"19.5"}),r.jsx("line",{x1:"17",y1:"16",x2:"18.5",y2:"18.5"})]});function r0({className:e}){return r.jsx(Pt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),r.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"})]}),legs:An,extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),r.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 B4({className:e}){return r.jsx(Pt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"9.5",y1:"6.5",x2:"9.5",y2:"4.5"}),r.jsx("line",{x1:"14.5",y1:"6.5",x2:"14.5",y2:"4.5"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"9.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"14.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"})]}),legs:s0,extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M5 11 C4 9.5 2.5 10 3 12 C3.5 13.5 4.5 13 5 12"}),r.jsx("path",{d:"M19 11 C20 9.5 21.5 10 21 12 C20.5 13.5 19.5 13 19 12"})]})})}function U4({className:e}){return r.jsx(Pt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"7",y1:"7",x2:"6.5",y2:"4.5"}),r.jsx("line",{x1:"17",y1:"7",x2:"17.5",y2:"4.5"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"6.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"17.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:An,extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M4 12 C2.5 10.5 1 11 1.5 13 C2 14.5 3.5 14 4.5 13"}),r.jsx("path",{d:"M20 12 C21.5 10.5 23 11 22.5 13 C22 14.5 20.5 14 19.5 13"})]})})}function W4({className:e}){return r.jsx(Pt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"10",y1:"6.5",x2:"10",y2:"3.5"}),r.jsx("line",{x1:"14",y1:"6.5",x2:"14",y2:"3.5"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"10",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"14",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"7",y1:"17",x2:"5",y2:"20.5"}),r.jsx("line",{x1:"9.5",y1:"18.5",x2:"8.5",y2:"21.5"}),r.jsx("line",{x1:"14.5",y1:"18.5",x2:"15.5",y2:"21.5"}),r.jsx("line",{x1:"17",y1:"17",x2:"19",y2:"20.5"})]}),extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M6.5 11 C5 8.5 3 9 3.5 11.5 C4 13.5 5 13 6 12"}),r.jsx("path",{d:"M17.5 11 C19 8.5 21 9 20.5 11.5 C20 13.5 19 13 18 12"})]})})}function H4({className:e}){return r.jsx(Pt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),r.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:An,extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),r.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 V4({className:e}){return r.jsx(Pt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),r.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),r.jsx("line",{x1:"13.5",y1:"4",x2:"15.5",y2:"5"})]}),legs:An,extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),r.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 q4({className:e}){return r.jsx(Pt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"10",y1:"8",x2:"10",y2:"6"}),r.jsx("line",{x1:"14",y1:"8",x2:"14",y2:"6"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"9",y1:"6",x2:"11",y2:"6.5"}),r.jsx("line",{x1:"13",y1:"6",x2:"15",y2:"6.5"})]}),legs:s0,extras:r.jsxs(r.Fragment,{children:[r.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"}),r.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 Z4({className:e}){return r.jsx(Pt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),r.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:An,extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),r.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),r.jsx("line",{x1:"8.5",y1:"4",x2:"10.5",y2:"4.5"}),r.jsx("line",{x1:"15.5",y1:"4",x2:"13.5",y2:"4.5"}),r.jsx("path",{d:"M9 15.5 C10 14.5 14 14.5 15 15.5"})]})})}function G4({className:e}){return r.jsx(Pt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),r.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"9.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"}),r.jsx("circle",{cx:"14.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"})]}),legs:An,extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),r.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),r.jsx("ellipse",{cx:"12",cy:"15",rx:"2",ry:"1.5",fill:"currentColor",stroke:"none"})]})})}function K4({className:e}){return r.jsx(Pt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"9.5",y1:"7",x2:"9",y2:"5"}),r.jsx("line",{x1:"14.5",y1:"7",x2:"15",y2:"5"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"9",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"15",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"})]}),legs:An,extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M5 11 C3.5 9 2 9.5 2.5 12 C3 14 4 13 5 12"}),r.jsx("path",{d:"M19 11 C20.5 9 22 9.5 21.5 12 C21 14 20 13 19 12"}),r.jsx("path",{d:"M9 14.5 C10 16 14 16 15 14.5"}),r.jsx("circle",{cx:"7",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"}),r.jsx("circle",{cx:"17",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"})]})})}function J4({className:e}){return r.jsx(Pt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5.5"}),r.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5.5"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"7.5",y1:"5.5",x2:"16.5",y2:"5.5"}),r.jsx("rect",{x:"7",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"}),r.jsx("rect",{x:"13",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"})]}),legs:An,extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),r.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),r.jsx("path",{d:"M9.5 15 C10.5 16 13.5 16 14.5 15"})]})})}function Y4({className:e}){return r.jsx(Pt,{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:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"10.5",y1:"9.5",x2:"10.5",y2:"8"}),r.jsx("line",{x1:"13.5",y1:"9.5",x2:"13.5",y2:"8"})]}),eyes:r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"10.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"13.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:r.jsxs(r.Fragment,{children:[r.jsx("line",{x1:"8",y1:"16",x2:"6.5",y2:"18"}),r.jsx("line",{x1:"10",y1:"17",x2:"9.5",y2:"19"}),r.jsx("line",{x1:"14",y1:"17",x2:"14.5",y2:"19"}),r.jsx("line",{x1:"16",y1:"16",x2:"17.5",y2:"18"})]}),extras:r.jsxs(r.Fragment,{children:[r.jsx("path",{d:"M7.5 12 C6.5 11 5.5 11.5 6 13 C6.5 14 7 13.5 7.5 13"}),r.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 dr=[r0,B4,U4,W4,H4,V4,q4,Z4,G4,K4,J4,Y4];function cc(e){return dr[Math.abs(e)%dr.length]??r0}function X4(e){const t=dr.length-2;return t<=0?0:1+((Number.isFinite(e)?Math.trunc(e):0)%t+t)%t}function Q4(e){return cc(X4(e))}const eT="x-anthropic-billing-header:";function tT(e){return e.trimStart().toLowerCase().startsWith(eT)}function nT(e){return ac(e)?Object.prototype.hasOwnProperty.call(e,"system"):!1}function sT(e){if(!ac(e))return!1;const t=_e(e,"type"),n=_e(e,"text");return typeof t!="string"||t!=="text"||typeof n!="string"?!1:tT(n)}function rT(e){let t;try{t=JSON.parse(e)}catch{return{body:e,removed:0}}if(!nT(t))return{body:e,removed:0};const n=t.system;if(!Array.isArray(n)||n.length===0)return{body:e,removed:0};const s=[];let o=0;for(const i of n){if(sT(i)){o+=1;continue}s.push(i)}return o===0?{body:e,removed:0}:(s.length===0?delete t.system:t.system=s,{body:JSON.stringify(t),removed:o})}const oT=400,Lu=2e3;function iT(e){return Array.isArray(e)}function aT(e,t){const n=[e];let s=0;for(;n.length>0;){const o=n.pop();if(o!==void 0){if(s+=1,s>t)return s;if(!(o===null||typeof o!="object")){if(iT(o)){for(const i of o)n.push(i);continue}for(const i of Object.keys(o)){const a=o[i];a!==void 0&&n.push(a)}}}}return s}function lT(e){const t=aT(e,Lu+1);return t<=oT?{depth:Number.POSITIVE_INFINITY}:t<=Lu?{depth:3}:{depth:2}}function cT(e){try{const t=JSON.parse(e);return{kind:"json",data:Ro(t)}}catch{return{kind:"text"}}}function Ui(e){const t=p.useMemo(()=>e===null?null:cT(e),[e]),n=t?.kind==="json"?t.data:null,s=p.useMemo(()=>n===null?null:lT(n),[n]),[o,i]=p.useState(!1),[a,l]=p.useState(0),[c,u]=p.useState(0),[d,f]=p.useTransition(),h=p.useCallback(()=>{const m=!o,v=m&&s!==null?s.depth:0;f(()=>{i(m),l(v),u(g=>g+1)})},[o,s]);return{parsedData:n,policy:s,isExpanded:o,toggle:h,isPending:d,bulkDepth:a,bulkRevision:c}}function Ro(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=>Ro(n));const t={};for(const n of Object.keys(e)){const s=Object.getOwnPropertyDescriptor(e,n);t[n]=Ro(s?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function o0({className:e,orientation:t="horizontal",...n}){return r.jsx(V3,{"data-slot":"tabs","data-orientation":t,orientation:t,className:ie("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",e),...n})}const uT=Ll("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 i0({className:e,variant:t="default",...n}){return r.jsx(q3,{"data-slot":"tabs-list","data-variant":t,className:ie(uT({variant:t}),e),...n})}function Ct({className:e,...t}){return r.jsx(Z3,{"data-slot":"tabs-trigger",className:ie("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 Nt({className:e,...t}){return r.jsx(G3,{"data-slot":"tabs-content",className:ie("flex-1 outline-none",e),...t})}function gn(e){const[t,n]=p.useState(!1),s=p.useRef(null);p.useEffect(()=>()=>{s.current!==null&&clearTimeout(s.current)},[]);const o=p.useCallback(i=>{i.stopPropagation(),e!==null&&Tt(e).then(a=>{a&&(n(!0),s.current!==null&&clearTimeout(s.current),s.current=setTimeout(()=>n(!1),2e3))})},[e]);return{copied:t,copy:o}}const dT=p.lazy(()=>Vn(()=>import("./CompareDrawer-Lx-WeJNC.js"),__vite__mapDeps([0,1])).then(e=>({default:e.CompareDrawer}))),fT=p.lazy(()=>Vn(()=>import("./ReplayDialog-CADaXFPE.js"),__vite__mapDeps([2,1,3])).then(e=>({default:e.ReplayDialog}))),pT=p.lazy(()=>Vn(()=>import("./RequestAnatomy-CGoL8ACh.js"),__vite__mapDeps([4,1])).then(e=>({default:e.RequestAnatomy}))),hT=p.lazy(()=>Vn(()=>import("./ResponseView-BSwM1dCH.js"),__vite__mapDeps([3,1])).then(e=>({default:e.ResponseView}))),mT=p.lazy(()=>Vn(()=>import("./StreamingChunkSequence-qhWtSx3D.js"),__vite__mapDeps([5,1])).then(e=>({default:e.StreamingChunkSequence}))),La=p.lazy(()=>Vn(()=>import("./json-viewer-uIwLntt-.js"),__vite__mapDeps([6,1])).then(e=>({default:e.JsonViewer}))),gT=p.lazy(()=>Vn(()=>import("./json-viewer-uIwLntt-.js"),__vite__mapDeps([6,1])).then(e=>({default:e.JsonViewerFromString}))),xT=1200,bT=12;function vT(e){const{containerRef:t,setExpandToPath:n,ensureTabActive:s,highlightMs:o}=e,i=p.useRef(null);return p.useCallback(a=>{s?.(),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"),i.current!==null&&clearTimeout(i.current),i.current=setTimeout(()=>{f.classList.remove("ring-2","ring-primary/60","ring-offset-1","ring-offset-background","rounded-sm","transition-shadow"),n(null)},o??xT)},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 m=h.querySelector(u);if(m!==null){l(m);return}}f>0?window.requestAnimationFrame(()=>d(f-1)):n(null)};window.requestAnimationFrame(()=>d(bT))},[t,s,o,n])}const Du="The compact log metadata is still available. Retry if the local server was restarting or the body store was briefly unavailable.";function ps(e){return e<1024?`${e.toLocaleString()} 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 yT(e,t){const n=[];return e!=null&&n.push(`Request ${ps(e)}`),t!=null&&n.push(`Response ${ps(t)}`),n.length===0?null:n.join(" · ")}function wT(e){if(e instanceof Vo)return{title:"Full bodies timed out",detail:"The log store did not answer before the UI timeout. Compact metadata is still available; retry loading the bodies."};if(e instanceof Error){const t=e.message.trim();return{title:"Full bodies could not be loaded",detail:t===""?Du:t}}return{title:"Full bodies could not be loaded",detail:Du}}class a0{diff(t,n,s={}){let o;typeof s=="function"?(o=s,s={}):"callback"in s&&(o=s.callback);const i=this.castInput(t,s),a=this.castInput(n,s),l=this.removeEmpty(this.tokenize(i,s)),c=this.removeEmpty(this.tokenize(a,s));return this.diffWithOptionsObj(l,c,s,o)}diffWithOptionsObj(t,n,s,o){var i;const a=y=>{if(y=this.postProcess(y,s),o){setTimeout(function(){o(y)},0);return}else return y},l=n.length,c=t.length;let u=1,d=l+c;s.maxEditLength!=null&&(d=Math.min(d,s.maxEditLength));const f=(i=s.timeout)!==null&&i!==void 0?i:1/0,h=Date.now()+f,m=[{oldPos:-1,lastComponent:void 0}];let v=this.extractCommon(m[0],n,t,0,s);if(m[0].oldPos+1>=c&&v+1>=l)return a(this.buildValues(m[0].lastComponent,n,t));let g=-1/0,x=1/0;const b=()=>{for(let y=Math.max(g,-u);y<=Math.min(x,u);y+=2){let k;const j=m[y-1],C=m[y+1];j&&(m[y-1]=void 0);let T=!1;if(C){const P=C.oldPos-y;T=C&&0<=P&&P<l}const N=j&&j.oldPos+1<c;if(!T&&!N){m[y]=void 0;continue}if(!N||T&&j.oldPos<C.oldPos?k=this.addToPath(C,!0,!1,0,s):k=this.addToPath(j,!1,!0,1,s),v=this.extractCommon(k,n,t,y,s),k.oldPos+1>=c&&v+1>=l)return a(this.buildValues(k.lastComponent,n,t))||!0;m[y]=k,k.oldPos+1>=c&&(x=Math.min(x,y-1)),v+1>=l&&(g=Math.max(g,y+1))}u++};if(o)(function y(){setTimeout(function(){if(u>d||Date.now()>h)return o(void 0);b()||y()},0)})();else for(;u<=d&&Date.now()<=h;){const y=b();if(y)return y}}addToPath(t,n,s,o,i){const a=t.lastComponent;return a&&!i.oneChangePerToken&&a.added===n&&a.removed===s?{oldPos:t.oldPos+o,lastComponent:{count:a.count+1,added:n,removed:s,previousComponent:a.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:n,removed:s,previousComponent:a}}}extractCommon(t,n,s,o,i){const a=n.length,l=s.length;let c=t.oldPos,u=c-o,d=0;for(;u+1<a&&c+1<l&&this.equals(s[c+1],n[u+1],i);)u++,c++,d++,i.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!i.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,s){return s.comparator?s.comparator(t,n):t===n||!!s.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let s=0;s<t.length;s++)t[s]&&n.push(t[s]);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,s){const o=[];let i;for(;t;)o.push(t),i=t.previousComponent,delete t.previousComponent,t=i;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(s.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,m){const v=s[u+m];return v.length>h.length?v: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 _T extends a0{constructor(){super(...arguments),this.tokenize=c0}equals(t,n,s){return s.ignoreWhitespace?((!s.newlineIsToken||!t.includes(`
|
|
96
96
|
`))&&(t=t.trim()),(!s.newlineIsToken||!n.includes(`
|
|
97
97
|
`))&&(n=n.trim())):s.ignoreNewlineAtEof&&!s.newlineIsToken&&(t.endsWith(`
|
|
98
98
|
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
99
|
-
`)&&(n=n.slice(0,-1))),super.equals(t,n,s)}}const
|
|
100
|
-
`));const n=[],s=e.split(/(\n|\r\n)/);s[s.length-1]||s.pop();for(let o=0;o<s.length;o++){const i=s[o];o%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}class
|
|
101
|
-
`);i.length>0&&i[i.length-1]===""&&i.pop();for(const a of i)o.added?(s+=1,t.push({kind:"added",text:a,oldLineNumber:null,newLineNumber:s})):o.removed?(n+=1,t.push({kind:"removed",text:a,oldLineNumber:n,newLineNumber:null})):(n+=1,s+=1,t.push({kind:"context",text:a,oldLineNumber:n,newLineNumber:s}))}return t}function
|
|
102
|
-
`),s
|
|
103
|
-
`);if(n===s)return{lines:[],isEmpty:!0};const o=a0(n,s);return{lines:$a(o),isEmpty:!1}}function $u(e){try{const t=JSON.parse(e);return t===null||typeof t=="string"||typeof t=="object"?t:null}catch{return null}}function jT(e,t){const n=e??"",s=t??"";if(n===s)return{lines:[],isEmpty:!0};const o=$u(n),i=$u(s);if(o!==null&&i!==null){const l=_T(o,i)??[];if(l.length===1){const c=l[0];if(c!==void 0&&!c.added&&!c.removed)return{lines:[],isEmpty:!0}}return{lines:$a(l),isEmpty:!1}}const a=a0(n,s);return{lines:$a(a),isEmpty:!1}}const ST=22,Wi=1e4;function CT(e){return e==="added"?"+":e==="removed"?"-":" "}function NT(e){return e==="added"?"bg-green-500/10 text-green-700 dark:text-green-300":e==="removed"?"bg-red-500/10 text-red-700 dark:text-red-300":"text-foreground/80"}const TT=function({result:t,emptyLabel:n}){const[s,o]=p.useState("unified"),i=p.useRef(null),a=P4({count:t.lines.length,getScrollElement:()=>i.current,estimateSize:()=>ST,overscan:10});if(t.isEmpty)return r.jsx("div",{className:"rounded border border-dashed border-border bg-muted/30 px-4 py-6 text-center text-xs text-muted-foreground","data-testid":"diff-empty",children:n??"No transformation applied — raw and processed are identical."});const l=t.lines.length,c=l>Wi,u=c?t.lines.slice(0,Wi):t.lines;return r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[r.jsxs("span",{children:[l.toLocaleString()," line",l===1?"":"s",c&&` (showing first ${Wi.toLocaleString()})`]}),r.jsxs("div",{className:"inline-flex rounded-md border border-border overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>o("unified"),"aria-pressed":s==="unified",className:ie("flex items-center gap-1 px-2 py-1 transition-colors",s==="unified"?"bg-muted text-foreground":"hover:bg-muted/50"),title:"Unified diff (single column)",children:[r.jsx(Xw,{className:"size-3"}),"Unified"]}),r.jsxs("button",{type:"button",onClick:()=>o("split"),"aria-pressed":s==="split",className:ie("flex items-center gap-1 px-2 py-1 transition-colors border-l border-border",s==="split"?"bg-muted text-foreground":"hover:bg-muted/50"),title:"Split diff (side by side)",children:[r.jsx(Vy,{className:"size-3"}),"Split"]})]})]}),r.jsx("div",{ref:i,className:"max-h-[60vh] overflow-auto rounded border border-border bg-background font-mono text-xs","data-testid":"diff-viewport",children:s==="unified"?r.jsx(ET,{virtualizer:a,lines:u}):r.jsx(IT,{lines:u})})]})};function ET({virtualizer:e,lines:t}){return r.jsx("div",{style:{height:`${e.getTotalSize()}px`,width:"100%",position:"relative"},children:e.getVirtualItems().map(n=>{const s=t[n.index];return s===void 0?null:r.jsxs("div",{"data-index":n.index,ref:e.measureElement,className:ie("flex items-start gap-3 px-2",NT(s.kind)),style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${n.start}px)`},children:[r.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:s.oldLineNumber??""}),r.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:s.newLineNumber??""}),r.jsx("span",{className:ie("select-none w-3 text-right font-bold",s.kind==="added"&&"text-green-600 dark:text-green-400",s.kind==="removed"&&"text-red-600 dark:text-red-400"),children:CT(s.kind)}),r.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:s.text})]},n.key)})})}function AT(e){const t=[];let n=0;for(;n<e.length;){const s=e[n];if(s===void 0)break;if(s.kind==="context"){t.push({left:{text:s.text,lineNumber:s.oldLineNumber},right:{text:s.text,lineNumber:s.newLineNumber},kind:"equal"}),n+=1;continue}const o=[],i=[];for(;n<e.length&&e[n]?.kind==="removed";){const l=e[n];l!==void 0&&o.push(l),n+=1}for(;n<e.length&&e[n]?.kind==="added";){const l=e[n];l!==void 0&&i.push(l),n+=1}const a=Math.max(o.length,i.length);for(let l=0;l<a;l+=1){const c=o[l],u=i[l];c!==void 0&&u!==void 0?t.push({left:{text:c.text,lineNumber:c.oldLineNumber},right:{text:u.text,lineNumber:u.newLineNumber},kind:"changed"}):c!==void 0?t.push({left:{text:c.text,lineNumber:c.oldLineNumber},right:null,kind:"removed"}):u!==void 0&&t.push({left:null,right:{text:u.text,lineNumber:u.newLineNumber},kind:"added"})}}return t}function RT(e){switch(e){case"changed":return"bg-amber-500/10";case"removed":return"bg-red-500/10";case"added":return"bg-green-500/10";case"equal":return""}}function IT({lines:e}){const t=AT(e);return r.jsx("div",{"data-testid":"diff-split",children:t.map((n,s)=>r.jsxs("div",{className:ie("grid grid-cols-2 font-mono text-xs",RT(n.kind)),children:[r.jsxs("div",{className:"flex items-start gap-2 px-2 border-r border-border/50",children:[r.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.left?.lineNumber??""}),r.jsx("span",{className:ie("select-none w-3 text-right font-bold",(n.kind==="removed"||n.kind==="changed")&&"text-red-600 dark:text-red-400"),children:n.left!==null?"-":" "}),r.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.left?.text??""})]}),r.jsxs("div",{className:"flex items-start gap-2 px-2",children:[r.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.right?.lineNumber??""}),r.jsx("span",{className:ie("select-none w-3 text-right font-bold",(n.kind==="added"||n.kind==="changed")&&"text-green-600 dark:text-green-400"),children:n.right!==null?"+":" "}),r.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.right?.text??""})]})]},s))})}const c0=p.memo(TT),zT=Ml("inline-flex items-center justify-center rounded-full border border-transparent px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function Me({className:e,variant:t="default",asChild:n=!1,...s}){const o=n?Qk:"span";return r.jsx(o,{"data-slot":"badge","data-variant":t,className:ie(zT({variant:t}),e),...s})}const OT={success:"bg-slate-300/[0.08] text-slate-100 border-transparent",client_error:"bg-amber-300/[0.10] text-amber-100 border-transparent",server_error:"bg-rose-400/[0.10] text-rose-100 border-transparent",pending:"bg-cyan-300/[0.08] text-cyan-100 border-transparent"},PT={success:{frame:"border-cyan-200/15 bg-white/[0.04] text-slate-100"},client_error:{frame:"border-amber-300/25 bg-amber-300/[0.08] text-amber-100"},server_error:{frame:"border-rose-300/25 bg-rose-300/[0.08] text-rose-100"},pending:{frame:"border-cyan-300/25 bg-cyan-300/[0.08] text-cyan-100"}},Bs="border border-transparent bg-white/[0.045] hover:bg-white/[0.075] size-8 text-muted-foreground shadow-none hover:text-cyan-100",Pt="bg-white/[0.045] flex h-7 items-center gap-1 rounded-md px-2 text-xs";function Us(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function MT(e){return e>=10?`${e.toFixed(0)}/s`:`${e.toFixed(1)}/s`}function LT(e,t){switch(e){case"success":return t===null?"OK":String(t);case"client_error":return t===null?"WARN":String(t);case"server_error":return t===null?"FAIL":String(t);case"pending":return"ROLL"}}function Fu({trend:e}){if(e===null)return null;const t=e.direction==="up",n=t?ly:ny,s=t?"+":"-";return r.jsxs("span",{className:"flex items-center gap-0.5 text-muted-foreground tabular-nums",children:[r.jsx(n,{className:t?"size-3 text-cyan-300":"size-3 text-rose-400"}),r.jsxs("span",{className:"font-mono",children:[s,Fe(e.delta)]})]})}const DT=p.memo(function({log:e,displayNumber:t,messageCount:n=null,toolCount:s=null,expanded:o,onToggle:i,cacheTrend:a=null,activeTab:l,tabActions:c,onReplay:u,slowResponseThresholdSeconds:d=0,showClientMetadata:f=!0,timeDisplayFormat:h}){const m=Wk(e.responseStatus),v=e.elapsedMs!==null&&d>0&&e.elapsedMs>d*1e3,g=e.inputTokens!==null||e.outputTokens!==null,x=e.firstChunkMs??null,b=e.tokensPerSecond??null,y=x===null?null:Us(x),k=b===null||b<=0?null:MT(b),j=e.warnings?.length??0,C=e.clientPid!==null&&e.clientPid!==void 0,T=e.clientProjectFolder!==null&&e.clientProjectFolder!==void 0&&e.clientProjectFolder!=="";e.clientCwd!==null&&e.clientCwd!==void 0&&e.clientCwd;const N=PT[m],O=LT(m,e.responseStatus),A=m!=="success"||e.responseStatus!==200,z=e.streaming&&y===null&&k===null;return r.jsx(jn,{children:r.jsxs("div",{id:`log-${e.id}`,role:"button",tabIndex:0,"data-nav-id":`log-${e.id}`,"data-nav-action":o?"collapse":"expand",className:ie("group/header relative isolate flex min-w-0 cursor-pointer items-start gap-2 overflow-hidden px-3 py-2 transition-[background-color,border-color,box-shadow]",o?"bg-white/[0.04]":"bg-transparent hover:bg-white/[0.035]","select-none","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),onClick:i,onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),i())},children:[r.jsxs("span",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1",children:[r.jsx("span",{className:ie("inline-flex h-8 shrink-0 items-center rounded-md px-2 font-mono",N.frame),children:r.jsxs("span",{className:"text-xs font-semibold tabular-nums",title:`Log ID ${String(e.id)}`,children:["#",t]})}),r.jsxs("span",{className:"bg-white/[0.045] flex h-7 shrink-0 items-center gap-1 rounded-md px-2 text-xs text-muted-foreground",children:[r.jsx(sn,{className:"size-3"}),r.jsx("span",{className:"font-mono tabular-nums",title:e.timestamp,children:ga(e.timestamp,h)})]}),A&&r.jsxs(Me,{variant:"outline",className:ie("h-6 gap-1 rounded-md px-2 py-0 font-mono text-[10px] font-semibold uppercase tabular-nums shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]",OT[m]),children:[m==="success"?r.jsx(Ge,{className:"size-3","aria-label":"Success"}):m==="server_error"?r.jsx(Mw,{className:"size-3","aria-label":"Server error"}):m==="client_error"?r.jsx(rn,{className:"size-3","aria-label":"Client error"}):r.jsx(Qe,{className:"size-3 animate-spin","aria-label":"Pending"}),O]}),j>0&&r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsxs(Me,{variant:"outline",className:"h-6 gap-1 rounded-md border-amber-300/30 bg-amber-300/[0.10] px-2 py-0 font-mono text-[10px] tabular-nums text-amber-100",children:[r.jsx(rn,{className:"size-3","aria-label":"Tool schema warnings"}),j]})}),r.jsx(dt,{children:j===1?"1 tool schema warning":`${j} tool schema warnings`})]}),e.elapsedMs!==null&&(v?r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsxs("span",{className:ie(Pt,"shrink-0 border-amber-300/25 text-amber-200"),children:[r.jsx(sn,{className:"size-3"}),r.jsx("span",{className:"font-mono tabular-nums",children:Us(e.elapsedMs)}),r.jsx(rn,{className:"size-3","aria-label":"Slow response"})]})}),r.jsxs(dt,{children:["Slow response: ",Us(e.elapsedMs)," exceeds"," ",Us(d*1e3)]})]}):r.jsxs("span",{className:ie(Pt,"shrink-0 text-muted-foreground"),children:[r.jsx(sn,{className:"size-3"}),r.jsx("span",{className:"font-mono tabular-nums",children:Us(e.elapsedMs)})]})),e.streaming&&y!==null&&r.jsxs("span",{className:ie(Pt,"shrink-0 text-cyan-300"),children:[r.jsx(Uc,{className:"size-3"}),r.jsxs("span",{className:"font-mono tabular-nums",children:["first ",y]})]}),e.streaming&&k!==null&&r.jsxs("span",{className:ie(Pt,"shrink-0 text-cyan-300"),children:[r.jsx(Nl,{className:"size-3"}),r.jsx("span",{className:"font-mono tabular-nums",children:k})]}),g&&r.jsxs("span",{className:ie(Pt,"min-w-0 sm:shrink-0"),children:[r.jsx(tr,{className:"size-3 text-muted-foreground"}),r.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-x-1 font-mono tabular-nums",children:[r.jsxs("span",{className:ie("whitespace-nowrap",e.inputTokens!==null?"text-blue-400":"text-muted-foreground"),children:["IN ",e.inputTokens!==null?Fe(e.inputTokens):"n/a"]}),r.jsx("span",{className:"text-muted-foreground",children:"/"}),r.jsxs("span",{className:ie("whitespace-nowrap",e.outputTokens!==null?"text-amber-400":"text-muted-foreground"),children:["OUT ",e.outputTokens!==null?Fe(e.outputTokens):"n/a"]})]})]}),e.cacheCreationInputTokens!==null&&e.cacheCreationInputTokens>0&&r.jsxs("span",{className:ie(Pt,"shrink-0"),children:[r.jsx(Fu,{trend:a?.creation??null}),r.jsxs("span",{className:"font-mono tabular-nums text-cyan-300",children:["KV Cache +",Fe(e.cacheCreationInputTokens)]})]}),e.cacheReadInputTokens!==null&&e.cacheReadInputTokens>0&&r.jsxs("span",{className:ie(Pt,"shrink-0"),children:[r.jsx(Fu,{trend:a?.read??null}),r.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["KV Cache ~",Fe(e.cacheReadInputTokens)]})]}),n!==null&&r.jsxs("span",{className:ie(Pt,"shrink-0 text-muted-foreground"),children:[r.jsx(Zo,{className:"size-3"}),r.jsx("span",{className:"font-mono tabular-nums",children:n})]}),s!==null&&r.jsxs("span",{className:ie(Pt,"shrink-0 text-muted-foreground"),children:[r.jsx(As,{className:"size-3"}),r.jsx("span",{className:"font-mono tabular-nums",children:s})]}),e.origin!==null&&r.jsxs("span",{className:ie(Pt,"hidden shrink-0 text-muted-foreground xl:flex"),title:`Origin: ${e.origin}`,children:[r.jsx(Gf,{className:"size-3"}),r.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",title:e.origin,children:e.origin})]}),f&&(C||T)&&r.jsxs("span",{className:ie(Pt,"hidden shrink-0 text-purple-300 xl:flex"),children:[r.jsx(lw,{className:"size-3"}),T?r.jsx("span",{className:"font-mono tabular-nums",children:e.clientProjectFolder}):r.jsxs("span",{className:"font-mono tabular-nums",children:["PID ",e.clientPid]})]}),z&&r.jsx(Uc,{className:"size-3 shrink-0 text-muted-foreground/60"})]}),r.jsxs("span",{className:"flex shrink-0 items-start gap-1.5",children:[o&&r.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",onClick:D=>D.stopPropagation(),onKeyDown:D=>D.stopPropagation(),children:[c!==void 0&&l!==void 0&&(()=>{const D=c[l];return D===void 0?null:r.jsxs(r.Fragment,{children:[D.expansion!==null&&r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsx(ke,{variant:"outline",size:"icon",className:Bs,onClick:D.expansion.onToggle,disabled:D.expansion.isPending,"aria-pressed":D.expansion.isExpanded,"aria-label":D.expansion.isExpanded?"Collapse all JSON":"Expand all JSON",children:D.expansion.isExpanded?r.jsx(Ty,{className:"size-3.5"}):r.jsx(_y,{className:"size-3.5"})})}),r.jsx(dt,{children:D.expansion.isExpanded?"Collapse all JSON nodes":"Expand all JSON nodes"})]}),D.diffWithRaw!==void 0&&r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsx(ke,{variant:"outline",size:"icon",className:ie(Bs,D.diffWithRaw.active&&"border-cyan-300/35 bg-cyan-400/15 text-cyan-100"),onClick:D.diffWithRaw.onToggle,"aria-pressed":D.diffWithRaw.active,"aria-label":D.diffWithRaw.active?"Hide raw diff":"Diff with raw",children:r.jsx(rw,{className:"size-3.5"})})}),r.jsx(dt,{children:D.diffWithRaw.active?"Hide diff with raw request":"Show diff between displayed and raw request body"})]}),D.diffWithPrevious!==void 0&&r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsx(ke,{variant:"outline",size:"icon",className:Bs,onClick:D.diffWithPrevious,"aria-label":"Diff with previous",children:r.jsx(Kf,{className:"size-3.5"})})}),r.jsx(dt,{children:"Compare this request with the immediately preceding one"})]}),D.copyText!==null&&r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsx(ke,{variant:"outline",size:"icon",className:Bs,onClick:D.onCopy,"aria-label":D.copyCopied?"Copied":D.copyLabel,children:D.copyCopied?r.jsx(Ge,{className:"size-3.5 text-cyan-300"}):r.jsx(At,{className:"size-3.5"})})}),r.jsx(dt,{children:D.copyCopied?"Copied to clipboard":D.copyLabel})]})]})})(),u!==void 0&&r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsx(ke,{variant:"outline",size:"icon",className:Bs,onClick:u,"aria-label":"Replay request",children:r.jsx(Kw,{className:"size-3.5"})})}),r.jsx(dt,{children:"Re-send this request to the provider"})]})]}),r.jsx("span",{className:"bg-white/[0.045] hover:bg-white/[0.075] inline-flex size-8 shrink-0 items-center justify-center rounded-md text-slate-200","aria-hidden":"true",children:o?r.jsx(ot,{className:"size-4 shrink-0"}):r.jsx(Tt,{className:"size-4 shrink-0"})})]})]})})});function $T({...e}){return r.jsx(cS,{"data-slot":"collapsible",...e})}function kz({...e}){return r.jsx(rh,{"data-slot":"collapsible-trigger",...e})}function FT({...e}){return r.jsx(oh,{"data-slot":"collapsible-content",...e})}function BT({className:e,children:t,...n}){return r.jsxs(tN,{"data-slot":"scroll-area",className:ie("relative overflow-hidden",e),...n,children:[r.jsx(nN,{"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}),r.jsx(UT,{}),r.jsx(sN,{})]})}function UT({className:e,orientation:t="vertical",...n}){return r.jsx(Bh,{"data-slot":"scroll-area-scrollbar",orientation:t,className:ie("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:r.jsx(Vh,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}const u0={file:"file",shell:"shell",browser:"browser",web:"web",mcp:"MCP",code:"code",other:"other"},WT={file:"border-transparent bg-blue-400/5 text-blue-300",shell:"border-transparent bg-teal-400/5 text-teal-300",browser:"border-transparent bg-cyan-400/5 text-cyan-300",web:"border-transparent bg-sky-400/5 text-sky-300",mcp:"border-transparent bg-violet-400/5 text-violet-300",code:"border-transparent bg-emerald-400/5 text-emerald-300",other:"border-transparent bg-muted/30 text-muted-foreground"};function HT({category:e}){switch(e){case"file":return r.jsx(uw,{className:"size-3.5"});case"shell":return r.jsx(Es,{className:"size-3.5"});case"browser":return r.jsx(Iw,{className:"size-3.5"});case"web":return r.jsx(Gf,{className:"size-3.5"});case"mcp":return r.jsx(py,{className:"size-3.5"});case"code":return r.jsx(Wy,{className:"size-3.5"});case"other":return r.jsx(Yy,{className:"size-3.5"})}}function VT({names:e}){return e.length===0?null:r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"required"}),e.slice(0,4).map(t=>r.jsx(Me,{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&&r.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:["+",e.length-4]})]})}function qT({tool:e,called:t}){const[n,s]=p.useState(!1),o=gn(e.name),i=e.description!==null||e.requiredParameters.length>0||e.schema!==null;return r.jsx($T,{open:n,onOpenChange:s,children:r.jsxs("div",{className:"bg-white/[0.035] rounded-[8px]",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-2.5 py-2",children:[r.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:()=>s(a=>!a),"aria-expanded":n,disabled:!i,children:[r.jsx(HT,{category:e.category}),r.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold text-foreground/90",children:e.name}),t&&r.jsx(Me,{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"}),r.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:[e.parameterCount," params"]}),e.descriptionPreview!==null&&r.jsx("span",{className:"hidden min-w-0 truncate text-xs text-muted-foreground md:inline",children:e.descriptionPreview}),r.jsx("span",{className:"flex-1"}),i&&(n?r.jsx(ot,{className:"size-3.5 shrink-0 text-muted-foreground"}):r.jsx(Tt,{className:"size-3.5 shrink-0 text-muted-foreground"}))]}),r.jsx("button",{type:"button",className:"bg-white/[0.045] hover:bg-white/[0.075] inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors 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?r.jsx(Ge,{className:"size-3.5 text-emerald-400"}):r.jsx(At,{className:"size-3.5"})})]}),r.jsx(FT,{children:n&&r.jsxs("div",{className:"space-y-2 bg-white/[0.025] px-2.5 py-2",children:[e.description!==null&&r.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:e.description}),r.jsx(VT,{names:e.requiredParameters}),e.schema!==null&&r.jsx(BT,{className:"bg-black/[0.16] max-h-64 rounded-[8px] p-2",children:r.jsx(p.Suspense,{fallback:r.jsx("div",{className:"text-xs text-muted-foreground",children:"Loading JSON..."}),children:r.jsx(La,{data:No(e.schema),defaultExpandDepth:0})})})]})})]})})}function ZT(e,t){return t.length===0?!0:`${e.name} ${e.description??""} ${u0[e.category]}`.toLowerCase().trim().includes(t)}const GT=p.memo(function({summary:t,calledToolNames:n}){const[s,o]=p.useState(!1),[i,a]=p.useState(""),l=p.useMemo(()=>new Set(n),[n]),c=i.trim().toLowerCase(),u=p.useMemo(()=>t===null?[]:t.tools.filter(h=>ZT(h,c)),[c,t]);if(t===null)return null;const d=t.tools.slice(0,6),f=t.tools.length-d.length;return r.jsxs("section",{className:"bg-black/[0.10] mb-3 overflow-hidden rounded-[8px]",children:[r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 px-3 py-2",children:[r.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[r.jsx(As,{className:"size-4 shrink-0 text-sky-300/80"}),r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[r.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Request Tools"}),r.jsx(Me,{variant:"outline",className:"h-5 rounded-md px-1.5 py-0 font-mono text-[10px]",children:t.tools.length}),t.toolChoiceLabel!==null&&r.jsxs(Me,{variant:"outline",className:"h-5 rounded-md px-1.5 py-0 font-mono text-[10px] text-muted-foreground",children:["tool_choice: ",t.toolChoiceLabel]})]}),r.jsx("div",{className:"mt-1 flex min-w-0 flex-wrap gap-1",children:t.categories.map(h=>r.jsxs(Me,{variant:"outline",className:ie("h-5 rounded-md px-1.5 py-0 font-mono text-[10px]",WT[h.category]),children:[h.count," ",u0[h.category]]},h.category))})]})]}),r.jsxs(ke,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-muted-foreground hover:text-cyan-100",onClick:()=>o(h=>!h),"aria-expanded":s,children:[s?r.jsx(ot,{className:"size-3.5"}):r.jsx(Tt,{className:"size-3.5"}),s?"Hide":"Show"]})]}),r.jsxs("div",{className:"flex min-w-0 flex-wrap gap-1.5 bg-white/[0.025] px-3 py-2",children:[d.map(h=>r.jsx(Me,{variant:"outline",className:ie("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&&r.jsxs("span",{className:"font-mono text-[10px] leading-5 text-muted-foreground",children:["+",f]})]}),s&&r.jsxs("div",{className:"space-y-2 bg-black/10 px-3 py-3",children:[r.jsxs("label",{className:"bg-white/[0.045] hover:bg-white/[0.075] flex h-8 items-center gap-2 rounded-md px-2 text-xs",children:[r.jsx(Qf,{className:"size-3.5 shrink-0 text-muted-foreground"}),r.jsx("input",{value:i,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"})]}),r.jsx("div",{className:"grid gap-1.5",children:u.length>0?u.map(h=>r.jsx(qT,{tool:h,called:l.has(h.name)},h.name)):r.jsx("p",{className:"py-2 text-xs text-muted-foreground",children:"No matching tools"})})]})]})});function Bu(e,t,n){return e==="anthropic"&&t==="full"&&n}function KT(e,t){return e==="full"&&t}function JT(e,t,n,s){return e==="anthropic"&&t==="full"&&n&&s}function is(){return r.jsx("div",{className:"h-1","aria-hidden":"true"})}function YT(e,t){switch(e){case"anatomy":return t===null?"request":"anatomy";case"request":return"request";case"response":return"parsed"}}const XT=15e3,QT=15e3,eE=256*1024,To=1024*1024,zn="h-9 flex-none rounded-md border border-transparent bg-transparent px-3 text-xs font-semibold text-muted-foreground shadow-none transition-colors hover:bg-white/[0.045] hover:text-foreground data-[state=active]:bg-cyan-300/[0.08] data-[state=active]:text-cyan-100 data-[state=active]:shadow-none";function Pr(e=null){return{status:"idle",text:"",offset:0,totalBytes:e,hasMore:e!==null&&e>0,error:null}}function Eo(e){return e??0}function d0(e){return e.bodyContentMode==="compact"||e.bodyContentMode==="truncated"}function f0(e){return d0(e)?Eo(e.rawRequestBodyBytes)>To||Eo(e.responseTextBytes)>To:!1}function tE(e){return d0(e)&&!f0(e)}function nE(e){return e instanceof Vo?"Body preview timed out. The log is still available on disk; try loading again.":e instanceof Error?e.message:"Body preview could not be loaded."}function Mr({status:e,error:t,footprint:n,onRetry:s}){switch(e){case"idle":return null;case"loading":return r.jsx(lr,{tone:"loading",title:"Loading full bodies",children:r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(Qe,{className:"size-3.5 shrink-0 animate-spin text-cyan-200"}),r.jsx("span",{children:"Loading full request and response bodies from the log store."})]}),n!==null&&r.jsx("span",{className:"rounded border border-cyan-300/15 bg-cyan-300/[0.06] px-2 py-0.5 font-mono text-[11px] text-cyan-100",children:n})]})});case"failed":return r.jsx(lr,{tone:"warning",title:t?.title??"Full bodies could not be loaded",children:r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsx("span",{children:t?.detail??"Compact metadata is still available."}),r.jsxs(ke,{type:"button",variant:"outline",size:"sm",className:"border border-input bg-background hover:bg-accent hover:text-accent-foreground h-7 gap-1.5 text-xs text-amber-100",onClick:s,children:[r.jsx(yn,{className:"size-3"}),"Retry"]})]})})}}function Uu(e,t){return e?t.text!==""?t.text:t.status==="success"?"":null:null}function On({children:e,className:t}){return r.jsx("div",{className:ie("bg-black/[0.14] inspector-scrollbar mx-3 mb-3 max-h-[72vh] overflow-auto rounded-[8px] p-3",t),children:e})}function to({children:e}){return r.jsx("div",{className:"bg-white/[0.035] rounded-md px-3 py-5 text-center text-xs italic text-muted-foreground",children:e})}function Lr({children:e}){return r.jsx("pre",{className:"bg-black/[0.18] inspector-scrollbar max-h-[64vh] overflow-auto whitespace-pre-wrap break-words rounded-[8px] p-3 font-mono text-xs leading-relaxed text-muted-foreground",children:e})}const sE={loading:"border-transparent bg-cyan-400/[0.06] text-cyan-100",warning:"border-transparent bg-amber-400/[0.08] text-amber-100",danger:"border-transparent bg-rose-400/[0.08] text-rose-100"};function lr({tone:e,title:t,children:n}){return r.jsxs("div",{className:ie("mb-3 rounded-md border px-3 py-2 text-xs shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]",sE[e]),children:[t!==void 0&&r.jsx("div",{className:"mb-1 font-semibold",children:t}),r.jsx("div",{className:"leading-relaxed text-muted-foreground",children:n})]})}function Dr({label:e,state:t,expectedBytes:n,onLoadMore:s}){const o=t.totalBytes??n,i=o===null?ps(t.offset):`${ps(t.offset)} / ${ps(o)}`,a=t.status!=="loading"&&t.hasMore,l=t.status==="failed"?"Retry":"Load more";return r.jsx(lr,{tone:t.status==="failed"?"warning":"loading",title:`${e} body preview`,children:r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("span",{children:[t.status==="idle"&&o!==null?`${e} body is ${ps(o)}. Loading the first preview chunk.`:`Loaded ${i}.`,t.status==="failed"&&t.error!==null&&` ${t.error}`]}),a&&r.jsx(ke,{type:"button",variant:"outline",size:"sm",className:"border border-input bg-background hover:bg-accent hover:text-accent-foreground h-7 text-xs text-cyan-100",onClick:s,children:l})]})})}function Wu({headers:e,emptyLabel:t}){const n=e===void 0?[]:Object.entries(e).sort(([s],[o])=>s.localeCompare(o));return n.length===0?r.jsx(to,{children:t}):r.jsx("div",{className:"bg-black/[0.14] overflow-hidden rounded-[8px] font-mono text-xs",children:n.map(([s,o])=>r.jsxs("div",{className:"grid min-w-0 grid-cols-[minmax(140px,0.32fr)_minmax(0,1fr)] border-b border-white/[0.055] last:border-b-0",children:[r.jsx("div",{className:"min-w-0 truncate bg-white/[0.035] px-2.5 py-2 font-semibold text-cyan-200",children:s}),r.jsx("div",{className:"min-w-0 truncate px-2.5 py-2 text-muted-foreground",title:o,children:o})]},s))})}function rE({active:e,onClick:t}){return r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsxs(ke,{variant:e?"default":"outline",size:"sm",className:ie("h-8 border-white/10 text-xs shadow-none",e?"bg-cyan-300 text-black hover:bg-cyan-200":"border border-input bg-background hover:bg-accent hover:text-accent-foreground text-muted-foreground hover:text-cyan-100"),onClick:t,"aria-pressed":e,children:[r.jsx(bw,{className:"size-3.5 mr-1"}),e?"Showing diff":"Diff with Raw"]})}),r.jsx(dt,{children:e?"Hide diff view":"Compare proxy output against the original raw version"})]})}const oE=p.memo(function({rawBody:e,displayedBody:t,emptyLabel:n}){const s=p.useMemo(()=>jT(e,t),[e,t]);return r.jsx(c0,{result:s,emptyLabel:n})}),iE=p.memo(function({rawHeaders:e,headers:t,emptyLabel:n}){const s=p.useMemo(()=>kT(e,t),[e,t]);return r.jsx(c0,{result:s,emptyLabel:n})}),aE=p.memo(function({log:e,displayNumber:t,viewMode:n="simple",strip:s,slowResponseThresholdSeconds:o,timeDisplayFormat:i,cacheTrend:a=null,onCompareWithPrevious:l,showClientMetadata:c=!0}){const[u,d]=p.useState(!1),[f,h]=p.useState(!1),[m,v]=p.useState(!1),[g,x]=p.useState(!1),[b,y]=p.useState("request"),[k,j]=p.useState(null),[C,T]=p.useState(0),[N,O]=p.useState(null),[A,z]=p.useState(null),[D,E]=p.useState("idle"),[L,w]=p.useState(null),[$,ee]=p.useState(0),[F,W]=p.useState(()=>Pr(e.rawRequestBodyBytes??null)),[Z,ue]=p.useState(()=>Pr(e.responseTextBytes??null)),V=p.useRef(null),H=p.useRef(e.id),le=p.useRef(!1),U=A??e,X=A===null&&f0(e),Ce=p.useMemo(()=>gT(e.rawRequestBodyBytes,e.responseTextBytes),[e.rawRequestBodyBytes,e.responseTextBytes]),ae=Uu(X,F),ge=Uu(X,Z),xe=U.rawRequestBody??ae,he=U.responseText??ge,be=U.rawRequestBody===null&&ae!==null,Se=U.responseText===null&&ge!==null,Ie=!be||F.hasMore===!1&&Eo(F.totalBytes)<=To,_=!Se||Z.hasMore===!1&&Eo(Z.totalBytes)<=To,Q=rr(U),G=Ym(Q),P=p.useMemo(()=>G.analyzeRequest(U.rawRequestBody),[G,U.rawRequestBody]),R=p.useMemo(()=>G.analyzeResponse(U.responseText),[G,U.responseText]),se=p.useMemo(()=>!s||Q!=="anthropic"||U.rawRequestBody===null?null:eT(U.rawRequestBody).body,[U.rawRequestBody,Q,s])??xe,ne=Ui(Ie?se:null),q=Ui(b==="raw-request"&&Ie?xe:null),ce=Ui(b==="raw"&&_?he:null),I=p.useMemo(()=>U.headers&&Object.keys(U.headers).length>0?JSON.stringify(U.headers,null,2):null,[U.headers]),M=p.useMemo(()=>U.rawHeaders&&Object.keys(U.rawHeaders).length>0?JSON.stringify(U.rawHeaders,null,2):null,[U.rawHeaders]),Y=gn(se),re=gn(xe),oe=gn(I),ve=gn(M),pe=gn(he),me=p.useMemo(()=>({request:{copyLabel:be?"Copy loaded request preview":"Copy request body",copyText:se,copyCopied:Y.copied,onCopy:Y.copy,expansion:Ie?{isExpanded:ne.isExpanded,isPending:ne.isPending,onToggle:ne.toggle}:null,diffWithRaw:JT(Q,n,s,U.rawRequestBody!==null)?{active:g,onToggle:()=>x(!g)}:void 0,diffWithPrevious:l===void 0?void 0:()=>{l(U)}},"raw-request":{copyLabel:be?"Copy loaded raw request preview":"Copy raw request",copyText:xe,copyCopied:re.copied,onCopy:re.copy,expansion:Ie?{isExpanded:q.isExpanded,isPending:q.isPending,onToggle:q.toggle}:null},headers:{copyLabel:"Copy headers",copyText:I,copyCopied:oe.copied,onCopy:oe.copy,expansion:null},"raw-headers":{copyLabel:"Copy raw headers",copyText:M,copyCopied:ve.copied,onCopy:ve.copy,expansion:null},raw:{copyLabel:Se?"Copy loaded response preview":"Copy response",copyText:he,copyCopied:pe.copied,onCopy:pe.copy,expansion:_?{isExpanded:ce.isExpanded,isPending:ce.isPending,onToggle:ce.toggle}:null}}),[se,be,Ie,Y,ne,g,U,U.rawRequestBody,xe,re,q,I,oe,M,ve,U.responseText,Se,_,he,pe,ce,Q,n,s,l]),Ae=p.useMemo(()=>ne.parsedData!==null?G.anatomySegments(ne.parsedData):null,[G,ne.parsedData]),$e=p.useMemo(()=>ac(ne.parsedData),[ne.parsedData]),Bt=U.warnings??[],Rn=p.useMemo(()=>{if(Ae!==null)return new Set(Ae.map(Be=>Be.path))},[Ae]),gt=mT({containerRef:V,setExpandToPath:O,ensureTabActive:()=>{b!=="request"&&y("request")}}),it=p.useCallback((Be,jt)=>{const et=Be==="request"?W:ue;et(xt=>({...xt,status:"loading",error:null}));const Ut=new URLSearchParams({part:Be,offset:String(jt),limit:String(eE)});Ke(`/api/logs/${String(e.id)}/body?${Ut.toString()}`,e2,QT).then(xt=>{H.current===e.id&&et(Qn=>({status:"success",text:xt.offset===0?xt.text:`${Qn.text}${xt.text}`,offset:xt.nextOffset??xt.totalBytes,totalBytes:xt.totalBytes,hasMore:xt.hasMore,error:null}))}).catch(xt=>{H.current===e.id&&et(Qn=>({...Qn,status:"failed",error:nE(xt)}))})},[e.id]),en=p.useCallback(()=>{le.current||(z(null),E("idle"),w(null),ee(Be=>Be+1))},[]),Ms=p.useCallback(()=>{const Be=!u;Be&&y(Ae!==null?"anatomy":"request"),d(Be)},[Ae,u]);return p.useEffect(()=>{H.current=e.id,le.current=!1,z(null),E("idle"),w(null),ee(0),W(Pr(e.rawRequestBodyBytes??null)),ue(Pr(e.responseTextBytes??null))},[e.id,e.rawRequestBodyBytes,e.responseTextBytes]),p.useEffect(()=>{if(!u||!tE(e)||A!==null||le.current)return;let Be=!1;return le.current=!0,E("loading"),w(null),Ke(`/api/logs/${String(e.id)}`,er,XT).then(jt=>{Be||(le.current=!1,z(jt),E("idle"),w(null))}).catch(jt=>{Be||(le.current=!1,E("failed"),w(xT(jt)))}),()=>{Be=!0,le.current=!1}},[u,A,e.bodyContentMode,e.id,e.rawRequestBodyBytes,e.responseTextBytes,$]),p.useEffect(()=>{u&&X&&F.status==="idle"&&(b!=="request"&&b!=="raw-request"&&b!=="anatomy"||it("request",0))},[b,u,it,F.status,X]),p.useEffect(()=>{u&&X&&Z.status==="idle"&&(b!=="parsed"&&b!=="raw"||it("response",0))},[b,u,it,Z.status,X]),p.useEffect(()=>{const Be=jt=>{const et=bi(jt);et!==null&&et.logId===e.id&&(d(!0),y(YT(et.tab,Ae)),et.tab==="response"&&et.toolCallIndex!==void 0&&(j(et.toolCallIndex),T(Ut=>Ut+1)))};return window.addEventListener(ln,Be),()=>{window.removeEventListener(ln,Be)}},[Ae,e.id]),r.jsxs(jn,{children:[r.jsxs("div",{className:ie("bg-card/80 relative mb-1.5 overflow-hidden rounded-[8px] transition-[background-color,box-shadow]",u?"bg-card shadow-[0_18px_60px_rgba(0,0,0,0.30),0_0_0_1px_rgba(103,232,249,0.08)]":"hover:bg-card"),children:[r.jsx(DT,{log:U,displayNumber:t,messageCount:P.messageCount,toolCount:P.toolCount,expanded:u,onToggle:Ms,cacheTrend:a,slowResponseThresholdSeconds:o,showClientMetadata:c,timeDisplayFormat:i,activeTab:b,tabActions:me,onReplay:l===void 0?void 0:()=>{h(!0)}}),u&&r.jsxs("div",{className:"relative bg-black/[0.14] pt-2",onClick:Be=>Be.stopPropagation(),onKeyDown:Be=>Be.stopPropagation(),children:[r.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-12 bg-gradient-to-b from-white/[0.05] to-transparent","aria-hidden":"true"}),r.jsxs(r0,{value:b,onValueChange:y,className:"gap-2",children:[r.jsxs(o0,{variant:"line",className:"bg-white/[0.04] inspector-scrollbar relative mx-3 h-auto w-[calc(100%-1.5rem)] justify-start overflow-x-auto rounded-[8px] p-1",children:[n==="full"&&r.jsx(St,{className:zn,value:"raw-headers",children:"Raw Headers"}),n==="full"&&r.jsx(St,{className:zn,value:"headers",children:"Headers"}),Ae!==null&&r.jsx(St,{className:zn,value:"anatomy",children:"Context"}),Bu(Q,n,s)&&r.jsx(St,{className:zn,value:"raw-request",children:"Raw Request"}),r.jsx(St,{className:zn,value:"request",children:"Request"}),n==="full"&&r.jsx(St,{className:zn,value:"raw",children:"Raw Response"}),r.jsx(St,{className:zn,value:"parsed",children:"Response"})]}),Bu(Q,n,s)&&r.jsx(Ct,{value:"raw-request",children:b==="raw-request"&&r.jsxs(On,{children:[r.jsx(Mr,{status:D,error:L,footprint:Ce,onRetry:en}),X&&r.jsx(Dr,{label:"Request",state:F,expectedBytes:e.rawRequestBodyBytes??null,onLoadMore:()=>it("request",F.offset)}),xe===null?r.jsx(to,{children:X?"Request preview is loading":"No request body"}):q.parsedData!==null?r.jsx(p.Suspense,{fallback:r.jsx(is,{}),children:r.jsx(La,{data:q.parsedData,bulkDepth:q.bulkDepth,bulkRevision:q.bulkRevision})}):r.jsx(Lr,{children:xe})]})}),r.jsx(Ct,{value:"request",children:b==="request"&&r.jsxs(On,{children:[r.jsx(Mr,{status:D,error:L,footprint:Ce,onRetry:en}),X&&r.jsx(Dr,{label:"Request",state:F,expectedBytes:e.rawRequestBodyBytes??null,onLoadMore:()=>it("request",F.offset)}),Bt.length>0&&r.jsxs(lr,{tone:"warning",children:[r.jsxs("div",{className:"flex items-center gap-2 font-semibold text-amber-300",children:[r.jsx(rn,{className:"size-3.5"}),"Tool schema warnings"]}),r.jsx("ul",{className:"mt-2 space-y-1 text-muted-foreground",children:Bt.map(Be=>r.jsx("li",{children:Be},Be))})]}),r.jsx(GT,{summary:$e,calledToolNames:R.toolNames??[]}),g?r.jsx(oE,{rawBody:U.rawRequestBody,displayedBody:se,emptyLabel:"No transformation applied; raw and sent request bodies are identical."}):r.jsx("div",{ref:V,children:se===null?r.jsx(to,{children:X?"Request preview is loading":"No request body"}):ne.parsedData!==null?r.jsx(p.Suspense,{fallback:r.jsx(is,{}),children:r.jsx(La,{data:ne.parsedData,bulkDepth:ne.bulkDepth,bulkRevision:ne.bulkRevision,anatomyPaths:Rn,expandToPath:N})}):r.jsx(Lr,{children:se})})]})}),Ae!==null&&r.jsx(Ct,{value:"anatomy",children:b==="anatomy"&&r.jsx(On,{className:"p-0",children:r.jsx(p.Suspense,{fallback:r.jsx(is,{}),children:r.jsx(cT,{parsed:ne.parsedData,inputTokens:U.inputTokens??null,model:U.model,segments:Ae,onSegmentActivate:gt})})})}),n==="full"&&r.jsx(Ct,{value:"headers",children:b==="headers"&&r.jsxs(On,{children:[r.jsx("div",{className:"flex justify-end gap-2 mb-2",children:KT(n,U.rawHeaders!==void 0&&Object.keys(U.rawHeaders).length>0)&&r.jsx(rE,{active:m,onClick:Be=>{Be.stopPropagation(),v(!m)}})}),m?r.jsx(iE,{rawHeaders:U.rawHeaders,headers:U.headers,emptyLabel:"No transformation applied; raw and processed headers are identical."}):r.jsx(Wu,{headers:U.headers,emptyLabel:"No headers captured"})]})}),n==="full"&&r.jsx(Ct,{value:"raw-headers",children:b==="raw-headers"&&r.jsx(On,{children:r.jsx(Wu,{headers:U.rawHeaders,emptyLabel:"No raw headers captured"})})}),r.jsx(Ct,{value:"raw",children:b==="raw"&&r.jsxs(On,{className:"space-y-3",children:[r.jsx(Mr,{status:D,error:L,footprint:Ce,onRetry:en}),X&&r.jsx(Dr,{label:"Response",state:Z,expectedBytes:e.responseTextBytes??null,onLoadMore:()=>it("response",Z.offset)}),U.error!==void 0&&U.error!==null&&r.jsx(lr,{tone:"danger",title:"SSE Error",children:r.jsx("span",{className:"font-mono",children:U.error})}),he!==null&&_?r.jsx(p.Suspense,{fallback:r.jsx(is,{}),children:r.jsx(fT,{text:he,defaultExpandDepth:0,bulkDepth:ce.bulkDepth,bulkRevision:ce.bulkRevision})}):he!==null?r.jsx(Lr,{children:he}):r.jsx(to,{children:X?"Response preview is loading":"No response"}),U.streaming===!0&&r.jsx(p.Suspense,{fallback:r.jsx(is,{}),children:r.jsx(dT,{logId:U.id,truncated:U.streamingChunksPath!==null})})]})}),r.jsx(Ct,{value:"parsed",children:b==="parsed"&&r.jsxs(On,{children:[r.jsx(Mr,{status:D,error:L,footprint:Ce,onRetry:en}),X&&r.jsx(Dr,{label:"Response",state:Z,expectedBytes:e.responseTextBytes??null,onLoadMore:()=>it("response",Z.offset)}),Se&&!_?r.jsx(Lr,{children:he}):r.jsx(p.Suspense,{fallback:r.jsx(is,{}),children:r.jsx(uT,{responseText:he,responseStatus:U.responseStatus,streaming:U.streaming,inputTokens:U.inputTokens,outputTokens:U.outputTokens,cacheCreationInputTokens:U.cacheCreationInputTokens,cacheReadInputTokens:U.cacheReadInputTokens,apiFormat:Q,error:U.error,focusedToolIndex:k,toolFocusNonce:C})})]})})]})]})]}),r.jsx(p.Suspense,{fallback:null,children:r.jsx(lT,{log:U,displayNumber:t,open:f,onOpenChange:h})})]})});function lE(e){switch(e){case"end_turn":return"End of Turn (Anthropic)";case"stop":return"End of Turn (OpenAI)";case"length":return"End of Turn (length limit)";case"tool_use":case null:return"End of Turn"}}function Hi(e){return e?"cursor-pointer transition-transform hover:scale-110":""}function cE({stopReason:e,isPending:t,isFirst:n,isTurnStart:s,isOnlyEntry:o=!1,crabIndex:i=0,collapsible:a=!1,onToggle:l}){const c=El(e),u=o&&s&&c,d=t&&!c,f=a&&l!==void 0,h=p.useMemo(()=>lc(i),[i]),m=p.useMemo(()=>K4(i),[i]),v=x=>{!f||l===void 0||(x.stopPropagation(),l())},g=x=>{!f||l===void 0||x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),l())};return r.jsxs("div",{className:"flex flex-col items-center w-6 shrink-0 pt-0.5 pb-0.5",children:[r.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]",children:!n&&r.jsx("div",{className:"w-px bg-muted-foreground/18 h-full"})}),u?r.jsx("span",{role:f?"button":void 0,tabIndex:f?0:void 0,title:"Single-request turn",className:Hi(f),onClick:v,onKeyDown:g,children:r.jsx(m,{className:ie("size-3.5 text-[#80FF00]","animate-crab-settle","drop-shadow-[0_0_4px_rgba(128,255,0,0.5)]")})}):c?r.jsx("span",{role:f?"button":void 0,tabIndex:f?0:void 0,title:lE(e),className:Hi(f),onClick:v,onKeyDown:g,children:r.jsx(h,{className:ie("size-3.5 text-amber-400","animate-crab-settle","drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})}):s?r.jsx("span",{role:f?"button":void 0,tabIndex:f?0:void 0,title:"Start of turn",className:Hi(f),onClick:v,onKeyDown:g,children:r.jsx(h,{className:ie("size-3.5 text-emerald-400","animate-crab-appear","drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}):d?r.jsx("span",{title:"Processing",children:r.jsx(h,{className:ie("size-3.5 text-amber-300/80","animate-crab-crawl")})}):r.jsx("span",{title:"Request in turn",children:r.jsx(h,{className:"size-3.5 text-muted-foreground/40"})}),r.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:!c&&r.jsx("div",{className:ie("w-0.5 h-full",t?"border-dashed bg-transparent border-l border-muted-foreground/14":"bg-muted-foreground/18")})})]})}const uE=4;function dE({event:e}){return r.jsxs("button",{type:"button",className:"inline-flex h-6 max-w-[11rem] min-w-0 items-center gap-1 rounded-md bg-white/[0.028] px-1.5 text-[11px] text-muted-foreground transition-colors hover:bg-sky-400/[0.08] hover:text-sky-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>ir({logId:e.logId,tab:"response",toolCallIndex:e.index}),"aria-label":`Open response tool call ${e.name}`,children:[r.jsx(As,{className:"size-3 shrink-0 text-sky-400/65"}),r.jsx("span",{className:"min-w-0 truncate font-mono font-semibold",children:e.name})]},e.id)}function fE({events:e,warnings:t=[]}){if(e.length===0&&t.length===0)return null;const n=e.slice(0,uE),s=Math.max(0,e.length-n.length);return r.jsxs("div",{className:"mx-3 mb-2 flex min-w-0 items-center gap-1.5 overflow-hidden rounded-md bg-black/[0.10] px-2 py-1 shadow-[inset_0_1px_0_rgba(255,255,255,0.025)]",children:[e.length>0&&r.jsxs("span",{className:"inline-flex h-6 shrink-0 items-center gap-1 rounded-md px-1.5 font-mono text-[10px] font-semibold uppercase tracking-[0.12em] text-sky-300/70",children:[r.jsx(As,{className:"size-3"}),e.length]}),t.length>0&&r.jsxs("span",{className:"inline-flex h-6 shrink-0 items-center gap-1 rounded-md border border-amber-300/20 bg-amber-300/[0.08] px-1.5 font-mono text-[10px] font-semibold text-amber-100",children:[r.jsx(rn,{className:"size-3"}),t.length]}),r.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden",children:[n.map(o=>r.jsx(dE,{event:o},o.id)),s>0&&r.jsxs("span",{className:"inline-flex h-6 shrink-0 items-center rounded-md bg-white/[0.025] px-1.5 font-mono text-[11px] font-semibold text-muted-foreground",children:["+",s]})]})]})}const Hu=180,Vi=new WeakMap;function pE(e,t){const n=e.responseText;if(n===null)return!1;switch(t){case"anthropic":return n.includes("tool_use");case"openai":return n.includes("tool_calls")||n.includes("function_call");case"unknown":return!1}}function hE(e,t,n){return e>1&&t&&!n}function Fa(e){const t=[];let n=[],s=0;for(let o=0;o<e.length;o+=1){const i=e[o];if(i===void 0)continue;n.push({log:i,stopReason:sp(i),sessionLogNumber:o+1});const a=n[n.length-1];a!==void 0&&El(a.stopReason)&&(t.push({entries:n,turnIndex:s}),n=[],s+=1)}return n.length>0&&t.push({entries:n,turnIndex:s}),t}function mE(e){const t=new Map;for(const n of e)for(let s=1;s<n.logs.length;s+=1){const o=n.logs[s],i=n.logs[s-1];if(o===void 0||i===void 0)continue;const a=rr(o),l=rr(i);a==="unknown"||a!==l||t.set(o.id,i)}return t}function p0(e){if(e===null)return null;try{const t=JSON.parse(e);return typeof t=="string"?JSON.parse(t):t}catch{return null}}function no(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>Hu?`${n.slice(0,Hu-1)}...`:n}function so(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 gE(e){const t=p0(e.responseText),n=_e(t,"content");if(!Array.isArray(n))return[];const s=[];for(const o of n){if(_e(o,"type")!=="tool_use")continue;const a=_e(o,"name");if(typeof a!="string"||a.length===0)continue;const l=_e(o,"input");s.push({id:`${String(e.id)}-anthropic-tool-${String(s.length)}`,logId:e.id,index:s.length,provider:"anthropic",name:a,argumentsText:so(l),argumentsPreview:no(l)})}return s}function xE(e){const t=p0(e.responseText),n=_e(t,"choices");if(!Array.isArray(n))return[];const s=[];for(const i of n){const a=_e(i,"message"),l=_e(a,"tool_calls");if(Array.isArray(l))for(const d of l){const f=_e(d,"function"),h=_e(f,"name");if(typeof h!="string"||h.length===0)continue;const m=_e(f,"arguments");s.push({id:`${String(e.id)}-openai-tool-${String(s.length)}`,logId:e.id,index:s.length,provider:"openai",name:h,argumentsText:so(m),argumentsPreview:no(m)})}const c=_e(a,"function_call"),u=_e(c,"name");if(typeof u=="string"&&u.length>0){const d=_e(c,"arguments");s.push({id:`${String(e.id)}-openai-tool-${String(s.length)}`,logId:e.id,index:s.length,provider:"openai",name:u,argumentsText:so(d),argumentsPreview:no(d)})}}const o=_e(t,"output");if(Array.isArray(o))for(const i of o){if(_e(i,"type")!=="function_call")continue;const a=_e(i,"name");if(typeof a!="string"||a.length===0)continue;const l=_e(i,"arguments");s.push({id:`${String(e.id)}-openai-tool-${String(s.length)}`,logId:e.id,index:s.length,provider:"openai",name:a,argumentsText:so(l),argumentsPreview:no(l)})}return s}function cc(e){const t=Vi.get(e);if(t!==void 0&&t.apiFormat===e.apiFormat&&t.responseText===e.responseText)return t.events;const n=rr(e);if(!pE(e,n)){const o=[];return Vi.set(e,{apiFormat:e.apiFormat,responseText:e.responseText,events:o}),o}let s;switch(n){case"anthropic":s=gE(e);break;case"openai":s=xE(e);break;case"unknown":s=[];break}return Vi.set(e,{apiFormat:e.apiFormat,responseText:e.responseText,events:s}),s}function bE(e,t,n=0){let s=0,o=0,i=0,a=0,l=0,c=0,u=0,d=0,f=null,h=0;for(const m of e)m.responseStatus===null?o+=1:m.responseStatus>=400&&(s+=1),m.elapsedMs!==null&&t>0&&m.elapsedMs>t*1e3&&(i+=1),m.inputTokens!==null&&(a+=m.inputTokens),m.outputTokens!==null&&(l+=m.outputTokens),m.cacheCreationInputTokens!==null&&(c+=m.cacheCreationInputTokens),m.cacheReadInputTokens!==null&&(u+=m.cacheReadInputTokens),m.elapsedMs!==null&&(d+=m.elapsedMs,f=f===null?m.elapsedMs:Math.max(f,m.elapsedMs)),h+=cc(m).length;return{llmCallCount:e.length,toolCallCount:h,failedCallCount:s,pendingCallCount:o,slowCallCount:i,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 qi(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const vE=p.memo(function({entries:t,viewMode:n,strip:s,slowResponseThresholdSeconds:o,cacheTrends:i,onCompareWithPrevious:a,comparisonPredecessors:l,turnIndex:c=0,timeDisplayFormat:u,pendingFocusRequest:d,showLogClientMetadata:f=!0}){const h=t.length-1,m=t[h]?.stopReason??null,v=m!==null?El(m):!1,g=t[h]?.log.responseStatus===null,x=t.length===1,b=hE(t.length,v,g),[y,k]=p.useState(!1),j=p.useRef(!1);p.useEffect(()=>{b?v&&!j.current&&k(!0):k(!1),j.current=v},[b,v]),p.useEffect(()=>{const F=W=>{const Z=bi(W);Z!==null&&t.some(ue=>ue.log.id===Z.logId)&&b&&k(!1)};return window.addEventListener(ln,F),()=>{window.removeEventListener(ln,F)}},[b,t]),p.useEffect(()=>{if(d===void 0||!t.some(W=>W.log.id===d.logId))return;b&&k(!1);const F=window.setTimeout(()=>{ir({logId:d.logId,tab:d.tab,source:"virtualizer"})},0);return()=>window.clearTimeout(F)},[b,t,d]);const C=p.useCallback(()=>{b&&k(F=>!F)},[b]),T=p.useMemo(()=>{let F=0,W=0,Z=null,ue=!1;for(const V of t)V.log.inputTokens!==null&&(F+=V.log.inputTokens,ue=!0),V.log.outputTokens!==null&&(W+=V.log.outputTokens,ue=!0),V.log.elapsedMs!==null&&(Z=Z===null?V.log.elapsedMs:Math.max(Z,V.log.elapsedMs));return{totalInput:F,totalOutput:W,hasTokens:ue,maxElapsed:Z}},[t,h]),N=c%2===0?"bg-white/[0.008]":"bg-cyan-300/[0.008]",O=T.maxElapsed!==null&&o>0&&T.maxElapsed>o*1e3,A=p.useMemo(()=>{const F=new Map;for(const W of t){const Z=cc(W.log);Z.length>0&&F.set(W.log.id,Z)}return F},[t]),[z,D]=p.useState(0),E=p.useRef(null);p.useEffect(()=>{const F=E.current;if(!F)return;let W=0;const Z=new ResizeObserver(()=>{window.cancelAnimationFrame(W),W=window.requestAnimationFrame(()=>D(ue=>ue+1))});return Z.observe(F),()=>{Z.disconnect(),window.cancelAnimationFrame(W)}},[]);const L=t[0]?.log.id??c,w=`Turn ${String(c+1)}`,$=p.useMemo(()=>lc(L%12),[L]),ee=p.useMemo(()=>({contentVisibility:"auto",containIntrinsicSize:y?"48px":"160px"}),[y]);return r.jsx("div",{ref:E,style:ee,tabIndex:y?void 0:0,role:y?void 0:"group","aria-label":y?void 0:w,"data-nav-id":y?void 0:`turn-${String(L)}`,className:ie("rounded-[8px] transition-[background-color,box-shadow]",g?"bg-amber-300/[0.018] shadow-[0_0_0_1px_rgba(252,211,77,0.035)]":"",!y&&"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),children:y?r.jsxs("div",{"data-nav-id":`turn-collapsed-${String(L)}`,"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:C,onKeyDown:F=>{(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),C())},children:[r.jsxs("div",{className:"w-6 shrink-0 flex flex-col items-center pt-1.5 pb-1.5",children:[r.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]"}),r.jsx($,{className:ie("size-3.5",g?"animate-crab-crawl text-amber-300/80":"animate-crab-appear text-emerald-400",g?"drop-shadow-[0_0_4px_rgba(252,211,77,0.42)]":"drop-shadow-[0_0_4px_rgba(52,211,153,0.45)]")}),r.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:r.jsx("div",{className:"w-px bg-muted-foreground/14 h-full"})}),v&&r.jsx($,{className:ie("size-3.5 animate-crab-settle text-amber-400","drop-shadow-[0_0_4px_rgba(251,191,36,0.45)]")})]}),t.length>1&&r.jsxs("div",{className:ie("flex-1 min-w-0 mb-0.5 rounded-[8px] py-1.5 px-3 flex items-center gap-3 text-xs","bg-card/80 transition-colors hover:bg-card",N),children:[r.jsx("span",{className:"font-mono text-[10px] font-semibold uppercase tracking-[0.14em] text-muted-foreground/70",children:w}),r.jsxs("span",{className:"text-blue-300/85 font-mono font-semibold tabular-nums shrink-0",title:`Log IDs ${String(t[0]?.log.id??"?")} ~ ${String(t[h]?.log.id??"?")}`,children:["#",t[0]?.sessionLogNumber??"?"," ~ #",t[h]?.sessionLogNumber??"?"]}),r.jsxs("span",{className:"text-muted-foreground shrink-0",children:[t.length," request",t.length>1?"s":""]}),T.maxElapsed!==null&&r.jsx(jn,{children:r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsxs("span",{className:ie("flex items-center gap-1 shrink-0",O?"text-amber-400":"text-muted-foreground"),children:[r.jsx(sn,{className:"size-3"}),r.jsx("span",{className:"font-mono tabular-nums",children:qi(T.maxElapsed)}),O&&r.jsx(rn,{className:"size-3","aria-label":"Slow response"})]})}),r.jsx(dt,{children:O?`Slow response: ${qi(T.maxElapsed)} exceeds ${qi(o*1e3)}`:"Slowest request in this turn"})]})}),T.hasTokens&&r.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[r.jsx(tr,{className:"size-3 text-muted-foreground"}),r.jsxs("span",{className:"font-mono tabular-nums",children:[r.jsxs("span",{className:"text-blue-400",children:["IN ",Fe(T.totalInput)]})," / ",r.jsxs("span",{className:"text-amber-400",children:["OUT ",Fe(T.totalOutput)]})]})]}),r.jsx("span",{className:"flex-1 min-w-0"}),r.jsx("span",{className:"bg-white/[0.045] inline-flex size-7 shrink-0 items-center justify-center rounded-md text-slate-200","aria-hidden":"true",children:r.jsx(Tt,{className:"size-4 shrink-0"})})]})]}):t.map((F,W)=>{const{log:Z,stopReason:ue}=F,V=W===0;return r.jsxs("div",{className:"flex items-stretch",children:[r.jsx(cE,{stopReason:ue,isPending:Z.responseStatus===null,isFirst:W===0,isTurnStart:V,isOnlyEntry:x,crabIndex:Z.id%12,collapsible:b&&V,onToggle:C}),r.jsxs("div",{className:ie("flex-1 min-w-0 mb-0.5 rounded-[8px]",N),children:[r.jsx(aE,{log:Z,displayNumber:F.sessionLogNumber,viewMode:n,strip:s,slowResponseThresholdSeconds:o,timeDisplayFormat:u,cacheTrend:i?.get(Z.id)??null,showClientMetadata:f,onCompareWithPrevious:l.has(Z.id)?a:void 0}),r.jsx(fE,{events:A.get(Z.id)??[],warnings:Z.warnings??[]})]})]},Z.id)})})}),yE=24,wE=132,_E=8;function kE(e){return e>yE}function jE(e){const t=new Map;for(let n=0;n<e.length;n++){const s=e[n];if(s!==void 0)for(const o of s.entries)t.set(o.log.id,n)}return t}function h0(e,t,n){return r.jsx(vE,{entries:e.entries,viewMode:t.viewMode,strip:t.strip,slowResponseThresholdSeconds:t.slowResponseThresholdSeconds,timeDisplayFormat:t.timeDisplayFormat,cacheTrends:t.cacheTrends,onCompareWithPrevious:t.onCompareWithPrevious,comparisonPredecessors:t.comparisonPredecessors,turnIndex:e.turnIndex,pendingFocusRequest:n,showLogClientMetadata:t.showLogClientMetadata},e.turnIndex)}function SE(e){return kE(e.turnGroups.length)?r.jsx(CE,{...e}):r.jsx(r.Fragment,{children:e.turnGroups.map(t=>h0(t,e))})}function CE(e){const{turnGroups:t}=e,[n,s]=p.useState(null),o=M4({count:t.length,estimateSize:()=>wE,overscan:_E,getItemKey:a=>t[a]?.turnIndex??a}),i=p.useMemo(()=>jE(t),[t]);return p.useEffect(()=>{const a=l=>{const c=bi(l);if(c===null||c.source==="virtualizer")return;const u=i.get(c.logId);u!==void 0&&(o.scrollToIndex(u,{align:"center"}),s(d=>({...c,turnIndex:u,nonce:d===null?1:d.nonce+1})))};return window.addEventListener(ln,a),()=>{window.removeEventListener(ln,a)}},[i,o]),r.jsx("div",{className:"relative w-full",style:{height:`${o.getTotalSize()}px`},"data-virtualized-turn-list":"true",children:o.getVirtualItems().map(a=>{const l=t[a.index];if(l===void 0)return null;const c=n!==null&&n.turnIndex===a.index?n:void 0;return r.jsx("div",{"data-index":a.index,ref:o.measureElement,className:"absolute left-0 top-0 w-full",style:{transform:`translateY(${a.start}px)`},children:h0(l,e,c)},a.key)})})}const uc=Re(["episode","procedure","preference","project-fact"]),NE=Re(["draft","promoted","failed"]),m0=J({source:Ee("agent-inspector"),sessionId:S(),logIds:fe(K().int().positive()),project:S().nullable(),models:fe(S())}),TE=J({redacted:Le(),patterns:fe(S())}),xr=J({id:S(),type:uc,title:S(),content:S(),tags:fe(S()),source:Ee("agent-inspector"),sessionId:S(),logIds:fe(K().int().positive()),evidence:m0,status:NE,createdAt:S(),updatedAt:S(),openClawMemoryId:S().nullable(),error:S().nullable(),redaction:TE});J({idempotencyKey:S(),type:uc,title:S(),content:S(),tags:fe(S()),source:Ee("agent-inspector"),project:S().nullable(),evidence:m0});const EE=J({id:S(),type:uc.or(S()),title:S(),content:S(),score:K().nullable(),source:S().nullable(),project:S().nullable(),evidence:Ln().optional()});J({results:fe(EE),warning:S().nullable()});const AE=J({candidates:fe(xr)}),RE=J({candidate:xr}),IE=J({error:S().optional(),candidate:xr.optional()}),zE=J({candidate:xr}),OE=3e4,PE=15e3,ME=15e3,LE={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 Ba(e){return e===null?"-":e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`}function DE(e,t,n){return e===null||t===null?null:Tl(e,t,n)}function $E(e){return`${String(e)} candidate${e===1?"":"s"}`}function g0(e){return`log-${String(e)}`}function x0(e){const t=g0(e),n=document.getElementById(t);window.history.replaceState(null,"",`#${t}`),n instanceof HTMLElement&&(n.scrollIntoView({block:"center",behavior:"smooth"}),n.focus({preventScroll:!0}))}function FE(e){for(const t of e)if(t.responseStatus!==null&&t.responseStatus>=400)return t;return null}function BE(e){let t=null,n=-1;for(const s of e)s.elapsedMs!==null&&s.elapsedMs>n&&(t=s,n=s.elapsedMs);return t}function UE(e){for(const t of e)if(cc(t).length>0)return t;return null}function WE(e){const t=new Map;for(let n=0;n<e.length;n+=1){const s=e[n];s!==void 0&&t.set(s.id,n+1)}return t}function bs(e,t){return String(t.get(e)??e)}function HE(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=UE(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 #${bs(n.id,e.displayNumberByLogId)}`,logId:n.id});const s=FE(e.logs);s!==null&&t.push({kind:"failure",title:`Failure #${String(s.responseStatus)}`,detail:`First failed request is #${bs(s.id,e.displayNumberByLogId)}`,logId:s.id});const o=BE(e.logs);if(o!==null&&e.summary.maxElapsedMs!==null&&t.push({kind:"slow",title:`Slowest ${Ba(e.summary.maxElapsedMs)}`,detail:`Max latency observed at #${bs(o.id,e.displayNumberByLogId)}`,logId:o.id}),e.candidates.length>0){const i=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(i)} draft / ${String(a)} promoted`,logId:e.candidates[0]?.logIds[0]??null})}return t}function VE(e){switch(e){case"session":return r.jsx(Zo,{className:"size-3.5 text-blue-400"});case"tool":return r.jsx(As,{className:"size-3.5 text-sky-400/70"});case"slow":return r.jsx(sn,{className:"size-3.5 text-amber-400"});case"failure":return r.jsx(qf,{className:"size-3.5 text-destructive"});case"candidate":return r.jsx(Vf,{className:"size-3.5 text-emerald-400"})}}function qE({insights:e}){return e.length===0?null:r.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=>r.jsxs("button",{type:"button",className:ie("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&&x0(t.logId)},disabled:t.logId===null,children:[VE(t.kind),r.jsxs("span",{className:"min-w-0",children:[r.jsx("span",{className:"block truncate font-medium text-foreground/90",children:t.title}),r.jsx("span",{className:"block truncate font-mono text-[10px]",children:t.detail})]})]},`${t.kind}-${t.title}`))})}function ZE(e){switch(e){case"draft":return"Draft";case"promoted":return"Promoted";case"failed":return"Failed"}}function GE(e,t){if(t)return"Promoting";switch(e.status){case"draft":return"Promote";case"failed":return"Retry";case"promoted":return"Promoted"}}function KE(e){return e.redaction.redacted?`Redacted ${e.redaction.patterns.join(", ")}`:"No sensitive pattern matched"}function JE(e,t){const n=e.replace(/\s+/g," ").trim();return n.length<=t?n:`${n.slice(0,t-3)}...`}function YE(e,t){const n=e[0],s=e[e.length-1];if(n===void 0)return"No evidence logs";const o=bs(n,t);return s===void 0||n===s?`#${o}`:`#${o}-#${bs(s,t)}`}function Vu(e){return e.join(", ")}function XE(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function QE({candidate:e,isPromoting:t,isUpdating:n,onPromoteCandidate:s,onUpdateCandidate:o,displayNumberByLogId:i}){const[a,l]=p.useState(!1),[c,u]=p.useState(e.type),[d,f]=p.useState(e.title),[h,m]=p.useState(e.content),[v,g]=p.useState(Vu(e.tags)),[x,b]=p.useState(null),y=e.status!=="promoted",k=e.status!=="promoted",j=p.useCallback(()=>{u(e.type),f(e.title),m(e.content),g(Vu(e.tags)),b(null)},[e.content,e.tags,e.title,e.type]),C=p.useCallback(async()=>{const T=d.trim(),N=h.trim(),O=XE(v);if(T.length===0){b("Title is required.");return}if(N.length===0){b("Content is required.");return}if(O.length===0){b("At least one tag is required.");return}b(null),await o(e.id,{type:c,title:T,content:N,tags:O})&&l(!1)},[e.id,h,v,d,c,o]);return a?r.jsx("div",{className:"border border-border bg-card shadow-sm rounded-[8px] px-2.5 py-2",children:r.jsxs("div",{className:"grid gap-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("select",{value:c,disabled:n,onChange:T=>{const N=xr.shape.type.safeParse(T.currentTarget.value);N.success&&u(N.data)},className:"border border-input bg-background hover:bg-accent hover:text-accent-foreground h-7 rounded-md px-2 text-xs","aria-label":"Candidate type",children:[r.jsx("option",{value:"episode",children:"episode"}),r.jsx("option",{value:"procedure",children:"procedure"}),r.jsx("option",{value:"preference",children:"preference"}),r.jsx("option",{value:"project-fact",children:"project-fact"})]}),r.jsx("input",{value:d,disabled:n,onChange:T=>f(T.currentTarget.value),className:"border border-input bg-background hover:bg-accent hover:text-accent-foreground h-7 min-w-[220px] flex-1 rounded-md px-2 text-xs","aria-label":"Candidate title"})]}),r.jsx("textarea",{value:h,disabled:n,onChange:T=>m(T.currentTarget.value),className:"border border-input bg-background hover:bg-accent hover:text-accent-foreground min-h-28 rounded-md px-2 py-1.5 font-mono text-[11px] leading-relaxed","aria-label":"Candidate content"}),r.jsx("input",{value:v,disabled:n,onChange:T=>g(T.currentTarget.value),className:"border border-input bg-background hover:bg-accent hover:text-accent-foreground h-7 rounded-md px-2 text-xs","aria-label":"Candidate tags"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground",children:[r.jsx(Wc,{className:"size-3"}),"Saving reruns Inspector redaction before promotion."]}),r.jsx("span",{className:"flex-1"}),x!==null&&r.jsx("span",{className:"text-[10px] text-destructive",children:x}),r.jsxs(ke,{type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:n,onClick:()=>{j(),l(!1)},children:[r.jsx(fr,{className:"size-3.5"}),"Cancel"]}),r.jsxs(ke,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:n,onClick:()=>{C()},children:[n?r.jsx(yn,{className:"size-3.5 animate-spin"}):r.jsx(e_,{className:"size-3.5"}),"Save"]})]})]})}):r.jsxs("div",{className:"rounded-md border border-border/80 bg-background/60 px-2.5 py-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(Me,{variant:"outline",className:"h-5 px-1.5 text-[10px] font-mono",children:e.type}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",title:e.title,children:e.title}),r.jsx(Me,{variant:"outline",className:ie("h-5 shrink-0 px-1.5 text-[10px] font-mono",LE[e.status]),children:ZE(e.status)})]}),r.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",title:e.content,children:JE(e.content,360)}),r.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-[10px] text-muted-foreground",children:[r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx(iw,{className:"size-3"}),YE(e.logIds,i)]}),r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx(Wc,{className:"size-3"}),KE(e)]}),e.status==="promoted"&&r.jsxs("span",{className:"inline-flex items-center gap-1 text-emerald-500",children:[r.jsx(ua,{className:"size-3"}),e.openClawMemoryId??"OpenClaw"]}),e.status==="failed"&&e.error!==null&&r.jsxs("span",{className:"inline-flex items-center gap-1 text-destructive",children:[r.jsx(qf,{className:"size-3"}),e.error]})]}),r.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[e.logIds.map(T=>{const N=bs(T,i);return r.jsxs("a",{href:`#${g0(T)}`,onClick:O=>{O.preventDefault(),x0(T)},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 ${N}`,title:`Log ID ${String(T)}`,children:["#",N]},T)}),r.jsx("span",{className:"flex-1"}),k&&r.jsxs(ke,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1.5 px-2 text-[10px]",disabled:n||t,onClick:()=>l(!0),children:[r.jsx(Yf,{className:"size-3"}),"Review"]}),r.jsxs(ke,{type:"button",variant:y?"outline":"ghost",size:"sm",className:"h-6 gap-1.5 px-2 text-[10px]",onClick:()=>s(e.id),disabled:!y||t||n,children:[t?r.jsx(yn,{className:"size-3 animate-spin"}):y?r.jsx(By,{className:"size-3"}):r.jsx(ua,{className:"size-3"}),GE(e,t)]})]})]})}function eA({candidates:e,promotingCandidateIds:t,updatingCandidateIds:n,onPromoteCandidate:s,onUpdateCandidate:o,displayNumberByLogId:i}){return e.length===0?null:r.jsx("div",{className:"mt-2 grid gap-1.5",children:e.map(a=>r.jsx(QE,{candidate:a,isPromoting:t.has(a.id),isUpdating:n.has(a.id),onPromoteCandidate:s,onUpdateCandidate:o,displayNumberByLogId:i},a.id))})}function tA({logs:e,scopeId:t,slowResponseThresholdSeconds:n,showRollupMetrics:s,timeDisplayFormat:o}){const[i,a]=p.useState([]),[l,c]=p.useState(!0),[u,d]=p.useState({status:"idle",error:null}),[f,h]=p.useState(()=>new Set),[m,v]=p.useState(()=>new Set),g=i.length>0,x=p.useMemo(()=>bE(e,n,i.length),[i.length,e,n]),b=p.useMemo(()=>WE(e),[e]),y=p.useMemo(()=>HE({logs:e,scopeId:t,summary:x,candidates:i,displayNumberByLogId:b}),[i,b,e,t,x]),k=s||x.maxElapsedMs!==null,j=p.useMemo(()=>DE(x.startedAt,x.endedAt,o),[x.endedAt,x.startedAt,o]),C=p.useCallback(()=>{e.length===0||u.status==="loading"||(d({status:"loading",error:null}),(async()=>{try{const O=await Ke(`/api/knowledge/sessions/${encodeURIComponent(t)}/candidates`,AE,OE,{method:"POST"},A=>`Candidate generation failed with ${String(A.status)}`);a(O.candidates),c(O.candidates.length>0),d(O.candidates.length>0?{status:"ready",error:null}:{status:"failed",error:"No candidate was generated for this trace scope."})}catch(O){d({status:"failed",error:O instanceof Error?O.message:"Candidate response was invalid"})}})())},[u.status,e.length,t]),T=p.useCallback(O=>{h(A=>{if(A.has(O))return A;const z=new Set(A);return z.add(O),z}),(async()=>{try{const A=await Dn(`/api/knowledge/candidates/${encodeURIComponent(O)}/promote`,PE,{method:"POST"}),z=await A.json().catch(()=>null),D=RE.safeParse(z);if(A.ok&&D.success){a(L=>L.map(w=>w.id===D.data.candidate.id?D.data.candidate:w)),d({status:"ready",error:null});return}const E=IE.safeParse(z);E.success&&E.data.candidate!==void 0&&a(L=>L.map(w=>w.id===E.data.candidate?.id?E.data.candidate:w)),d({status:"failed",error:E.success?E.data.error??"Candidate promotion failed":`Candidate promotion failed with ${String(A.status)}`})}catch(A){d({status:"failed",error:A instanceof Error?A.message:"Candidate promotion failed"})}finally{h(A=>{const z=new Set(A);return z.delete(O),z})}})()},[]),N=p.useCallback(async(O,A)=>{v(z=>{if(z.has(O))return z;const D=new Set(z);return D.add(O),D});try{const z=await Ke(`/api/knowledge/candidates/${encodeURIComponent(O)}`,zE,ME,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)},D=>`Candidate update failed with ${String(D.status)}`);return a(D=>D.map(E=>E.id===z.candidate.id?z.candidate:E)),d({status:"ready",error:null}),!0}catch(z){return d({status:"failed",error:z instanceof Error?z.message:"Candidate update failed"}),!1}finally{v(z=>{const D=new Set(z);return D.delete(O),D})}},[]);return e.length===0?null:r.jsxs("section",{className:"border border-border bg-card shadow-sm mb-2 rounded-[8px] px-3 py-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 text-xs",children:[s&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 font-semibold text-foreground",children:[r.jsx(Zo,{className:"size-3.5 text-blue-400"}),x.llmCallCount," LLM"]}),r.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[r.jsx(As,{className:"size-3.5 text-sky-400/70"}),x.toolCallCount," tools"]}),s&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[r.jsx(tr,{className:"size-3.5 text-emerald-400"}),r.jsxs("span",{className:"font-mono",children:[Fe(x.totalInputTokens)," / ",Fe(x.totalOutputTokens)]})]}),(x.totalCacheCreationInputTokens>0||x.totalCacheReadInputTokens>0)&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[r.jsx(tr,{className:"size-3.5 text-purple-400"}),r.jsxs("span",{className:"font-mono",children:["KV Cache +",Fe(x.totalCacheCreationInputTokens)," / ~",Fe(x.totalCacheReadInputTokens)]})]}),k&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[r.jsx(sn,{className:"size-3.5"}),s&&r.jsx("span",{className:"font-mono",children:Ba(x.totalElapsedMs)}),x.maxElapsedMs!==null&&r.jsxs("span",{className:"font-mono text-muted-foreground/70",children:["max ",Ba(x.maxElapsedMs)]})]}),s&&j!==null&&r.jsx("span",{className:"font-mono text-muted-foreground/70",children:j}),(x.failedCallCount>0||x.pendingCallCount>0||x.slowCallCount>0)&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 text-amber-400",children:[r.jsx(rn,{className:"size-3.5"}),r.jsxs("span",{className:"font-mono",children:[x.failedCallCount," fail / ",x.pendingCallCount," pending /"," ",x.slowCallCount," slow"]})]}),r.jsx("span",{className:"flex-1"}),g&&r.jsx(Me,{variant:"outline",className:"h-6 px-2 text-[10px] font-mono",children:$E(x.knowledgeCandidateCount)}),r.jsxs(ke,{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"?r.jsx(Qe,{className:"size-3.5 animate-spin"}):r.jsx(Vf,{className:"size-3.5"}),"Candidate"]}),g&&r.jsx(ke,{type:"button",variant:"ghost",size:"icon",className:"size-7 text-muted-foreground",onClick:()=>c(O=>!O),"aria-expanded":l,"aria-label":l?"Collapse memory candidates":"Expand memory candidates",children:l?r.jsx(ot,{className:"size-3.5"}):r.jsx(Tt,{className:"size-3.5"})})]}),u.status==="failed"&&r.jsx("p",{className:"mt-2 text-xs text-destructive",children:u.error}),r.jsx(qE,{insights:y}),l&&r.jsx(eA,{candidates:i,promotingCandidateIds:f,updatingCandidateIds:m,onPromoteCandidate:T,onUpdateCandidate:N,displayNumberByLogId:b})]})}function nA(e){let t=0,n=0;for(const s of e)s.inputTokens!==null&&(t+=s.inputTokens),s.outputTokens!==null&&(n+=s.outputTokens);return{totalInputTokens:t,totalOutputTokens:n}}function sA(e){const t=new Map;for(const n of e){if(n.model===null)continue;const s=Kj(n.model);if(s==="unknown")continue;let o=t.get(s);o===void 0&&(o=new Set,t.set(s,o)),o.add(n.model)}return[...t.entries()].map(([n,s])=>({provider:n,models:[...s]}))}function rA(e){for(const t of e){const n=t.clientPid;if(n!=null)return n}return null}function oA(e){for(const t of e){const n=t.clientProjectFolder;if(n!=null&&n!=="")return n}return null}const iA=p.memo(function({group:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:s,cacheTrends:o,onCompareWithPrevious:i,comparisonPredecessors:a,onClearGroup:l,showClientIdentity:c=!0,showProcessMetadata:u=!0,showLogClientMetadata:d=!0,defaultExpanded:f=!1,timeDisplayFormat:h,expanded:m,onExpandedChange:v}){const[g,x]=p.useState(f),b=m??g,y=p.useCallback(D=>{if(v!==void 0){v(D);return}x(D)},[v]);p.useEffect(()=>{!f||m!==void 0||x(!0)},[m,f]);const k=p.useMemo(()=>nA(e.logs),[e.logs]),j=p.useMemo(()=>sA(e.logs),[e.logs]),C=e.logs[0]?.timestamp??new Date().toISOString(),T=e.logs[e.logs.length-1]?.timestamp??new Date().toISOString(),N=e.logs.some(D=>D.responseStatus===null),O=p.useMemo(()=>rA(e.logs),[e.logs]),A=p.useMemo(()=>oA(e.logs),[e.logs]),z=p.useMemo(()=>Fa(e.logs),[e.logs]);return p.useEffect(()=>{const D=E=>{const L=bi(E);L!==null&&e.logs.some(w=>w.id===L.logId)&&y(!0)};return window.addEventListener(ln,D),()=>{window.removeEventListener(ln,D)}},[e.logs,y]),r.jsxs("div",{className:"mb-2",children:[r.jsx(b4,{conversationId:e.conversationId,startTime:C,endTime:T,totalCalls:e.logs.length,totalInputTokens:k.totalInputTokens,totalOutputTokens:k.totalOutputTokens,expanded:b,onToggle:()=>y(!b),providers:j,isLoading:N,userAgent:e.logs[0]?.userAgent??null,clientPid:O,clientProjectFolder:A,showClientIdentity:c,showProcessMetadata:u,timeDisplayFormat:h,onClear:()=>l(e.logs.map(D=>D.id))}),b&&r.jsxs("div",{children:[r.jsx(tA,{logs:e.logs,scopeId:e.conversationId,slowResponseThresholdSeconds:s,showRollupMetrics:!1,timeDisplayFormat:h}),r.jsx(SE,{turnGroups:z,viewMode:t,strip:n,slowResponseThresholdSeconds:s,timeDisplayFormat:h,cacheTrends:o,onCompareWithPrevious:i,comparisonPredecessors:a,showLogClientMetadata:d})]})]})});function Ua({className:e}){return r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:ie("inline-block size-5",e),children:[r.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"}),r.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),r.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),r.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),r.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"}),r.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),r.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),r.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),r.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),r.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]})}const aA="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 lA({className:e}){return r.jsx("img",{src:aA,alt:"Model Context Protocol","aria-hidden":"true",className:ie("inline-block size-8 object-contain invert",e)})}function Ao({...e}){return r.jsx(NN,{"data-slot":"select",...e})}function Ro({...e}){return r.jsx(EN,{"data-slot":"select-value",...e})}function Io({className:e,size:t="default",children:n,...s}){return r.jsxs(TN,{"data-slot":"select-trigger","data-size":t,className:ie("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),...s,children:[n,r.jsx(AN,{asChild:!0,children:r.jsx(ot,{className:"size-4 opacity-50"})})]})}function zo({className:e,children:t,position:n="popper",align:s="center",...o}){return r.jsx(RN,{children:r.jsxs(IN,{"data-slot":"select-content",className:ie("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:s,...o,children:[r.jsx(cA,{}),r.jsx(zN,{className:ie("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),r.jsx(uA,{})]})})}function Lt({className:e,children:t,...n}){return r.jsxs(ON,{"data-slot":"select-item",className:ie("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:[r.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:r.jsx(MN,{children:r.jsx(Ge,{className:"size-4"})})}),r.jsx(PN,{children:t})]})}function cA({className:e,...t}){return r.jsx(LN,{"data-slot":"select-scroll-up-button",className:ie("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(_l,{className:"size-4"})})}function uA({className:e,...t}){return r.jsx(DN,{"data-slot":"select-scroll-down-button",className:ie("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(ot,{className:"size-4"})})}const dA=Re(["critical","warning","notice"]),fA=Re(["open"]),pA=Re(["proxy","tool-schema","run","group"]),b0=Re(["request-failure","request-timeout","slow-response","tool-schema","run-failure","group-failure","group-incomplete"]),hA=Re(["log","session","run","group"]),mA=Re(["anthropic","openai","unknown"]),gA=J({kind:hA,id:S(),label:S(),href:S().nullable()}),xA=J({id:S(),fingerprint:S(),severity:dA,category:b0,source:pA,status:fA,title:S(),message:S(),count:K().int().positive(),firstSeenAt:S(),lastSeenAt:S(),logIds:fe(K().int().positive()),sessionIds:fe(S()),runIds:fe(S()),groupIds:fe(S()),provider:S().nullable(),model:S().nullable(),apiFormat:mA.nullable(),evidence:fe(gA),metadata:Ye(S(),nt)}),bA=J({category:b0,count:K().int().nonnegative()}),v0=J({total:K().int().nonnegative(),open:K().int().nonnegative(),critical:K().int().nonnegative(),warning:K().int().nonnegative(),notice:K().int().nonnegative(),byCategory:fe(bA)}),vA=J({alerts:fe(xA),total:K().int().nonnegative(),limit:K().int().positive(),summary:v0}),yA=8e3,wA=1e4;function _A(e){const t=new URLSearchParams;e.severity!==void 0&&t.set("severity",e.severity),e.category!==void 0&&t.set("category",e.category),e.source!==void 0&&t.set("source",e.source),e.limit!==void 0&&t.set("limit",String(e.limit));const n=t.toString();return n.length>0?`/api/alerts?${n}`:"/api/alerts"}function kA(e,t){const n=qt(t?_A(e):null,s=>Ke(s,vA,wA));return{alerts:n.data?.alerts??[],total:n.data?.total??0,summary:n.data?.summary??null,isLoading:n.isLoading,error:n.error,mutate:n.mutate}}function jA(){const e=qt("/api/alerts/summary",t=>Ke(t,v0,yA),{refreshInterval:5e3,revalidateOnFocus:!0});return{summary:e.data??null,isLoading:e.isLoading,error:e.error,mutate:e.mutate}}const vi="relative size-8 rounded-md border-0 bg-white/[0.035] text-muted-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:bg-white/[0.065] hover:text-accent-foreground focus-visible:ring-ring/50",SA=["request-failure","request-timeout","slow-response","tool-schema","run-failure","group-failure","group-incomplete"];function y0(e){switch(e){case"critical":return"Critical";case"warning":return"Warning";case"notice":return"Notice"}}function CA(e){switch(e){case"proxy":return"Proxy";case"tool-schema":return"Tool schema";case"run":return"Run";case"group":return"Group"}}function dc(e){switch(e){case"request-failure":return"Request failure";case"request-timeout":return"Timeout";case"slow-response":return"Slow response";case"tool-schema":return"Tool calling";case"run-failure":return"Run failure";case"group-failure":return"Group failure";case"group-incomplete":return"Group incomplete"}}function NA(e){switch(e){case"critical":return"border-red-400/40 bg-red-500/12 text-red-100";case"warning":return"border-amber-300/35 bg-amber-400/12 text-amber-100";case"notice":return"border-sky-300/35 bg-sky-400/12 text-sky-100"}}function TA(e){switch(e){case"critical":return"bg-red-400";case"warning":return"bg-amber-300";case"notice":return"bg-sky-300"}}function EA(e){switch(e){case"critical":return"text-red-200";case"warning":return"text-amber-100";case"notice":return"text-sky-100"}}function AA(e){switch(e){case"request-failure":case"run-failure":case"group-failure":return r.jsx(c_,{className:"size-3.5"});case"request-timeout":case"slow-response":return r.jsx(Dy,{className:"size-3.5"});case"tool-schema":return r.jsx(rn,{className:"size-3.5"});case"group-incomplete":return r.jsx(dy,{className:"size-3.5"})}}function Wa(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 _t(e){return e.toLocaleString()}function w0(e){return e.provider!==null&&e.model!==null?`${e.provider} / ${e.model}`:e.provider!==null?e.provider:e.model!==null?e.model:"Unknown target"}function RA(e,t){const n={limit:100};return e!=="all"&&(n.severity=e),t!=="all"&&(n.category=t),n}function IA(e,t){if(t!==null){const n=e.find(s=>s.id===t);if(n!==void 0)return n}return e[0]??null}function $r({label:e,count:t,tone:n}){const s=n==="critical"?"border-red-400/30 bg-red-500/10 text-red-100":n==="warning"?"border-amber-300/30 bg-amber-400/10 text-amber-100":n==="notice"?"border-sky-300/30 bg-sky-400/10 text-sky-100":"border-border bg-muted/40 text-foreground";return r.jsxs("div",{className:ie("rounded-md border px-3 py-2",s),children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase opacity-75",children:e}),r.jsx("div",{className:"mt-1 text-lg font-semibold leading-none",children:_t(t)})]})}function Fr({value:e,active:t,label:n,count:s,onClick:o}){return r.jsxs(ke,{type:"button",variant:t?"secondary":"ghost",size:"sm","aria-pressed":t,onClick:()=>o(e),className:"h-7 px-2",children:[n,s!==null?r.jsx(Me,{variant:"outline",children:_t(s)}):null]})}function zA({category:e,active:t,count:n,onClick:s}){return r.jsxs(ke,{type:"button",variant:t?"secondary":"ghost",size:"sm","aria-pressed":t,onClick:()=>s(e),className:"h-7 px-2",children:[AA(e),dc(e),r.jsx(Me,{variant:"outline",children:_t(n)})]})}function OA({alerts:e,selectedAlertId:t,isLoading:n,error:s,onSelect:o}){return n?r.jsxs("div",{className:"flex min-h-56 items-center justify-center rounded-md border border-dashed border-border text-xs text-muted-foreground",children:[r.jsx(Qe,{className:"mr-2 size-3.5 animate-spin"}),"Loading alerts..."]}):s!==void 0?r.jsx("div",{className:"rounded-md border border-red-300/30 bg-red-500/10 px-3 py-2 text-xs text-red-100",children:s.message}):e.length===0?r.jsx("div",{className:"flex min-h-56 items-center justify-center rounded-md border border-dashed border-border px-4 text-center text-xs text-muted-foreground",children:"No alerts match the current filters."}):r.jsx("div",{className:"min-h-0 space-y-2 overflow-y-auto pr-1",children:e.map(i=>{const a=i.id===t;return r.jsxs("button",{type:"button",onClick:()=>o(i.id),className:ie("w-full rounded-md border px-3 py-3 text-left transition-colors",a?"border-primary/60 bg-primary/12":"border-border bg-background/70 hover:border-primary/30 hover:bg-muted/60"),children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:ie("size-2 rounded-full",TA(i.severity))}),r.jsx("span",{className:ie("text-xs font-semibold",EA(i.severity)),children:y0(i.severity)}),r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:dc(i.category)})]}),r.jsx("div",{className:"mt-1 text-sm font-semibold leading-snug",children:i.title}),r.jsx("div",{className:"mt-1 line-clamp-2 text-xs text-muted-foreground",children:i.message})]}),i.count>1?r.jsxs(Me,{variant:"outline",className:"shrink-0",children:["x",_t(i.count)]}):null]}),r.jsxs("div",{className:"mt-2 flex min-w-0 items-start justify-between gap-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"min-w-0 leading-snug",children:w0(i)}),r.jsx("span",{className:"shrink-0",children:Wa(i.lastSeenAt)})]})]},i.id)})})}function PA({alert:e,onNavigate:t}){return e.evidence.length===0?r.jsx("span",{className:"text-xs text-muted-foreground",children:"No linked evidence"}):r.jsx("div",{className:"flex flex-wrap gap-2",children:e.evidence.map(n=>n.href===null?r.jsx(Me,{variant:"outline",children:n.label},`${n.kind}:${n.id}`):r.jsx(Me,{variant:"outline",asChild:!0,children:r.jsx("a",{href:n.href,onClick:t,children:n.label})},`${n.kind}:${n.id}`))})}function MA({alert:e,onNavigate:t}){return e===null?r.jsx("div",{className:"flex min-h-56 items-center justify-center rounded-md border border-dashed border-border px-4 text-center text-xs text-muted-foreground",children:"Select an alert to inspect its evidence."}):r.jsxs("div",{className:"min-h-0 overflow-y-auto rounded-md border border-border bg-background/70",children:[r.jsx("div",{className:ie("border-b px-4 py-3",NA(e.severity)),children:r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(Me,{variant:"outline",children:y0(e.severity)}),r.jsx(Me,{variant:"outline",children:CA(e.source)}),r.jsx(Me,{variant:"outline",children:dc(e.category)})]}),r.jsx("h3",{className:"mt-3 text-base font-semibold",children:e.title}),r.jsx("p",{className:"mt-1 text-sm opacity-85",children:e.message})]}),e.count>1?r.jsxs(Me,{variant:"outline",className:"shrink-0",children:[_t(e.count)," hits"]}):null]})}),r.jsxs("div",{className:"space-y-4 p-4",children:[r.jsxs("div",{className:"grid gap-2 text-xs sm:grid-cols-2",children:[r.jsx(dn,{label:"Target",value:w0(e)}),r.jsx(dn,{label:"Last seen",value:Wa(e.lastSeenAt)}),r.jsx(dn,{label:"First seen",value:Wa(e.firstSeenAt)}),r.jsx(dn,{label:"Protocol",value:e.apiFormat??"n/a"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"mb-2 text-xs font-semibold text-muted-foreground",children:"Evidence"}),r.jsx(PA,{alert:e,onNavigate:t})]}),r.jsxs("div",{className:"grid gap-2 text-xs sm:grid-cols-2",children:[r.jsx(dn,{label:"Logs",value:e.logIds.length===0?"n/a":_t(e.logIds.length)}),r.jsx(dn,{label:"Sessions",value:e.sessionIds.length===0?"n/a":_t(e.sessionIds.length)}),r.jsx(dn,{label:"Runs",value:e.runIds.length===0?"n/a":_t(e.runIds.length)}),r.jsx(dn,{label:"Groups",value:e.groupIds.length===0?"n/a":_t(e.groupIds.length)})]})]})]})}function dn({label:e,value:t}){return r.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase text-muted-foreground",children:e}),r.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-foreground",children:t})]})}function qu(){const[e,t]=p.useState(!1),[n,s]=p.useState("all"),[o,i]=p.useState("all"),[a,l]=p.useState(null),{summary:c,isLoading:u}=jA(),d=p.useMemo(()=>RA(n,o),[o,n]),{alerts:f,total:h,isLoading:m,error:v,mutate:g}=kA(d,e),x=p.useMemo(()=>IA(f,a),[f,a]);p.useEffect(()=>{!e||a!==null&&f.some(N=>N.id===a)||l(f[0]?.id??null)},[f,e,a]);const b=c?.total??0,y=c?.critical??0,k=c?.warning??0,j=c?.notice??0,C=y>0?"bg-red-500":k>0?"bg-amber-400":"bg-sky-400";return r.jsxs(Gn,{open:e,onOpenChange:t,children:[r.jsx(Xo,{asChild:!0,children:r.jsxs(ke,{type:"button",variant:"ghost",size:"icon",className:vi,"aria-label":"Alerts",title:"Alerts",children:[r.jsx(fa,{className:"size-4"}),u?r.jsx(Qe,{className:"absolute -right-0.5 -top-0.5 size-3 animate-spin text-muted-foreground"}):b>0?r.jsx("span",{className:ie("absolute -right-1 -top-1 min-w-4 rounded-full px-1 text-[10px] font-semibold leading-4 text-white",C),children:_t(b)}):null,r.jsx("span",{className:"sr-only",children:"Alerts"})]})}),r.jsxs(Kn,{className:"flex max-h-[86vh] max-w-6xl flex-col overflow-hidden",children:[r.jsxs(Jn,{children:[r.jsxs(Yn,{className:"flex items-center gap-2 pr-8",children:[r.jsx(fa,{className:"size-5 text-red-300"}),r.jsx("span",{children:"Alerts"}),r.jsx(Me,{variant:"outline",children:_t(b)})]}),r.jsx(Yp,{className:"sr-only",children:"Local alert board for captured Inspector evidence."})]}),r.jsxs("div",{className:"grid gap-2 sm:grid-cols-4",children:[r.jsx($r,{label:"Open",count:c?.open??0,tone:"neutral"}),r.jsx($r,{label:"Critical",count:y,tone:"critical"}),r.jsx($r,{label:"Warning",count:k,tone:"warning"}),r.jsx($r,{label:"Notice",count:j,tone:"notice"})]}),r.jsxs("div",{className:"flex min-h-0 flex-wrap items-center justify-between gap-2 border-y border-border py-3",children:[r.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.jsx(Fr,{value:"all",active:n==="all",label:"All",count:c?.total??null,onClick:s}),r.jsx(Fr,{value:"critical",active:n==="critical",label:"Critical",count:y,onClick:s}),r.jsx(Fr,{value:"warning",active:n==="warning",label:"Warning",count:k,onClick:s}),r.jsx(Fr,{value:"notice",active:n==="notice",label:"Notice",count:j,onClick:s})]}),r.jsxs(ke,{type:"button",variant:"outline",size:"sm",className:"h-7 shrink-0 px-2",onClick:()=>{g()},children:[r.jsx(yn,{className:"size-3.5"}),"Refresh"]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.jsx(ke,{type:"button",variant:o==="all"?"secondary":"ghost",size:"sm","aria-pressed":o==="all",onClick:()=>i("all"),className:"h-7 px-2",children:"All categories"}),SA.map(T=>{const N=c?.byCategory.find(O=>O.category===T)?.count??0;return N===0?null:r.jsx(zA,{category:T,active:o===T,count:N,onClick:i},T)})]}),r.jsxs("div",{className:"grid min-h-0 flex-1 gap-4 md:grid-cols-[360px_minmax(0,1fr)]",children:[r.jsxs("div",{className:"flex min-h-0 flex-col",children:[r.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs text-muted-foreground",children:[r.jsxs("span",{children:[_t(h)," matched"]}),r.jsx("span",{children:f.length<h?`${_t(f.length)} shown`:"Latest"})]}),r.jsx(OA,{alerts:f,selectedAlertId:x?.id??null,isLoading:m,error:v,onSelect:l})]}),r.jsx(MA,{alert:x,onNavigate:()=>t(!1)})]})]})]})}const LA=12e3;function DA(e){return e===null||e.evidence===null?null:`/api/groups/${encodeURIComponent(e.id)}/evidence`}function $A(e){const t=qt(DA(e),n=>Ke(n,B2,LA));return{evidenceResponse:t.data??null,isLoading:t.isLoading,error:t.error,mutate:t.mutate}}const FA=8e3;function BA(){const e=qt("/api/groups",t=>Ke(t,Uf,FA));return{groups:e.data?.groups??[],isLoading:e.isLoading,error:e.error,mutate:e.mutate}}const UA=3e3;function WA(e,t){return{id:(e?.id??0)+1,message:t.message,tone:t.tone??"error"}}function _0(){const[e,t]=p.useState(null),n=p.useCallback(o=>{t(i=>WA(i,o))},[]),s=p.useCallback(()=>{t(null)},[]);return p.useEffect(()=>{if(e===null)return;const o=window.setTimeout(()=>{t(null)},UA);return()=>{window.clearTimeout(o)}},[e]),{notice:e,showToast:n,dismissToast:s}}function k0({notice:e,onDismiss:t}){if(e===null)return null;const n=e.tone==="error",s=n?rn:ua;return r.jsx("div",{"aria-atomic":"true","aria-live":"polite",className:"pointer-events-none fixed top-4 right-4 z-[100] w-[min(calc(100vw-2rem),26rem)]",role:"status",children:r.jsxs("div",{className:ie("pointer-events-auto flex items-start gap-2 rounded-md border px-3 py-2 text-sm shadow-[0_18px_50px_rgba(0,0,0,0.45)] backdrop-blur",n?"border-red-400/30 bg-[#16090b]/95 text-red-100":"border-cyan-300/25 bg-[#071318]/95 text-cyan-100"),children:[r.jsx(s,{className:ie("mt-0.5 size-4 shrink-0",n?"text-red-300":"text-cyan-200")}),r.jsx("div",{className:"min-w-0 flex-1 break-words leading-5",children:e.message}),r.jsx("button",{type:"button",className:"inline-flex size-6 shrink-0 items-center justify-center rounded-md text-current/70 transition-colors hover:bg-white/10 hover:text-current","aria-label":"Dismiss notification",onClick:t,children:r.jsx(fr,{className:"size-3.5"})})]},e.id)})}const Zi=2e4;function HA(e,t){const n=`/api/groups/${encodeURIComponent(e)}`;return t?`${n}?deleteEvidence=1`:n}function VA(e){return"/api/groups"}function j0(e){let t=0,n=0,s=0,o=0;for(const i of e.members)switch(i.status){case"completed":t+=1;break;case"failed":case"cancelled":n+=1;break;case"running":s+=1;break;case"created":break;case null:o+=1;break}return{memberCount:e.members.length,completedMembers:t,failedMembers:n,runningMembers:s,missingStatusMembers:o}}function qA(e,t,n=null){return t!==null&&t.group.id===e.id?t.members.map(s=>({member:s.member,exportMember:s,source:"export"})):n!==null&&n.group.id===e.id&&n.members!==null?n.members.map(s=>({member:s.member,exportMember:s,source:"evidence"})):e.members.map(s=>({member:s,exportMember:null,source:"group"}))}function fc(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 pc(e){return e??"unknown"}function ZA(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 yi(e){return e===null||e.trim().length===0?"-":e}function wt(e){return e.toLocaleString()}function Ha(e){return e==null?"-":e<1e3?`${wt(e)} ms`:`${(e/1e3).toFixed(1)} s`}function Ns(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 Zu(e){return e===null?"-":Ns(e)}function GA(e){const t=JSON.stringify(e),n=t===void 0?String(e):t;return n.length<=160?n:`${n.slice(0,157)}...`}function S0(...e){for(const t of e)if(t!==null&&t.trim().length>0)return t;return"-"}function KA(...e){for(const t of e)if(t!=null&&t.trim().length>0)return t;return null}function JA(e){const t=e.provider,n=e.model;return t!==null&&t.length>0&&n!==null&&n.length>0?`${t} / ${n}`:S0(t,n)}function YA(e,t){if(t!==null){const n=e.find(s=>s.id===t);if(n!==void 0)return n}return e[0]??null}function XA(e){return(e.exportMember?.session?.latestLogs??[])[0]??null}function QA(e){switch(e){case"export":return"fresh export";case"evidence":return"evidence";case"group":return"group"}}function e6(e,t){return t!==null&&t.group.id===e.id?t.evidence:e.evidence}function t6(e,t,n){return t!==null&&t.group.id===e.id?t.summary:n!==null&&n.group.id===e.id?n.summary:null}function n6(e,t,n){return t!==null&&t.group.id===e.id?t.jenkinsReport:n!==null&&n.group.id===e.id?n.report:null}function Gu(){const[e,t]=p.useState(!1),[n,s]=p.useState(null),[o,i]=p.useState(null),[a,l]=p.useState(null),[c,u]=p.useState(null),[d,f]=p.useState(null),[h,m]=p.useState(!1),[v,g]=p.useState(null),[x,b]=p.useState(null),[y,k]=p.useState(!1),{notice:j,showToast:C,dismissToast:T}=_0(),{groups:N,isLoading:O,error:A,mutate:z}=BA(),D=p.useMemo(()=>YA(N,n),[N,n]);p.useEffect(()=>{!e||n!==null&&N.some(X=>X.id===n)||s(N[0]?.id??null)},[N,e,n]);const E=D!==null&&c!==null&&c.group.id===D.id?c:null,{evidenceResponse:L,isLoading:w,error:$,mutate:ee}=$A(D),F=p.useCallback(()=>{z()},[z]),W=p.useCallback(async()=>{if(!(N.length===0||y)){k(!0),f(null),m(!1),b(null),l(null);try{const U=await Ke(VA(!1),$f,Zi,{method:"DELETE"},X=>`Clear failed with status ${String(X.status)}`);u(null),s(null),await z(),await ee(),C({message:`Cleared ${wt(U.deleted)} group${U.deleted===1?"":"s"}.`,tone:"success"})}catch(U){C({message:U instanceof Error?U.message:"Unknown error clearing groups",tone:"error"})}finally{k(!1)}}},[y,N.length,z,ee,C]),Z=p.useCallback(async U=>{i(U.id),l(null);try{const X=await Ke(`/api/groups/${encodeURIComponent(U.id)}/evidence`,U2,Zi,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({latestLogLimit:10})},Ce=>`Export failed with status ${String(Ce.status)}`);u(X),await z(),await ee()}catch(X){l(X instanceof Error?X.message:String(X))}finally{i(null)}},[z,ee]),ue=p.useCallback(U=>{f(U),m(!1),b(null)},[]),V=p.useCallback(()=>{v===null&&(f(null),m(!1),b(null))},[v]),H=p.useCallback(U=>{s(U),f(null),m(!1),b(null)},[]),le=p.useCallback(async()=>{const U=d;if(U!==null){g(U.id),b(null);try{await Ke(HA(U.id,h),Df,Zi,{method:"DELETE"},X=>`Delete failed with status ${String(X.status)}`),u(X=>X!==null&&X.group.id===U.id?null:X),s(X=>X===U.id?null:X),f(null),m(!1),await z(),await ee()}catch(X){b(X instanceof Error?X.message:String(X))}finally{g(null)}}},[h,d,z,ee]);return r.jsxs(Gn,{open:e,onOpenChange:t,children:[r.jsx(k0,{notice:j,onDismiss:T}),r.jsx(Xo,{asChild:!0,children:r.jsxs(ke,{type:"button",variant:"ghost",size:"icon",className:vi,"aria-label":"Evaluation groups",title:"Evaluation groups",children:[r.jsx(Bc,{className:"size-4"}),O?r.jsx(Qe,{className:"absolute -right-0.5 -top-0.5 size-3 animate-spin text-muted-foreground"}):N.length>0?r.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:N.length}):null,r.jsx("span",{className:"sr-only",children:"Evaluation groups"})]})}),r.jsxs(Kn,{className:"flex max-h-[85vh] max-w-5xl flex-col overflow-hidden",children:[r.jsx(Jn,{children:r.jsxs(Yn,{className:"flex items-center gap-2 pr-8",children:[r.jsx(Bc,{className:"size-5 text-muted-foreground"}),r.jsx("span",{children:"Groups"}),r.jsx(Me,{variant:"outline",children:wt(N.length)})]})}),r.jsxs("div",{className:"flex min-h-0 items-center justify-between gap-3 border-b border-border pb-3",children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:"Evaluation batches, model runs, and exported evidence packs."}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsxs(ke,{type:"button",variant:"outline",size:"sm",disabled:N.length===0||y,onClick:()=>{W()},title:"Clear all groups. Session logs and run records stay intact.",children:[y?r.jsx(Qe,{className:"size-3.5 animate-spin"}):r.jsx(wn,{className:"size-3.5"}),"Clear"]}),r.jsxs(ke,{type:"button",variant:"outline",size:"sm",onClick:F,children:[r.jsx(yn,{className:"size-3.5"}),"Refresh"]})]})]}),r.jsxs("div",{className:"grid min-h-0 flex-1 gap-4 md:grid-cols-[260px_minmax(0,1fr)]",children:[r.jsx(s6,{groups:N,selectedGroupId:D?.id??null,isLoading:O,error:A,onSelect:H}),r.jsx(r6,{group:D,deleteTarget:d,deleteEvidence:h,exportResult:E,evidenceResponse:L,evidenceLoading:w,evidenceError:$,exportError:a,deleteError:x,exportingGroupId:o,deletingGroupId:v,onDeleteEvidenceChange:m,onExport:Z,onRequestDelete:ue,onCancelDelete:V,onConfirmDelete:()=>{le()}})]})]})]})}function s6({groups:e,selectedGroupId:t,isLoading:n,error:s,onSelect:o}){return n?r.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..."}):s!==void 0?r.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:s.message}):e.length===0?r.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."}):r.jsx("div",{className:"min-h-0 overflow-y-auto pr-1",children:r.jsx("div",{className:"space-y-2",children:e.map(i=>{const a=j0(i),l=t===i.id;return r.jsxs("button",{type:"button",onClick:()=>o(i.id),className:ie("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:[r.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[r.jsx("span",{className:"min-w-0 text-sm font-medium leading-snug",children:i.title}),r.jsx(Me,{variant:"outline",className:fc(i.status),children:pc(i.status)})]}),r.jsxs("div",{className:"mt-1 flex items-center gap-2 text-muted-foreground",children:[r.jsxs("span",{children:[a.memberCount," sessions"]}),r.jsx("span",{children:Ns(i.updatedAt)})]})]},i.id)})})})}function r6({group:e,deleteTarget:t,deleteEvidence:n,exportResult:s,evidenceResponse:o,evidenceLoading:i,evidenceError:a,exportError:l,deleteError:c,exportingGroupId:u,deletingGroupId:d,onDeleteEvidenceChange:f,onExport:h,onRequestDelete:m,onCancelDelete:v,onConfirmDelete:g}){if(e===null)return r.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=j0(e),b=t6(e,s,o),y=n6(e,s,o),k=e6(e,s),j=qA(e,s,o),C=u===e.id,T=d===e.id,N=t?.id===e.id;return r.jsx("div",{className:"min-h-0 overflow-y-auto pr-1",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[r.jsxs("div",{className:"min-w-0 space-y-1",children:[r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[r.jsx("h3",{className:"min-w-0 text-base font-semibold leading-snug",children:e.title}),r.jsx(Me,{variant:"outline",className:fc(e.status),children:pc(e.status)}),r.jsx(Me,{variant:"outline",children:e.kind})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:yi(e.project)}),r.jsxs("span",{children:["updated ",Ns(e.updatedAt)]})]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx(ke,{type:"button",variant:"outline",size:"icon",className:"size-8 text-red-600 hover:text-red-700","aria-label":"Delete group",title:"Delete group",disabled:T,onClick:()=>m(e),children:T?r.jsx(Qe,{className:"size-3.5 animate-spin"}):r.jsx(wn,{className:"size-3.5"})}),r.jsxs(ke,{type:"button",variant:"default",size:"sm",className:"shrink-0",disabled:C||T,onClick:()=>{h(e)},children:[C?r.jsx(Qe,{className:"size-3.5 animate-spin"}):r.jsx(dr,{className:"size-3.5"}),"Export evidence"]})]})]}),e.task!==null&&e.task.trim().length>0&&r.jsx("p",{className:"rounded-md border border-border bg-muted/20 px-3 py-2 text-xs text-muted-foreground",children:e.task}),N&&r.jsx(o6,{group:e,deleteEvidence:n,isDeleting:T,error:c,onDeleteEvidenceChange:f,onCancel:v,onConfirm:g}),r.jsxs("div",{className:"grid gap-2 sm:grid-cols-4",children:[r.jsx(fn,{label:"Members",value:x.memberCount}),r.jsx(fn,{label:"Done",value:x.completedMembers}),r.jsx(fn,{label:"Failed",value:x.failedMembers}),r.jsx(fn,{label:"Running",value:x.runningMembers})]}),b!==null&&r.jsxs("div",{className:"grid gap-2 sm:grid-cols-4",children:[r.jsx(fn,{label:"Requests",value:b.requestCount}),r.jsx(fn,{label:"Errors",value:b.errorCount}),r.jsx(fn,{label:"Tokens",value:b.tokenUsage.total}),r.jsx(fn,{label:"Missing",value:b.missingSessions})]}),r.jsx(i6,{report:y,loading:i,error:a,hasEvidence:k!==null}),r.jsx(a6,{evidence:k}),l!==null&&r.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&&!N&&r.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:c}),r.jsx(l6,{rows:j})]})})}function o6({group:e,deleteEvidence:t,isDeleting:n,error:s,onDeleteEvidenceChange:o,onCancel:i,onConfirm:a}){const l=e.evidence!==null,c=e.evidence?.markdownPath??"No evidence pack exported.";return r.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-3 text-red-900",children:r.jsxs("div",{className:"flex min-w-0 flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[r.jsxs("div",{className:"min-w-0 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[r.jsx(wn,{className:"size-4 text-red-600"}),r.jsx("span",{children:"Delete group?"})]}),r.jsxs("p",{className:"text-xs text-red-800",children:["Delete ",r.jsx("span",{className:"font-medium",children:e.title}),". Session logs and run records stay intact."]}),r.jsxs("label",{className:ie("flex min-w-0 items-start gap-2 text-xs",l?"cursor-pointer":"opacity-60"),children:[r.jsx("input",{type:"checkbox",className:"mt-0.5 size-4 shrink-0",checked:t,disabled:!l||n,onChange:u=>o(u.currentTarget.checked)}),r.jsxs("span",{className:"min-w-0",children:[r.jsx("span",{className:"block font-medium",children:"Also delete exported evidence files"}),r.jsx("code",{className:"mt-1 block truncate font-mono text-[11px] text-red-700",children:c})]})]}),s!==null&&r.jsx("div",{className:"rounded-md border border-red-200 bg-white px-2 py-1.5 text-xs text-red-700",children:s})]}),r.jsxs("div",{className:"flex shrink-0 justify-end gap-2",children:[r.jsx(ke,{type:"button",variant:"outline",size:"sm",disabled:n,onClick:i,children:"Cancel"}),r.jsxs(ke,{type:"button",variant:"destructive",size:"sm",disabled:n,onClick:a,children:[n?r.jsx(Qe,{className:"size-3.5 animate-spin"}):r.jsx(wn,{className:"size-3.5"}),"Delete"]})]})]})})}function fn({label:e,value:t}){return r.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[r.jsx("div",{className:"text-[11px] font-medium uppercase text-muted-foreground",children:e}),r.jsx("div",{className:"mt-1 font-mono text-sm font-semibold",children:wt(t)})]})}function i6({report:e,loading:t,error:n,hasEvidence:s}){const{copied:o,copy:i}=gn(e?.markdown??null);return e===null&&!t&&n===void 0?null:t?r.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:[r.jsx(Qe,{className:"size-3.5 animate-spin"}),"Loading evidence report..."]}):n!==void 0&&s?r.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:r.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:"text-xs font-semibold",children:"Evidence report"}),r.jsx(Me,{variant:"outline",className:ZA(e.status),children:e.status})]}),r.jsx(ke,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":o?"Copied evidence report":"Copy evidence report",onClick:i,children:o?r.jsx(Ge,{className:"size-3.5 text-emerald-500"}):r.jsx(At,{className:"size-3.5"})})]}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:e.summary})]})}function a6({evidence:e}){return e===null?r.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."}):r.jsxs("div",{className:"space-y-2 rounded-md border border-border bg-muted/20 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-xs font-semibold",children:"Evidence paths"}),r.jsx("span",{className:"text-[11px] text-muted-foreground",children:Ns(e.exportedAt)})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Gi,{label:"JSON",value:e.jsonPath}),r.jsx(Gi,{label:"Markdown",value:e.markdownPath}),r.jsx(Gi,{label:"HTML",value:e.htmlPath})]})]})}function Gi({label:e,value:t}){const{copied:n,copy:s}=gn(t);return r.jsxs("div",{className:"flex min-w-0 items-center gap-2 rounded-md border border-border bg-background px-2 py-1.5",children:[r.jsx("span",{className:"w-16 shrink-0 text-[11px] font-medium text-muted-foreground",children:e}),r.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs",children:t}),r.jsx(ke,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":n?`Copied ${e} path`:`Copy ${e} path`,onClick:s,children:n?r.jsx(Ge,{className:"size-3.5 text-emerald-500"}):r.jsx(At,{className:"size-3.5"})})]})}function l6({rows:e}){const[t,n]=p.useState(null),s=p.useCallback(o=>{n(i=>i===o?null:o)},[]);return e.length===0?r.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."}):r.jsxs("div",{className:"overflow-hidden rounded-md border border-border",children:[r.jsx("div",{className:"border-b border-border bg-muted/30 px-3 py-2 text-xs font-semibold",children:"Members"}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[760px] text-left text-xs",children:[r.jsx("thead",{className:"border-b border-border bg-muted/20 text-muted-foreground",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-3 py-2 font-medium",children:"Session"}),r.jsx("th",{className:"px-3 py-2 font-medium",children:"Provider / Model"}),r.jsx("th",{className:"px-3 py-2 font-medium",children:"Status"}),r.jsx("th",{className:"px-3 py-2 font-medium",children:"Requests"}),r.jsx("th",{className:"px-3 py-2 font-medium",children:"Errors"}),r.jsx("th",{className:"px-3 py-2 font-medium",children:"First chunk"}),r.jsx("th",{className:"px-3 py-2 font-medium",children:"Tokens"})]})}),r.jsx("tbody",{children:e.map(o=>{const i=t===o.member.id;return r.jsxs(p.Fragment,{children:[r.jsx(c6,{row:o,isExpanded:i,onToggleDetails:s}),r.jsx(u6,{row:o,isExpanded:i})]},o.member.id)})})]})})]})}function c6({row:e,isExpanded:t,onToggleDetails:n}){const s=e.member,o=e.exportMember?.session??null,i=XA(e),a=o?.inspectorPath??Fd(s.sessionId),l=e.source!=="evidence",c=o?.requestCount??null,u=o?.errorCount??null,d=o?.tokenUsage.total??null,f=i?.firstChunkMs??null,h=S0(s.label,s.sessionId),m=KA(o?.clientUserAgent,i?.userAgent,s.agent),v=o?.clientProjectFolder??null,g=Ll({userAgent:m,conversationId:s.sessionId,clientProjectFolder:v}),x=Qo(g);return r.jsxs("tr",{className:"border-b border-border last:border-0 hover:bg-muted/20",children:[r.jsxs("td",{className:"max-w-56 px-3 py-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx(ke,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0 text-muted-foreground","aria-label":t?`Hide member ${h}`:`Show member ${h}`,title:t?"Hide member details":"Show member details",onClick:()=>{n(s.id)},children:t?r.jsx(ot,{className:"size-3.5"}):r.jsx(Tt,{className:"size-3.5"})}),x!==null&&r.jsx(ei,{client:g,className:"size-5"}),l?r.jsxs("a",{href:a,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 ${h}`,title:`Open session ${h}`,children:[r.jsx("span",{className:"min-w-0 truncate",children:h}),r.jsx(jl,{className:"size-3 shrink-0 text-muted-foreground"})]}):r.jsxs("button",{type:"button",className:"inline-flex max-w-full min-w-0 items-center gap-2 rounded-sm font-mono text-xs text-foreground outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",title:`Show evidence snapshot for ${h}`,"aria-label":`Show evidence snapshot for ${h}`,onClick:()=>{n(s.id)},children:[r.jsx("span",{className:"min-w-0 truncate",children:h}),r.jsx(Me,{variant:"outline",className:"shrink-0 border-zinc-200 bg-zinc-50 text-zinc-600",children:"evidence"})]})]}),r.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:yi(s.agent)})]}),r.jsx("td",{className:"max-w-52 px-3 py-2",children:r.jsx("span",{className:"block whitespace-normal leading-snug",children:JA(s)})}),r.jsx("td",{className:"px-3 py-2",children:r.jsx(Me,{variant:"outline",className:fc(s.status),children:pc(s.status)})}),r.jsx("td",{className:"px-3 py-2 font-mono",children:c===null?"-":wt(c)}),r.jsx("td",{className:"px-3 py-2 font-mono",children:u===null?"-":wt(u)}),r.jsx("td",{className:"px-3 py-2 font-mono",children:Ha(f)}),r.jsx("td",{className:"px-3 py-2 font-mono",children:d===null?"-":wt(d)})]})}function u6({row:e,isExpanded:t}){if(!t)return null;const n=e.member,s=e.exportMember,o=s?.session??null,i=s?.run??null,a=Object.entries(n.metadata);return r.jsx("tr",{className:"border-b border-border bg-muted/10",children:r.jsx("td",{colSpan:7,className:"px-3 pb-4 pt-2",children:r.jsxs("div",{className:"space-y-3 rounded-md border border-border bg-background p-3",children:[r.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-4",children:[r.jsx(st,{label:"Source",value:QA(e.source)}),r.jsx(st,{label:"Member ID",value:n.id,mono:!0}),r.jsx(st,{label:"Session ID",value:n.sessionId,mono:!0}),r.jsx(st,{label:"Run ID",value:i?.id??n.runId??"-",mono:!0}),r.jsx(st,{label:"Created",value:Ns(n.addedAt)}),r.jsx(st,{label:"Updated",value:Ns(n.updatedAt)}),r.jsx(st,{label:"Session created",value:Zu(o?.createdAt??null)}),r.jsx(st,{label:"Session updated",value:Zu(o?.updatedAt??null)})]}),o===null?r.jsx("div",{className:"rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground",children:"No session snapshot is available for this member."}):r.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-4",children:[r.jsx(st,{label:"Log coverage",value:o.logCoverage}),r.jsx(st,{label:"Runtime",value:yi(o.runtimeMode)}),r.jsx(st,{label:"Requests",value:wt(o.requestCount),mono:!0}),r.jsx(st,{label:"Errors",value:wt(o.errorCount),mono:!0}),r.jsx(st,{label:"Input tokens",value:wt(o.tokenUsage.input),mono:!0}),r.jsx(st,{label:"Output tokens",value:wt(o.tokenUsage.output),mono:!0}),r.jsx(st,{label:"Cache read",value:wt(o.tokenUsage.cacheRead),mono:!0}),r.jsx(st,{label:"Total tokens",value:wt(o.tokenUsage.total),mono:!0})]}),r.jsx(d6,{logs:o?.latestLogs??[]}),r.jsx(f6,{entries:a})]})})})}function st({label:e,value:t,mono:n=!1}){return r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:e}),r.jsx("div",{className:ie("truncate text-xs text-foreground",n?"font-mono":""),title:t,children:t})]})}function d6({logs:e}){const t=e.slice(0,5);return t.length===0?r.jsx("div",{className:"rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground",children:"No latest logs in this snapshot."}):r.jsxs("div",{className:"overflow-hidden rounded-md border border-border",children:[r.jsx("div",{className:"border-b border-border bg-muted/30 px-3 py-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Latest logs"}),r.jsx("div",{className:"divide-y divide-border",children:t.map(n=>{const s=n.sessionLogNumber??n.id;return r.jsxs("div",{className:"grid gap-2 px-3 py-2 text-xs sm:grid-cols-[72px_1fr_88px_88px]",children:[r.jsxs("span",{className:"font-mono text-muted-foreground",title:`Log ID ${String(n.id)}`,children:["#",s]}),r.jsxs("span",{className:"min-w-0 truncate",children:[yi(n.model)," · ",n.apiFormat," · ",n.path]}),r.jsx("span",{className:"font-mono text-muted-foreground",children:Ha(n.firstChunkMs)}),r.jsx("span",{className:"font-mono text-muted-foreground",children:Ha(n.latencyMs)})]},n.id)})})]})}function f6({entries:e}){return e.length===0?null:r.jsxs("div",{className:"overflow-hidden rounded-md border border-border",children:[r.jsx("div",{className:"border-b border-border bg-muted/30 px-3 py-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Metadata"}),r.jsx("div",{className:"grid gap-x-3 gap-y-2 p-3 text-xs sm:grid-cols-2",children:e.map(([t,n])=>{const s=GA(n);return r.jsxs("div",{className:"min-w-0",children:[r.jsx("span",{className:"mr-2 text-muted-foreground",children:t}),r.jsx("span",{className:"font-mono text-foreground",title:s,children:s})]},t)})})]})}const p6=J({name:S(),apiKey:S(),format:Re(["anthropic","openai"]),anthropicBaseUrl:S(),openaiBaseUrl:S(),openaiResponsesBaseUrl:S().optional().default(""),models:fe(S()),sourceTool:Re(["claude-code","opencode","mimo-code"]),alreadyExists:Le()}),h6=J({providers:fe(p6),warnings:fe(S()).optional()}),m6=J({success:Le().optional(),imported:K().optional(),message:S().optional(),errors:fe(S()).optional()}),Ku=2e4;function g6({open:e,onOpenChange:t,onImportComplete:n}){const[s,o]=p.useState(!1),[i,a]=p.useState(null),[l,c]=p.useState([]),[u,d]=p.useState([]),[f,h]=p.useState(new Set),[m,v]=p.useState(!1),[g,x]=p.useState(null),[b,y]=p.useState(null),k=p.useRef(0),j=p.useRef(0),C=p.useCallback(()=>{const A=k.current+1;k.current=A,o(!0),a(null),d([]),c([]),h(new Set),x(null),y(null),Ke("/api/providers/scan",h6,Ku,void 0,z=>`Scan failed (${String(z.status)})`).then(z=>{if(k.current!==A)return;c(z.providers),d(z.warnings??[]);const D=new Set;z.providers.forEach((E,L)=>{E.alreadyExists||D.add(L)}),h(D)}).catch(z=>{k.current===A&&a(z instanceof Error?z.message:String(z))}).finally(()=>{k.current===A&&o(!1)})},[]);p.useEffect(()=>{e&&C()},[e,C]),p.useEffect(()=>{e||(k.current+=1,j.current+=1,o(!1),v(!1))},[e]);const T=p.useCallback(A=>{h(z=>{const D=new Set(z);return D.has(A)?D.delete(A):D.add(A),D})},[]),N=p.useCallback(()=>{const A=l.filter((L,w)=>f.has(w));if(A.length===0)return;const z=j.current+1;j.current=z,v(!0),y(null),x(null);const D=new Date().toISOString(),E=A.map(L=>({id:window.crypto.randomUUID(),name:L.name,apiKey:L.apiKey,format:L.format,anthropicBaseUrl:L.anthropicBaseUrl,openaiBaseUrl:L.openaiBaseUrl,openaiResponsesBaseUrl:L.openaiResponsesBaseUrl,models:L.models,createdAt:D,updatedAt:D}));Ke("/api/providers/import",m6,Ku,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providers:E})},L=>`Import failed (${String(L.status)})`).then(L=>{j.current===z&&(c(w=>w.map(($,ee)=>f.has(ee)?{...$,alreadyExists:!0}:$)),h(new Set),L.errors!==void 0&&L.errors.length>0&&L.message!==void 0?x(L.message):x(`Imported ${L.imported??A.length} provider(s)`),n())}).catch(L=>{j.current===z&&y(L instanceof Error?L.message:String(L))}).finally(()=>{j.current===z&&v(!1)})},[l,f,n]),O=l.some(A=>!A.alreadyExists);return r.jsx(Gn,{open:e,onOpenChange:t,children:r.jsxs(Kn,{className:"max-w-xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(Jn,{children:[r.jsx(Yn,{children:"Import from External Tools"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Detect provider configurations from Claude Code, OpenCode, and MiMo Code."})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto space-y-3",children:[s&&r.jsxs("div",{className:"flex items-center justify-center py-8 gap-2 text-muted-foreground",children:[r.jsx(Qe,{className:"size-4 animate-spin"}),r.jsx("span",{className:"text-sm",children:"Scanning for external providers..."})]}),i!==null&&r.jsxs("div",{className:"flex items-center gap-2 text-destructive text-sm py-4",children:[r.jsx(_s,{className:"size-4"}),i]}),!s&&i===null&&l.length===0&&r.jsxs("p",{className:"text-sm text-muted-foreground py-8 text-center",children:["No external provider configurations found.",r.jsx("br",{}),r.jsx("span",{className:"text-xs",children:"Supported tools: Claude Code (~/.claude/settings.json), OpenCode (~/.config/opencode/opencode.json), MiMo Code (~/.config/mimocode/mimocode.jsonc)"})]}),!s&&l.map((A,z)=>r.jsxs("label",{className:`flex items-start gap-3 p-3 border rounded-md ${A.alreadyExists?"":"cursor-pointer hover:bg-muted/50"}`,children:[!A.alreadyExists&&r.jsx("input",{type:"checkbox",checked:f.has(z),disabled:m,onChange:()=>T(z),className:"mt-0.5 size-4"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ei,{client:A.sourceTool,className:"size-7 rounded-[8px]"}),A.alreadyExists&&r.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Already added"})]}),r.jsxs("div",{className:"mt-1 text-xs leading-snug text-muted-foreground",children:[A.models.slice(0,4).join(", "),A.models.length>4?` +${A.models.length-4} more`:""]}),r.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:A.format==="anthropic"?A.anthropicBaseUrl:A.openaiResponsesBaseUrl!==""?A.openaiResponsesBaseUrl:A.openaiBaseUrl}),r.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 font-mono",children:A.apiKey.length>8?`${A.apiKey.slice(0,4)}••••${A.apiKey.slice(-4)}`:"••••"})]})]},`${A.sourceTool}-${A.name}`)),u.length>0&&r.jsx("div",{className:"text-xs text-muted-foreground space-y-1 border-t pt-2",children:u.map((A,z)=>r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(_s,{className:"size-3"}),A]},z))}),g!==null&&r.jsx("div",{className:"text-sm text-green-500 border-t pt-2",children:g}),b!==null&&r.jsx("div",{className:"text-sm text-destructive border-t pt-2",children:b})]}),r.jsxs("div",{className:"flex items-center justify-between pt-3 border-t",children:[r.jsxs(ke,{variant:"outline",size:"sm",onClick:C,disabled:s,children:[r.jsx(Qe,{className:`size-3 mr-1 ${s?"animate-spin":""}`}),"Rescan"]}),r.jsxs(ke,{size:"sm",onClick:N,disabled:!O||f.size===0||m,children:[r.jsx(dr,{className:"size-3 mr-1"}),m?"Importing...":`Import Selected (${f.size})`]})]})]})})}function C0(e){return e.length<=8?"••••••••":e.slice(0,4)+"••••••••"+e.slice(-4)}const N0=J({id:S().min(1),aliases:fe(S()).optional().default([]),contextWindow:K().int().positive().optional(),outputLimit:K().int().positive().optional(),sourceUrl:S().optional()}),x6=J({name:S().min(1).optional(),aliases:fe(S()).optional().default([]),baseUrls:fe(S()).optional().default([]),models:fe(N0).min(1)});J({version:K().int().positive().optional(),updatedAt:S().optional(),providers:fe(x6).optional().default([]),models:fe(N0).optional().default([])});function Ju(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}function b6(e){const t=e.models.filter(n=>n.trim()!=="");return t.length>0?t:e.model!==void 0&&e.model.trim()!==""?[e.model]:[]}function hc(e,t){const n=Ju(t);return(e.modelMetadata??[]).find(o=>Ju(o.model)===n)??null}function v6(e){const t=b6(e);return t.length===0?!1:t.every(n=>{const s=hc(e,n);return s!==null&&s.contextWindow!==void 0})}function y6(e,t){if(e===null)return null;for(const n of t){const s=hc(n,e);if(s!==null&&s.contextWindow!==void 0)return{providerName:n.name,model:s.model,tokens:s.contextWindow,sourceUrl:s.sourceUrl}}return null}const w6={deepseek:"https://api-docs.deepseek.com/zh-cn/"};function T0(e){return Object.prototype.hasOwnProperty.call(e,"success")}function E0(e){return Object.prototype.hasOwnProperty.call(e,"notConfigured")}function vt(e){return e!==void 0&&e.trim()!==""}function Va(e){if(e===void 0)return;const t=Object.entries(e).map(([n,s])=>`${n}: ${s}`);if(t.length!==0)return t.join(`
|
|
104
|
-
`)}function Yu(e){return Va(e)!==void 0}function Xu(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function _6(e){return e>=10?`${e.toFixed(0)}/s`:`${e.toFixed(1)}/s`}function k6(e){const t=e.debug;return vt(e.error?.hint)||vt(e.error?.details)||vt(e.rawResponse)||vt(t?.requestUrl)||vt(t?.requestBody)||vt(t?.responseBody)||Yu(t?.requestHeaders)||Yu(t?.responseHeaders)||t?.responseStatus!==void 0}function pn({title:e,children:t}){return r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"font-medium text-foreground/80",children:e}),t]})}function Ws({value:e}){return r.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 j6({result:e}){const t=e.debug,n=t?.requestUrl,s=t?.requestMethod??"POST",o=Va(t?.requestHeaders),i=Va(t?.responseHeaders),a=t?.responseStatus!==void 0?`${t.responseStatus}${vt(t.responseStatusText)?` ${t.responseStatusText}`:""}`:void 0,l=t?.responseBody??e.rawResponse;return r.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:[vt(e.error?.hint)&&r.jsx(pn,{title:"Hint",children:r.jsx("div",{children:e.error.hint})}),vt(e.error?.details)&&r.jsx(pn,{title:"Error",children:r.jsx(Ws,{value:e.error.details})}),vt(n)&&r.jsx(pn,{title:"Request",children:r.jsxs("div",{className:"rounded-md bg-background/80 p-2 font-mono text-[11px] break-all text-foreground/80",children:[s," ",n]})}),o!==void 0&&r.jsx(pn,{title:"Request Headers",children:r.jsx(Ws,{value:o})}),vt(t?.requestBody)&&r.jsx(pn,{title:"Request Body",children:r.jsx(Ws,{value:t.requestBody})}),vt(a)&&r.jsx(pn,{title:"Response Status",children:r.jsx("div",{className:"rounded-md bg-background/80 p-2 font-mono text-[11px] text-foreground/80",children:a})}),i!==void 0&&r.jsx(pn,{title:"Response Headers",children:r.jsx(Ws,{value:i})}),vt(l)&&r.jsx(pn,{title:"Response Body",children:r.jsx(Ws,{value:l})})]})}function as({results:e}){return r.jsxs("div",{className:"grid min-w-0 gap-2 sm:grid-cols-2",children:[r.jsxs("div",{className:"min-w-0 rounded-md border border-border/60 bg-muted/20 px-2 py-1.5",children:[r.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Non-stream"}),r.jsx(Qu,{result:e.nonStreaming})]}),r.jsxs("div",{className:"min-w-0 rounded-md border border-border/60 bg-muted/20 px-2 py-1.5",children:[r.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Stream"}),r.jsx(Qu,{result:e.streaming})]})]})}function Ki({label:e,children:t}){return r.jsxs("div",{className:"min-w-0 space-y-2 rounded-md border border-border/60 bg-muted/15 p-2",children:[r.jsx("div",{className:"text-xs font-medium text-foreground/80",children:e}),t]})}function Ze(e){return e!==void 0&&e!==""}function S6(e){const t=[];return Ze(e.anthropicBaseUrl)&&t.push("Anthropic"),Ze(e.openaiBaseUrl)&&t.push("Chat"),Ze(e.openaiResponsesBaseUrl)&&t.push("Responses"),t}function Ji({label:e,enabled:t,tone:n}){const o=(n??(t?"active":"quiet"))==="response"&&t?"border-sky-300/30 bg-sky-300/[0.09] text-sky-100":t?"border-border/70 bg-muted/25 text-foreground/80":"border-border/50 bg-transparent text-muted-foreground/70";return r.jsxs("span",{className:`inline-flex items-center gap-1 rounded border px-1.5 py-0.5 ${o}`,children:[t?r.jsx(kl,{className:"size-3"}):r.jsx(Jf,{className:"size-3"}),e]})}function C6({provider:e}){const t=Ze(e.anthropicBaseUrl),n=Ze(e.openaiBaseUrl),s=Ze(e.openaiResponsesBaseUrl);return!t&&!n&&!s?r.jsx("div",{className:"text-xs text-muted-foreground",children:"Test requires at least one configured endpoint."}):r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("span",{children:"Capabilities"}),t&&r.jsx(Ji,{label:"Anthropic",enabled:!0}),n&&r.jsx(Ji,{label:"OpenAI Chat",enabled:!0}),r.jsx(Ji,{label:s?"OpenAI Responses":"No OpenAI Responses",enabled:s,tone:"response"}),r.jsx("span",{children:"tested non-stream + stream"})]})}function N6(e,t){if(t===void 0)return[];const n=[];return Ze(e.anthropicBaseUrl)&&n.push(t.anthropic),Ze(e.openaiBaseUrl)&&n.push(t.openaiChat),Ze(e.openaiResponsesBaseUrl)&&n.push(t.openaiResponses),n}function T6(e,t){const n={total:0,passed:0,failed:0,testing:0};for(const s of N6(e,t))for(const o of[s.nonStreaming,s.streaming])E0(o)||(n.total+=1,T0(o)?o.success?n.passed+=1:n.failed+=1:n.testing+=1);return n}function E6({provider:e,testResults:t,isTesting:n}){const s=S6(e),o=T6(e,t);return n?r.jsxs("span",{className:"inline-flex items-center gap-1 rounded border border-cyan-300/25 bg-cyan-300/[0.08] px-2 py-1 text-xs text-cyan-100",children:[r.jsx(ho,{className:"size-3 animate-spin"}),"Testing"]}):s.length===0?r.jsx("span",{className:"rounded border border-border/70 bg-muted/20 px-2 py-1 text-xs text-muted-foreground",children:"No endpoint"}):t===void 0||o.total===0?r.jsx("span",{className:"rounded border border-border/70 bg-muted/20 px-2 py-1 text-xs text-muted-foreground",children:"Not tested"}):o.failed>0?r.jsxs("span",{className:"inline-flex items-center gap-1 rounded border border-red-400/25 bg-red-500/[0.08] px-2 py-1 text-xs text-red-200",children:[r.jsx(_s,{className:"size-3"}),o.passed,"/",o.total," passed"]}):o.testing>0||o.passed<o.total?r.jsxs("span",{className:"rounded border border-amber-300/25 bg-amber-400/[0.08] px-2 py-1 text-xs text-amber-100",children:["Partial ",o.passed,"/",o.total]}):r.jsxs("span",{className:"inline-flex items-center gap-1 rounded border border-cyan-300/25 bg-cyan-300/[0.08] px-2 py-1 text-xs text-cyan-100",children:[r.jsx(kl,{className:"size-3"}),"OK ",o.passed,"/",o.total]})}function A6(e){const t=e.models??[];if(t.length===0)return"No models configured";const n=t.slice(0,2).join(", "),s=t.length-2;return s>0?`${n} +${s} more`:n}function R6({provider:e,model:t}){const n=hc(e,t),s=P6(n?.sourceUrl);return r.jsxs("span",{className:"inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",children:[r.jsx("span",{children:t}),n!==null&&n.contextWindow!==void 0&&r.jsx("span",{className:"font-mono text-foreground/80",children:bp(n.contextWindow)}),s!==null&&r.jsx(jn,{children:r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsx("a",{href:s.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":s.title,children:s.label})}),r.jsx(dt,{children:s.title})]})})]})}function I6(e){const t=e?.models;if(t===void 0)return null;const n=Object.keys(t).length;return n===0?null:`${n} model${n===1?"":"s"} tested`}function z6(e){const t={className:"size-3",strokeWidth:2};switch(e){case"timeout":return r.jsx(sn,{...t});case"network_unreachable":return r.jsx(y_,{...t});case"connection_refused":return r.jsx(__,{...t});case"auth_failed":return r.jsx(Cw,{...t});case"rate_limited":return r.jsx(Nl,{...t});case"server_error":return r.jsx(o_,{...t});case"invalid_response":return r.jsx(zy,{...t});case"unknown":return r.jsx(_s,{...t});default:return r.jsx(_s,{...t})}}function Qu({result:e}){const[t,n]=p.useState(!1);if(!T0(e))return E0(e)?r.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[r.jsx(Jf,{className:"size-3"}),r.jsx("span",{children:"Not configured"})]}):r.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[r.jsx(ho,{className:"size-3 animate-spin"}),r.jsx("span",{children:"Testing..."})]});if(e.success){const l=[],c=[];e.inputTokens!==void 0&&l.push(r.jsxs("span",{children:[e.inputTokens," in"]},"in")),e.outputTokens!==void 0&&l.push(r.jsxs("span",{children:[e.outputTokens," out"]},"out")),e.cacheCreationInputTokens!==void 0&&e.cacheCreationInputTokens>0&&l.push(r.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(r.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(r.jsxs("span",{children:["first ",Xu(e.firstChunkMs)]},"first")),e.totalStreamMs!==void 0&&e.totalStreamMs!==null&&c.push(r.jsxs("span",{children:["total ",Xu(e.totalStreamMs)]},"total")),e.tokensPerSecond!==void 0&&e.tokensPerSecond!==null&&e.tokensPerSecond>0&&c.push(r.jsxs("span",{children:[_6(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 r.jsxs("div",{className:"flex shrink-0 items-center gap-1 text-xs text-cyan-100",children:[r.jsx(kl,{className:"size-3 text-cyan-300"}),r.jsx("span",{children:"Connected"}),l.length>0&&r.jsxs("span",{className:"text-muted-foreground",children:["(",u,")"]}),c.length>0&&r.jsxs("span",{className:"hidden text-muted-foreground lg:inline",children:["(",d,")"]})]})}const s=e.error,o=s?.message??"Connection failed",i=s?.type??"unknown",a=k6(e);return r.jsxs("div",{className:"flex flex-col gap-1 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-1 text-xs text-red-600 max-w-[200px]",children:[z6(i),r.jsx("span",{className:"truncate",children:o}),a&&r.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?r.jsx(Sl,{className:"size-3"}):r.jsx(Cl,{className:"size-3"}),r.jsx("span",{children:t?"Hide":"Details"})]})]}),t&&a&&r.jsx(j6,{result:e})]})}function O6(e){const t=Date.now(),n=new Date(e).getTime(),s=t-n,o=Math.floor(s/1e3);if(o<60)return"just now";const i=Math.floor(o/60);if(i<60)return`${i}m ago`;const a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function P6(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(),s=n==="huggingface.co"||n.endsWith(".huggingface.co");return{label:s?"HF":"Source",title:s?"Open Hugging Face model source":"Open model metadata source",url:e}}catch{return null}}function M6({provider:e,testResults:t,isTesting:n,testingTimeLeft:s,isHighlighted:o,onEdit:i,onDelete:a,onTest:l,onRefreshMetadata:c,isRefreshingMetadata:u=!1}){const[d,f]=p.useState(!1),[h,m]=p.useState(!1),[v,g]=p.useState(!1),[x,b]=p.useState(!1);function y(){Nt(e.apiKey).then(z=>{z&&(m(!0),setTimeout(()=>m(!1),2e3))})}const k=e.apiDocsUrl??Object.entries(w6).find(([z])=>e.name.toLowerCase().includes(z))?.[1],j=v6(e),C=e.modelMetadataUrl!==void 0&&e.modelMetadataUrl.trim()!=="",T=C?"Refresh":"Import defaults",N=n??!1,O=I6(t),A=e.source==="company"?r.jsx("span",{className:"shrink-0 rounded border border-cyan-300/20 bg-cyan-300/[0.08] px-1.5 py-0.5 text-xs text-cyan-100",children:"Company"}):e.source==="personal"?r.jsx("span",{className:"shrink-0 rounded border border-violet-300/20 bg-violet-300/[0.08] px-1.5 py-0.5 text-xs text-violet-100",children:"Personal"}):null;return r.jsxs("div",{className:`flex flex-col gap-3 rounded-[8px] border border-border bg-card p-4 shadow-sm transition-all duration-500 ${o===!0?"ring-2 ring-primary shadow-md":""}`,children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 space-y-1",children:[r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[r.jsx("span",{className:"font-medium leading-snug",children:e.name}),A]}),r.jsx("div",{className:"text-xs leading-snug text-muted-foreground",children:A6(e)})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx(E6,{provider:e,testResults:t,isTesting:N}),k!==void 0&&r.jsxs("a",{href:k,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground",title:"View API documentation",children:[r.jsx(jl,{className:"size-3"}),r.jsx("span",{className:"sr-only",children:"Docs"})]})]})]}),r.jsxs("div",{className:"flex flex-col gap-2 text-xs text-muted-foreground sm:flex-row sm:items-center sm:justify-between",children:[r.jsx(C6,{provider:e}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{children:"Key configured"}),r.jsx("span",{children:e.authHeader==="x-api-key"?"x-api-key":"Bearer"}),O!==null&&r.jsx("span",{children:O}),t?.testedAt!==void 0&&r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx(sn,{className:"size-3"}),O6(t.testedAt)]})]})]}),!j&&r.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:[r.jsx("span",{children:"Context window metadata missing"}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[r.jsxs(ke,{type:"button",variant:"outline",size:"sm",onClick:()=>c?.(e.id),className:"h-6 gap-1 px-2 text-xs",disabled:u,children:[r.jsx(ho,{className:`size-3 ${u?"animate-spin":""}`}),T]}),!C&&r.jsx(ke,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(e),className:"h-6 px-2 text-xs",children:"Set URL"})]})]}),v&&r.jsxs("div",{className:"space-y-3 border-t border-border/60 pt-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("code",{className:"flex-1 truncate rounded bg-muted px-2 py-1 text-xs text-muted-foreground",children:d?e.apiKey:C0(e.apiKey)}),r.jsx("button",{type:"button",onClick:()=>f(z=>!z),className:"p-1 text-muted-foreground transition-colors hover:text-foreground","aria-label":d?"Hide API key":"Show API key",children:d?r.jsx(Sl,{className:"size-4"}):r.jsx(Cl,{className:"size-4"})}),r.jsx("button",{type:"button",onClick:y,className:"p-1 text-muted-foreground transition-colors hover:text-foreground","aria-label":"Copy API key",children:h?r.jsx(Ge,{className:"size-4 text-cyan-300"}):r.jsx(At,{className:"size-4"})})]}),e.models!==void 0&&e.models.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1",children:e.models.map(z=>r.jsx(R6,{provider:e,model:z},z))}),(Ze(e.anthropicBaseUrl)||Ze(e.openaiBaseUrl)||Ze(e.openaiResponsesBaseUrl))&&r.jsxs("div",{className:"grid gap-2 lg:grid-cols-3",children:[Ze(e.anthropicBaseUrl)&&r.jsxs(Ki,{label:"Anthropic",children:[t!==void 0&&r.jsx(as,{results:t.anthropic}),t===void 0&&r.jsx("div",{className:"text-xs text-muted-foreground",children:"Not tested yet"})]}),Ze(e.openaiBaseUrl)&&r.jsxs(Ki,{label:"OpenAI Chat",children:[t!==void 0&&r.jsx(as,{results:t.openaiChat}),t===void 0&&r.jsx("div",{className:"text-xs text-muted-foreground",children:"Not tested yet"})]}),Ze(e.openaiResponsesBaseUrl)&&r.jsxs(Ki,{label:"OpenAI Responses",children:[t!==void 0&&r.jsx(as,{results:t.openaiResponses}),t===void 0&&r.jsx("div",{className:"text-xs text-muted-foreground",children:"Not tested yet"})]}),!Ze(e.openaiResponsesBaseUrl)&&r.jsx("div",{className:"min-w-0 rounded-md border border-border/50 bg-transparent p-2 text-xs text-muted-foreground/75",children:"OpenAI Responses not configured"})]}),t?.models!==void 0&&Object.keys(t.models).length>0&&r.jsxs("div",{children:[r.jsxs("button",{type:"button",onClick:()=>b(z=>!z),className:"flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground",children:[x?r.jsx(ot,{className:"size-3"}):r.jsx(Tt,{className:"size-3"}),"Model Test Results (",Object.keys(t.models).length,")"]}),x&&r.jsx("div",{className:"mt-2 overflow-x-auto",children:r.jsxs("table",{className:"w-full border-collapse text-xs",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border",children:[r.jsx("th",{className:"px-2 py-1 text-left font-medium text-muted-foreground",children:"Model"}),Ze(e.anthropicBaseUrl)&&r.jsx("th",{className:"px-2 py-1 text-left font-medium text-muted-foreground",children:"Anthropic"}),Ze(e.openaiBaseUrl)&&r.jsx("th",{className:"px-2 py-1 text-left font-medium text-muted-foreground",children:"Chat"}),Ze(e.openaiResponsesBaseUrl)&&r.jsx("th",{className:"px-2 py-1 text-left font-medium text-muted-foreground",children:"Responses"})]})}),r.jsx("tbody",{children:Object.entries(t.models).map(([z,D])=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[r.jsx("td",{className:"px-2 py-1 font-medium",children:z}),Ze(e.anthropicBaseUrl)&&r.jsx("td",{className:"px-2 py-1 align-top",children:r.jsx(as,{results:D.anthropic})}),Ze(e.openaiBaseUrl)&&r.jsx("td",{className:"px-2 py-1 align-top",children:r.jsx(as,{results:D.openaiChat})}),Ze(e.openaiResponsesBaseUrl)&&r.jsx("td",{className:"px-2 py-1 align-top",children:r.jsx(as,{results:D.openaiResponses})})]},z))})]})})]})]}),r.jsxs("div",{className:"flex flex-col gap-2 border-t pt-1 sm:flex-row sm:items-center sm:justify-between",children:[r.jsxs("button",{type:"button",onClick:()=>g(z=>!z),className:"inline-flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground","aria-expanded":v,children:[v?r.jsx(ot,{className:"size-3"}):r.jsx(Tt,{className:"size-3"}),"Details"]}),r.jsxs("div",{className:"flex gap-2",children:[l!==void 0&&r.jsxs(ke,{variant:"outline",size:"sm",onClick:()=>l(e.id),className:"text-xs h-7 gap-1",disabled:N,children:[r.jsx(ho,{className:`size-3 ${N?"animate-spin":""}`}),N?s!==void 0?`Testing (${s}s)`:"Testing...":"Test"]}),r.jsxs(ke,{variant:"outline",size:"sm",onClick:()=>i(e),className:"text-xs h-7 gap-1",disabled:N,children:[r.jsx(Yf,{className:"size-3"}),"Edit"]}),r.jsxs(ke,{variant:"outline",size:"sm",onClick:()=>a(e.id),className:"text-xs h-7 gap-1 text-destructive hover:text-destructive",disabled:N,children:[r.jsx(wn,{className:"size-3"}),"Delete"]})]})]})]})}const vs="/v1/chat/completions",qa="/v1/responses",L6="/v1/messages";function D6(e,t){const n=e.endsWith("/")?e.slice(0,-1):e,s=A0(t),o=t.indexOf("?"),i=o>=0?t.slice(o):"";return s!==""&&n.endsWith(s)?n+i:I0(n)&&R0(t)||n.endsWith("/v1")&&t.startsWith("/v1/")?n+t.slice(3):n+t}function $6(e,t,n={}){const s=e.trim().replace(/\/+$/,""),o=A0(t),i=D6(s,t),a=[];return o!==""&&s.endsWith(o)?a.push({severity:"info",message:"This already includes the exact endpoint; no duplicate suffix will be appended."}):I0(s)&&R0(t)?a.push({severity:"info",message:"Zhipu bases already include the API version; only /chat/completions is appended."}):s.endsWith("/v1")&&t.startsWith("/v1/")&&a.push({severity:"info",message:"Base URL already ends with /v1; the suffix will not repeat /v1."}),ed(o)&&B6(s)&&a.push({severity:"warning",message:"This looks like a Chat Completions endpoint, so Responses would append after it."}),F6(o)&&U6(s)&&a.push({severity:"warning",message:"This looks like a Responses endpoint, so Chat Completions would append after it."}),ed(o)&&W6(s,n.providerName)&&a.push({severity:"warning",message:"DeepSeek's official API does not currently expose OpenAI Responses."}),{finalUrl:i,diagnostics:a}}function A0(e){return e.split("?")[0]??e}function R0(e){return e===vs||e.startsWith(`${vs}?`)||e.startsWith(`${vs}/`)}function F6(e){return e===vs||e.startsWith(`${vs}/`)}function ed(e){return e===qa||e.startsWith(`${qa}/`)}function B6(e){return e.toLowerCase().endsWith("/chat/completions")}function U6(e){return e.toLowerCase().endsWith("/responses")}function W6(e,t){const n=t?.toLowerCase();if(n!==void 0&&n.includes("deepseek"))return!0;try{return new URL(e).hostname.toLowerCase().includes("deepseek")}catch{return e.toLowerCase().includes("deepseek")}}function I0(e){try{const t=new URL(e),n=t.pathname.replace(/\/+$/,"");return t.hostname==="open.bigmodel.cn"&&(n==="/api/paas/v4"||n==="/api/coding/paas/v4")}catch{return!1}}const td=["zhipu","zhipuai","bigmodel","z.ai","zai","glm"],nd=["zhipu coding","glm coding","bigmodel coding","z.ai coding","zai coding"],Br=L6,Ur=vs,Wr=qa,H6={deepseek:{openaiBaseUrl:"https://api.deepseek.com"},minimax:{anthropicBaseUrl:"https://api.minimaxi.com/anthropic",openaiBaseUrl:"https://api.minimaxi.com",openaiResponsesBaseUrl:"https://api.minimaxi.com",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"}},sd=["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"],rd=["qwen3.6-plus","qwen3.7-max"],od=["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"],Za="__unset__",Oo="__custom__",z0=[{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 Pn(){return{contextWindow:"",contextWindowMode:"unset",outputLimit:""}}function id(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}function O0(e,t){const n=id(t);return e?.modelMetadata?.find(s=>id(s.model)===n)??null}function P0(e){const t=go(e);if(t===null)return null;for(const n of z0)if(go(n.value)===t)return n.value;return null}function V6(e){return e.trim()===""?"unset":P0(e)!==null?"preset":"custom"}function q6(e){switch(e.contextWindowMode){case"unset":return Za;case"custom":return Oo;case"preset":return P0(e.contextWindow)??Oo}}function Yi(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 s=n[1];if(s===void 0)return{amount:t,unit:"K"};const o=n[2];if(o===void 0||o==="")return{amount:s,unit:"tokens"};switch(o.toLowerCase()){case"k":return{amount:s,unit:"K"};case"m":return{amount:s,unit:"M"};default:return{amount:t,unit:"K"}}}function ad(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 ld(e,t){return t.map(n=>{const s=O0(e,n),o=s?.contextWindow!==void 0?Bk(s.contextWindow):"";return{contextWindow:o,contextWindowMode:V6(o),outputLimit:s?.outputLimit?.toString()??""}})}function cd(e){const t=e.trim();if(t==="")return null;const n=Number(t);return!Number.isInteger(n)||n<=0?null:n}function ls(e,t){if(e===void 0)return"";const n=e.trim(),s=n.replace(/\/+$/,"");return s.endsWith(t)?s.slice(0,-t.length).replace(/\/+$/,""):n}function Z6(e,t,n){const s=e.trim();return s===""?null:$6(s,t,{providerName:n})}function Xi({baseUrl:e,endpoint:t,providerName:n}){const s=Z6(e,t,n);return s===null?null:r.jsxs("div",{className:"border border-border bg-muted/40 rounded-md px-3 py-2 text-xs",children:[r.jsx("div",{className:"text-muted-foreground",children:"Final URL"}),r.jsx("div",{className:"break-all font-mono text-foreground",children:s.finalUrl}),s.diagnostics.length>0&&r.jsx("div",{className:"mt-2 space-y-1",children:s.diagnostics.map(o=>r.jsx("div",{className:o.severity==="warning"?"text-amber-200":"text-muted-foreground",children:o.message},`${o.severity}:${o.message}`))})]})}function G6({provider:e,onSubmit:t,onCancel:n}){const[s,o]=p.useState(e?.name??""),[i,a]=p.useState(e?.apiKey??""),[l,c]=p.useState(!1),[u,d]=p.useState(!1),f=e?.models,[h,m]=p.useState(f!==void 0&&f.length>0?f:[""]),[v,g]=p.useState(()=>ld(e,f!==void 0&&f.length>0?f:[""])),[x,b]=p.useState("anthropic"),[y,k]=p.useState(ls(e?.anthropicBaseUrl,Br)),[j,C]=p.useState(ls(e?.openaiBaseUrl,Ur)),[T,N]=p.useState(ls(e?.openaiResponsesBaseUrl,Wr)),[O,A]=p.useState(e?.apiDocsUrl??""),[z,D]=p.useState(e?.modelMetadataUrl??""),[E,L]=p.useState(e?.source),[w,$]=p.useState({}),[ee,F]=p.useState(!1),[W,Z]=p.useState(null),ue=p.useRef([]);p.useEffect(()=>{if(W===null)return;const I=W;function M(Y){if(!(Y.target instanceof Node))return;const re=ue.current[I];re!=null&&!re.contains(Y.target)&&Z(null)}return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[W]);const[V,H]=p.useState(!1),[le,U]=p.useState(!1),[X,Ce]=p.useState(!1),ae=s.toLowerCase().includes("minimax"),ge=s.toLowerCase().includes("alibaba"),xe=[...td,...nd].some(I=>s.toLowerCase().includes(I)),he=ae?sd:xe?od:ge?rd:[],be=e?.modelMetadata?.some(I=>I.contextWindow!==void 0)??!1;function Se(){Nt(i).then(I=>{I&&(d(!0),setTimeout(()=>d(!1),2e3))})}p.useEffect(()=>{if(e){o(e.name),a(e.apiKey);const I=(e.models?.length??0)>0?e.models:[""];m(I),g(ld(e,I)),k(ls(e.anthropicBaseUrl,Br)),C(ls(e.openaiBaseUrl,Ur)),N(ls(e.openaiResponsesBaseUrl,Wr)),A(e.apiDocsUrl??""),D(e.modelMetadataUrl??""),L(e.source),H(!1),U(!1),Ce(!1)}},[e]),p.useEffect(()=>{const I=s.toLowerCase();for(const[M,Y]of Object.entries(H6))if(I.includes(M)){Y.anthropicBaseUrl!==void 0&&!V&&k(Y.anthropicBaseUrl),Y.openaiBaseUrl!==void 0&&!le&&C(Y.openaiBaseUrl),Y.openaiResponsesBaseUrl!==void 0&&!X&&N(Y.openaiResponsesBaseUrl),Y.apiDocsUrl!==void 0&&!O&&A(Y.apiDocsUrl),M==="minimax"&&h.length===1&&h[0]===""&&m([sd[0]??""]),M==="alibaba"&&h.length===1&&h[0]===""&&m([rd[0]??""]),(td.includes(M)||nd.includes(M))&&h.length===1&&h[0]===""&&m([od[0]??""]);break}},[s]);function Ie(){const I={};return s.trim()||(I.name="Name is required"),i.trim()||(I.apiKey="API key is required"),(h.length===0||h.every(M=>!M.trim()))&&(I.models="At least one model is required"),y.trim()&&!_(y.trim())&&(I.anthropicBaseUrl="Invalid URL format"),j.trim()&&!_(j.trim())&&(I.openaiBaseUrl="Invalid URL format"),T.trim()&&!_(T.trim())&&(I.openaiResponsesBaseUrl="Invalid URL format"),z.trim()&&!_(z.trim())&&(I.modelMetadataUrl="Invalid URL format"),v.forEach((M,Y)=>{const re=go(M.contextWindow),oe=cd(M.outputLimit);M.contextWindow.trim()!==""&&re===null&&(I[`modelMetadata.${Y}.contextWindow`]="Context window must be a positive number, optionally using K or M"),M.outputLimit.trim()!==""&&oe===null&&(I[`modelMetadata.${Y}.outputLimit`]="Output limit must be a positive integer"),re!==null&&oe!==null&&oe>re&&(I[`modelMetadata.${Y}.outputLimit`]="Output limit should not exceed context window")}),!y.trim()&&!j.trim()&&!T.trim()&&(I.format="At least one format URL (Anthropic or OpenAI) is required"),$(I),Object.keys(I).length===0}function _(I){try{return new URL(I),!0}catch{return!1}}function Q(I,M){m(Y=>{const re=[...Y];return re[I]=M,re})}function G(I,M){g(Y=>{const re=[...Y];return re[I]={...re[I]??Pn(),...M},re})}function P(I,M){switch(M){case Za:G(I,{contextWindow:"",contextWindowMode:"unset"});return;case Oo:{const Y=v[I]??Pn();G(I,{contextWindow:Y.contextWindow,contextWindowMode:"custom"});return}default:G(I,{contextWindow:M,contextWindowMode:"preset"});return}}function R(I,M){const Y=v[I]??Pn(),re=Yi(Y.contextWindow);G(I,{contextWindow:ad(M,re.unit),contextWindowMode:"custom"})}function B(I,M){const Y=v[I]??Pn(),re=Yi(Y.contextWindow);switch(M){case"K":case"M":case"tokens":G(I,{contextWindow:ad(re.amount,M),contextWindowMode:"custom"});return;default:return}}function se(I){m(M=>M.filter((Y,re)=>re!==I)),g(M=>M.filter((Y,re)=>re!==I))}function ne(){m(I=>[...I,""]),g(I=>[...I,Pn()])}function q(){const I=new Date().toISOString(),M=[];return h.forEach((Y,re)=>{const oe=Y.trim();if(oe==="")return;const ve=v[re]??Pn(),pe=go(ve.contextWindow),me=cd(ve.outputLimit);if(pe===null&&me===null)return;const Ae=O0(e,oe);if(Ae!==null&&Ae.contextWindow===(pe??void 0)&&Ae.outputLimit===(me??void 0)){M.push({...Ae,model:oe});return}const $e={model:oe,source:"manual",updatedAt:I};pe!==null&&($e.contextWindow=pe),me!==null&&($e.outputLimit=me),M.push($e)}),M.length>0?M:e?.modelMetadata!==void 0?[]:void 0}function ce(I){if(I.preventDefault(),!!Ie()){F(!0);try{t({name:s.trim(),apiKey:i.trim(),models:h.map(M=>M.trim()).filter(M=>M!==""),anthropicBaseUrl:y.trim()||void 0,openaiBaseUrl:j.trim()||void 0,openaiResponsesBaseUrl:T.trim()||void 0,apiDocsUrl:O.trim()||void 0,modelMetadataUrl:z.trim()||void 0,modelMetadata:q(),source:E})}finally{F(!1)}}}return r.jsxs("form",{onSubmit:ce,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{htmlFor:"provider-name",className:"text-sm font-medium",children:["Name ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsx("input",{id:"provider-name",type:"text",value:s,onChange:I=>o(I.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"}),w.name!==void 0&&r.jsx("p",{className:"text-xs text-destructive",children:w.name})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{htmlFor:"provider-source",className:"text-sm font-medium",children:"Token Source"}),r.jsxs("select",{id:"provider-source",value:E??"",onChange:I=>L(I.target.value==="company"||I.target.value==="personal"?I.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:[r.jsx("option",{value:"",children:"Unspecified"}),r.jsx("option",{value:"personal",children:"个人 (Personal)"}),r.jsx("option",{value:"company",children:"公司 (Company)"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Label whether this API key is company-provided or personal."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{htmlFor:"provider-model-metadata-url",className:"text-sm font-medium",children:"Model Metadata URL"}),r.jsx("input",{id:"provider-model-metadata-url",type:"text",value:z,onChange:I=>D(I.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"}),w.modelMetadataUrl!==void 0&&r.jsx("p",{className:"text-xs text-destructive",children:w.modelMetadataUrl}),z.trim()===""&&r.jsx("div",{className:"border border-border bg-muted/40 rounded-md 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&&!be&&z.trim()===""&&r.jsx("p",{className:"text-xs text-amber-400",children:"This provider has no matching context metadata yet."}),z.trim()!==""&&r.jsx("p",{className:"text-xs text-muted-foreground",children:"Agent Inspector will refresh model limits from this JSON registry after save."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{htmlFor:"provider-apikey",className:"text-sm font-medium",children:["API Key ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{id:"provider-apikey",type:"text",value:l||i.length===0?i:C0(i),onChange:I=>a(I.target.value),onFocus:()=>{!l&&i.length>0&&c(!0)},placeholder:"sk-ant-...",readOnly:!l&&i.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"}),r.jsx("button",{type:"button",onClick:()=>c(I=>!I),className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":l?"Hide API key":"Show API key",children:l?r.jsx(Sl,{className:"size-4"}):r.jsx(Cl,{className:"size-4"})}),r.jsx("button",{type:"button",onClick:Se,className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":"Copy API key",children:u?r.jsx(Ge,{className:"size-4 text-cyan-300"}):r.jsx(At,{className:"size-4"})})]}),w.apiKey!==void 0&&r.jsx("p",{className:"text-xs text-destructive",children:w.apiKey})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"text-sm font-medium",children:["Models ",r.jsx("span",{className:"text-destructive",children:"*"})]}),h.map((I,M)=>{const Y=v[M]??Pn(),re=w[`modelMetadata.${M}.contextWindow`],oe=w[`modelMetadata.${M}.outputLimit`],ve=q6(Y),pe=Yi(Y.contextWindow);return r.jsxs("div",{ref:me=>{ue.current[M]=me},className:"border border-border bg-card shadow-sm space-y-2 rounded-[8px] p-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx("input",{type:"text",value:I,onChange:me=>Q(M,me.target.value),placeholder:he.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"}),he.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",onClick:()=>Z(W===M?null:M),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:r.jsx(ot,{className:"size-4"})}),W===M&&r.jsx("div",{className:"bg-popover text-popover-foreground absolute left-0 right-0 top-full z-50 mt-1 max-h-48 overflow-y-auto rounded-md border shadow-md",children:he.map(me=>r.jsx("button",{type:"button",onClick:()=>{Q(M,me),Z(null)},className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-white/[0.06]",children:me},me))})]})]}),h.length>1&&r.jsx("button",{type:"button",onClick:()=>se(M),className:"text-muted-foreground hover:text-destructive transition-colors p-1 shrink-0","aria-label":"Remove model",children:r.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:[r.jsx("path",{d:"M3 6h18"}),r.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),r.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]})})]}),r.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[r.jsx("span",{children:"Context Window"}),r.jsxs(Ao,{value:ve,onValueChange:me=>P(M,me),children:[r.jsx(Io,{size:"sm",className:"w-full bg-background font-mono text-xs",children:r.jsx(Ro,{})}),r.jsxs(zo,{className:"max-h-64",children:[r.jsx(Lt,{value:Za,children:"Not set"}),z0.map(me=>r.jsxs(Lt,{value:me.value,children:[me.label," · ",me.value]},me.value)),r.jsx(Lt,{value:Oo,children:"Custom"})]})]}),Y.contextWindowMode==="custom"&&r.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_5.75rem] gap-1.5",children:[r.jsx("input",{type:"text",inputMode:"decimal",value:pe.amount,onChange:me=>R(M,me.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]"}),r.jsxs(Ao,{value:pe.unit,onValueChange:me=>B(M,me),children:[r.jsx(Io,{size:"sm",className:"w-full bg-background font-mono text-xs",children:r.jsx(Ro,{})}),r.jsxs(zo,{children:[r.jsx(Lt,{value:"K",children:"K"}),r.jsx(Lt,{value:"M",children:"M"}),r.jsx(Lt,{value:"tokens",children:"tokens"})]})]})]}),re!==void 0&&r.jsx("span",{className:"block text-destructive",children:re})]}),r.jsxs("label",{className:"space-y-1 text-xs text-muted-foreground",children:[r.jsx("span",{children:"Output Limit"}),r.jsx("input",{type:"number",min:1,step:1e3,value:Y.outputLimit,onChange:me=>G(M,{outputLimit:me.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]"}),oe!==void 0&&r.jsx("span",{className:"block text-destructive",children:oe})]})]})]},M)}),r.jsx("button",{type:"button",onClick:ne,className:"text-xs text-primary hover:underline flex items-center gap-1",children:"+ Add Model"}),w.models!==void 0&&r.jsx("p",{className:"text-xs text-destructive",children:w.models})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"border border-border bg-muted/40 flex gap-1 rounded-[8px] p-1",children:[r.jsx(jn,{children:r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.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"})}),r.jsx(dt,{children:"Anthropic Messages API format"})]})}),r.jsx(jn,{children:r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.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"})}),r.jsx(dt,{children:"OpenAI Chat Completions API format"})]})})]}),w.format!==void 0&&r.jsx("p",{className:"text-xs text-destructive",children:w.format})]}),x==="anthropic"&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{htmlFor:"provider-anthropic-base-url",className:"text-sm font-medium",children:"Anthropic Base URL"}),r.jsxs("div",{className:"border border-input bg-background hover:bg-accent hover:text-accent-foreground flex min-w-0 overflow-hidden rounded-md focus-within:border-ring focus-within:outline-ring focus-within:ring-[3px]",children:[r.jsx("input",{id:"provider-anthropic-base-url",type:"text",value:y,onChange:I=>{H(!0),k(I.target.value)},placeholder:"https://api.anthropic.com",className:"min-w-0 flex-1 bg-transparent px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50"}),r.jsx("span",{className:"shrink-0 select-none border-l border-white/10 bg-white/[0.04] px-3 py-2 font-mono text-xs text-muted-foreground",children:Br})]}),w.anthropicBaseUrl!==void 0&&r.jsx("p",{className:"text-xs text-destructive",children:w.anthropicBaseUrl}),r.jsx(Xi,{baseUrl:y,endpoint:Br,providerName:s}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Anthropic-compatible base URL. Leave empty if this provider does not support Anthropic format."})]}),x==="openai"&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{htmlFor:"provider-openai-base-url",className:"text-sm font-medium",children:"OpenAI Chat Base URL"}),r.jsxs("div",{className:"border border-input bg-background hover:bg-accent hover:text-accent-foreground flex min-w-0 overflow-hidden rounded-md focus-within:border-ring focus-within:outline-ring focus-within:ring-[3px]",children:[r.jsx("input",{id:"provider-openai-base-url",type:"text",value:j,onChange:I=>{U(!0),C(I.target.value)},placeholder:"https://api.openai.com",className:"min-w-0 flex-1 bg-transparent px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50"}),r.jsx("span",{className:"shrink-0 select-none border-l border-white/10 bg-white/[0.04] px-3 py-2 font-mono text-xs text-muted-foreground",children:Ur})]}),w.openaiBaseUrl!==void 0&&r.jsx("p",{className:"text-xs text-destructive",children:w.openaiBaseUrl}),r.jsx(Xi,{baseUrl:j,endpoint:Ur,providerName:s}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"OpenAI Chat Completions-compatible base URL. Leave empty if this provider only supports the Responses API."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{htmlFor:"provider-openai-responses-base-url",className:"text-sm font-medium",children:"OpenAI Responses Base URL"}),r.jsxs("div",{className:"border border-input bg-background hover:bg-accent hover:text-accent-foreground flex min-w-0 overflow-hidden rounded-md focus-within:border-ring focus-within:outline-ring focus-within:ring-[3px]",children:[r.jsx("input",{id:"provider-openai-responses-base-url",type:"text",value:T,onChange:I=>{Ce(!0),N(I.target.value)},placeholder:"https://api.openai.com",className:"min-w-0 flex-1 bg-transparent px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50"}),r.jsx("span",{className:"shrink-0 select-none border-l border-white/10 bg-white/[0.04] px-3 py-2 font-mono text-xs text-muted-foreground",children:Wr})]}),w.openaiResponsesBaseUrl!==void 0&&r.jsx("p",{className:"text-xs text-destructive",children:w.openaiResponsesBaseUrl}),r.jsx(Xi,{baseUrl:T,endpoint:Wr,providerName:s}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional Responses-compatible base URL. Set only when the provider supports the Responses API."})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{htmlFor:"provider-api-docs-url",className:"text-sm font-medium",children:"API Docs URL"}),r.jsx("input",{id:"provider-api-docs-url",type:"text",value:O,onChange:I=>A(I.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"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional API documentation URL. If not set, uses known provider docs."})]}),r.jsxs("div",{className:"border border-border bg-background/95 shadow-sm sticky bottom-0 flex justify-end gap-2 rounded-[8px] px-3 py-2",children:[r.jsx(ke,{type:"button",variant:"outline",onClick:n,disabled:ee,children:"Cancel"}),r.jsx(ke,{type:"submit",disabled:ee,children:ee?"Saving...":e?"Update Provider":"Add Provider"})]})]})}const K6=Re(["timeout","network_unreachable","connection_refused","auth_failed","rate_limited","server_error","invalid_response","unknown"]),J6=J({message:S(),type:K6,details:S().optional(),hint:S().optional()}),Y6=J({type:Re(["text","thinking"]),text:S().optional(),thinking:S().optional()}),X6=J({requestUrl:S().optional(),requestMethod:S().optional(),requestHeaders:Ye(S(),S()).optional(),requestBody:S().optional(),responseStatus:K().optional(),responseStatusText:S().optional(),responseHeaders:Ye(S(),S()).optional(),responseBody:S().optional()}),Q6=J({success:Le(),error:J6.optional(),model:S().optional(),inputTokens:K().optional(),outputTokens:K().optional(),cacheCreationInputTokens:K().optional(),cacheReadInputTokens:K().optional(),latencyMs:K().optional(),firstChunkMs:K().nullable().optional(),totalStreamMs:K().nullable().optional(),tokensPerSecond:K().nullable().optional(),content:fe(Y6).optional(),rawResponse:S().optional(),streaming:Le().optional(),streamingChunks:J({chunks:fe(yf),truncated:Le().default(!1)}).optional(),requestHeaders:Ye(S(),S()).optional(),debug:X6.optional()}),ud=Yt([Q6,J({notConfigured:Ee(!0)}),J({testing:Ee(!0)})]),xn=J({nonStreaming:ud,streaming:ud});function Po(){return{nonStreaming:{notConfigured:!0},streaming:{notConfigured:!0}}}const eR=J({anthropic:xn,openai:xn.optional(),openaiChat:xn.optional(),openaiResponses:xn.optional()}).transform(e=>{const t=e.openaiChat??e.openai??Po();return{...e,openai:e.openai??t,openaiChat:t,openaiResponses:e.openaiResponses??Po()}}),tR=J({anthropic:xn,openai:xn.optional(),openaiChat:xn.optional(),openaiResponses:xn.optional(),models:Ye(S(),eR).optional(),testedAt:S().optional()}).transform(e=>{const t=e.openaiChat??e.openai??Po();return{...e,openai:e.openai??t,openaiChat:t,openaiResponses:e.openaiResponses??Po()}});function nR(){return{anthropic:{nonStreaming:{testing:!0},streaming:{testing:!0}},openai:{nonStreaming:{testing:!0},streaming:{testing:!0}},openaiChat:{nonStreaming:{testing:!0},streaming:{testing:!0}},openaiResponses:{nonStreaming:{testing:!0},streaming:{testing:!0}}}}function dd(e,t){const n=()=>({nonStreaming:{success:!1,error:{message:e,type:t}},streaming:{notConfigured:!0}});return{anthropic:n(),openai:n(),openaiChat:n(),openaiResponses:n()}}const sR=J({providerConfig:S()}),rR=J({success:Le().optional(),imported:K().optional(),message:S().optional(),errors:fe(S()).optional()}),oR=J({provider:xo,imported:K(),matchedModels:fe(S()),missingModels:fe(S()),sourceUrl:S()}),Hr="Network error: could not reach the server. Is the proxy running?",iR=5e3,aR=5e3,fd=15e3,lR=1e4,cR=2e4,uR=2e4,dR=3e4;function pd(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,openaiResponsesBaseUrl:(e.openaiResponsesBaseUrl?.length??0)>0?e.openaiResponsesBaseUrl: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 fR(e,t){const n=e?.models?.map(s=>s.trim()).filter(s=>s!=="").length??0;return Math.max(1,n)*t}async function pR(e,t){if(t.models!==void 0)try{await Dn(`/api/providers/${e}/test/log`,aR,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch{}}function hR({externalProviders:e,isLoading:t=!1,externalTestResults:n,externalTestingProviders:s,externalTestingTimeLeft:o,onProvidersMutate:i,onTestResultsChange:a,onTestingProvidersChange:l,onTestingTimeLeftChange:c}){const[u,d]=p.useState(!1),[f,h]=p.useState(),[m,v]=p.useState(null),[g,x]=p.useState({}),[b,y]=p.useState(new Set),[k,j]=p.useState({}),[C,T]=p.useState(null),[N,O]=p.useState(!1),[A,z]=p.useState(null),[D,E]=p.useState(!1),[L,w]=p.useState(!1),[$,ee]=p.useState(null),[F,W]=p.useState("all"),[Z,ue]=p.useState(new Set),{providerTestTimeoutSeconds:V}=yl(),H=p.useRef(null),le=p.useRef(null),U=e??[],X=p.useMemo(()=>{const I=F==="all"?U:U.filter(M=>M.source===F);return F==="all"?[...I].sort((M,Y)=>{const re={personal:0,company:1};return(re[M.source??""]??2)-(re[Y.source??""]??2)}):I},[U,F]),Ce=n??g,ae=s??b,ge=o??k,xe=c?(I,M)=>c(I,M):(I,M)=>{j(M===void 0?Y=>{const re={...Y};return delete re[I],re}:Y=>({...Y,[I]:M}))};p.useEffect(()=>{(async()=>{try{const I=await Ke("/api/config/paths",sR,iR);T(I.providerConfig)}catch{}})()},[]);const he=p.useCallback(I=>{le.current!==null&&clearTimeout(le.current),z(I),H.current?.scrollTo({top:H.current.scrollHeight,behavior:"smooth"}),le.current=setTimeout(()=>{z(null),le.current=null},2e3)},[]);p.useEffect(()=>()=>{le.current!==null&&clearTimeout(le.current)},[]);const be=p.useCallback(()=>{i?.().catch(()=>{})},[i]),Se=p.useCallback((I,M)=>{a?a(I,M):x(Y=>({...Y,[I]:M}))},[a]),Ie=p.useCallback((I,M)=>{if(l){l(I,M);return}y(Y=>{const re=new Set(Y);return M?re.add(I):re.delete(I),re})},[l]),_=p.useCallback(async I=>{Se(I,nR()),Ie(I,!0);const M=new AbortController,Y=U.find(pe=>pe.id===I),re=fR(Y,V);let oe=re;xe(I,oe);const ve=setInterval(()=>{oe--,xe(I,oe),oe<=0&&(clearInterval(ve),M.abort())},1e3);try{const pe=await Ke(`/api/providers/${I}/test`,tR,re*1e3+1e3,{method:"POST",signal:M.signal},me=>`HTTP ${me.status}: ${me.statusText}`);Se(I,pe),await pR(I,pe)}catch(pe){const me=pe instanceof Error&&pe.name==="AbortError",Ae=pe instanceof Vo;me||Ae?Se(I,dd("Request timed out","timeout")):pe instanceof Error&&Se(I,dd(pe.message,"server_error"))}finally{clearInterval(ve),xe(I,void 0),Ie(I,!1)}},[V,U,xe,Se,Ie]),Q=p.useCallback(async(I,M,Y=!0)=>{ue(re=>{const oe=new Set(re);return oe.add(I),oe});try{const re=M!==void 0&&M.trim()!==""?{url:M}:{},oe=await Ke(`/api/providers/${I}/model-metadata`,oR,dR,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)},()=>"Failed to refresh model metadata");return oe.imported===0&&Y?v("No matching model metadata found for this provider."):v(null),he(oe.provider.id),be(),oe.imported>0}catch(re){return Y&&v(re instanceof Error?re.message:Hr),!1}finally{ue(re=>{const oe=new Set(re);return oe.delete(I),oe})}},[be,he]);function G(I){(async()=>{try{const M=await Ke("/api/providers",xo,fd,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(pd(I))},()=>"Failed to add provider");d(!1),he(M.id),I.modelMetadataUrl!==void 0&&I.modelMetadataUrl.trim()!==""&&await Q(M.id,I.modelMetadataUrl,!1),be(),await _(M.id)}catch(M){v(M instanceof Error?M.message:Hr)}})()}function P(I){f&&(async()=>{try{const M=await Ke(`/api/providers/${f.id}`,xo,fd,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(pd(I))},()=>"Failed to update provider");h(void 0),he(M.id),I.modelMetadataUrl!==void 0&&I.modelMetadataUrl.trim()!==""&&await Q(M.id,I.modelMetadataUrl,!1),be(),((I.apiKey??"")!==(f.apiKey??"")||JSON.stringify(I.models)!==JSON.stringify(f.models)||(I.anthropicBaseUrl??"")!==(f.anthropicBaseUrl??"")||(I.openaiBaseUrl??"")!==(f.openaiBaseUrl??"")||(I.openaiResponsesBaseUrl??"")!==(f.openaiResponsesBaseUrl??""))&&await _(M.id)}catch(M){v(M instanceof Error?M.message:Hr)}})()}function R(I){ee(I),w(!0)}function B(){const I=$;I!==null&&(async()=>{let M;try{M=await Dn(`/api/providers/${I}`,lR,{method:"DELETE"})}catch{v(Hr);return}if(!M.ok){v(await dl(M,"Failed to delete provider"));return}be()})()}const se=p.useRef(null);function ne(I){const M="/api/providers/export";(async()=>{try{const Y=await Dn(M,cR);if(!Y.ok){v("Failed to export providers");return}const re=await Y.blob(),oe=URL.createObjectURL(re),ve=document.createElement("a");ve.href=oe,ve.download=Y.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]??"providers.json",document.body.appendChild(ve),ve.click(),document.body.removeChild(ve),URL.revokeObjectURL(oe)}catch{v("Failed to export providers")}})()}function q(){se.current?.click()}function ce(I){const M=I.target.files?.[0];M&&(async()=>{try{const Y=await M.text(),re=await Dn("/api/providers/import",uR,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Y)}),oe=await ul(re,rR);re.ok&&oe.imported!==void 0&&oe.imported>0?(be(),v(null)):oe.errors&&oe.errors.length>0?v(oe.errors.join("; ")):v(oe.message??"Import failed")}catch{v("Failed to import providers")}I.target.value=""})()}return t?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading providers..."})}):u||f?r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"sticky top-0 z-10 flex items-center justify-between gap-3 rounded-[8px] bg-background/95 px-1 py-1 backdrop-blur",children:r.jsx("h3",{className:"text-lg font-medium",children:f?"Edit Provider":"Add New Provider"})}),r.jsx(G6,{provider:f,onSubmit:f?P:G,onCancel:()=>{d(!1),h(void 0)}})]}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between gap-3 rounded-[8px] bg-background/95 px-1 py-1 backdrop-blur",children:[r.jsx("h3",{className:"text-lg font-medium",children:"Providers"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ke,{variant:"outline",size:"sm",onClick:()=>ne(),className:"gap-1 hover:bg-muted",children:[r.jsx(dr,{className:"size-3"}),"Export"]}),r.jsxs(ke,{variant:"outline",size:"sm",onClick:q,className:"gap-1 hover:bg-muted",children:[r.jsx(ep,{className:"size-3"}),"Import"]}),r.jsx("input",{type:"file",ref:se,accept:".json",onChange:ce,style:{display:"none"}}),r.jsxs(ke,{variant:"outline",size:"sm",onClick:()=>E(!0),className:"gap-1",children:[r.jsx(n_,{className:"size-3"}),"Scan"]}),r.jsxs(ke,{onClick:()=>d(!0),size:"sm",className:"gap-1",children:[r.jsx(da,{className:"size-4"}),"Add Provider"]})]})]}),C!==null&&r.jsxs("div",{className:"flex items-center gap-2 rounded-[8px] bg-muted/15 px-3 py-2 text-xs text-muted-foreground",children:[r.jsx("span",{className:"shrink-0",children:"Config:"}),r.jsx("span",{className:"font-mono truncate",title:C,children:C}),r.jsx("button",{type:"button",onClick:()=>{Nt(C).then(I=>{I&&(O(!0),setTimeout(()=>O(!1),2e3))})},className:"ml-auto shrink-0 text-muted-foreground transition-colors hover:text-foreground","aria-label":N?"Copied config file path":"Copy config file path",children:N?r.jsx(Ge,{className:"size-3 text-cyan-300"}):r.jsx(At,{className:"size-3"})})]}),m!==null&&r.jsxs("div",{className:"border border-border bg-card shadow-sm flex items-center gap-2 rounded-[8px] px-3 py-2 text-sm text-destructive",children:[r.jsx(_s,{className:"size-4 shrink-0"}),m]}),U.length===0?r.jsxs("div",{className:"border border-border bg-card shadow-sm space-y-3 rounded-[8px] py-12 text-center",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"No providers configured yet."}),r.jsxs(ke,{onClick:()=>d(!0),variant:"outline",size:"sm",children:[r.jsx(da,{className:"size-4"}),"Add Your First Provider"]})]}):r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"inline-flex w-fit gap-1 rounded-[8px] bg-muted/20 p-1",children:["all","personal","company"].map(I=>r.jsx("button",{type:"button",onClick:()=>W(I),className:`rounded-md px-3 py-1.5 text-sm font-medium transition-colors ${F===I?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:I==="all"?"All":I==="personal"?"Personal":"Company"},I))}),r.jsx("div",{ref:H,className:"space-y-3",children:X.map(I=>r.jsx(M6,{provider:I,testResults:Ce[I.id],isTesting:ae.has(I.id),testingTimeLeft:ge[I.id],isHighlighted:I.id===A,onEdit:M=>h(M),onDelete:R,onRefreshMetadata:M=>{Q(M)},isRefreshingMetadata:Z.has(I.id),onTest:M=>{_(M)}},I.id))})]}),r.jsx(g6,{open:D,onOpenChange:E,onImportComplete:()=>{i!==void 0&&i()}}),r.jsx(Xp,{open:L,onOpenChange:w,title:"Delete Provider",description:"Are you sure you want to delete this provider? This action cannot be undone.",confirmLabel:"Delete",variant:"destructive",onConfirm:B})]})}function hd(){const[e,t]=p.useState(!1),[n,s]=p.useState("providers"),{providers:o,isLoading:i,mutate:a}=vp(),[l,c]=p.useState({}),[u,d]=p.useState(new Set),[f,h]=p.useState({}),m=p.useCallback((x,b)=>{c(y=>({...y,[x]:b}))},[]),v=p.useCallback((x,b)=>{d(y=>{const k=new Set(y);return b?k.add(x):k.delete(x),k})},[]),g=p.useCallback((x,b)=>{h(y=>{if(b===void 0){const k={...y};return delete k[x],k}return{...y,[x]:b}})},[]);return r.jsxs(Gn,{open:e,onOpenChange:t,children:[r.jsx(Xo,{asChild:!0,children:r.jsxs(ke,{variant:"ghost",size:"icon",className:vi,"aria-label":"Settings",title:"Settings",children:[r.jsx(a_,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"Settings"})]})}),r.jsxs(Kn,{className:"flex max-h-[80vh] max-w-2xl flex-col overflow-hidden",children:[r.jsx(Jn,{children:r.jsx(Yn,{children:"Settings"})}),r.jsxs(r0,{value:n,onValueChange:s,className:"flex-1 overflow-hidden",children:[r.jsxs(o0,{className:"w-full justify-start bg-muted/35",children:[r.jsx(St,{value:"providers",children:"Providers"}),r.jsx(St,{value:"proxy",children:"Proxy"}),r.jsx(St,{value:"storage",children:"Storage"}),r.jsx(St,{value:"mcp",children:"MCP"}),r.jsx(St,{value:"onboarding",children:"Onboarding"})]}),r.jsxs("div",{className:"mt-4 flex-1 overflow-x-hidden overflow-y-auto pr-2",children:[r.jsx(Ct,{value:"providers",children:r.jsx(hR,{externalProviders:o,isLoading:i,externalTestResults:l,externalTestingProviders:u,externalTestingTimeLeft:f,onProvidersMutate:()=>a(),onTestResultsChange:m,onTestingProvidersChange:v,onTestingTimeLeftChange:g})}),r.jsx(Ct,{value:"proxy",children:r.jsx(yR,{})}),r.jsx(Ct,{value:"storage",children:r.jsx(xR,{})}),r.jsx(Ct,{value:"mcp",children:r.jsx(vR,{})}),r.jsx(Ct,{value:"onboarding",children:r.jsx(bR,{})})]})]})]})]})}const mR=J({memoryCount:K(),logDir:S(),logFileCount:K(),logBytes:K(),chunkDir:S(),chunkFileCount:K(),chunkBytes:K(),sessionArchiveDir:S(),sessionArchiveFileCount:K(),sessionArchiveBytes:K()}),gR=1e4;function Qi(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 xR(){const[e,t]=p.useState(null),[n,s]=p.useState(null),[o,i]=p.useState(!1),[a,l]=p.useState(null),c=p.useCallback(async()=>{i(!0),s(null);try{const d=await Ke("/api/logs?stats=1",mR,gR,void 0,f=>`Failed to load storage stats: HTTP ${String(f.status)}`);t(d)}catch(d){s(d instanceof Error?d.message:String(d))}finally{i(!1)}},[]);p.useEffect(()=>{c()},[c]);const u=p.useCallback((d,f)=>{Nt(f).then(h=>{h&&(l(d),setTimeout(()=>l(null),1600))})},[]);return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"Log storage"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Inspect local log and streaming chunk footprint before exporting or clearing sessions."})]}),r.jsx(ke,{type:"button",variant:"outline",size:"sm",onClick:()=>{c()},children:o?"Refreshing...":"Refresh"})]}),e!==null&&r.jsxs("div",{className:"grid gap-2 text-xs",children:[r.jsx(Gs,{id:"log-dir",label:"Log storage path",value:e.logDir,copiedId:a,onCopy:u}),r.jsx(Gs,{id:"chunk-dir",label:"Streaming chunks storage path",value:e.chunkDir,copiedId:a,onCopy:u}),r.jsx(Gs,{id:"session-archive-dir",label:"Session archive storage path",value:e.sessionArchiveDir,copiedId:a,onCopy:u}),r.jsxs("div",{className:"rounded-md bg-muted/20 px-3 py-2",children:[r.jsx("div",{className:"font-medium",children:"In-memory logs"}),r.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.memoryCount.toLocaleString()," loaded"]})]}),r.jsxs("div",{className:"rounded-md bg-muted/20 px-3 py-2",children:[r.jsx("div",{className:"font-medium",children:"Log files"}),r.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.logFileCount.toLocaleString()," files / ",Qi(e.logBytes)]})]}),r.jsxs("div",{className:"rounded-md bg-muted/20 px-3 py-2",children:[r.jsx("div",{className:"font-medium",children:"Streaming chunks"}),r.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.chunkFileCount.toLocaleString()," files / ",Qi(e.chunkBytes)]})]}),r.jsxs("div",{className:"rounded-md bg-muted/20 px-3 py-2",children:[r.jsx("div",{className:"font-medium",children:"Session archives"}),r.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.sessionArchiveFileCount.toLocaleString()," files /"," ",Qi(e.sessionArchiveBytes)]})]})]}),n!==null&&r.jsx("p",{className:"text-xs text-destructive",children:n})]})}function Gs({id:e,label:t,value:n,copiedId:s,onCopy:o}){const i=s===e;return r.jsxs("div",{className:"min-w-0 rounded-md border border-border/45 bg-muted/15 px-3 py-2 transition-colors hover:bg-muted/25",children:[r.jsx("div",{className:"mb-1 text-xs font-medium text-muted-foreground",children:t}),r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:n}),r.jsx(ke,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0",onClick:()=>o(e,n),"aria-label":i?`Copied ${t}`:`Copy ${t}`,children:i?r.jsx(Ge,{className:"size-3.5 text-emerald-500"}):r.jsx(At,{className:"size-3.5"})})]})]})}function bR(){const[e,t]=p.useState(null),n=p.useMemo(()=>typeof window>"u"?"http://localhost:9527":window.location.origin,[]),s=p.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:"mimo-config",label:"MiMo Code config",value:"agent-inspector onboard --mimo-only"},{id:"mimo-status",label:"MiMo Code status",value:"agent-inspector onboard --status --mimo-only"},{id:"mimo-verify",label:"MiMo Code verify",value:"mimo mcp list"},{id:"mimo-proxy",label:"MiMo Code proxy",value:`OPENAI_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=p.useCallback((i,a)=>{Nt(a).then(l=>{l&&(t(i),setTimeout(()=>t(null),1600))})},[]);return r.jsxs("div",{className:"min-w-0 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Es,{className:"size-4 text-muted-foreground"}),r.jsx("h3",{className:"text-sm font-semibold",children:"Agent onboarding"})]}),r.jsx("div",{className:"grid gap-2",children:s.map(i=>r.jsx(Gs,{id:i.id,label:i.label,value:i.value,copiedId:e,onCopy:o},i.id))}),r.jsxs("div",{className:"grid gap-2 rounded-md bg-muted/15 px-3 py-2 text-xs text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ge,{className:"size-3.5 text-emerald-500"}),r.jsx("span",{children:"Provider test creates a traceable memory probe session."})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ge,{className:"size-3.5 text-emerald-500"}),r.jsx("span",{children:"Captured sessions can produce reviewable memory candidates."})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Ge,{className:"mt-0.5 size-3.5 text-emerald-500"}),r.jsxs("span",{children:["Streamable HTTP clients should use the MCP URL directly. Stdio-only clients should use",r.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."]})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Ge,{className:"mt-0.5 size-3.5 text-emerald-500"}),r.jsxs("span",{children:["OpenCode onboarding safely merges"," ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[11px] text-foreground",children:"mcp.agent-inspector"})," ","into"," ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[11px] text-foreground",children:"opencode.json"}),", then verify with"," ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[11px] text-foreground",children:"opencode mcp list"}),"."]})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Ge,{className:"mt-0.5 size-3.5 text-emerald-500"}),r.jsxs("span",{children:["MiMo Code onboarding safely merges"," ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[11px] text-foreground",children:"mcp.agent-inspector"})," ","into"," ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[11px] text-foreground",children:"mimocode.jsonc"}),", then route OpenAI-format traffic with"," ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[11px] text-foreground",children:"OPENAI_BASE_URL"}),"."]})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Ge,{className:"mt-0.5 size-3.5 text-emerald-500"}),r.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 vR(){const[e,t]=p.useState(null),s=`${p.useMemo(()=>typeof window>"u"?"http://localhost:9527":window.location.origin,[])}/api/mcp`,o=p.useMemo(()=>[{id:"mcp-url",label:"Streamable HTTP MCP URL",value:s},{id:"stdio",label:"Stdio bridge command",value:`agent-inspector-mcp stdio --url ${s}`},{id:"doctor",label:"Bridge doctor",value:`agent-inspector-mcp doctor --url ${s}`},{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:s}}},null,2)},{id:"stdio-json",label:"Stdio MCP JSON",value:JSON.stringify({mcpServers:{"agent-inspector":{command:"agent-inspector-mcp",args:["stdio","--url",s]}}},null,2)},{id:"opencode-local",label:"OpenCode local MCP",value:JSON.stringify({mcp:{"agent-inspector":{type:"local",command:["agent-inspector-mcp","stdio","--url",s],enabled:!0}}},null,2)},{id:"mimo-local",label:"MiMo Code local MCP",value:JSON.stringify({mcp:{"agent-inspector":{type:"local",command:["agent-inspector-mcp","stdio","--url",s],enabled:!0}}},null,2)},{id:"codex-toml",label:"Codex TOML",value:`[mcp_servers.agent-inspector]
|
|
99
|
+
`)&&(n=n.slice(0,-1))),super.equals(t,n,s)}}const kT=new _T;function l0(e,t,n){return kT.diff(e,t,n)}function c0(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
100
|
+
`));const n=[],s=e.split(/(\n|\r\n)/);s[s.length-1]||s.pop();for(let o=0;o<s.length;o++){const i=s[o];o%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}class jT extends a0{constructor(){super(...arguments),this.tokenize=c0}get useLongestToken(){return!0}castInput(t,n){const{undefinedReplacement:s,stringifyReplacer:o=(i,a)=>typeof a>"u"?s:a}=n;return typeof t=="string"?t:JSON.stringify(Da(t,null,null,o),null," ")}equals(t,n,s){return super.equals(t.replace(/,([\r\n])/g,"$1"),n.replace(/,([\r\n])/g,"$1"),s)}}const ST=new jT;function CT(e,t,n){return ST.diff(e,t,n)}function Da(e,t,n,s,o){t=t||[],n=n||[],s&&(e=s(o===void 0?"":o,e));let i;for(i=0;i<t.length;i+=1)if(t[i]===e)return n[i];let a;if(Object.prototype.toString.call(e)==="[object Array]"){for(t.push(e),a=new Array(e.length),n.push(a),i=0;i<e.length;i+=1)a[i]=Da(e[i],t,n,s,String(i));return t.pop(),n.pop(),a}if(e&&e.toJSON&&(e=e.toJSON()),typeof e=="object"&&e!==null){t.push(e),a={},n.push(a);const l=[];let c;for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&l.push(c);for(l.sort(),i=0;i<l.length;i+=1)c=l[i],a[c]=Da(e[c],t,n,s,c);t.pop(),n.pop()}else a=e;return a}function $u(e){return e===void 0?[]:Object.entries(e).map(t=>[t[0].toLowerCase(),t[1]]).sort(([t],[n])=>t.localeCompare(n))}function Fu([e,t]){return`${e}: ${t}`}function $a(e){const t=[];let n=0,s=0;for(const o of e){const i=o.value.split(`
|
|
101
|
+
`);i.length>0&&i[i.length-1]===""&&i.pop();for(const a of i)o.added?(s+=1,t.push({kind:"added",text:a,oldLineNumber:null,newLineNumber:s})):o.removed?(n+=1,t.push({kind:"removed",text:a,oldLineNumber:n,newLineNumber:null})):(n+=1,s+=1,t.push({kind:"context",text:a,oldLineNumber:n,newLineNumber:s}))}return t}function NT(e,t){const n=$u(e).map(Fu).join(`
|
|
102
|
+
`),s=$u(t).map(Fu).join(`
|
|
103
|
+
`);if(n===s)return{lines:[],isEmpty:!0};const o=l0(n,s);return{lines:$a(o),isEmpty:!1}}function Bu(e){try{const t=JSON.parse(e);return t===null||typeof t=="string"||typeof t=="object"?t:null}catch{return null}}function TT(e,t){const n=e??"",s=t??"";if(n===s)return{lines:[],isEmpty:!0};const o=Bu(n),i=Bu(s);if(o!==null&&i!==null){const l=CT(o,i)??[];if(l.length===1){const c=l[0];if(c!==void 0&&!c.added&&!c.removed)return{lines:[],isEmpty:!0}}return{lines:$a(l),isEmpty:!1}}const a=l0(n,s);return{lines:$a(a),isEmpty:!1}}const ET=22,Wi=1e4;function AT(e){return e==="added"?"+":e==="removed"?"-":" "}function RT(e){return e==="added"?"bg-green-500/10 text-green-700 dark:text-green-300":e==="removed"?"bg-red-500/10 text-red-700 dark:text-red-300":"text-foreground/80"}const IT=function({result:t,emptyLabel:n}){const[s,o]=p.useState("unified"),i=p.useRef(null),a=$4({count:t.lines.length,getScrollElement:()=>i.current,estimateSize:()=>ET,overscan:10});if(t.isEmpty)return r.jsx("div",{className:"rounded border border-dashed border-border bg-muted/30 px-4 py-6 text-center text-xs text-muted-foreground","data-testid":"diff-empty",children:n??"No transformation applied — raw and processed are identical."});const l=t.lines.length,c=l>Wi,u=c?t.lines.slice(0,Wi):t.lines;return r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[r.jsxs("span",{children:[l.toLocaleString()," line",l===1?"":"s",c&&` (showing first ${Wi.toLocaleString()})`]}),r.jsxs("div",{className:"inline-flex rounded-md border border-border overflow-hidden",children:[r.jsxs("button",{type:"button",onClick:()=>o("unified"),"aria-pressed":s==="unified",className:ie("flex items-center gap-1 px-2 py-1 transition-colors",s==="unified"?"bg-muted text-foreground":"hover:bg-muted/50"),title:"Unified diff (single column)",children:[r.jsx(e_,{className:"size-3"}),"Unified"]}),r.jsxs("button",{type:"button",onClick:()=>o("split"),"aria-pressed":s==="split",className:ie("flex items-center gap-1 px-2 py-1 transition-colors border-l border-border",s==="split"?"bg-muted text-foreground":"hover:bg-muted/50"),title:"Split diff (side by side)",children:[r.jsx(Zy,{className:"size-3"}),"Split"]})]})]}),r.jsx("div",{ref:i,className:"max-h-[60vh] overflow-auto rounded border border-border bg-background font-mono text-xs","data-testid":"diff-viewport",children:s==="unified"?r.jsx(zT,{virtualizer:a,lines:u}):r.jsx(MT,{lines:u})})]})};function zT({virtualizer:e,lines:t}){return r.jsx("div",{style:{height:`${e.getTotalSize()}px`,width:"100%",position:"relative"},children:e.getVirtualItems().map(n=>{const s=t[n.index];return s===void 0?null:r.jsxs("div",{"data-index":n.index,ref:e.measureElement,className:ie("flex items-start gap-3 px-2",RT(s.kind)),style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${n.start}px)`},children:[r.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:s.oldLineNumber??""}),r.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:s.newLineNumber??""}),r.jsx("span",{className:ie("select-none w-3 text-right font-bold",s.kind==="added"&&"text-green-600 dark:text-green-400",s.kind==="removed"&&"text-red-600 dark:text-red-400"),children:AT(s.kind)}),r.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:s.text})]},n.key)})})}function PT(e){const t=[];let n=0;for(;n<e.length;){const s=e[n];if(s===void 0)break;if(s.kind==="context"){t.push({left:{text:s.text,lineNumber:s.oldLineNumber},right:{text:s.text,lineNumber:s.newLineNumber},kind:"equal"}),n+=1;continue}const o=[],i=[];for(;n<e.length&&e[n]?.kind==="removed";){const l=e[n];l!==void 0&&o.push(l),n+=1}for(;n<e.length&&e[n]?.kind==="added";){const l=e[n];l!==void 0&&i.push(l),n+=1}const a=Math.max(o.length,i.length);for(let l=0;l<a;l+=1){const c=o[l],u=i[l];c!==void 0&&u!==void 0?t.push({left:{text:c.text,lineNumber:c.oldLineNumber},right:{text:u.text,lineNumber:u.newLineNumber},kind:"changed"}):c!==void 0?t.push({left:{text:c.text,lineNumber:c.oldLineNumber},right:null,kind:"removed"}):u!==void 0&&t.push({left:null,right:{text:u.text,lineNumber:u.newLineNumber},kind:"added"})}}return t}function OT(e){switch(e){case"changed":return"bg-amber-500/10";case"removed":return"bg-red-500/10";case"added":return"bg-green-500/10";case"equal":return""}}function MT({lines:e}){const t=PT(e);return r.jsx("div",{"data-testid":"diff-split",children:t.map((n,s)=>r.jsxs("div",{className:ie("grid grid-cols-2 font-mono text-xs",OT(n.kind)),children:[r.jsxs("div",{className:"flex items-start gap-2 px-2 border-r border-border/50",children:[r.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.left?.lineNumber??""}),r.jsx("span",{className:ie("select-none w-3 text-right font-bold",(n.kind==="removed"||n.kind==="changed")&&"text-red-600 dark:text-red-400"),children:n.left!==null?"-":" "}),r.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.left?.text??""})]}),r.jsxs("div",{className:"flex items-start gap-2 px-2",children:[r.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.right?.lineNumber??""}),r.jsx("span",{className:ie("select-none w-3 text-right font-bold",(n.kind==="added"||n.kind==="changed")&&"text-green-600 dark:text-green-400"),children:n.right!==null?"+":" "}),r.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.right?.text??""})]})]},s))})}const u0=p.memo(IT),LT=Ll("inline-flex items-center justify-center rounded-full border border-transparent px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function Me({className:e,variant:t="default",asChild:n=!1,...s}){const o=n?sk:"span";return r.jsx(o,{"data-slot":"badge","data-variant":t,className:ie(LT({variant:t}),e),...s})}const DT={success:"bg-slate-300/[0.08] text-slate-100 border-transparent",client_error:"bg-amber-300/[0.10] text-amber-100 border-transparent",server_error:"bg-rose-400/[0.10] text-rose-100 border-transparent",pending:"bg-cyan-300/[0.08] text-cyan-100 border-transparent"},$T={success:{frame:"border-cyan-200/15 bg-white/[0.04] text-slate-100"},client_error:{frame:"border-amber-300/25 bg-amber-300/[0.08] text-amber-100"},server_error:{frame:"border-rose-300/25 bg-rose-300/[0.08] text-rose-100"},pending:{frame:"border-cyan-300/25 bg-cyan-300/[0.08] text-cyan-100"}},Vs="border border-transparent bg-white/[0.045] hover:bg-white/[0.075] size-8 text-muted-foreground shadow-none hover:text-cyan-100",Mt="bg-white/[0.045] flex h-7 items-center gap-1 rounded-md px-2 text-xs";function qs(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function FT(e){return e>=10?`${e.toFixed(0)}/s`:`${e.toFixed(1)}/s`}function BT(e,t){switch(e){case"success":return t===null?"OK":String(t);case"client_error":return t===null?"WARN":String(t);case"server_error":return t===null?"FAIL":String(t);case"pending":return"ROLL"}}function Uu({trend:e}){if(e===null)return null;const t=e.direction==="up",n=t?ly:ny,s=t?"+":"-";return r.jsxs("span",{className:"flex items-center gap-0.5 text-muted-foreground tabular-nums",children:[r.jsx(n,{className:t?"size-3 text-cyan-300":"size-3 text-rose-400"}),r.jsxs("span",{className:"font-mono",children:[s,Fe(e.delta)]})]})}const UT=p.memo(function({log:e,displayNumber:t,messageCount:n=null,toolCount:s=null,expanded:o,onToggle:i,cacheTrend:a=null,activeTab:l,tabActions:c,onReplay:u,slowResponseThresholdSeconds:d=0,showClientMetadata:f=!0,timeDisplayFormat:h}){const m=Z5(e.responseStatus),v=e.elapsedMs!==null&&d>0&&e.elapsedMs>d*1e3,g=e.inputTokens!==null||e.outputTokens!==null,x=e.firstChunkMs??null,b=e.tokensPerSecond??null,y=x===null?null:qs(x),k=b===null||b<=0?null:FT(b),j=e.warnings?.length??0,C=e.clientPid!==null&&e.clientPid!==void 0,T=e.clientProjectFolder!==null&&e.clientProjectFolder!==void 0&&e.clientProjectFolder!=="";e.clientCwd!==null&&e.clientCwd!==void 0&&e.clientCwd;const N=$T[m],P=BT(m,e.responseStatus),A=m!=="success"||e.responseStatus!==200,z=e.streaming&&y===null&&k===null;return r.jsx(jn,{children:r.jsxs("div",{id:`log-${e.id}`,role:"button",tabIndex:0,"data-nav-id":`log-${e.id}`,"data-nav-action":o?"collapse":"expand",className:ie("group/header relative isolate flex min-w-0 cursor-pointer items-start gap-2 overflow-hidden px-3 py-2 transition-[background-color,border-color,box-shadow]",o?"bg-white/[0.04]":"bg-transparent hover:bg-white/[0.035]","select-none","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),onClick:i,onKeyDown:D=>{(D.key==="Enter"||D.key===" ")&&(D.preventDefault(),i())},children:[r.jsxs("span",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1",children:[r.jsx("span",{className:ie("inline-flex h-8 shrink-0 items-center rounded-md px-2 font-mono",N.frame),children:r.jsxs("span",{className:"text-xs font-semibold tabular-nums",title:`Log ID ${String(e.id)}`,children:["#",t]})}),r.jsxs("span",{className:"bg-white/[0.045] flex h-7 shrink-0 items-center gap-1 rounded-md px-2 text-xs text-muted-foreground",children:[r.jsx(sn,{className:"size-3"}),r.jsx("span",{className:"font-mono tabular-nums",title:e.timestamp,children:ga(e.timestamp,h)})]}),A&&r.jsxs(Me,{variant:"outline",className:ie("h-6 gap-1 rounded-md px-2 py-0 font-mono text-[10px] font-semibold uppercase tabular-nums shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]",DT[m]),children:[m==="success"?r.jsx(Ge,{className:"size-3","aria-label":"Success"}):m==="server_error"?r.jsx(Dw,{className:"size-3","aria-label":"Server error"}):m==="client_error"?r.jsx(rn,{className:"size-3","aria-label":"Client error"}):r.jsx(Xe,{className:"size-3 animate-spin","aria-label":"Pending"}),P]}),j>0&&r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsxs(Me,{variant:"outline",className:"h-6 gap-1 rounded-md border-amber-300/30 bg-amber-300/[0.10] px-2 py-0 font-mono text-[10px] tabular-nums text-amber-100",children:[r.jsx(rn,{className:"size-3","aria-label":"Tool schema warnings"}),j]})}),r.jsx(dt,{children:j===1?"1 tool schema warning":`${j} tool schema warnings`})]}),e.elapsedMs!==null&&(v?r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsxs("span",{className:ie(Mt,"shrink-0 border-amber-300/25 text-amber-200"),children:[r.jsx(sn,{className:"size-3"}),r.jsx("span",{className:"font-mono tabular-nums",children:qs(e.elapsedMs)}),r.jsx(rn,{className:"size-3","aria-label":"Slow response"})]})}),r.jsxs(dt,{children:["Slow response: ",qs(e.elapsedMs)," exceeds"," ",qs(d*1e3)]})]}):r.jsxs("span",{className:ie(Mt,"shrink-0 text-muted-foreground"),children:[r.jsx(sn,{className:"size-3"}),r.jsx("span",{className:"font-mono tabular-nums",children:qs(e.elapsedMs)})]})),e.streaming&&y!==null&&r.jsxs("span",{className:ie(Mt,"shrink-0 text-cyan-300"),children:[r.jsx(Hc,{className:"size-3"}),r.jsxs("span",{className:"font-mono tabular-nums",children:["first ",y]})]}),e.streaming&&k!==null&&r.jsxs("span",{className:ie(Mt,"shrink-0 text-cyan-300"),children:[r.jsx(Nl,{className:"size-3"}),r.jsx("span",{className:"font-mono tabular-nums",children:k})]}),g&&r.jsxs("span",{className:ie(Mt,"min-w-0 sm:shrink-0"),children:[r.jsx(or,{className:"size-3 text-muted-foreground"}),r.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-x-1 font-mono tabular-nums",children:[r.jsxs("span",{className:ie("whitespace-nowrap",e.inputTokens!==null?"text-blue-400":"text-muted-foreground"),children:["IN ",e.inputTokens!==null?Fe(e.inputTokens):"n/a"]}),r.jsx("span",{className:"text-muted-foreground",children:"/"}),r.jsxs("span",{className:ie("whitespace-nowrap",e.outputTokens!==null?"text-amber-400":"text-muted-foreground"),children:["OUT ",e.outputTokens!==null?Fe(e.outputTokens):"n/a"]})]})]}),e.cacheCreationInputTokens!==null&&e.cacheCreationInputTokens>0&&r.jsxs("span",{className:ie(Mt,"shrink-0"),children:[r.jsx(Uu,{trend:a?.creation??null}),r.jsxs("span",{className:"font-mono tabular-nums text-cyan-300",children:["KV Cache +",Fe(e.cacheCreationInputTokens)]})]}),e.cacheReadInputTokens!==null&&e.cacheReadInputTokens>0&&r.jsxs("span",{className:ie(Mt,"shrink-0"),children:[r.jsx(Uu,{trend:a?.read??null}),r.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["KV Cache ~",Fe(e.cacheReadInputTokens)]})]}),n!==null&&r.jsxs("span",{className:ie(Mt,"shrink-0 text-muted-foreground"),children:[r.jsx(Zo,{className:"size-3"}),r.jsx("span",{className:"font-mono tabular-nums",children:n})]}),s!==null&&r.jsxs("span",{className:ie(Mt,"shrink-0 text-muted-foreground"),children:[r.jsx(Ps,{className:"size-3"}),r.jsx("span",{className:"font-mono tabular-nums",children:s})]}),e.origin!==null&&r.jsxs("span",{className:ie(Mt,"hidden shrink-0 text-muted-foreground xl:flex"),title:`Origin: ${e.origin}`,children:[r.jsx(Jf,{className:"size-3"}),r.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",title:e.origin,children:e.origin})]}),f&&(C||T)&&r.jsxs("span",{className:ie(Mt,"hidden shrink-0 text-purple-300 xl:flex"),children:[r.jsx(uw,{className:"size-3"}),T?r.jsx("span",{className:"font-mono tabular-nums",children:e.clientProjectFolder}):r.jsxs("span",{className:"font-mono tabular-nums",children:["PID ",e.clientPid]})]}),z&&r.jsx(Hc,{className:"size-3 shrink-0 text-muted-foreground/60"})]}),r.jsxs("span",{className:"flex shrink-0 items-start gap-1.5",children:[o&&r.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",onClick:D=>D.stopPropagation(),onKeyDown:D=>D.stopPropagation(),children:[c!==void 0&&l!==void 0&&(()=>{const D=c[l];return D===void 0?null:r.jsxs(r.Fragment,{children:[D.expansion!==null&&r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsx(ke,{variant:"outline",size:"icon",className:Vs,onClick:D.expansion.onToggle,disabled:D.expansion.isPending,"aria-pressed":D.expansion.isExpanded,"aria-label":D.expansion.isExpanded?"Collapse all JSON":"Expand all JSON",children:D.expansion.isExpanded?r.jsx(Ay,{className:"size-3.5"}):r.jsx(jy,{className:"size-3.5"})})}),r.jsx(dt,{children:D.expansion.isExpanded?"Collapse all JSON nodes":"Expand all JSON nodes"})]}),D.diffWithRaw!==void 0&&r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsx(ke,{variant:"outline",size:"icon",className:ie(Vs,D.diffWithRaw.active&&"border-cyan-300/35 bg-cyan-400/15 text-cyan-100"),onClick:D.diffWithRaw.onToggle,"aria-pressed":D.diffWithRaw.active,"aria-label":D.diffWithRaw.active?"Hide raw diff":"Diff with raw",children:r.jsx(iw,{className:"size-3.5"})})}),r.jsx(dt,{children:D.diffWithRaw.active?"Hide diff with raw request":"Show diff between displayed and raw request body"})]}),D.diffWithPrevious!==void 0&&r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsx(ke,{variant:"outline",size:"icon",className:Vs,onClick:D.diffWithPrevious,"aria-label":"Diff with previous",children:r.jsx(Yf,{className:"size-3.5"})})}),r.jsx(dt,{children:"Compare this request with the immediately preceding one"})]}),D.copyText!==null&&r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsx(ke,{variant:"outline",size:"icon",className:Vs,onClick:D.onCopy,"aria-label":D.copyCopied?"Copied":D.copyLabel,children:D.copyCopied?r.jsx(Ge,{className:"size-3.5 text-cyan-300"}):r.jsx(Rt,{className:"size-3.5"})})}),r.jsx(dt,{children:D.copyCopied?"Copied to clipboard":D.copyLabel})]})]})})(),u!==void 0&&r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsx(ke,{variant:"outline",size:"icon",className:Vs,onClick:u,"aria-label":"Replay request",children:r.jsx(Yw,{className:"size-3.5"})})}),r.jsx(dt,{children:"Re-send this request to the provider"})]})]}),r.jsx("span",{className:"bg-white/[0.045] hover:bg-white/[0.075] inline-flex size-8 shrink-0 items-center justify-center rounded-md text-slate-200","aria-hidden":"true",children:o?r.jsx(ot,{className:"size-4 shrink-0"}):r.jsx(Et,{className:"size-4 shrink-0"})})]})]})})});function WT({...e}){return r.jsx(pS,{"data-slot":"collapsible",...e})}function zz({...e}){return r.jsx(oh,{"data-slot":"collapsible-trigger",...e})}function HT({...e}){return r.jsx(ih,{"data-slot":"collapsible-content",...e})}function VT({className:e,children:t,...n}){return r.jsxs(o3,{"data-slot":"scroll-area",className:ie("relative overflow-hidden",e),...n,children:[r.jsx(i3,{"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}),r.jsx(qT,{}),r.jsx(a3,{})]})}function qT({className:e,orientation:t="vertical",...n}){return r.jsx(Uh,{"data-slot":"scroll-area-scrollbar",orientation:t,className:ie("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:r.jsx(qh,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}const d0={file:"file",shell:"shell",browser:"browser",web:"web",mcp:"MCP",code:"code",other:"other"},ZT={file:"border-transparent bg-blue-400/5 text-blue-300",shell:"border-transparent bg-teal-400/5 text-teal-300",browser:"border-transparent bg-cyan-400/5 text-cyan-300",web:"border-transparent bg-sky-400/5 text-sky-300",mcp:"border-transparent bg-violet-400/5 text-violet-300",code:"border-transparent bg-emerald-400/5 text-emerald-300",other:"border-transparent bg-muted/30 text-muted-foreground"};function GT({category:e}){switch(e){case"file":return r.jsx(fw,{className:"size-3.5"});case"shell":return r.jsx(zs,{className:"size-3.5"});case"browser":return r.jsx(Pw,{className:"size-3.5"});case"web":return r.jsx(Jf,{className:"size-3.5"});case"mcp":return r.jsx(py,{className:"size-3.5"});case"code":return r.jsx(Vy,{className:"size-3.5"});case"other":return r.jsx(Qy,{className:"size-3.5"})}}function KT({names:e}){return e.length===0?null:r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"required"}),e.slice(0,4).map(t=>r.jsx(Me,{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&&r.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:["+",e.length-4]})]})}function JT({tool:e,called:t}){const[n,s]=p.useState(!1),o=gn(e.name),i=e.description!==null||e.requiredParameters.length>0||e.schema!==null;return r.jsx(WT,{open:n,onOpenChange:s,children:r.jsxs("div",{className:"bg-white/[0.035] rounded-[8px]",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-2.5 py-2",children:[r.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:()=>s(a=>!a),"aria-expanded":n,disabled:!i,children:[r.jsx(GT,{category:e.category}),r.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold text-foreground/90",children:e.name}),t&&r.jsx(Me,{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"}),r.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:[e.parameterCount," params"]}),e.descriptionPreview!==null&&r.jsx("span",{className:"hidden min-w-0 truncate text-xs text-muted-foreground md:inline",children:e.descriptionPreview}),r.jsx("span",{className:"flex-1"}),i&&(n?r.jsx(ot,{className:"size-3.5 shrink-0 text-muted-foreground"}):r.jsx(Et,{className:"size-3.5 shrink-0 text-muted-foreground"}))]}),r.jsx("button",{type:"button",className:"bg-white/[0.045] hover:bg-white/[0.075] inline-flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors 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?r.jsx(Ge,{className:"size-3.5 text-emerald-400"}):r.jsx(Rt,{className:"size-3.5"})})]}),r.jsx(HT,{children:n&&r.jsxs("div",{className:"space-y-2 bg-white/[0.025] px-2.5 py-2",children:[e.description!==null&&r.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:e.description}),r.jsx(KT,{names:e.requiredParameters}),e.schema!==null&&r.jsx(VT,{className:"bg-black/[0.16] max-h-64 rounded-[8px] p-2",children:r.jsx(p.Suspense,{fallback:r.jsx("div",{className:"text-xs text-muted-foreground",children:"Loading JSON..."}),children:r.jsx(La,{data:Ro(e.schema),defaultExpandDepth:0})})})]})})]})})}function YT(e,t){return t.length===0?!0:`${e.name} ${e.description??""} ${d0[e.category]}`.toLowerCase().trim().includes(t)}const XT=p.memo(function({summary:t,calledToolNames:n}){const[s,o]=p.useState(!1),[i,a]=p.useState(""),l=p.useMemo(()=>new Set(n),[n]),c=i.trim().toLowerCase(),u=p.useMemo(()=>t===null?[]:t.tools.filter(h=>YT(h,c)),[c,t]);if(t===null)return null;const d=t.tools.slice(0,6),f=t.tools.length-d.length;return r.jsxs("section",{className:"bg-black/[0.10] mb-3 overflow-hidden rounded-[8px]",children:[r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 px-3 py-2",children:[r.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[r.jsx(Ps,{className:"size-4 shrink-0 text-sky-300/80"}),r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[r.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Request Tools"}),r.jsx(Me,{variant:"outline",className:"h-5 rounded-md px-1.5 py-0 font-mono text-[10px]",children:t.tools.length}),t.toolChoiceLabel!==null&&r.jsxs(Me,{variant:"outline",className:"h-5 rounded-md px-1.5 py-0 font-mono text-[10px] text-muted-foreground",children:["tool_choice: ",t.toolChoiceLabel]})]}),r.jsx("div",{className:"mt-1 flex min-w-0 flex-wrap gap-1",children:t.categories.map(h=>r.jsxs(Me,{variant:"outline",className:ie("h-5 rounded-md px-1.5 py-0 font-mono text-[10px]",ZT[h.category]),children:[h.count," ",d0[h.category]]},h.category))})]})]}),r.jsxs(ke,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-muted-foreground hover:text-cyan-100",onClick:()=>o(h=>!h),"aria-expanded":s,children:[s?r.jsx(ot,{className:"size-3.5"}):r.jsx(Et,{className:"size-3.5"}),s?"Hide":"Show"]})]}),r.jsxs("div",{className:"flex min-w-0 flex-wrap gap-1.5 bg-white/[0.025] px-3 py-2",children:[d.map(h=>r.jsx(Me,{variant:"outline",className:ie("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&&r.jsxs("span",{className:"font-mono text-[10px] leading-5 text-muted-foreground",children:["+",f]})]}),s&&r.jsxs("div",{className:"space-y-2 bg-black/10 px-3 py-3",children:[r.jsxs("label",{className:"bg-white/[0.045] hover:bg-white/[0.075] flex h-8 items-center gap-2 rounded-md px-2 text-xs",children:[r.jsx(tp,{className:"size-3.5 shrink-0 text-muted-foreground"}),r.jsx("input",{value:i,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"})]}),r.jsx("div",{className:"grid gap-1.5",children:u.length>0?u.map(h=>r.jsx(JT,{tool:h,called:l.has(h.name)},h.name)):r.jsx("p",{className:"py-2 text-xs text-muted-foreground",children:"No matching tools"})})]})]})});function Wu(e,t,n){return e==="anthropic"&&t==="full"&&n}function QT(e,t){return e==="full"&&t}function eE(e,t,n,s){return e==="anthropic"&&t==="full"&&n&&s}function is(){return r.jsx("div",{className:"h-1","aria-hidden":"true"})}function tE(e,t){switch(e){case"anatomy":return t===null?"request":"anatomy";case"request":return"request";case"response":return"parsed"}}const nE=15e3,sE=15e3,rE=256*1024,Io=1024*1024,zn="h-9 flex-none rounded-md border border-transparent bg-transparent px-3 text-xs font-semibold text-muted-foreground shadow-none transition-colors hover:bg-white/[0.045] hover:text-foreground data-[state=active]:bg-cyan-300/[0.08] data-[state=active]:text-cyan-100 data-[state=active]:shadow-none";function $r(e=null){return{status:"idle",text:"",offset:0,totalBytes:e,hasMore:e!==null&&e>0,error:null}}function zo(e){return e??0}function f0(e){return e.bodyContentMode==="compact"||e.bodyContentMode==="truncated"}function p0(e){return f0(e)?zo(e.rawRequestBodyBytes)>Io||zo(e.responseTextBytes)>Io:!1}function oE(e){return f0(e)&&!p0(e)}function iE(e){return e instanceof Vo?"Body preview timed out. The log is still available on disk; try loading again.":e instanceof Error?e.message:"Body preview could not be loaded."}function Fr({status:e,error:t,footprint:n,onRetry:s}){switch(e){case"idle":return null;case"loading":return r.jsx(fr,{tone:"loading",title:"Loading full bodies",children:r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(Xe,{className:"size-3.5 shrink-0 animate-spin text-cyan-200"}),r.jsx("span",{children:"Loading full request and response bodies from the log store."})]}),n!==null&&r.jsx("span",{className:"rounded border border-cyan-300/15 bg-cyan-300/[0.06] px-2 py-0.5 font-mono text-[11px] text-cyan-100",children:n})]})});case"failed":return r.jsx(fr,{tone:"warning",title:t?.title??"Full bodies could not be loaded",children:r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsx("span",{children:t?.detail??"Compact metadata is still available."}),r.jsxs(ke,{type:"button",variant:"outline",size:"sm",className:"border border-input bg-background hover:bg-accent hover:text-accent-foreground h-7 gap-1.5 text-xs text-amber-100",onClick:s,children:[r.jsx(yn,{className:"size-3"}),"Retry"]})]})})}}function Hu(e,t){return e?t.text!==""?t.text:t.status==="success"?"":null:null}function Pn({children:e,className:t}){return r.jsx("div",{className:ie("bg-black/[0.14] inspector-scrollbar mx-3 mb-3 max-h-[72vh] overflow-auto rounded-[8px] p-3",t),children:e})}function oo({children:e}){return r.jsx("div",{className:"bg-white/[0.035] rounded-md px-3 py-5 text-center text-xs italic text-muted-foreground",children:e})}function Br({children:e}){return r.jsx("pre",{className:"bg-black/[0.18] inspector-scrollbar max-h-[64vh] overflow-auto whitespace-pre-wrap break-words rounded-[8px] p-3 font-mono text-xs leading-relaxed text-muted-foreground",children:e})}const aE={loading:"border-transparent bg-cyan-400/[0.06] text-cyan-100",warning:"border-transparent bg-amber-400/[0.08] text-amber-100",danger:"border-transparent bg-rose-400/[0.08] text-rose-100"};function fr({tone:e,title:t,children:n}){return r.jsxs("div",{className:ie("mb-3 rounded-md border px-3 py-2 text-xs shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]",aE[e]),children:[t!==void 0&&r.jsx("div",{className:"mb-1 font-semibold",children:t}),r.jsx("div",{className:"leading-relaxed text-muted-foreground",children:n})]})}function Ur({label:e,state:t,expectedBytes:n,onLoadMore:s}){const o=t.totalBytes??n,i=o===null?ps(t.offset):`${ps(t.offset)} / ${ps(o)}`,a=t.status!=="loading"&&t.hasMore,l=t.status==="failed"?"Retry":"Load more";return r.jsx(fr,{tone:t.status==="failed"?"warning":"loading",title:`${e} body preview`,children:r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("span",{children:[t.status==="idle"&&o!==null?`${e} body is ${ps(o)}. Loading the first preview chunk.`:`Loaded ${i}.`,t.status==="failed"&&t.error!==null&&` ${t.error}`]}),a&&r.jsx(ke,{type:"button",variant:"outline",size:"sm",className:"border border-input bg-background hover:bg-accent hover:text-accent-foreground h-7 text-xs text-cyan-100",onClick:s,children:l})]})})}function Vu({headers:e,emptyLabel:t}){const n=e===void 0?[]:Object.entries(e).sort(([s],[o])=>s.localeCompare(o));return n.length===0?r.jsx(oo,{children:t}):r.jsx("div",{className:"bg-black/[0.14] overflow-hidden rounded-[8px] font-mono text-xs",children:n.map(([s,o])=>r.jsxs("div",{className:"grid min-w-0 grid-cols-[minmax(140px,0.32fr)_minmax(0,1fr)] border-b border-white/[0.055] last:border-b-0",children:[r.jsx("div",{className:"min-w-0 truncate bg-white/[0.035] px-2.5 py-2 font-semibold text-cyan-200",children:s}),r.jsx("div",{className:"min-w-0 truncate px-2.5 py-2 text-muted-foreground",title:o,children:o})]},s))})}function lE({active:e,onClick:t}){return r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsxs(ke,{variant:e?"default":"outline",size:"sm",className:ie("h-8 border-white/10 text-xs shadow-none",e?"bg-cyan-300 text-black hover:bg-cyan-200":"border border-input bg-background hover:bg-accent hover:text-accent-foreground text-muted-foreground hover:text-cyan-100"),onClick:t,"aria-pressed":e,children:[r.jsx(yw,{className:"size-3.5 mr-1"}),e?"Showing diff":"Diff with Raw"]})}),r.jsx(dt,{children:e?"Hide diff view":"Compare proxy output against the original raw version"})]})}const cE=p.memo(function({rawBody:e,displayedBody:t,emptyLabel:n}){const s=p.useMemo(()=>TT(e,t),[e,t]);return r.jsx(u0,{result:s,emptyLabel:n})}),uE=p.memo(function({rawHeaders:e,headers:t,emptyLabel:n}){const s=p.useMemo(()=>NT(e,t),[e,t]);return r.jsx(u0,{result:s,emptyLabel:n})}),dE=p.memo(function({log:e,displayNumber:t,viewMode:n="simple",strip:s,slowResponseThresholdSeconds:o,timeDisplayFormat:i,cacheTrend:a=null,onCompareWithPrevious:l,showClientMetadata:c=!0}){const[u,d]=p.useState(!1),[f,h]=p.useState(!1),[m,v]=p.useState(!1),[g,x]=p.useState(!1),[b,y]=p.useState("request"),[k,j]=p.useState(null),[C,T]=p.useState(0),[N,P]=p.useState(null),[A,z]=p.useState(null),[D,E]=p.useState("idle"),[L,w]=p.useState(null),[$,ee]=p.useState(0),[F,W]=p.useState(()=>$r(e.rawRequestBodyBytes??null)),[Z,ue]=p.useState(()=>$r(e.responseTextBytes??null)),V=p.useRef(null),H=p.useRef(e.id),le=p.useRef(!1),U=A??e,X=A===null&&p0(e),Ce=p.useMemo(()=>yT(e.rawRequestBodyBytes,e.responseTextBytes),[e.rawRequestBodyBytes,e.responseTextBytes]),ae=Hu(X,F),ge=Hu(X,Z),xe=U.rawRequestBody??ae,he=U.responseText??ge,be=U.rawRequestBody===null&&ae!==null,Se=U.responseText===null&&ge!==null,Ie=!be||F.hasMore===!1&&zo(F.totalBytes)<=Io,_=!Se||Z.hasMore===!1&&zo(Z.totalBytes)<=Io,Q=lr(U),G=Xm(Q),O=p.useMemo(()=>G.analyzeRequest(U.rawRequestBody),[G,U.rawRequestBody]),R=p.useMemo(()=>G.analyzeResponse(U.responseText),[G,U.responseText]),se=p.useMemo(()=>!s||Q!=="anthropic"||U.rawRequestBody===null?null:rT(U.rawRequestBody).body,[U.rawRequestBody,Q,s])??xe,ne=Ui(Ie?se:null),q=Ui(b==="raw-request"&&Ie?xe:null),ce=Ui(b==="raw"&&_?he:null),I=p.useMemo(()=>U.headers&&Object.keys(U.headers).length>0?JSON.stringify(U.headers,null,2):null,[U.headers]),M=p.useMemo(()=>U.rawHeaders&&Object.keys(U.rawHeaders).length>0?JSON.stringify(U.rawHeaders,null,2):null,[U.rawHeaders]),Y=gn(se),re=gn(xe),oe=gn(I),ve=gn(M),pe=gn(he),me=p.useMemo(()=>({request:{copyLabel:be?"Copy loaded request preview":"Copy request body",copyText:se,copyCopied:Y.copied,onCopy:Y.copy,expansion:Ie?{isExpanded:ne.isExpanded,isPending:ne.isPending,onToggle:ne.toggle}:null,diffWithRaw:eE(Q,n,s,U.rawRequestBody!==null)?{active:g,onToggle:()=>x(!g)}:void 0,diffWithPrevious:l===void 0?void 0:()=>{l(U)}},"raw-request":{copyLabel:be?"Copy loaded raw request preview":"Copy raw request",copyText:xe,copyCopied:re.copied,onCopy:re.copy,expansion:Ie?{isExpanded:q.isExpanded,isPending:q.isPending,onToggle:q.toggle}:null},headers:{copyLabel:"Copy headers",copyText:I,copyCopied:oe.copied,onCopy:oe.copy,expansion:null},"raw-headers":{copyLabel:"Copy raw headers",copyText:M,copyCopied:ve.copied,onCopy:ve.copy,expansion:null},raw:{copyLabel:Se?"Copy loaded response preview":"Copy response",copyText:he,copyCopied:pe.copied,onCopy:pe.copy,expansion:_?{isExpanded:ce.isExpanded,isPending:ce.isPending,onToggle:ce.toggle}:null}}),[se,be,Ie,Y,ne,g,U,U.rawRequestBody,xe,re,q,I,oe,M,ve,U.responseText,Se,_,he,pe,ce,Q,n,s,l]),Re=p.useMemo(()=>ne.parsedData!==null?G.anatomySegments(ne.parsedData):null,[G,ne.parsedData]),$e=p.useMemo(()=>lc(ne.parsedData),[ne.parsedData]),Bt=U.warnings??[],Rn=p.useMemo(()=>{if(Re!==null)return new Set(Re.map(Be=>Be.path))},[Re]),xt=vT({containerRef:V,setExpandToPath:P,ensureTabActive:()=>{b!=="request"&&y("request")}}),it=p.useCallback((Be,St)=>{const et=Be==="request"?W:ue;et(bt=>({...bt,status:"loading",error:null}));const Ut=new URLSearchParams({part:Be,offset:String(St),limit:String(rE)});Ke(`/api/logs/${String(e.id)}/body?${Ut.toString()}`,e2,sE).then(bt=>{H.current===e.id&&et(Qn=>({status:"success",text:bt.offset===0?bt.text:`${Qn.text}${bt.text}`,offset:bt.nextOffset??bt.totalBytes,totalBytes:bt.totalBytes,hasMore:bt.hasMore,error:null}))}).catch(bt=>{H.current===e.id&&et(Qn=>({...Qn,status:"failed",error:iE(bt)}))})},[e.id]),en=p.useCallback(()=>{le.current||(z(null),E("idle"),w(null),ee(Be=>Be+1))},[]),Fs=p.useCallback(()=>{const Be=!u;Be&&y(Re!==null?"anatomy":"request"),d(Be)},[Re,u]);return p.useEffect(()=>{H.current=e.id,le.current=!1,z(null),E("idle"),w(null),ee(0),W($r(e.rawRequestBodyBytes??null)),ue($r(e.responseTextBytes??null))},[e.id,e.rawRequestBodyBytes,e.responseTextBytes]),p.useEffect(()=>{if(!u||!oE(e)||A!==null||le.current)return;let Be=!1;return le.current=!0,E("loading"),w(null),Ke(`/api/logs/${String(e.id)}`,rr,nE).then(St=>{Be||(le.current=!1,z(St),E("idle"),w(null))}).catch(St=>{Be||(le.current=!1,E("failed"),w(wT(St)))}),()=>{Be=!0,le.current=!1}},[u,A,e.bodyContentMode,e.id,e.rawRequestBodyBytes,e.responseTextBytes,$]),p.useEffect(()=>{u&&X&&F.status==="idle"&&(b!=="request"&&b!=="raw-request"&&b!=="anatomy"||it("request",0))},[b,u,it,F.status,X]),p.useEffect(()=>{u&&X&&Z.status==="idle"&&(b!=="parsed"&&b!=="raw"||it("response",0))},[b,u,it,Z.status,X]),p.useEffect(()=>{const Be=St=>{const et=bi(St);et!==null&&et.logId===e.id&&(d(!0),y(tE(et.tab,Re)),et.tab==="response"&&et.toolCallIndex!==void 0&&(j(et.toolCallIndex),T(Ut=>Ut+1)))};return window.addEventListener(ln,Be),()=>{window.removeEventListener(ln,Be)}},[Re,e.id]),r.jsxs(jn,{children:[r.jsxs("div",{className:ie("bg-card/80 relative mb-1.5 overflow-hidden rounded-[8px] transition-[background-color,box-shadow]",u?"bg-card shadow-[0_18px_60px_rgba(0,0,0,0.30),0_0_0_1px_rgba(103,232,249,0.08)]":"hover:bg-card"),children:[r.jsx(UT,{log:U,displayNumber:t,messageCount:O.messageCount,toolCount:O.toolCount,expanded:u,onToggle:Fs,cacheTrend:a,slowResponseThresholdSeconds:o,showClientMetadata:c,timeDisplayFormat:i,activeTab:b,tabActions:me,onReplay:l===void 0?void 0:()=>{h(!0)}}),u&&r.jsxs("div",{className:"relative bg-black/[0.14] pt-2",onClick:Be=>Be.stopPropagation(),onKeyDown:Be=>Be.stopPropagation(),children:[r.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 h-12 bg-gradient-to-b from-white/[0.05] to-transparent","aria-hidden":"true"}),r.jsxs(o0,{value:b,onValueChange:y,className:"gap-2",children:[r.jsxs(i0,{variant:"line",className:"bg-white/[0.04] inspector-scrollbar relative mx-3 h-auto w-[calc(100%-1.5rem)] justify-start overflow-x-auto rounded-[8px] p-1",children:[n==="full"&&r.jsx(Ct,{className:zn,value:"raw-headers",children:"Raw Headers"}),n==="full"&&r.jsx(Ct,{className:zn,value:"headers",children:"Headers"}),Re!==null&&r.jsx(Ct,{className:zn,value:"anatomy",children:"Context"}),Wu(Q,n,s)&&r.jsx(Ct,{className:zn,value:"raw-request",children:"Raw Request"}),r.jsx(Ct,{className:zn,value:"request",children:"Request"}),n==="full"&&r.jsx(Ct,{className:zn,value:"raw",children:"Raw Response"}),r.jsx(Ct,{className:zn,value:"parsed",children:"Response"})]}),Wu(Q,n,s)&&r.jsx(Nt,{value:"raw-request",children:b==="raw-request"&&r.jsxs(Pn,{children:[r.jsx(Fr,{status:D,error:L,footprint:Ce,onRetry:en}),X&&r.jsx(Ur,{label:"Request",state:F,expectedBytes:e.rawRequestBodyBytes??null,onLoadMore:()=>it("request",F.offset)}),xe===null?r.jsx(oo,{children:X?"Request preview is loading":"No request body"}):q.parsedData!==null?r.jsx(p.Suspense,{fallback:r.jsx(is,{}),children:r.jsx(La,{data:q.parsedData,bulkDepth:q.bulkDepth,bulkRevision:q.bulkRevision})}):r.jsx(Br,{children:xe})]})}),r.jsx(Nt,{value:"request",children:b==="request"&&r.jsxs(Pn,{children:[r.jsx(Fr,{status:D,error:L,footprint:Ce,onRetry:en}),X&&r.jsx(Ur,{label:"Request",state:F,expectedBytes:e.rawRequestBodyBytes??null,onLoadMore:()=>it("request",F.offset)}),Bt.length>0&&r.jsxs(fr,{tone:"warning",children:[r.jsxs("div",{className:"flex items-center gap-2 font-semibold text-amber-300",children:[r.jsx(rn,{className:"size-3.5"}),"Tool schema warnings"]}),r.jsx("ul",{className:"mt-2 space-y-1 text-muted-foreground",children:Bt.map(Be=>r.jsx("li",{children:Be},Be))})]}),r.jsx(XT,{summary:$e,calledToolNames:R.toolNames??[]}),g?r.jsx(cE,{rawBody:U.rawRequestBody,displayedBody:se,emptyLabel:"No transformation applied; raw and sent request bodies are identical."}):r.jsx("div",{ref:V,children:se===null?r.jsx(oo,{children:X?"Request preview is loading":"No request body"}):ne.parsedData!==null?r.jsx(p.Suspense,{fallback:r.jsx(is,{}),children:r.jsx(La,{data:ne.parsedData,bulkDepth:ne.bulkDepth,bulkRevision:ne.bulkRevision,anatomyPaths:Rn,expandToPath:N})}):r.jsx(Br,{children:se})})]})}),Re!==null&&r.jsx(Nt,{value:"anatomy",children:b==="anatomy"&&r.jsx(Pn,{className:"p-0",children:r.jsx(p.Suspense,{fallback:r.jsx(is,{}),children:r.jsx(pT,{parsed:ne.parsedData,inputTokens:U.inputTokens??null,model:U.model,segments:Re,onSegmentActivate:xt})})})}),n==="full"&&r.jsx(Nt,{value:"headers",children:b==="headers"&&r.jsxs(Pn,{children:[r.jsx("div",{className:"flex justify-end gap-2 mb-2",children:QT(n,U.rawHeaders!==void 0&&Object.keys(U.rawHeaders).length>0)&&r.jsx(lE,{active:m,onClick:Be=>{Be.stopPropagation(),v(!m)}})}),m?r.jsx(uE,{rawHeaders:U.rawHeaders,headers:U.headers,emptyLabel:"No transformation applied; raw and processed headers are identical."}):r.jsx(Vu,{headers:U.headers,emptyLabel:"No headers captured"})]})}),n==="full"&&r.jsx(Nt,{value:"raw-headers",children:b==="raw-headers"&&r.jsx(Pn,{children:r.jsx(Vu,{headers:U.rawHeaders,emptyLabel:"No raw headers captured"})})}),r.jsx(Nt,{value:"raw",children:b==="raw"&&r.jsxs(Pn,{className:"space-y-3",children:[r.jsx(Fr,{status:D,error:L,footprint:Ce,onRetry:en}),X&&r.jsx(Ur,{label:"Response",state:Z,expectedBytes:e.responseTextBytes??null,onLoadMore:()=>it("response",Z.offset)}),U.error!==void 0&&U.error!==null&&r.jsx(fr,{tone:"danger",title:"SSE Error",children:r.jsx("span",{className:"font-mono",children:U.error})}),he!==null&&_?r.jsx(p.Suspense,{fallback:r.jsx(is,{}),children:r.jsx(gT,{text:he,defaultExpandDepth:0,bulkDepth:ce.bulkDepth,bulkRevision:ce.bulkRevision})}):he!==null?r.jsx(Br,{children:he}):r.jsx(oo,{children:X?"Response preview is loading":"No response"}),U.streaming===!0&&r.jsx(p.Suspense,{fallback:r.jsx(is,{}),children:r.jsx(mT,{logId:U.id,truncated:U.streamingChunksPath!==null})})]})}),r.jsx(Nt,{value:"parsed",children:b==="parsed"&&r.jsxs(Pn,{children:[r.jsx(Fr,{status:D,error:L,footprint:Ce,onRetry:en}),X&&r.jsx(Ur,{label:"Response",state:Z,expectedBytes:e.responseTextBytes??null,onLoadMore:()=>it("response",Z.offset)}),Se&&!_?r.jsx(Br,{children:he}):r.jsx(p.Suspense,{fallback:r.jsx(is,{}),children:r.jsx(hT,{responseText:he,responseStatus:U.responseStatus,streaming:U.streaming,inputTokens:U.inputTokens,outputTokens:U.outputTokens,cacheCreationInputTokens:U.cacheCreationInputTokens,cacheReadInputTokens:U.cacheReadInputTokens,apiFormat:Q,error:U.error,focusedToolIndex:k,toolFocusNonce:C})})]})})]})]})]}),r.jsx(p.Suspense,{fallback:null,children:r.jsx(fT,{log:U,displayNumber:t,open:f,onOpenChange:h})})]})});function fE(e){switch(e){case"end_turn":return"End of Turn (Anthropic)";case"stop":return"End of Turn (OpenAI)";case"length":return"End of Turn (length limit)";case"tool_use":case null:return"End of Turn"}}function Hi(e){return e?"cursor-pointer transition-transform hover:scale-110":""}function pE({stopReason:e,isPending:t,isFirst:n,isTurnStart:s,isOnlyEntry:o=!1,crabIndex:i=0,collapsible:a=!1,onToggle:l}){const c=El(e),u=o&&s&&c,d=t&&!c,f=a&&l!==void 0,h=p.useMemo(()=>cc(i),[i]),m=p.useMemo(()=>Q4(i),[i]),v=x=>{!f||l===void 0||(x.stopPropagation(),l())},g=x=>{!f||l===void 0||x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),l())};return r.jsxs("div",{className:"flex flex-col items-center w-6 shrink-0 pt-0.5 pb-0.5",children:[r.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]",children:!n&&r.jsx("div",{className:"w-px bg-muted-foreground/18 h-full"})}),u?r.jsx("span",{role:f?"button":void 0,tabIndex:f?0:void 0,title:"Single-request turn",className:Hi(f),onClick:v,onKeyDown:g,children:r.jsx(m,{className:ie("size-3.5 text-[#80FF00]","animate-crab-settle","drop-shadow-[0_0_4px_rgba(128,255,0,0.5)]")})}):c?r.jsx("span",{role:f?"button":void 0,tabIndex:f?0:void 0,title:fE(e),className:Hi(f),onClick:v,onKeyDown:g,children:r.jsx(h,{className:ie("size-3.5 text-amber-400","animate-crab-settle","drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})}):s?r.jsx("span",{role:f?"button":void 0,tabIndex:f?0:void 0,title:"Start of turn",className:Hi(f),onClick:v,onKeyDown:g,children:r.jsx(h,{className:ie("size-3.5 text-emerald-400","animate-crab-appear","drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}):d?r.jsx("span",{title:"Processing",children:r.jsx(h,{className:ie("size-3.5 text-amber-300/80","animate-crab-crawl")})}):r.jsx("span",{title:"Request in turn",children:r.jsx(h,{className:"size-3.5 text-muted-foreground/40"})}),r.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:!c&&r.jsx("div",{className:ie("w-0.5 h-full",t?"border-dashed bg-transparent border-l border-muted-foreground/14":"bg-muted-foreground/18")})})]})}const hE=4;function mE({event:e}){return r.jsxs("button",{type:"button",className:"inline-flex h-6 max-w-[11rem] min-w-0 items-center gap-1 rounded-md bg-white/[0.028] px-1.5 text-[11px] text-muted-foreground transition-colors hover:bg-sky-400/[0.08] hover:text-sky-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>ur({logId:e.logId,tab:"response",toolCallIndex:e.index}),"aria-label":`Open response tool call ${e.name}`,children:[r.jsx(Ps,{className:"size-3 shrink-0 text-sky-400/65"}),r.jsx("span",{className:"min-w-0 truncate font-mono font-semibold",children:e.name})]},e.id)}function gE({events:e,warnings:t=[]}){if(e.length===0&&t.length===0)return null;const n=e.slice(0,hE),s=Math.max(0,e.length-n.length);return r.jsxs("div",{className:"mx-3 mb-2 flex min-w-0 items-center gap-1.5 overflow-hidden rounded-md bg-black/[0.10] px-2 py-1 shadow-[inset_0_1px_0_rgba(255,255,255,0.025)]",children:[e.length>0&&r.jsxs("span",{className:"inline-flex h-6 shrink-0 items-center gap-1 rounded-md px-1.5 font-mono text-[10px] font-semibold uppercase tracking-[0.12em] text-sky-300/70",children:[r.jsx(Ps,{className:"size-3"}),e.length]}),t.length>0&&r.jsxs("span",{className:"inline-flex h-6 shrink-0 items-center gap-1 rounded-md border border-amber-300/20 bg-amber-300/[0.08] px-1.5 font-mono text-[10px] font-semibold text-amber-100",children:[r.jsx(rn,{className:"size-3"}),t.length]}),r.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-hidden",children:[n.map(o=>r.jsx(mE,{event:o},o.id)),s>0&&r.jsxs("span",{className:"inline-flex h-6 shrink-0 items-center rounded-md bg-white/[0.025] px-1.5 font-mono text-[11px] font-semibold text-muted-foreground",children:["+",s]})]})]})}const qu=180,Vi=new WeakMap;function xE(e,t){const n=e.responseText;if(n===null)return!1;switch(t){case"anthropic":return n.includes("tool_use");case"openai":return n.includes("tool_calls")||n.includes("function_call");case"unknown":return!1}}function bE(e,t,n){return e>1&&t&&!n}function Fa(e){const t=[];let n=[],s=0;for(let o=0;o<e.length;o+=1){const i=e[o];if(i===void 0)continue;n.push({log:i,stopReason:op(i),sessionLogNumber:o+1});const a=n[n.length-1];a!==void 0&&El(a.stopReason)&&(t.push({entries:n,turnIndex:s}),n=[],s+=1)}return n.length>0&&t.push({entries:n,turnIndex:s}),t}function vE(e){const t=new Map;for(const n of e)for(let s=1;s<n.logs.length;s+=1){const o=n.logs[s],i=n.logs[s-1];if(o===void 0||i===void 0)continue;const a=lr(o),l=lr(i);a==="unknown"||a!==l||t.set(o.id,i)}return t}function h0(e){if(e===null)return null;try{const t=JSON.parse(e);return typeof t=="string"?JSON.parse(t):t}catch{return null}}function io(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>qu?`${n.slice(0,qu-1)}...`:n}function ao(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 yE(e){const t=h0(e.responseText),n=_e(t,"content");if(!Array.isArray(n))return[];const s=[];for(const o of n){if(_e(o,"type")!=="tool_use")continue;const a=_e(o,"name");if(typeof a!="string"||a.length===0)continue;const l=_e(o,"input");s.push({id:`${String(e.id)}-anthropic-tool-${String(s.length)}`,logId:e.id,index:s.length,provider:"anthropic",name:a,argumentsText:ao(l),argumentsPreview:io(l)})}return s}function wE(e){const t=h0(e.responseText),n=_e(t,"choices");if(!Array.isArray(n))return[];const s=[];for(const i of n){const a=_e(i,"message"),l=_e(a,"tool_calls");if(Array.isArray(l))for(const d of l){const f=_e(d,"function"),h=_e(f,"name");if(typeof h!="string"||h.length===0)continue;const m=_e(f,"arguments");s.push({id:`${String(e.id)}-openai-tool-${String(s.length)}`,logId:e.id,index:s.length,provider:"openai",name:h,argumentsText:ao(m),argumentsPreview:io(m)})}const c=_e(a,"function_call"),u=_e(c,"name");if(typeof u=="string"&&u.length>0){const d=_e(c,"arguments");s.push({id:`${String(e.id)}-openai-tool-${String(s.length)}`,logId:e.id,index:s.length,provider:"openai",name:u,argumentsText:ao(d),argumentsPreview:io(d)})}}const o=_e(t,"output");if(Array.isArray(o))for(const i of o){if(_e(i,"type")!=="function_call")continue;const a=_e(i,"name");if(typeof a!="string"||a.length===0)continue;const l=_e(i,"arguments");s.push({id:`${String(e.id)}-openai-tool-${String(s.length)}`,logId:e.id,index:s.length,provider:"openai",name:a,argumentsText:ao(l),argumentsPreview:io(l)})}return s}function uc(e){const t=Vi.get(e);if(t!==void 0&&t.apiFormat===e.apiFormat&&t.responseText===e.responseText)return t.events;const n=lr(e);if(!xE(e,n)){const o=[];return Vi.set(e,{apiFormat:e.apiFormat,responseText:e.responseText,events:o}),o}let s;switch(n){case"anthropic":s=yE(e);break;case"openai":s=wE(e);break;case"unknown":s=[];break}return Vi.set(e,{apiFormat:e.apiFormat,responseText:e.responseText,events:s}),s}function _E(e,t,n=0){let s=0,o=0,i=0,a=0,l=0,c=0,u=0,d=0,f=null,h=0;for(const m of e)m.responseStatus===null?o+=1:m.responseStatus>=400&&(s+=1),m.elapsedMs!==null&&t>0&&m.elapsedMs>t*1e3&&(i+=1),m.inputTokens!==null&&(a+=m.inputTokens),m.outputTokens!==null&&(l+=m.outputTokens),m.cacheCreationInputTokens!==null&&(c+=m.cacheCreationInputTokens),m.cacheReadInputTokens!==null&&(u+=m.cacheReadInputTokens),m.elapsedMs!==null&&(d+=m.elapsedMs,f=f===null?m.elapsedMs:Math.max(f,m.elapsedMs)),h+=uc(m).length;return{llmCallCount:e.length,toolCallCount:h,failedCallCount:s,pendingCallCount:o,slowCallCount:i,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 qi(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const kE=p.memo(function({entries:t,viewMode:n,strip:s,slowResponseThresholdSeconds:o,cacheTrends:i,onCompareWithPrevious:a,comparisonPredecessors:l,turnIndex:c=0,timeDisplayFormat:u,pendingFocusRequest:d,showLogClientMetadata:f=!0}){const h=t.length-1,m=t[h]?.stopReason??null,v=m!==null?El(m):!1,g=t[h]?.log.responseStatus===null,x=t.length===1,b=bE(t.length,v,g),[y,k]=p.useState(!1),j=p.useRef(!1);p.useEffect(()=>{b?v&&!j.current&&k(!0):k(!1),j.current=v},[b,v]),p.useEffect(()=>{const F=W=>{const Z=bi(W);Z!==null&&t.some(ue=>ue.log.id===Z.logId)&&b&&k(!1)};return window.addEventListener(ln,F),()=>{window.removeEventListener(ln,F)}},[b,t]),p.useEffect(()=>{if(d===void 0||!t.some(W=>W.log.id===d.logId))return;b&&k(!1);const F=window.setTimeout(()=>{ur({logId:d.logId,tab:d.tab,source:"virtualizer"})},0);return()=>window.clearTimeout(F)},[b,t,d]);const C=p.useCallback(()=>{b&&k(F=>!F)},[b]),T=p.useMemo(()=>{let F=0,W=0,Z=null,ue=!1;for(const V of t)V.log.inputTokens!==null&&(F+=V.log.inputTokens,ue=!0),V.log.outputTokens!==null&&(W+=V.log.outputTokens,ue=!0),V.log.elapsedMs!==null&&(Z=Z===null?V.log.elapsedMs:Math.max(Z,V.log.elapsedMs));return{totalInput:F,totalOutput:W,hasTokens:ue,maxElapsed:Z}},[t,h]),N=c%2===0?"bg-white/[0.008]":"bg-cyan-300/[0.008]",P=T.maxElapsed!==null&&o>0&&T.maxElapsed>o*1e3,A=p.useMemo(()=>{const F=new Map;for(const W of t){const Z=uc(W.log);Z.length>0&&F.set(W.log.id,Z)}return F},[t]),[z,D]=p.useState(0),E=p.useRef(null);p.useEffect(()=>{const F=E.current;if(!F)return;let W=0;const Z=new ResizeObserver(()=>{window.cancelAnimationFrame(W),W=window.requestAnimationFrame(()=>D(ue=>ue+1))});return Z.observe(F),()=>{Z.disconnect(),window.cancelAnimationFrame(W)}},[]);const L=t[0]?.log.id??c,w=`Turn ${String(c+1)}`,$=p.useMemo(()=>cc(L%12),[L]),ee=p.useMemo(()=>({contentVisibility:"auto",containIntrinsicSize:y?"48px":"160px"}),[y]);return r.jsx("div",{ref:E,style:ee,tabIndex:y?void 0:0,role:y?void 0:"group","aria-label":y?void 0:w,"data-nav-id":y?void 0:`turn-${String(L)}`,className:ie("rounded-[8px] transition-[background-color,box-shadow]",g?"bg-amber-300/[0.018] shadow-[0_0_0_1px_rgba(252,211,77,0.035)]":"",!y&&"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),children:y?r.jsxs("div",{"data-nav-id":`turn-collapsed-${String(L)}`,"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:C,onKeyDown:F=>{(F.key==="Enter"||F.key===" ")&&(F.preventDefault(),C())},children:[r.jsxs("div",{className:"w-6 shrink-0 flex flex-col items-center pt-1.5 pb-1.5",children:[r.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]"}),r.jsx($,{className:ie("size-3.5",g?"animate-crab-crawl text-amber-300/80":"animate-crab-appear text-emerald-400",g?"drop-shadow-[0_0_4px_rgba(252,211,77,0.42)]":"drop-shadow-[0_0_4px_rgba(52,211,153,0.45)]")}),r.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:r.jsx("div",{className:"w-px bg-muted-foreground/14 h-full"})}),v&&r.jsx($,{className:ie("size-3.5 animate-crab-settle text-amber-400","drop-shadow-[0_0_4px_rgba(251,191,36,0.45)]")})]}),t.length>1&&r.jsxs("div",{className:ie("flex-1 min-w-0 mb-0.5 rounded-[8px] py-1.5 px-3 flex items-center gap-3 text-xs","bg-card/80 transition-colors hover:bg-card",N),children:[r.jsx("span",{className:"font-mono text-[10px] font-semibold uppercase tracking-[0.14em] text-muted-foreground/70",children:w}),r.jsxs("span",{className:"text-blue-300/85 font-mono font-semibold tabular-nums shrink-0",title:`Log IDs ${String(t[0]?.log.id??"?")} ~ ${String(t[h]?.log.id??"?")}`,children:["#",t[0]?.sessionLogNumber??"?"," ~ #",t[h]?.sessionLogNumber??"?"]}),r.jsxs("span",{className:"text-muted-foreground shrink-0",children:[t.length," request",t.length>1?"s":""]}),T.maxElapsed!==null&&r.jsx(jn,{children:r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsxs("span",{className:ie("flex items-center gap-1 shrink-0",P?"text-amber-400":"text-muted-foreground"),children:[r.jsx(sn,{className:"size-3"}),r.jsx("span",{className:"font-mono tabular-nums",children:qi(T.maxElapsed)}),P&&r.jsx(rn,{className:"size-3","aria-label":"Slow response"})]})}),r.jsx(dt,{children:P?`Slow response: ${qi(T.maxElapsed)} exceeds ${qi(o*1e3)}`:"Slowest request in this turn"})]})}),T.hasTokens&&r.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[r.jsx(or,{className:"size-3 text-muted-foreground"}),r.jsxs("span",{className:"font-mono tabular-nums",children:[r.jsxs("span",{className:"text-blue-400",children:["IN ",Fe(T.totalInput)]})," / ",r.jsxs("span",{className:"text-amber-400",children:["OUT ",Fe(T.totalOutput)]})]})]}),r.jsx("span",{className:"flex-1 min-w-0"}),r.jsx("span",{className:"bg-white/[0.045] inline-flex size-7 shrink-0 items-center justify-center rounded-md text-slate-200","aria-hidden":"true",children:r.jsx(Et,{className:"size-4 shrink-0"})})]})]}):t.map((F,W)=>{const{log:Z,stopReason:ue}=F,V=W===0;return r.jsxs("div",{className:"flex items-stretch",children:[r.jsx(pE,{stopReason:ue,isPending:Z.responseStatus===null,isFirst:W===0,isTurnStart:V,isOnlyEntry:x,crabIndex:Z.id%12,collapsible:b&&V,onToggle:C}),r.jsxs("div",{className:ie("flex-1 min-w-0 mb-0.5 rounded-[8px]",N),children:[r.jsx(dE,{log:Z,displayNumber:F.sessionLogNumber,viewMode:n,strip:s,slowResponseThresholdSeconds:o,timeDisplayFormat:u,cacheTrend:i?.get(Z.id)??null,showClientMetadata:f,onCompareWithPrevious:l.has(Z.id)?a:void 0}),r.jsx(gE,{events:A.get(Z.id)??[],warnings:Z.warnings??[]})]})]},Z.id)})})}),jE=24,SE=132,CE=8;function NE(e){return e>jE}function TE(e){const t=new Map;for(let n=0;n<e.length;n++){const s=e[n];if(s!==void 0)for(const o of s.entries)t.set(o.log.id,n)}return t}function m0(e,t,n){return r.jsx(kE,{entries:e.entries,viewMode:t.viewMode,strip:t.strip,slowResponseThresholdSeconds:t.slowResponseThresholdSeconds,timeDisplayFormat:t.timeDisplayFormat,cacheTrends:t.cacheTrends,onCompareWithPrevious:t.onCompareWithPrevious,comparisonPredecessors:t.comparisonPredecessors,turnIndex:e.turnIndex,pendingFocusRequest:n,showLogClientMetadata:t.showLogClientMetadata},e.turnIndex)}function EE(e){return NE(e.turnGroups.length)?r.jsx(AE,{...e}):r.jsx(r.Fragment,{children:e.turnGroups.map(t=>m0(t,e))})}function AE(e){const{turnGroups:t}=e,[n,s]=p.useState(null),o=F4({count:t.length,estimateSize:()=>SE,overscan:CE,getItemKey:a=>t[a]?.turnIndex??a}),i=p.useMemo(()=>TE(t),[t]);return p.useEffect(()=>{const a=l=>{const c=bi(l);if(c===null||c.source==="virtualizer")return;const u=i.get(c.logId);u!==void 0&&(o.scrollToIndex(u,{align:"center"}),s(d=>({...c,turnIndex:u,nonce:d===null?1:d.nonce+1})))};return window.addEventListener(ln,a),()=>{window.removeEventListener(ln,a)}},[i,o]),r.jsx("div",{className:"relative w-full",style:{height:`${o.getTotalSize()}px`},"data-virtualized-turn-list":"true",children:o.getVirtualItems().map(a=>{const l=t[a.index];if(l===void 0)return null;const c=n!==null&&n.turnIndex===a.index?n:void 0;return r.jsx("div",{"data-index":a.index,ref:o.measureElement,className:"absolute left-0 top-0 w-full",style:{transform:`translateY(${a.start}px)`},children:m0(l,e,c)},a.key)})})}const dc=Ee(["episode","procedure","preference","project-fact"]),RE=Ee(["draft","promoted","failed"]),g0=J({source:Ae("agent-inspector"),sessionId:S(),logIds:fe(K().int().positive()),project:S().nullable(),models:fe(S())}),IE=J({redacted:Le(),patterns:fe(S())}),wr=J({id:S(),type:dc,title:S(),content:S(),tags:fe(S()),source:Ae("agent-inspector"),sessionId:S(),logIds:fe(K().int().positive()),evidence:g0,status:RE,createdAt:S(),updatedAt:S(),openClawMemoryId:S().nullable(),error:S().nullable(),redaction:IE});J({idempotencyKey:S(),type:dc,title:S(),content:S(),tags:fe(S()),source:Ae("agent-inspector"),project:S().nullable(),evidence:g0});const zE=J({id:S(),type:dc.or(S()),title:S(),content:S(),score:K().nullable(),source:S().nullable(),project:S().nullable(),evidence:Ln().optional()});J({results:fe(zE),warning:S().nullable()});const PE=J({candidates:fe(wr)}),OE=J({candidate:wr}),ME=J({error:S().optional(),candidate:wr.optional()}),LE=J({candidate:wr}),DE=3e4,$E=15e3,FE=15e3,BE={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 Ba(e){return e===null?"-":e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`}function UE(e,t,n){return e===null||t===null?null:Tl(e,t,n)}function WE(e){return`${String(e)} candidate${e===1?"":"s"}`}function x0(e){return`log-${String(e)}`}function b0(e){const t=x0(e),n=document.getElementById(t);window.history.replaceState(null,"",`#${t}`),n instanceof HTMLElement&&(n.scrollIntoView({block:"center",behavior:"smooth"}),n.focus({preventScroll:!0}))}function HE(e){for(const t of e)if(t.responseStatus!==null&&t.responseStatus>=400)return t;return null}function VE(e){let t=null,n=-1;for(const s of e)s.elapsedMs!==null&&s.elapsedMs>n&&(t=s,n=s.elapsedMs);return t}function qE(e){for(const t of e)if(uc(t).length>0)return t;return null}function ZE(e){const t=new Map;for(let n=0;n<e.length;n+=1){const s=e[n];s!==void 0&&t.set(s.id,n+1)}return t}function bs(e,t){return String(t.get(e)??e)}function GE(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=qE(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 #${bs(n.id,e.displayNumberByLogId)}`,logId:n.id});const s=HE(e.logs);s!==null&&t.push({kind:"failure",title:`Failure #${String(s.responseStatus)}`,detail:`First failed request is #${bs(s.id,e.displayNumberByLogId)}`,logId:s.id});const o=VE(e.logs);if(o!==null&&e.summary.maxElapsedMs!==null&&t.push({kind:"slow",title:`Slowest ${Ba(e.summary.maxElapsedMs)}`,detail:`Max latency observed at #${bs(o.id,e.displayNumberByLogId)}`,logId:o.id}),e.candidates.length>0){const i=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(i)} draft / ${String(a)} promoted`,logId:e.candidates[0]?.logIds[0]??null})}return t}function KE(e){switch(e){case"session":return r.jsx(Zo,{className:"size-3.5 text-blue-400"});case"tool":return r.jsx(Ps,{className:"size-3.5 text-sky-400/70"});case"slow":return r.jsx(sn,{className:"size-3.5 text-amber-400"});case"failure":return r.jsx(Gf,{className:"size-3.5 text-destructive"});case"candidate":return r.jsx(Zf,{className:"size-3.5 text-emerald-400"})}}function JE({insights:e}){return e.length===0?null:r.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=>r.jsxs("button",{type:"button",className:ie("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&&b0(t.logId)},disabled:t.logId===null,children:[KE(t.kind),r.jsxs("span",{className:"min-w-0",children:[r.jsx("span",{className:"block truncate font-medium text-foreground/90",children:t.title}),r.jsx("span",{className:"block truncate font-mono text-[10px]",children:t.detail})]})]},`${t.kind}-${t.title}`))})}function YE(e){switch(e){case"draft":return"Draft";case"promoted":return"Promoted";case"failed":return"Failed"}}function XE(e,t){if(t)return"Promoting";switch(e.status){case"draft":return"Promote";case"failed":return"Retry";case"promoted":return"Promoted"}}function QE(e){return e.redaction.redacted?`Redacted ${e.redaction.patterns.join(", ")}`:"No sensitive pattern matched"}function eA(e,t){const n=e.replace(/\s+/g," ").trim();return n.length<=t?n:`${n.slice(0,t-3)}...`}function tA(e,t){const n=e[0],s=e[e.length-1];if(n===void 0)return"No evidence logs";const o=bs(n,t);return s===void 0||n===s?`#${o}`:`#${o}-#${bs(s,t)}`}function Zu(e){return e.join(", ")}function nA(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function sA({candidate:e,isPromoting:t,isUpdating:n,onPromoteCandidate:s,onUpdateCandidate:o,displayNumberByLogId:i}){const[a,l]=p.useState(!1),[c,u]=p.useState(e.type),[d,f]=p.useState(e.title),[h,m]=p.useState(e.content),[v,g]=p.useState(Zu(e.tags)),[x,b]=p.useState(null),y=e.status!=="promoted",k=e.status!=="promoted",j=p.useCallback(()=>{u(e.type),f(e.title),m(e.content),g(Zu(e.tags)),b(null)},[e.content,e.tags,e.title,e.type]),C=p.useCallback(async()=>{const T=d.trim(),N=h.trim(),P=nA(v);if(T.length===0){b("Title is required.");return}if(N.length===0){b("Content is required.");return}if(P.length===0){b("At least one tag is required.");return}b(null),await o(e.id,{type:c,title:T,content:N,tags:P})&&l(!1)},[e.id,h,v,d,c,o]);return a?r.jsx("div",{className:"border border-border bg-card shadow-sm rounded-[8px] px-2.5 py-2",children:r.jsxs("div",{className:"grid gap-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("select",{value:c,disabled:n,onChange:T=>{const N=wr.shape.type.safeParse(T.currentTarget.value);N.success&&u(N.data)},className:"border border-input bg-background hover:bg-accent hover:text-accent-foreground h-7 rounded-md px-2 text-xs","aria-label":"Candidate type",children:[r.jsx("option",{value:"episode",children:"episode"}),r.jsx("option",{value:"procedure",children:"procedure"}),r.jsx("option",{value:"preference",children:"preference"}),r.jsx("option",{value:"project-fact",children:"project-fact"})]}),r.jsx("input",{value:d,disabled:n,onChange:T=>f(T.currentTarget.value),className:"border border-input bg-background hover:bg-accent hover:text-accent-foreground h-7 min-w-[220px] flex-1 rounded-md px-2 text-xs","aria-label":"Candidate title"})]}),r.jsx("textarea",{value:h,disabled:n,onChange:T=>m(T.currentTarget.value),className:"border border-input bg-background hover:bg-accent hover:text-accent-foreground min-h-28 rounded-md px-2 py-1.5 font-mono text-[11px] leading-relaxed","aria-label":"Candidate content"}),r.jsx("input",{value:v,disabled:n,onChange:T=>g(T.currentTarget.value),className:"border border-input bg-background hover:bg-accent hover:text-accent-foreground h-7 rounded-md px-2 text-xs","aria-label":"Candidate tags"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground",children:[r.jsx(Vc,{className:"size-3"}),"Saving reruns Inspector redaction before promotion."]}),r.jsx("span",{className:"flex-1"}),x!==null&&r.jsx("span",{className:"text-[10px] text-destructive",children:x}),r.jsxs(ke,{type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:n,onClick:()=>{j(),l(!1)},children:[r.jsx(gr,{className:"size-3.5"}),"Cancel"]}),r.jsxs(ke,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:n,onClick:()=>{C()},children:[n?r.jsx(yn,{className:"size-3.5 animate-spin"}):r.jsx(n_,{className:"size-3.5"}),"Save"]})]})]})}):r.jsxs("div",{className:"rounded-md border border-border/80 bg-background/60 px-2.5 py-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(Me,{variant:"outline",className:"h-5 px-1.5 text-[10px] font-mono",children:e.type}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",title:e.title,children:e.title}),r.jsx(Me,{variant:"outline",className:ie("h-5 shrink-0 px-1.5 text-[10px] font-mono",BE[e.status]),children:YE(e.status)})]}),r.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",title:e.content,children:eA(e.content,360)}),r.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-[10px] text-muted-foreground",children:[r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx(lw,{className:"size-3"}),tA(e.logIds,i)]}),r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx(Vc,{className:"size-3"}),QE(e)]}),e.status==="promoted"&&r.jsxs("span",{className:"inline-flex items-center gap-1 text-emerald-500",children:[r.jsx(ua,{className:"size-3"}),e.openClawMemoryId??"OpenClaw"]}),e.status==="failed"&&e.error!==null&&r.jsxs("span",{className:"inline-flex items-center gap-1 text-destructive",children:[r.jsx(Gf,{className:"size-3"}),e.error]})]}),r.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[e.logIds.map(T=>{const N=bs(T,i);return r.jsxs("a",{href:`#${x0(T)}`,onClick:P=>{P.preventDefault(),b0(T)},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 ${N}`,title:`Log ID ${String(T)}`,children:["#",N]},T)}),r.jsx("span",{className:"flex-1"}),k&&r.jsxs(ke,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1.5 px-2 text-[10px]",disabled:n||t,onClick:()=>l(!0),children:[r.jsx(Qf,{className:"size-3"}),"Review"]}),r.jsxs(ke,{type:"button",variant:y?"outline":"ghost",size:"sm",className:"h-6 gap-1.5 px-2 text-[10px]",onClick:()=>s(e.id),disabled:!y||t||n,children:[t?r.jsx(yn,{className:"size-3 animate-spin"}):y?r.jsx(Wy,{className:"size-3"}):r.jsx(ua,{className:"size-3"}),XE(e,t)]})]})]})}function rA({candidates:e,promotingCandidateIds:t,updatingCandidateIds:n,onPromoteCandidate:s,onUpdateCandidate:o,displayNumberByLogId:i}){return e.length===0?null:r.jsx("div",{className:"mt-2 grid gap-1.5",children:e.map(a=>r.jsx(sA,{candidate:a,isPromoting:t.has(a.id),isUpdating:n.has(a.id),onPromoteCandidate:s,onUpdateCandidate:o,displayNumberByLogId:i},a.id))})}function oA({logs:e,scopeId:t,slowResponseThresholdSeconds:n,showRollupMetrics:s,timeDisplayFormat:o}){const[i,a]=p.useState([]),[l,c]=p.useState(!0),[u,d]=p.useState({status:"idle",error:null}),[f,h]=p.useState(()=>new Set),[m,v]=p.useState(()=>new Set),g=i.length>0,x=p.useMemo(()=>_E(e,n,i.length),[i.length,e,n]),b=p.useMemo(()=>ZE(e),[e]),y=p.useMemo(()=>GE({logs:e,scopeId:t,summary:x,candidates:i,displayNumberByLogId:b}),[i,b,e,t,x]),k=s||x.maxElapsedMs!==null,j=p.useMemo(()=>UE(x.startedAt,x.endedAt,o),[x.endedAt,x.startedAt,o]),C=p.useCallback(()=>{e.length===0||u.status==="loading"||(d({status:"loading",error:null}),(async()=>{try{const P=await Ke(`/api/knowledge/sessions/${encodeURIComponent(t)}/candidates`,PE,DE,{method:"POST"},A=>`Candidate generation failed with ${String(A.status)}`);a(P.candidates),c(P.candidates.length>0),d(P.candidates.length>0?{status:"ready",error:null}:{status:"failed",error:"No candidate was generated for this trace scope."})}catch(P){d({status:"failed",error:P instanceof Error?P.message:"Candidate response was invalid"})}})())},[u.status,e.length,t]),T=p.useCallback(P=>{h(A=>{if(A.has(P))return A;const z=new Set(A);return z.add(P),z}),(async()=>{try{const A=await Dn(`/api/knowledge/candidates/${encodeURIComponent(P)}/promote`,$E,{method:"POST"}),z=await A.json().catch(()=>null),D=OE.safeParse(z);if(A.ok&&D.success){a(L=>L.map(w=>w.id===D.data.candidate.id?D.data.candidate:w)),d({status:"ready",error:null});return}const E=ME.safeParse(z);E.success&&E.data.candidate!==void 0&&a(L=>L.map(w=>w.id===E.data.candidate?.id?E.data.candidate:w)),d({status:"failed",error:E.success?E.data.error??"Candidate promotion failed":`Candidate promotion failed with ${String(A.status)}`})}catch(A){d({status:"failed",error:A instanceof Error?A.message:"Candidate promotion failed"})}finally{h(A=>{const z=new Set(A);return z.delete(P),z})}})()},[]),N=p.useCallback(async(P,A)=>{v(z=>{if(z.has(P))return z;const D=new Set(z);return D.add(P),D});try{const z=await Ke(`/api/knowledge/candidates/${encodeURIComponent(P)}`,LE,FE,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)},D=>`Candidate update failed with ${String(D.status)}`);return a(D=>D.map(E=>E.id===z.candidate.id?z.candidate:E)),d({status:"ready",error:null}),!0}catch(z){return d({status:"failed",error:z instanceof Error?z.message:"Candidate update failed"}),!1}finally{v(z=>{const D=new Set(z);return D.delete(P),D})}},[]);return e.length===0?null:r.jsxs("section",{className:"border border-border bg-card shadow-sm mb-2 rounded-[8px] px-3 py-2",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 text-xs",children:[s&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 font-semibold text-foreground",children:[r.jsx(Zo,{className:"size-3.5 text-blue-400"}),x.llmCallCount," LLM"]}),r.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[r.jsx(Ps,{className:"size-3.5 text-sky-400/70"}),x.toolCallCount," tools"]}),s&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[r.jsx(or,{className:"size-3.5 text-emerald-400"}),r.jsxs("span",{className:"font-mono",children:[Fe(x.totalInputTokens)," / ",Fe(x.totalOutputTokens)]})]}),(x.totalCacheCreationInputTokens>0||x.totalCacheReadInputTokens>0)&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[r.jsx(or,{className:"size-3.5 text-purple-400"}),r.jsxs("span",{className:"font-mono",children:["KV Cache +",Fe(x.totalCacheCreationInputTokens)," / ~",Fe(x.totalCacheReadInputTokens)]})]}),k&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[r.jsx(sn,{className:"size-3.5"}),s&&r.jsx("span",{className:"font-mono",children:Ba(x.totalElapsedMs)}),x.maxElapsedMs!==null&&r.jsxs("span",{className:"font-mono text-muted-foreground/70",children:["max ",Ba(x.maxElapsedMs)]})]}),s&&j!==null&&r.jsx("span",{className:"font-mono text-muted-foreground/70",children:j}),(x.failedCallCount>0||x.pendingCallCount>0||x.slowCallCount>0)&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 text-amber-400",children:[r.jsx(rn,{className:"size-3.5"}),r.jsxs("span",{className:"font-mono",children:[x.failedCallCount," fail / ",x.pendingCallCount," pending /"," ",x.slowCallCount," slow"]})]}),r.jsx("span",{className:"flex-1"}),g&&r.jsx(Me,{variant:"outline",className:"h-6 px-2 text-[10px] font-mono",children:WE(x.knowledgeCandidateCount)}),r.jsxs(ke,{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"?r.jsx(Xe,{className:"size-3.5 animate-spin"}):r.jsx(Zf,{className:"size-3.5"}),"Candidate"]}),g&&r.jsx(ke,{type:"button",variant:"ghost",size:"icon",className:"size-7 text-muted-foreground",onClick:()=>c(P=>!P),"aria-expanded":l,"aria-label":l?"Collapse memory candidates":"Expand memory candidates",children:l?r.jsx(ot,{className:"size-3.5"}):r.jsx(Et,{className:"size-3.5"})})]}),u.status==="failed"&&r.jsx("p",{className:"mt-2 text-xs text-destructive",children:u.error}),r.jsx(JE,{insights:y}),l&&r.jsx(rA,{candidates:i,promotingCandidateIds:f,updatingCandidateIds:m,onPromoteCandidate:T,onUpdateCandidate:N,displayNumberByLogId:b})]})}function iA(e){let t=0,n=0;for(const s of e)s.inputTokens!==null&&(t+=s.inputTokens),s.outputTokens!==null&&(n+=s.outputTokens);return{totalInputTokens:t,totalOutputTokens:n}}function aA(e){const t=new Map;for(const n of e){if(n.model===null)continue;const s=Qj(n.model);if(s==="unknown")continue;let o=t.get(s);o===void 0&&(o=new Set,t.set(s,o)),o.add(n.model)}return[...t.entries()].map(([n,s])=>({provider:n,models:[...s]}))}function lA(e){for(const t of e){const n=t.clientPid;if(n!=null)return n}return null}function cA(e){for(const t of e){const n=t.clientProjectFolder;if(n!=null&&n!=="")return n}return null}const uA=p.memo(function({group:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:s,cacheTrends:o,onCompareWithPrevious:i,comparisonPredecessors:a,onClearGroup:l,showClientIdentity:c=!0,showProcessMetadata:u=!0,showLogClientMetadata:d=!0,defaultExpanded:f=!1,timeDisplayFormat:h,expanded:m,onExpandedChange:v}){const[g,x]=p.useState(f),b=m??g,y=p.useCallback(D=>{if(v!==void 0){v(D);return}x(D)},[v]);p.useEffect(()=>{!f||m!==void 0||x(!0)},[m,f]);const k=p.useMemo(()=>iA(e.logs),[e.logs]),j=p.useMemo(()=>aA(e.logs),[e.logs]),C=e.logs[0]?.timestamp??new Date().toISOString(),T=e.logs[e.logs.length-1]?.timestamp??new Date().toISOString(),N=e.logs.some(D=>D.responseStatus===null),P=p.useMemo(()=>lA(e.logs),[e.logs]),A=p.useMemo(()=>cA(e.logs),[e.logs]),z=p.useMemo(()=>Fa(e.logs),[e.logs]);return p.useEffect(()=>{const D=E=>{const L=bi(E);L!==null&&e.logs.some(w=>w.id===L.logId)&&y(!0)};return window.addEventListener(ln,D),()=>{window.removeEventListener(ln,D)}},[e.logs,y]),r.jsxs("div",{className:"mb-2",children:[r.jsx(_4,{conversationId:e.conversationId,startTime:C,endTime:T,totalCalls:e.logs.length,totalInputTokens:k.totalInputTokens,totalOutputTokens:k.totalOutputTokens,expanded:b,onToggle:()=>y(!b),providers:j,isLoading:N,userAgent:e.logs[0]?.userAgent??null,clientPid:P,clientProjectFolder:A,showClientIdentity:c,showProcessMetadata:u,timeDisplayFormat:h,onClear:()=>l(e.logs.map(D=>D.id))}),b&&r.jsxs("div",{children:[r.jsx(oA,{logs:e.logs,scopeId:e.conversationId,slowResponseThresholdSeconds:s,showRollupMetrics:!1,timeDisplayFormat:h}),r.jsx(EE,{turnGroups:z,viewMode:t,strip:n,slowResponseThresholdSeconds:s,timeDisplayFormat:h,cacheTrends:o,onCompareWithPrevious:i,comparisonPredecessors:a,showLogClientMetadata:d})]})]})});function Ua({className:e}){return r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:ie("inline-block size-5",e),children:[r.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"}),r.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),r.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),r.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),r.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"}),r.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),r.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),r.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),r.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),r.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]})}const dA="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 fA({className:e}){return r.jsx("img",{src:dA,alt:"Model Context Protocol","aria-hidden":"true",className:ie("inline-block size-8 object-contain invert",e)})}function Ns({...e}){return r.jsx(R3,{"data-slot":"select",...e})}function Ts({...e}){return r.jsx(z3,{"data-slot":"select-value",...e})}function Es({className:e,size:t="default",children:n,...s}){return r.jsxs(I3,{"data-slot":"select-trigger","data-size":t,className:ie("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),...s,children:[n,r.jsx(P3,{asChild:!0,children:r.jsx(ot,{className:"size-4 opacity-50"})})]})}function As({className:e,children:t,position:n="popper",align:s="center",...o}){return r.jsx(O3,{children:r.jsxs(M3,{"data-slot":"select-content",className:ie("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:s,...o,children:[r.jsx(pA,{}),r.jsx(L3,{className:ie("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),r.jsx(hA,{})]})})}function ft({className:e,children:t,...n}){return r.jsxs(D3,{"data-slot":"select-item",className:ie("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:[r.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:r.jsx(F3,{children:r.jsx(Ge,{className:"size-4"})})}),r.jsx($3,{children:t})]})}function pA({className:e,...t}){return r.jsx(B3,{"data-slot":"select-scroll-up-button",className:ie("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(_l,{className:"size-4"})})}function hA({className:e,...t}){return r.jsx(U3,{"data-slot":"select-scroll-down-button",className:ie("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(ot,{className:"size-4"})})}const mA=Ee(["critical","warning","notice"]),gA=Ee(["open"]),xA=Ee(["proxy","tool-schema","run","group"]),v0=Ee(["request-failure","request-timeout","slow-response","tool-schema","run-failure","group-failure","group-incomplete"]),bA=Ee(["log","session","run","group"]),vA=Ee(["anthropic","openai","unknown"]),yA=J({kind:bA,id:S(),label:S(),href:S().nullable()}),wA=J({id:S(),fingerprint:S(),severity:mA,category:v0,source:xA,status:gA,title:S(),message:S(),count:K().int().positive(),firstSeenAt:S(),lastSeenAt:S(),logIds:fe(K().int().positive()),sessionIds:fe(S()),runIds:fe(S()),groupIds:fe(S()),provider:S().nullable(),model:S().nullable(),apiFormat:vA.nullable(),evidence:fe(yA),metadata:Ye(S(),nt)}),_A=J({category:v0,count:K().int().nonnegative()}),y0=J({total:K().int().nonnegative(),open:K().int().nonnegative(),critical:K().int().nonnegative(),warning:K().int().nonnegative(),notice:K().int().nonnegative(),byCategory:fe(_A)}),kA=J({alerts:fe(wA),total:K().int().nonnegative(),limit:K().int().positive(),summary:y0}),jA=8e3,SA=1e4;function CA(e){const t=new URLSearchParams;e.severity!==void 0&&t.set("severity",e.severity),e.category!==void 0&&t.set("category",e.category),e.source!==void 0&&t.set("source",e.source),e.limit!==void 0&&t.set("limit",String(e.limit));const n=t.toString();return n.length>0?`/api/alerts?${n}`:"/api/alerts"}function NA(e,t){const n=qt(t?CA(e):null,s=>Ke(s,kA,SA));return{alerts:n.data?.alerts??[],total:n.data?.total??0,summary:n.data?.summary??null,isLoading:n.isLoading,error:n.error,mutate:n.mutate}}function TA(){const e=qt("/api/alerts/summary",t=>Ke(t,y0,jA),{refreshInterval:5e3,revalidateOnFocus:!0});return{summary:e.data??null,isLoading:e.isLoading,error:e.error,mutate:e.mutate}}const vi="relative size-8 rounded-md border-0 bg-white/[0.035] text-muted-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:bg-white/[0.065] hover:text-accent-foreground focus-visible:ring-ring/50",EA=["request-failure","request-timeout","slow-response","tool-schema","run-failure","group-failure","group-incomplete"];function w0(e){switch(e){case"critical":return"Critical";case"warning":return"Warning";case"notice":return"Notice"}}function AA(e){switch(e){case"proxy":return"Proxy";case"tool-schema":return"Tool schema";case"run":return"Run";case"group":return"Group"}}function fc(e){switch(e){case"request-failure":return"Request failure";case"request-timeout":return"Timeout";case"slow-response":return"Slow response";case"tool-schema":return"Tool calling";case"run-failure":return"Run failure";case"group-failure":return"Group failure";case"group-incomplete":return"Group incomplete"}}function RA(e){switch(e){case"critical":return"border-red-400/40 bg-red-500/12 text-red-100";case"warning":return"border-amber-300/35 bg-amber-400/12 text-amber-100";case"notice":return"border-sky-300/35 bg-sky-400/12 text-sky-100"}}function IA(e){switch(e){case"critical":return"bg-red-400";case"warning":return"bg-amber-300";case"notice":return"bg-sky-300"}}function zA(e){switch(e){case"critical":return"text-red-200";case"warning":return"text-amber-100";case"notice":return"text-sky-100"}}function PA(e){switch(e){case"request-failure":case"run-failure":case"group-failure":return r.jsx(p_,{className:"size-3.5"});case"request-timeout":case"slow-response":return r.jsx(Fy,{className:"size-3.5"});case"tool-schema":return r.jsx(rn,{className:"size-3.5"});case"group-incomplete":return r.jsx(dy,{className:"size-3.5"})}}function Wa(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 kt(e){return e.toLocaleString()}function _0(e){return e.provider!==null&&e.model!==null?`${e.provider} / ${e.model}`:e.provider!==null?e.provider:e.model!==null?e.model:"Unknown target"}function OA(e,t){const n={limit:100};return e!=="all"&&(n.severity=e),t!=="all"&&(n.category=t),n}function MA(e,t){if(t!==null){const n=e.find(s=>s.id===t);if(n!==void 0)return n}return e[0]??null}function Wr({label:e,count:t,tone:n}){const s=n==="critical"?"border-red-400/30 bg-red-500/10 text-red-100":n==="warning"?"border-amber-300/30 bg-amber-400/10 text-amber-100":n==="notice"?"border-sky-300/30 bg-sky-400/10 text-sky-100":"border-border bg-muted/40 text-foreground";return r.jsxs("div",{className:ie("rounded-md border px-3 py-2",s),children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase opacity-75",children:e}),r.jsx("div",{className:"mt-1 text-lg font-semibold leading-none",children:kt(t)})]})}function Hr({value:e,active:t,label:n,count:s,onClick:o}){return r.jsxs(ke,{type:"button",variant:t?"secondary":"ghost",size:"sm","aria-pressed":t,onClick:()=>o(e),className:"h-7 px-2",children:[n,s!==null?r.jsx(Me,{variant:"outline",children:kt(s)}):null]})}function LA({category:e,active:t,count:n,onClick:s}){return r.jsxs(ke,{type:"button",variant:t?"secondary":"ghost",size:"sm","aria-pressed":t,onClick:()=>s(e),className:"h-7 px-2",children:[PA(e),fc(e),r.jsx(Me,{variant:"outline",children:kt(n)})]})}function DA({alerts:e,selectedAlertId:t,isLoading:n,error:s,onSelect:o}){return n?r.jsxs("div",{className:"flex min-h-56 items-center justify-center rounded-md border border-dashed border-border text-xs text-muted-foreground",children:[r.jsx(Xe,{className:"mr-2 size-3.5 animate-spin"}),"Loading alerts..."]}):s!==void 0?r.jsx("div",{className:"rounded-md border border-red-300/30 bg-red-500/10 px-3 py-2 text-xs text-red-100",children:s.message}):e.length===0?r.jsx("div",{className:"flex min-h-56 items-center justify-center rounded-md border border-dashed border-border px-4 text-center text-xs text-muted-foreground",children:"No alerts match the current filters."}):r.jsx("div",{className:"min-h-0 space-y-2 overflow-y-auto pr-1",children:e.map(i=>{const a=i.id===t;return r.jsxs("button",{type:"button",onClick:()=>o(i.id),className:ie("w-full rounded-md border px-3 py-3 text-left transition-colors",a?"border-primary/60 bg-primary/12":"border-border bg-background/70 hover:border-primary/30 hover:bg-muted/60"),children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:ie("size-2 rounded-full",IA(i.severity))}),r.jsx("span",{className:ie("text-xs font-semibold",zA(i.severity)),children:w0(i.severity)}),r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:fc(i.category)})]}),r.jsx("div",{className:"mt-1 text-sm font-semibold leading-snug",children:i.title}),r.jsx("div",{className:"mt-1 line-clamp-2 text-xs text-muted-foreground",children:i.message})]}),i.count>1?r.jsxs(Me,{variant:"outline",className:"shrink-0",children:["x",kt(i.count)]}):null]}),r.jsxs("div",{className:"mt-2 flex min-w-0 items-start justify-between gap-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"min-w-0 leading-snug",children:_0(i)}),r.jsx("span",{className:"shrink-0",children:Wa(i.lastSeenAt)})]})]},i.id)})})}function $A({alert:e,onNavigate:t}){return e.evidence.length===0?r.jsx("span",{className:"text-xs text-muted-foreground",children:"No linked evidence"}):r.jsx("div",{className:"flex flex-wrap gap-2",children:e.evidence.map(n=>n.href===null?r.jsx(Me,{variant:"outline",children:n.label},`${n.kind}:${n.id}`):r.jsx(Me,{variant:"outline",asChild:!0,children:r.jsx("a",{href:n.href,onClick:t,children:n.label})},`${n.kind}:${n.id}`))})}function FA({alert:e,onNavigate:t}){return e===null?r.jsx("div",{className:"flex min-h-56 items-center justify-center rounded-md border border-dashed border-border px-4 text-center text-xs text-muted-foreground",children:"Select an alert to inspect its evidence."}):r.jsxs("div",{className:"min-h-0 overflow-y-auto rounded-md border border-border bg-background/70",children:[r.jsx("div",{className:ie("border-b px-4 py-3",RA(e.severity)),children:r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(Me,{variant:"outline",children:w0(e.severity)}),r.jsx(Me,{variant:"outline",children:AA(e.source)}),r.jsx(Me,{variant:"outline",children:fc(e.category)})]}),r.jsx("h3",{className:"mt-3 text-base font-semibold",children:e.title}),r.jsx("p",{className:"mt-1 text-sm opacity-85",children:e.message})]}),e.count>1?r.jsxs(Me,{variant:"outline",className:"shrink-0",children:[kt(e.count)," hits"]}):null]})}),r.jsxs("div",{className:"space-y-4 p-4",children:[r.jsxs("div",{className:"grid gap-2 text-xs sm:grid-cols-2",children:[r.jsx(dn,{label:"Target",value:_0(e)}),r.jsx(dn,{label:"Last seen",value:Wa(e.lastSeenAt)}),r.jsx(dn,{label:"First seen",value:Wa(e.firstSeenAt)}),r.jsx(dn,{label:"Protocol",value:e.apiFormat??"n/a"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"mb-2 text-xs font-semibold text-muted-foreground",children:"Evidence"}),r.jsx($A,{alert:e,onNavigate:t})]}),r.jsxs("div",{className:"grid gap-2 text-xs sm:grid-cols-2",children:[r.jsx(dn,{label:"Logs",value:e.logIds.length===0?"n/a":kt(e.logIds.length)}),r.jsx(dn,{label:"Sessions",value:e.sessionIds.length===0?"n/a":kt(e.sessionIds.length)}),r.jsx(dn,{label:"Runs",value:e.runIds.length===0?"n/a":kt(e.runIds.length)}),r.jsx(dn,{label:"Groups",value:e.groupIds.length===0?"n/a":kt(e.groupIds.length)})]})]})]})}function dn({label:e,value:t}){return r.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase text-muted-foreground",children:e}),r.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-foreground",children:t})]})}function Gu(){const[e,t]=p.useState(!1),[n,s]=p.useState("all"),[o,i]=p.useState("all"),[a,l]=p.useState(null),{summary:c,isLoading:u}=TA(),d=p.useMemo(()=>OA(n,o),[o,n]),{alerts:f,total:h,isLoading:m,error:v,mutate:g}=NA(d,e),x=p.useMemo(()=>MA(f,a),[f,a]);p.useEffect(()=>{!e||a!==null&&f.some(N=>N.id===a)||l(f[0]?.id??null)},[f,e,a]);const b=c?.total??0,y=c?.critical??0,k=c?.warning??0,j=c?.notice??0,C=y>0?"bg-red-500":k>0?"bg-amber-400":"bg-sky-400";return r.jsxs(Gn,{open:e,onOpenChange:t,children:[r.jsx(Xo,{asChild:!0,children:r.jsxs(ke,{type:"button",variant:"ghost",size:"icon",className:vi,"aria-label":"Alerts",title:"Alerts",children:[r.jsx(fa,{className:"size-4"}),u?r.jsx(Xe,{className:"absolute -right-0.5 -top-0.5 size-3 animate-spin text-muted-foreground"}):b>0?r.jsx("span",{className:ie("absolute -right-1 -top-1 min-w-4 rounded-full px-1 text-[10px] font-semibold leading-4 text-white",C),children:kt(b)}):null,r.jsx("span",{className:"sr-only",children:"Alerts"})]})}),r.jsxs(Kn,{className:"flex max-h-[86vh] max-w-6xl flex-col overflow-hidden",children:[r.jsxs(Jn,{children:[r.jsxs(Yn,{className:"flex items-center gap-2 pr-8",children:[r.jsx(fa,{className:"size-5 text-red-300"}),r.jsx("span",{children:"Alerts"}),r.jsx(Me,{variant:"outline",children:kt(b)})]}),r.jsx(Xp,{className:"sr-only",children:"Local alert board for captured Inspector evidence."})]}),r.jsxs("div",{className:"grid gap-2 sm:grid-cols-4",children:[r.jsx(Wr,{label:"Open",count:c?.open??0,tone:"neutral"}),r.jsx(Wr,{label:"Critical",count:y,tone:"critical"}),r.jsx(Wr,{label:"Warning",count:k,tone:"warning"}),r.jsx(Wr,{label:"Notice",count:j,tone:"notice"})]}),r.jsxs("div",{className:"flex min-h-0 flex-wrap items-center justify-between gap-2 border-y border-border py-3",children:[r.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.jsx(Hr,{value:"all",active:n==="all",label:"All",count:c?.total??null,onClick:s}),r.jsx(Hr,{value:"critical",active:n==="critical",label:"Critical",count:y,onClick:s}),r.jsx(Hr,{value:"warning",active:n==="warning",label:"Warning",count:k,onClick:s}),r.jsx(Hr,{value:"notice",active:n==="notice",label:"Notice",count:j,onClick:s})]}),r.jsxs(ke,{type:"button",variant:"outline",size:"sm",className:"h-7 shrink-0 px-2",onClick:()=>{g()},children:[r.jsx(yn,{className:"size-3.5"}),"Refresh"]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1",children:[r.jsx(ke,{type:"button",variant:o==="all"?"secondary":"ghost",size:"sm","aria-pressed":o==="all",onClick:()=>i("all"),className:"h-7 px-2",children:"All categories"}),EA.map(T=>{const N=c?.byCategory.find(P=>P.category===T)?.count??0;return N===0?null:r.jsx(LA,{category:T,active:o===T,count:N,onClick:i},T)})]}),r.jsxs("div",{className:"grid min-h-0 flex-1 gap-4 md:grid-cols-[360px_minmax(0,1fr)]",children:[r.jsxs("div",{className:"flex min-h-0 flex-col",children:[r.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs text-muted-foreground",children:[r.jsxs("span",{children:[kt(h)," matched"]}),r.jsx("span",{children:f.length<h?`${kt(f.length)} shown`:"Latest"})]}),r.jsx(DA,{alerts:f,selectedAlertId:x?.id??null,isLoading:m,error:v,onSelect:l})]}),r.jsx(FA,{alert:x,onNavigate:()=>t(!1)})]})]})]})}const BA=12e3;function UA(e){return e===null||e.evidence===null?null:`/api/groups/${encodeURIComponent(e.id)}/evidence`}function WA(e){const t=qt(UA(e),n=>Ke(n,B2,BA));return{evidenceResponse:t.data??null,isLoading:t.isLoading,error:t.error,mutate:t.mutate}}const HA=8e3;function VA(){const e=qt("/api/groups",t=>Ke(t,Hf,HA));return{groups:e.data?.groups??[],isLoading:e.isLoading,error:e.error,mutate:e.mutate}}const qA=3e3;function ZA(e,t){return{id:(e?.id??0)+1,message:t.message,tone:t.tone??"error"}}function k0(){const[e,t]=p.useState(null),n=p.useCallback(o=>{t(i=>ZA(i,o))},[]),s=p.useCallback(()=>{t(null)},[]);return p.useEffect(()=>{if(e===null)return;const o=window.setTimeout(()=>{t(null)},qA);return()=>{window.clearTimeout(o)}},[e]),{notice:e,showToast:n,dismissToast:s}}function j0({notice:e,onDismiss:t}){if(e===null)return null;const n=e.tone==="error",s=n?rn:ua;return r.jsx("div",{"aria-atomic":"true","aria-live":"polite",className:"pointer-events-none fixed top-4 right-4 z-[100] w-[min(calc(100vw-2rem),26rem)]",role:"status",children:r.jsxs("div",{className:ie("pointer-events-auto flex items-start gap-2 rounded-md border px-3 py-2 text-sm shadow-[0_18px_50px_rgba(0,0,0,0.45)] backdrop-blur",n?"border-red-400/30 bg-[#16090b]/95 text-red-100":"border-cyan-300/25 bg-[#071318]/95 text-cyan-100"),children:[r.jsx(s,{className:ie("mt-0.5 size-4 shrink-0",n?"text-red-300":"text-cyan-200")}),r.jsx("div",{className:"min-w-0 flex-1 break-words leading-5",children:e.message}),r.jsx("button",{type:"button",className:"inline-flex size-6 shrink-0 items-center justify-center rounded-md text-current/70 transition-colors hover:bg-white/10 hover:text-current","aria-label":"Dismiss notification",onClick:t,children:r.jsx(gr,{className:"size-3.5"})})]},e.id)})}const Zi=2e4;function GA(e,t){const n=`/api/groups/${encodeURIComponent(e)}`;return t?`${n}?deleteEvidence=1`:n}function KA(e){return"/api/groups"}function S0(e){let t=0,n=0,s=0,o=0;for(const i of e.members)switch(i.status){case"completed":t+=1;break;case"failed":case"cancelled":n+=1;break;case"running":s+=1;break;case"created":break;case null:o+=1;break}return{memberCount:e.members.length,completedMembers:t,failedMembers:n,runningMembers:s,missingStatusMembers:o}}function JA(e,t,n=null){return t!==null&&t.group.id===e.id?t.members.map(s=>({member:s.member,exportMember:s,source:"export"})):n!==null&&n.group.id===e.id&&n.members!==null?n.members.map(s=>({member:s.member,exportMember:s,source:"evidence"})):e.members.map(s=>({member:s,exportMember:null,source:"group"}))}function pc(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 hc(e){return e??"unknown"}function YA(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 yi(e){return e===null||e.trim().length===0?"-":e}function _t(e){return e.toLocaleString()}function Ha(e){return e==null?"-":e<1e3?`${_t(e)} ms`:`${(e/1e3).toFixed(1)} s`}function Rs(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 Ku(e){return e===null?"-":Rs(e)}function XA(e){const t=JSON.stringify(e),n=t===void 0?String(e):t;return n.length<=160?n:`${n.slice(0,157)}...`}function C0(...e){for(const t of e)if(t!==null&&t.trim().length>0)return t;return"-"}function QA(...e){for(const t of e)if(t!=null&&t.trim().length>0)return t;return null}function e6(e){const t=e.provider,n=e.model;return t!==null&&t.length>0&&n!==null&&n.length>0?`${t} / ${n}`:C0(t,n)}function t6(e,t){if(t!==null){const n=e.find(s=>s.id===t);if(n!==void 0)return n}return e[0]??null}function n6(e){return(e.exportMember?.session?.latestLogs??[])[0]??null}function s6(e){switch(e){case"export":return"fresh export";case"evidence":return"evidence";case"group":return"group"}}function r6(e,t){return t!==null&&t.group.id===e.id?t.evidence:e.evidence}function o6(e,t,n){return t!==null&&t.group.id===e.id?t.summary:n!==null&&n.group.id===e.id?n.summary:null}function i6(e,t,n){return t!==null&&t.group.id===e.id?t.jenkinsReport:n!==null&&n.group.id===e.id?n.report:null}function Ju(){const[e,t]=p.useState(!1),[n,s]=p.useState(null),[o,i]=p.useState(null),[a,l]=p.useState(null),[c,u]=p.useState(null),[d,f]=p.useState(null),[h,m]=p.useState(!1),[v,g]=p.useState(null),[x,b]=p.useState(null),[y,k]=p.useState(!1),{notice:j,showToast:C,dismissToast:T}=k0(),{groups:N,isLoading:P,error:A,mutate:z}=VA(),D=p.useMemo(()=>t6(N,n),[N,n]);p.useEffect(()=>{!e||n!==null&&N.some(X=>X.id===n)||s(N[0]?.id??null)},[N,e,n]);const E=D!==null&&c!==null&&c.group.id===D.id?c:null,{evidenceResponse:L,isLoading:w,error:$,mutate:ee}=WA(D),F=p.useCallback(()=>{z()},[z]),W=p.useCallback(async()=>{if(!(N.length===0||y)){k(!0),f(null),m(!1),b(null),l(null);try{const U=await Ke(KA(!1),Bf,Zi,{method:"DELETE"},X=>`Clear failed with status ${String(X.status)}`);u(null),s(null),await z(),await ee(),C({message:`Cleared ${_t(U.deleted)} group${U.deleted===1?"":"s"}.`,tone:"success"})}catch(U){C({message:U instanceof Error?U.message:"Unknown error clearing groups",tone:"error"})}finally{k(!1)}}},[y,N.length,z,ee,C]),Z=p.useCallback(async U=>{i(U.id),l(null);try{const X=await Ke(`/api/groups/${encodeURIComponent(U.id)}/evidence`,U2,Zi,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({latestLogLimit:10})},Ce=>`Export failed with status ${String(Ce.status)}`);u(X),await z(),await ee()}catch(X){l(X instanceof Error?X.message:String(X))}finally{i(null)}},[z,ee]),ue=p.useCallback(U=>{f(U),m(!1),b(null)},[]),V=p.useCallback(()=>{v===null&&(f(null),m(!1),b(null))},[v]),H=p.useCallback(U=>{s(U),f(null),m(!1),b(null)},[]),le=p.useCallback(async()=>{const U=d;if(U!==null){g(U.id),b(null);try{await Ke(GA(U.id,h),Ff,Zi,{method:"DELETE"},X=>`Delete failed with status ${String(X.status)}`),u(X=>X!==null&&X.group.id===U.id?null:X),s(X=>X===U.id?null:X),f(null),m(!1),await z(),await ee()}catch(X){b(X instanceof Error?X.message:String(X))}finally{g(null)}}},[h,d,z,ee]);return r.jsxs(Gn,{open:e,onOpenChange:t,children:[r.jsx(j0,{notice:j,onDismiss:T}),r.jsx(Xo,{asChild:!0,children:r.jsxs(ke,{type:"button",variant:"ghost",size:"icon",className:vi,"aria-label":"Evaluation groups",title:"Evaluation groups",children:[r.jsx(Wc,{className:"size-4"}),P?r.jsx(Xe,{className:"absolute -right-0.5 -top-0.5 size-3 animate-spin text-muted-foreground"}):N.length>0?r.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:N.length}):null,r.jsx("span",{className:"sr-only",children:"Evaluation groups"})]})}),r.jsxs(Kn,{className:"flex max-h-[85vh] max-w-5xl flex-col overflow-hidden",children:[r.jsx(Jn,{children:r.jsxs(Yn,{className:"flex items-center gap-2 pr-8",children:[r.jsx(Wc,{className:"size-5 text-muted-foreground"}),r.jsx("span",{children:"Groups"}),r.jsx(Me,{variant:"outline",children:_t(N.length)})]})}),r.jsxs("div",{className:"flex min-h-0 items-center justify-between gap-3 border-b border-border pb-3",children:[r.jsx("p",{className:"text-xs text-muted-foreground",children:"Evaluation batches, model runs, and exported evidence packs."}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsxs(ke,{type:"button",variant:"outline",size:"sm",disabled:N.length===0||y,onClick:()=>{W()},title:"Clear all groups. Session logs and run records stay intact.",children:[y?r.jsx(Xe,{className:"size-3.5 animate-spin"}):r.jsx(wn,{className:"size-3.5"}),"Clear"]}),r.jsxs(ke,{type:"button",variant:"outline",size:"sm",onClick:F,children:[r.jsx(yn,{className:"size-3.5"}),"Refresh"]})]})]}),r.jsxs("div",{className:"grid min-h-0 flex-1 gap-4 md:grid-cols-[260px_minmax(0,1fr)]",children:[r.jsx(a6,{groups:N,selectedGroupId:D?.id??null,isLoading:P,error:A,onSelect:H}),r.jsx(l6,{group:D,deleteTarget:d,deleteEvidence:h,exportResult:E,evidenceResponse:L,evidenceLoading:w,evidenceError:$,exportError:a,deleteError:x,exportingGroupId:o,deletingGroupId:v,onDeleteEvidenceChange:m,onExport:Z,onRequestDelete:ue,onCancelDelete:V,onConfirmDelete:()=>{le()}})]})]})]})}function a6({groups:e,selectedGroupId:t,isLoading:n,error:s,onSelect:o}){return n?r.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..."}):s!==void 0?r.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:s.message}):e.length===0?r.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."}):r.jsx("div",{className:"min-h-0 overflow-y-auto pr-1",children:r.jsx("div",{className:"space-y-2",children:e.map(i=>{const a=S0(i),l=t===i.id;return r.jsxs("button",{type:"button",onClick:()=>o(i.id),className:ie("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:[r.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[r.jsx("span",{className:"min-w-0 text-sm font-medium leading-snug",children:i.title}),r.jsx(Me,{variant:"outline",className:pc(i.status),children:hc(i.status)})]}),r.jsxs("div",{className:"mt-1 flex items-center gap-2 text-muted-foreground",children:[r.jsxs("span",{children:[a.memberCount," sessions"]}),r.jsx("span",{children:Rs(i.updatedAt)})]})]},i.id)})})})}function l6({group:e,deleteTarget:t,deleteEvidence:n,exportResult:s,evidenceResponse:o,evidenceLoading:i,evidenceError:a,exportError:l,deleteError:c,exportingGroupId:u,deletingGroupId:d,onDeleteEvidenceChange:f,onExport:h,onRequestDelete:m,onCancelDelete:v,onConfirmDelete:g}){if(e===null)return r.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=S0(e),b=o6(e,s,o),y=i6(e,s,o),k=r6(e,s),j=JA(e,s,o),C=u===e.id,T=d===e.id,N=t?.id===e.id;return r.jsx("div",{className:"min-h-0 overflow-y-auto pr-1",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[r.jsxs("div",{className:"min-w-0 space-y-1",children:[r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[r.jsx("h3",{className:"min-w-0 text-base font-semibold leading-snug",children:e.title}),r.jsx(Me,{variant:"outline",className:pc(e.status),children:hc(e.status)}),r.jsx(Me,{variant:"outline",children:e.kind})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:yi(e.project)}),r.jsxs("span",{children:["updated ",Rs(e.updatedAt)]})]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx(ke,{type:"button",variant:"outline",size:"icon",className:"size-8 text-red-600 hover:text-red-700","aria-label":"Delete group",title:"Delete group",disabled:T,onClick:()=>m(e),children:T?r.jsx(Xe,{className:"size-3.5 animate-spin"}):r.jsx(wn,{className:"size-3.5"})}),r.jsxs(ke,{type:"button",variant:"default",size:"sm",className:"shrink-0",disabled:C||T,onClick:()=>{h(e)},children:[C?r.jsx(Xe,{className:"size-3.5 animate-spin"}):r.jsx(mr,{className:"size-3.5"}),"Export evidence"]})]})]}),e.task!==null&&e.task.trim().length>0&&r.jsx("p",{className:"rounded-md border border-border bg-muted/20 px-3 py-2 text-xs text-muted-foreground",children:e.task}),N&&r.jsx(c6,{group:e,deleteEvidence:n,isDeleting:T,error:c,onDeleteEvidenceChange:f,onCancel:v,onConfirm:g}),r.jsxs("div",{className:"grid gap-2 sm:grid-cols-4",children:[r.jsx(fn,{label:"Members",value:x.memberCount}),r.jsx(fn,{label:"Done",value:x.completedMembers}),r.jsx(fn,{label:"Failed",value:x.failedMembers}),r.jsx(fn,{label:"Running",value:x.runningMembers})]}),b!==null&&r.jsxs("div",{className:"grid gap-2 sm:grid-cols-4",children:[r.jsx(fn,{label:"Requests",value:b.requestCount}),r.jsx(fn,{label:"Errors",value:b.errorCount}),r.jsx(fn,{label:"Tokens",value:b.tokenUsage.total}),r.jsx(fn,{label:"Missing",value:b.missingSessions})]}),r.jsx(u6,{report:y,loading:i,error:a,hasEvidence:k!==null}),r.jsx(d6,{evidence:k}),l!==null&&r.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&&!N&&r.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:c}),r.jsx(f6,{rows:j})]})})}function c6({group:e,deleteEvidence:t,isDeleting:n,error:s,onDeleteEvidenceChange:o,onCancel:i,onConfirm:a}){const l=e.evidence!==null,c=e.evidence?.markdownPath??"No evidence pack exported.";return r.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-3 text-red-900",children:r.jsxs("div",{className:"flex min-w-0 flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[r.jsxs("div",{className:"min-w-0 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[r.jsx(wn,{className:"size-4 text-red-600"}),r.jsx("span",{children:"Delete group?"})]}),r.jsxs("p",{className:"text-xs text-red-800",children:["Delete ",r.jsx("span",{className:"font-medium",children:e.title}),". Session logs and run records stay intact."]}),r.jsxs("label",{className:ie("flex min-w-0 items-start gap-2 text-xs",l?"cursor-pointer":"opacity-60"),children:[r.jsx("input",{type:"checkbox",className:"mt-0.5 size-4 shrink-0",checked:t,disabled:!l||n,onChange:u=>o(u.currentTarget.checked)}),r.jsxs("span",{className:"min-w-0",children:[r.jsx("span",{className:"block font-medium",children:"Also delete exported evidence files"}),r.jsx("code",{className:"mt-1 block truncate font-mono text-[11px] text-red-700",children:c})]})]}),s!==null&&r.jsx("div",{className:"rounded-md border border-red-200 bg-white px-2 py-1.5 text-xs text-red-700",children:s})]}),r.jsxs("div",{className:"flex shrink-0 justify-end gap-2",children:[r.jsx(ke,{type:"button",variant:"outline",size:"sm",disabled:n,onClick:i,children:"Cancel"}),r.jsxs(ke,{type:"button",variant:"destructive",size:"sm",disabled:n,onClick:a,children:[n?r.jsx(Xe,{className:"size-3.5 animate-spin"}):r.jsx(wn,{className:"size-3.5"}),"Delete"]})]})]})})}function fn({label:e,value:t}){return r.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[r.jsx("div",{className:"text-[11px] font-medium uppercase text-muted-foreground",children:e}),r.jsx("div",{className:"mt-1 font-mono text-sm font-semibold",children:_t(t)})]})}function u6({report:e,loading:t,error:n,hasEvidence:s}){const{copied:o,copy:i}=gn(e?.markdown??null);return e===null&&!t&&n===void 0?null:t?r.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:[r.jsx(Xe,{className:"size-3.5 animate-spin"}),"Loading evidence report..."]}):n!==void 0&&s?r.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:r.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:"text-xs font-semibold",children:"Evidence report"}),r.jsx(Me,{variant:"outline",className:YA(e.status),children:e.status})]}),r.jsx(ke,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":o?"Copied evidence report":"Copy evidence report",onClick:i,children:o?r.jsx(Ge,{className:"size-3.5 text-emerald-500"}):r.jsx(Rt,{className:"size-3.5"})})]}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:e.summary})]})}function d6({evidence:e}){return e===null?r.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."}):r.jsxs("div",{className:"space-y-2 rounded-md border border-border bg-muted/20 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-xs font-semibold",children:"Evidence paths"}),r.jsx("span",{className:"text-[11px] text-muted-foreground",children:Rs(e.exportedAt)})]}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Gi,{label:"JSON",value:e.jsonPath}),r.jsx(Gi,{label:"Markdown",value:e.markdownPath}),r.jsx(Gi,{label:"HTML",value:e.htmlPath})]})]})}function Gi({label:e,value:t}){const{copied:n,copy:s}=gn(t);return r.jsxs("div",{className:"flex min-w-0 items-center gap-2 rounded-md border border-border bg-background px-2 py-1.5",children:[r.jsx("span",{className:"w-16 shrink-0 text-[11px] font-medium text-muted-foreground",children:e}),r.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs",children:t}),r.jsx(ke,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":n?`Copied ${e} path`:`Copy ${e} path`,onClick:s,children:n?r.jsx(Ge,{className:"size-3.5 text-emerald-500"}):r.jsx(Rt,{className:"size-3.5"})})]})}function f6({rows:e}){const[t,n]=p.useState(null),s=p.useCallback(o=>{n(i=>i===o?null:o)},[]);return e.length===0?r.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."}):r.jsxs("div",{className:"overflow-hidden rounded-md border border-border",children:[r.jsx("div",{className:"border-b border-border bg-muted/30 px-3 py-2 text-xs font-semibold",children:"Members"}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full min-w-[760px] text-left text-xs",children:[r.jsx("thead",{className:"border-b border-border bg-muted/20 text-muted-foreground",children:r.jsxs("tr",{children:[r.jsx("th",{className:"px-3 py-2 font-medium",children:"Session"}),r.jsx("th",{className:"px-3 py-2 font-medium",children:"Provider / Model"}),r.jsx("th",{className:"px-3 py-2 font-medium",children:"Status"}),r.jsx("th",{className:"px-3 py-2 font-medium",children:"Requests"}),r.jsx("th",{className:"px-3 py-2 font-medium",children:"Errors"}),r.jsx("th",{className:"px-3 py-2 font-medium",children:"First chunk"}),r.jsx("th",{className:"px-3 py-2 font-medium",children:"Tokens"})]})}),r.jsx("tbody",{children:e.map(o=>{const i=t===o.member.id;return r.jsxs(p.Fragment,{children:[r.jsx(p6,{row:o,isExpanded:i,onToggleDetails:s}),r.jsx(h6,{row:o,isExpanded:i})]},o.member.id)})})]})})]})}function p6({row:e,isExpanded:t,onToggleDetails:n}){const s=e.member,o=e.exportMember?.session??null,i=n6(e),a=o?.inspectorPath??Ud(s.sessionId),l=e.source!=="evidence",c=o?.requestCount??null,u=o?.errorCount??null,d=o?.tokenUsage.total??null,f=i?.firstChunkMs??null,h=C0(s.label,s.sessionId),m=QA(o?.clientUserAgent,i?.userAgent,s.agent),v=o?.clientProjectFolder??null,g=Dl({userAgent:m,conversationId:s.sessionId,clientProjectFolder:v}),x=Qo(g);return r.jsxs("tr",{className:"border-b border-border last:border-0 hover:bg-muted/20",children:[r.jsxs("td",{className:"max-w-56 px-3 py-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[r.jsx(ke,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0 text-muted-foreground","aria-label":t?`Hide member ${h}`:`Show member ${h}`,title:t?"Hide member details":"Show member details",onClick:()=>{n(s.id)},children:t?r.jsx(ot,{className:"size-3.5"}):r.jsx(Et,{className:"size-3.5"})}),x!==null&&r.jsx(ei,{client:g,className:"size-5"}),l?r.jsxs("a",{href:a,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 ${h}`,title:`Open session ${h}`,children:[r.jsx("span",{className:"min-w-0 truncate",children:h}),r.jsx(jl,{className:"size-3 shrink-0 text-muted-foreground"})]}):r.jsxs("button",{type:"button",className:"inline-flex max-w-full min-w-0 items-center gap-2 rounded-sm font-mono text-xs text-foreground outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",title:`Show evidence snapshot for ${h}`,"aria-label":`Show evidence snapshot for ${h}`,onClick:()=>{n(s.id)},children:[r.jsx("span",{className:"min-w-0 truncate",children:h}),r.jsx(Me,{variant:"outline",className:"shrink-0 border-zinc-200 bg-zinc-50 text-zinc-600",children:"evidence"})]})]}),r.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:yi(s.agent)})]}),r.jsx("td",{className:"max-w-52 px-3 py-2",children:r.jsx("span",{className:"block whitespace-normal leading-snug",children:e6(s)})}),r.jsx("td",{className:"px-3 py-2",children:r.jsx(Me,{variant:"outline",className:pc(s.status),children:hc(s.status)})}),r.jsx("td",{className:"px-3 py-2 font-mono",children:c===null?"-":_t(c)}),r.jsx("td",{className:"px-3 py-2 font-mono",children:u===null?"-":_t(u)}),r.jsx("td",{className:"px-3 py-2 font-mono",children:Ha(f)}),r.jsx("td",{className:"px-3 py-2 font-mono",children:d===null?"-":_t(d)})]})}function h6({row:e,isExpanded:t}){if(!t)return null;const n=e.member,s=e.exportMember,o=s?.session??null,i=s?.run??null,a=Object.entries(n.metadata);return r.jsx("tr",{className:"border-b border-border bg-muted/10",children:r.jsx("td",{colSpan:7,className:"px-3 pb-4 pt-2",children:r.jsxs("div",{className:"space-y-3 rounded-md border border-border bg-background p-3",children:[r.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-4",children:[r.jsx(st,{label:"Source",value:s6(e.source)}),r.jsx(st,{label:"Member ID",value:n.id,mono:!0}),r.jsx(st,{label:"Session ID",value:n.sessionId,mono:!0}),r.jsx(st,{label:"Run ID",value:i?.id??n.runId??"-",mono:!0}),r.jsx(st,{label:"Created",value:Rs(n.addedAt)}),r.jsx(st,{label:"Updated",value:Rs(n.updatedAt)}),r.jsx(st,{label:"Session created",value:Ku(o?.createdAt??null)}),r.jsx(st,{label:"Session updated",value:Ku(o?.updatedAt??null)})]}),o===null?r.jsx("div",{className:"rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground",children:"No session snapshot is available for this member."}):r.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-4",children:[r.jsx(st,{label:"Log coverage",value:o.logCoverage}),r.jsx(st,{label:"Runtime",value:yi(o.runtimeMode)}),r.jsx(st,{label:"Requests",value:_t(o.requestCount),mono:!0}),r.jsx(st,{label:"Errors",value:_t(o.errorCount),mono:!0}),r.jsx(st,{label:"Input tokens",value:_t(o.tokenUsage.input),mono:!0}),r.jsx(st,{label:"Output tokens",value:_t(o.tokenUsage.output),mono:!0}),r.jsx(st,{label:"Cache read",value:_t(o.tokenUsage.cacheRead),mono:!0}),r.jsx(st,{label:"Total tokens",value:_t(o.tokenUsage.total),mono:!0})]}),r.jsx(m6,{logs:o?.latestLogs??[]}),r.jsx(g6,{entries:a})]})})})}function st({label:e,value:t,mono:n=!1}){return r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:e}),r.jsx("div",{className:ie("truncate text-xs text-foreground",n?"font-mono":""),title:t,children:t})]})}function m6({logs:e}){const t=e.slice(0,5);return t.length===0?r.jsx("div",{className:"rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground",children:"No latest logs in this snapshot."}):r.jsxs("div",{className:"overflow-hidden rounded-md border border-border",children:[r.jsx("div",{className:"border-b border-border bg-muted/30 px-3 py-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Latest logs"}),r.jsx("div",{className:"divide-y divide-border",children:t.map(n=>{const s=n.sessionLogNumber??n.id;return r.jsxs("div",{className:"grid gap-2 px-3 py-2 text-xs sm:grid-cols-[72px_1fr_88px_88px]",children:[r.jsxs("span",{className:"font-mono text-muted-foreground",title:`Log ID ${String(n.id)}`,children:["#",s]}),r.jsxs("span",{className:"min-w-0 truncate",children:[yi(n.model)," · ",n.apiFormat," · ",n.path]}),r.jsx("span",{className:"font-mono text-muted-foreground",children:Ha(n.firstChunkMs)}),r.jsx("span",{className:"font-mono text-muted-foreground",children:Ha(n.latencyMs)})]},n.id)})})]})}function g6({entries:e}){return e.length===0?null:r.jsxs("div",{className:"overflow-hidden rounded-md border border-border",children:[r.jsx("div",{className:"border-b border-border bg-muted/30 px-3 py-2 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Metadata"}),r.jsx("div",{className:"grid gap-x-3 gap-y-2 p-3 text-xs sm:grid-cols-2",children:e.map(([t,n])=>{const s=XA(n);return r.jsxs("div",{className:"min-w-0",children:[r.jsx("span",{className:"mr-2 text-muted-foreground",children:t}),r.jsx("span",{className:"font-mono text-foreground",title:s,children:s})]},t)})})]})}const x6=J({name:S(),apiKey:S(),format:Ee(["anthropic","openai"]),anthropicBaseUrl:S(),openaiBaseUrl:S(),openaiResponsesBaseUrl:S().optional().default(""),models:fe(S()),sourceTool:Ee(["claude-code","opencode","mimo-code"]),alreadyExists:Le()}),b6=J({providers:fe(x6),warnings:fe(S()).optional()}),v6=J({success:Le().optional(),imported:K().optional(),message:S().optional(),errors:fe(S()).optional()}),Yu=2e4;function y6({open:e,onOpenChange:t,onImportComplete:n}){const[s,o]=p.useState(!1),[i,a]=p.useState(null),[l,c]=p.useState([]),[u,d]=p.useState([]),[f,h]=p.useState(new Set),[m,v]=p.useState(!1),[g,x]=p.useState(null),[b,y]=p.useState(null),k=p.useRef(0),j=p.useRef(0),C=p.useCallback(()=>{const A=k.current+1;k.current=A,o(!0),a(null),d([]),c([]),h(new Set),x(null),y(null),Ke("/api/providers/scan",b6,Yu,void 0,z=>`Scan failed (${String(z.status)})`).then(z=>{if(k.current!==A)return;c(z.providers),d(z.warnings??[]);const D=new Set;z.providers.forEach((E,L)=>{E.alreadyExists||D.add(L)}),h(D)}).catch(z=>{k.current===A&&a(z instanceof Error?z.message:String(z))}).finally(()=>{k.current===A&&o(!1)})},[]);p.useEffect(()=>{e&&C()},[e,C]),p.useEffect(()=>{e||(k.current+=1,j.current+=1,o(!1),v(!1))},[e]);const T=p.useCallback(A=>{h(z=>{const D=new Set(z);return D.has(A)?D.delete(A):D.add(A),D})},[]),N=p.useCallback(()=>{const A=l.filter((L,w)=>f.has(w));if(A.length===0)return;const z=j.current+1;j.current=z,v(!0),y(null),x(null);const D=new Date().toISOString(),E=A.map(L=>({id:window.crypto.randomUUID(),name:L.name,apiKey:L.apiKey,format:L.format,anthropicBaseUrl:L.anthropicBaseUrl,openaiBaseUrl:L.openaiBaseUrl,openaiResponsesBaseUrl:L.openaiResponsesBaseUrl,models:L.models,createdAt:D,updatedAt:D}));Ke("/api/providers/import",v6,Yu,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providers:E})},L=>`Import failed (${String(L.status)})`).then(L=>{j.current===z&&(c(w=>w.map(($,ee)=>f.has(ee)?{...$,alreadyExists:!0}:$)),h(new Set),L.errors!==void 0&&L.errors.length>0&&L.message!==void 0?x(L.message):x(`Imported ${L.imported??A.length} provider(s)`),n())}).catch(L=>{j.current===z&&y(L instanceof Error?L.message:String(L))}).finally(()=>{j.current===z&&v(!1)})},[l,f,n]),P=l.some(A=>!A.alreadyExists);return r.jsx(Gn,{open:e,onOpenChange:t,children:r.jsxs(Kn,{className:"max-w-xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(Jn,{children:[r.jsx(Yn,{children:"Import from External Tools"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Detect provider configurations from Claude Code, OpenCode, and MiMo Code."})]}),r.jsxs("div",{className:"flex-1 overflow-y-auto space-y-3",children:[s&&r.jsxs("div",{className:"flex items-center justify-center py-8 gap-2 text-muted-foreground",children:[r.jsx(Xe,{className:"size-4 animate-spin"}),r.jsx("span",{className:"text-sm",children:"Scanning for external providers..."})]}),i!==null&&r.jsxs("div",{className:"flex items-center gap-2 text-destructive text-sm py-4",children:[r.jsx(_s,{className:"size-4"}),i]}),!s&&i===null&&l.length===0&&r.jsxs("p",{className:"text-sm text-muted-foreground py-8 text-center",children:["No external provider configurations found.",r.jsx("br",{}),r.jsx("span",{className:"text-xs",children:"Supported tools: Claude Code (~/.claude/settings.json), OpenCode (~/.config/opencode/opencode.json), MiMo Code (~/.config/mimocode/mimocode.jsonc)"})]}),!s&&l.map((A,z)=>r.jsxs("label",{className:`flex items-start gap-3 p-3 border rounded-md ${A.alreadyExists?"":"cursor-pointer hover:bg-muted/50"}`,children:[!A.alreadyExists&&r.jsx("input",{type:"checkbox",checked:f.has(z),disabled:m,onChange:()=>T(z),className:"mt-0.5 size-4"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(ei,{client:A.sourceTool,className:"size-7 rounded-[8px]"}),A.alreadyExists&&r.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Already added"})]}),r.jsxs("div",{className:"mt-1 text-xs leading-snug text-muted-foreground",children:[A.models.slice(0,4).join(", "),A.models.length>4?` +${A.models.length-4} more`:""]}),r.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:A.format==="anthropic"?A.anthropicBaseUrl:A.openaiResponsesBaseUrl!==""?A.openaiResponsesBaseUrl:A.openaiBaseUrl}),r.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 font-mono",children:A.apiKey.length>8?`${A.apiKey.slice(0,4)}••••${A.apiKey.slice(-4)}`:"••••"})]})]},`${A.sourceTool}-${A.name}`)),u.length>0&&r.jsx("div",{className:"text-xs text-muted-foreground space-y-1 border-t pt-2",children:u.map((A,z)=>r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(_s,{className:"size-3"}),A]},z))}),g!==null&&r.jsx("div",{className:"text-sm text-green-500 border-t pt-2",children:g}),b!==null&&r.jsx("div",{className:"text-sm text-destructive border-t pt-2",children:b})]}),r.jsxs("div",{className:"flex items-center justify-between pt-3 border-t",children:[r.jsxs(ke,{variant:"outline",size:"sm",onClick:C,disabled:s,children:[r.jsx(Xe,{className:`size-3 mr-1 ${s?"animate-spin":""}`}),"Rescan"]}),r.jsxs(ke,{size:"sm",onClick:N,disabled:!P||f.size===0||m,children:[r.jsx(mr,{className:"size-3 mr-1"}),m?"Importing...":`Import Selected (${f.size})`]})]})]})})}function N0(e){return e.length<=8?"••••••••":e.slice(0,4)+"••••••••"+e.slice(-4)}const T0=J({id:S().min(1),aliases:fe(S()).optional().default([]),contextWindow:K().int().positive().optional(),outputLimit:K().int().positive().optional(),sourceUrl:S().optional()}),w6=J({name:S().min(1).optional(),aliases:fe(S()).optional().default([]),baseUrls:fe(S()).optional().default([]),models:fe(T0).min(1)});J({version:K().int().positive().optional(),updatedAt:S().optional(),providers:fe(w6).optional().default([]),models:fe(T0).optional().default([])});function Xu(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}function _6(e){const t=e.models.filter(n=>n.trim()!=="");return t.length>0?t:e.model!==void 0&&e.model.trim()!==""?[e.model]:[]}function mc(e,t){const n=Xu(t);return(e.modelMetadata??[]).find(o=>Xu(o.model)===n)??null}function k6(e){const t=_6(e);return t.length===0?!1:t.every(n=>{const s=mc(e,n);return s!==null&&s.contextWindow!==void 0})}function j6(e,t){if(e===null)return null;for(const n of t){const s=mc(n,e);if(s!==null&&s.contextWindow!==void 0)return{providerName:n.name,model:s.model,tokens:s.contextWindow,sourceUrl:s.sourceUrl}}return null}const S6={deepseek:"https://api-docs.deepseek.com/zh-cn/"};function E0(e){return Object.prototype.hasOwnProperty.call(e,"success")}function A0(e){return Object.prototype.hasOwnProperty.call(e,"notConfigured")}function yt(e){return e!==void 0&&e.trim()!==""}function Va(e){if(e===void 0)return;const t=Object.entries(e).map(([n,s])=>`${n}: ${s}`);if(t.length!==0)return t.join(`
|
|
104
|
+
`)}function Qu(e){return Va(e)!==void 0}function ed(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function C6(e){return e>=10?`${e.toFixed(0)}/s`:`${e.toFixed(1)}/s`}function N6(e){const t=e.debug;return yt(e.error?.hint)||yt(e.error?.details)||yt(e.rawResponse)||yt(t?.requestUrl)||yt(t?.requestBody)||yt(t?.responseBody)||Qu(t?.requestHeaders)||Qu(t?.responseHeaders)||t?.responseStatus!==void 0}function pn({title:e,children:t}){return r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"font-medium text-foreground/80",children:e}),t]})}function Zs({value:e}){return r.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 T6({result:e}){const t=e.debug,n=t?.requestUrl,s=t?.requestMethod??"POST",o=Va(t?.requestHeaders),i=Va(t?.responseHeaders),a=t?.responseStatus!==void 0?`${t.responseStatus}${yt(t.responseStatusText)?` ${t.responseStatusText}`:""}`:void 0,l=t?.responseBody??e.rawResponse;return r.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:[yt(e.error?.hint)&&r.jsx(pn,{title:"Hint",children:r.jsx("div",{children:e.error.hint})}),yt(e.error?.details)&&r.jsx(pn,{title:"Error",children:r.jsx(Zs,{value:e.error.details})}),yt(n)&&r.jsx(pn,{title:"Request",children:r.jsxs("div",{className:"rounded-md bg-background/80 p-2 font-mono text-[11px] break-all text-foreground/80",children:[s," ",n]})}),o!==void 0&&r.jsx(pn,{title:"Request Headers",children:r.jsx(Zs,{value:o})}),yt(t?.requestBody)&&r.jsx(pn,{title:"Request Body",children:r.jsx(Zs,{value:t.requestBody})}),yt(a)&&r.jsx(pn,{title:"Response Status",children:r.jsx("div",{className:"rounded-md bg-background/80 p-2 font-mono text-[11px] text-foreground/80",children:a})}),i!==void 0&&r.jsx(pn,{title:"Response Headers",children:r.jsx(Zs,{value:i})}),yt(l)&&r.jsx(pn,{title:"Response Body",children:r.jsx(Zs,{value:l})})]})}function as({results:e}){return r.jsxs("div",{className:"grid min-w-0 gap-2 sm:grid-cols-2",children:[r.jsxs("div",{className:"min-w-0 rounded-md border border-border/60 bg-muted/20 px-2 py-1.5",children:[r.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Non-stream"}),r.jsx(td,{result:e.nonStreaming})]}),r.jsxs("div",{className:"min-w-0 rounded-md border border-border/60 bg-muted/20 px-2 py-1.5",children:[r.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Stream"}),r.jsx(td,{result:e.streaming})]})]})}function Ki({label:e,children:t}){return r.jsxs("div",{className:"min-w-0 space-y-2 rounded-md border border-border/60 bg-muted/15 p-2",children:[r.jsx("div",{className:"text-xs font-medium text-foreground/80",children:e}),t]})}function Ze(e){return e!==void 0&&e!==""}function E6(e){const t=[];return Ze(e.anthropicBaseUrl)&&t.push("Anthropic"),Ze(e.openaiBaseUrl)&&t.push("Chat"),Ze(e.openaiResponsesBaseUrl)&&t.push("Responses"),t}function Ji({label:e,enabled:t,tone:n}){const o=(n??(t?"active":"quiet"))==="response"&&t?"border-sky-300/30 bg-sky-300/[0.09] text-sky-100":t?"border-border/70 bg-muted/25 text-foreground/80":"border-border/50 bg-transparent text-muted-foreground/70";return r.jsxs("span",{className:`inline-flex items-center gap-1 rounded border px-1.5 py-0.5 ${o}`,children:[t?r.jsx(kl,{className:"size-3"}):r.jsx(Xf,{className:"size-3"}),e]})}function A6({provider:e}){const t=Ze(e.anthropicBaseUrl),n=Ze(e.openaiBaseUrl),s=Ze(e.openaiResponsesBaseUrl);return!t&&!n&&!s?r.jsx("div",{className:"text-xs text-muted-foreground",children:"Test requires at least one configured endpoint."}):r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx("span",{children:"Capabilities"}),t&&r.jsx(Ji,{label:"Anthropic",enabled:!0}),n&&r.jsx(Ji,{label:"OpenAI Chat",enabled:!0}),r.jsx(Ji,{label:s?"OpenAI Responses":"No OpenAI Responses",enabled:s,tone:"response"}),r.jsx("span",{children:"tested non-stream + stream"})]})}function R6(e,t){if(t===void 0)return[];const n=[];return Ze(e.anthropicBaseUrl)&&n.push(t.anthropic),Ze(e.openaiBaseUrl)&&n.push(t.openaiChat),Ze(e.openaiResponsesBaseUrl)&&n.push(t.openaiResponses),n}function I6(e,t){const n={total:0,passed:0,failed:0,testing:0};for(const s of R6(e,t))for(const o of[s.nonStreaming,s.streaming])A0(o)||(n.total+=1,E0(o)?o.success?n.passed+=1:n.failed+=1:n.testing+=1);return n}function z6({provider:e,testResults:t,isTesting:n}){const s=E6(e),o=I6(e,t);return n?r.jsxs("span",{className:"inline-flex items-center gap-1 rounded border border-cyan-300/25 bg-cyan-300/[0.08] px-2 py-1 text-xs text-cyan-100",children:[r.jsx(bo,{className:"size-3 animate-spin"}),"Testing"]}):s.length===0?r.jsx("span",{className:"rounded border border-border/70 bg-muted/20 px-2 py-1 text-xs text-muted-foreground",children:"No endpoint"}):t===void 0||o.total===0?r.jsx("span",{className:"rounded border border-border/70 bg-muted/20 px-2 py-1 text-xs text-muted-foreground",children:"Not tested"}):o.failed>0?r.jsxs("span",{className:"inline-flex items-center gap-1 rounded border border-red-400/25 bg-red-500/[0.08] px-2 py-1 text-xs text-red-200",children:[r.jsx(_s,{className:"size-3"}),o.passed,"/",o.total," passed"]}):o.testing>0||o.passed<o.total?r.jsxs("span",{className:"rounded border border-amber-300/25 bg-amber-400/[0.08] px-2 py-1 text-xs text-amber-100",children:["Partial ",o.passed,"/",o.total]}):r.jsxs("span",{className:"inline-flex items-center gap-1 rounded border border-cyan-300/25 bg-cyan-300/[0.08] px-2 py-1 text-xs text-cyan-100",children:[r.jsx(kl,{className:"size-3"}),"OK ",o.passed,"/",o.total]})}function P6(e){const t=e.models??[];if(t.length===0)return"No models configured";const n=t.slice(0,2).join(", "),s=t.length-2;return s>0?`${n} +${s} more`:n}function O6({provider:e,model:t}){const n=mc(e,t),s=$6(n?.sourceUrl);return r.jsxs("span",{className:"inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",children:[r.jsx("span",{children:t}),n!==null&&n.contextWindow!==void 0&&r.jsx("span",{className:"font-mono text-foreground/80",children:yp(n.contextWindow)}),s!==null&&r.jsx(jn,{children:r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.jsx("a",{href:s.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":s.title,children:s.label})}),r.jsx(dt,{children:s.title})]})})]})}function M6(e){const t=e?.models;if(t===void 0)return null;const n=Object.keys(t).length;return n===0?null:`${n} model${n===1?"":"s"} tested`}function L6(e){const t={className:"size-3",strokeWidth:2};switch(e){case"timeout":return r.jsx(sn,{...t});case"network_unreachable":return r.jsx(j_,{...t});case"connection_refused":return r.jsx(C_,{...t});case"auth_failed":return r.jsx(Tw,{...t});case"rate_limited":return r.jsx(Nl,{...t});case"server_error":return r.jsx(c_,{...t});case"invalid_response":return r.jsx(Oy,{...t});case"unknown":return r.jsx(_s,{...t});default:return r.jsx(_s,{...t})}}function td({result:e}){const[t,n]=p.useState(!1);if(!E0(e))return A0(e)?r.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[r.jsx(Xf,{className:"size-3"}),r.jsx("span",{children:"Not configured"})]}):r.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[r.jsx(bo,{className:"size-3 animate-spin"}),r.jsx("span",{children:"Testing..."})]});if(e.success){const l=[],c=[];e.inputTokens!==void 0&&l.push(r.jsxs("span",{children:[e.inputTokens," in"]},"in")),e.outputTokens!==void 0&&l.push(r.jsxs("span",{children:[e.outputTokens," out"]},"out")),e.cacheCreationInputTokens!==void 0&&e.cacheCreationInputTokens>0&&l.push(r.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(r.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(r.jsxs("span",{children:["first ",ed(e.firstChunkMs)]},"first")),e.totalStreamMs!==void 0&&e.totalStreamMs!==null&&c.push(r.jsxs("span",{children:["total ",ed(e.totalStreamMs)]},"total")),e.tokensPerSecond!==void 0&&e.tokensPerSecond!==null&&e.tokensPerSecond>0&&c.push(r.jsxs("span",{children:[C6(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 r.jsxs("div",{className:"flex shrink-0 items-center gap-1 text-xs text-cyan-100",children:[r.jsx(kl,{className:"size-3 text-cyan-300"}),r.jsx("span",{children:"Connected"}),l.length>0&&r.jsxs("span",{className:"text-muted-foreground",children:["(",u,")"]}),c.length>0&&r.jsxs("span",{className:"hidden text-muted-foreground lg:inline",children:["(",d,")"]})]})}const s=e.error,o=s?.message??"Connection failed",i=s?.type??"unknown",a=N6(e);return r.jsxs("div",{className:"flex flex-col gap-1 shrink-0",children:[r.jsxs("div",{className:"flex items-center gap-1 text-xs text-red-600 max-w-[200px]",children:[L6(i),r.jsx("span",{className:"truncate",children:o}),a&&r.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?r.jsx(Sl,{className:"size-3"}):r.jsx(Cl,{className:"size-3"}),r.jsx("span",{children:t?"Hide":"Details"})]})]}),t&&a&&r.jsx(T6,{result:e})]})}function D6(e){const t=Date.now(),n=new Date(e).getTime(),s=t-n,o=Math.floor(s/1e3);if(o<60)return"just now";const i=Math.floor(o/60);if(i<60)return`${i}m ago`;const a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function $6(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(),s=n==="huggingface.co"||n.endsWith(".huggingface.co");return{label:s?"HF":"Source",title:s?"Open Hugging Face model source":"Open model metadata source",url:e}}catch{return null}}function F6({provider:e,testResults:t,isTesting:n,testingTimeLeft:s,isHighlighted:o,onEdit:i,onDelete:a,onTest:l,onRefreshMetadata:c,isRefreshingMetadata:u=!1}){const[d,f]=p.useState(!1),[h,m]=p.useState(!1),[v,g]=p.useState(!1),[x,b]=p.useState(!1);function y(){Tt(e.apiKey).then(z=>{z&&(m(!0),setTimeout(()=>m(!1),2e3))})}const k=e.apiDocsUrl??Object.entries(S6).find(([z])=>e.name.toLowerCase().includes(z))?.[1],j=k6(e),C=e.modelMetadataUrl!==void 0&&e.modelMetadataUrl.trim()!=="",T=C?"Refresh":"Import defaults",N=n??!1,P=M6(t),A=e.source==="company"?r.jsx("span",{className:"shrink-0 rounded border border-cyan-300/20 bg-cyan-300/[0.08] px-1.5 py-0.5 text-xs text-cyan-100",children:"Company"}):e.source==="personal"?r.jsx("span",{className:"shrink-0 rounded border border-violet-300/20 bg-violet-300/[0.08] px-1.5 py-0.5 text-xs text-violet-100",children:"Personal"}):null;return r.jsxs("div",{className:`flex flex-col gap-3 rounded-[8px] border border-border bg-card p-4 shadow-sm transition-all duration-500 ${o===!0?"ring-2 ring-primary shadow-md":""}`,children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 space-y-1",children:[r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[r.jsx("span",{className:"font-medium leading-snug",children:e.name}),A]}),r.jsx("div",{className:"text-xs leading-snug text-muted-foreground",children:P6(e)})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx(z6,{provider:e,testResults:t,isTesting:N}),k!==void 0&&r.jsxs("a",{href:k,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground",title:"View API documentation",children:[r.jsx(jl,{className:"size-3"}),r.jsx("span",{className:"sr-only",children:"Docs"})]})]})]}),r.jsxs("div",{className:"flex flex-col gap-2 text-xs text-muted-foreground sm:flex-row sm:items-center sm:justify-between",children:[r.jsx(A6,{provider:e}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{children:"Key configured"}),r.jsx("span",{children:e.authHeader==="x-api-key"?"x-api-key":"Bearer"}),P!==null&&r.jsx("span",{children:P}),t?.testedAt!==void 0&&r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx(sn,{className:"size-3"}),D6(t.testedAt)]})]})]}),!j&&r.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:[r.jsx("span",{children:"Context window metadata missing"}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[r.jsxs(ke,{type:"button",variant:"outline",size:"sm",onClick:()=>c?.(e.id),className:"h-6 gap-1 px-2 text-xs",disabled:u,children:[r.jsx(bo,{className:`size-3 ${u?"animate-spin":""}`}),T]}),!C&&r.jsx(ke,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(e),className:"h-6 px-2 text-xs",children:"Set URL"})]})]}),v&&r.jsxs("div",{className:"space-y-3 border-t border-border/60 pt-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("code",{className:"flex-1 truncate rounded bg-muted px-2 py-1 text-xs text-muted-foreground",children:d?e.apiKey:N0(e.apiKey)}),r.jsx("button",{type:"button",onClick:()=>f(z=>!z),className:"p-1 text-muted-foreground transition-colors hover:text-foreground","aria-label":d?"Hide API key":"Show API key",children:d?r.jsx(Sl,{className:"size-4"}):r.jsx(Cl,{className:"size-4"})}),r.jsx("button",{type:"button",onClick:y,className:"p-1 text-muted-foreground transition-colors hover:text-foreground","aria-label":"Copy API key",children:h?r.jsx(Ge,{className:"size-4 text-cyan-300"}):r.jsx(Rt,{className:"size-4"})})]}),e.models!==void 0&&e.models.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1",children:e.models.map(z=>r.jsx(O6,{provider:e,model:z},z))}),(Ze(e.anthropicBaseUrl)||Ze(e.openaiBaseUrl)||Ze(e.openaiResponsesBaseUrl))&&r.jsxs("div",{className:"grid gap-2 lg:grid-cols-3",children:[Ze(e.anthropicBaseUrl)&&r.jsxs(Ki,{label:"Anthropic",children:[t!==void 0&&r.jsx(as,{results:t.anthropic}),t===void 0&&r.jsx("div",{className:"text-xs text-muted-foreground",children:"Not tested yet"})]}),Ze(e.openaiBaseUrl)&&r.jsxs(Ki,{label:"OpenAI Chat",children:[t!==void 0&&r.jsx(as,{results:t.openaiChat}),t===void 0&&r.jsx("div",{className:"text-xs text-muted-foreground",children:"Not tested yet"})]}),Ze(e.openaiResponsesBaseUrl)&&r.jsxs(Ki,{label:"OpenAI Responses",children:[t!==void 0&&r.jsx(as,{results:t.openaiResponses}),t===void 0&&r.jsx("div",{className:"text-xs text-muted-foreground",children:"Not tested yet"})]}),!Ze(e.openaiResponsesBaseUrl)&&r.jsx("div",{className:"min-w-0 rounded-md border border-border/50 bg-transparent p-2 text-xs text-muted-foreground/75",children:"OpenAI Responses not configured"})]}),t?.models!==void 0&&Object.keys(t.models).length>0&&r.jsxs("div",{children:[r.jsxs("button",{type:"button",onClick:()=>b(z=>!z),className:"flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground",children:[x?r.jsx(ot,{className:"size-3"}):r.jsx(Et,{className:"size-3"}),"Model Test Results (",Object.keys(t.models).length,")"]}),x&&r.jsx("div",{className:"mt-2 overflow-x-auto",children:r.jsxs("table",{className:"w-full border-collapse text-xs",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-border",children:[r.jsx("th",{className:"px-2 py-1 text-left font-medium text-muted-foreground",children:"Model"}),Ze(e.anthropicBaseUrl)&&r.jsx("th",{className:"px-2 py-1 text-left font-medium text-muted-foreground",children:"Anthropic"}),Ze(e.openaiBaseUrl)&&r.jsx("th",{className:"px-2 py-1 text-left font-medium text-muted-foreground",children:"Chat"}),Ze(e.openaiResponsesBaseUrl)&&r.jsx("th",{className:"px-2 py-1 text-left font-medium text-muted-foreground",children:"Responses"})]})}),r.jsx("tbody",{children:Object.entries(t.models).map(([z,D])=>r.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[r.jsx("td",{className:"px-2 py-1 font-medium",children:z}),Ze(e.anthropicBaseUrl)&&r.jsx("td",{className:"px-2 py-1 align-top",children:r.jsx(as,{results:D.anthropic})}),Ze(e.openaiBaseUrl)&&r.jsx("td",{className:"px-2 py-1 align-top",children:r.jsx(as,{results:D.openaiChat})}),Ze(e.openaiResponsesBaseUrl)&&r.jsx("td",{className:"px-2 py-1 align-top",children:r.jsx(as,{results:D.openaiResponses})})]},z))})]})})]})]}),r.jsxs("div",{className:"flex flex-col gap-2 border-t pt-1 sm:flex-row sm:items-center sm:justify-between",children:[r.jsxs("button",{type:"button",onClick:()=>g(z=>!z),className:"inline-flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground","aria-expanded":v,children:[v?r.jsx(ot,{className:"size-3"}):r.jsx(Et,{className:"size-3"}),"Details"]}),r.jsxs("div",{className:"flex gap-2",children:[l!==void 0&&r.jsxs(ke,{variant:"outline",size:"sm",onClick:()=>l(e.id),className:"text-xs h-7 gap-1",disabled:N,children:[r.jsx(bo,{className:`size-3 ${N?"animate-spin":""}`}),N?s!==void 0?`Testing (${s}s)`:"Testing...":"Test"]}),r.jsxs(ke,{variant:"outline",size:"sm",onClick:()=>i(e),className:"text-xs h-7 gap-1",disabled:N,children:[r.jsx(Qf,{className:"size-3"}),"Edit"]}),r.jsxs(ke,{variant:"outline",size:"sm",onClick:()=>a(e.id),className:"text-xs h-7 gap-1 text-destructive hover:text-destructive",disabled:N,children:[r.jsx(wn,{className:"size-3"}),"Delete"]})]})]})]})}const vs="/v1/chat/completions",qa="/v1/responses",B6="/v1/messages";function U6(e,t){const n=e.endsWith("/")?e.slice(0,-1):e,s=R0(t),o=t.indexOf("?"),i=o>=0?t.slice(o):"";return s!==""&&n.endsWith(s)?n+i:z0(n)&&I0(t)||n.endsWith("/v1")&&t.startsWith("/v1/")?n+t.slice(3):n+t}function W6(e,t,n={}){const s=e.trim().replace(/\/+$/,""),o=R0(t),i=U6(s,t),a=[];return o!==""&&s.endsWith(o)?a.push({severity:"info",message:"This already includes the exact endpoint; no duplicate suffix will be appended."}):z0(s)&&I0(t)?a.push({severity:"info",message:"Zhipu bases already include the API version; only /chat/completions is appended."}):s.endsWith("/v1")&&t.startsWith("/v1/")&&a.push({severity:"info",message:"Base URL already ends with /v1; the suffix will not repeat /v1."}),nd(o)&&V6(s)&&a.push({severity:"warning",message:"This looks like a Chat Completions endpoint, so Responses would append after it."}),H6(o)&&q6(s)&&a.push({severity:"warning",message:"This looks like a Responses endpoint, so Chat Completions would append after it."}),nd(o)&&Z6(s,n.providerName)&&a.push({severity:"warning",message:"DeepSeek's official API does not currently expose OpenAI Responses."}),{finalUrl:i,diagnostics:a}}function R0(e){return e.split("?")[0]??e}function I0(e){return e===vs||e.startsWith(`${vs}?`)||e.startsWith(`${vs}/`)}function H6(e){return e===vs||e.startsWith(`${vs}/`)}function nd(e){return e===qa||e.startsWith(`${qa}/`)}function V6(e){return e.toLowerCase().endsWith("/chat/completions")}function q6(e){return e.toLowerCase().endsWith("/responses")}function Z6(e,t){const n=t?.toLowerCase();if(n!==void 0&&n.includes("deepseek"))return!0;try{return new URL(e).hostname.toLowerCase().includes("deepseek")}catch{return e.toLowerCase().includes("deepseek")}}function z0(e){try{const t=new URL(e),n=t.pathname.replace(/\/+$/,"");return t.hostname==="open.bigmodel.cn"&&(n==="/api/paas/v4"||n==="/api/coding/paas/v4")}catch{return!1}}const sd=["zhipu","zhipuai","bigmodel","z.ai","zai","glm"],rd=["zhipu coding","glm coding","bigmodel coding","z.ai coding","zai coding"],Vr=B6,qr=vs,Zr=qa,G6={deepseek:{openaiBaseUrl:"https://api.deepseek.com"},minimax:{anthropicBaseUrl:"https://api.minimaxi.com/anthropic",openaiBaseUrl:"https://api.minimaxi.com",openaiResponsesBaseUrl:"https://api.minimaxi.com",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"}},od=["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"],id=["qwen3.6-plus","qwen3.7-max"],ad=["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"],Za="__unset__",Po="__custom__",P0=[{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 On(){return{contextWindow:"",contextWindowMode:"unset",outputLimit:""}}function ld(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}function O0(e,t){const n=ld(t);return e?.modelMetadata?.find(s=>ld(s.model)===n)??null}function M0(e){const t=yo(e);if(t===null)return null;for(const n of P0)if(yo(n.value)===t)return n.value;return null}function K6(e){return e.trim()===""?"unset":M0(e)!==null?"preset":"custom"}function J6(e){switch(e.contextWindowMode){case"unset":return Za;case"custom":return Po;case"preset":return M0(e.contextWindow)??Po}}function Yi(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 s=n[1];if(s===void 0)return{amount:t,unit:"K"};const o=n[2];if(o===void 0||o==="")return{amount:s,unit:"tokens"};switch(o.toLowerCase()){case"k":return{amount:s,unit:"K"};case"m":return{amount:s,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 ud(e,t){return t.map(n=>{const s=O0(e,n),o=s?.contextWindow!==void 0?V5(s.contextWindow):"";return{contextWindow:o,contextWindowMode:K6(o),outputLimit:s?.outputLimit?.toString()??""}})}function dd(e){const t=e.trim();if(t==="")return null;const n=Number(t);return!Number.isInteger(n)||n<=0?null:n}function ls(e,t){if(e===void 0)return"";const n=e.trim(),s=n.replace(/\/+$/,"");return s.endsWith(t)?s.slice(0,-t.length).replace(/\/+$/,""):n}function Y6(e,t,n){const s=e.trim();return s===""?null:W6(s,t,{providerName:n})}function Xi({baseUrl:e,endpoint:t,providerName:n}){const s=Y6(e,t,n);return s===null?null:r.jsxs("div",{className:"border border-border bg-muted/40 rounded-md px-3 py-2 text-xs",children:[r.jsx("div",{className:"text-muted-foreground",children:"Final URL"}),r.jsx("div",{className:"break-all font-mono text-foreground",children:s.finalUrl}),s.diagnostics.length>0&&r.jsx("div",{className:"mt-2 space-y-1",children:s.diagnostics.map(o=>r.jsx("div",{className:o.severity==="warning"?"text-amber-200":"text-muted-foreground",children:o.message},`${o.severity}:${o.message}`))})]})}function X6({provider:e,onSubmit:t,onCancel:n}){const[s,o]=p.useState(e?.name??""),[i,a]=p.useState(e?.apiKey??""),[l,c]=p.useState(!1),[u,d]=p.useState(!1),f=e?.models,[h,m]=p.useState(f!==void 0&&f.length>0?f:[""]),[v,g]=p.useState(()=>ud(e,f!==void 0&&f.length>0?f:[""])),[x,b]=p.useState("anthropic"),[y,k]=p.useState(ls(e?.anthropicBaseUrl,Vr)),[j,C]=p.useState(ls(e?.openaiBaseUrl,qr)),[T,N]=p.useState(ls(e?.openaiResponsesBaseUrl,Zr)),[P,A]=p.useState(e?.apiDocsUrl??""),[z,D]=p.useState(e?.modelMetadataUrl??""),[E,L]=p.useState(e?.source),[w,$]=p.useState({}),[ee,F]=p.useState(!1),[W,Z]=p.useState(null),ue=p.useRef([]);p.useEffect(()=>{if(W===null)return;const I=W;function M(Y){if(!(Y.target instanceof Node))return;const re=ue.current[I];re!=null&&!re.contains(Y.target)&&Z(null)}return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[W]);const[V,H]=p.useState(!1),[le,U]=p.useState(!1),[X,Ce]=p.useState(!1),ae=s.toLowerCase().includes("minimax"),ge=s.toLowerCase().includes("alibaba"),xe=[...sd,...rd].some(I=>s.toLowerCase().includes(I)),he=ae?od:xe?ad:ge?id:[],be=e?.modelMetadata?.some(I=>I.contextWindow!==void 0)??!1;function Se(){Tt(i).then(I=>{I&&(d(!0),setTimeout(()=>d(!1),2e3))})}p.useEffect(()=>{if(e){o(e.name),a(e.apiKey);const I=(e.models?.length??0)>0?e.models:[""];m(I),g(ud(e,I)),k(ls(e.anthropicBaseUrl,Vr)),C(ls(e.openaiBaseUrl,qr)),N(ls(e.openaiResponsesBaseUrl,Zr)),A(e.apiDocsUrl??""),D(e.modelMetadataUrl??""),L(e.source),H(!1),U(!1),Ce(!1)}},[e]),p.useEffect(()=>{const I=s.toLowerCase();for(const[M,Y]of Object.entries(G6))if(I.includes(M)){Y.anthropicBaseUrl!==void 0&&!V&&k(Y.anthropicBaseUrl),Y.openaiBaseUrl!==void 0&&!le&&C(Y.openaiBaseUrl),Y.openaiResponsesBaseUrl!==void 0&&!X&&N(Y.openaiResponsesBaseUrl),Y.apiDocsUrl!==void 0&&!P&&A(Y.apiDocsUrl),M==="minimax"&&h.length===1&&h[0]===""&&m([od[0]??""]),M==="alibaba"&&h.length===1&&h[0]===""&&m([id[0]??""]),(sd.includes(M)||rd.includes(M))&&h.length===1&&h[0]===""&&m([ad[0]??""]);break}},[s]);function Ie(){const I={};return s.trim()||(I.name="Name is required"),i.trim()||(I.apiKey="API key is required"),(h.length===0||h.every(M=>!M.trim()))&&(I.models="At least one model is required"),y.trim()&&!_(y.trim())&&(I.anthropicBaseUrl="Invalid URL format"),j.trim()&&!_(j.trim())&&(I.openaiBaseUrl="Invalid URL format"),T.trim()&&!_(T.trim())&&(I.openaiResponsesBaseUrl="Invalid URL format"),z.trim()&&!_(z.trim())&&(I.modelMetadataUrl="Invalid URL format"),v.forEach((M,Y)=>{const re=yo(M.contextWindow),oe=dd(M.outputLimit);M.contextWindow.trim()!==""&&re===null&&(I[`modelMetadata.${Y}.contextWindow`]="Context window must be a positive number, optionally using K or M"),M.outputLimit.trim()!==""&&oe===null&&(I[`modelMetadata.${Y}.outputLimit`]="Output limit must be a positive integer"),re!==null&&oe!==null&&oe>re&&(I[`modelMetadata.${Y}.outputLimit`]="Output limit should not exceed context window")}),!y.trim()&&!j.trim()&&!T.trim()&&(I.format="At least one format URL (Anthropic or OpenAI) is required"),$(I),Object.keys(I).length===0}function _(I){try{return new URL(I),!0}catch{return!1}}function Q(I,M){m(Y=>{const re=[...Y];return re[I]=M,re})}function G(I,M){g(Y=>{const re=[...Y];return re[I]={...re[I]??On(),...M},re})}function O(I,M){switch(M){case Za:G(I,{contextWindow:"",contextWindowMode:"unset"});return;case Po:{const Y=v[I]??On();G(I,{contextWindow:Y.contextWindow,contextWindowMode:"custom"});return}default:G(I,{contextWindow:M,contextWindowMode:"preset"});return}}function R(I,M){const Y=v[I]??On(),re=Yi(Y.contextWindow);G(I,{contextWindow:cd(M,re.unit),contextWindowMode:"custom"})}function B(I,M){const Y=v[I]??On(),re=Yi(Y.contextWindow);switch(M){case"K":case"M":case"tokens":G(I,{contextWindow:cd(re.amount,M),contextWindowMode:"custom"});return;default:return}}function se(I){m(M=>M.filter((Y,re)=>re!==I)),g(M=>M.filter((Y,re)=>re!==I))}function ne(){m(I=>[...I,""]),g(I=>[...I,On()])}function q(){const I=new Date().toISOString(),M=[];return h.forEach((Y,re)=>{const oe=Y.trim();if(oe==="")return;const ve=v[re]??On(),pe=yo(ve.contextWindow),me=dd(ve.outputLimit);if(pe===null&&me===null)return;const Re=O0(e,oe);if(Re!==null&&Re.contextWindow===(pe??void 0)&&Re.outputLimit===(me??void 0)){M.push({...Re,model:oe});return}const $e={model:oe,source:"manual",updatedAt:I};pe!==null&&($e.contextWindow=pe),me!==null&&($e.outputLimit=me),M.push($e)}),M.length>0?M:e?.modelMetadata!==void 0?[]:void 0}function ce(I){if(I.preventDefault(),!!Ie()){F(!0);try{t({name:s.trim(),apiKey:i.trim(),models:h.map(M=>M.trim()).filter(M=>M!==""),anthropicBaseUrl:y.trim()||void 0,openaiBaseUrl:j.trim()||void 0,openaiResponsesBaseUrl:T.trim()||void 0,apiDocsUrl:P.trim()||void 0,modelMetadataUrl:z.trim()||void 0,modelMetadata:q(),source:E})}finally{F(!1)}}}return r.jsxs("form",{onSubmit:ce,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{htmlFor:"provider-name",className:"text-sm font-medium",children:["Name ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsx("input",{id:"provider-name",type:"text",value:s,onChange:I=>o(I.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"}),w.name!==void 0&&r.jsx("p",{className:"text-xs text-destructive",children:w.name})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{htmlFor:"provider-source",className:"text-sm font-medium",children:"Token Source"}),r.jsxs("select",{id:"provider-source",value:E??"",onChange:I=>L(I.target.value==="company"||I.target.value==="personal"?I.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:[r.jsx("option",{value:"",children:"Unspecified"}),r.jsx("option",{value:"personal",children:"个人 (Personal)"}),r.jsx("option",{value:"company",children:"公司 (Company)"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Label whether this API key is company-provided or personal."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{htmlFor:"provider-model-metadata-url",className:"text-sm font-medium",children:"Model Metadata URL"}),r.jsx("input",{id:"provider-model-metadata-url",type:"text",value:z,onChange:I=>D(I.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"}),w.modelMetadataUrl!==void 0&&r.jsx("p",{className:"text-xs text-destructive",children:w.modelMetadataUrl}),z.trim()===""&&r.jsx("div",{className:"border border-border bg-muted/40 rounded-md 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&&!be&&z.trim()===""&&r.jsx("p",{className:"text-xs text-amber-400",children:"This provider has no matching context metadata yet."}),z.trim()!==""&&r.jsx("p",{className:"text-xs text-muted-foreground",children:"Agent Inspector will refresh model limits from this JSON registry after save."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{htmlFor:"provider-apikey",className:"text-sm font-medium",children:["API Key ",r.jsx("span",{className:"text-destructive",children:"*"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{id:"provider-apikey",type:"text",value:l||i.length===0?i:N0(i),onChange:I=>a(I.target.value),onFocus:()=>{!l&&i.length>0&&c(!0)},placeholder:"sk-ant-...",readOnly:!l&&i.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"}),r.jsx("button",{type:"button",onClick:()=>c(I=>!I),className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":l?"Hide API key":"Show API key",children:l?r.jsx(Sl,{className:"size-4"}):r.jsx(Cl,{className:"size-4"})}),r.jsx("button",{type:"button",onClick:Se,className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":"Copy API key",children:u?r.jsx(Ge,{className:"size-4 text-cyan-300"}):r.jsx(Rt,{className:"size-4"})})]}),w.apiKey!==void 0&&r.jsx("p",{className:"text-xs text-destructive",children:w.apiKey})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"text-sm font-medium",children:["Models ",r.jsx("span",{className:"text-destructive",children:"*"})]}),h.map((I,M)=>{const Y=v[M]??On(),re=w[`modelMetadata.${M}.contextWindow`],oe=w[`modelMetadata.${M}.outputLimit`],ve=J6(Y),pe=Yi(Y.contextWindow);return r.jsxs("div",{ref:me=>{ue.current[M]=me},className:"border border-border bg-card shadow-sm space-y-2 rounded-[8px] p-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx("input",{type:"text",value:I,onChange:me=>Q(M,me.target.value),placeholder:he.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"}),he.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",onClick:()=>Z(W===M?null:M),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:r.jsx(ot,{className:"size-4"})}),W===M&&r.jsx("div",{className:"bg-popover text-popover-foreground absolute left-0 right-0 top-full z-50 mt-1 max-h-48 overflow-y-auto rounded-md border shadow-md",children:he.map(me=>r.jsx("button",{type:"button",onClick:()=>{Q(M,me),Z(null)},className:"w-full px-3 py-2 text-left text-sm transition-colors hover:bg-white/[0.06]",children:me},me))})]})]}),h.length>1&&r.jsx("button",{type:"button",onClick:()=>se(M),className:"text-muted-foreground hover:text-destructive transition-colors p-1 shrink-0","aria-label":"Remove model",children:r.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:[r.jsx("path",{d:"M3 6h18"}),r.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),r.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]})})]}),r.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[r.jsx("span",{children:"Context Window"}),r.jsxs(Ns,{value:ve,onValueChange:me=>O(M,me),children:[r.jsx(Es,{size:"sm",className:"w-full bg-background font-mono text-xs",children:r.jsx(Ts,{})}),r.jsxs(As,{className:"max-h-64",children:[r.jsx(ft,{value:Za,children:"Not set"}),P0.map(me=>r.jsxs(ft,{value:me.value,children:[me.label," · ",me.value]},me.value)),r.jsx(ft,{value:Po,children:"Custom"})]})]}),Y.contextWindowMode==="custom"&&r.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_5.75rem] gap-1.5",children:[r.jsx("input",{type:"text",inputMode:"decimal",value:pe.amount,onChange:me=>R(M,me.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]"}),r.jsxs(Ns,{value:pe.unit,onValueChange:me=>B(M,me),children:[r.jsx(Es,{size:"sm",className:"w-full bg-background font-mono text-xs",children:r.jsx(Ts,{})}),r.jsxs(As,{children:[r.jsx(ft,{value:"K",children:"K"}),r.jsx(ft,{value:"M",children:"M"}),r.jsx(ft,{value:"tokens",children:"tokens"})]})]})]}),re!==void 0&&r.jsx("span",{className:"block text-destructive",children:re})]}),r.jsxs("label",{className:"space-y-1 text-xs text-muted-foreground",children:[r.jsx("span",{children:"Output Limit"}),r.jsx("input",{type:"number",min:1,step:1e3,value:Y.outputLimit,onChange:me=>G(M,{outputLimit:me.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]"}),oe!==void 0&&r.jsx("span",{className:"block text-destructive",children:oe})]})]})]},M)}),r.jsx("button",{type:"button",onClick:ne,className:"text-xs text-primary hover:underline flex items-center gap-1",children:"+ Add Model"}),w.models!==void 0&&r.jsx("p",{className:"text-xs text-destructive",children:w.models})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"border border-border bg-muted/40 flex gap-1 rounded-[8px] p-1",children:[r.jsx(jn,{children:r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.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"})}),r.jsx(dt,{children:"Anthropic Messages API format"})]})}),r.jsx(jn,{children:r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.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"})}),r.jsx(dt,{children:"OpenAI Chat Completions API format"})]})})]}),w.format!==void 0&&r.jsx("p",{className:"text-xs text-destructive",children:w.format})]}),x==="anthropic"&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{htmlFor:"provider-anthropic-base-url",className:"text-sm font-medium",children:"Anthropic Base URL"}),r.jsxs("div",{className:"border border-input bg-background hover:bg-accent hover:text-accent-foreground flex min-w-0 overflow-hidden rounded-md focus-within:border-ring focus-within:outline-ring focus-within:ring-[3px]",children:[r.jsx("input",{id:"provider-anthropic-base-url",type:"text",value:y,onChange:I=>{H(!0),k(I.target.value)},placeholder:"https://api.anthropic.com",className:"min-w-0 flex-1 bg-transparent px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50"}),r.jsx("span",{className:"shrink-0 select-none border-l border-white/10 bg-white/[0.04] px-3 py-2 font-mono text-xs text-muted-foreground",children:Vr})]}),w.anthropicBaseUrl!==void 0&&r.jsx("p",{className:"text-xs text-destructive",children:w.anthropicBaseUrl}),r.jsx(Xi,{baseUrl:y,endpoint:Vr,providerName:s}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Anthropic-compatible base URL. Leave empty if this provider does not support Anthropic format."})]}),x==="openai"&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{htmlFor:"provider-openai-base-url",className:"text-sm font-medium",children:"OpenAI Chat Base URL"}),r.jsxs("div",{className:"border border-input bg-background hover:bg-accent hover:text-accent-foreground flex min-w-0 overflow-hidden rounded-md focus-within:border-ring focus-within:outline-ring focus-within:ring-[3px]",children:[r.jsx("input",{id:"provider-openai-base-url",type:"text",value:j,onChange:I=>{U(!0),C(I.target.value)},placeholder:"https://api.openai.com",className:"min-w-0 flex-1 bg-transparent px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50"}),r.jsx("span",{className:"shrink-0 select-none border-l border-white/10 bg-white/[0.04] px-3 py-2 font-mono text-xs text-muted-foreground",children:qr})]}),w.openaiBaseUrl!==void 0&&r.jsx("p",{className:"text-xs text-destructive",children:w.openaiBaseUrl}),r.jsx(Xi,{baseUrl:j,endpoint:qr,providerName:s}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"OpenAI Chat Completions-compatible base URL. Leave empty if this provider only supports the Responses API."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{htmlFor:"provider-openai-responses-base-url",className:"text-sm font-medium",children:"OpenAI Responses Base URL"}),r.jsxs("div",{className:"border border-input bg-background hover:bg-accent hover:text-accent-foreground flex min-w-0 overflow-hidden rounded-md focus-within:border-ring focus-within:outline-ring focus-within:ring-[3px]",children:[r.jsx("input",{id:"provider-openai-responses-base-url",type:"text",value:T,onChange:I=>{Ce(!0),N(I.target.value)},placeholder:"https://api.openai.com",className:"min-w-0 flex-1 bg-transparent px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50"}),r.jsx("span",{className:"shrink-0 select-none border-l border-white/10 bg-white/[0.04] px-3 py-2 font-mono text-xs text-muted-foreground",children:Zr})]}),w.openaiResponsesBaseUrl!==void 0&&r.jsx("p",{className:"text-xs text-destructive",children:w.openaiResponsesBaseUrl}),r.jsx(Xi,{baseUrl:T,endpoint:Zr,providerName:s}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional Responses-compatible base URL. Set only when the provider supports the Responses API."})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{htmlFor:"provider-api-docs-url",className:"text-sm font-medium",children:"API Docs URL"}),r.jsx("input",{id:"provider-api-docs-url",type:"text",value:P,onChange:I=>A(I.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"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional API documentation URL. If not set, uses known provider docs."})]}),r.jsxs("div",{className:"border border-border bg-background/95 shadow-sm sticky bottom-0 flex justify-end gap-2 rounded-[8px] px-3 py-2",children:[r.jsx(ke,{type:"button",variant:"outline",onClick:n,disabled:ee,children:"Cancel"}),r.jsx(ke,{type:"submit",disabled:ee,children:ee?"Saving...":e?"Update Provider":"Add Provider"})]})]})}const Q6=Ee(["timeout","network_unreachable","connection_refused","auth_failed","rate_limited","server_error","invalid_response","unknown"]),eR=J({message:S(),type:Q6,details:S().optional(),hint:S().optional()}),tR=J({type:Ee(["text","thinking"]),text:S().optional(),thinking:S().optional()}),nR=J({requestUrl:S().optional(),requestMethod:S().optional(),requestHeaders:Ye(S(),S()).optional(),requestBody:S().optional(),responseStatus:K().optional(),responseStatusText:S().optional(),responseHeaders:Ye(S(),S()).optional(),responseBody:S().optional()}),sR=J({success:Le(),error:eR.optional(),model:S().optional(),inputTokens:K().optional(),outputTokens:K().optional(),cacheCreationInputTokens:K().optional(),cacheReadInputTokens:K().optional(),latencyMs:K().optional(),firstChunkMs:K().nullable().optional(),totalStreamMs:K().nullable().optional(),tokensPerSecond:K().nullable().optional(),content:fe(tR).optional(),rawResponse:S().optional(),streaming:Le().optional(),streamingChunks:J({chunks:fe(_f),truncated:Le().default(!1)}).optional(),requestHeaders:Ye(S(),S()).optional(),debug:nR.optional()}),fd=Yt([sR,J({notConfigured:Ae(!0)}),J({testing:Ae(!0)})]),xn=J({nonStreaming:fd,streaming:fd});function Oo(){return{nonStreaming:{notConfigured:!0},streaming:{notConfigured:!0}}}const rR=J({anthropic:xn,openai:xn.optional(),openaiChat:xn.optional(),openaiResponses:xn.optional()}).transform(e=>{const t=e.openaiChat??e.openai??Oo();return{...e,openai:e.openai??t,openaiChat:t,openaiResponses:e.openaiResponses??Oo()}}),oR=J({anthropic:xn,openai:xn.optional(),openaiChat:xn.optional(),openaiResponses:xn.optional(),models:Ye(S(),rR).optional(),testedAt:S().optional()}).transform(e=>{const t=e.openaiChat??e.openai??Oo();return{...e,openai:e.openai??t,openaiChat:t,openaiResponses:e.openaiResponses??Oo()}});function iR(){return{anthropic:{nonStreaming:{testing:!0},streaming:{testing:!0}},openai:{nonStreaming:{testing:!0},streaming:{testing:!0}},openaiChat:{nonStreaming:{testing:!0},streaming:{testing:!0}},openaiResponses:{nonStreaming:{testing:!0},streaming:{testing:!0}}}}function pd(e,t){const n=()=>({nonStreaming:{success:!1,error:{message:e,type:t}},streaming:{notConfigured:!0}});return{anthropic:n(),openai:n(),openaiChat:n(),openaiResponses:n()}}const aR=J({providerConfig:S()}),lR=J({success:Le().optional(),imported:K().optional(),message:S().optional(),errors:fe(S()).optional()}),cR=J({provider:wo,imported:K(),matchedModels:fe(S()),missingModels:fe(S()),sourceUrl:S()}),Gr="Network error: could not reach the server. Is the proxy running?",uR=5e3,dR=5e3,hd=15e3,fR=1e4,pR=2e4,hR=2e4,mR=3e4;function md(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,openaiResponsesBaseUrl:(e.openaiResponsesBaseUrl?.length??0)>0?e.openaiResponsesBaseUrl: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 gR(e,t){const n=e?.models?.map(s=>s.trim()).filter(s=>s!=="").length??0;return Math.max(1,n)*t}async function xR(e,t){if(t.models!==void 0)try{await Dn(`/api/providers/${e}/test/log`,dR,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch{}}function bR({externalProviders:e,isLoading:t=!1,externalTestResults:n,externalTestingProviders:s,externalTestingTimeLeft:o,onProvidersMutate:i,onTestResultsChange:a,onTestingProvidersChange:l,onTestingTimeLeftChange:c}){const[u,d]=p.useState(!1),[f,h]=p.useState(),[m,v]=p.useState(null),[g,x]=p.useState({}),[b,y]=p.useState(new Set),[k,j]=p.useState({}),[C,T]=p.useState(null),[N,P]=p.useState(!1),[A,z]=p.useState(null),[D,E]=p.useState(!1),[L,w]=p.useState(!1),[$,ee]=p.useState(null),[F,W]=p.useState("all"),[Z,ue]=p.useState(new Set),{providerTestTimeoutSeconds:V}=yl(),H=p.useRef(null),le=p.useRef(null),U=e??[],X=p.useMemo(()=>{const I=F==="all"?U:U.filter(M=>M.source===F);return F==="all"?[...I].sort((M,Y)=>{const re={personal:0,company:1};return(re[M.source??""]??2)-(re[Y.source??""]??2)}):I},[U,F]),Ce=n??g,ae=s??b,ge=o??k,xe=c?(I,M)=>c(I,M):(I,M)=>{j(M===void 0?Y=>{const re={...Y};return delete re[I],re}:Y=>({...Y,[I]:M}))};p.useEffect(()=>{(async()=>{try{const I=await Ke("/api/config/paths",aR,uR);T(I.providerConfig)}catch{}})()},[]);const he=p.useCallback(I=>{le.current!==null&&clearTimeout(le.current),z(I),H.current?.scrollTo({top:H.current.scrollHeight,behavior:"smooth"}),le.current=setTimeout(()=>{z(null),le.current=null},2e3)},[]);p.useEffect(()=>()=>{le.current!==null&&clearTimeout(le.current)},[]);const be=p.useCallback(()=>{i?.().catch(()=>{})},[i]),Se=p.useCallback((I,M)=>{a?a(I,M):x(Y=>({...Y,[I]:M}))},[a]),Ie=p.useCallback((I,M)=>{if(l){l(I,M);return}y(Y=>{const re=new Set(Y);return M?re.add(I):re.delete(I),re})},[l]),_=p.useCallback(async I=>{Se(I,iR()),Ie(I,!0);const M=new AbortController,Y=U.find(pe=>pe.id===I),re=gR(Y,V);let oe=re;xe(I,oe);const ve=setInterval(()=>{oe--,xe(I,oe),oe<=0&&(clearInterval(ve),M.abort())},1e3);try{const pe=await Ke(`/api/providers/${I}/test`,oR,re*1e3+1e3,{method:"POST",signal:M.signal},me=>`HTTP ${me.status}: ${me.statusText}`);Se(I,pe),await xR(I,pe)}catch(pe){const me=pe instanceof Error&&pe.name==="AbortError",Re=pe instanceof Vo;me||Re?Se(I,pd("Request timed out","timeout")):pe instanceof Error&&Se(I,pd(pe.message,"server_error"))}finally{clearInterval(ve),xe(I,void 0),Ie(I,!1)}},[V,U,xe,Se,Ie]),Q=p.useCallback(async(I,M,Y=!0)=>{ue(re=>{const oe=new Set(re);return oe.add(I),oe});try{const re=M!==void 0&&M.trim()!==""?{url:M}:{},oe=await Ke(`/api/providers/${I}/model-metadata`,cR,mR,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)},()=>"Failed to refresh model metadata");return oe.imported===0&&Y?v("No matching model metadata found for this provider."):v(null),he(oe.provider.id),be(),oe.imported>0}catch(re){return Y&&v(re instanceof Error?re.message:Gr),!1}finally{ue(re=>{const oe=new Set(re);return oe.delete(I),oe})}},[be,he]);function G(I){(async()=>{try{const M=await Ke("/api/providers",wo,hd,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(md(I))},()=>"Failed to add provider");d(!1),he(M.id),I.modelMetadataUrl!==void 0&&I.modelMetadataUrl.trim()!==""&&await Q(M.id,I.modelMetadataUrl,!1),be(),await _(M.id)}catch(M){v(M instanceof Error?M.message:Gr)}})()}function O(I){f&&(async()=>{try{const M=await Ke(`/api/providers/${f.id}`,wo,hd,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(md(I))},()=>"Failed to update provider");h(void 0),he(M.id),I.modelMetadataUrl!==void 0&&I.modelMetadataUrl.trim()!==""&&await Q(M.id,I.modelMetadataUrl,!1),be(),((I.apiKey??"")!==(f.apiKey??"")||JSON.stringify(I.models)!==JSON.stringify(f.models)||(I.anthropicBaseUrl??"")!==(f.anthropicBaseUrl??"")||(I.openaiBaseUrl??"")!==(f.openaiBaseUrl??"")||(I.openaiResponsesBaseUrl??"")!==(f.openaiResponsesBaseUrl??""))&&await _(M.id)}catch(M){v(M instanceof Error?M.message:Gr)}})()}function R(I){ee(I),w(!0)}function B(){const I=$;I!==null&&(async()=>{let M;try{M=await Dn(`/api/providers/${I}`,fR,{method:"DELETE"})}catch{v(Gr);return}if(!M.ok){v(await dl(M,"Failed to delete provider"));return}be()})()}const se=p.useRef(null);function ne(I){const M="/api/providers/export";(async()=>{try{const Y=await Dn(M,pR);if(!Y.ok){v("Failed to export providers");return}const re=await Y.blob(),oe=URL.createObjectURL(re),ve=document.createElement("a");ve.href=oe,ve.download=Y.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]??"providers.json",document.body.appendChild(ve),ve.click(),document.body.removeChild(ve),URL.revokeObjectURL(oe)}catch{v("Failed to export providers")}})()}function q(){se.current?.click()}function ce(I){const M=I.target.files?.[0];M&&(async()=>{try{const Y=await M.text(),re=await Dn("/api/providers/import",hR,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Y)}),oe=await ul(re,lR);re.ok&&oe.imported!==void 0&&oe.imported>0?(be(),v(null)):oe.errors&&oe.errors.length>0?v(oe.errors.join("; ")):v(oe.message??"Import failed")}catch{v("Failed to import providers")}I.target.value=""})()}return t?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading providers..."})}):u||f?r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"sticky top-0 z-10 flex items-center justify-between gap-3 rounded-[8px] bg-background/95 px-1 py-1 backdrop-blur",children:r.jsx("h3",{className:"text-lg font-medium",children:f?"Edit Provider":"Add New Provider"})}),r.jsx(X6,{provider:f,onSubmit:f?O:G,onCancel:()=>{d(!1),h(void 0)}})]}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between gap-3 rounded-[8px] bg-background/95 px-1 py-1 backdrop-blur",children:[r.jsx("h3",{className:"text-lg font-medium",children:"Providers"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ke,{variant:"outline",size:"sm",onClick:()=>ne(),className:"gap-1 hover:bg-muted",children:[r.jsx(mr,{className:"size-3"}),"Export"]}),r.jsxs(ke,{variant:"outline",size:"sm",onClick:q,className:"gap-1 hover:bg-muted",children:[r.jsx(np,{className:"size-3"}),"Import"]}),r.jsx("input",{type:"file",ref:se,accept:".json",onChange:ce,style:{display:"none"}}),r.jsxs(ke,{variant:"outline",size:"sm",onClick:()=>E(!0),className:"gap-1",children:[r.jsx(r_,{className:"size-3"}),"Scan"]}),r.jsxs(ke,{onClick:()=>d(!0),size:"sm",className:"gap-1",children:[r.jsx(da,{className:"size-4"}),"Add Provider"]})]})]}),C!==null&&r.jsxs("div",{className:"flex items-center gap-2 rounded-[8px] bg-muted/15 px-3 py-2 text-xs text-muted-foreground",children:[r.jsx("span",{className:"shrink-0",children:"Config:"}),r.jsx("span",{className:"font-mono truncate",title:C,children:C}),r.jsx("button",{type:"button",onClick:()=>{Tt(C).then(I=>{I&&(P(!0),setTimeout(()=>P(!1),2e3))})},className:"ml-auto shrink-0 text-muted-foreground transition-colors hover:text-foreground","aria-label":N?"Copied config file path":"Copy config file path",children:N?r.jsx(Ge,{className:"size-3 text-cyan-300"}):r.jsx(Rt,{className:"size-3"})})]}),m!==null&&r.jsxs("div",{className:"border border-border bg-card shadow-sm flex items-center gap-2 rounded-[8px] px-3 py-2 text-sm text-destructive",children:[r.jsx(_s,{className:"size-4 shrink-0"}),m]}),U.length===0?r.jsxs("div",{className:"border border-border bg-card shadow-sm space-y-3 rounded-[8px] py-12 text-center",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"No providers configured yet."}),r.jsxs(ke,{onClick:()=>d(!0),variant:"outline",size:"sm",children:[r.jsx(da,{className:"size-4"}),"Add Your First Provider"]})]}):r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"inline-flex w-fit gap-1 rounded-[8px] bg-muted/20 p-1",children:["all","personal","company"].map(I=>r.jsx("button",{type:"button",onClick:()=>W(I),className:`rounded-md px-3 py-1.5 text-sm font-medium transition-colors ${F===I?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:I==="all"?"All":I==="personal"?"Personal":"Company"},I))}),r.jsx("div",{ref:H,className:"space-y-3",children:X.map(I=>r.jsx(F6,{provider:I,testResults:Ce[I.id],isTesting:ae.has(I.id),testingTimeLeft:ge[I.id],isHighlighted:I.id===A,onEdit:M=>h(M),onDelete:R,onRefreshMetadata:M=>{Q(M)},isRefreshingMetadata:Z.has(I.id),onTest:M=>{_(M)}},I.id))})]}),r.jsx(y6,{open:D,onOpenChange:E,onImportComplete:()=>{i!==void 0&&i()}}),r.jsx(Qp,{open:L,onOpenChange:w,title:"Delete Provider",description:"Are you sure you want to delete this provider? This action cannot be undone.",confirmLabel:"Delete",variant:"destructive",onConfirm:B})]})}function gd(){const[e,t]=p.useState(!1),[n,s]=p.useState("providers"),{providers:o,isLoading:i,mutate:a}=Rl(),[l,c]=p.useState({}),[u,d]=p.useState(new Set),[f,h]=p.useState({}),m=p.useCallback((x,b)=>{c(y=>({...y,[x]:b}))},[]),v=p.useCallback((x,b)=>{d(y=>{const k=new Set(y);return b?k.add(x):k.delete(x),k})},[]),g=p.useCallback((x,b)=>{h(y=>{if(b===void 0){const k={...y};return delete k[x],k}return{...y,[x]:b}})},[]);return r.jsxs(Gn,{open:e,onOpenChange:t,children:[r.jsx(Xo,{asChild:!0,children:r.jsxs(ke,{variant:"ghost",size:"icon",className:vi,"aria-label":"Settings",title:"Settings",children:[r.jsx(d_,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"Settings"})]})}),r.jsxs(Kn,{className:"flex max-h-[80vh] max-w-2xl flex-col overflow-hidden",children:[r.jsx(Jn,{children:r.jsx(Yn,{children:"Settings"})}),r.jsxs(o0,{value:n,onValueChange:s,className:"flex-1 overflow-hidden",children:[r.jsxs(i0,{className:"w-full justify-start bg-muted/35",children:[r.jsx(Ct,{value:"providers",children:"Providers"}),r.jsx(Ct,{value:"proxy",children:"Proxy"}),r.jsx(Ct,{value:"storage",children:"Storage"}),r.jsx(Ct,{value:"mcp",children:"MCP"}),r.jsx(Ct,{value:"onboarding",children:"Onboarding"})]}),r.jsxs("div",{className:"mt-4 flex-1 overflow-x-hidden overflow-y-auto pr-2",children:[r.jsx(Nt,{value:"providers",children:r.jsx(bR,{externalProviders:o,isLoading:i,externalTestResults:l,externalTestingProviders:u,externalTestingTimeLeft:f,onProvidersMutate:()=>a(),onTestResultsChange:m,onTestingProvidersChange:v,onTestingTimeLeftChange:g})}),r.jsx(Nt,{value:"proxy",children:r.jsx(jR,{})}),r.jsx(Nt,{value:"storage",children:r.jsx(wR,{})}),r.jsx(Nt,{value:"mcp",children:r.jsx(kR,{})}),r.jsx(Nt,{value:"onboarding",children:r.jsx(_R,{})})]})]})]})]})}const vR=J({memoryCount:K(),logDir:S(),logFileCount:K(),logBytes:K(),chunkDir:S(),chunkFileCount:K(),chunkBytes:K(),sessionArchiveDir:S(),sessionArchiveFileCount:K(),sessionArchiveBytes:K()}),yR=1e4;function Qi(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 wR(){const[e,t]=p.useState(null),[n,s]=p.useState(null),[o,i]=p.useState(!1),[a,l]=p.useState(null),c=p.useCallback(async()=>{i(!0),s(null);try{const d=await Ke("/api/logs?stats=1",vR,yR,void 0,f=>`Failed to load storage stats: HTTP ${String(f.status)}`);t(d)}catch(d){s(d instanceof Error?d.message:String(d))}finally{i(!1)}},[]);p.useEffect(()=>{c()},[c]);const u=p.useCallback((d,f)=>{Tt(f).then(h=>{h&&(l(d),setTimeout(()=>l(null),1600))})},[]);return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"Log storage"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Inspect local log and streaming chunk footprint before exporting or clearing sessions."})]}),r.jsx(ke,{type:"button",variant:"outline",size:"sm",onClick:()=>{c()},children:o?"Refreshing...":"Refresh"})]}),e!==null&&r.jsxs("div",{className:"grid gap-2 text-xs",children:[r.jsx(Xs,{id:"log-dir",label:"Log storage path",value:e.logDir,copiedId:a,onCopy:u}),r.jsx(Xs,{id:"chunk-dir",label:"Streaming chunks storage path",value:e.chunkDir,copiedId:a,onCopy:u}),r.jsx(Xs,{id:"session-archive-dir",label:"Session archive storage path",value:e.sessionArchiveDir,copiedId:a,onCopy:u}),r.jsxs("div",{className:"rounded-md bg-muted/20 px-3 py-2",children:[r.jsx("div",{className:"font-medium",children:"In-memory logs"}),r.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.memoryCount.toLocaleString()," loaded"]})]}),r.jsxs("div",{className:"rounded-md bg-muted/20 px-3 py-2",children:[r.jsx("div",{className:"font-medium",children:"Log files"}),r.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.logFileCount.toLocaleString()," files / ",Qi(e.logBytes)]})]}),r.jsxs("div",{className:"rounded-md bg-muted/20 px-3 py-2",children:[r.jsx("div",{className:"font-medium",children:"Streaming chunks"}),r.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.chunkFileCount.toLocaleString()," files / ",Qi(e.chunkBytes)]})]}),r.jsxs("div",{className:"rounded-md bg-muted/20 px-3 py-2",children:[r.jsx("div",{className:"font-medium",children:"Session archives"}),r.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.sessionArchiveFileCount.toLocaleString()," files /"," ",Qi(e.sessionArchiveBytes)]})]})]}),n!==null&&r.jsx("p",{className:"text-xs text-destructive",children:n})]})}function Xs({id:e,label:t,value:n,copiedId:s,onCopy:o}){const i=s===e;return r.jsxs("div",{className:"min-w-0 rounded-md border border-border/45 bg-muted/15 px-3 py-2 transition-colors hover:bg-muted/25",children:[r.jsx("div",{className:"mb-1 text-xs font-medium text-muted-foreground",children:t}),r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:n}),r.jsx(ke,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0",onClick:()=>o(e,n),"aria-label":i?`Copied ${t}`:`Copy ${t}`,children:i?r.jsx(Ge,{className:"size-3.5 text-emerald-500"}):r.jsx(Rt,{className:"size-3.5"})})]})]})}function _R(){const[e,t]=p.useState(null),n=p.useMemo(()=>typeof window>"u"?"http://localhost:9527":window.location.origin,[]),s=p.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:"mimo-config",label:"MiMo Code config",value:"agent-inspector onboard --mimo-only"},{id:"mimo-status",label:"MiMo Code status",value:"agent-inspector onboard --status --mimo-only"},{id:"mimo-verify",label:"MiMo Code verify",value:"mimo mcp list"},{id:"mimo-proxy",label:"MiMo Code proxy",value:`OPENAI_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=p.useCallback((i,a)=>{Tt(a).then(l=>{l&&(t(i),setTimeout(()=>t(null),1600))})},[]);return r.jsxs("div",{className:"min-w-0 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(zs,{className:"size-4 text-muted-foreground"}),r.jsx("h3",{className:"text-sm font-semibold",children:"Agent onboarding"})]}),r.jsx("div",{className:"grid gap-2",children:s.map(i=>r.jsx(Xs,{id:i.id,label:i.label,value:i.value,copiedId:e,onCopy:o},i.id))}),r.jsxs("div",{className:"grid gap-2 rounded-md bg-muted/15 px-3 py-2 text-xs text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ge,{className:"size-3.5 text-emerald-500"}),r.jsx("span",{children:"Provider test creates a traceable memory probe session."})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ge,{className:"size-3.5 text-emerald-500"}),r.jsx("span",{children:"Captured sessions can produce reviewable memory candidates."})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Ge,{className:"mt-0.5 size-3.5 text-emerald-500"}),r.jsxs("span",{children:["Streamable HTTP clients should use the MCP URL directly. Stdio-only clients should use",r.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."]})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Ge,{className:"mt-0.5 size-3.5 text-emerald-500"}),r.jsxs("span",{children:["OpenCode onboarding safely merges"," ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[11px] text-foreground",children:"mcp.agent-inspector"})," ","into"," ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[11px] text-foreground",children:"opencode.json"}),", then verify with"," ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[11px] text-foreground",children:"opencode mcp list"}),"."]})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Ge,{className:"mt-0.5 size-3.5 text-emerald-500"}),r.jsxs("span",{children:["MiMo Code onboarding safely merges"," ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[11px] text-foreground",children:"mcp.agent-inspector"})," ","into"," ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[11px] text-foreground",children:"mimocode.jsonc"}),", then route OpenAI-format traffic with"," ",r.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[11px] text-foreground",children:"OPENAI_BASE_URL"}),"."]})]}),r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Ge,{className:"mt-0.5 size-3.5 text-emerald-500"}),r.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 kR(){const[e,t]=p.useState(null),s=`${p.useMemo(()=>typeof window>"u"?"http://localhost:9527":window.location.origin,[])}/api/mcp`,o=p.useMemo(()=>[{id:"mcp-url",label:"Streamable HTTP MCP URL",value:s},{id:"stdio",label:"Stdio bridge command",value:`agent-inspector-mcp stdio --url ${s}`},{id:"doctor",label:"Bridge doctor",value:`agent-inspector-mcp doctor --url ${s}`},{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:s}}},null,2)},{id:"stdio-json",label:"Stdio MCP JSON",value:JSON.stringify({mcpServers:{"agent-inspector":{command:"agent-inspector-mcp",args:["stdio","--url",s]}}},null,2)},{id:"opencode-local",label:"OpenCode local MCP",value:JSON.stringify({mcp:{"agent-inspector":{type:"local",command:["agent-inspector-mcp","stdio","--url",s],enabled:!0}}},null,2)},{id:"mimo-local",label:"MiMo Code local MCP",value:JSON.stringify({mcp:{"agent-inspector":{type:"local",command:["agent-inspector-mcp","stdio","--url",s],enabled:!0}}},null,2)},{id:"codex-toml",label:"Codex TOML",value:`[mcp_servers.agent-inspector]
|
|
105
105
|
command = "agent-inspector-mcp"
|
|
106
|
-
args = ["stdio", "--url", "${s}"]`}],[s]),i=p.useCallback((a,l)=>{Nt(l).then(c=>{c&&(t(a),setTimeout(()=>t(null),1600))})},[]);return r.jsxs("div",{className:"min-w-0 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Es,{className:"size-4 text-muted-foreground"}),r.jsx("h3",{className:"text-sm font-semibold",children:"MCP access"})]}),r.jsxs("div",{className:"grid gap-2 rounded-md bg-muted/15 px-3 py-2 text-xs text-muted-foreground",children:[r.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."}),r.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."})]}),r.jsx("div",{className:"grid gap-2",children:o.map(a=>r.jsx(Gs,{id:a.id,label:a.label,value:a.value,copiedId:e,onCopy:i},a.id))})]})}function yR(){const{strip:e,slowResponseThresholdSeconds:t,providerTestTimeoutSeconds:n,timeDisplayFormat:s,isLoading:o,setStrip:i,setSlowResponseThresholdSeconds:a,setProviderTestTimeoutSeconds:l,setTimeDisplayFormat:c}=yl(),[u,d]=p.useState(null),[f,h]=p.useState(!1),m=p.useCallback(async b=>{d(null),h(!0);try{await i(b)}catch(y){d(y instanceof Error?y.message:String(y))}finally{h(!1)}},[i]),v=p.useCallback(async b=>{d(null),h(!0);try{await a(b)}catch(y){d(y instanceof Error?y.message:String(y))}finally{h(!1)}},[a]),g=p.useCallback(async b=>{d(null),h(!0);try{await l(b)}catch(y){d(y instanceof Error?y.message:String(y))}finally{h(!1)}},[l]),x=p.useCallback(async b=>{d(null),h(!0);try{await c(b)}catch(y){d(y instanceof Error?y.message:String(y))}finally{h(!1)}},[c]);return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"Claude Code billing header"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Strip Claude Code's synthetic billing block before upstream forwarding. This can improve prefix-cache hits with third-party providers and is persisted to ",r.jsx("code",{children:"config.json"}),"."]})]}),r.jsxs("label",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"checkbox",role:"switch",checked:e,disabled:o||f,onChange:b=>{m(b.currentTarget.checked)},className:"size-4 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"}),r.jsx("span",{className:"text-sm",children:o?"Loading...":e?"Stripping enabled":"Stripping disabled"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{htmlFor:"slow-response-threshold",className:"text-sm font-semibold",children:"Slow response threshold"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Show a slow marker when elapsed time exceeds this many seconds. Use ",r.jsx("code",{children:"0"})," to disable it."]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{id:"slow-response-threshold",type:"number",min:0,max:la,step:1,value:t,disabled:o||f,onChange:b=>{const y=Number(b.currentTarget.value);Number.isInteger(y)&&(y<0||y>la||v(y))},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"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"seconds"})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{htmlFor:"provider-test-timeout",className:"text-sm font-semibold",children:"Provider test timeout"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Abort slow Provider Test probes after this many seconds per model."}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{id:"provider-test-timeout",type:"number",min:1,max:ca,step:1,value:n,disabled:o||f,onChange:b=>{const y=Number(b.currentTarget.value);Number.isInteger(y)&&(y<1||y>ca||g(y))},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"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"seconds / model"})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{htmlFor:"time-display-format",className:"text-sm font-semibold",children:"Time display"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Controls timestamps in session summaries, headers, and log rows."}),r.jsxs("select",{id:"time-display-format",value:s,disabled:o||f,onChange:b=>{const y=Wf.safeParse(b.currentTarget.value);y.success&&x(y.data)},className:"h-8 rounded-md border border-input bg-background px-2 text-sm disabled:cursor-not-allowed disabled:opacity-50",children:[r.jsx("option",{value:"time",children:"Time only"}),r.jsx("option",{value:"full",children:"Full ISO"})]})]}),u!==null&&r.jsxs("p",{className:"text-xs text-destructive",children:["Failed to save: ",u]})]})}const wR=Re(["installed","update-available","available","planned","unknown"]),_R=J({id:S(),name:S(),npmName:S(),capability:S(),description:S(),workflow:S(),installCommand:S(),state:wR,installedVersion:S().nullable(),latestVersion:S().nullable(),primary:Le()}),kR=J({id:S(),name:S(),validatedVersion:S(),binary:S(),modelFlag:S(),variantFlag:S().nullable(),tools:fe(S()),logDir:S(),skillsDir:S(),agentsDir:S()}),jR=J({id:S(),title:S(),stage:S(),packageId:S(),description:S(),command:S(),requiresSession:Le(),runnable:Le()}),SR=J({checkedAt:S(),packages:fe(_R),runnerPresets:fe(kR),recipes:fe(jR)}),CR=Re(["install","upgrade","help","runner-presets","recipe"]),NR=Re(["queued","running","succeeded","failed"]),M0=J({id:S(),packageId:S(),npmName:S(),recipeId:S().nullable().default(null),action:CR,status:NR,command:S(),output:S(),createdAt:S(),startedAt:S().nullable(),finishedAt:S().nullable(),exitCode:K().nullable(),error:S().nullable()}),mc=J({task:M0}),TR=J({tasks:fe(M0)}),ER=[{id:"observe",title:"Observe",label:"Live",description:"Capture IDE, process, session, turn, request, response, tools, and providers.",metric:"Inspector core",icon:X2},{id:"replay",title:"Replay",label:"Ready",description:"Promote real logs into repeatable replay evidence without losing the raw context.",metric:"Session asset",icon:yn},{id:"evaluate",title:"Evaluate",label:"Next",description:"Use eval-harness to turn sessions into regression cases and provider bakeoffs.",metric:"Eval loop",icon:wl},{id:"connect",title:"Connect",label:"MCP",description:"Expose Inspector state to coding agents as queryable context and durable evidence.",metric:"/api/mcp",icon:Ow}];async function AR(e){return pt(e,SR,void 0,t=>`Failed to load ecosystem packages: ${String(t.status)}`)}async function RR(e){return pt(e,mc,void 0,t=>`Failed to load ecosystem task: ${String(t.status)}`)}async function IR(e){return pt(e,TR,void 0,t=>`Failed to load ecosystem tasks: ${String(t.status)}`)}async function zR(e,t){return(await pt(`/api/ecosystem/packages/${encodeURIComponent(e)}/${t}`,mc,{method:"POST"},s=>`Failed to start ecosystem task: ${String(s.status)}`)).task}async function OR(e){return(await pt(`/api/ecosystem/recipes/${encodeURIComponent(e)}/run`,mc,{method:"POST"},n=>`Failed to start ecosystem recipe: ${String(n.status)}`)).task}function PR(e){switch(e){case"installed":return"Installed";case"update-available":return"Update";case"available":return"Available";case"planned":return"Planned";case"unknown":return"Unknown"}}function MR(e){switch(e){case"installed":return"border-emerald-400/20 bg-emerald-400/8 text-emerald-200";case"update-available":return"border-amber-400/20 bg-amber-400/8 text-amber-200";case"available":return"border-sky-400/20 bg-sky-400/8 text-sky-200";case"planned":return"border-white/10 bg-white/[0.04] text-white/55";case"unknown":return"border-white/10 bg-white/[0.04] text-white/45"}}function LR(e){return e.installedVersion!==null&&e.latestVersion!==null?e.installedVersion===e.latestVersion?`v${e.installedVersion}`:`v${e.installedVersion} -> v${e.latestVersion}`:e.installedVersion!==null?`v${e.installedVersion}`:e.latestVersion!==null?`latest v${e.latestVersion}`:"not published"}function Ks(e){switch(e){case"install":return"Install";case"upgrade":return"Upgrade";case"help":return"Help";case"runner-presets":return"Presets";case"recipe":return"Recipe"}}function DR(e){switch(e.status){case"queued":return"Queued";case"running":return`${Ks(e.action)} running`;case"succeeded":return`${Ks(e.action)} complete`;case"failed":return`${Ks(e.action)} failed`}}function L0(e){switch(e){case"queued":case"running":return"border-cyan-300/20 bg-cyan-300/8 text-cyan-100";case"succeeded":return"border-emerald-400/20 bg-emerald-400/8 text-emerald-100";case"failed":return"border-red-400/20 bg-red-400/8 text-red-100"}}function $R(e){switch(e.state){case"available":return"install";case"update-available":return"upgrade";case"installed":case"planned":case"unknown":return null}}function FR({pkg:e,activeTask:t,onStartTask:n}){const s=$R(e),o=t!==null&&t.packageId===e.id&&t.status==="running";return r.jsxs("div",{className:"rounded-lg bg-white/[0.025] p-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[r.jsx(Dw,{className:"size-4 shrink-0 text-white/55"}),r.jsx("div",{className:"text-sm font-semibold leading-snug",children:e.name})]}),r.jsx("div",{className:"mt-1 break-all font-mono text-[11px] leading-snug text-white/35",children:e.npmName})]}),r.jsx(Me,{className:ie("shrink-0",MR(e.state)),variant:"outline",children:PR(e.state)})]}),r.jsx("div",{className:"mt-3 text-xs leading-5 text-muted-foreground",children:e.description}),r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-[11px]",children:[r.jsx("span",{className:"rounded bg-white/[0.035] px-2 py-1 font-mono text-white/50",children:LR(e)}),r.jsx("span",{className:"rounded bg-white/[0.035] px-2 py-1 text-white/45",children:e.capability}),r.jsx("span",{className:"rounded bg-white/[0.035] px-2 py-1 font-mono text-white/35",children:e.installCommand})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[s!==null&&r.jsxs(ke,{type:"button",size:"sm",variant:"secondary",disabled:o,onClick:()=>n(e.id,s),children:[o?r.jsx(Qe,{className:"size-3.5 animate-spin"}):r.jsx(dr,{className:"size-3.5"}),Ks(s)]}),r.jsxs(ke,{type:"button",size:"sm",variant:"outline",disabled:o||e.state==="planned",onClick:()=>n(e.id,"help"),children:[r.jsx(Es,{className:"size-3.5"}),"Help"]}),e.id==="eval-harness"&&r.jsxs(ke,{type:"button",size:"sm",variant:"ghost",disabled:o||e.state==="planned",onClick:()=>n(e.id,"runner-presets"),children:[r.jsx(wl,{className:"size-3.5"}),"Presets"]})]})]})}function BR({task:e}){if(e===null)return null;const t=e.status==="queued"||e.status==="running";return r.jsxs("section",{className:"mt-3 rounded-lg bg-white/[0.025] p-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t?r.jsx(Qe,{className:"size-4 animate-spin text-cyan-200/75"}):r.jsx(Es,{className:"size-4 text-white/55"}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-semibold",children:DR(e)}),r.jsx("div",{className:"break-all font-mono text-[11px] text-white/35",children:e.command})]})]}),r.jsx(Me,{variant:"outline",className:ie("shrink-0",L0(e.status)),children:e.status})]}),r.jsx("pre",{className:"mt-3 max-h-56 overflow-auto whitespace-pre-wrap rounded-md bg-black/30 p-3 font-mono text-[11px] leading-5 text-white/60 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.045)]",children:e.output.trim().length>0?e.output:"Waiting for npm output..."}),e.error!==null&&r.jsx("div",{className:"mt-2 text-xs text-red-100",children:e.error})]})}function UR({workflow:e}){const t=e.icon;return r.jsxs("div",{className:"rounded-lg bg-white/[0.025] p-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(t,{className:"size-4 shrink-0 text-cyan-200/75"}),r.jsx("div",{className:"text-sm font-semibold",children:e.title})]}),r.jsx("span",{className:"rounded bg-white/[0.04] px-2 py-0.5 font-mono text-[10px] text-white/45",children:e.label})]}),r.jsx("div",{className:"mt-2 min-h-10 text-xs leading-5 text-muted-foreground",children:e.description}),r.jsx("div",{className:"mt-3 font-mono text-[11px] text-white/35",children:e.metric})]})}function WR(e){return e===null?'npx @tonyclaw/eval-harness inspector-smoke --title "TonyClaw Lab smoke" --latest-log-limit 5':`npx @tonyclaw/eval-harness inspector-smoke --title "TonyClaw Lab smoke ${e}" --latest-log-limit 5`}function HR({preset:e}){return r.jsxs("div",{className:"rounded-lg bg-white/[0.025] p-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[r.jsx(Xf,{className:"size-4 shrink-0 text-cyan-200/75"}),r.jsx("div",{className:"text-sm font-semibold leading-snug",children:e.name})]}),r.jsxs("div",{className:"mt-1 break-all font-mono text-[11px] leading-snug text-white/35",children:[e.binary," ",e.modelFlag,e.variantFlag!==null?` ${e.variantFlag}`:""]})]}),r.jsxs(Me,{variant:"outline",className:"border-white/10 bg-white/[0.04] text-white/55",children:["v",e.validatedVersion]})]}),r.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 text-[11px]",children:[r.jsxs("div",{className:"rounded bg-black/15 px-2 py-1 text-white/45",children:["logs/",e.logDir]}),r.jsx("div",{className:"rounded bg-black/15 px-2 py-1 text-white/45",children:e.tools.join(", ")}),r.jsx("div",{className:"rounded bg-black/15 px-2 py-1 font-mono text-white/35",children:e.skillsDir}),r.jsx("div",{className:"rounded bg-black/15 px-2 py-1 font-mono text-white/35",children:e.agentsDir})]})]})}function VR({recipe:e,copied:t,running:n,onCopy:s,onRun:o}){return r.jsxs("div",{className:"rounded-lg bg-white/[0.025] p-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[r.jsx(Zf,{className:"size-4 shrink-0 text-cyan-200/75"}),r.jsx("div",{className:"text-sm font-semibold leading-snug",children:e.title})]}),r.jsx("div",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:e.description})]}),r.jsx(Me,{variant:"outline",className:"border-white/10 bg-white/[0.04] text-white/55",children:e.runnable?e.stage:"Template"})]}),r.jsx("div",{className:"mt-3 rounded-md bg-black/20 p-2 font-mono text-[11px] leading-5 text-white/50 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.045)]",children:e.command}),r.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2",children:[r.jsx("span",{className:"rounded bg-white/[0.035] px-2 py-1 font-mono text-[11px] text-white/35",children:e.packageId}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ke,{type:"button",size:"sm",variant:"outline",onClick:()=>s(e),children:[t?r.jsx(Ge,{className:"size-3.5"}):r.jsx(At,{className:"size-3.5"}),t?"Copied":"Copy"]}),e.runnable&&r.jsxs(ke,{type:"button",size:"sm",variant:"secondary",disabled:n,onClick:()=>o(e),children:[n?r.jsx(Qe,{className:"size-3.5 animate-spin"}):r.jsx(Xf,{className:"size-3.5"}),n?"Running":"Run"]})]})]})]})}function qR({task:e,selected:t,onSelect:n}){const s=e.recipeId??Ks(e.action);return r.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md bg-white/[0.025] px-3 py-2 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.045)]",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(Kf,{className:"size-3.5 shrink-0 text-white/40"}),r.jsx("div",{className:"truncate text-xs font-semibold text-white/75",children:s}),r.jsx(Me,{variant:"outline",className:ie("shrink-0",L0(e.status)),children:e.status})]}),r.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-2 font-mono text-[10px] text-white/35",children:[r.jsx("span",{children:e.packageId}),r.jsx("span",{children:new Date(e.createdAt).toLocaleTimeString()}),e.exitCode!==null&&r.jsxs("span",{children:["exit ",String(e.exitCode)]})]})]}),r.jsx(ke,{type:"button",size:"sm",variant:t?"secondary":"outline",onClick:()=>n(e),children:t?"Open":"View"})]})}function md({currentSessionId:e,logCount:t}){const[n,s]=p.useState(!1),[o,i]=p.useState(!1),[a,l]=p.useState(!1),[c,u]=p.useState(null),[d,f]=p.useState(null),[h,m]=p.useState(null),v=qt("/api/ecosystem/packages",AR,{revalidateOnFocus:!1,revalidateIfStale:!1}),g=qt(d===null?null:`/api/ecosystem/tasks/${d}`,RR,{refreshInterval:w=>{const $=w?.task;return $!==void 0&&($.status==="queued"||$.status==="running")?900:0},revalidateOnFocus:!1}),x=qt(n?"/api/ecosystem/tasks":null,IR,{refreshInterval:2500,revalidateOnFocus:!1}),b=v.data?.packages??[],y=v.data?.runnerPresets??[],k=v.data?.recipes??[],j=(x.data?.tasks??[]).slice(0,6),C=p.useMemo(()=>b.filter(w=>w.state==="installed"||w.state==="update-available").length,[b]),T=WR(e),N="npx @tonyclaw/eval-harness runner-presets",O=()=>{Nt(T).then(()=>{i(!0),window.setTimeout(()=>i(!1),1200)})},A=()=>{Nt(N).then(()=>{l(!0),window.setTimeout(()=>l(!1),1200)})},z=w=>{Nt(w.command).then(()=>{u(w.id),window.setTimeout(()=>u(null),1200)})},D=w=>{m(null),OR(w.id).then($=>{f($.id),g.mutate({task:$},{revalidate:!0}),x.mutate()}).catch($=>{m($ instanceof Error?$.message:"Failed to start ecosystem recipe")})},E=g.data?.task??null;p.useEffect(()=>{E!==null&&(x.mutate(),E.status==="succeeded"&&v.mutate())},[E,v,x]);const L=(w,$)=>{m(null),zR(w,$).then(ee=>{f(ee.id),g.mutate({task:ee},{revalidate:!0}),x.mutate()}).catch(ee=>{m(ee instanceof Error?ee.message:"Failed to start ecosystem task")})};return r.jsxs(Gn,{open:n,onOpenChange:s,children:[r.jsx(Xo,{asChild:!0,children:r.jsxs(ke,{variant:"ghost",size:"icon",className:vi,"aria-label":"TonyClaw Lab",title:"TonyClaw Lab",children:[r.jsx(Zf,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"TonyClaw Lab"})]})}),r.jsxs(Kn,{className:"flex max-h-[84vh] max-w-5xl flex-col overflow-hidden",children:[r.jsx(Jn,{children:r.jsxs(Yn,{className:"flex items-center gap-2",children:[r.jsx(Hc,{className:"size-4 text-cyan-200/80"}),"TonyClaw Lab"]})}),r.jsxs("div",{className:"overflow-y-auto pr-2",children:[r.jsxs("div",{className:"grid gap-3 lg:grid-cols-[1.1fr_0.9fr]",children:[r.jsxs("section",{className:"rounded-lg bg-white/[0.025] p-4 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-semibold",children:"Session asset pipeline"}),r.jsx("div",{className:"mt-1 max-w-2xl text-xs leading-5 text-muted-foreground",children:"Treat captured traffic as durable assets: observe it, replay it, evaluate it, and expose it back to agents through MCP."})]}),r.jsxs(Me,{variant:"outline",className:"border-cyan-300/20 bg-cyan-300/8 text-cyan-100",children:[String(C),"/",String(b.length)," packages"]})]}),r.jsx("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:ER.map(w=>r.jsx(UR,{workflow:w},w.id))})]}),r.jsxs("section",{className:"rounded-lg bg-white/[0.025] p-4 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-semibold",children:"Current session"}),r.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:e===null?"MCP smoke command":e})]}),r.jsxs(Me,{variant:"outline",className:"border-white/10 bg-white/[0.04] text-white/55",children:[String(t)," logs"]})]}),r.jsx("div",{className:"mt-4 rounded-md bg-black/20 p-3 font-mono text-[11px] leading-5 text-white/55 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.045)]",children:T}),r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[r.jsxs(ke,{size:"sm",variant:"secondary",onClick:O,children:[o?r.jsx(Ge,{className:"size-3.5"}):r.jsx(At,{className:"size-3.5"}),o?"Copied":"Copy"]}),r.jsxs(ke,{size:"sm",variant:"outline",onClick:A,children:[r.jsx(wl,{className:"size-3.5"}),a?"Presets copied":"Runner Presets"]})]})]})]}),r.jsxs("section",{className:"mt-3",children:[r.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[r.jsx("div",{className:"text-sm font-semibold",children:"Lab recipes"}),r.jsxs("div",{className:"hidden items-center gap-1 font-mono text-[11px] text-muted-foreground sm:flex",children:[r.jsx(Hc,{className:"size-3.5"}),"copy-ready workflows"]})]}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[k.map(w=>r.jsx(VR,{recipe:w,copied:c===w.id,running:E!==null&&E.recipeId===w.id&&(E.status==="queued"||E.status==="running"),onCopy:z,onRun:D},w.id)),v.isLoading&&k.length===0&&[0,1].map(w=>r.jsx("div",{className:"h-40 animate-pulse rounded-lg bg-white/[0.025] shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]"},w))]})]}),r.jsxs("section",{className:"mt-3",children:[r.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[r.jsx("div",{className:"text-sm font-semibold",children:"Runner presets"}),r.jsxs("div",{className:"hidden items-center gap-1 font-mono text-[11px] text-muted-foreground sm:flex",children:[r.jsx(Es,{className:"size-3.5"}),N]})]}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-4",children:[y.map(w=>r.jsx(HR,{preset:w},w.id)),v.isLoading&&y.length===0&&[0,1,2,3].map(w=>r.jsx("div",{className:"h-32 animate-pulse rounded-lg bg-white/[0.025] shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]"},w))]})]}),r.jsxs("section",{className:"mt-3",children:[r.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[r.jsx("div",{className:"text-sm font-semibold",children:"TonyClaw packages"}),v.isLoading&&r.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:"checking npm..."})]}),v.error!==void 0&&r.jsx("div",{className:"rounded-lg bg-red-500/8 p-3 text-xs text-red-100 shadow-[inset_0_0_0_1px_rgba(248,113,113,0.16)]",children:"Package status is temporarily unavailable."}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[b.map(w=>r.jsx(FR,{pkg:w,activeTask:E,onStartTask:L},w.id)),v.isLoading&&b.length===0&&[0,1,2].map(w=>r.jsx("div",{className:"h-36 animate-pulse rounded-lg bg-white/[0.025] shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]"},w))]})]}),h!==null&&r.jsx("div",{className:"mt-3 rounded-lg bg-red-500/8 p-3 text-xs text-red-100 shadow-[inset_0_0_0_1px_rgba(248,113,113,0.16)]",children:h}),j.length>0&&r.jsxs("section",{className:"mt-3",children:[r.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[r.jsx("div",{className:"text-sm font-semibold",children:"Recent Lab runs"}),r.jsxs("div",{className:"hidden font-mono text-[11px] text-muted-foreground sm:block",children:["last ",String(j.length)]})]}),r.jsx("div",{className:"grid gap-2 md:grid-cols-2",children:j.map(w=>r.jsx(qR,{task:w,selected:d===w.id,onSelect:$=>{f($.id),g.mutate({task:$},{revalidate:!0})}},w.id))})]}),r.jsx(BR,{task:E})]})]})]})}function ZR(e){const t=new Map;for(const n of e){const s=n.logs;for(let o=1;o<s.length;o++){const i=s[o-1],a=s[o];i===void 0||a===void 0||t.set(a.id,{creation:gd(i.cacheCreationInputTokens,a.cacheCreationInputTokens),read:gd(i.cacheReadInputTokens,a.cacheReadInputTokens)})}}return t}function gd(e,t){return t===null||e===null?null:t>e?{direction:"up",delta:t-e}:t<e?{direction:"down",delta:e-t}:null}function D0(e){return e.filter(t=>t.responseStatus===null).length}function $0(e){for(const t of e){const n=t.userAgent;if(n!=null&&n!=="")return n}return null}function GR(e){for(const t of e){const n=t.clientPid;if(n!=null)return n}return null}function F0(e){for(const t of e){const n=t.clientProjectFolder;if(n!=null&&n!=="")return n}return null}function KR(e){return Ll({userAgent:$0(e.logs),conversationId:e.conversationId,clientProjectFolder:F0(e.logs)})}function JR(e){if(e===null||e==="")return"Unknown IDE";const t=e.split(/[ /;]/)[0]??"";return t===""?"Unknown IDE":t}function YR(e,t){const n=Qo(e);return n!==null?n:JR(t)}function Mo(e){return e===null||e===""?"unknown":String(e)}function XR(e,t,n){return e!=="unknown"?e:`unknown:${Mo(t)}:${Mo(n)}`}function QR(e,t){return`${Mo(e)}:${Mo(t)}`}function Ga(e){return[...e].sort((t,n)=>t.timestamp.localeCompare(n.timestamp))}function xd(e){return Ga(e)[0]?.timestamp??""}function ea(e){return[...e].sort((t,n)=>xd(t.logs).localeCompare(xd(n.logs)))}function eI(e){const t=new Map;for(const s of e){const o=$0(s.logs),i=F0(s.logs),a=KR(s),l=XR(a,o,i);let c=t.get(l);c===void 0&&(c={id:l,client:a,label:YR(a,o),userAgent:o,processes:new Map,logs:[]},t.set(l,c)),c.logs.push(...s.logs);const u=GR(s.logs),d=`${l}:${QR(u,i)}`;let f=c.processes.get(d);f===void 0&&(f={id:d,clientPid:u,clientProjectFolder:i,sessions:[],logs:[]},c.processes.set(d,f)),f.sessions.push(s),f.logs.push(...s.logs)}const n=[];for(const s of t.values()){const o=ea([...s.processes.values()].map(i=>({id:i.id,clientPid:i.clientPid,clientProjectFolder:i.clientProjectFolder,sessions:ea(i.sessions),logs:Ga(i.logs)})));n.push({id:s.id,client:s.client,label:s.label,userAgent:s.userAgent,processes:o,logs:Ga(s.logs)})}return ea(n)}function Lo(e){return e<=0?"0":Fe(e)}function B0(e){let t=0,n=0;for(const s of e)s.inputTokens!==null&&s.inputTokens!==void 0&&(t+=s.inputTokens),s.outputTokens!==null&&s.outputTokens!==void 0&&(n+=s.outputTokens);return{inputTokens:t,outputTokens:n}}function tI(e){let t=0;for(const n of e)t+=n.sessions.length;return t}function nI(e){if(e===null||e==="")return null;const t=e.replaceAll("\\","/").split("/").filter(o=>o!==""),n=t[t.length-1];if(n===void 0)return e;const s=t[t.length-2];return s===void 0?n:`${s}/${n}`}function Do({label:e,value:t,className:n}){return r.jsxs("span",{className:ie("bg-white/[0.045] inline-flex h-7 items-center gap-1 rounded-md px-2 text-xs text-muted-foreground",n),children:[r.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.12em] text-white/35",children:e}),r.jsx("span",{className:"font-mono tabular-nums text-slate-100",children:t})]})}function U0({count:e,label:t="Turn open"}){return r.jsxs("span",{className:"inline-flex h-6 shrink-0 items-center gap-1.5 rounded-md bg-amber-300/[0.10] px-1.5 font-mono text-[10px] uppercase tracking-[0.14em] text-amber-100/90 ring-1 ring-amber-200/10",title:`${e} turn${e!==1?"s":""} not finished yet`,children:[r.jsx(Qe,{className:"size-3 animate-spin"}),t,e>1&&r.jsxs("span",{className:"tabular-nums",children:["x",e]})]})}function W0(){return r.jsx("span",{className:"pointer-events-none absolute inset-x-3 bottom-0 h-px overflow-hidden rounded-full bg-white/[0.06]","aria-hidden":"true",children:r.jsx("span",{className:"absolute inset-y-0 left-0 w-1/3 animate-pulse rounded-full bg-amber-200/65 shadow-[0_0_14px_rgba(252,211,77,0.32)]"})})}function sI({groups:e,...t}){const n=p.useMemo(()=>eI(e),[e]),[s,o]=p.useState(()=>new Set),[i,a]=p.useState(()=>new Set),l=p.useCallback(u=>{o(d=>{const f=new Set(d);return f.has(u)?f.delete(u):f.add(u),f})},[]),c=p.useCallback(u=>{a(d=>{const f=new Set(d);return f.has(u)?f.delete(u):f.add(u),f})},[]);return r.jsx("div",{className:"space-y-4",children:n.map(u=>r.jsx(rI,{group:u,collapsed:s.has(u.id),collapsedProcessIds:i,onToggleIde:()=>l(u.id),onToggleProcess:c,conversationProps:t},u.id))})}function rI({group:e,collapsed:t,collapsedProcessIds:n,onToggleIde:s,onToggleProcess:o,conversationProps:i}){const a=B0(e.logs),l=tI(e.processes),c=e.logs.length,u=D0(e.logs),d=u>0;return r.jsxs("section",{className:ie("bg-card/75 shadow-sm relative isolate overflow-hidden rounded-[8px]",d&&"bg-card/85"),"data-ide-group":e.id,children:[r.jsxs("button",{type:"button",className:"flex w-full min-w-0 items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-white/[0.03] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/45",onClick:s,"aria-expanded":!t,children:[e.client==="unknown"?r.jsx("span",{className:"bg-white/[0.045] inline-flex size-10 shrink-0 items-center justify-center rounded-[8px] text-slate-200",children:r.jsx(Aw,{className:"size-5"})}):r.jsx(ei,{client:e.client,className:"size-10 rounded-[8px] text-cyan-100"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:"truncate text-sm font-semibold text-slate-50",title:e.userAgent??e.label,children:e.label}),r.jsx("span",{className:"rounded bg-cyan-300/[0.06] px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-[0.16em] text-cyan-100/75",children:"IDE"}),d&&r.jsx(U0,{count:u,label:"Turn open"})]}),r.jsxs("span",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[r.jsxs("span",{children:[e.processes.length," process",e.processes.length!==1?"es":""]}),r.jsxs("span",{children:[l," session",l!==1?"s":""]}),r.jsxs("span",{children:[c," log",c!==1?"s":""]})]})]}),r.jsxs("span",{className:"hidden shrink-0 items-center gap-2 md:flex",children:[r.jsx(Do,{label:"IN",value:Lo(a.inputTokens)}),r.jsx(Do,{label:"OUT",value:Lo(a.outputTokens)})]}),r.jsx("span",{className:"bg-white/[0.045] hover:bg-white/[0.075] inline-flex size-8 shrink-0 items-center justify-center rounded-md text-slate-200",children:t?r.jsx(Tt,{className:"size-4"}):r.jsx(ot,{className:"size-4"})})]}),d&&r.jsx(W0,{}),!t&&r.jsx("div",{className:"space-y-3 px-3 pb-3 pt-2 sm:px-4",children:e.processes.map(f=>r.jsx(oI,{group:f,collapsed:n.has(f.id),onToggle:()=>o(f.id),conversationProps:i},f.id))})]})}function oI({group:e,collapsed:t,onToggle:n,conversationProps:s}){const o=B0(e.logs),i=nI(e.clientProjectFolder),a=e.sessions.length,l=e.logs.length,c=D0(e.logs),u=c>0,d=e.clientPid!==null&&e.clientPid!==void 0?`PID ${e.clientPid}`:"process";return r.jsxs("section",{className:"relative pl-5",children:[r.jsx("span",{className:"absolute bottom-1 left-2 top-1 w-px bg-white/[0.055]","aria-hidden":"true"}),r.jsxs("div",{className:"bg-black/[0.10] relative overflow-hidden rounded-[8px]",children:[r.jsxs("button",{type:"button",className:"flex w-full min-w-0 items-center gap-3 px-3 py-2.5 text-left transition-colors hover:bg-white/[0.035] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40",onClick:n,"aria-expanded":!t,children:[r.jsx("span",{className:"bg-white/[0.045] inline-flex size-8 shrink-0 items-center justify-center rounded-md text-amber-100",children:r.jsx(Gy,{className:"size-4"})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[r.jsx("span",{className:"font-mono text-xs font-semibold tabular-nums text-slate-100",children:d}),u&&r.jsx(U0,{count:c,label:"Turn open"}),i!==null&&r.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1 text-xs text-muted-foreground",title:e.clientProjectFolder??i,children:[r.jsx(mw,{className:"size-3 shrink-0"}),r.jsx("span",{className:"truncate font-mono",children:i})]})]}),r.jsxs("span",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[r.jsxs("span",{children:[a," session",a!==1?"s":""]}),r.jsxs("span",{children:[l," log",l!==1?"s":""]})]})]}),r.jsxs("span",{className:"hidden shrink-0 items-center gap-2 md:flex",children:[r.jsx(Do,{label:"IN",value:Lo(o.inputTokens)}),r.jsx(Do,{label:"OUT",value:Lo(o.outputTokens)})]}),r.jsx("span",{className:"bg-white/[0.045] hover:bg-white/[0.075] inline-flex size-7 shrink-0 items-center justify-center rounded-md text-slate-200",children:t?r.jsx(Tt,{className:"size-4"}):r.jsx(ot,{className:"size-4"})})]}),u&&r.jsx(W0,{}),!t&&r.jsx("div",{className:"space-y-2 p-2 pt-1 sm:p-3 sm:pt-2",children:e.sessions.map(f=>r.jsx(iA,{group:f,...s,showClientIdentity:!1,showLogClientMetadata:!1,showProcessMetadata:!1},f.id))})]})]})}const $o="data-nav-id",iI="data-nav-action";function bd(e){return Array.from(e.querySelectorAll(`[${$o}]`))}function vd(e){return e instanceof HTMLElement}function aI(e,t){let n=e;for(;n!==null&&n!==t;){if(n.hasAttribute($o))return n;n=n.parentElement}return e.hasAttribute($o)?e:null}function ta(e){const t=e.getAttribute(iI);return t==="toggle"||t==="expand"||t==="collapse"?t:null}function Hs(e){e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",behavior:"smooth"})}function Vs(e,t){return e[t]??null}function H0(e){const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)}function yd(e){const t=e.tagName;return t==="BUTTON"||t==="A"||H0(e)?!0:e.closest("[role='button'],[role='menuitem'],[role='option']")!==null}function lI(e){return e.closest("[role='dialog'],[role='menu'],[role='listbox']")!==null?!0:document.querySelector("[role='dialog'],[role='menu'],[role='listbox']")!==null}function cI(){const e=window.getSelection();return e===null?!1:e.type==="Range"&&e.toString().length>0}function Vr(e,t){return e.key===t&&e.shiftKey}function uI(e,t,n={}){const s=t??e,o=n.pageWide===!0,i=p.useCallback(a=>{const l=e.current,c=s.current;if(!l||!c)return;const u=a.target;if(!vd(u)||u!==c)return;const d=bd(l),f=Vs(d,0);f!==null&&Hs(f)},[e,s]);p.useEffect(()=>{const a=l=>{if(l.altKey||l.ctrlKey||l.metaKey)return;const c=e.current;if(!c)return;const u=l.target;if(!vd(u)||H0(u)||cI())return;const d=c.contains(u);if(d&&yd(u)&&!u.hasAttribute($o)||!d&&(!o||yd(u)||lI(u)))return;const f=bd(c);if(f.length===0)return;const h=aI(u,c),m=h!==null?f.indexOf(h):-1;let v=!1;switch(l.key){case"ArrowUp":case"W":{if(l.shiftKey&&l.key==="ArrowUp"||l.key==="W"&&!Vr(l,"W"))break;l.preventDefault();const g=m>0?m-1:m===-1?f.length-1:-1;if(g!==-1){const x=Vs(f,g);x!==null&&Hs(x)}v=!0;break}case"ArrowDown":case"S":{if(l.shiftKey&&l.key==="ArrowDown"||l.key==="S"&&!Vr(l,"S"))break;l.preventDefault();const g=m<f.length-1?m+1:m===-1?0:-1;if(g!==-1){const x=Vs(f,g);x!==null&&Hs(x)}v=!0;break}case"ArrowLeft":case"A":{if(l.shiftKey&&l.key==="ArrowLeft"||l.key==="A"&&!Vr(l,"A")||h===null)break;if(l.preventDefault(),ta(h)==="collapse")h.click();else if(m>0){const x=Vs(f,m-1);x!==null&&Hs(x)}v=!0;break}case"ArrowRight":case"D":{if(l.shiftKey&&l.key==="ArrowRight"||l.key==="D"&&!Vr(l,"D")||h===null)break;if(l.preventDefault(),ta(h)==="expand")h.click();else if(m<f.length-1){const x=Vs(f,m+1);x!==null&&Hs(x)}v=!0;break}case" ":{if(h===null)break;l.preventDefault(),ta(h)!==null&&h.click(),v=!0;break}}v&&l.stopPropagation()};return document.addEventListener("keydown",a,{capture:!0}),()=>document.removeEventListener("keydown",a,{capture:!0})},[e,o,s]),p.useEffect(()=>(document.addEventListener("focusin",i),()=>document.removeEventListener("focusin",i)),[i])}const dI={system:"System",user:"User",assistant:"Assistant",tool:"Tool Results",tools:"Tool Definitions"},fI={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"},pI={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"},na=12,qr=1,wd=80,_d=24;function hI(e){return e.length<=_d?e:`${e.slice(0,_d-3)}...`}function mI(e){const t=e.replace(/\s+/g," ").trim();return t.length<=wd?t:`${t.slice(0,wd)}...`}function Zr(e){return e>=10?`${e.toFixed(0)}%`:e>=1?`${e.toFixed(1)}%`:e>0?"<1%":"0%"}const gI=p.memo(function({segments:t,totalTokens:n,showLabels:s=!0,onActivate:o}){const i=p.useMemo(()=>n>0?n:t.reduce((x,b)=>x+b.size,0),[t,n]),a=t.slice(0,na),l=t.slice(na),c=l.reduce((x,b)=>x+b.size,0),u=l.length,d=na,f=d+u-1,h=u>0,m=o!==void 0,v=p.useMemo(()=>a.reduce((x,b)=>x+b.size,0),[a]),g=p.useMemo(()=>`Request context: ~${Fe(i)} tokens across ${t.length} segment${t.length===1?"":"s"}`,[t.length,i]);return t.length===0||i<=0?r.jsx("div",{role:"img","aria-label":g,className:"h-6"}):r.jsx(jn,{delayDuration:150,children:r.jsxs("div",{role:"img","aria-label":g,className:"flex flex-col gap-1.5",children:[r.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 y=i>0?x.size/i*100:0,k=Math.max(qr,y),j=ie("h-full border-r border-background/80 last:border-r-0",m?"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",fI[x.role],m?pI[x.role]:""),C={width:`${k}%`},T=`${x.label}, ${Zr(y)}, ~${Fe(x.size)} tokens`;return r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:m?r.jsx("button",{type:"button",role:"button",tabIndex:0,onClick:()=>o(x),onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),o(x))},"data-anatomy-path":x.path,"aria-label":T,className:j,style:C}):r.jsx("span",{"aria-label":T,className:j,style:C})}),r.jsxs(dt,{side:"bottom",className:"max-w-sm text-xs p-2 space-y-0.5",children:[r.jsxs("div",{className:"font-semibold",children:[x.label," - ",Zr(y)," - ~",Fe(x.size)," ","tokens"]}),r.jsx("div",{className:"text-muted-foreground",children:dI[x.role]}),r.jsxs("div",{className:"text-muted-foreground",children:[x.characters.toLocaleString()," chars"]}),x.text.length>0&&r.jsx("div",{className:"text-muted-foreground/90 break-words whitespace-pre-wrap",children:mI(x.text)})]})]},`${x.path}-${b}`)}),h&&r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.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(qr,c/i*100)}%`},children:["... +",u]})}),r.jsxs(dt,{side:"bottom",className:"text-xs",children:[u," more segment",u===1?"":"s"," (indices"," ",d,"-",f,")"]})]})]}),s&&r.jsxs("div",{className:"flex w-full gap-1 text-[10px] text-muted-foreground",children:[a.map((x,b)=>{const y=i>0?x.size/i*100:0,k=Math.max(qr,y);return r.jsxs("div",{className:"flex flex-col gap-0.5 truncate",style:{width:`${k}%`},title:`${x.label} - ${Zr(y)} - ~${Fe(x.size)} tokens`,children:[r.jsx("span",{className:"truncate font-mono text-foreground/80",children:hI(x.label)}),r.jsxs("span",{className:"truncate font-mono text-muted-foreground/70",children:[Zr(y)," - ~",Fe(x.size)]})]},`label-${x.path}-${b}`)}),h&&r.jsxs("div",{className:"flex flex-col gap-0.5 truncate text-muted-foreground",style:{width:`${Math.max(qr,c/i*100)}%`},children:[r.jsxs("span",{className:"truncate font-mono text-foreground/60",children:["... +",u]}),r.jsxs("span",{className:"truncate font-mono text-muted-foreground/60",children:["~",Fe(c)]})]})]}),v<i*.1&&r.jsx("div",{className:"h-0"})]})})}),V0=.75,q0=.9,Ka=8e3,xI=.35,Z0=40,G0=160,bI=5,vI=8,yI=18,wI=6e4,_I=.7,kd=3e3,kI=.3,jd=160,jI=new Set(["answer","body","content","data","error","message","markdown","output","response","result","stderr","stdout","text","transcript"]),SI=["context_window","contextWindow","context_length","contextLength","max_context_length","maxContextLength","max_input_tokens","maxInputTokens"],CI=["max_tokens","maxTokens","max_completion_tokens","maxCompletionTokens","max_output_tokens","maxOutputTokens"],NI=[{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"]}],TI={system:"System",user:"User messages",assistant:"Assistant messages",tool:"Tool results",tools:"Tool definitions"};function EI(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 K0(e,t){for(const n of t){const s=EI(_e(e,n));if(s!==null)return s}return null}function AI(e){const t=_e(e,"model");if(typeof t!="string")return null;const n=t.trim();return n===""?null:n}function RI(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 II(e,t,n=[]){const s=K0(t,SI);if(s!==null)return{tokens:s,label:"Request metadata",source:"request"};const o=y6(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 i=e.trim().toLowerCase().replace(/\s+/g,"-");for(const a of NI)if(RI(i,a))return{tokens:a.tokens,label:`${a.family} local rule`,source:"model-rule"};return{tokens:null,label:"No local rule",source:"unknown"}}function zI(e){return e<0?0:e>1?1:e}function OI(e){return e===null?"unknown":e>=q0?"danger":e>=V0?"watch":"ok"}function PI(e,t){return e.filter(n=>n.role===t).reduce((n,s)=>n+s.size,0)}function MI(e,t){return["system","user","assistant","tool","tools"].map(s=>{const o=PI(e,s);return{role:s,label:TI[s],tokens:o,percent:t>0?o/t:0}}).filter(s=>s.tokens>0).sort((s,o)=>o.tokens-s.tokens)}function Ja(e){return e.replace(/\s+/g," ").trim().toLowerCase()}function LI(e){const t=e.replace(/\s+/g," ").trim();return t.length<=jd?t:`${t.slice(0,jd-3)}...`}function DI(e){return{role:e.role,label:e.label,path:e.path,tokens:e.tokens,characters:e.characters}}function $I(e){return{role:e.role,label:e.label,path:e.path,tokens:e.size,characters:e.characters,text:e.text}}function FI(e){const t=e.trim();return t.startsWith("{")||t.startsWith("[")}function BI(e){if(!FI(e))return null;try{return JSON.parse(e)}catch{return null}}function UI(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function WI(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 HI(e){const t=WI(e);return t===null?!1:jI.has(UI(t))}function VI(e){return e.map(t=>t.startsWith("[")?t:`.${t}`).join("").replace(/^\./,"")}function qI(e,t,n){const s=oc(t);if(s<G0)return null;const o=rc(t);return o<Z0?null:{role:e.role,label:`${e.label} ${VI(n)}`,path:e.path,tokens:o,characters:s,text:t}}function Ya({value:e,segment:t,path:n,depth:s,candidates:o}){if(!(o.length>=vI)&&!(s>bI)){if(typeof e=="string"){if(!HI(n))return;const i=qI(t,e,n);i!==null&&o.push(i);return}if(Array.isArray(e)){e.forEach((i,a)=>Ya({value:i,segment:t,path:[...n,`[${String(a)}]`],depth:s+1,candidates:o}));return}ic(e)&&Object.entries(e).forEach(([i,a])=>Ya({value:a,segment:t,path:[...n,i],depth:s+1,candidates:o}))}}function ZI(e){const t=$I(e),n=BI(e.text);if(n===null)return[t];const s=[];Ya({value:n,segment:e,path:[],depth:0,candidates:s});const o=Ja(e.text),i=new Set([o]),a=s.filter(l=>{const c=Ja(l.text);return c===""||i.has(c)?!1:(i.add(c),!0)});return[t,...a]}function GI(e){const t=new Map;for(const s of e){const o=ZI(s);for(const i of o){if(i.tokens<Z0||i.characters<G0)continue;const a=Ja(i.text);if(a==="")continue;const l=t.get(a);if(l===void 0){t.set(a,{tokens:i.tokens,candidates:[i]});continue}t.set(a,{tokens:l.tokens+i.tokens,candidates:[...l.candidates,i]})}}const n=[];for(const s of t.values()){if(s.candidates.length<2)continue;const o=s.candidates[0]??null;if(o===null)continue;const i=s.tokens-o.tokens;n.push({key:`${o.path}:${o.label}:${String(s.candidates.length)}:${String(s.tokens)}`,count:s.candidates.length,totalTokens:s.tokens,repeatedTokens:i,preview:LI(o.text),firstLabel:o.label,segments:s.candidates.map(DI)})}return n.sort((s,o)=>o.repeatedTokens-s.repeatedTokens||o.totalTokens-s.totalTokens)}function KI(e){if(e.length===0)return null;const t=e.length,n=e.reduce((o,i)=>o+i.count,0),s=e.reduce((o,i)=>o+i.repeatedTokens,0);return{kind:"duplicate",severity:s>=Ka?"danger":"watch",title:"Duplicate context",detail:`${String(n)} repeated blocks across ${String(t)} group${t===1?"":"s"}, ~${String(s)} repeated tokens.`}}function JI(e){return e.reduce((t,n)=>t+n.repeatedTokens,0)}function YI(e,t,n){const s=[],o=e.find(c=>c.role==="tools")??null;o!==null&&(o.tokens>=Ka||o.percent>=xI&&o.tokens>=kd)&&s.push({kind:"tool-schema",severity:o.tokens>=Ka?"danger":"watch",title:"Large tool schema",detail:`Tool definitions take ${Math.round(o.percent*100)}% of request context.`});const i=e.find(c=>c.role==="system")??null;i!==null&&i.tokens>=kd&&i.percent>=kI&&s.push({kind:"system-heavy",severity:"watch",title:"Large system prompt",detail:`System instructions take ${Math.round(i.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>=yI&&(a>=wI||l>=_I)&&s.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.`}),s}function XI({risk:e,contextWindow:t,diagnostics:n,duplicateGroups:s}){let i=new Set(n.map(c=>c.kind)).size;(e==="watch"||e==="danger")&&(i+=1),t.source==="unknown"&&(i+=1);const a=n.some(c=>c.severity==="danger");return{level:e==="danger"||a?"risk":i>0?"optimizable":"ok",opportunityCount:i,reclaimableTokens:JI(s)}}function QI({segments:e,inputTokens:t,parsed:n,model:s,providers:o=[]}){const i=e.reduce((T,N)=>T+N.size,0),a=s??AI(n),l=t??i,c=K0(n,CI),u=II(a,n,o),d=c??0,f=u.tokens===null?null:l+d,h=u.tokens===null?null:u.tokens-l,m=u.tokens===null?null:u.tokens-l-d,v=u.tokens===null||f===null?null:zI(f/u.tokens),g=MI(e,i),x=g[0]??null,b=e.filter(T=>T.role!=="tools").length,y=GI(e),k=KI(y),j=YI(g,i,b);k!==null&&j.unshift(k);const C=OI(v);return{model:a,contextWindow:u,estimatedInputTokens:l,outputReserveTokens:c,windowUsedTokens:f,remainingInputTokens:h,remainingAfterReserveTokens:m,usagePercent:v,riskLevel:C,roleUsages:g,largestRole:x,diagnostics:j,duplicateGroups:y,health:XI({risk:C,contextWindow:u,diagnostics:j,duplicateGroups:y})}}const jz={watch:V0,danger:q0},Sd=new WeakMap;function e8(e){return e.map(t=>{const n=t.modelMetadata?.map(s=>`${s.model}:${String(s.contextWindow??"")}`).join(",")??"";return`${t.id}:${t.updatedAt}:${t.models.join(",")}:${n}`}).join("|")}function t8(e){if(e===null)return null;try{return JSON.parse(e)}catch{return null}}function n8(e){return{role:e.role,label:e.label,size:e.tokens,characters:e.tokens*4,text:"",path:`role:${e.role}`}}function s8(e,t){const n=t8(e.rawRequestBody);if(n===null)return null;const o=Ym(rr(e)).anatomySegments(n);if(o===null)return null;const i=QI({segments:o,inputTokens:e.inputTokens??null,parsed:n,model:e.model,providers:t}),a=i.model??e.model??"Unknown model",l=i.roleUsages.map(n8);return{logId:e.id,model:a,timestamp:e.timestamp,contextWindow:i.contextWindow,estimatedInputTokens:i.estimatedInputTokens,windowUsedTokens:i.windowUsedTokens,usagePercent:i.usagePercent,riskLevel:i.riskLevel,health:i.health,diagnostics:i.diagnostics.map(c=>c.title),roleSegments:l,roleTotalTokens:l.reduce((c,u)=>c+u.size,0)}}function r8(e,t,n){const s=Sd.get(e);if(s!==void 0&&s.id===e.id&&s.rawRequestBody===e.rawRequestBody&&s.inputTokens===e.inputTokens&&s.model===e.model&&s.path===e.path&&s.apiFormat===e.apiFormat&&s.timestamp===e.timestamp&&s.providersSignature===n)return s.snapshot;const o=s8(e,t);return Sd.set(e,{id:e.id,rawRequestBody:e.rawRequestBody,inputTokens:e.inputTokens,model:e.model,path:e.path,apiFormat:e.apiFormat,timestamp:e.timestamp,providersSignature:n,snapshot:o}),o}function o8(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 Cd(e){switch(e){case"danger":return 4;case"watch":return 3;case"unknown":return 2;case"ok":return 1}}function i8(e,t){const n=Cd(t.latest.riskLevel)-Cd(e.latest.riskLevel);if(n!==0)return n;const s=e.peak.usagePercent??-1,i=(t.peak.usagePercent??-1)-s;return i!==0?i:t.latest.logId-e.latest.logId}function a8(e,t){return e.usagePercent===null||t.usagePercent===null?null:(t.usagePercent-e.usagePercent)*100}function l8(e){for(let t=1;t<e.length;t++){const n=e[t-1],s=e[t];if(!(n===void 0||s===void 0)&&n.id>s.id)return[...e].sort((o,i)=>o.id-i.id)}return e}function c8(e,t=[]){const n=l8(e),s=e8(t),o=new Map;for(const a of n){const l=r8(a,t,s);if(l===null)continue;const c=o.get(l.model);if(c===void 0){o.set(l.model,{model:l.model,requestCount:1,first:l,latest:l,peak:l});continue}o.set(l.model,{model:c.model,requestCount:c.requestCount+1,first:c.first,latest:l,peak:o8(l,c.peak)?l:c.peak})}return{models:[...o.values()].map(a=>({model:a.model,requestCount:a.requestCount,first:a.first,latest:a.latest,peak:a.peak,trendPercent:a8(a.first,a.latest)})).sort(i8)}}function nn(e){return e.length<=30?e:`${e.slice(0,12)}...${e.slice(-12)}`}function u8(e){const t=new Map;for(const n of e)for(let s=0;s<n.logs.length;s+=1){const o=n.logs[s];o!==void 0&&t.set(o.id,s+1)}return t}function Nd(e,t){return t.get(e.id)??e.id}function d8(e){return e==="full"}function f8(e,t){const n=t>0;return{redacted:n,raw:n&&d8(e)}}function Td(e){let t=0,n=0;for(const s of e)s.inputTokens!==null&&(t+=s.inputTokens),s.outputTokens!==null&&(n+=s.outputTokens);return{totalIn:t,totalOut:n}}function J0(e,t){const n=e[0],s=e[e.length-1];return n===void 0||s===void 0?null:Tl(n.timestamp,s.timestamp,t)}function p8(e){for(const t of e)if(t.userAgent!==null&&t.userAgent!==void 0&&t.userAgent!=="")return t.userAgent;return null}function h8(e){return e.error!==null&&e.error!==void 0&&e.error.length>0?!0:e.responseStatus!==null&&e.responseStatus>=400}function m8(e){const t=new Set;for(const s of e)s.model!==null&&s.model.length>0&&t.add(s.model);const n=[...t].sort();return n.length===0?"Model unknown":n.length===1?n[0]??"Model unknown":`${n.length} models`}function g8(e){const t=new Set;for(const s of e)s.providerName!==null&&s.providerName!==void 0&&s.providerName.length>0&&t.add(s.providerName);const n=[...t].sort();return n.length===0?"Provider unknown":n.length===1?n[0]??"Provider unknown":`${n.length} providers`}function x8(e){if(e<1e3)return`${e}ms`;if(e<6e4){const o=e/1e3;return`${o<10?o.toFixed(1):o.toFixed(0)}s`}const t=Math.round(e/1e3),n=Math.floor(t/60),s=t%60;return`${n}m ${s}s`}function b8(e,t){return`${Fe(e)} in / ${Fe(t)} out`}function v8(e,t){if(e.length===0)return 0;if(t.length===0)return Fa(e).length;let n=0;for(const s of t)n+=Fa(s.logs).length;return n}function y8({stopReason:e,pending:t,lastFailureLogNumber:n}){if(t>0)return{label:"In flight",detail:`${t} request${t===1?"":"s"} pending`,tone:"cool"};if(n!==null&&e===null)return{label:"Error",detail:`Last failed request #${n}`,tone:"danger"};switch(e){case"end_turn":return{label:"End turn",detail:"Assistant completed the turn",tone:"neutral"};case"stop":return{label:"Stop",detail:"Model reached a stop condition",tone:"neutral"};case"length":return{label:"Output limit",detail:"Turn ended at max output tokens",tone:"watch"};case"tool_use":return{label:"Tool call",detail:"Assistant requested a tool",tone:"cool"};case null:return{label:"Unknown",detail:"No finish reason captured",tone:"neutral"}}}function w8(e){if(e===null)return!1;const t=e.toLowerCase();return t.includes("abort")||t.includes("cancel")||t.includes("client disconnected")||t.includes("stream disconnected")||t.includes("connection closed")}function _8({pending:e,failures:t,lengthStops:n,stopReason:s,lastFailure:o}){if(o!==null&&(o.status===499||w8(o.error)))return{label:"Client aborted",detail:`Request #${o.logNumber} ended before completion`,tone:"watch"};if(e>0)return{label:"In flight",detail:`${e} request${e===1?"":"s"} still running`,tone:"cool"};if(o!==null&&o.status!==null&&o.status>=500)return{label:"Provider error",detail:`Request #${o.logNumber} returned HTTP ${o.status}`,tone:"danger"};if(t>0&&o!==null)return{label:"Failed",detail:`Request #${o.logNumber} needs attention`,tone:"danger"};if(n>0||s==="length")return{label:"Output limited",detail:"Model stopped at the output token limit",tone:"watch"};switch(s){case"end_turn":case"stop":return{label:"Completed",detail:"Assistant completed normally",tone:"neutral"};case"tool_use":return{label:"Tool requested",detail:"Assistant handed off to a tool",tone:"cool"};case null:return{label:"Unknown",detail:"No terminal signal captured",tone:"neutral"}}}function k8({logs:e,conversationGroups:t,isLoading:n,timeDisplayFormat:s,slowResponseThresholdSeconds:o}){let i=0,a=0,l=0,c=0,u=0,d=0,f=null,h=null,m=null,v=null,g=null,x=0,b=0,y=0,k=null;const j=o*1e3;for(let A=0;A<e.length;A+=1){const z=e[A];if(z===void 0)continue;const D=A+1,E=sp(z);E!==null&&(f=E),E==="length"&&(c+=1),h8(z)&&(i+=1,h=D,m={logNumber:D,status:z.responseStatus,error:z.error??null}),z.responseStatus===null&&(a+=1),o>0&&z.elapsedMs!==null&&z.elapsedMs>=j&&(l+=1),z.inputTokens!==null&&(u+=z.inputTokens),z.outputTokens!==null&&(d+=z.outputTokens),z.elapsedMs!==null&&(v===null||z.elapsedMs>v)&&(v=z.elapsedMs,g=D);const L=z.inputTokens??0,w=z.outputTokens??0,$=L+w;$>x&&(x=$,b=L,y=w,k=D)}const C=n||a>0&&i===0?"rolling":i>0?"failed":l>0||c>0?"watch":"clear",T=C==="rolling"?"Rolling":C==="failed"?"Failure":C==="watch"?"Watch":"Clear",N=y8({stopReason:f,pending:a,lastFailureLogNumber:h}),O=_8({pending:a,failures:i,lengthStops:c,stopReason:f,lastFailure:m});return{status:C,statusLabel:T,modelLabel:m8(e),providerLabel:g8(e),requests:e.length,turns:v8(e,t),failures:i,pending:a,slow:l,lengthStops:c,timeRange:J0(e,s),tokenLabel:`${Fe(u)} in / ${Fe(d)} out`,finishLabel:N.label,finishDetail:N.detail,finishTone:N.tone,outcomeLabel:O.label,outcomeDetail:O.detail,outcomeTone:O.tone,slowestLabel:v===null?"n/a":x8(v),slowestDetail:g===null?"Latency pending":`Request #${g}`,heaviestDetail:k===null?"Tokens pending":`#${k} ${b8(b,y)}`}}function j8(e){switch(e){case"cool":return"text-cyan-100";case"danger":return"text-red-100";case"watch":return"text-amber-100";case"neutral":return"text-foreground"}}function S8(e){switch(e){case"rolling":return"cool";case"failed":return"danger";case"watch":return"watch";case"clear":return"neutral"}}function C8(e){return e.pending>0?`${e.pending} pending / ${e.failures} failed`:e.lengthStops>0?`${e.lengthStops} output limit / ${e.failures} failed`:`${e.failures} failed / ${e.slow} slow`}function cs({label:e,value:t,detail:n,icon:s,tone:o="neutral"}){return r.jsxs("div",{className:"min-w-0 border-t border-white/10 px-4 py-3",children:[r.jsxs("div",{className:"flex items-center gap-1 text-[10px] uppercase text-muted-foreground",children:[s,e]}),r.jsx("div",{className:ie("mt-2 font-mono text-sm font-semibold",j8(o)),children:t}),r.jsx("div",{className:"mt-1 font-mono text-[11px] leading-snug text-muted-foreground",children:n})]})}function N8({stats:e}){return e.requests===0?null:r.jsxs("div",{className:"border border-border bg-card shadow-sm mb-4 overflow-hidden rounded-[8px]",children:[r.jsx("div",{className:"px-4 py-3",children:r.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-semibold uppercase text-muted-foreground",children:[r.jsx(My,{className:"size-3.5 text-slate-300"}),"Flight Recorder"]}),r.jsx("div",{className:"mt-2 min-w-0 font-mono text-sm font-semibold text-foreground",children:e.modelLabel})]}),r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-4 gap-y-1 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"min-w-0 font-mono",children:e.providerLabel}),r.jsx("span",{className:"min-w-0 font-mono",children:e.timeRange??"Timeline pending"})]})]})}),r.jsxs("div",{className:"grid grid-cols-2 border-t border-white/10 md:grid-cols-3 2xl:grid-cols-6",children:[r.jsx(cs,{label:"Status",value:e.statusLabel,detail:C8(e),tone:S8(e.status)}),r.jsx(cs,{label:"Turns",value:String(e.turns),detail:e.finishLabel,icon:r.jsx(fw,{className:"size-3 text-muted-foreground"}),tone:e.finishTone}),r.jsx(cs,{label:"Requests",value:String(e.requests),detail:`${e.failures} failed / ${e.slow} slow`,icon:r.jsx(fa,{className:"size-3 text-muted-foreground"}),tone:e.failures>0?"danger":"neutral"}),r.jsx(cs,{label:"Peak",value:e.slowestLabel,detail:e.slowestDetail,icon:r.jsx(m_,{className:"size-3 text-muted-foreground"}),tone:e.slow>0?"watch":"neutral"}),r.jsx(cs,{label:"Tokens",value:e.tokenLabel,detail:e.heaviestDetail,icon:r.jsx(Nl,{className:"size-3 text-muted-foreground"})}),r.jsx(cs,{label:"Outcome",value:e.outcomeLabel,detail:e.outcomeDetail,tone:e.outcomeTone})]})]})}function T8({pinnedSessionId:e,selectedSession:t,sessions:n,logs:s}){if(e!==void 0){const a=s.filter(l=>l.sessionId===e);return a.length===0?null:{label:e,logs:a,showBackLink:!0}}if(t!=="__all__"){const a=s.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&&s.every(l=>l.sessionId===o)?{label:o,logs:[...s],showBackLink:!1}:n.length===0&&s.length>0&&s.every(a=>a.sessionId===null)?{label:"Visible requests",logs:[...s],showBackLink:!1}:null}function Js(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 E8(e){return e===null?"n/a":Math.abs(e)<.1?"0%":`${e>0?"+":""}${e.toFixed(1)}%`}function Xa(e){return e===null||!Number.isFinite(e)?0:Math.min(Math.max(e*100,0),100)}function A8(e,t){if(t===null)return null;const n=Xa(e),s=Xa(t);return s<=0||Math.abs(s-n)<.5?null:s}function R8(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-cyan-300"}}function I8(e){const t=e.latest.contextWindow.tokens;return t===null?"Context window unknown":`Context window ${bp(t)}`}const z8=["score","decision","final_status","validation_pass_ratio","semantic_memory_score","opencode_exit","actual_model","run_dir","workspace","project_dir","work_dir"];function Y0(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 sa(e,t){if(e===null)return null;const n=e.metadata[t];return n===void 0?null:Y0(n)}function O8(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-cyan-300/25 bg-cyan-400/10 text-cyan-100":"border-border/70 bg-background/70 text-muted-foreground"}function P8(e){const t=[];for(const n of z8){const s=e.metadata[n];if(s===void 0)continue;const o=Y0(s);o!==null&&t.push({key:n,value:o})}return t}function Ed({memberships:e,defaultOpen:t=!1}){const[n,s]=p.useState(t);if(e.length===0)return null;const o=e[0],i=o?.member??null,a=sa(i,"score"),l=sa(i,"decision"),c=sa(i,"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},i?.model===null||i?.model===void 0?null:{label:i.model,value:i.model}].filter(d=>d!==null&&d.label.length>0&&d.value.length>0);return r.jsxs("div",{className:"border border-border bg-card shadow-sm mb-3 rounded-[8px] text-xs",children:[r.jsxs("button",{type:"button",onClick:()=>s(d=>!d),className:"flex w-full items-center gap-3 px-3 py-2 text-left transition-colors hover:bg-white/[0.04]","aria-expanded":n,children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[r.jsx("span",{className:"font-semibold text-foreground",children:"Case File"}),o!==void 0&&r.jsx("span",{className:"truncate text-muted-foreground",title:o.groupTitle,children:o.groupTitle}),r.jsxs("span",{className:"font-mono text-[10px] uppercase text-muted-foreground",children:[e.length," group",e.length===1?"":"s"]})]}),u.length>0&&r.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=>r.jsx("span",{className:ie("rounded border px-1.5 py-0.5 font-mono text-[10px]",O8(d.value)),children:d.label},d.label))})]}),n?r.jsx(_l,{className:"size-4 shrink-0 text-muted-foreground"}):r.jsx(ot,{className:"size-4 shrink-0 text-muted-foreground"})]}),n&&r.jsx("div",{className:"space-y-2 border-t border-white/10 px-3 py-2",children:e.map(d=>{const f=d.member,h=P8(f);return r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[r.jsx("span",{className:"truncate font-medium text-foreground",title:d.groupTitle,children:d.groupTitle}),r.jsx("span",{className:"font-mono text-[10px] uppercase text-muted-foreground",children:d.groupStatus}),f.status!==null&&r.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:["member ",f.status]})]}),r.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground",children:[r.jsx("span",{className:"font-mono",title:f.sessionId,children:nn(f.sessionId)}),f.label!==null&&r.jsx("span",{children:f.label}),f.provider!==null&&r.jsx("span",{children:f.provider}),f.model!==null&&r.jsx("span",{className:"font-mono",children:f.model}),f.runId!==null&&r.jsxs("span",{className:"font-mono",title:f.runId,children:["run ",nn(f.runId)]})]}),h.length>0&&r.jsx("div",{className:"mt-2 grid gap-1 sm:grid-cols-2 xl:grid-cols-3",children:h.map(m=>r.jsxs("div",{className:"border border-border bg-muted/40 min-w-0 rounded-md px-2 py-1",children:[r.jsx("div",{className:"font-mono text-[10px] text-muted-foreground",children:m.key}),r.jsx("div",{className:"truncate font-mono text-[11px] text-foreground",title:m.value,children:m.value})]},m.key))})]},`${d.groupId}:${f.id}`)})})]})}function M8({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],s=e[e.length-1],o=n===void 0||s===void 0?"Current page":`#${n.id}-#${s.id}`;return t.total===null?`Showing ${e.length} logs (${o})`:t.total<=e.length?`Showing all ${t.total} logs`:`Showing ${e.length} of ${t.total} logs (${o})`}function Gr({label:e,title:t,icon:n,disabled:s,onClick:o}){return r.jsxs("button",{type:"button",onClick:o,disabled:s,className:"border border-input bg-background hover:bg-accent hover:text-accent-foreground inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs text-muted-foreground transition-colors hover:text-foreground disabled:cursor-not-allowed disabled:opacity-45",title:t,children:[n,r.jsx("span",{children:e})]})}function L8(e){return`${Math.max(0,Math.ceil(e/1e3)).toString()}s`}function ro({progress:e}){const t=Math.min(1,e.elapsedMs/e.timeoutMs),n=Math.max(4,Math.round(t*100)),s=Math.max(0,e.timeoutMs-e.elapsedMs),o=t>=.75,i=[e.loadedLogs>0?`${e.loadedLogs.toString()} logs`:null,e.loadedPages>0?`${e.loadedPages.toString()} page${e.loadedPages===1?"":"s"}`:null,`${L8(s)} before timeout`].filter(a=>a!==null);return r.jsxs("div",{className:"min-w-0 space-y-1 px-1 pb-1",children:[r.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3 font-mono text-[10px] text-muted-foreground",children:[r.jsx("span",{className:"min-w-0 truncate",children:e.label}),r.jsx("span",{className:ie("shrink-0 tabular-nums",o&&"text-amber-300"),children:i.join(" / ")})]}),r.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-white/[0.06]",children:r.jsx("div",{className:ie("h-full rounded-full transition-all duration-300",o?"bg-amber-300/80":"bg-cyan-300/70"),style:{width:`${n.toString()}%`}})})]})}function Ad({logs:e,pagination:t,embedded:n=!1}){if(t===void 0)return null;const s=t.isLoading;return r.jsxs("div",{className:ie("flex min-h-9 flex-col gap-2 px-1 py-1 sm:flex-row sm:items-center",n?"border-t border-white/10 pt-2":"border border-border bg-card shadow-sm mb-3 rounded-[8px] px-2"),children:[r.jsxs("div",{className:"w-full min-w-0 px-1 font-mono text-[11px] text-muted-foreground sm:flex-1",children:[M8({logs:e,pagination:t}),t.isLoading&&e.length>0&&r.jsx("span",{className:"ml-2",children:"Loading..."}),t.loadProgress!==void 0&&r.jsx(ro,{progress:t.loadProgress})]}),r.jsxs("div",{className:"flex w-full items-center gap-1 overflow-x-auto sm:w-auto",children:[r.jsx(Gr,{label:"Oldest",title:"Load the oldest logs in this session",icon:r.jsx(jy,{className:"size-3.5"}),disabled:s||!t.hasOlder,onClick:t.onOldest}),r.jsx(Gr,{label:"Older",title:"Load older logs",icon:r.jsx(by,{className:"size-3.5"}),disabled:s||!t.hasOlder,onClick:t.onOlder}),r.jsx(Gr,{label:"Newer",title:"Load newer logs",icon:r.jsx(Tt,{className:"size-3.5"}),disabled:s||!t.hasNewer,onClick:t.onNewer}),r.jsx(Gr,{label:"Newest",title:"Load the newest logs in this session",icon:r.jsx(Cy,{className:"size-3.5"}),disabled:s||!t.hasNewer,onClick:t.onNewest})]})]})}function D8(e){return`${e} ${e===1?"request":"requests"}`}function Rd(e){return`#${String(e)}`}function Id(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-cyan-200"}}function $8(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-cyan-300/25 bg-cyan-400/8 text-cyan-100"}}function F8(e){switch(e){case"risk":return"Risk";case"optimizable":return"Optimizable";case"ok":return"OK"}}const B8=10,U8=80;function W8(e){e.setAttribute("data-deep-link-highlight","true"),window.setTimeout(()=>{e.removeAttribute("data-deep-link-highlight")},1800)}function H8(e){const t=document.getElementById(`log-${String(e)}`);return t instanceof HTMLElement?(t.scrollIntoView({block:"center",behavior:"smooth"}),t.focus({preventScroll:!0}),W8(t),!0):!1}function X0(e){ir({logId:e,tab:"anatomy"});let t=0;const n=()=>{ir({logId:e,tab:"anatomy"}),!H8(e)&&(t+=1,t<B8&&window.setTimeout(n,U8))};window.setTimeout(n,0)}function zd({command:e}){const[t,n]=p.useState(!1),s=p.useCallback(()=>{Nt(e).then(o=>{o&&(n(!0),setTimeout(()=>n(!1),2e3))})},[e]);return r.jsxs("div",{className:"bg-black/20 inline-flex max-w-full items-center gap-2 rounded-md px-3 py-2 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]",children:[r.jsx("pre",{className:"m-0 overflow-x-auto font-mono text-sm text-cyan-200",children:e}),r.jsx("button",{type:"button",onClick:s,className:"shrink-0 cursor-pointer text-muted-foreground transition-colors hover:text-foreground","aria-label":"Copy command",children:t?r.jsx(Ge,{className:"size-4"}):r.jsx(At,{className:"size-4"})})]})}function ra({label:e,children:t,className:n}){return r.jsxs("section",{className:ie("bg-white/[0.028] shadow-[inset_0_1px_0_rgba(255,255,255,0.035)] rounded-[8px]",n),children:[r.jsx("div",{className:"px-3 pt-3",children:r.jsx("div",{className:"font-mono text-[10px] font-semibold uppercase tracking-[0.14em] text-white/35",children:e})}),r.jsx("div",{className:"p-3 pt-2",children:t})]})}function Kr({label:e,value:t}){return r.jsxs("div",{className:"bg-black/20 min-w-0 rounded-md px-2 py-2 shadow-[inset_0_1px_0_rgba(255,255,255,0.035)]",children:[r.jsx("div",{className:"truncate font-mono text-lg font-semibold leading-6 text-slate-100",children:t}),r.jsx("div",{className:"mt-0.5 truncate font-mono text-[10px] uppercase tracking-[0.12em] text-white/35",children:e})]})}const V8=["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 Od({compact:e,entrancePhase:t}){return e?r.jsx(Ua,{className:"size-14 text-amber-500"}):r.jsxs("span",{className:"flex shrink-0 items-end gap-1 group cursor-default","aria-hidden":"true",children:[r.jsx(Ua,{className:"size-10 text-amber-500 transition-all duration-300 group-hover:scale-125 group-hover:-translate-y-1.5"}),r.jsx("span",{className:"hidden items-end gap-0.5 sm:flex",children:ar.map((n,s)=>{const o=V8[s]??"text-amber-500",i=t==="hidden"?"opacity-0 scale-0":t==="playing"?"animate-crab-piano-pop":"";return r.jsx(n,{className:`size-5 ${o} transition-all duration-300 ease-out group-hover:scale-125 group-hover:-translate-y-1 ${i}`,style:{transitionDelay:`${s*50}ms`,...t==="playing"?{animationDelay:`${s*400}ms`}:{}}},s)})})]})}function q8({compact:e,crabEntrancePhase:t,currentSessionId:n,logCount:s}){return e?r.jsx("div",{className:"bg-white/[0.035] shadow-[inset_0_1px_0_rgba(255,255,255,0.045),0_16px_44px_rgba(0,0,0,0.18)] rounded-[8px] p-3",children:r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex min-w-fit items-start gap-3",children:[r.jsx(Od,{compact:!0,entrancePhase:t}),r.jsxs("div",{className:"min-w-fit",children:[r.jsxs("div",{className:"flex min-w-fit flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[r.jsx("span",{className:"whitespace-nowrap text-base font-bold",children:"Agent Inspector"}),r.jsxs("span",{className:"hidden shrink-0 font-mono text-[11px] font-semibold text-muted-foreground sm:inline",children:["v",ha.version]})]}),r.jsx("div",{className:"hidden text-[11px] font-semibold text-muted-foreground sm:block",children:"Local First. Evidence First."})]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[r.jsx(qu,{}),r.jsx(Gu,{}),r.jsx(md,{currentSessionId:n,logCount:s}),r.jsx(hd,{})]})]})}):r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-x-4 gap-y-3 pb-6",children:[r.jsx("div",{className:"min-w-10 flex-1","aria-hidden":"true"}),r.jsxs("h1",{className:"flex min-w-fit flex-col items-center gap-2 text-center",children:[r.jsxs("span",{className:"flex max-w-full flex-wrap items-end justify-center gap-x-2 gap-y-1",children:[r.jsx(Od,{compact:!1,entrancePhase:t}),r.jsxs("span",{className:"flex min-w-fit flex-wrap items-baseline justify-center gap-x-2 gap-y-0.5 pl-1",children:[r.jsx("span",{className:"whitespace-nowrap text-lg font-bold",children:"Agent Inspector"}),r.jsxs("span",{className:"shrink-0 font-mono text-xs font-semibold text-muted-foreground",children:["v",ha.version]})]}),r.jsx(da,{className:"size-4 shrink-0 text-muted-foreground/70","aria-hidden":"true"}),r.jsx(lA,{className:"size-10 shrink-0"})]}),r.jsx("span",{className:"max-w-full text-sm font-semibold text-muted-foreground",children:"Local First. Evidence First."})]}),r.jsxs("div",{className:"flex flex-1 justify-end gap-1",children:[r.jsx(qu,{}),r.jsx(Gu,{}),r.jsx(md,{currentSessionId:n,logCount:s}),r.jsx(hd,{})]})]})}const Jt=56,Ne=14,Z8=5200,G8=2400,Pd=72,K8=156,Q0="agent-inspector.detailsPanelCollapsed";function J8(){if(typeof window>"u")return!0;const e=window.localStorage.getItem(Q0);return e===null||e==="1"}function gc(e){const t=Math.max(Ne,window.innerWidth-Jt-Ne),n=Math.max(Ne,window.innerHeight-Jt-Ne);return{x:Math.min(Math.max(e.x,Ne),t),y:Math.min(Math.max(e.y,Ne),n)}}function Qa(e){const t=gc(e),n=Math.max(Ne,window.innerWidth-Jt-Ne),s=Math.max(Ne,window.innerHeight-Jt-Ne),o=t.x-Ne,i=n-t.x,a=t.y-Ne,l=s-t.y,c=Math.min(o,i,a,l);return c===o?{x:Ne,y:t.y}:c===i?{x:n,y:t.y}:c===a?{x:t.x,y:Ne}:{x:t.x,y:s}}function Y8(){const e=Math.max(Ne,window.innerWidth-Jt-Ne),t=Math.max(Ne,window.innerHeight-Jt-Ne),n=Ne+Math.random()*(e-Ne),s=Ne+Math.random()*(t-Ne);switch(Math.floor(Math.random()*4)){case 0:return{x:Ne,y:s};case 1:return{x:e,y:s};case 2:return{x:n,y:Ne};case 3:return{x:n,y:t};default:return{x:e,y:Ne}}}function X8(e){const t=gc(e),n=Math.max(Ne,window.innerWidth-Jt-Ne),s=Math.max(Ne,window.innerHeight-Jt-Ne);return[{edge:"left",distance:t.x-Ne},{edge:"right",distance:n-t.x},{edge:"top",distance:t.y-Ne},{edge:"bottom",distance:s-t.y}].reduce((i,a)=>a.distance<i.distance?a:i).edge}function Q8(e){const t=Qa(e),n=Math.max(Ne,window.innerWidth-Jt-Ne),s=Math.max(Ne,window.innerHeight-Jt-Ne),o=Pd+Math.random()*(K8-Pd),i=Math.random()>.5?1:-1;switch(X8(t)){case"left":{const l=t.y+o*i;return l<=Ne?{x:Ne,y:Ne}:l>=s?{x:Ne,y:s}:{x:Ne,y:l}}case"right":{const l=t.y+o*i;return l<=Ne?{x:n,y:Ne}:l>=s?{x:n,y:s}:{x:n,y:l}}case"top":{const l=t.x+o*i;return l<=Ne?{x:Ne,y:Ne}:l>=n?{x:n,y:Ne}:{x:l,y:Ne}}case"bottom":{const l=t.x+o*i;return l<=Ne?{x:Ne,y:s}:l>=n?{x:n,y:s}:{x:l,y:s}}}}function ez(){const[e,t]=p.useState({x:Ne,y:Ne}),[n,s]=p.useState(0),[o,i]=p.useState(!1),a=p.useRef(null);p.useEffect(()=>{t(Y8())},[]),p.useEffect(()=>{if(o)return;let f=null;const h=()=>{const m=Z8+Math.random()*G8;f=window.setTimeout(()=>{s(v=>v+1),t(v=>Q8(v)),h()},m)};return h(),()=>{f!==null&&window.clearTimeout(f)}},[o]),p.useEffect(()=>{const f=()=>{t(h=>Qa(h))};return window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[]);const l=p.useCallback(f=>{const h=f.currentTarget.getBoundingClientRect();a.current={pointerId:f.pointerId,offsetX:f.clientX-h.left,offsetY:f.clientY-h.top},f.currentTarget.setPointerCapture(f.pointerId),i(!0)},[]),c=p.useCallback(f=>{const h=a.current;h===null||h.pointerId!==f.pointerId||t(gc({x:f.clientX-h.offsetX,y:f.clientY-h.offsetY}))},[]),u=p.useCallback(f=>{const h=a.current;h===null||h.pointerId!==f.pointerId||(f.currentTarget.hasPointerCapture(f.pointerId)&&f.currentTarget.releasePointerCapture(f.pointerId),a.current=null,i(!1),t(m=>Qa(m)))},[]),d=p.useMemo(()=>({transform:`translate3d(${e.x}px, ${e.y}px, 0) rotate(${n%2===0?"-4deg":"5deg"}) scale(${o?"1.08":"1"})`,transition:o?"none":"transform 4800ms cubic-bezier(0.33, 1, 0.68, 1)",touchAction:"none"}),[o,n,e.x,e.y]);return r.jsx("button",{type:"button",className:ie("fixed left-0 top-0 z-40 flex size-14 items-center justify-center rounded-full bg-transparent text-foreground outline-none transition-[filter,opacity] duration-200 hover:opacity-95 hover:drop-shadow-[0_0_24px_rgba(245,158,11,0.36)] focus-visible:ring-1 focus-visible:ring-amber-300/55",o?"cursor-grabbing":"cursor-grab"),style:d,onPointerDown:l,onPointerMove:c,onPointerUp:u,onPointerCancel:u,"aria-label":"Floating Inspector logo",title:"Drag Inspector logo",children:r.jsxs("span",{className:ie("relative flex size-12 items-center justify-center",!o&&"floating-crab-body"),"aria-hidden":"true",children:[r.jsx(Ua,{className:"relative z-10 size-11 text-amber-500 drop-shadow-[0_0_15px_rgba(245,158,11,0.30)]"}),r.jsx("span",{className:"pointer-events-none absolute inset-x-0 bottom-0 z-0 flex items-end justify-center gap-1 text-amber-400/80",children:[0,1,2,3,4,5].map(f=>r.jsx("span",{className:ie("floating-crab-leg h-2 w-0.5 rounded-full bg-current shadow-[0_0_7px_rgba(245,158,11,0.24)]",f<3?"floating-crab-leg-left":"floating-crab-leg-right",o&&"animate-none"),style:{animationDelay:`${f%2===0?0:180}ms`}},f))})]})})}function Md({label:e,logId:t}){return r.jsxs("button",{type:"button",onClick:()=>X0(t),className:"inline-flex h-5 items-center rounded px-1 font-mono text-[10px] text-muted-foreground transition-colors hover:bg-white/[0.06] hover:text-foreground",title:`Open Context for ${Rd(t)}`,children:[e," ",Rd(t)]})}function tz({latestPercent:e,peakPercent:t,risk:n,onOpenContext:s}){const o=Xa(e),i=A8(e,t),a=t===null?`Latest context window usage ${Js(e)}`:`Latest context window usage ${Js(e)}, peak ${Js(t)}`;return r.jsx("button",{type:"button",onClick:s,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:r.jsxs("span",{className:"relative block h-2.5 overflow-hidden rounded-full border border-white/10 bg-black/25 transition-colors group-hover:border-cyan-200/35",role:"meter","aria-label":a,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(o),children:[r.jsx("span",{className:ie("block h-full rounded-full transition-[width]",R8(n)),style:{width:`${o}%`}}),i!==null&&r.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(${i}% - 0.5px)`},"aria-hidden":"true"})]})})}function nz({summary:e}){const t=e.trendPercent,n=t===null||Math.abs(t)<.1?null:t>0?iy:ey,s=e.latest.diagnostics[0]??null,o=Js(e.latest.usagePercent),i=Js(e.peak.usagePercent),a=()=>{X0(e.latest.logId)};return r.jsxs("div",{className:"grid gap-x-4 gap-y-2 border-t border-white/10 py-2 first:border-t-0 lg:grid-cols-[minmax(180px,1fr)_minmax(260px,1fr)_minmax(260px,1.4fr)]",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.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}),r.jsx("span",{className:ie("inline-flex h-5 shrink-0 items-center rounded border px-1.5 font-mono text-[10px]",$8(e.latest.health.level)),children:F8(e.latest.health.level)})]}),r.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:[r.jsx("span",{children:D8(e.requestCount)}),r.jsx("span",{children:I8(e)})]})]}),r.jsxs("div",{className:"min-w-0 space-y-2 text-xs",children:[r.jsx(tz,{latestPercent:e.latest.usagePercent,peakPercent:e.peak.usagePercent,risk:e.latest.riskLevel,onOpenContext:a}),r.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Latest"}),r.jsx("div",{className:ie("mt-0.5 font-mono",Id(e.latest.riskLevel)),children:o}),r.jsx(Md,{label:"Log",logId:e.latest.logId})]}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Peak"}),r.jsx("div",{className:ie("mt-0.5 font-mono",Id(e.peak.riskLevel)),children:i}),r.jsx(Md,{label:"Log",logId:e.peak.logId})]}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Trend"}),r.jsxs("div",{className:"mt-0.5 flex items-center gap-1 font-mono text-foreground",children:[n!==null&&r.jsx(n,{className:ie("size-3",t!==null&&t>0?"text-amber-300":"text-cyan-300")}),E8(t)]}),r.jsx("div",{className:"h-5","aria-hidden":"true"})]})]})]}),r.jsxs("div",{className:"min-w-0 space-y-1.5",children:[r.jsx(gI,{segments:e.latest.roleSegments,totalTokens:e.latest.roleTotalTokens,showLabels:!1}),r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground",children:[r.jsxs("span",{className:"font-mono",children:["~",Fe(e.latest.estimatedInputTokens)," input"]}),e.latest.windowUsedTokens!==null&&r.jsxs("span",{className:"font-mono",children:["~",Fe(e.latest.windowUsedTokens)," used"]}),s!==null&&r.jsx("span",{className:"truncate",children:s})]})]})]})}function sz({summary:e}){return e.models.length===0?null:r.jsxs("div",{className:"mt-3 border-t border-white/10 pt-2",children:[r.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-normal text-muted-foreground",children:"Session Context"}),r.jsxs("div",{className:"font-mono text-[10px] text-muted-foreground",children:[e.models.length," model",e.models.length===1?"":"s"]})]}),r.jsx("div",{className:"max-h-52 overflow-y-auto pr-1",children:e.models.map(t=>r.jsx(nz,{summary:t},t.model))})]})}function rz(e){const t=e.models.filter(s=>s.latest.health.level==="risk").length;if(t>0)return`${t} risk`;const n=e.models.filter(s=>s.latest.health.level==="optimizable").length;return n>0?`${n} optimizable`:`${e.models.length} model${e.models.length===1?"":"s"}`}function oz({label:e,logs:t,totalIn:n,totalOut:s,timeDisplayFormat:o,contextSummary:i,showBackLink:a}){const[l,c]=p.useState(!1),[u,d]=p.useState(!1),f=p.useMemo(()=>J0(t,o),[t,o]),h=p.useMemo(()=>p8(t),[t]),m=p.useMemo(()=>rz(i),[i]),v=p.useCallback(()=>{Nt(window.location.href).then(g=>{g&&(c(!0),setTimeout(()=>c(!1),2e3))})},[]);return r.jsxs("div",{className:"border border-border bg-card shadow-sm mb-3 rounded-[8px] px-3 py-2 text-xs",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a&&r.jsx("a",{href:"/",className:"bg-white/[0.035] hover:bg-white/[0.065] inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:text-foreground","aria-label":"Back to all sessions",title:"Back to all sessions",children:r.jsx(ry,{className:"size-3.5"})}),r.jsxs("div",{className:"min-w-[180px] flex-1",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:"font-mono font-semibold text-purple-400/90 truncate",title:e,children:nn(e)}),h!==null&&r.jsx("span",{className:"font-mono text-muted-foreground truncate max-w-[220px]",title:h,children:h})]}),r.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground",children:[r.jsxs("span",{children:[t.length," request",t.length!==1?"s":""]}),f!==null&&r.jsx("span",{children:f}),(n>0||s>0)&&r.jsxs("span",{className:"font-mono",children:[Fe(n)," in / ",Fe(s)," out"]})]})]}),i.models.length>0&&r.jsxs("button",{type:"button",onClick:()=>d(g=>!g),className:"bg-white/[0.035] hover:bg-white/[0.065] inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md px-2.5 font-mono text-[11px] text-muted-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:text-foreground","aria-expanded":u,title:u?"Hide context details":"Show context details",children:[r.jsx("span",{children:m}),u?r.jsx(_l,{className:"size-3.5"}):r.jsx(ot,{className:"size-3.5"})]}),r.jsx("button",{type:"button",onClick:v,className:"bg-white/[0.035] hover:bg-white/[0.065] inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:text-foreground","aria-label":l?"Copied session link":"Copy session link",title:l?"Copied session link":"Copy session link",children:l?r.jsx(Ge,{className:"size-3.5"}):r.jsx(At,{className:"size-3.5"})})]}),u&&r.jsx(sz,{summary:i})]})}function iz({logs:e,sessions:t,models:n,selectedSession:s,selectedModel:o,onSessionChange:i,onModelChange:a,onClearAll:l,onDeleteCurrentView:c,onReloadSession:u,onClearGroup:d,onNotify:f,onImportLogs:h,viewMode:m,captureMode:v,strip:g,slowResponseThresholdSeconds:x,timeDisplayFormat:b,isLoading:y=!1,pagination:k,sessionLoadProgress:j,sessionMemberships:C=[],hideSessionFilter:T=!1,pinnedSessionId:N}){const{totalIn:O,totalOut:A}=p.useMemo(()=>Td(e),[e]),{providers:z}=vp(),[D,E]=p.useState(null),[L,w]=p.useState(null),[$,ee]=p.useState(!1),[F,W]=p.useState(null),[Z,ue]=p.useState(null),[V,H]=p.useState(!1),[le,U]=p.useState(!1),[X,Ce]=p.useState(!0),[ae,ge]=p.useState(!1),[xe,he]=p.useState(null),[be,Se]=p.useState("hidden"),Ie=p.useRef(null),_=p.useRef(null),Q=p.useRef(null),G=p.useRef(null),P=p.useRef(0);uI(Ie,_,{pageWide:!0});const R=p.useCallback(()=>{P.current+=1,G.current?.abort(),G.current=null,E(null),w(null)},[]);p.useEffect(()=>()=>{P.current+=1,G.current?.abort(),G.current=null},[]),p.useEffect(()=>{const bt=50+ar.length*400,Ot=setTimeout(()=>Se("playing"),50),br=setTimeout(()=>Se("done"),bt);return()=>{clearTimeout(Ot),clearTimeout(br)}},[]),p.useEffect(()=>{Ce(J8()),ge(!0)},[]),p.useEffect(()=>{ae&&window.localStorage.setItem(Q0,X?"1":"0")},[X,ae]),p.useEffect(()=>{if(N===void 0){document.title="Agent Inspector";return}const Ue=e.length===1?"1 req":`${e.length} req`;document.title=`${nn(N)} - ${Ue} - Agent Inspector`},[e.length,N]);const B=p.useCallback(async Ue=>{G.current?.abort();const at=new AbortController;G.current=at;const bt=P.current+1;P.current=bt,E(Ue),w(null);try{const Ot=await q_(e,Ue,{signal:at.signal});if(P.current!==bt)return;if(!Ot.ok){if(Ot.canceled===!0)return;f!==void 0?f({message:Ot.message,tone:"error"}):w(Ot.message)}}finally{P.current===bt&&(G.current=null,E(null))}},[e,f]),se=p.useCallback(()=>{Q.current?.click()},[]),ne=p.useCallback(Ue=>{const at=Ue.currentTarget.files?.[0];Ue.currentTarget.value="",!(at===void 0||h===void 0)&&(ee(!0),ue(null),W(null),h(at).then(bt=>{const Ot=bt.skipped>0?`, skipped ${String(bt.skipped)}`:"",br=`Imported ${String(bt.imported)} logs as ${bt.sessionId}${Ot}.`;f!==void 0?f({message:br,tone:"success"}):W(br)}).catch(bt=>{const Ot=bt instanceof Error?bt.message:"Failed to import logs";f!==void 0?f({message:Ot,tone:"error"}):ue(Ot)}).finally(()=>{ee(!1)}))},[h,f]);p.useEffect(()=>{R(),he(null)},[R,s,o]);const q=p.useCallback(()=>{R(),W(null),ue(null),he(null),l()},[R,l]),ce=p.useCallback(()=>{H(!0)},[]),I=p.useCallback(()=>{R(),W(null),ue(null),he(null),c!==void 0&&(U(!0),c().then(()=>{H(!1)}).catch(Ue=>{const at=Ue instanceof Error?Ue.message:"Failed to delete stored logs";f!==void 0?f({message:at,tone:"error"}):ue(at)}).finally(()=>{U(!1)}))},[R,c,f]),M=p.useCallback(()=>{u!==void 0&&(R(),W(null),ue(null),he(null),u())},[R,u]),Y=p.useCallback(()=>{he(null)},[]),re=p.useCallback(()=>{Ce(Ue=>!Ue)},[]),oe=p.useMemo(()=>y4(e),[e]),ve=p.useMemo(()=>u8(oe),[oe]),pe=p.useMemo(()=>T8({pinnedSessionId:N,selectedSession:s,sessions:t,logs:e}),[e,N,s,t]),me=pe?.logs??[],Ae=pe!==null&&me.length>0,{totalIn:$e,totalOut:Bt}=p.useMemo(()=>Td(me),[me]),Rn=p.useMemo(()=>c8(me,z),[me,z]),gt=p.useMemo(()=>ZR(oe),[oe]),it=p.useMemo(()=>mE(oe),[oe]),en=f8(v,e.length),Ms=N!==void 0,Be=e.length>0,jt=c!==void 0&&(e.length>0||s!=="__all__"),et=s==="__all__"?"all sessions":"this session",Ut=s==="__all__"?"Deletes every stored log, streaming chunk, and session archive entry across all sessions.":"Deletes every stored log, streaming chunk, and session archive entry for this session, including history that is not currently loaded.",xt=e.length===0?"Load":"Reload",Qn=s==="__all__"?"":s,bc=s==="__all__"||t.includes(s)?s:"__typed__",wi=Ae&&pe!==null?nn(pe.label):s==="__all__"?"All sessions":nn(s),tg=p.useMemo(()=>k8({logs:e,conversationGroups:oe,isLoading:y,timeDisplayFormat:b,slowResponseThresholdSeconds:x}),[oe,y,e,x,b]),ng=p.useCallback(Ue=>{const at=it.get(Ue.id);at!==void 0&&he([at,Ue])},[it]),sg=p.useCallback(Ue=>{const at=Ue.currentTarget.value.trim();i(at===""?"__all__":at)},[i]),rg=p.useCallback(Ue=>{Ue!=="__typed__"&&i(Ue)},[i]),og=N!==void 0?N:s==="__all__"?null:s;return r.jsxs("div",{className:"bg-background min-h-screen w-full text-foreground",children:[r.jsxs("button",{type:"button",onClick:re,className:ie("group fixed top-1/2 right-3 z-40 inline-flex h-14 w-7 -translate-y-1/2 items-center justify-center rounded-l-md border border-white/[0.08] bg-background/90 text-muted-foreground shadow-[0_12px_34px_rgba(0,0,0,0.26),inset_0_1px_0_rgba(255,255,255,0.06)] backdrop-blur transition-[right,background-color,color,border-color] duration-200 hover:border-white/[0.16] hover:bg-white/[0.07] hover:text-foreground focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-none",X?"right-3":"lg:right-[326px] xl:right-[346px]"),"aria-label":X?"Show details panel":"Hide details panel",title:X?"Show details panel":"Hide details panel",children:[r.jsx("span",{className:"absolute left-1 top-2 bottom-2 w-px rounded-full bg-white/[0.16] transition-colors group-hover:bg-white/[0.28]"}),X?r.jsx(Uw,{className:"size-3.5"}):r.jsx(Fw,{className:"size-3.5"})]}),X&&r.jsx(ez,{}),r.jsxs("div",{className:ie("grid min-h-screen w-full grid-cols-1",X?"lg:grid-cols-[minmax(0,1fr)]":"lg:grid-cols-[minmax(0,1fr)_340px] xl:grid-cols-[minmax(0,1fr)_360px]"),children:[!X&&r.jsx("aside",{className:"bg-background/95 order-1 border-b border-white/[0.045] lg:sticky lg:top-0 lg:order-2 lg:h-screen lg:overflow-y-auto lg:border-b-0 lg:border-l lg:border-white/[0.055]",children:r.jsxs("div",{className:"space-y-4 p-4",children:[r.jsx(q8,{compact:!0,crabEntrancePhase:be,currentSessionId:og,logCount:e.length}),r.jsxs(ra,{label:"Session",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsx(Kr,{label:"Requests",value:e.length}),r.jsx(Kr,{label:"Sessions",value:t.length}),r.jsx(Kr,{label:"Input",value:Fe(Ae?$e:O)}),r.jsx(Kr,{label:"Output",value:Fe(Ae?Bt:A)})]}),j!==void 0&&r.jsx("div",{className:"mt-2 rounded-md bg-black/20 px-2 py-2 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.045)]",children:r.jsx(ro,{progress:j})})]}),r.jsx(ra,{label:"Workspace",children:r.jsxs("div",{className:"bg-black/20 rounded-md px-3 py-2 shadow-[inset_0_1px_0_rgba(255,255,255,0.035)]",children:[r.jsx("div",{className:"truncate font-mono text-xs font-semibold text-cyan-100",title:wi,children:wi}),r.jsx("div",{className:"mt-1 text-[11px] text-muted-foreground",children:Ms?"Session workspace":"Live workspace"})]})}),Ae&&pe!==null&&r.jsx(oz,{label:pe.label,logs:me,totalIn:$e,totalOut:Bt,timeDisplayFormat:b,contextSummary:Rn,showBackLink:pe.showBackLink}),Ae&&N!==void 0&&C.length>0&&r.jsx(Ed,{memberships:C}),r.jsx(ra,{label:"Filters",children:r.jsxs("div",{className:"space-y-2",children:[!T&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative",children:[r.jsx(Qf,{className:"pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"search",value:Qn,onChange:sg,placeholder:"Paste session ID",className:"bg-black/25 hover:bg-white/[0.045] focus-visible:ring-ring h-9 w-full rounded-md px-8 font-mono text-xs text-foreground outline-none shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors placeholder:font-sans placeholder:text-muted-foreground focus-visible:ring-1","aria-label":"Filter by session ID",title:"Filter by exact session ID"}),Qn!==""&&r.jsx("button",{type:"button",onClick:()=>i("__all__"),className:"absolute right-1.5 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-white/[0.06] hover:text-foreground","aria-label":"Clear session filter",title:"Clear session filter",children:r.jsx(fr,{className:"size-3.5"})})]}),r.jsxs(Ao,{value:bc,onValueChange:rg,children:[r.jsx(Io,{className:"bg-black/25 hover:bg-white/[0.045] h-9 w-full border-0 text-xs text-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]",children:r.jsx(Ro,{placeholder:"All sessions"})}),r.jsxs(zo,{children:[r.jsx(Lt,{value:"__all__",children:"All sessions"}),bc==="__typed__"&&r.jsxs(Lt,{value:"__typed__",children:["Typed: ",nn(s)]}),t.map(Ue=>r.jsx(Lt,{value:Ue,children:nn(Ue)},Ue))]})]})]}),r.jsxs(Ao,{value:o,onValueChange:a,children:[r.jsx(Io,{className:"bg-black/25 hover:bg-white/[0.045] h-9 w-full border-0 text-xs text-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]",children:r.jsx(Ro,{placeholder:"All models"})}),r.jsxs(zo,{children:[r.jsx(Lt,{value:"__all__",children:"All models"}),n.map(Ue=>r.jsx(Lt,{value:Ue,children:Ue},Ue))]})]})]})})]})}),r.jsxs("main",{className:"order-2 min-w-0 lg:order-1",children:[r.jsxs("div",{className:"bg-background/95 shadow-[0_12px_36px_rgba(0,0,0,0.18),inset_0_-1px_0_rgba(255,255,255,0.045)] sticky top-0 z-30 px-4 py-3 lg:px-5",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("div",{className:"min-w-[180px] flex-1",children:[r.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Logs"}),r.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-muted-foreground",children:wi})]}),h!==void 0&&r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:Q,type:"file",accept:".zip,.json,.jsonl,application/zip,application/json",className:"hidden",onChange:ne}),r.jsx("button",{type:"button",onClick:se,disabled:$,className:"bg-white/[0.035] hover:bg-white/[0.065] inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs text-muted-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",title:"Import Agent Inspector export",children:$?r.jsx("span",{children:"Importing..."}):r.jsxs(r.Fragment,{children:[r.jsx(ep,{className:"size-3.5"}),r.jsx("span",{children:"Import"})]})})]}),en.redacted&&r.jsx("button",{type:"button",onClick:()=>{B("redacted")},disabled:D!==null,className:"bg-white/[0.035] hover:bg-white/[0.065] inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs text-muted-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",title:"Export redacted logs as JSON ZIP",children:D==="redacted"?r.jsx("span",{children:"Exporting..."}):r.jsxs(r.Fragment,{children:[r.jsx(dr,{className:"size-3.5"}),r.jsx("span",{children:"Export"})]})}),en.raw&&r.jsx("button",{type:"button",onClick:()=>{B("raw")},disabled:D!==null,className:"bg-white/[0.035] hover:bg-white/[0.065] inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs text-muted-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",title:"Export raw logs without redaction",children:D==="raw"?r.jsx("span",{children:"Exporting..."}):r.jsxs(r.Fragment,{children:[r.jsx(nw,{className:"size-3.5"}),r.jsx("span",{children:"Raw"})]})}),u!==void 0&&r.jsxs("button",{type:"button",onClick:M,disabled:y,className:"bg-white/[0.035] hover:bg-white/[0.065] inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs text-muted-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",title:"Reload this session from stored logs",children:[r.jsx(yn,{className:ie("size-3.5",y&&"animate-spin")}),r.jsx("span",{children:xt})]}),r.jsxs("button",{type:"button",onClick:q,disabled:!Be,className:"bg-white/[0.035] hover:bg-white/[0.065] inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs text-muted-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",title:"Clear the current view. Stored logs remain reloadable.",children:[r.jsx(wn,{className:"size-3.5"}),r.jsx("span",{children:"Clear"})]}),c!==void 0&&r.jsxs("button",{type:"button",onClick:ce,disabled:!jt||le,className:"bg-red-500/[0.07] hover:bg-red-500/[0.12] inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs text-red-200 shadow-[inset_0_0_0_1px_rgba(248,113,113,0.14)] transition-colors hover:text-red-100 disabled:cursor-not-allowed disabled:opacity-50",title:"Delete persisted history for the selected session.",children:[r.jsx(wn,{className:"size-3.5"}),r.jsx("span",{children:"Delete"})]})]}),k===void 0&&j!==void 0&&r.jsx("div",{className:"mt-2 rounded-md bg-black/20 px-2 py-2 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.045)]",children:r.jsx(ro,{progress:j})}),r.jsx(Ad,{logs:e,pagination:k,embedded:!0}),f===void 0&&L!==null&&r.jsx("div",{className:"mt-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:L}),f===void 0&&Z!==null&&r.jsx("div",{className:"mt-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:Z}),f===void 0&&F!==null&&Z===null&&r.jsx("div",{className:"mt-2 rounded-md border border-cyan-400/25 bg-cyan-500/10 px-3 py-2 text-xs text-cyan-100",children:F})]}),r.jsxs("div",{className:"px-4 py-4 lg:px-5",children:[r.jsx(N8,{stats:tg}),e.length===0?s!=="__all__"?r.jsx("div",{className:"py-16 text-center text-muted-foreground",children:r.jsxs("div",{className:"bg-white/[0.035] shadow-[inset_0_1px_0_rgba(255,255,255,0.045),0_18px_52px_rgba(0,0,0,0.18)] mx-auto max-w-xl space-y-4 rounded-[8px] px-4 py-8",children:[r.jsx("p",{className:"text-sm font-medium",children:y?"Loading session data...":"No logs loaded for this session"}),r.jsx("p",{className:"inline-block max-w-full rounded bg-muted px-3 py-1 font-mono text-xs break-all",children:nn(s)}),j!==void 0&&r.jsx("div",{className:"mx-auto max-w-md rounded-md bg-black/20 px-2 py-2 text-left shadow-[inset_0_0_0_1px_rgba(255,255,255,0.045)]",children:r.jsx(ro,{progress:j})}),C.length>0&&r.jsx("div",{className:"text-left",children:r.jsx(Ed,{memberships:C})}),!y&&r.jsxs("div",{className:"flex flex-col items-center gap-3 text-xs",children:[r.jsx("p",{children:"Stored logs may still be available."}),r.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[u!==void 0&&r.jsxs("button",{type:"button",onClick:M,className:"bg-white/[0.045] hover:bg-white/[0.075] inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs text-muted-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:text-foreground",children:[r.jsx(yn,{className:"size-3.5"}),r.jsx("span",{children:"Load session"})]}),T?r.jsx("a",{href:"/",className:"inline-flex h-8 items-center rounded-md px-3 text-xs text-muted-foreground underline transition-colors hover:text-foreground",children:"Back to all sessions"}):r.jsx("button",{type:"button",onClick:()=>i("__all__"),className:"inline-flex h-8 items-center rounded-md px-3 text-xs text-muted-foreground underline transition-colors hover:text-foreground",children:"Show all sessions"})]})]})]})}):r.jsx("div",{className:"py-16 text-center text-muted-foreground",children:r.jsxs("div",{className:"bg-white/[0.035] shadow-[inset_0_1px_0_rgba(255,255,255,0.045),0_18px_52px_rgba(0,0,0,0.18)] mx-auto max-w-2xl space-y-4 rounded-[8px] px-4 py-8",children:[r.jsx("p",{className:"text-sm",children:"No logs loaded in the current view."}),t.length>0&&r.jsx("p",{className:"mx-auto max-w-xl text-xs leading-relaxed text-muted-foreground",children:"Pick a session from the filter panel to load stored logs on demand."}),r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(zd,{command:"ANTHROPIC_BASE_URL=http://localhost:9527/proxy <your-tool>"}),r.jsx(zd,{command:"OPENAI_BASE_URL=http://localhost:9527/proxy <your-tool>"})]}),r.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."})]})}):r.jsxs("div",{ref:_,tabIndex:0,className:"flex flex-col gap-2 focus:outline-none",children:[r.jsx("div",{ref:Ie,children:r.jsx(sI,{groups:oe,viewMode:m,strip:g,slowResponseThresholdSeconds:x,cacheTrends:gt,onCompareWithPrevious:ng,comparisonPredecessors:it,onClearGroup:d,defaultExpanded:oe.length===1,timeDisplayFormat:b})}),r.jsx("div",{className:"mt-3",children:r.jsx(Ad,{logs:e,pagination:k})})]})]})]})]}),r.jsx(Gn,{open:V,onOpenChange:H,children:r.jsxs(Kn,{className:"border-red-500/20 bg-zinc-950 text-zinc-100 sm:max-w-md",children:[r.jsxs(Jn,{children:[r.jsxs(Yn,{children:["Delete ",et," history?"]}),r.jsx(Yp,{children:"Clear only hides logs from the UI. Delete removes stored history from disk."})]}),r.jsxs("div",{className:"rounded-md bg-red-500/[0.08] px-3 py-3 text-sm text-red-100 shadow-[inset_0_0_0_1px_rgba(248,113,113,0.16)]",children:[r.jsx("span",{className:"block font-medium",children:"This is a full history delete."}),r.jsx("span",{className:"mt-1 block text-xs text-red-200/80",children:Ut})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ke,{type:"button",variant:"outline",size:"sm",disabled:le,onClick:()=>H(!1),children:"Cancel"}),r.jsx(ke,{type:"button",variant:"destructive",size:"sm",disabled:le,onClick:I,children:le?"Deleting...":"Delete history"})]})]})}),xe!==null&&r.jsx(p.Suspense,{fallback:null,children:r.jsx(aT,{left:xe[0],right:xe[1],leftDisplayNumber:Nd(xe[0],ve),rightDisplayNumber:Nd(xe[1],ve),onClose:Y})})]})}const az=Yt([J({type:Ee("init"),logs:fe(er)}),J({type:Ee("update"),log:er})]),lz=J({logs:fe(er),total:K().int().nonnegative(),limit:K().int().positive(),hasOlder:Le(),hasNewer:Le(),oldestLogId:K().int().positive().nullable(),newestLogId:K().int().positive().nullable()}),cz=fe(S()),Ld=J({success:Le(),cleared:K().int().nonnegative(),logFilesRewritten:K().int().nonnegative().optional(),chunkFilesDeleted:K().int().nonnegative(),sessionArchiveLogsDeleted:K().int().nonnegative().optional()});function uz(e,t){const n=[];for(const s of e)for(const o of s.members)o.sessionId===t&&n.push({groupId:s.id,groupTitle:s.title,groupKind:s.kind,groupStatus:s.status,groupTask:s.task,groupProject:s.project,groupEvidence:s.evidence,member:o});return n}function Jr(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function dz(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function fz(e,t,n){return t==="__all__"&&n==="__all__"?e:e.filter(s=>!(t!=="__all__"&&s.sessionId!==t||n!=="__all__"&&s.model!==n))}const pz=100,hz=12,mz=1800,xc=100,Fo=500,eg=200,el=2e4,gz=1e4;function xz(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 bz(e,t,n=xc){const s=new URLSearchParams({cursor:"1",compact:"1",limit:String(n),sessionId:e});switch(t.kind){case"oldest":s.set("anchor","oldest");break;case"older":s.set("beforeLogId",String(t.beforeLogId));break;case"newer":s.set("afterLogId",String(t.afterLogId));break}return`/api/logs?${s.toString()}`}function hn(e){const t=new Map;for(let n=0;n<e.length;n++){const s=e[n];s!==void 0&&t.set(s.id,n)}return t}function Ys(e,t,n=xc){return Ke(bz(e,t,n),lz,el)}async function vz(e,t){const n=new Set;let s=await Ys(e,{kind:"oldest"},Fo);for(const i of s.logs)n.add(i.id);t(n.size,1);let o=1;for(;s.hasNewer&&s.newestLogId!==null&&o<eg;){s=await Ys(e,{kind:"newer",afterLogId:s.newestLogId},Fo);for(const i of s.logs)n.add(i.id);o+=1,t(n.size,o)}return{ids:[...n],truncated:s.hasNewer}}async function yz(){try{return{deleted:(await pt("/api/groups",$f,{method:"DELETE"})).deleted,ok:!0}}catch{return{deleted:0,ok:!1}}}function Yr(e,t){if(t.length===0)return[...e];const n=new Map;for(const s of e)n.set(s.id,s);for(const s of t)n.set(s.id,s);return[...n.values()].sort((s,o)=>s.id-o.id)}function Mn(e,t){const n=new Set;for(const s of e)s!==""&&n.add(s);for(const s of t)s!==""&&n.add(s);return[...n].sort()}function Sz({initialSessionId:e}={}){const[t,n]=p.useState([]),[s,o]=p.useState(e??"__all__"),[i,a]=p.useState("__all__"),[l,c]=p.useState([]),{notice:u,showToast:d,dismissToast:f}=_0(),[h,m]=p.useState(e===void 0),[v,g]=p.useState(null),[x,b]=p.useState(e!==void 0),[y,k]=p.useState(void 0),[j,C]=p.useState([]),[,T]=p.useTransition(),N=p.useRef(null),O=p.useRef(null),A=p.useRef(null),z=p.useRef(0),D=p.useRef(null),E=p.useRef(null),L=p.useRef(new Map),w=p.useRef([]),$=p.useRef(null),ee=p.useCallback(I=>{d({message:I,tone:"error"})},[d]),F=p.useCallback(()=>{E.current!==null&&(clearInterval(E.current),E.current=null),D.current=null,k(void 0)},[]),W=p.useCallback((I,M,Y=0,re=0)=>{E.current!==null&&clearInterval(E.current);const oe=Date.now();D.current=oe;const ve=()=>{z.current===M&&k({label:I,elapsedMs:Date.now()-oe,timeoutMs:el,loadedLogs:Y,loadedPages:re})};ve(),E.current=setInterval(ve,250)},[]),Z=p.useCallback((I,M,Y,re)=>{const oe=D.current;oe===null||z.current!==M||k({label:I,elapsedMs:Date.now()-oe,timeoutMs:el,loadedLogs:Y,loadedPages:re})},[]),ue=p.useMemo(()=>fz(t,s,i),[t,s,i]),V=p.useMemo(()=>Mn(l,Jr(t)),[t,l]),H=p.useMemo(()=>dz(t),[t]),le=p.useCallback(()=>{pt("/api/sessions",cz).then(I=>{c(M=>Mn(M,I))}).catch(()=>{})},[]),U=p.useCallback(()=>{$.current=null;const I=w.current;w.current=[],I.length!==0&&T(()=>{n(M=>{const Y=Yr(M,I);return L.current=hn(Y),Y})})},[T]),X=p.useCallback(I=>{w.current.push(I),$.current===null&&($.current=setTimeout(U,pz))},[U]),Ce=p.useCallback(()=>{N.current&&N.current.close(),m(!1);const I=new EventSource(xz(e));N.current=I,I.onmessage=M=>{try{const Y=String(M.data),re=JSON.parse(Y),oe=az.safeParse(re);if(!oe.success){ee("Failed to parse SSE data");return}const ve=oe.data;ve.type==="init"?($.current!==null&&(clearTimeout($.current),$.current=null),w.current=[],n(pe=>{const me=Yr(pe,ve.logs);return L.current=hn(me),me}),c(pe=>Mn(pe,Jr(ve.logs))),m(!0),f()):ve.type==="update"&&(c(pe=>ve.log.sessionId===null||ve.log.sessionId===""?pe:Mn(pe,[ve.log.sessionId])),X(ve.log))}catch{ee("Failed to parse SSE data")}},I.onerror=()=>{ee("SSE connection lost, reconnecting..."),m(!0),I.close(),O.current!==null&&clearTimeout(O.current),O.current=setTimeout(Ce,3e3)}},[f,e,X,ee]),ae=p.useCallback(I=>{if(e===void 0)return;const M=z.current+1;z.current=M,b(!0),W("Loading session logs",M),f(),Ys(e,I).then(Y=>{if(z.current!==M)return;const re=Y.logs;L.current=hn(re),n(re),g(Y),o(e),b(!1),F(),f()}).catch(Y=>{z.current===M&&(n([]),g(null),b(!1),F(),ee(Y instanceof Error?Y.message:"Failed to load session logs"))})},[f,e,ee,W,F]),ge=p.useCallback(I=>{const M=z.current+1;z.current=M,b(!0),W("Reloading full session",M),f(),(async()=>{const Y=[];let re=await Ys(I,{kind:"oldest"},Fo);Y.push(...re.logs),Z("Reloading full session",M,Y.length,1);let oe=1;for(;re.hasNewer&&re.newestLogId!==null&&oe<eg;)re=await Ys(I,{kind:"newer",afterLogId:re.newestLogId},Fo),Y.push(...re.logs),oe+=1,Z("Reloading full session",M,Y.length,oe);z.current===M&&(n(ve=>{const pe=Yr(ve,Y);return L.current=hn(pe),pe}),c(ve=>Mn(ve,[I])),b(!1),F(),re.hasNewer?d({message:`Loaded ${String(Y.length)} logs for this session. More history is available.`,tone:"success"}):f())})().catch(Y=>{z.current===M&&(b(!1),F(),ee(Y instanceof Error?Y.message:"Failed to reload session logs"))})},[f,ee,d,W,F,Z]);p.useEffect(()=>{if(e===void 0){C([]);return}let I=!1;return Ke("/api/groups",Uf,gz).then(M=>M.groups).then(M=>{I||M===null||C(uz(M,e))}).catch(()=>{I||C([])}),()=>{I=!0}},[e]),p.useEffect(()=>{le()},[le]),p.useEffect(()=>()=>{F()},[F]),p.useEffect(()=>{e!==void 0&&ae({kind:"newest"})},[e,ae]),p.useEffect(()=>{e===void 0&&s!=="__all__"&&ge(s)},[e,ge,s]),p.useEffect(()=>{if(e===void 0)return Ce(),()=>{N.current&&(N.current.close(),N.current=null),O.current!==null&&(clearTimeout(O.current),O.current=null),$.current!==null&&(clearTimeout($.current),$.current=null)}},[Ce,e]),p.useEffect(()=>{const I=window.location.hash;if(!I.startsWith("#log-")||A.current===I)return;const M=I.slice(1),Y=Number(M.replace(/^log-/,""));Number.isInteger(Y)&&Y>0&&ir({logId:Y,tab:"request"});let re=!1,oe=0,ve=null,pe=null;const me=()=>{if(re)return;const Ae=document.getElementById(M);if(Ae!==null){A.current=I,Ae.scrollIntoView({block:"center",behavior:"smooth"}),Ae instanceof HTMLElement&&(ve=Ae,Ae.setAttribute("data-deep-link-highlight","true"),pe=window.setTimeout(()=>{Ae.removeAttribute("data-deep-link-highlight")},mz),Ae.focus({preventScroll:!0}),Ae.getAttribute("data-nav-action")==="expand"&&Ae.click());return}oe+=1,oe<hz&&window.setTimeout(me,100)};return me(),()=>{re=!0,pe!==null&&window.clearTimeout(pe),ve!==null&&ve.removeAttribute("data-deep-link-highlight")}},[ue.length]);const xe=p.useCallback(()=>{const I=Jr(t);F(),b(!1),L.current.clear(),n([]),g(null),c(M=>Mn(M,I)),d({message:"Cleared the current view. Stored logs are still reloadable.",tone:"success"})},[t,d,F]),he=p.useCallback(I=>{if(I.length===0)return;const M=new Set(I);n(Y=>{const re=Y.filter(ve=>M.has(ve.id)),oe=Y.filter(ve=>!M.has(ve.id));return c(ve=>Mn(ve,Jr(re))),L.current=hn(oe),oe}),d({message:"Cleared this group from the current view.",tone:"success"})},[d]),be=p.useCallback(async()=>{const I=z.current+1;z.current=I,b(!0),F(),f();try{if(s==="__all__"){W("Deleting stored history",I);const pe=await pt("/api/logs",Ld,{method:"DELETE"}),me=await yz();if(z.current!==I)return;n([]),L.current.clear(),g(null),c([]),C([]),b(!1),F();const Ae=me.ok?` Cleared ${me.deleted.toString()} group${me.deleted===1?"":"s"}.`:" Group cleanup failed; open Groups to retry Clear.";d({message:`Deleted ${pe.cleared.toString()} stored log${pe.cleared===1?"":"s"} across all sessions.${Ae}`,tone:me.ok?"success":"error"});return}const M=s;W("Deleting session history",I);const Y=await vz(M,(pe,me)=>{Z("Deleting session history",I,pe,me)}),re=new Set(Y.ids);for(const pe of t)pe.sessionId===M&&re.add(pe.id);const oe=[...re].filter(pe=>Number.isInteger(pe)&&pe>=0);if(oe.length===0){if(z.current!==I)return;n(pe=>{const me=pe.filter(Ae=>Ae.sessionId!==M);return L.current=hn(me),me}),g(pe=>pe===null?null:{...pe,logs:pe.logs.filter(me=>me.sessionId!==M)}),c(pe=>pe.filter(me=>me!==M)),b(!1),F(),d({message:"No stored log records were found for this session.",tone:"success"});return}const ve=await pt("/api/logs",Ld,{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({ids:oe})});if(z.current!==I)return;n(pe=>{const me=pe.filter(Ae=>Ae.sessionId!==M);return L.current=hn(me),me}),g(pe=>pe===null?null:{...pe,logs:pe.logs.filter(me=>me.sessionId!==M)}),c(pe=>pe.filter(me=>me!==M)),b(!1),F(),d({message:`Deleted ${ve.cleared.toString()} stored log${ve.cleared===1?"":"s"} for this session${Y.truncated?". More history may remain.":"."}`,tone:Y.truncated?"error":"success"})}finally{z.current===I&&(b(!1),F())}},[t,f,s,d,W,F,Z]),Se=p.useCallback(()=>{if(e!==void 0){ae({kind:"newest"});return}if(s==="__all__"){le();return}ge(s)},[e,ae,le,ge,s]),Ie=p.useCallback(async I=>{const M=new FormData;M.set("file",I);const Y=await pt("/api/logs/import",W2,{method:"POST",body:M});return n(re=>{const oe=new Set(Y.logs.map(pe=>pe.id)),ve=Yr(re.filter(pe=>!oe.has(pe.id)),Y.logs);return L.current=hn(ve),ve}),o(Y.sessionId),a("__all__"),g(null),f(),Y},[f]),{strip:_,captureMode:Q,slowResponseThresholdSeconds:G,timeDisplayFormat:P}=yl(),R=Q,B=p.useCallback(()=>{ae({kind:"oldest"})},[ae]),se=p.useCallback(()=>{ae({kind:"newest"})},[ae]),ne=p.useCallback(()=>{const I=t[0],M=v?.oldestLogId??I?.id??null;M!==null&&ae({kind:"older",beforeLogId:M})},[t,ae,v]),q=p.useCallback(()=>{const I=t[t.length-1],M=v?.newestLogId??I?.id??null;M!==null&&ae({kind:"newer",afterLogId:M})},[t,ae,v]),ce=p.useMemo(()=>{if(e!==void 0)return{isLoading:x,loadProgress:y,total:v?.total??null,pageSize:v?.limit??xc,hasOlder:v?.hasOlder??!1,hasNewer:v?.hasNewer??!1,oldestLogId:v?.oldestLogId??null,newestLogId:v?.newestLogId??null,onOldest:B,onOlder:ne,onNewer:q,onNewest:se}},[e,se,q,ne,B,v,y,x]);return r.jsxs(r.Fragment,{children:[r.jsx(k0,{notice:u,onDismiss:f}),r.jsx(E_,{}),r.jsx(iz,{logs:ue,sessions:V,models:H,selectedSession:s,selectedModel:i,onSessionChange:o,onModelChange:a,onClearAll:xe,onDeleteCurrentView:be,onReloadSession:e!==void 0||s!=="__all__"?Se:void 0,onClearGroup:he,onNotify:d,onImportLogs:e===void 0?Ie:void 0,isLoading:e===void 0&&!h||x,pagination:ce,sessionLoadProgress:y,sessionMemberships:j,viewMode:R,captureMode:Q,strip:_,slowResponseThresholdSeconds:G,timeDisplayFormat:P,hideSessionFilter:e!==void 0,pinnedSessionId:e})]})}export{kz as $,J as A,Me as B,Vy as C,Gn as D,K as E,fe as F,ir as G,Vo as H,Le as I,S as J,er as K,fT as L,Jf as M,QI as N,_w as O,Sz as P,fI as Q,Xw as R,gI as S,r0 as T,dI as U,bp as V,jz as W,fr as X,ot as Y,ze as Z,$T as _,v4 as a,Vf as a0,FT as a1,BT as a2,Es as a3,La as a4,No as a5,tr as a6,_e as a7,rn as a8,Wk as a9,Qe as aa,yf as ab,oT as ac,_y as ad,ie as b,de as c,da as d,Yf as e,Fe as f,Ym as g,Tt as h,Ge as i,At as j,Nt as k,Ke as l,Kn as m,Jn as n,Yn as o,Kw as p,o0 as q,rr as r,St as s,Ct as t,vp as u,ke as v,jn as w,ct as x,ut as y,dt as z};
|
|
106
|
+
args = ["stdio", "--url", "${s}"]`}],[s]),i=p.useCallback((a,l)=>{Tt(l).then(c=>{c&&(t(a),setTimeout(()=>t(null),1600))})},[]);return r.jsxs("div",{className:"min-w-0 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(zs,{className:"size-4 text-muted-foreground"}),r.jsx("h3",{className:"text-sm font-semibold",children:"MCP access"})]}),r.jsxs("div",{className:"grid gap-2 rounded-md bg-muted/15 px-3 py-2 text-xs text-muted-foreground",children:[r.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."}),r.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."})]}),r.jsx("div",{className:"grid gap-2",children:o.map(a=>r.jsx(Xs,{id:a.id,label:a.label,value:a.value,copiedId:e,onCopy:i},a.id))})]})}function jR(){const{strip:e,slowResponseThresholdSeconds:t,providerTestTimeoutSeconds:n,timeDisplayFormat:s,isLoading:o,setStrip:i,setSlowResponseThresholdSeconds:a,setProviderTestTimeoutSeconds:l,setTimeDisplayFormat:c}=yl(),[u,d]=p.useState(null),[f,h]=p.useState(!1),m=p.useCallback(async b=>{d(null),h(!0);try{await i(b)}catch(y){d(y instanceof Error?y.message:String(y))}finally{h(!1)}},[i]),v=p.useCallback(async b=>{d(null),h(!0);try{await a(b)}catch(y){d(y instanceof Error?y.message:String(y))}finally{h(!1)}},[a]),g=p.useCallback(async b=>{d(null),h(!0);try{await l(b)}catch(y){d(y instanceof Error?y.message:String(y))}finally{h(!1)}},[l]),x=p.useCallback(async b=>{d(null),h(!0);try{await c(b)}catch(y){d(y instanceof Error?y.message:String(y))}finally{h(!1)}},[c]);return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"Claude Code billing header"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Strip Claude Code's synthetic billing block before upstream forwarding. This can improve prefix-cache hits with third-party providers and is persisted to ",r.jsx("code",{children:"config.json"}),"."]})]}),r.jsxs("label",{className:"flex items-center gap-3",children:[r.jsx("input",{type:"checkbox",role:"switch",checked:e,disabled:o||f,onChange:b=>{m(b.currentTarget.checked)},className:"size-4 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"}),r.jsx("span",{className:"text-sm",children:o?"Loading...":e?"Stripping enabled":"Stripping disabled"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{htmlFor:"slow-response-threshold",className:"text-sm font-semibold",children:"Slow response threshold"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Show a slow marker when elapsed time exceeds this many seconds. Use ",r.jsx("code",{children:"0"})," to disable it."]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{id:"slow-response-threshold",type:"number",min:0,max:la,step:1,value:t,disabled:o||f,onChange:b=>{const y=Number(b.currentTarget.value);Number.isInteger(y)&&(y<0||y>la||v(y))},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"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"seconds"})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{htmlFor:"provider-test-timeout",className:"text-sm font-semibold",children:"Provider test timeout"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Abort slow Provider Test probes after this many seconds per model."}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{id:"provider-test-timeout",type:"number",min:1,max:ca,step:1,value:n,disabled:o||f,onChange:b=>{const y=Number(b.currentTarget.value);Number.isInteger(y)&&(y<1||y>ca||g(y))},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"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"seconds / model"})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("label",{htmlFor:"time-display-format",className:"text-sm font-semibold",children:"Time display"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Controls timestamps in session summaries, headers, and log rows."}),r.jsxs("select",{id:"time-display-format",value:s,disabled:o||f,onChange:b=>{const y=Vf.safeParse(b.currentTarget.value);y.success&&x(y.data)},className:"h-8 rounded-md border border-input bg-background px-2 text-sm disabled:cursor-not-allowed disabled:opacity-50",children:[r.jsx("option",{value:"time",children:"Time only"}),r.jsx("option",{value:"full",children:"Full ISO"})]})]}),u!==null&&r.jsxs("p",{className:"text-xs text-destructive",children:["Failed to save: ",u]})]})}const SR=Ee(["installed","update-available","available","planned","unknown"]),CR=J({id:S(),name:S(),npmName:S(),capability:S(),description:S(),workflow:S(),installCommand:S(),state:SR,installedVersion:S().nullable(),latestVersion:S().nullable(),primary:Le()}),NR=J({id:S(),name:S(),validatedVersion:S(),binary:S(),modelFlag:S(),variantFlag:S().nullable(),tools:fe(S()),logDir:S(),skillsDir:S(),agentsDir:S()}),TR=J({id:S(),title:S(),stage:S(),packageId:S(),description:S(),command:S(),requiresSession:Le(),runnable:Le()}),ER=J({checkedAt:S(),packages:fe(CR),runnerPresets:fe(NR),recipes:fe(TR)}),AR=Ee(["install","upgrade","help","runner-presets","recipe"]),RR=Ee(["queued","running","succeeded","failed"]),L0=J({id:S(),packageId:S(),npmName:S(),recipeId:S().nullable().default(null),action:AR,status:RR,command:S(),output:S(),createdAt:S(),startedAt:S().nullable(),finishedAt:S().nullable(),exitCode:K().nullable(),error:S().nullable()}),gc=J({task:L0}),IR=J({tasks:fe(L0)}),zR=[{id:"observe",title:"Observe",label:"Live",description:"Capture IDE, process, session, turn, request, response, tools, and providers.",metric:"Inspector core",icon:X2},{id:"replay",title:"Replay",label:"Ready",description:"Promote real logs into repeatable replay evidence without losing the raw context.",metric:"Session asset",icon:yn},{id:"evaluate",title:"Evaluate",label:"Next",description:"Use eval-harness to turn sessions into regression cases and provider bakeoffs.",metric:"Eval loop",icon:wl},{id:"connect",title:"Connect",label:"MCP",description:"Expose Inspector state to coding agents as queryable context and durable evidence.",metric:"/api/mcp",icon:Mw}];async function PR(e){return ht(e,ER,void 0,t=>`Failed to load ecosystem packages: ${String(t.status)}`)}async function OR(e){return ht(e,gc,void 0,t=>`Failed to load ecosystem task: ${String(t.status)}`)}async function MR(e){return ht(e,IR,void 0,t=>`Failed to load ecosystem tasks: ${String(t.status)}`)}async function LR(e,t){return(await ht(`/api/ecosystem/packages/${encodeURIComponent(e)}/${t}`,gc,{method:"POST"},s=>`Failed to start ecosystem task: ${String(s.status)}`)).task}async function DR(e){return(await ht(`/api/ecosystem/recipes/${encodeURIComponent(e)}/run`,gc,{method:"POST"},n=>`Failed to start ecosystem recipe: ${String(n.status)}`)).task}function $R(e){switch(e){case"installed":return"Installed";case"update-available":return"Update";case"available":return"Available";case"planned":return"Planned";case"unknown":return"Unknown"}}function FR(e){switch(e){case"installed":return"border-emerald-400/20 bg-emerald-400/8 text-emerald-200";case"update-available":return"border-amber-400/20 bg-amber-400/8 text-amber-200";case"available":return"border-sky-400/20 bg-sky-400/8 text-sky-200";case"planned":return"border-white/10 bg-white/[0.04] text-white/55";case"unknown":return"border-white/10 bg-white/[0.04] text-white/45"}}function BR(e){return e.installedVersion!==null&&e.latestVersion!==null?e.installedVersion===e.latestVersion?`v${e.installedVersion}`:`v${e.installedVersion} -> v${e.latestVersion}`:e.installedVersion!==null?`v${e.installedVersion}`:e.latestVersion!==null?`latest v${e.latestVersion}`:"not published"}function Qs(e){switch(e){case"install":return"Install";case"upgrade":return"Upgrade";case"help":return"Help";case"runner-presets":return"Presets";case"recipe":return"Recipe"}}function UR(e){switch(e.status){case"queued":return"Queued";case"running":return`${Qs(e.action)} running`;case"succeeded":return`${Qs(e.action)} complete`;case"failed":return`${Qs(e.action)} failed`}}function D0(e){switch(e){case"queued":case"running":return"border-cyan-300/20 bg-cyan-300/8 text-cyan-100";case"succeeded":return"border-emerald-400/20 bg-emerald-400/8 text-emerald-100";case"failed":return"border-red-400/20 bg-red-400/8 text-red-100"}}function WR(e){switch(e.state){case"available":return"install";case"update-available":return"upgrade";case"installed":case"planned":case"unknown":return null}}function HR({pkg:e,activeTask:t,onStartTask:n}){const s=WR(e),o=t!==null&&t.packageId===e.id&&t.status==="running";return r.jsxs("div",{className:"rounded-lg bg-white/[0.025] p-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[r.jsx(Fw,{className:"size-4 shrink-0 text-white/55"}),r.jsx("div",{className:"text-sm font-semibold leading-snug",children:e.name})]}),r.jsx("div",{className:"mt-1 break-all font-mono text-[11px] leading-snug text-white/35",children:e.npmName})]}),r.jsx(Me,{className:ie("shrink-0",FR(e.state)),variant:"outline",children:$R(e.state)})]}),r.jsx("div",{className:"mt-3 text-xs leading-5 text-muted-foreground",children:e.description}),r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-[11px]",children:[r.jsx("span",{className:"rounded bg-white/[0.035] px-2 py-1 font-mono text-white/50",children:BR(e)}),r.jsx("span",{className:"rounded bg-white/[0.035] px-2 py-1 text-white/45",children:e.capability}),r.jsx("span",{className:"rounded bg-white/[0.035] px-2 py-1 font-mono text-white/35",children:e.installCommand})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[s!==null&&r.jsxs(ke,{type:"button",size:"sm",variant:"secondary",disabled:o,onClick:()=>n(e.id,s),children:[o?r.jsx(Xe,{className:"size-3.5 animate-spin"}):r.jsx(mr,{className:"size-3.5"}),Qs(s)]}),r.jsxs(ke,{type:"button",size:"sm",variant:"outline",disabled:o||e.state==="planned",onClick:()=>n(e.id,"help"),children:[r.jsx(zs,{className:"size-3.5"}),"Help"]}),e.id==="eval-harness"&&r.jsxs(ke,{type:"button",size:"sm",variant:"ghost",disabled:o||e.state==="planned",onClick:()=>n(e.id,"runner-presets"),children:[r.jsx(wl,{className:"size-3.5"}),"Presets"]})]})]})}function VR({task:e}){if(e===null)return null;const t=e.status==="queued"||e.status==="running";return r.jsxs("section",{className:"mt-3 rounded-lg bg-white/[0.025] p-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t?r.jsx(Xe,{className:"size-4 animate-spin text-cyan-200/75"}):r.jsx(zs,{className:"size-4 text-white/55"}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-semibold",children:UR(e)}),r.jsx("div",{className:"break-all font-mono text-[11px] text-white/35",children:e.command})]})]}),r.jsx(Me,{variant:"outline",className:ie("shrink-0",D0(e.status)),children:e.status})]}),r.jsx("pre",{className:"mt-3 max-h-56 overflow-auto whitespace-pre-wrap rounded-md bg-black/30 p-3 font-mono text-[11px] leading-5 text-white/60 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.045)]",children:e.output.trim().length>0?e.output:"Waiting for npm output..."}),e.error!==null&&r.jsx("div",{className:"mt-2 text-xs text-red-100",children:e.error})]})}function qR({workflow:e}){const t=e.icon;return r.jsxs("div",{className:"rounded-lg bg-white/[0.025] p-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(t,{className:"size-4 shrink-0 text-cyan-200/75"}),r.jsx("div",{className:"text-sm font-semibold",children:e.title})]}),r.jsx("span",{className:"rounded bg-white/[0.04] px-2 py-0.5 font-mono text-[10px] text-white/45",children:e.label})]}),r.jsx("div",{className:"mt-2 min-h-10 text-xs leading-5 text-muted-foreground",children:e.description}),r.jsx("div",{className:"mt-3 font-mono text-[11px] text-white/35",children:e.metric})]})}function ZR(e){return e===null?'npx @tonyclaw/eval-harness inspector-smoke --title "TonyClaw Lab smoke" --latest-log-limit 5':`npx @tonyclaw/eval-harness inspector-smoke --title "TonyClaw Lab smoke ${e}" --latest-log-limit 5`}function GR({preset:e}){return r.jsxs("div",{className:"rounded-lg bg-white/[0.025] p-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[r.jsx(ep,{className:"size-4 shrink-0 text-cyan-200/75"}),r.jsx("div",{className:"text-sm font-semibold leading-snug",children:e.name})]}),r.jsxs("div",{className:"mt-1 break-all font-mono text-[11px] leading-snug text-white/35",children:[e.binary," ",e.modelFlag,e.variantFlag!==null?` ${e.variantFlag}`:""]})]}),r.jsxs(Me,{variant:"outline",className:"border-white/10 bg-white/[0.04] text-white/55",children:["v",e.validatedVersion]})]}),r.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 text-[11px]",children:[r.jsxs("div",{className:"rounded bg-black/15 px-2 py-1 text-white/45",children:["logs/",e.logDir]}),r.jsx("div",{className:"rounded bg-black/15 px-2 py-1 text-white/45",children:e.tools.join(", ")}),r.jsx("div",{className:"rounded bg-black/15 px-2 py-1 font-mono text-white/35",children:e.skillsDir}),r.jsx("div",{className:"rounded bg-black/15 px-2 py-1 font-mono text-white/35",children:e.agentsDir})]})]})}function KR({recipe:e,copied:t,running:n,onCopy:s,onRun:o}){return r.jsxs("div",{className:"rounded-lg bg-white/[0.025] p-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[r.jsx(Kf,{className:"size-4 shrink-0 text-cyan-200/75"}),r.jsx("div",{className:"text-sm font-semibold leading-snug",children:e.title})]}),r.jsx("div",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:e.description})]}),r.jsx(Me,{variant:"outline",className:"border-white/10 bg-white/[0.04] text-white/55",children:e.runnable?e.stage:"Template"})]}),r.jsx("div",{className:"mt-3 rounded-md bg-black/20 p-2 font-mono text-[11px] leading-5 text-white/50 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.045)]",children:e.command}),r.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2",children:[r.jsx("span",{className:"rounded bg-white/[0.035] px-2 py-1 font-mono text-[11px] text-white/35",children:e.packageId}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ke,{type:"button",size:"sm",variant:"outline",onClick:()=>s(e),children:[t?r.jsx(Ge,{className:"size-3.5"}):r.jsx(Rt,{className:"size-3.5"}),t?"Copied":"Copy"]}),e.runnable&&r.jsxs(ke,{type:"button",size:"sm",variant:"secondary",disabled:n,onClick:()=>o(e),children:[n?r.jsx(Xe,{className:"size-3.5 animate-spin"}):r.jsx(ep,{className:"size-3.5"}),n?"Running":"Run"]})]})]})]})}function JR({task:e,selected:t,onSelect:n}){const s=e.recipeId??Qs(e.action);return r.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md bg-white/[0.025] px-3 py-2 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.045)]",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(Yf,{className:"size-3.5 shrink-0 text-white/40"}),r.jsx("div",{className:"truncate text-xs font-semibold text-white/75",children:s}),r.jsx(Me,{variant:"outline",className:ie("shrink-0",D0(e.status)),children:e.status})]}),r.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-2 font-mono text-[10px] text-white/35",children:[r.jsx("span",{children:e.packageId}),r.jsx("span",{children:new Date(e.createdAt).toLocaleTimeString()}),e.exitCode!==null&&r.jsxs("span",{children:["exit ",String(e.exitCode)]})]})]}),r.jsx(ke,{type:"button",size:"sm",variant:t?"secondary":"outline",onClick:()=>n(e),children:t?"Open":"View"})]})}function xd({currentSessionId:e,logCount:t}){const[n,s]=p.useState(!1),[o,i]=p.useState(!1),[a,l]=p.useState(!1),[c,u]=p.useState(null),[d,f]=p.useState(null),[h,m]=p.useState(null),v=qt("/api/ecosystem/packages",PR,{revalidateOnFocus:!1,revalidateIfStale:!1}),g=qt(d===null?null:`/api/ecosystem/tasks/${d}`,OR,{refreshInterval:w=>{const $=w?.task;return $!==void 0&&($.status==="queued"||$.status==="running")?900:0},revalidateOnFocus:!1}),x=qt(n?"/api/ecosystem/tasks":null,MR,{refreshInterval:2500,revalidateOnFocus:!1}),b=v.data?.packages??[],y=v.data?.runnerPresets??[],k=v.data?.recipes??[],j=(x.data?.tasks??[]).slice(0,6),C=p.useMemo(()=>b.filter(w=>w.state==="installed"||w.state==="update-available").length,[b]),T=ZR(e),N="npx @tonyclaw/eval-harness runner-presets",P=()=>{Tt(T).then(()=>{i(!0),window.setTimeout(()=>i(!1),1200)})},A=()=>{Tt(N).then(()=>{l(!0),window.setTimeout(()=>l(!1),1200)})},z=w=>{Tt(w.command).then(()=>{u(w.id),window.setTimeout(()=>u(null),1200)})},D=w=>{m(null),DR(w.id).then($=>{f($.id),g.mutate({task:$},{revalidate:!0}),x.mutate()}).catch($=>{m($ instanceof Error?$.message:"Failed to start ecosystem recipe")})},E=g.data?.task??null;p.useEffect(()=>{E!==null&&(x.mutate(),E.status==="succeeded"&&v.mutate())},[E,v,x]);const L=(w,$)=>{m(null),LR(w,$).then(ee=>{f(ee.id),g.mutate({task:ee},{revalidate:!0}),x.mutate()}).catch(ee=>{m(ee instanceof Error?ee.message:"Failed to start ecosystem task")})};return r.jsxs(Gn,{open:n,onOpenChange:s,children:[r.jsx(Xo,{asChild:!0,children:r.jsxs(ke,{variant:"ghost",size:"icon",className:vi,"aria-label":"TonyClaw Lab",title:"TonyClaw Lab",children:[r.jsx(Kf,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"TonyClaw Lab"})]})}),r.jsxs(Kn,{className:"flex max-h-[84vh] max-w-5xl flex-col overflow-hidden",children:[r.jsx(Jn,{children:r.jsxs(Yn,{className:"flex items-center gap-2",children:[r.jsx(qc,{className:"size-4 text-cyan-200/80"}),"TonyClaw Lab"]})}),r.jsxs("div",{className:"overflow-y-auto pr-2",children:[r.jsxs("div",{className:"grid gap-3 lg:grid-cols-[1.1fr_0.9fr]",children:[r.jsxs("section",{className:"rounded-lg bg-white/[0.025] p-4 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-semibold",children:"Session asset pipeline"}),r.jsx("div",{className:"mt-1 max-w-2xl text-xs leading-5 text-muted-foreground",children:"Treat captured traffic as durable assets: observe it, replay it, evaluate it, and expose it back to agents through MCP."})]}),r.jsxs(Me,{variant:"outline",className:"border-cyan-300/20 bg-cyan-300/8 text-cyan-100",children:[String(C),"/",String(b.length)," packages"]})]}),r.jsx("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:zR.map(w=>r.jsx(qR,{workflow:w},w.id))})]}),r.jsxs("section",{className:"rounded-lg bg-white/[0.025] p-4 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-semibold",children:"Current session"}),r.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:e===null?"MCP smoke command":e})]}),r.jsxs(Me,{variant:"outline",className:"border-white/10 bg-white/[0.04] text-white/55",children:[String(t)," logs"]})]}),r.jsx("div",{className:"mt-4 rounded-md bg-black/20 p-3 font-mono text-[11px] leading-5 text-white/55 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.045)]",children:T}),r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[r.jsxs(ke,{size:"sm",variant:"secondary",onClick:P,children:[o?r.jsx(Ge,{className:"size-3.5"}):r.jsx(Rt,{className:"size-3.5"}),o?"Copied":"Copy"]}),r.jsxs(ke,{size:"sm",variant:"outline",onClick:A,children:[r.jsx(wl,{className:"size-3.5"}),a?"Presets copied":"Runner Presets"]})]})]})]}),r.jsxs("section",{className:"mt-3",children:[r.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[r.jsx("div",{className:"text-sm font-semibold",children:"Lab recipes"}),r.jsxs("div",{className:"hidden items-center gap-1 font-mono text-[11px] text-muted-foreground sm:flex",children:[r.jsx(qc,{className:"size-3.5"}),"copy-ready workflows"]})]}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[k.map(w=>r.jsx(KR,{recipe:w,copied:c===w.id,running:E!==null&&E.recipeId===w.id&&(E.status==="queued"||E.status==="running"),onCopy:z,onRun:D},w.id)),v.isLoading&&k.length===0&&[0,1].map(w=>r.jsx("div",{className:"h-40 animate-pulse rounded-lg bg-white/[0.025] shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]"},w))]})]}),r.jsxs("section",{className:"mt-3",children:[r.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[r.jsx("div",{className:"text-sm font-semibold",children:"Runner presets"}),r.jsxs("div",{className:"hidden items-center gap-1 font-mono text-[11px] text-muted-foreground sm:flex",children:[r.jsx(zs,{className:"size-3.5"}),N]})]}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-4",children:[y.map(w=>r.jsx(GR,{preset:w},w.id)),v.isLoading&&y.length===0&&[0,1,2,3].map(w=>r.jsx("div",{className:"h-32 animate-pulse rounded-lg bg-white/[0.025] shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]"},w))]})]}),r.jsxs("section",{className:"mt-3",children:[r.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[r.jsx("div",{className:"text-sm font-semibold",children:"TonyClaw packages"}),v.isLoading&&r.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:"checking npm..."})]}),v.error!==void 0&&r.jsx("div",{className:"rounded-lg bg-red-500/8 p-3 text-xs text-red-100 shadow-[inset_0_0_0_1px_rgba(248,113,113,0.16)]",children:"Package status is temporarily unavailable."}),r.jsxs("div",{className:"grid gap-3 md:grid-cols-3",children:[b.map(w=>r.jsx(HR,{pkg:w,activeTask:E,onStartTask:L},w.id)),v.isLoading&&b.length===0&&[0,1,2].map(w=>r.jsx("div",{className:"h-36 animate-pulse rounded-lg bg-white/[0.025] shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]"},w))]})]}),h!==null&&r.jsx("div",{className:"mt-3 rounded-lg bg-red-500/8 p-3 text-xs text-red-100 shadow-[inset_0_0_0_1px_rgba(248,113,113,0.16)]",children:h}),j.length>0&&r.jsxs("section",{className:"mt-3",children:[r.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[r.jsx("div",{className:"text-sm font-semibold",children:"Recent Lab runs"}),r.jsxs("div",{className:"hidden font-mono text-[11px] text-muted-foreground sm:block",children:["last ",String(j.length)]})]}),r.jsx("div",{className:"grid gap-2 md:grid-cols-2",children:j.map(w=>r.jsx(JR,{task:w,selected:d===w.id,onSelect:$=>{f($.id),g.mutate({task:$},{revalidate:!0})}},w.id))})]}),r.jsx(VR,{task:E})]})]})]})}J({question:S().trim().min(1).max(4e3),sessionId:S().trim().min(1).optional(),providerId:S().trim().min(1).optional(),model:S().trim().min(1).optional(),logLimit:K().int().min(1).max(80).optional()});const YR=J({answer:S(),providerId:S(),providerName:S(),model:S(),protocol:Ee(["openaiResponses","openaiChat","anthropic"]),logCount:K().int().nonnegative()}),XR="Analyze the current Inspector session. What looks abnormal, slow, or likely to hang?";function QR(e){return e.openaiResponsesBaseUrl!==void 0||e.openaiBaseUrl!==void 0||e.anthropicBaseUrl!==void 0}function eI(e){return e.openaiResponsesBaseUrl!==void 0&&e.openaiResponsesBaseUrl!==""?"Responses":e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""?"Chat":"Anthropic"}function tI(e){return e.toSorted((t,n)=>{const s=t.source==="company"?0:1,o=n.source==="company"?0:1;return s!==o?s-o:t.name.localeCompare(n.name)})}function nI({currentSessionId:e,logCount:t}){const{providers:n}=Rl(),s=p.useMemo(()=>tI(n.filter(QR)),[n]),[o,i]=p.useState(XR),[a,l]=p.useState("__auto__"),[c,u]=p.useState("__auto__"),[d,f]=p.useState(""),[h,m]=p.useState(""),[v,g]=p.useState(!1),b=s.find(T=>T.id===a)?.models??[],y=o.trim()!==""&&s.length>0&&!v,k=T=>{i(T.currentTarget.value)},j=T=>{l(T),u("__auto__")},C=()=>{if(!y)return;g(!0),m(""),f("");const T={question:o.trim(),...e!==null?{sessionId:e}:{},...a!=="__auto__"?{providerId:a}:{},...c!=="__auto__"?{model:c}:{},logLimit:24};fetch("/api/pi-agent",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(T)}).then(async N=>{const P=await N.text();if(!N.ok){m(`Pi Agent failed: HTTP ${String(N.status)}`),f(P);return}const A=JSON.parse(P),z=YR.safeParse(A);if(!z.success){m("Pi Agent returned an unexpected response."),f(P);return}m(`${z.data.providerName} / ${z.data.model} / ${z.data.protocol} / ${String(z.data.logCount)} logs`),f(z.data.answer)}).catch(N=>{m(N instanceof Error?N.message:"Pi Agent request failed.")}).finally(()=>{g(!1)})};return r.jsxs("section",{className:"rounded-md bg-black/20 px-3 py-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.045)]",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(my,{className:"size-4 text-cyan-200"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-xs font-semibold text-foreground",children:"Pi Agent"}),r.jsx("div",{className:"text-[11px] text-muted-foreground",children:e===null?"Inspector-wide analysis":"Session analysis"})]})]}),r.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[r.jsxs(Ns,{value:a,onValueChange:j,children:[r.jsx(Es,{className:"h-8 border-0 bg-black/25 text-xs shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]",children:r.jsx(Ts,{placeholder:"Provider"})}),r.jsxs(As,{children:[r.jsx(ft,{value:"__auto__",children:"Auto provider"}),s.map(T=>r.jsxs(ft,{value:T.id,children:[T.name," / ",eI(T)]},T.id))]})]}),r.jsxs(Ns,{value:c,onValueChange:u,children:[r.jsx(Es,{className:"h-8 border-0 bg-black/25 text-xs shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]",children:r.jsx(Ts,{placeholder:"Model"})}),r.jsxs(As,{children:[r.jsx(ft,{value:"__auto__",children:"Auto model"}),b.map(T=>r.jsx(ft,{value:T,children:T},T))]})]})]}),r.jsx("textarea",{value:o,onChange:k,className:"mt-2 min-h-24 w-full resize-y rounded-md bg-black/25 px-3 py-2 text-xs leading-5 text-foreground outline-none shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors placeholder:text-muted-foreground focus-visible:ring-1 focus-visible:ring-ring",placeholder:"Ask Pi Agent about this session..."}),r.jsxs("button",{type:"button",onClick:C,disabled:!y,className:"mt-2 inline-flex h-8 w-full items-center justify-center gap-2 rounded-md bg-cyan-400/12 px-3 text-xs font-medium text-cyan-100 shadow-[inset_0_0_0_1px_rgba(103,232,249,0.18)] transition-colors hover:bg-cyan-400/18 disabled:cursor-not-allowed disabled:opacity-50",children:[v?r.jsx(Xe,{className:"size-3.5 animate-spin"}):r.jsx(a_,{className:"size-3.5"}),r.jsx("span",{children:v?"Thinking...":"Ask Pi"})]}),s.length===0&&r.jsx("p",{className:"mt-2 text-[11px] leading-5 text-muted-foreground",children:"Configure a Provider with Responses, Chat, or Anthropic URL to enable Pi Agent."}),h!==""&&r.jsx("p",{className:"mt-2 break-words font-mono text-[10px] text-cyan-100/70",children:h}),d!==""&&r.jsx("div",{className:"mt-3 max-h-64 overflow-y-auto whitespace-pre-wrap rounded-md bg-black/25 p-3 text-xs leading-5 text-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.05)]",children:d}),t===0&&r.jsx("p",{className:"mt-2 text-[11px] leading-5 text-muted-foreground",children:"No logs are visible in this scope yet; Pi Agent can still answer Provider setup questions."})]})}function sI(e){const t=new Map;for(const n of e){const s=n.logs;for(let o=1;o<s.length;o++){const i=s[o-1],a=s[o];i===void 0||a===void 0||t.set(a.id,{creation:bd(i.cacheCreationInputTokens,a.cacheCreationInputTokens),read:bd(i.cacheReadInputTokens,a.cacheReadInputTokens)})}}return t}function bd(e,t){return t===null||e===null?null:t>e?{direction:"up",delta:t-e}:t<e?{direction:"down",delta:e-t}:null}function $0(e){return e.filter(t=>t.responseStatus===null).length}function F0(e){for(const t of e){const n=t.userAgent;if(n!=null&&n!=="")return n}return null}function rI(e){for(const t of e){const n=t.clientPid;if(n!=null)return n}return null}function B0(e){for(const t of e){const n=t.clientProjectFolder;if(n!=null&&n!=="")return n}return null}function oI(e){return Dl({userAgent:F0(e.logs),conversationId:e.conversationId,clientProjectFolder:B0(e.logs)})}function iI(e){if(e===null||e==="")return"Unknown IDE";const t=e.split(/[ /;]/)[0]??"";return t===""?"Unknown IDE":t}function aI(e,t){const n=Qo(e);return n!==null?n:iI(t)}function Mo(e){return e===null||e===""?"unknown":String(e)}function lI(e,t,n){return e!=="unknown"?e:`unknown:${Mo(t)}:${Mo(n)}`}function cI(e,t){return`${Mo(e)}:${Mo(t)}`}function Ga(e){return[...e].sort((t,n)=>t.timestamp.localeCompare(n.timestamp))}function vd(e){return Ga(e)[0]?.timestamp??""}function ea(e){return[...e].sort((t,n)=>vd(t.logs).localeCompare(vd(n.logs)))}function uI(e){const t=new Map;for(const s of e){const o=F0(s.logs),i=B0(s.logs),a=oI(s),l=lI(a,o,i);let c=t.get(l);c===void 0&&(c={id:l,client:a,label:aI(a,o),userAgent:o,processes:new Map,logs:[]},t.set(l,c)),c.logs.push(...s.logs);const u=rI(s.logs),d=`${l}:${cI(u,i)}`;let f=c.processes.get(d);f===void 0&&(f={id:d,clientPid:u,clientProjectFolder:i,sessions:[],logs:[]},c.processes.set(d,f)),f.sessions.push(s),f.logs.push(...s.logs)}const n=[];for(const s of t.values()){const o=ea([...s.processes.values()].map(i=>({id:i.id,clientPid:i.clientPid,clientProjectFolder:i.clientProjectFolder,sessions:ea(i.sessions),logs:Ga(i.logs)})));n.push({id:s.id,client:s.client,label:s.label,userAgent:s.userAgent,processes:o,logs:Ga(s.logs)})}return ea(n)}function Lo(e){return e<=0?"0":Fe(e)}function U0(e){let t=0,n=0;for(const s of e)s.inputTokens!==null&&s.inputTokens!==void 0&&(t+=s.inputTokens),s.outputTokens!==null&&s.outputTokens!==void 0&&(n+=s.outputTokens);return{inputTokens:t,outputTokens:n}}function dI(e){let t=0;for(const n of e)t+=n.sessions.length;return t}function fI(e){if(e===null||e==="")return null;const t=e.replaceAll("\\","/").split("/").filter(o=>o!==""),n=t[t.length-1];if(n===void 0)return e;const s=t[t.length-2];return s===void 0?n:`${s}/${n}`}function Do({label:e,value:t,className:n}){return r.jsxs("span",{className:ie("bg-white/[0.045] inline-flex h-7 items-center gap-1 rounded-md px-2 text-xs text-muted-foreground",n),children:[r.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.12em] text-white/35",children:e}),r.jsx("span",{className:"font-mono tabular-nums text-slate-100",children:t})]})}function W0({count:e,label:t="Turn open"}){return r.jsxs("span",{className:"inline-flex h-6 shrink-0 items-center gap-1.5 rounded-md bg-amber-300/[0.10] px-1.5 font-mono text-[10px] uppercase tracking-[0.14em] text-amber-100/90 ring-1 ring-amber-200/10",title:`${e} turn${e!==1?"s":""} not finished yet`,children:[r.jsx(Xe,{className:"size-3 animate-spin"}),t,e>1&&r.jsxs("span",{className:"tabular-nums",children:["x",e]})]})}function H0(){return r.jsx("span",{className:"pointer-events-none absolute inset-x-3 bottom-0 h-px overflow-hidden rounded-full bg-white/[0.06]","aria-hidden":"true",children:r.jsx("span",{className:"absolute inset-y-0 left-0 w-1/3 animate-pulse rounded-full bg-amber-200/65 shadow-[0_0_14px_rgba(252,211,77,0.32)]"})})}function pI({groups:e,...t}){const n=p.useMemo(()=>uI(e),[e]),[s,o]=p.useState(()=>new Set),[i,a]=p.useState(()=>new Set),l=p.useCallback(u=>{o(d=>{const f=new Set(d);return f.has(u)?f.delete(u):f.add(u),f})},[]),c=p.useCallback(u=>{a(d=>{const f=new Set(d);return f.has(u)?f.delete(u):f.add(u),f})},[]);return r.jsx("div",{className:"space-y-4",children:n.map(u=>r.jsx(hI,{group:u,collapsed:s.has(u.id),collapsedProcessIds:i,onToggleIde:()=>l(u.id),onToggleProcess:c,conversationProps:t},u.id))})}function hI({group:e,collapsed:t,collapsedProcessIds:n,onToggleIde:s,onToggleProcess:o,conversationProps:i}){const a=U0(e.logs),l=dI(e.processes),c=e.logs.length,u=$0(e.logs),d=u>0;return r.jsxs("section",{className:ie("bg-card/75 shadow-sm relative isolate overflow-hidden rounded-[8px]",d&&"bg-card/85"),"data-ide-group":e.id,children:[r.jsxs("button",{type:"button",className:"flex w-full min-w-0 items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-white/[0.03] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/45",onClick:s,"aria-expanded":!t,children:[e.client==="unknown"?r.jsx("span",{className:"bg-white/[0.045] inline-flex size-10 shrink-0 items-center justify-center rounded-[8px] text-slate-200",children:r.jsx(Iw,{className:"size-5"})}):r.jsx(ei,{client:e.client,className:"size-10 rounded-[8px] text-cyan-100"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:"truncate text-sm font-semibold text-slate-50",title:e.userAgent??e.label,children:e.label}),r.jsx("span",{className:"rounded bg-cyan-300/[0.06] px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-[0.16em] text-cyan-100/75",children:"IDE"}),d&&r.jsx(W0,{count:u,label:"Turn open"})]}),r.jsxs("span",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[r.jsxs("span",{children:[e.processes.length," process",e.processes.length!==1?"es":""]}),r.jsxs("span",{children:[l," session",l!==1?"s":""]}),r.jsxs("span",{children:[c," log",c!==1?"s":""]})]})]}),r.jsxs("span",{className:"hidden shrink-0 items-center gap-2 md:flex",children:[r.jsx(Do,{label:"IN",value:Lo(a.inputTokens)}),r.jsx(Do,{label:"OUT",value:Lo(a.outputTokens)})]}),r.jsx("span",{className:"bg-white/[0.045] hover:bg-white/[0.075] inline-flex size-8 shrink-0 items-center justify-center rounded-md text-slate-200",children:t?r.jsx(Et,{className:"size-4"}):r.jsx(ot,{className:"size-4"})})]}),d&&r.jsx(H0,{}),!t&&r.jsx("div",{className:"space-y-3 px-3 pb-3 pt-2 sm:px-4",children:e.processes.map(f=>r.jsx(mI,{group:f,collapsed:n.has(f.id),onToggle:()=>o(f.id),conversationProps:i},f.id))})]})}function mI({group:e,collapsed:t,onToggle:n,conversationProps:s}){const o=U0(e.logs),i=fI(e.clientProjectFolder),a=e.sessions.length,l=e.logs.length,c=$0(e.logs),u=c>0,d=e.clientPid!==null&&e.clientPid!==void 0?`PID ${e.clientPid}`:"process";return r.jsxs("section",{className:"relative pl-5",children:[r.jsx("span",{className:"absolute bottom-1 left-2 top-1 w-px bg-white/[0.055]","aria-hidden":"true"}),r.jsxs("div",{className:"bg-black/[0.10] relative overflow-hidden rounded-[8px]",children:[r.jsxs("button",{type:"button",className:"flex w-full min-w-0 items-center gap-3 px-3 py-2.5 text-left transition-colors hover:bg-white/[0.035] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-cyan-300/40",onClick:n,"aria-expanded":!t,children:[r.jsx("span",{className:"bg-white/[0.045] inline-flex size-8 shrink-0 items-center justify-center rounded-md text-amber-100",children:r.jsx(Jy,{className:"size-4"})}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[r.jsx("span",{className:"font-mono text-xs font-semibold tabular-nums text-slate-100",children:d}),u&&r.jsx(W0,{count:c,label:"Turn open"}),i!==null&&r.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1 text-xs text-muted-foreground",title:e.clientProjectFolder??i,children:[r.jsx(xw,{className:"size-3 shrink-0"}),r.jsx("span",{className:"truncate font-mono",children:i})]})]}),r.jsxs("span",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[r.jsxs("span",{children:[a," session",a!==1?"s":""]}),r.jsxs("span",{children:[l," log",l!==1?"s":""]})]})]}),r.jsxs("span",{className:"hidden shrink-0 items-center gap-2 md:flex",children:[r.jsx(Do,{label:"IN",value:Lo(o.inputTokens)}),r.jsx(Do,{label:"OUT",value:Lo(o.outputTokens)})]}),r.jsx("span",{className:"bg-white/[0.045] hover:bg-white/[0.075] inline-flex size-7 shrink-0 items-center justify-center rounded-md text-slate-200",children:t?r.jsx(Et,{className:"size-4"}):r.jsx(ot,{className:"size-4"})})]}),u&&r.jsx(H0,{}),!t&&r.jsx("div",{className:"space-y-2 p-2 pt-1 sm:p-3 sm:pt-2",children:e.sessions.map(f=>r.jsx(uA,{group:f,...s,showClientIdentity:!1,showLogClientMetadata:!1,showProcessMetadata:!1},f.id))})]})]})}const $o="data-nav-id",gI="data-nav-action";function yd(e){return Array.from(e.querySelectorAll(`[${$o}]`))}function wd(e){return e instanceof HTMLElement}function xI(e,t){let n=e;for(;n!==null&&n!==t;){if(n.hasAttribute($o))return n;n=n.parentElement}return e.hasAttribute($o)?e:null}function ta(e){const t=e.getAttribute(gI);return t==="toggle"||t==="expand"||t==="collapse"?t:null}function Gs(e){e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",behavior:"smooth"})}function Ks(e,t){return e[t]??null}function V0(e){const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)}function _d(e){const t=e.tagName;return t==="BUTTON"||t==="A"||V0(e)?!0:e.closest("[role='button'],[role='menuitem'],[role='option']")!==null}function bI(e){return e.closest("[role='dialog'],[role='menu'],[role='listbox']")!==null?!0:document.querySelector("[role='dialog'],[role='menu'],[role='listbox']")!==null}function vI(){const e=window.getSelection();return e===null?!1:e.type==="Range"&&e.toString().length>0}function Kr(e,t){return e.key===t&&e.shiftKey}function yI(e,t,n={}){const s=t??e,o=n.pageWide===!0,i=p.useCallback(a=>{const l=e.current,c=s.current;if(!l||!c)return;const u=a.target;if(!wd(u)||u!==c)return;const d=yd(l),f=Ks(d,0);f!==null&&Gs(f)},[e,s]);p.useEffect(()=>{const a=l=>{if(l.altKey||l.ctrlKey||l.metaKey)return;const c=e.current;if(!c)return;const u=l.target;if(!wd(u)||V0(u)||vI())return;const d=c.contains(u);if(d&&_d(u)&&!u.hasAttribute($o)||!d&&(!o||_d(u)||bI(u)))return;const f=yd(c);if(f.length===0)return;const h=xI(u,c),m=h!==null?f.indexOf(h):-1;let v=!1;switch(l.key){case"ArrowUp":case"W":{if(l.shiftKey&&l.key==="ArrowUp"||l.key==="W"&&!Kr(l,"W"))break;l.preventDefault();const g=m>0?m-1:m===-1?f.length-1:-1;if(g!==-1){const x=Ks(f,g);x!==null&&Gs(x)}v=!0;break}case"ArrowDown":case"S":{if(l.shiftKey&&l.key==="ArrowDown"||l.key==="S"&&!Kr(l,"S"))break;l.preventDefault();const g=m<f.length-1?m+1:m===-1?0:-1;if(g!==-1){const x=Ks(f,g);x!==null&&Gs(x)}v=!0;break}case"ArrowLeft":case"A":{if(l.shiftKey&&l.key==="ArrowLeft"||l.key==="A"&&!Kr(l,"A")||h===null)break;if(l.preventDefault(),ta(h)==="collapse")h.click();else if(m>0){const x=Ks(f,m-1);x!==null&&Gs(x)}v=!0;break}case"ArrowRight":case"D":{if(l.shiftKey&&l.key==="ArrowRight"||l.key==="D"&&!Kr(l,"D")||h===null)break;if(l.preventDefault(),ta(h)==="expand")h.click();else if(m<f.length-1){const x=Ks(f,m+1);x!==null&&Gs(x)}v=!0;break}case" ":{if(h===null)break;l.preventDefault(),ta(h)!==null&&h.click(),v=!0;break}}v&&l.stopPropagation()};return document.addEventListener("keydown",a,{capture:!0}),()=>document.removeEventListener("keydown",a,{capture:!0})},[e,o,s]),p.useEffect(()=>(document.addEventListener("focusin",i),()=>document.removeEventListener("focusin",i)),[i])}const wI={system:"System",user:"User",assistant:"Assistant",tool:"Tool Results",tools:"Tool Definitions"},_I={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"},kI={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"},na=12,Jr=1,kd=80,jd=24;function jI(e){return e.length<=jd?e:`${e.slice(0,jd-3)}...`}function SI(e){const t=e.replace(/\s+/g," ").trim();return t.length<=kd?t:`${t.slice(0,kd)}...`}function Yr(e){return e>=10?`${e.toFixed(0)}%`:e>=1?`${e.toFixed(1)}%`:e>0?"<1%":"0%"}const CI=p.memo(function({segments:t,totalTokens:n,showLabels:s=!0,onActivate:o}){const i=p.useMemo(()=>n>0?n:t.reduce((x,b)=>x+b.size,0),[t,n]),a=t.slice(0,na),l=t.slice(na),c=l.reduce((x,b)=>x+b.size,0),u=l.length,d=na,f=d+u-1,h=u>0,m=o!==void 0,v=p.useMemo(()=>a.reduce((x,b)=>x+b.size,0),[a]),g=p.useMemo(()=>`Request context: ~${Fe(i)} tokens across ${t.length} segment${t.length===1?"":"s"}`,[t.length,i]);return t.length===0||i<=0?r.jsx("div",{role:"img","aria-label":g,className:"h-6"}):r.jsx(jn,{delayDuration:150,children:r.jsxs("div",{role:"img","aria-label":g,className:"flex flex-col gap-1.5",children:[r.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 y=i>0?x.size/i*100:0,k=Math.max(Jr,y),j=ie("h-full border-r border-background/80 last:border-r-0",m?"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",_I[x.role],m?kI[x.role]:""),C={width:`${k}%`},T=`${x.label}, ${Yr(y)}, ~${Fe(x.size)} tokens`;return r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:m?r.jsx("button",{type:"button",role:"button",tabIndex:0,onClick:()=>o(x),onKeyDown:N=>{(N.key==="Enter"||N.key===" ")&&(N.preventDefault(),o(x))},"data-anatomy-path":x.path,"aria-label":T,className:j,style:C}):r.jsx("span",{"aria-label":T,className:j,style:C})}),r.jsxs(dt,{side:"bottom",className:"max-w-sm text-xs p-2 space-y-0.5",children:[r.jsxs("div",{className:"font-semibold",children:[x.label," - ",Yr(y)," - ~",Fe(x.size)," ","tokens"]}),r.jsx("div",{className:"text-muted-foreground",children:wI[x.role]}),r.jsxs("div",{className:"text-muted-foreground",children:[x.characters.toLocaleString()," chars"]}),x.text.length>0&&r.jsx("div",{className:"text-muted-foreground/90 break-words whitespace-pre-wrap",children:SI(x.text)})]})]},`${x.path}-${b}`)}),h&&r.jsxs(ct,{children:[r.jsx(ut,{asChild:!0,children:r.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(Jr,c/i*100)}%`},children:["... +",u]})}),r.jsxs(dt,{side:"bottom",className:"text-xs",children:[u," more segment",u===1?"":"s"," (indices"," ",d,"-",f,")"]})]})]}),s&&r.jsxs("div",{className:"flex w-full gap-1 text-[10px] text-muted-foreground",children:[a.map((x,b)=>{const y=i>0?x.size/i*100:0,k=Math.max(Jr,y);return r.jsxs("div",{className:"flex flex-col gap-0.5 truncate",style:{width:`${k}%`},title:`${x.label} - ${Yr(y)} - ~${Fe(x.size)} tokens`,children:[r.jsx("span",{className:"truncate font-mono text-foreground/80",children:jI(x.label)}),r.jsxs("span",{className:"truncate font-mono text-muted-foreground/70",children:[Yr(y)," - ~",Fe(x.size)]})]},`label-${x.path}-${b}`)}),h&&r.jsxs("div",{className:"flex flex-col gap-0.5 truncate text-muted-foreground",style:{width:`${Math.max(Jr,c/i*100)}%`},children:[r.jsxs("span",{className:"truncate font-mono text-foreground/60",children:["... +",u]}),r.jsxs("span",{className:"truncate font-mono text-muted-foreground/60",children:["~",Fe(c)]})]})]}),v<i*.1&&r.jsx("div",{className:"h-0"})]})})}),q0=.75,Z0=.9,Ka=8e3,NI=.35,G0=40,K0=160,TI=5,EI=8,AI=18,RI=6e4,II=.7,Sd=3e3,zI=.3,Cd=160,PI=new Set(["answer","body","content","data","error","message","markdown","output","response","result","stderr","stdout","text","transcript"]),OI=["context_window","contextWindow","context_length","contextLength","max_context_length","maxContextLength","max_input_tokens","maxInputTokens"],MI=["max_tokens","maxTokens","max_completion_tokens","maxCompletionTokens","max_output_tokens","maxOutputTokens"],LI=[{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"]}],DI={system:"System",user:"User messages",assistant:"Assistant messages",tool:"Tool results",tools:"Tool definitions"};function $I(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 J0(e,t){for(const n of t){const s=$I(_e(e,n));if(s!==null)return s}return null}function FI(e){const t=_e(e,"model");if(typeof t!="string")return null;const n=t.trim();return n===""?null:n}function BI(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 UI(e,t,n=[]){const s=J0(t,OI);if(s!==null)return{tokens:s,label:"Request metadata",source:"request"};const o=j6(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 i=e.trim().toLowerCase().replace(/\s+/g,"-");for(const a of LI)if(BI(i,a))return{tokens:a.tokens,label:`${a.family} local rule`,source:"model-rule"};return{tokens:null,label:"No local rule",source:"unknown"}}function WI(e){return e<0?0:e>1?1:e}function HI(e){return e===null?"unknown":e>=Z0?"danger":e>=q0?"watch":"ok"}function VI(e,t){return e.filter(n=>n.role===t).reduce((n,s)=>n+s.size,0)}function qI(e,t){return["system","user","assistant","tool","tools"].map(s=>{const o=VI(e,s);return{role:s,label:DI[s],tokens:o,percent:t>0?o/t:0}}).filter(s=>s.tokens>0).sort((s,o)=>o.tokens-s.tokens)}function Ja(e){return e.replace(/\s+/g," ").trim().toLowerCase()}function ZI(e){const t=e.replace(/\s+/g," ").trim();return t.length<=Cd?t:`${t.slice(0,Cd-3)}...`}function GI(e){return{role:e.role,label:e.label,path:e.path,tokens:e.tokens,characters:e.characters}}function KI(e){return{role:e.role,label:e.label,path:e.path,tokens:e.size,characters:e.characters,text:e.text}}function JI(e){const t=e.trim();return t.startsWith("{")||t.startsWith("[")}function YI(e){if(!JI(e))return null;try{return JSON.parse(e)}catch{return null}}function XI(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function QI(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 e8(e){const t=QI(e);return t===null?!1:PI.has(XI(t))}function t8(e){return e.map(t=>t.startsWith("[")?t:`.${t}`).join("").replace(/^\./,"")}function n8(e,t,n){const s=ic(t);if(s<K0)return null;const o=oc(t);return o<G0?null:{role:e.role,label:`${e.label} ${t8(n)}`,path:e.path,tokens:o,characters:s,text:t}}function Ya({value:e,segment:t,path:n,depth:s,candidates:o}){if(!(o.length>=EI)&&!(s>TI)){if(typeof e=="string"){if(!e8(n))return;const i=n8(t,e,n);i!==null&&o.push(i);return}if(Array.isArray(e)){e.forEach((i,a)=>Ya({value:i,segment:t,path:[...n,`[${String(a)}]`],depth:s+1,candidates:o}));return}ac(e)&&Object.entries(e).forEach(([i,a])=>Ya({value:a,segment:t,path:[...n,i],depth:s+1,candidates:o}))}}function s8(e){const t=KI(e),n=YI(e.text);if(n===null)return[t];const s=[];Ya({value:n,segment:e,path:[],depth:0,candidates:s});const o=Ja(e.text),i=new Set([o]),a=s.filter(l=>{const c=Ja(l.text);return c===""||i.has(c)?!1:(i.add(c),!0)});return[t,...a]}function r8(e){const t=new Map;for(const s of e){const o=s8(s);for(const i of o){if(i.tokens<G0||i.characters<K0)continue;const a=Ja(i.text);if(a==="")continue;const l=t.get(a);if(l===void 0){t.set(a,{tokens:i.tokens,candidates:[i]});continue}t.set(a,{tokens:l.tokens+i.tokens,candidates:[...l.candidates,i]})}}const n=[];for(const s of t.values()){if(s.candidates.length<2)continue;const o=s.candidates[0]??null;if(o===null)continue;const i=s.tokens-o.tokens;n.push({key:`${o.path}:${o.label}:${String(s.candidates.length)}:${String(s.tokens)}`,count:s.candidates.length,totalTokens:s.tokens,repeatedTokens:i,preview:ZI(o.text),firstLabel:o.label,segments:s.candidates.map(GI)})}return n.sort((s,o)=>o.repeatedTokens-s.repeatedTokens||o.totalTokens-s.totalTokens)}function o8(e){if(e.length===0)return null;const t=e.length,n=e.reduce((o,i)=>o+i.count,0),s=e.reduce((o,i)=>o+i.repeatedTokens,0);return{kind:"duplicate",severity:s>=Ka?"danger":"watch",title:"Duplicate context",detail:`${String(n)} repeated blocks across ${String(t)} group${t===1?"":"s"}, ~${String(s)} repeated tokens.`}}function i8(e){return e.reduce((t,n)=>t+n.repeatedTokens,0)}function a8(e,t,n){const s=[],o=e.find(c=>c.role==="tools")??null;o!==null&&(o.tokens>=Ka||o.percent>=NI&&o.tokens>=Sd)&&s.push({kind:"tool-schema",severity:o.tokens>=Ka?"danger":"watch",title:"Large tool schema",detail:`Tool definitions take ${Math.round(o.percent*100)}% of request context.`});const i=e.find(c=>c.role==="system")??null;i!==null&&i.tokens>=Sd&&i.percent>=zI&&s.push({kind:"system-heavy",severity:"watch",title:"Large system prompt",detail:`System instructions take ${Math.round(i.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>=AI&&(a>=RI||l>=II)&&s.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.`}),s}function l8({risk:e,contextWindow:t,diagnostics:n,duplicateGroups:s}){let i=new Set(n.map(c=>c.kind)).size;(e==="watch"||e==="danger")&&(i+=1),t.source==="unknown"&&(i+=1);const a=n.some(c=>c.severity==="danger");return{level:e==="danger"||a?"risk":i>0?"optimizable":"ok",opportunityCount:i,reclaimableTokens:i8(s)}}function c8({segments:e,inputTokens:t,parsed:n,model:s,providers:o=[]}){const i=e.reduce((T,N)=>T+N.size,0),a=s??FI(n),l=t??i,c=J0(n,MI),u=UI(a,n,o),d=c??0,f=u.tokens===null?null:l+d,h=u.tokens===null?null:u.tokens-l,m=u.tokens===null?null:u.tokens-l-d,v=u.tokens===null||f===null?null:WI(f/u.tokens),g=qI(e,i),x=g[0]??null,b=e.filter(T=>T.role!=="tools").length,y=r8(e),k=o8(y),j=a8(g,i,b);k!==null&&j.unshift(k);const C=HI(v);return{model:a,contextWindow:u,estimatedInputTokens:l,outputReserveTokens:c,windowUsedTokens:f,remainingInputTokens:h,remainingAfterReserveTokens:m,usagePercent:v,riskLevel:C,roleUsages:g,largestRole:x,diagnostics:j,duplicateGroups:y,health:l8({risk:C,contextWindow:u,diagnostics:j,duplicateGroups:y})}}const Pz={watch:q0,danger:Z0},Nd=new WeakMap;function u8(e){return e.map(t=>{const n=t.modelMetadata?.map(s=>`${s.model}:${String(s.contextWindow??"")}`).join(",")??"";return`${t.id}:${t.updatedAt}:${t.models.join(",")}:${n}`}).join("|")}function d8(e){if(e===null)return null;try{return JSON.parse(e)}catch{return null}}function f8(e){return{role:e.role,label:e.label,size:e.tokens,characters:e.tokens*4,text:"",path:`role:${e.role}`}}function p8(e,t){const n=d8(e.rawRequestBody);if(n===null)return null;const o=Xm(lr(e)).anatomySegments(n);if(o===null)return null;const i=c8({segments:o,inputTokens:e.inputTokens??null,parsed:n,model:e.model,providers:t}),a=i.model??e.model??"Unknown model",l=i.roleUsages.map(f8);return{logId:e.id,model:a,timestamp:e.timestamp,contextWindow:i.contextWindow,estimatedInputTokens:i.estimatedInputTokens,windowUsedTokens:i.windowUsedTokens,usagePercent:i.usagePercent,riskLevel:i.riskLevel,health:i.health,diagnostics:i.diagnostics.map(c=>c.title),roleSegments:l,roleTotalTokens:l.reduce((c,u)=>c+u.size,0)}}function h8(e,t,n){const s=Nd.get(e);if(s!==void 0&&s.id===e.id&&s.rawRequestBody===e.rawRequestBody&&s.inputTokens===e.inputTokens&&s.model===e.model&&s.path===e.path&&s.apiFormat===e.apiFormat&&s.timestamp===e.timestamp&&s.providersSignature===n)return s.snapshot;const o=p8(e,t);return Nd.set(e,{id:e.id,rawRequestBody:e.rawRequestBody,inputTokens:e.inputTokens,model:e.model,path:e.path,apiFormat:e.apiFormat,timestamp:e.timestamp,providersSignature:n,snapshot:o}),o}function m8(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 Td(e){switch(e){case"danger":return 4;case"watch":return 3;case"unknown":return 2;case"ok":return 1}}function g8(e,t){const n=Td(t.latest.riskLevel)-Td(e.latest.riskLevel);if(n!==0)return n;const s=e.peak.usagePercent??-1,i=(t.peak.usagePercent??-1)-s;return i!==0?i:t.latest.logId-e.latest.logId}function x8(e,t){return e.usagePercent===null||t.usagePercent===null?null:(t.usagePercent-e.usagePercent)*100}function b8(e){for(let t=1;t<e.length;t++){const n=e[t-1],s=e[t];if(!(n===void 0||s===void 0)&&n.id>s.id)return[...e].sort((o,i)=>o.id-i.id)}return e}function v8(e,t=[]){const n=b8(e),s=u8(t),o=new Map;for(const a of n){const l=h8(a,t,s);if(l===null)continue;const c=o.get(l.model);if(c===void 0){o.set(l.model,{model:l.model,requestCount:1,first:l,latest:l,peak:l});continue}o.set(l.model,{model:c.model,requestCount:c.requestCount+1,first:c.first,latest:l,peak:m8(l,c.peak)?l:c.peak})}return{models:[...o.values()].map(a=>({model:a.model,requestCount:a.requestCount,first:a.first,latest:a.latest,peak:a.peak,trendPercent:x8(a.first,a.latest)})).sort(g8)}}function nn(e){return e.length<=30?e:`${e.slice(0,12)}...${e.slice(-12)}`}function y8(e){const t=new Map;for(const n of e)for(let s=0;s<n.logs.length;s+=1){const o=n.logs[s];o!==void 0&&t.set(o.id,s+1)}return t}function Ed(e,t){return t.get(e.id)??e.id}function w8(e){return e==="full"}function _8(e,t){const n=t>0;return{redacted:n,raw:n&&w8(e)}}function Ad(e){let t=0,n=0;for(const s of e)s.inputTokens!==null&&(t+=s.inputTokens),s.outputTokens!==null&&(n+=s.outputTokens);return{totalIn:t,totalOut:n}}function Y0(e,t){const n=e[0],s=e[e.length-1];return n===void 0||s===void 0?null:Tl(n.timestamp,s.timestamp,t)}function k8(e){for(const t of e)if(t.userAgent!==null&&t.userAgent!==void 0&&t.userAgent!=="")return t.userAgent;return null}function j8(e){return e.error!==null&&e.error!==void 0&&e.error.length>0?!0:e.responseStatus!==null&&e.responseStatus>=400}function S8(e){const t=new Set;for(const s of e)s.model!==null&&s.model.length>0&&t.add(s.model);const n=[...t].sort();return n.length===0?"Model unknown":n.length===1?n[0]??"Model unknown":`${n.length} models`}function C8(e){const t=new Set;for(const s of e)s.providerName!==null&&s.providerName!==void 0&&s.providerName.length>0&&t.add(s.providerName);const n=[...t].sort();return n.length===0?"Provider unknown":n.length===1?n[0]??"Provider unknown":`${n.length} providers`}function N8(e){if(e<1e3)return`${e}ms`;if(e<6e4){const o=e/1e3;return`${o<10?o.toFixed(1):o.toFixed(0)}s`}const t=Math.round(e/1e3),n=Math.floor(t/60),s=t%60;return`${n}m ${s}s`}function T8(e,t){return`${Fe(e)} in / ${Fe(t)} out`}function E8(e,t){if(e.length===0)return 0;if(t.length===0)return Fa(e).length;let n=0;for(const s of t)n+=Fa(s.logs).length;return n}function A8({stopReason:e,pending:t,lastFailureLogNumber:n}){if(t>0)return{label:"In flight",detail:`${t} request${t===1?"":"s"} pending`,tone:"cool"};if(n!==null&&e===null)return{label:"Error",detail:`Last failed request #${n}`,tone:"danger"};switch(e){case"end_turn":return{label:"End turn",detail:"Assistant completed the turn",tone:"neutral"};case"stop":return{label:"Stop",detail:"Model reached a stop condition",tone:"neutral"};case"length":return{label:"Output limit",detail:"Turn ended at max output tokens",tone:"watch"};case"tool_use":return{label:"Tool call",detail:"Assistant requested a tool",tone:"cool"};case null:return{label:"Unknown",detail:"No finish reason captured",tone:"neutral"}}}function R8(e){if(e===null)return!1;const t=e.toLowerCase();return t.includes("abort")||t.includes("cancel")||t.includes("client disconnected")||t.includes("stream disconnected")||t.includes("connection closed")}function I8({pending:e,failures:t,lengthStops:n,stopReason:s,lastFailure:o}){if(o!==null&&(o.status===499||R8(o.error)))return{label:"Client aborted",detail:`Request #${o.logNumber} ended before completion`,tone:"watch"};if(e>0)return{label:"In flight",detail:`${e} request${e===1?"":"s"} still running`,tone:"cool"};if(o!==null&&o.status!==null&&o.status>=500)return{label:"Provider error",detail:`Request #${o.logNumber} returned HTTP ${o.status}`,tone:"danger"};if(t>0&&o!==null)return{label:"Failed",detail:`Request #${o.logNumber} needs attention`,tone:"danger"};if(n>0||s==="length")return{label:"Output limited",detail:"Model stopped at the output token limit",tone:"watch"};switch(s){case"end_turn":case"stop":return{label:"Completed",detail:"Assistant completed normally",tone:"neutral"};case"tool_use":return{label:"Tool requested",detail:"Assistant handed off to a tool",tone:"cool"};case null:return{label:"Unknown",detail:"No terminal signal captured",tone:"neutral"}}}function z8({logs:e,conversationGroups:t,isLoading:n,timeDisplayFormat:s,slowResponseThresholdSeconds:o}){let i=0,a=0,l=0,c=0,u=0,d=0,f=null,h=null,m=null,v=null,g=null,x=0,b=0,y=0,k=null;const j=o*1e3;for(let A=0;A<e.length;A+=1){const z=e[A];if(z===void 0)continue;const D=A+1,E=op(z);E!==null&&(f=E),E==="length"&&(c+=1),j8(z)&&(i+=1,h=D,m={logNumber:D,status:z.responseStatus,error:z.error??null}),z.responseStatus===null&&(a+=1),o>0&&z.elapsedMs!==null&&z.elapsedMs>=j&&(l+=1),z.inputTokens!==null&&(u+=z.inputTokens),z.outputTokens!==null&&(d+=z.outputTokens),z.elapsedMs!==null&&(v===null||z.elapsedMs>v)&&(v=z.elapsedMs,g=D);const L=z.inputTokens??0,w=z.outputTokens??0,$=L+w;$>x&&(x=$,b=L,y=w,k=D)}const C=n||a>0&&i===0?"rolling":i>0?"failed":l>0||c>0?"watch":"clear",T=C==="rolling"?"Rolling":C==="failed"?"Failure":C==="watch"?"Watch":"Clear",N=A8({stopReason:f,pending:a,lastFailureLogNumber:h}),P=I8({pending:a,failures:i,lengthStops:c,stopReason:f,lastFailure:m});return{status:C,statusLabel:T,modelLabel:S8(e),providerLabel:C8(e),requests:e.length,turns:E8(e,t),failures:i,pending:a,slow:l,lengthStops:c,timeRange:Y0(e,s),tokenLabel:`${Fe(u)} in / ${Fe(d)} out`,finishLabel:N.label,finishDetail:N.detail,finishTone:N.tone,outcomeLabel:P.label,outcomeDetail:P.detail,outcomeTone:P.tone,slowestLabel:v===null?"n/a":N8(v),slowestDetail:g===null?"Latency pending":`Request #${g}`,heaviestDetail:k===null?"Tokens pending":`#${k} ${T8(b,y)}`}}function P8(e){switch(e){case"cool":return"text-cyan-100";case"danger":return"text-red-100";case"watch":return"text-amber-100";case"neutral":return"text-foreground"}}function O8(e){switch(e){case"rolling":return"cool";case"failed":return"danger";case"watch":return"watch";case"clear":return"neutral"}}function M8(e){return e.pending>0?`${e.pending} pending / ${e.failures} failed`:e.lengthStops>0?`${e.lengthStops} output limit / ${e.failures} failed`:`${e.failures} failed / ${e.slow} slow`}function cs({label:e,value:t,detail:n,icon:s,tone:o="neutral"}){return r.jsxs("div",{className:"min-w-0 border-t border-white/10 px-4 py-3",children:[r.jsxs("div",{className:"flex items-center gap-1 text-[10px] uppercase text-muted-foreground",children:[s,e]}),r.jsx("div",{className:ie("mt-2 font-mono text-sm font-semibold",P8(o)),children:t}),r.jsx("div",{className:"mt-1 font-mono text-[11px] leading-snug text-muted-foreground",children:n})]})}function L8({stats:e}){return e.requests===0?null:r.jsxs("div",{className:"border border-border bg-card shadow-sm mb-4 overflow-hidden rounded-[8px]",children:[r.jsx("div",{className:"px-4 py-3",children:r.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-semibold uppercase text-muted-foreground",children:[r.jsx(Dy,{className:"size-3.5 text-slate-300"}),"Flight Recorder"]}),r.jsx("div",{className:"mt-2 min-w-0 font-mono text-sm font-semibold text-foreground",children:e.modelLabel})]}),r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-4 gap-y-1 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"min-w-0 font-mono",children:e.providerLabel}),r.jsx("span",{className:"min-w-0 font-mono",children:e.timeRange??"Timeline pending"})]})]})}),r.jsxs("div",{className:"grid grid-cols-2 border-t border-white/10 md:grid-cols-3 2xl:grid-cols-6",children:[r.jsx(cs,{label:"Status",value:e.statusLabel,detail:M8(e),tone:O8(e.status)}),r.jsx(cs,{label:"Turns",value:String(e.turns),detail:e.finishLabel,icon:r.jsx(hw,{className:"size-3 text-muted-foreground"}),tone:e.finishTone}),r.jsx(cs,{label:"Requests",value:String(e.requests),detail:`${e.failures} failed / ${e.slow} slow`,icon:r.jsx(fa,{className:"size-3 text-muted-foreground"}),tone:e.failures>0?"danger":"neutral"}),r.jsx(cs,{label:"Peak",value:e.slowestLabel,detail:e.slowestDetail,icon:r.jsx(v_,{className:"size-3 text-muted-foreground"}),tone:e.slow>0?"watch":"neutral"}),r.jsx(cs,{label:"Tokens",value:e.tokenLabel,detail:e.heaviestDetail,icon:r.jsx(Nl,{className:"size-3 text-muted-foreground"})}),r.jsx(cs,{label:"Outcome",value:e.outcomeLabel,detail:e.outcomeDetail,tone:e.outcomeTone})]})]})}function D8({pinnedSessionId:e,selectedSession:t,sessions:n,logs:s}){if(e!==void 0){const a=s.filter(l=>l.sessionId===e);return a.length===0?null:{label:e,logs:a,showBackLink:!0}}if(t!=="__all__"){const a=s.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&&s.every(l=>l.sessionId===o)?{label:o,logs:[...s],showBackLink:!1}:n.length===0&&s.length>0&&s.every(a=>a.sessionId===null)?{label:"Visible requests",logs:[...s],showBackLink:!1}:null}function er(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 $8(e){return e===null?"n/a":Math.abs(e)<.1?"0%":`${e>0?"+":""}${e.toFixed(1)}%`}function Xa(e){return e===null||!Number.isFinite(e)?0:Math.min(Math.max(e*100,0),100)}function F8(e,t){if(t===null)return null;const n=Xa(e),s=Xa(t);return s<=0||Math.abs(s-n)<.5?null:s}function B8(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-cyan-300"}}function U8(e){const t=e.latest.contextWindow.tokens;return t===null?"Context window unknown":`Context window ${yp(t)}`}const W8=["score","decision","final_status","validation_pass_ratio","semantic_memory_score","opencode_exit","actual_model","run_dir","workspace","project_dir","work_dir"];function X0(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 sa(e,t){if(e===null)return null;const n=e.metadata[t];return n===void 0?null:X0(n)}function H8(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-cyan-300/25 bg-cyan-400/10 text-cyan-100":"border-border/70 bg-background/70 text-muted-foreground"}function V8(e){const t=[];for(const n of W8){const s=e.metadata[n];if(s===void 0)continue;const o=X0(s);o!==null&&t.push({key:n,value:o})}return t}function Rd({memberships:e,defaultOpen:t=!1}){const[n,s]=p.useState(t);if(e.length===0)return null;const o=e[0],i=o?.member??null,a=sa(i,"score"),l=sa(i,"decision"),c=sa(i,"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},i?.model===null||i?.model===void 0?null:{label:i.model,value:i.model}].filter(d=>d!==null&&d.label.length>0&&d.value.length>0);return r.jsxs("div",{className:"border border-border bg-card shadow-sm mb-3 rounded-[8px] text-xs",children:[r.jsxs("button",{type:"button",onClick:()=>s(d=>!d),className:"flex w-full items-center gap-3 px-3 py-2 text-left transition-colors hover:bg-white/[0.04]","aria-expanded":n,children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[r.jsx("span",{className:"font-semibold text-foreground",children:"Case File"}),o!==void 0&&r.jsx("span",{className:"truncate text-muted-foreground",title:o.groupTitle,children:o.groupTitle}),r.jsxs("span",{className:"font-mono text-[10px] uppercase text-muted-foreground",children:[e.length," group",e.length===1?"":"s"]})]}),u.length>0&&r.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=>r.jsx("span",{className:ie("rounded border px-1.5 py-0.5 font-mono text-[10px]",H8(d.value)),children:d.label},d.label))})]}),n?r.jsx(_l,{className:"size-4 shrink-0 text-muted-foreground"}):r.jsx(ot,{className:"size-4 shrink-0 text-muted-foreground"})]}),n&&r.jsx("div",{className:"space-y-2 border-t border-white/10 px-3 py-2",children:e.map(d=>{const f=d.member,h=V8(f);return r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[r.jsx("span",{className:"truncate font-medium text-foreground",title:d.groupTitle,children:d.groupTitle}),r.jsx("span",{className:"font-mono text-[10px] uppercase text-muted-foreground",children:d.groupStatus}),f.status!==null&&r.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:["member ",f.status]})]}),r.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground",children:[r.jsx("span",{className:"font-mono",title:f.sessionId,children:nn(f.sessionId)}),f.label!==null&&r.jsx("span",{children:f.label}),f.provider!==null&&r.jsx("span",{children:f.provider}),f.model!==null&&r.jsx("span",{className:"font-mono",children:f.model}),f.runId!==null&&r.jsxs("span",{className:"font-mono",title:f.runId,children:["run ",nn(f.runId)]})]}),h.length>0&&r.jsx("div",{className:"mt-2 grid gap-1 sm:grid-cols-2 xl:grid-cols-3",children:h.map(m=>r.jsxs("div",{className:"border border-border bg-muted/40 min-w-0 rounded-md px-2 py-1",children:[r.jsx("div",{className:"font-mono text-[10px] text-muted-foreground",children:m.key}),r.jsx("div",{className:"truncate font-mono text-[11px] text-foreground",title:m.value,children:m.value})]},m.key))})]},`${d.groupId}:${f.id}`)})})]})}function q8({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],s=e[e.length-1],o=n===void 0||s===void 0?"Current page":`#${n.id}-#${s.id}`;return t.total===null?`Showing ${e.length} logs (${o})`:t.total<=e.length?`Showing all ${t.total} logs`:`Showing ${e.length} of ${t.total} logs (${o})`}function Xr({label:e,title:t,icon:n,disabled:s,onClick:o}){return r.jsxs("button",{type:"button",onClick:o,disabled:s,className:"border border-input bg-background hover:bg-accent hover:text-accent-foreground inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs text-muted-foreground transition-colors hover:text-foreground disabled:cursor-not-allowed disabled:opacity-45",title:t,children:[n,r.jsx("span",{children:e})]})}function Z8(e){return`${Math.max(0,Math.ceil(e/1e3)).toString()}s`}function lo({progress:e}){const t=Math.min(1,e.elapsedMs/e.timeoutMs),n=Math.max(4,Math.round(t*100)),s=Math.max(0,e.timeoutMs-e.elapsedMs),o=t>=.75,i=[e.loadedLogs>0?`${e.loadedLogs.toString()} logs`:null,e.loadedPages>0?`${e.loadedPages.toString()} page${e.loadedPages===1?"":"s"}`:null,`${Z8(s)} before timeout`].filter(a=>a!==null);return r.jsxs("div",{className:"min-w-0 space-y-1 px-1 pb-1",children:[r.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3 font-mono text-[10px] text-muted-foreground",children:[r.jsx("span",{className:"min-w-0 truncate",children:e.label}),r.jsx("span",{className:ie("shrink-0 tabular-nums",o&&"text-amber-300"),children:i.join(" / ")})]}),r.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-white/[0.06]",children:r.jsx("div",{className:ie("h-full rounded-full transition-all duration-300",o?"bg-amber-300/80":"bg-cyan-300/70"),style:{width:`${n.toString()}%`}})})]})}function Id({logs:e,pagination:t,embedded:n=!1}){if(t===void 0)return null;const s=t.isLoading;return r.jsxs("div",{className:ie("flex min-h-9 flex-col gap-2 px-1 py-1 sm:flex-row sm:items-center",n?"border-t border-white/10 pt-2":"border border-border bg-card shadow-sm mb-3 rounded-[8px] px-2"),children:[r.jsxs("div",{className:"w-full min-w-0 px-1 font-mono text-[11px] text-muted-foreground sm:flex-1",children:[q8({logs:e,pagination:t}),t.isLoading&&e.length>0&&r.jsx("span",{className:"ml-2",children:"Loading..."}),t.loadProgress!==void 0&&r.jsx(lo,{progress:t.loadProgress})]}),r.jsxs("div",{className:"flex w-full items-center gap-1 overflow-x-auto sm:w-auto",children:[r.jsx(Xr,{label:"Oldest",title:"Load the oldest logs in this session",icon:r.jsx(Cy,{className:"size-3.5"}),disabled:s||!t.hasOlder,onClick:t.onOldest}),r.jsx(Xr,{label:"Older",title:"Load older logs",icon:r.jsx(yy,{className:"size-3.5"}),disabled:s||!t.hasOlder,onClick:t.onOlder}),r.jsx(Xr,{label:"Newer",title:"Load newer logs",icon:r.jsx(Et,{className:"size-3.5"}),disabled:s||!t.hasNewer,onClick:t.onNewer}),r.jsx(Xr,{label:"Newest",title:"Load the newest logs in this session",icon:r.jsx(Ty,{className:"size-3.5"}),disabled:s||!t.hasNewer,onClick:t.onNewest})]})]})}function G8(e){return`${e} ${e===1?"request":"requests"}`}function zd(e){return`#${String(e)}`}function Pd(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-cyan-200"}}function K8(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-cyan-300/25 bg-cyan-400/8 text-cyan-100"}}function J8(e){switch(e){case"risk":return"Risk";case"optimizable":return"Optimizable";case"ok":return"OK"}}const Y8=10,X8=80;function Q8(e){e.setAttribute("data-deep-link-highlight","true"),window.setTimeout(()=>{e.removeAttribute("data-deep-link-highlight")},1800)}function ez(e){const t=document.getElementById(`log-${String(e)}`);return t instanceof HTMLElement?(t.scrollIntoView({block:"center",behavior:"smooth"}),t.focus({preventScroll:!0}),Q8(t),!0):!1}function Q0(e){ur({logId:e,tab:"anatomy"});let t=0;const n=()=>{ur({logId:e,tab:"anatomy"}),!ez(e)&&(t+=1,t<Y8&&window.setTimeout(n,X8))};window.setTimeout(n,0)}function Od({command:e}){const[t,n]=p.useState(!1),s=p.useCallback(()=>{Tt(e).then(o=>{o&&(n(!0),setTimeout(()=>n(!1),2e3))})},[e]);return r.jsxs("div",{className:"bg-black/20 inline-flex max-w-full items-center gap-2 rounded-md px-3 py-2 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.055)]",children:[r.jsx("pre",{className:"m-0 overflow-x-auto font-mono text-sm text-cyan-200",children:e}),r.jsx("button",{type:"button",onClick:s,className:"shrink-0 cursor-pointer text-muted-foreground transition-colors hover:text-foreground","aria-label":"Copy command",children:t?r.jsx(Ge,{className:"size-4"}):r.jsx(Rt,{className:"size-4"})})]})}function ra({label:e,children:t,className:n}){return r.jsxs("section",{className:ie("bg-white/[0.028] shadow-[inset_0_1px_0_rgba(255,255,255,0.035)] rounded-[8px]",n),children:[r.jsx("div",{className:"px-3 pt-3",children:r.jsx("div",{className:"font-mono text-[10px] font-semibold uppercase tracking-[0.14em] text-white/35",children:e})}),r.jsx("div",{className:"p-3 pt-2",children:t})]})}function Qr({label:e,value:t}){return r.jsxs("div",{className:"bg-black/20 min-w-0 rounded-md px-2 py-2 shadow-[inset_0_1px_0_rgba(255,255,255,0.035)]",children:[r.jsx("div",{className:"truncate font-mono text-lg font-semibold leading-6 text-slate-100",children:t}),r.jsx("div",{className:"mt-0.5 truncate font-mono text-[10px] uppercase tracking-[0.12em] text-white/35",children:e})]})}const tz=["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 Md({compact:e,entrancePhase:t}){return e?r.jsx(Ua,{className:"size-14 text-amber-500"}):r.jsxs("span",{className:"flex shrink-0 items-end gap-1 group cursor-default","aria-hidden":"true",children:[r.jsx(Ua,{className:"size-10 text-amber-500 transition-all duration-300 group-hover:scale-125 group-hover:-translate-y-1.5"}),r.jsx("span",{className:"hidden items-end gap-0.5 sm:flex",children:dr.map((n,s)=>{const o=tz[s]??"text-amber-500",i=t==="hidden"?"opacity-0 scale-0":t==="playing"?"animate-crab-piano-pop":"";return r.jsx(n,{className:`size-5 ${o} transition-all duration-300 ease-out group-hover:scale-125 group-hover:-translate-y-1 ${i}`,style:{transitionDelay:`${s*50}ms`,...t==="playing"?{animationDelay:`${s*400}ms`}:{}}},s)})})]})}function nz({compact:e,crabEntrancePhase:t,currentSessionId:n,logCount:s}){return e?r.jsx("div",{className:"bg-white/[0.035] shadow-[inset_0_1px_0_rgba(255,255,255,0.045),0_16px_44px_rgba(0,0,0,0.18)] rounded-[8px] p-3",children:r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex min-w-fit items-start gap-3",children:[r.jsx(Md,{compact:!0,entrancePhase:t}),r.jsxs("div",{className:"min-w-fit",children:[r.jsxs("div",{className:"flex min-w-fit flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[r.jsx("span",{className:"whitespace-nowrap text-base font-bold",children:"Agent Inspector"}),r.jsxs("span",{className:"hidden shrink-0 font-mono text-[11px] font-semibold text-muted-foreground sm:inline",children:["v",ha.version]})]}),r.jsx("div",{className:"hidden text-[11px] font-semibold text-muted-foreground sm:block",children:"Local First. Evidence First."})]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[r.jsx(Gu,{}),r.jsx(Ju,{}),r.jsx(xd,{currentSessionId:n,logCount:s}),r.jsx(gd,{})]})]})}):r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-x-4 gap-y-3 pb-6",children:[r.jsx("div",{className:"min-w-10 flex-1","aria-hidden":"true"}),r.jsxs("h1",{className:"flex min-w-fit flex-col items-center gap-2 text-center",children:[r.jsxs("span",{className:"flex max-w-full flex-wrap items-end justify-center gap-x-2 gap-y-1",children:[r.jsx(Md,{compact:!1,entrancePhase:t}),r.jsxs("span",{className:"flex min-w-fit flex-wrap items-baseline justify-center gap-x-2 gap-y-0.5 pl-1",children:[r.jsx("span",{className:"whitespace-nowrap text-lg font-bold",children:"Agent Inspector"}),r.jsxs("span",{className:"shrink-0 font-mono text-xs font-semibold text-muted-foreground",children:["v",ha.version]})]}),r.jsx(da,{className:"size-4 shrink-0 text-muted-foreground/70","aria-hidden":"true"}),r.jsx(fA,{className:"size-10 shrink-0"})]}),r.jsx("span",{className:"max-w-full text-sm font-semibold text-muted-foreground",children:"Local First. Evidence First."})]}),r.jsxs("div",{className:"flex flex-1 justify-end gap-1",children:[r.jsx(Gu,{}),r.jsx(Ju,{}),r.jsx(xd,{currentSessionId:n,logCount:s}),r.jsx(gd,{})]})]})}const Jt=56,Ne=14,sz=5200,rz=2400,Ld=72,oz=156,eg="agent-inspector.detailsPanelCollapsed";function iz(){if(typeof window>"u")return!0;const e=window.localStorage.getItem(eg);return e===null||e==="1"}function xc(e){const t=Math.max(Ne,window.innerWidth-Jt-Ne),n=Math.max(Ne,window.innerHeight-Jt-Ne);return{x:Math.min(Math.max(e.x,Ne),t),y:Math.min(Math.max(e.y,Ne),n)}}function Qa(e){const t=xc(e),n=Math.max(Ne,window.innerWidth-Jt-Ne),s=Math.max(Ne,window.innerHeight-Jt-Ne),o=t.x-Ne,i=n-t.x,a=t.y-Ne,l=s-t.y,c=Math.min(o,i,a,l);return c===o?{x:Ne,y:t.y}:c===i?{x:n,y:t.y}:c===a?{x:t.x,y:Ne}:{x:t.x,y:s}}function az(){const e=Math.max(Ne,window.innerWidth-Jt-Ne),t=Math.max(Ne,window.innerHeight-Jt-Ne),n=Ne+Math.random()*(e-Ne),s=Ne+Math.random()*(t-Ne);switch(Math.floor(Math.random()*4)){case 0:return{x:Ne,y:s};case 1:return{x:e,y:s};case 2:return{x:n,y:Ne};case 3:return{x:n,y:t};default:return{x:e,y:Ne}}}function lz(e){const t=xc(e),n=Math.max(Ne,window.innerWidth-Jt-Ne),s=Math.max(Ne,window.innerHeight-Jt-Ne);return[{edge:"left",distance:t.x-Ne},{edge:"right",distance:n-t.x},{edge:"top",distance:t.y-Ne},{edge:"bottom",distance:s-t.y}].reduce((i,a)=>a.distance<i.distance?a:i).edge}function cz(e){const t=Qa(e),n=Math.max(Ne,window.innerWidth-Jt-Ne),s=Math.max(Ne,window.innerHeight-Jt-Ne),o=Ld+Math.random()*(oz-Ld),i=Math.random()>.5?1:-1;switch(lz(t)){case"left":{const l=t.y+o*i;return l<=Ne?{x:Ne,y:Ne}:l>=s?{x:Ne,y:s}:{x:Ne,y:l}}case"right":{const l=t.y+o*i;return l<=Ne?{x:n,y:Ne}:l>=s?{x:n,y:s}:{x:n,y:l}}case"top":{const l=t.x+o*i;return l<=Ne?{x:Ne,y:Ne}:l>=n?{x:n,y:Ne}:{x:l,y:Ne}}case"bottom":{const l=t.x+o*i;return l<=Ne?{x:Ne,y:s}:l>=n?{x:n,y:s}:{x:l,y:s}}}}function uz(){const[e,t]=p.useState({x:Ne,y:Ne}),[n,s]=p.useState(0),[o,i]=p.useState(!1),a=p.useRef(null);p.useEffect(()=>{t(az())},[]),p.useEffect(()=>{if(o)return;let f=null;const h=()=>{const m=sz+Math.random()*rz;f=window.setTimeout(()=>{s(v=>v+1),t(v=>cz(v)),h()},m)};return h(),()=>{f!==null&&window.clearTimeout(f)}},[o]),p.useEffect(()=>{const f=()=>{t(h=>Qa(h))};return window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[]);const l=p.useCallback(f=>{const h=f.currentTarget.getBoundingClientRect();a.current={pointerId:f.pointerId,offsetX:f.clientX-h.left,offsetY:f.clientY-h.top},f.currentTarget.setPointerCapture(f.pointerId),i(!0)},[]),c=p.useCallback(f=>{const h=a.current;h===null||h.pointerId!==f.pointerId||t(xc({x:f.clientX-h.offsetX,y:f.clientY-h.offsetY}))},[]),u=p.useCallback(f=>{const h=a.current;h===null||h.pointerId!==f.pointerId||(f.currentTarget.hasPointerCapture(f.pointerId)&&f.currentTarget.releasePointerCapture(f.pointerId),a.current=null,i(!1),t(m=>Qa(m)))},[]),d=p.useMemo(()=>({transform:`translate3d(${e.x}px, ${e.y}px, 0) rotate(${n%2===0?"-4deg":"5deg"}) scale(${o?"1.08":"1"})`,transition:o?"none":"transform 4800ms cubic-bezier(0.33, 1, 0.68, 1)",touchAction:"none"}),[o,n,e.x,e.y]);return r.jsx("button",{type:"button",className:ie("fixed left-0 top-0 z-40 flex size-14 items-center justify-center rounded-full bg-transparent text-foreground outline-none transition-[filter,opacity] duration-200 hover:opacity-95 hover:drop-shadow-[0_0_24px_rgba(245,158,11,0.36)] focus-visible:ring-1 focus-visible:ring-amber-300/55",o?"cursor-grabbing":"cursor-grab"),style:d,onPointerDown:l,onPointerMove:c,onPointerUp:u,onPointerCancel:u,"aria-label":"Floating Inspector logo",title:"Drag Inspector logo",children:r.jsxs("span",{className:ie("relative flex size-12 items-center justify-center",!o&&"floating-crab-body"),"aria-hidden":"true",children:[r.jsx(Ua,{className:"relative z-10 size-11 text-amber-500 drop-shadow-[0_0_15px_rgba(245,158,11,0.30)]"}),r.jsx("span",{className:"pointer-events-none absolute inset-x-0 bottom-0 z-0 flex items-end justify-center gap-1 text-amber-400/80",children:[0,1,2,3,4,5].map(f=>r.jsx("span",{className:ie("floating-crab-leg h-2 w-0.5 rounded-full bg-current shadow-[0_0_7px_rgba(245,158,11,0.24)]",f<3?"floating-crab-leg-left":"floating-crab-leg-right",o&&"animate-none"),style:{animationDelay:`${f%2===0?0:180}ms`}},f))})]})})}function Dd({label:e,logId:t}){return r.jsxs("button",{type:"button",onClick:()=>Q0(t),className:"inline-flex h-5 items-center rounded px-1 font-mono text-[10px] text-muted-foreground transition-colors hover:bg-white/[0.06] hover:text-foreground",title:`Open Context for ${zd(t)}`,children:[e," ",zd(t)]})}function dz({latestPercent:e,peakPercent:t,risk:n,onOpenContext:s}){const o=Xa(e),i=F8(e,t),a=t===null?`Latest context window usage ${er(e)}`:`Latest context window usage ${er(e)}, peak ${er(t)}`;return r.jsx("button",{type:"button",onClick:s,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:r.jsxs("span",{className:"relative block h-2.5 overflow-hidden rounded-full border border-white/10 bg-black/25 transition-colors group-hover:border-cyan-200/35",role:"meter","aria-label":a,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(o),children:[r.jsx("span",{className:ie("block h-full rounded-full transition-[width]",B8(n)),style:{width:`${o}%`}}),i!==null&&r.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(${i}% - 0.5px)`},"aria-hidden":"true"})]})})}function fz({summary:e}){const t=e.trendPercent,n=t===null||Math.abs(t)<.1?null:t>0?iy:ey,s=e.latest.diagnostics[0]??null,o=er(e.latest.usagePercent),i=er(e.peak.usagePercent),a=()=>{Q0(e.latest.logId)};return r.jsxs("div",{className:"grid gap-x-4 gap-y-2 border-t border-white/10 py-2 first:border-t-0 lg:grid-cols-[minmax(180px,1fr)_minmax(260px,1fr)_minmax(260px,1.4fr)]",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.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}),r.jsx("span",{className:ie("inline-flex h-5 shrink-0 items-center rounded border px-1.5 font-mono text-[10px]",K8(e.latest.health.level)),children:J8(e.latest.health.level)})]}),r.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:[r.jsx("span",{children:G8(e.requestCount)}),r.jsx("span",{children:U8(e)})]})]}),r.jsxs("div",{className:"min-w-0 space-y-2 text-xs",children:[r.jsx(dz,{latestPercent:e.latest.usagePercent,peakPercent:e.peak.usagePercent,risk:e.latest.riskLevel,onOpenContext:a}),r.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Latest"}),r.jsx("div",{className:ie("mt-0.5 font-mono",Pd(e.latest.riskLevel)),children:o}),r.jsx(Dd,{label:"Log",logId:e.latest.logId})]}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Peak"}),r.jsx("div",{className:ie("mt-0.5 font-mono",Pd(e.peak.riskLevel)),children:i}),r.jsx(Dd,{label:"Log",logId:e.peak.logId})]}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Trend"}),r.jsxs("div",{className:"mt-0.5 flex items-center gap-1 font-mono text-foreground",children:[n!==null&&r.jsx(n,{className:ie("size-3",t!==null&&t>0?"text-amber-300":"text-cyan-300")}),$8(t)]}),r.jsx("div",{className:"h-5","aria-hidden":"true"})]})]})]}),r.jsxs("div",{className:"min-w-0 space-y-1.5",children:[r.jsx(CI,{segments:e.latest.roleSegments,totalTokens:e.latest.roleTotalTokens,showLabels:!1}),r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground",children:[r.jsxs("span",{className:"font-mono",children:["~",Fe(e.latest.estimatedInputTokens)," input"]}),e.latest.windowUsedTokens!==null&&r.jsxs("span",{className:"font-mono",children:["~",Fe(e.latest.windowUsedTokens)," used"]}),s!==null&&r.jsx("span",{className:"truncate",children:s})]})]})]})}function pz({summary:e}){return e.models.length===0?null:r.jsxs("div",{className:"mt-3 border-t border-white/10 pt-2",children:[r.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-normal text-muted-foreground",children:"Session Context"}),r.jsxs("div",{className:"font-mono text-[10px] text-muted-foreground",children:[e.models.length," model",e.models.length===1?"":"s"]})]}),r.jsx("div",{className:"max-h-52 overflow-y-auto pr-1",children:e.models.map(t=>r.jsx(fz,{summary:t},t.model))})]})}function hz(e){const t=e.models.filter(s=>s.latest.health.level==="risk").length;if(t>0)return`${t} risk`;const n=e.models.filter(s=>s.latest.health.level==="optimizable").length;return n>0?`${n} optimizable`:`${e.models.length} model${e.models.length===1?"":"s"}`}function mz({label:e,logs:t,totalIn:n,totalOut:s,timeDisplayFormat:o,contextSummary:i,showBackLink:a}){const[l,c]=p.useState(!1),[u,d]=p.useState(!1),f=p.useMemo(()=>Y0(t,o),[t,o]),h=p.useMemo(()=>k8(t),[t]),m=p.useMemo(()=>hz(i),[i]),v=p.useCallback(()=>{Tt(window.location.href).then(g=>{g&&(c(!0),setTimeout(()=>c(!1),2e3))})},[]);return r.jsxs("div",{className:"border border-border bg-card shadow-sm mb-3 rounded-[8px] px-3 py-2 text-xs",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a&&r.jsx("a",{href:"/",className:"bg-white/[0.035] hover:bg-white/[0.065] inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:text-foreground","aria-label":"Back to all sessions",title:"Back to all sessions",children:r.jsx(ry,{className:"size-3.5"})}),r.jsxs("div",{className:"min-w-[180px] flex-1",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:"font-mono font-semibold text-purple-400/90 truncate",title:e,children:nn(e)}),h!==null&&r.jsx("span",{className:"font-mono text-muted-foreground truncate max-w-[220px]",title:h,children:h})]}),r.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground",children:[r.jsxs("span",{children:[t.length," request",t.length!==1?"s":""]}),f!==null&&r.jsx("span",{children:f}),(n>0||s>0)&&r.jsxs("span",{className:"font-mono",children:[Fe(n)," in / ",Fe(s)," out"]})]})]}),i.models.length>0&&r.jsxs("button",{type:"button",onClick:()=>d(g=>!g),className:"bg-white/[0.035] hover:bg-white/[0.065] inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md px-2.5 font-mono text-[11px] text-muted-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:text-foreground","aria-expanded":u,title:u?"Hide context details":"Show context details",children:[r.jsx("span",{children:m}),u?r.jsx(_l,{className:"size-3.5"}):r.jsx(ot,{className:"size-3.5"})]}),r.jsx("button",{type:"button",onClick:v,className:"bg-white/[0.035] hover:bg-white/[0.065] inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:text-foreground","aria-label":l?"Copied session link":"Copy session link",title:l?"Copied session link":"Copy session link",children:l?r.jsx(Ge,{className:"size-3.5"}):r.jsx(Rt,{className:"size-3.5"})})]}),u&&r.jsx(pz,{summary:i})]})}function gz({logs:e,sessions:t,models:n,selectedSession:s,selectedModel:o,onSessionChange:i,onModelChange:a,onClearAll:l,onDeleteCurrentView:c,onReloadSession:u,onClearGroup:d,onNotify:f,onImportLogs:h,viewMode:m,captureMode:v,strip:g,slowResponseThresholdSeconds:x,timeDisplayFormat:b,isLoading:y=!1,pagination:k,sessionLoadProgress:j,sessionMemberships:C=[],hideSessionFilter:T=!1,pinnedSessionId:N}){const{totalIn:P,totalOut:A}=p.useMemo(()=>Ad(e),[e]),{providers:z}=Rl(),[D,E]=p.useState(null),[L,w]=p.useState(null),[$,ee]=p.useState(!1),[F,W]=p.useState(null),[Z,ue]=p.useState(null),[V,H]=p.useState(!1),[le,U]=p.useState(!1),[X,Ce]=p.useState(!0),[ae,ge]=p.useState(!1),[xe,he]=p.useState(null),[be,Se]=p.useState("hidden"),Ie=p.useRef(null),_=p.useRef(null),Q=p.useRef(null),G=p.useRef(null),O=p.useRef(0);yI(Ie,_,{pageWide:!0});const R=p.useCallback(()=>{O.current+=1,G.current?.abort(),G.current=null,E(null),w(null)},[]);p.useEffect(()=>()=>{O.current+=1,G.current?.abort(),G.current=null},[]),p.useEffect(()=>{const vt=50+dr.length*400,Ot=setTimeout(()=>Se("playing"),50),_r=setTimeout(()=>Se("done"),vt);return()=>{clearTimeout(Ot),clearTimeout(_r)}},[]),p.useEffect(()=>{Ce(iz()),ge(!0)},[]),p.useEffect(()=>{ae&&window.localStorage.setItem(eg,X?"1":"0")},[X,ae]),p.useEffect(()=>{if(N===void 0){document.title="Agent Inspector";return}const Ue=e.length===1?"1 req":`${e.length} req`;document.title=`${nn(N)} - ${Ue} - Agent Inspector`},[e.length,N]);const B=p.useCallback(async Ue=>{G.current?.abort();const at=new AbortController;G.current=at;const vt=O.current+1;O.current=vt,E(Ue),w(null);try{const Ot=await J_(e,Ue,{signal:at.signal});if(O.current!==vt)return;if(!Ot.ok){if(Ot.canceled===!0)return;f!==void 0?f({message:Ot.message,tone:"error"}):w(Ot.message)}}finally{O.current===vt&&(G.current=null,E(null))}},[e,f]),se=p.useCallback(()=>{Q.current?.click()},[]),ne=p.useCallback(Ue=>{const at=Ue.currentTarget.files?.[0];Ue.currentTarget.value="",!(at===void 0||h===void 0)&&(ee(!0),ue(null),W(null),h(at).then(vt=>{const Ot=vt.skipped>0?`, skipped ${String(vt.skipped)}`:"",_r=`Imported ${String(vt.imported)} logs as ${vt.sessionId}${Ot}.`;f!==void 0?f({message:_r,tone:"success"}):W(_r)}).catch(vt=>{const Ot=vt instanceof Error?vt.message:"Failed to import logs";f!==void 0?f({message:Ot,tone:"error"}):ue(Ot)}).finally(()=>{ee(!1)}))},[h,f]);p.useEffect(()=>{R(),he(null)},[R,s,o]);const q=p.useCallback(()=>{R(),W(null),ue(null),he(null),l()},[R,l]),ce=p.useCallback(()=>{H(!0)},[]),I=p.useCallback(()=>{R(),W(null),ue(null),he(null),c!==void 0&&(U(!0),c().then(()=>{H(!1)}).catch(Ue=>{const at=Ue instanceof Error?Ue.message:"Failed to delete stored logs";f!==void 0?f({message:at,tone:"error"}):ue(at)}).finally(()=>{U(!1)}))},[R,c,f]),M=p.useCallback(()=>{u!==void 0&&(R(),W(null),ue(null),he(null),u())},[R,u]),Y=p.useCallback(()=>{he(null)},[]),re=p.useCallback(()=>{Ce(Ue=>!Ue)},[]),oe=p.useMemo(()=>j4(e),[e]),ve=p.useMemo(()=>y8(oe),[oe]),pe=p.useMemo(()=>D8({pinnedSessionId:N,selectedSession:s,sessions:t,logs:e}),[e,N,s,t]),me=pe?.logs??[],Re=pe!==null&&me.length>0,{totalIn:$e,totalOut:Bt}=p.useMemo(()=>Ad(me),[me]),Rn=p.useMemo(()=>v8(me,z),[me,z]),xt=p.useMemo(()=>sI(oe),[oe]),it=p.useMemo(()=>vE(oe),[oe]),en=_8(v,e.length),Fs=N!==void 0,Be=e.length>0,St=c!==void 0&&(e.length>0||s!=="__all__"),et=s==="__all__"?"all sessions":"this session",Ut=s==="__all__"?"Deletes every stored log, streaming chunk, and session archive entry across all sessions.":"Deletes every stored log, streaming chunk, and session archive entry for this session, including history that is not currently loaded.",bt=e.length===0?"Load":"Reload",Qn=s==="__all__"?"":s,vc=s==="__all__"||t.includes(s)?s:"__typed__",wi=Re&&pe!==null?nn(pe.label):s==="__all__"?"All sessions":nn(s),ng=p.useMemo(()=>z8({logs:e,conversationGroups:oe,isLoading:y,timeDisplayFormat:b,slowResponseThresholdSeconds:x}),[oe,y,e,x,b]),sg=p.useCallback(Ue=>{const at=it.get(Ue.id);at!==void 0&&he([at,Ue])},[it]),rg=p.useCallback(Ue=>{const at=Ue.currentTarget.value.trim();i(at===""?"__all__":at)},[i]),og=p.useCallback(Ue=>{Ue!=="__typed__"&&i(Ue)},[i]),yc=N!==void 0?N:s==="__all__"?null:s;return r.jsxs("div",{className:"bg-background min-h-screen w-full text-foreground",children:[r.jsxs("button",{type:"button",onClick:re,className:ie("group fixed top-1/2 right-3 z-40 inline-flex h-14 w-7 -translate-y-1/2 items-center justify-center rounded-l-md border border-white/[0.08] bg-background/90 text-muted-foreground shadow-[0_12px_34px_rgba(0,0,0,0.26),inset_0_1px_0_rgba(255,255,255,0.06)] backdrop-blur transition-[right,background-color,color,border-color] duration-200 hover:border-white/[0.16] hover:bg-white/[0.07] hover:text-foreground focus-visible:ring-1 focus-visible:ring-ring focus-visible:outline-none",X?"right-3":"lg:right-[326px] xl:right-[346px]"),"aria-label":X?"Show details panel":"Hide details panel",title:X?"Show details panel":"Hide details panel",children:[r.jsx("span",{className:"absolute left-1 top-2 bottom-2 w-px rounded-full bg-white/[0.16] transition-colors group-hover:bg-white/[0.28]"}),X?r.jsx(Hw,{className:"size-3.5"}):r.jsx(Uw,{className:"size-3.5"})]}),X&&r.jsx(uz,{}),r.jsxs("div",{className:ie("grid min-h-screen w-full grid-cols-1",X?"lg:grid-cols-[minmax(0,1fr)]":"lg:grid-cols-[minmax(0,1fr)_340px] xl:grid-cols-[minmax(0,1fr)_360px]"),children:[!X&&r.jsx("aside",{className:"bg-background/95 order-1 border-b border-white/[0.045] lg:sticky lg:top-0 lg:order-2 lg:h-screen lg:overflow-y-auto lg:border-b-0 lg:border-l lg:border-white/[0.055]",children:r.jsxs("div",{className:"space-y-4 p-4",children:[r.jsx(nz,{compact:!0,crabEntrancePhase:be,currentSessionId:yc,logCount:e.length}),r.jsxs(ra,{label:"Session",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsx(Qr,{label:"Requests",value:e.length}),r.jsx(Qr,{label:"Sessions",value:t.length}),r.jsx(Qr,{label:"Input",value:Fe(Re?$e:P)}),r.jsx(Qr,{label:"Output",value:Fe(Re?Bt:A)})]}),j!==void 0&&r.jsx("div",{className:"mt-2 rounded-md bg-black/20 px-2 py-2 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.045)]",children:r.jsx(lo,{progress:j})})]}),r.jsx(ra,{label:"Workspace",children:r.jsxs("div",{className:"bg-black/20 rounded-md px-3 py-2 shadow-[inset_0_1px_0_rgba(255,255,255,0.035)]",children:[r.jsx("div",{className:"truncate font-mono text-xs font-semibold text-cyan-100",title:wi,children:wi}),r.jsx("div",{className:"mt-1 text-[11px] text-muted-foreground",children:Fs?"Session workspace":"Live workspace"})]})}),r.jsx(nI,{currentSessionId:yc,logCount:e.length}),Re&&pe!==null&&r.jsx(mz,{label:pe.label,logs:me,totalIn:$e,totalOut:Bt,timeDisplayFormat:b,contextSummary:Rn,showBackLink:pe.showBackLink}),Re&&N!==void 0&&C.length>0&&r.jsx(Rd,{memberships:C}),r.jsx(ra,{label:"Filters",children:r.jsxs("div",{className:"space-y-2",children:[!T&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative",children:[r.jsx(tp,{className:"pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),r.jsx("input",{type:"search",value:Qn,onChange:rg,placeholder:"Paste session ID",className:"bg-black/25 hover:bg-white/[0.045] focus-visible:ring-ring h-9 w-full rounded-md px-8 font-mono text-xs text-foreground outline-none shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors placeholder:font-sans placeholder:text-muted-foreground focus-visible:ring-1","aria-label":"Filter by session ID",title:"Filter by exact session ID"}),Qn!==""&&r.jsx("button",{type:"button",onClick:()=>i("__all__"),className:"absolute right-1.5 top-1/2 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-white/[0.06] hover:text-foreground","aria-label":"Clear session filter",title:"Clear session filter",children:r.jsx(gr,{className:"size-3.5"})})]}),r.jsxs(Ns,{value:vc,onValueChange:og,children:[r.jsx(Es,{className:"bg-black/25 hover:bg-white/[0.045] h-9 w-full border-0 text-xs text-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]",children:r.jsx(Ts,{placeholder:"All sessions"})}),r.jsxs(As,{children:[r.jsx(ft,{value:"__all__",children:"All sessions"}),vc==="__typed__"&&r.jsxs(ft,{value:"__typed__",children:["Typed: ",nn(s)]}),t.map(Ue=>r.jsx(ft,{value:Ue,children:nn(Ue)},Ue))]})]})]}),r.jsxs(Ns,{value:o,onValueChange:a,children:[r.jsx(Es,{className:"bg-black/25 hover:bg-white/[0.045] h-9 w-full border-0 text-xs text-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]",children:r.jsx(Ts,{placeholder:"All models"})}),r.jsxs(As,{children:[r.jsx(ft,{value:"__all__",children:"All models"}),n.map(Ue=>r.jsx(ft,{value:Ue,children:Ue},Ue))]})]})]})})]})}),r.jsxs("main",{className:"order-2 min-w-0 lg:order-1",children:[r.jsxs("div",{className:"bg-background/95 shadow-[0_12px_36px_rgba(0,0,0,0.18),inset_0_-1px_0_rgba(255,255,255,0.045)] sticky top-0 z-30 px-4 py-3 lg:px-5",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("div",{className:"min-w-[180px] flex-1",children:[r.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Logs"}),r.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-muted-foreground",children:wi})]}),h!==void 0&&r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:Q,type:"file",accept:".zip,.json,.jsonl,application/zip,application/json",className:"hidden",onChange:ne}),r.jsx("button",{type:"button",onClick:se,disabled:$,className:"bg-white/[0.035] hover:bg-white/[0.065] inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs text-muted-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",title:"Import Agent Inspector export",children:$?r.jsx("span",{children:"Importing..."}):r.jsxs(r.Fragment,{children:[r.jsx(np,{className:"size-3.5"}),r.jsx("span",{children:"Import"})]})})]}),en.redacted&&r.jsx("button",{type:"button",onClick:()=>{B("redacted")},disabled:D!==null,className:"bg-white/[0.035] hover:bg-white/[0.065] inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs text-muted-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",title:"Export redacted logs as JSON ZIP",children:D==="redacted"?r.jsx("span",{children:"Exporting..."}):r.jsxs(r.Fragment,{children:[r.jsx(mr,{className:"size-3.5"}),r.jsx("span",{children:"Export"})]})}),en.raw&&r.jsx("button",{type:"button",onClick:()=>{B("raw")},disabled:D!==null,className:"bg-white/[0.035] hover:bg-white/[0.065] inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs text-muted-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",title:"Export raw logs without redaction",children:D==="raw"?r.jsx("span",{children:"Exporting..."}):r.jsxs(r.Fragment,{children:[r.jsx(rw,{className:"size-3.5"}),r.jsx("span",{children:"Raw"})]})}),u!==void 0&&r.jsxs("button",{type:"button",onClick:M,disabled:y,className:"bg-white/[0.035] hover:bg-white/[0.065] inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs text-muted-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",title:"Reload this session from stored logs",children:[r.jsx(yn,{className:ie("size-3.5",y&&"animate-spin")}),r.jsx("span",{children:bt})]}),r.jsxs("button",{type:"button",onClick:q,disabled:!Be,className:"bg-white/[0.035] hover:bg-white/[0.065] inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs text-muted-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",title:"Clear the current view. Stored logs remain reloadable.",children:[r.jsx(wn,{className:"size-3.5"}),r.jsx("span",{children:"Clear"})]}),c!==void 0&&r.jsxs("button",{type:"button",onClick:ce,disabled:!St||le,className:"bg-red-500/[0.07] hover:bg-red-500/[0.12] inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs text-red-200 shadow-[inset_0_0_0_1px_rgba(248,113,113,0.14)] transition-colors hover:text-red-100 disabled:cursor-not-allowed disabled:opacity-50",title:"Delete persisted history for the selected session.",children:[r.jsx(wn,{className:"size-3.5"}),r.jsx("span",{children:"Delete"})]})]}),k===void 0&&j!==void 0&&r.jsx("div",{className:"mt-2 rounded-md bg-black/20 px-2 py-2 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.045)]",children:r.jsx(lo,{progress:j})}),r.jsx(Id,{logs:e,pagination:k,embedded:!0}),f===void 0&&L!==null&&r.jsx("div",{className:"mt-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:L}),f===void 0&&Z!==null&&r.jsx("div",{className:"mt-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:Z}),f===void 0&&F!==null&&Z===null&&r.jsx("div",{className:"mt-2 rounded-md border border-cyan-400/25 bg-cyan-500/10 px-3 py-2 text-xs text-cyan-100",children:F})]}),r.jsxs("div",{className:"px-4 py-4 lg:px-5",children:[r.jsx(L8,{stats:ng}),e.length===0?s!=="__all__"?r.jsx("div",{className:"py-16 text-center text-muted-foreground",children:r.jsxs("div",{className:"bg-white/[0.035] shadow-[inset_0_1px_0_rgba(255,255,255,0.045),0_18px_52px_rgba(0,0,0,0.18)] mx-auto max-w-xl space-y-4 rounded-[8px] px-4 py-8",children:[r.jsx("p",{className:"text-sm font-medium",children:y?"Loading session data...":"No logs loaded for this session"}),r.jsx("p",{className:"inline-block max-w-full rounded bg-muted px-3 py-1 font-mono text-xs break-all",children:nn(s)}),j!==void 0&&r.jsx("div",{className:"mx-auto max-w-md rounded-md bg-black/20 px-2 py-2 text-left shadow-[inset_0_0_0_1px_rgba(255,255,255,0.045)]",children:r.jsx(lo,{progress:j})}),C.length>0&&r.jsx("div",{className:"text-left",children:r.jsx(Rd,{memberships:C})}),!y&&r.jsxs("div",{className:"flex flex-col items-center gap-3 text-xs",children:[r.jsx("p",{children:"Stored logs may still be available."}),r.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[u!==void 0&&r.jsxs("button",{type:"button",onClick:M,className:"bg-white/[0.045] hover:bg-white/[0.075] inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs text-muted-foreground shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:text-foreground",children:[r.jsx(yn,{className:"size-3.5"}),r.jsx("span",{children:"Load session"})]}),T?r.jsx("a",{href:"/",className:"inline-flex h-8 items-center rounded-md px-3 text-xs text-muted-foreground underline transition-colors hover:text-foreground",children:"Back to all sessions"}):r.jsx("button",{type:"button",onClick:()=>i("__all__"),className:"inline-flex h-8 items-center rounded-md px-3 text-xs text-muted-foreground underline transition-colors hover:text-foreground",children:"Show all sessions"})]})]})]})}):r.jsx("div",{className:"py-16 text-center text-muted-foreground",children:r.jsxs("div",{className:"bg-white/[0.035] shadow-[inset_0_1px_0_rgba(255,255,255,0.045),0_18px_52px_rgba(0,0,0,0.18)] mx-auto max-w-2xl space-y-4 rounded-[8px] px-4 py-8",children:[r.jsx("p",{className:"text-sm",children:"No logs loaded in the current view."}),t.length>0&&r.jsx("p",{className:"mx-auto max-w-xl text-xs leading-relaxed text-muted-foreground",children:"Pick a session from the filter panel to load stored logs on demand."}),r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx(Od,{command:"ANTHROPIC_BASE_URL=http://localhost:9527/proxy <your-tool>"}),r.jsx(Od,{command:"OPENAI_BASE_URL=http://localhost:9527/proxy <your-tool>"})]}),r.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."})]})}):r.jsxs("div",{ref:_,tabIndex:0,className:"flex flex-col gap-2 focus:outline-none",children:[r.jsx("div",{ref:Ie,children:r.jsx(pI,{groups:oe,viewMode:m,strip:g,slowResponseThresholdSeconds:x,cacheTrends:xt,onCompareWithPrevious:sg,comparisonPredecessors:it,onClearGroup:d,defaultExpanded:oe.length===1,timeDisplayFormat:b})}),r.jsx("div",{className:"mt-3",children:r.jsx(Id,{logs:e,pagination:k})})]})]})]})]}),r.jsx(Gn,{open:V,onOpenChange:H,children:r.jsxs(Kn,{className:"border-red-500/20 bg-zinc-950 text-zinc-100 sm:max-w-md",children:[r.jsxs(Jn,{children:[r.jsxs(Yn,{children:["Delete ",et," history?"]}),r.jsx(Xp,{children:"Clear only hides logs from the UI. Delete removes stored history from disk."})]}),r.jsxs("div",{className:"rounded-md bg-red-500/[0.08] px-3 py-3 text-sm text-red-100 shadow-[inset_0_0_0_1px_rgba(248,113,113,0.16)]",children:[r.jsx("span",{className:"block font-medium",children:"This is a full history delete."}),r.jsx("span",{className:"mt-1 block text-xs text-red-200/80",children:Ut})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ke,{type:"button",variant:"outline",size:"sm",disabled:le,onClick:()=>H(!1),children:"Cancel"}),r.jsx(ke,{type:"button",variant:"destructive",size:"sm",disabled:le,onClick:I,children:le?"Deleting...":"Delete history"})]})]})}),xe!==null&&r.jsx(p.Suspense,{fallback:null,children:r.jsx(dT,{left:xe[0],right:xe[1],leftDisplayNumber:Ed(xe[0],ve),rightDisplayNumber:Ed(xe[1],ve),onClose:Y})})]})}const xz=Yt([J({type:Ae("init"),logs:fe(rr)}),J({type:Ae("update"),log:rr})]),bz=J({logs:fe(rr),total:K().int().nonnegative(),limit:K().int().positive(),hasOlder:Le(),hasNewer:Le(),oldestLogId:K().int().positive().nullable(),newestLogId:K().int().positive().nullable()}),vz=fe(S()),$d=J({success:Le(),cleared:K().int().nonnegative(),logFilesRewritten:K().int().nonnegative().optional(),chunkFilesDeleted:K().int().nonnegative(),sessionArchiveLogsDeleted:K().int().nonnegative().optional()});function yz(e,t){const n=[];for(const s of e)for(const o of s.members)o.sessionId===t&&n.push({groupId:s.id,groupTitle:s.title,groupKind:s.kind,groupStatus:s.status,groupTask:s.task,groupProject:s.project,groupEvidence:s.evidence,member:o});return n}function eo(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function wz(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function _z(e,t,n){return t==="__all__"&&n==="__all__"?e:e.filter(s=>!(t!=="__all__"&&s.sessionId!==t||n!=="__all__"&&s.model!==n))}const kz=100,jz=12,Sz=1800,bc=100,Fo=500,tg=200,el=2e4,Cz=1e4;function Nz(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 Tz(e,t,n=bc){const s=new URLSearchParams({cursor:"1",compact:"1",limit:String(n),sessionId:e});switch(t.kind){case"oldest":s.set("anchor","oldest");break;case"older":s.set("beforeLogId",String(t.beforeLogId));break;case"newer":s.set("afterLogId",String(t.afterLogId));break}return`/api/logs?${s.toString()}`}function hn(e){const t=new Map;for(let n=0;n<e.length;n++){const s=e[n];s!==void 0&&t.set(s.id,n)}return t}function tr(e,t,n=bc){return Ke(Tz(e,t,n),bz,el)}async function Ez(e,t){const n=new Set;let s=await tr(e,{kind:"oldest"},Fo);for(const i of s.logs)n.add(i.id);t(n.size,1);let o=1;for(;s.hasNewer&&s.newestLogId!==null&&o<tg;){s=await tr(e,{kind:"newer",afterLogId:s.newestLogId},Fo);for(const i of s.logs)n.add(i.id);o+=1,t(n.size,o)}return{ids:[...n],truncated:s.hasNewer}}async function Az(){try{return{deleted:(await ht("/api/groups",Bf,{method:"DELETE"})).deleted,ok:!0}}catch{return{deleted:0,ok:!1}}}function to(e,t){if(t.length===0)return[...e];const n=new Map;for(const s of e)n.set(s.id,s);for(const s of t)n.set(s.id,s);return[...n.values()].sort((s,o)=>s.id-o.id)}function Mn(e,t){const n=new Set;for(const s of e)s!==""&&n.add(s);for(const s of t)s!==""&&n.add(s);return[...n].sort()}function Oz({initialSessionId:e}={}){const[t,n]=p.useState([]),[s,o]=p.useState(e??"__all__"),[i,a]=p.useState("__all__"),[l,c]=p.useState([]),{notice:u,showToast:d,dismissToast:f}=k0(),[h,m]=p.useState(e===void 0),[v,g]=p.useState(null),[x,b]=p.useState(e!==void 0),[y,k]=p.useState(void 0),[j,C]=p.useState([]),[,T]=p.useTransition(),N=p.useRef(null),P=p.useRef(null),A=p.useRef(null),z=p.useRef(0),D=p.useRef(null),E=p.useRef(null),L=p.useRef(new Map),w=p.useRef([]),$=p.useRef(null),ee=p.useCallback(I=>{d({message:I,tone:"error"})},[d]),F=p.useCallback(()=>{E.current!==null&&(clearInterval(E.current),E.current=null),D.current=null,k(void 0)},[]),W=p.useCallback((I,M,Y=0,re=0)=>{E.current!==null&&clearInterval(E.current);const oe=Date.now();D.current=oe;const ve=()=>{z.current===M&&k({label:I,elapsedMs:Date.now()-oe,timeoutMs:el,loadedLogs:Y,loadedPages:re})};ve(),E.current=setInterval(ve,250)},[]),Z=p.useCallback((I,M,Y,re)=>{const oe=D.current;oe===null||z.current!==M||k({label:I,elapsedMs:Date.now()-oe,timeoutMs:el,loadedLogs:Y,loadedPages:re})},[]),ue=p.useMemo(()=>_z(t,s,i),[t,s,i]),V=p.useMemo(()=>Mn(l,eo(t)),[t,l]),H=p.useMemo(()=>wz(t),[t]),le=p.useCallback(()=>{ht("/api/sessions",vz).then(I=>{c(M=>Mn(M,I))}).catch(()=>{})},[]),U=p.useCallback(()=>{$.current=null;const I=w.current;w.current=[],I.length!==0&&T(()=>{n(M=>{const Y=to(M,I);return L.current=hn(Y),Y})})},[T]),X=p.useCallback(I=>{w.current.push(I),$.current===null&&($.current=setTimeout(U,kz))},[U]),Ce=p.useCallback(()=>{N.current&&N.current.close(),m(!1);const I=new EventSource(Nz(e));N.current=I,I.onmessage=M=>{try{const Y=String(M.data),re=JSON.parse(Y),oe=xz.safeParse(re);if(!oe.success){ee("Failed to parse SSE data");return}const ve=oe.data;ve.type==="init"?($.current!==null&&(clearTimeout($.current),$.current=null),w.current=[],n(pe=>{const me=to(pe,ve.logs);return L.current=hn(me),me}),c(pe=>Mn(pe,eo(ve.logs))),m(!0),f()):ve.type==="update"&&(c(pe=>ve.log.sessionId===null||ve.log.sessionId===""?pe:Mn(pe,[ve.log.sessionId])),X(ve.log))}catch{ee("Failed to parse SSE data")}},I.onerror=()=>{ee("SSE connection lost, reconnecting..."),m(!0),I.close(),P.current!==null&&clearTimeout(P.current),P.current=setTimeout(Ce,3e3)}},[f,e,X,ee]),ae=p.useCallback(I=>{if(e===void 0)return;const M=z.current+1;z.current=M,b(!0),W("Loading session logs",M),f(),tr(e,I).then(Y=>{if(z.current!==M)return;const re=Y.logs;L.current=hn(re),n(re),g(Y),o(e),b(!1),F(),f()}).catch(Y=>{z.current===M&&(n([]),g(null),b(!1),F(),ee(Y instanceof Error?Y.message:"Failed to load session logs"))})},[f,e,ee,W,F]),ge=p.useCallback(I=>{const M=z.current+1;z.current=M,b(!0),W("Reloading full session",M),f(),(async()=>{const Y=[];let re=await tr(I,{kind:"oldest"},Fo);Y.push(...re.logs),Z("Reloading full session",M,Y.length,1);let oe=1;for(;re.hasNewer&&re.newestLogId!==null&&oe<tg;)re=await tr(I,{kind:"newer",afterLogId:re.newestLogId},Fo),Y.push(...re.logs),oe+=1,Z("Reloading full session",M,Y.length,oe);z.current===M&&(n(ve=>{const pe=to(ve,Y);return L.current=hn(pe),pe}),c(ve=>Mn(ve,[I])),b(!1),F(),re.hasNewer?d({message:`Loaded ${String(Y.length)} logs for this session. More history is available.`,tone:"success"}):f())})().catch(Y=>{z.current===M&&(b(!1),F(),ee(Y instanceof Error?Y.message:"Failed to reload session logs"))})},[f,ee,d,W,F,Z]);p.useEffect(()=>{if(e===void 0){C([]);return}let I=!1;return Ke("/api/groups",Hf,Cz).then(M=>M.groups).then(M=>{I||M===null||C(yz(M,e))}).catch(()=>{I||C([])}),()=>{I=!0}},[e]),p.useEffect(()=>{le()},[le]),p.useEffect(()=>()=>{F()},[F]),p.useEffect(()=>{e!==void 0&&ae({kind:"newest"})},[e,ae]),p.useEffect(()=>{e===void 0&&s!=="__all__"&&ge(s)},[e,ge,s]),p.useEffect(()=>{if(e===void 0)return Ce(),()=>{N.current&&(N.current.close(),N.current=null),P.current!==null&&(clearTimeout(P.current),P.current=null),$.current!==null&&(clearTimeout($.current),$.current=null)}},[Ce,e]),p.useEffect(()=>{const I=window.location.hash;if(!I.startsWith("#log-")||A.current===I)return;const M=I.slice(1),Y=Number(M.replace(/^log-/,""));Number.isInteger(Y)&&Y>0&&ur({logId:Y,tab:"request"});let re=!1,oe=0,ve=null,pe=null;const me=()=>{if(re)return;const Re=document.getElementById(M);if(Re!==null){A.current=I,Re.scrollIntoView({block:"center",behavior:"smooth"}),Re instanceof HTMLElement&&(ve=Re,Re.setAttribute("data-deep-link-highlight","true"),pe=window.setTimeout(()=>{Re.removeAttribute("data-deep-link-highlight")},Sz),Re.focus({preventScroll:!0}),Re.getAttribute("data-nav-action")==="expand"&&Re.click());return}oe+=1,oe<jz&&window.setTimeout(me,100)};return me(),()=>{re=!0,pe!==null&&window.clearTimeout(pe),ve!==null&&ve.removeAttribute("data-deep-link-highlight")}},[ue.length]);const xe=p.useCallback(()=>{const I=eo(t);F(),b(!1),L.current.clear(),n([]),g(null),c(M=>Mn(M,I)),d({message:"Cleared the current view. Stored logs are still reloadable.",tone:"success"})},[t,d,F]),he=p.useCallback(I=>{if(I.length===0)return;const M=new Set(I);n(Y=>{const re=Y.filter(ve=>M.has(ve.id)),oe=Y.filter(ve=>!M.has(ve.id));return c(ve=>Mn(ve,eo(re))),L.current=hn(oe),oe}),d({message:"Cleared this group from the current view.",tone:"success"})},[d]),be=p.useCallback(async()=>{const I=z.current+1;z.current=I,b(!0),F(),f();try{if(s==="__all__"){W("Deleting stored history",I);const pe=await ht("/api/logs",$d,{method:"DELETE"}),me=await Az();if(z.current!==I)return;n([]),L.current.clear(),g(null),c([]),C([]),b(!1),F();const Re=me.ok?` Cleared ${me.deleted.toString()} group${me.deleted===1?"":"s"}.`:" Group cleanup failed; open Groups to retry Clear.";d({message:`Deleted ${pe.cleared.toString()} stored log${pe.cleared===1?"":"s"} across all sessions.${Re}`,tone:me.ok?"success":"error"});return}const M=s;W("Deleting session history",I);const Y=await Ez(M,(pe,me)=>{Z("Deleting session history",I,pe,me)}),re=new Set(Y.ids);for(const pe of t)pe.sessionId===M&&re.add(pe.id);const oe=[...re].filter(pe=>Number.isInteger(pe)&&pe>=0);if(oe.length===0){if(z.current!==I)return;n(pe=>{const me=pe.filter(Re=>Re.sessionId!==M);return L.current=hn(me),me}),g(pe=>pe===null?null:{...pe,logs:pe.logs.filter(me=>me.sessionId!==M)}),c(pe=>pe.filter(me=>me!==M)),b(!1),F(),d({message:"No stored log records were found for this session.",tone:"success"});return}const ve=await ht("/api/logs",$d,{method:"DELETE",headers:{"content-type":"application/json"},body:JSON.stringify({ids:oe})});if(z.current!==I)return;n(pe=>{const me=pe.filter(Re=>Re.sessionId!==M);return L.current=hn(me),me}),g(pe=>pe===null?null:{...pe,logs:pe.logs.filter(me=>me.sessionId!==M)}),c(pe=>pe.filter(me=>me!==M)),b(!1),F(),d({message:`Deleted ${ve.cleared.toString()} stored log${ve.cleared===1?"":"s"} for this session${Y.truncated?". More history may remain.":"."}`,tone:Y.truncated?"error":"success"})}finally{z.current===I&&(b(!1),F())}},[t,f,s,d,W,F,Z]),Se=p.useCallback(()=>{if(e!==void 0){ae({kind:"newest"});return}if(s==="__all__"){le();return}ge(s)},[e,ae,le,ge,s]),Ie=p.useCallback(async I=>{const M=new FormData;M.set("file",I);const Y=await ht("/api/logs/import",W2,{method:"POST",body:M});return n(re=>{const oe=new Set(Y.logs.map(pe=>pe.id)),ve=to(re.filter(pe=>!oe.has(pe.id)),Y.logs);return L.current=hn(ve),ve}),o(Y.sessionId),a("__all__"),g(null),f(),Y},[f]),{strip:_,captureMode:Q,slowResponseThresholdSeconds:G,timeDisplayFormat:O}=yl(),R=Q,B=p.useCallback(()=>{ae({kind:"oldest"})},[ae]),se=p.useCallback(()=>{ae({kind:"newest"})},[ae]),ne=p.useCallback(()=>{const I=t[0],M=v?.oldestLogId??I?.id??null;M!==null&&ae({kind:"older",beforeLogId:M})},[t,ae,v]),q=p.useCallback(()=>{const I=t[t.length-1],M=v?.newestLogId??I?.id??null;M!==null&&ae({kind:"newer",afterLogId:M})},[t,ae,v]),ce=p.useMemo(()=>{if(e!==void 0)return{isLoading:x,loadProgress:y,total:v?.total??null,pageSize:v?.limit??bc,hasOlder:v?.hasOlder??!1,hasNewer:v?.hasNewer??!1,oldestLogId:v?.oldestLogId??null,newestLogId:v?.newestLogId??null,onOldest:B,onOlder:ne,onNewer:q,onNewest:se}},[e,se,q,ne,B,v,y,x]);return r.jsxs(r.Fragment,{children:[r.jsx(j0,{notice:u,onDismiss:f}),r.jsx(z_,{}),r.jsx(gz,{logs:ue,sessions:V,models:H,selectedSession:s,selectedModel:i,onSessionChange:o,onModelChange:a,onClearAll:xe,onDeleteCurrentView:be,onReloadSession:e!==void 0||s!=="__all__"?Se:void 0,onClearGroup:he,onNotify:d,onImportLogs:e===void 0?Ie:void 0,isLoading:e===void 0&&!h||x,pagination:ce,sessionLoadProgress:y,sessionMemberships:j,viewMode:R,captureMode:Q,strip:_,slowResponseThresholdSeconds:G,timeDisplayFormat:O,hideSessionFilter:e!==void 0,pinnedSessionId:e})]})}export{zz as $,J as A,Me as B,Zy as C,Gn as D,K as E,fe as F,ur as G,Vo as H,Le as I,S as J,rr as K,gT as L,Xf as M,c8 as N,jw as O,Oz as P,_I as Q,e_ as R,CI as S,o0 as T,wI as U,yp as V,Pz as W,gr as X,ot as Y,ze as Z,WT as _,k4 as a,Zf as a0,HT as a1,VT as a2,zs as a3,La as a4,Ro as a5,or as a6,_e as a7,rn as a8,Z5 as a9,Xe as aa,_f as ab,cT as ac,jy as ad,ie as b,de as c,da as d,Qf as e,Fe as f,Xm as g,Et as h,Ge as i,Rt as j,Tt as k,Ke as l,Kn as m,Jn as n,Yn as o,Yw as p,i0 as q,lr as r,Ct as s,Nt as t,Rl as u,ke as v,jn as w,ct as x,ut as y,dt as z};
|