@tonyclaw/agent-inspector 2.1.5 → 2.1.7

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.
Files changed (34) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/{CompareDrawer-SAn2KFl2.js → CompareDrawer-BLS7CVvA.js} +1 -1
  3. package/.output/public/assets/ProxyViewerContainer-BFZ1WG07.js +117 -0
  4. package/.output/public/assets/{ReplayDialog-CCwz0YUV.js → ReplayDialog-DIGF807X.js} +1 -1
  5. package/.output/public/assets/{RequestAnatomy-DXcC4ydl.js → RequestAnatomy-C3Nlvp9P.js} +1 -1
  6. package/.output/public/assets/{ResponseView-Bh9t9aZF.js → ResponseView-BbZywqHe.js} +1 -1
  7. package/.output/public/assets/{StreamingChunkSequence-B69M2rr-.js → StreamingChunkSequence-Dk27PfPn.js} +1 -1
  8. package/.output/public/assets/_sessionId-BHpX8AVf.js +1 -0
  9. package/.output/public/assets/index-BXHM9OMb.js +1 -0
  10. package/.output/public/assets/index-DP4NzCZ5.css +1 -0
  11. package/.output/public/assets/{main-DZVKUeg6.js → main-BxHXMs6B.js} +2 -2
  12. package/.output/server/{_sessionId-COVUf_EG.mjs → _sessionId-D5HNwb9A.mjs} +3 -3
  13. package/.output/server/_ssr/{CompareDrawer-DqQHO4tk.mjs → CompareDrawer-QNk1twf8.mjs} +3 -3
  14. package/.output/server/_ssr/{ProxyViewerContainer-BEeF4V-C.mjs → ProxyViewerContainer-DGhc2le_.mjs} +255 -35
  15. package/.output/server/_ssr/{ReplayDialog-DUZbsd5x.mjs → ReplayDialog-D8wg4VNL.mjs} +4 -4
  16. package/.output/server/_ssr/{RequestAnatomy-DKuIxoBj.mjs → RequestAnatomy-BtJHKVl2.mjs} +3 -3
  17. package/.output/server/_ssr/{ResponseView-BB9CYmTJ.mjs → ResponseView-CndDItiU.mjs} +3 -3
  18. package/.output/server/_ssr/{StreamingChunkSequence-CkY3uTjF.mjs → StreamingChunkSequence-D5Ywpbr7.mjs} +3 -3
  19. package/.output/server/_ssr/{index-CHTchkrO.mjs → index-DtcUTHAX.mjs} +3 -3
  20. package/.output/server/_ssr/index.mjs +2 -2
  21. package/.output/server/_ssr/{router-C8DJ5pQZ.mjs → router-C0apgqfC.mjs} +542 -121
  22. package/.output/server/{_tanstack-start-manifest_v-Z1ffcxDr.mjs → _tanstack-start-manifest_v-BoTPaB-V.mjs} +1 -1
  23. package/.output/server/index.mjs +57 -57
  24. package/package.json +1 -1
  25. package/src/components/groups/GroupsDialog.tsx +260 -28
  26. package/src/components/providers/SettingsDialog.tsx +20 -0
  27. package/src/proxy/sessionArchive.ts +410 -0
  28. package/src/proxy/store.ts +121 -6
  29. package/src/routes/api/logs.ts +2 -0
  30. package/src/routes/api/sessions.ts +2 -2
  31. package/.output/public/assets/ProxyViewerContainer-DaiTFf7n.js +0 -117
  32. package/.output/public/assets/_sessionId-6fF5JpyQ.js +0 -1
  33. package/.output/public/assets/index-Bcq8bZoK.css +0 -1
  34. package/.output/public/assets/index-DBSbw8Gd.js +0 -1
@@ -0,0 +1,117 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CompareDrawer-BLS7CVvA.js","assets/main-BxHXMs6B.js","assets/ReplayDialog-DIGF807X.js","assets/ResponseView-BbZywqHe.js","assets/RequestAnatomy-C3Nlvp9P.js","assets/StreamingChunkSequence-Dk27PfPn.js"])))=>i.map(i=>d[i]);
2
+ import{u as Un,a as yf,r as g,j as s,c as ko,g as Ya,b as ao,d as pt,e as vf,f as Qx,h as wf,_ as Hn}from"./main-BxHXMs6B.js";function ie(e,t,n){function r(l,c){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,c);const u=a.prototype,d=Object.keys(u);for(let f=0;f<d.length;f++){const h=d[f];h in l||(l[h]=u[h].bind(l))}}const o=n?.Parent??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(l){var c;const u=n?.Parent?new i:this;r(u,l),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:l=>n?.Parent&&l instanceof n.Parent?!0:l?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class ir extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class kf extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const _f={};function bn(e){return _f}function Sf(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Qi(e,t){return typeof t=="bigint"?t.toString():t}function Ps(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Xa(e){return e==null}function Qa(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function e0(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}const 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 r;Object.defineProperty(e,t,{get(){if(r!==wc)return r===void 0&&(r=wc,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Wn(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 r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function kc(e){return JSON.stringify(e)}function t0(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Cf="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Yr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const n0=Ps(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function fr(e){if(Yr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Yr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function jf(e){return fr(e)?{...e}:Array.isArray(e)?[...e]:e}const r0=new Set(["string","number","symbol"]);function pr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Cn(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function _e(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function o0(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const s0={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 i0(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const 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 Wn(this,"shape",a),a},checks:[]});return Cn(e,i)}function a0(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const 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 Wn(this,"shape",a),a},checks:[]});return Cn(e,i)}function l0(e,t){if(!fr(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 Wn(this,"shape",i),i}});return Cn(e,o)}function c0(e,t){if(!fr(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Sn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Wn(this,"shape",r),r}});return Cn(e,n)}function u0(e,t){const n=Sn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Wn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return Cn(e,n)}function d0(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 Wn(this,"shape",c),c},checks:[]});return Cn(t,a)}function f0(e,t,n){const r=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 Wn(this,"shape",i),i}});return Cn(t,r)}function or(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 sr(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function _o(e){return typeof e=="string"?e:e?.message}function yn(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=_o(e.inst?._zod.def?.error?.(e))??_o(t?.error?.(e))??_o(n.customError?.(e))??_o(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function el(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Xr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Nf=(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,Qi,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ef=ie("$ZodError",Nf),Tf=ie("$ZodError",Nf,{Parent:Error});function p0(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function h0(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({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 r(e),n}const tl=e=>(t,n,r,o)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new ir;if(a.issues.length){const l=new(o?.Err??e)(a.issues.map(c=>yn(c,i,bn())));throw Cf(l,o?.callee),l}return a.value},nl=e=>async(t,n,r,o)=>{const i=r?Object.assign(r,{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=>yn(c,i,bn())));throw Cf(l,o?.callee),l}return a.value},Os=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new ir;return i.issues.length?{success:!1,error:new(e??Ef)(i.issues.map(a=>yn(a,o,bn())))}:{success:!0,data:i.value}},m0=Os(Tf),Ms=e=>async(t,n,r)=>{const o=r?Object.assign(r,{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=>yn(a,o,bn())))}:{success:!0,data:i.value}},g0=Ms(Tf),x0=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return tl(e)(t,n,o)},b0=e=>(t,n,r)=>tl(e)(t,n,r),y0=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return nl(e)(t,n,o)},v0=e=>async(t,n,r)=>nl(e)(t,n,r),w0=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Os(e)(t,n,o)},k0=e=>(t,n,r)=>Os(e)(t,n,r),_0=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ms(e)(t,n,o)},S0=e=>async(t,n,r)=>Ms(e)(t,n,r),C0=/^[cC][^\s-]{8,}$/,j0=/^[0-9a-z]+$/,N0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,E0=/^[0-9a-vA-V]{20}$/,T0=/^[A-Za-z0-9]{27}$/,A0=/^[a-zA-Z0-9_-]{21}$/,I0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,z0=/^([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})$/,_c=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)$/,R0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,P0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function O0(){return new RegExp(P0,"u")}const M0=/^(?:(?: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])$/,L0=/^(([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}|:))$/,D0=/^((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])$/,F0=/^(([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])$/,$0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Af=/^[A-Za-z0-9_-]*$/,B0=/^\+[1-9]\d{6,14}$/,If="(?:(?:\\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])))",U0=new RegExp(`^${If}$`);function zf(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 H0(e){return new RegExp(`^${zf(e)}$`)}function W0(e){const t=zf({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${If}T(?:${r})$`)}const V0=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},q0=/^-?\d+$/,Rf=/^-?\d+(?:\.\d+)?$/,Z0=/^(?:true|false)$/i,G0=/^null$/i,K0=/^[^A-Z]*$/,J0=/^[^a-z]*$/,mt=ie("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Pf={number:"number",bigint:"bigint",object:"date"},Of=ie("$ZodCheckLessThan",(e,t)=>{mt.init(e,t);const n=Pf[typeof t.value];e._zod.onattach.push(r=>{const o=r._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=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Mf=ie("$ZodCheckGreaterThan",(e,t)=>{mt.init(e,t);const n=Pf[typeof t.value];e._zod.onattach.push(r=>{const o=r._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=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Y0=ie("$ZodCheckMultipleOf",(e,t)=>{mt.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):e0(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})}}),X0=ie("$ZodCheckNumberFormat",(e,t)=>{mt.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,i]=s0[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=q0)}),e._zod.check=a=>{const l=a.value;if(n){if(!Number.isInteger(l)){a.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}l<o&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>i&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Q0=ie("$ZodCheckMaxLength",(e,t)=>{var n;mt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Xa(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const a=el(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),eb=ie("$ZodCheckMinLength",(e,t)=>{var n;mt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Xa(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const a=el(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),tb=ie("$ZodCheckLengthEquals",(e,t)=>{var n;mt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Xa(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,i=o.length;if(i===t.length)return;const a=el(o),l=i>t.length;r.issues.push({origin:a,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Ls=ie("$ZodCheckStringFormat",(e,t)=>{var n,r;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})}):(r=e._zod).check??(r.check=()=>{})}),nb=ie("$ZodCheckRegex",(e,t)=>{Ls.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})}}),rb=ie("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=K0),Ls.init(e,t)}),ob=ie("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=J0),Ls.init(e,t)}),sb=ie("$ZodCheckIncludes",(e,t)=>{mt.init(e,t);const n=pr(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),ib=ie("$ZodCheckStartsWith",(e,t)=>{mt.init(e,t);const n=new RegExp(`^${pr(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),ab=ie("$ZodCheckEndsWith",(e,t)=>{mt.init(e,t);const n=new RegExp(`.*${pr(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),lb=ie("$ZodCheckOverwrite",(e,t)=>{mt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class cb{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
3
+ `).filter(a=>a),o=Math.min(...r.map(a=>a.length-a.trimStart().length)),i=r.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 ub={major:4,minor:3,patch:6},Ge=ie("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ub;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const i of o._zod.onattach)i(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(a,l,c)=>{let u=or(a),d;for(const f of l){if(f._zod.def.when){if(!f._zod.def.when(a))continue}else if(u)continue;const h=a.issues.length,p=f._zod.check(a);if(p instanceof Promise&&c?.async===!1)throw new ir;if(d||p instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await p,a.issues.length!==h&&(u||(u=or(a,h)))});else{if(a.issues.length===h)continue;u||(u=or(a,h))}}return d?d.then(()=>a):a},i=(a,l,c)=>{if(or(a))return a.aborted=!0,a;const u=o(l,r,c);if(u instanceof Promise){if(c.async===!1)throw new ir;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 ir;return c.then(u=>o(u,r,l))}return o(c,r,l)}}Oe(e,"~standard",()=>({validate:o=>{try{const i=m0(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return g0(e,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),rl=ie("$ZodString",(e,t)=>{Ge.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??V0(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Je=ie("$ZodStringFormat",(e,t)=>{Ls.init(e,t),rl.init(e,t)}),db=ie("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=z0),Je.init(e,t)}),fb=ie("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=_c(r))}else t.pattern??(t.pattern=_c());Je.init(e,t)}),pb=ie("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=R0),Je.init(e,t)}),hb=ie("$ZodURL",(e,t)=>{Je.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),mb=ie("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=O0()),Je.init(e,t)}),gb=ie("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=A0),Je.init(e,t)}),xb=ie("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=C0),Je.init(e,t)}),bb=ie("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=j0),Je.init(e,t)}),yb=ie("$ZodULID",(e,t)=>{t.pattern??(t.pattern=N0),Je.init(e,t)}),vb=ie("$ZodXID",(e,t)=>{t.pattern??(t.pattern=E0),Je.init(e,t)}),wb=ie("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=T0),Je.init(e,t)}),kb=ie("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=W0(t)),Je.init(e,t)}),_b=ie("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=U0),Je.init(e,t)}),Sb=ie("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=H0(t)),Je.init(e,t)}),Cb=ie("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=I0),Je.init(e,t)}),jb=ie("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=M0),Je.init(e,t),e._zod.bag.format="ipv4"}),Nb=ie("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=L0),Je.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Eb=ie("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=D0),Je.init(e,t)}),Tb=ie("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=F0),Je.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,i]=r;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 Lf(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Ab=ie("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=$0),Je.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Lf(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Ib(e){if(!Af.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Lf(n)}const zb=ie("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Af),Je.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Ib(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Rb=ie("$ZodE164",(e,t)=>{t.pattern??(t.pattern=B0),Je.init(e,t)});function Pb(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const Ob=ie("$ZodJWT",(e,t)=>{Je.init(e,t),e._zod.check=n=>{Pb(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Df=ie("$ZodNumber",(e,t)=>{Ge.init(e,t),e._zod.pattern=e._zod.bag.pattern??Rf,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const 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}}),Mb=ie("$ZodNumberFormat",(e,t)=>{X0.init(e,t),Df.init(e,t)}),Lb=ie("$ZodBoolean",(e,t)=>{Ge.init(e,t),e._zod.pattern=Z0,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),Db=ie("$ZodNull",(e,t)=>{Ge.init(e,t),e._zod.pattern=G0,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{const o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),Fb=ie("$ZodUnknown",(e,t)=>{Ge.init(e,t),e._zod.parse=n=>n}),$b=ie("$ZodNever",(e,t)=>{Ge.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Sc(e,t,n){e.issues.length&&t.issues.push(...sr(n,e.issues)),t.value[n]=e.value}const Bb=ie("$ZodArray",(e,t)=>{Ge.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let a=0;a<o.length;a++){const l=o[a],c=t.element._zod.run({value:l,issues:[]},r);c instanceof Promise?i.push(c.then(u=>Sc(u,n,a))):Sc(c,n,a)}return i.length?Promise.all(i).then(()=>n):n}});function rs(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...sr(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Ff(e){const t=Object.keys(e.shape);for(const r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const n=o0(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function $f(e,t,n,r,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:[]},r);h instanceof Promise?e.push(h.then(p=>rs(p,n,f,t,d))):rs(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 Ub=ie("$ZodObject",(e,t)=>{if(Ge.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const l=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...l};return Object.defineProperty(t,"shape",{value:c}),c}})}const r=Ps(()=>Ff(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=Yr,i=t.catchall;let a;e._zod.parse=(l,c)=>{a??(a=r.value);const u=l.value;if(!o(u))return l.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),l;l.value={};const d=[],f=a.shape;for(const h of a.keys){const p=f[h],y=p._zod.optout==="optional",m=p._zod.run({value:u[h],issues:[]},c);m instanceof Promise?d.push(m.then(x=>rs(x,l,h,u,y))):rs(m,l,h,u,y)}return i?$f(d,u,l,c,r.value,e):d.length?Promise.all(d).then(()=>l):l}}),Hb=ie("$ZodObjectJIT",(e,t)=>{Ub.init(e,t);const n=e._zod.parse,r=Ps(()=>Ff(t)),o=h=>{const p=new cb(["shape","payload","ctx"]),y=r.value,m=w=>{const C=kc(w);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};p.write("const input = payload.value;");const x=Object.create(null);let b=0;for(const w of y.keys)x[w]=`key_${b++}`;p.write("const newResult = {};");for(const w of y.keys){const C=x[w],S=kc(w),N=h[w]?._zod?.optout==="optional";p.write(`const ${C} = ${m(w)};`),N?p.write(`
5
+ if (${C}.issues.length) {
6
+ if (${S} in input) {
7
+ payload.issues = payload.issues.concat(${C}.issues.map(iss => ({
8
+ ...iss,
9
+ path: iss.path ? [${S}, ...iss.path] : [${S}]
10
+ })));
11
+ }
12
+ }
13
+
14
+ if (${C}.value === undefined) {
15
+ if (${S} in input) {
16
+ newResult[${S}] = undefined;
17
+ }
18
+ } else {
19
+ newResult[${S}] = ${C}.value;
20
+ }
21
+
22
+ `):p.write(`
23
+ if (${C}.issues.length) {
24
+ payload.issues = payload.issues.concat(${C}.issues.map(iss => ({
25
+ ...iss,
26
+ path: iss.path ? [${S}, ...iss.path] : [${S}]
27
+ })));
28
+ }
29
+
30
+ if (${C}.value === undefined) {
31
+ if (${S} in input) {
32
+ newResult[${S}] = undefined;
33
+ }
34
+ } else {
35
+ newResult[${S}] = ${C}.value;
36
+ }
37
+
38
+ `)}p.write("payload.value = newResult;"),p.write("return payload;");const v=p.compile();return(w,C)=>v(h,w,C)};let i;const a=Yr,l=!_f.jitless,u=l&&n0.value,d=t.catchall;let f;e._zod.parse=(h,p)=>{f??(f=r.value);const y=h.value;return a(y)?l&&u&&p?.async===!1&&p.jitless!==!0?(i||(i=o(t.shape)),h=i(h,p),d?$f([],y,h,p,f,e):h):n(h,p):(h.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),h)}});function Cc(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!or(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=>yn(a,r,bn())))}),t)}const Bf=ie("$ZodUnion",(e,t)=>{Ge.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=>Qa(i.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(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=>Cc(c,o,e,i)):Cc(l,o,e,i)}}),Wb=ie("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Bf.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 r=Ps(()=>{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(!Yr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const l=r.value.get(a?.[t.discriminator]);return l?l._zod.run(o,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)}}),Vb=ie("$ZodIntersection",(e,t)=>{Ge.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([c,u])=>jc(n,c,u)):jc(n,i,a)}});function ea(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(fr(e)&&fr(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};for(const i of r){const a=ea(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 r=0;r<e.length;r++){const o=e[r],i=t[r],a=ea(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function jc(e,t,n){const r=new Map;let o;for(const l of t.issues)if(l.code==="unrecognized_keys"){o??(o=l);for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(l);for(const l of n.issues)if(l.code==="unrecognized_keys")for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(l);const i=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(i.length&&o&&e.issues.push({...o,keys:i}),or(e))return e;const a=ea(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 qb=ie("$ZodRecord",(e,t)=>{Ge.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!fr(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:[]},r);d instanceof Promise?i.push(d.then(f=>{f.issues.length&&n.issues.push(...sr(u,f.issues)),n.value[u]=f.value})):(d.issues.length&&n.issues.push(...sr(u,d.issues)),n.value[u]=d.value)}let c;for(const u in o)l.has(u)||(c=c??[],c.push(u));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{n.value={};for(const l of Reflect.ownKeys(o)){if(l==="__proto__")continue;let c=t.keyType._zod.run({value:l,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&Rf.test(l)&&c.issues.length){const f=t.keyType._zod.run({value:Number(l),issues:[]},r);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(c=f)}if(c.issues.length){t.mode==="loose"?n.value[l]=o[l]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(f=>yn(f,r,bn())),input:l,path:[l],inst:e});continue}const d=t.valueType._zod.run({value:o[l],issues:[]},r);d instanceof Promise?i.push(d.then(f=>{f.issues.length&&n.issues.push(...sr(l,f.issues)),n.value[c.value]=f.value})):(d.issues.length&&n.issues.push(...sr(l,d.issues)),n.value[c.value]=d.value)}}return i.length?Promise.all(i).then(()=>n):n}}),Zb=ie("$ZodEnum",(e,t)=>{Ge.init(e,t);const n=Sf(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>r0.has(typeof o)).map(o=>typeof o=="string"?pr(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),Gb=ie("$ZodLiteral",(e,t)=>{if(Ge.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?pr(r):r?pr(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),Kb=ie("$ZodTransform",(e,t)=>{Ge.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new kf(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n));if(o instanceof Promise)throw new ir;return n.value=o,n}});function Nc(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Uf=ie("$ZodOptional",(e,t)=>{Ge.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(`^(${Qa(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Nc(i,n.value)):Nc(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Jb=ie("$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,r)=>t.innerType._zod.run(n,r)}),Yb=ie("$ZodNullable",(e,t)=>{Ge.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(`^(${Qa(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,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Xb=ie("$ZodDefault",(e,t)=>{Ge.init(e,t),e._zod.optin="optional",Oe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Ec(i,t)):Ec(o,t)}});function Ec(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Qb=ie("$ZodPrefault",(e,t)=>{Ge.init(e,t),e._zod.optin="optional",Oe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),e1=ie("$ZodNonOptional",(e,t)=>{Ge.init(e,t),Oe(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Tc(i,e)):Tc(o,e)}});function Tc(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 t1=ie("$ZodCatch",(e,t)=>{Ge.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,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(a=>yn(a,r,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=>yn(i,r,bn()))},input:n.value}),n.issues=[]),n)}}),n1=ie("$ZodPipe",(e,t)=>{Ge.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,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(a=>So(a,t.in,r)):So(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>So(i,t.out,r)):So(o,t.out,r)}});function So(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const r1=ie("$ZodReadonly",(e,t)=>{Ge.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,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Ac):Ac(o)}});function Ac(e){return e.value=Object.freeze(e.value),e}const o1=ie("$ZodLazy",(e,t)=>{Ge.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,r)=>e._zod.innerType._zod.run(n,r)}),s1=ie("$ZodCustom",(e,t)=>{mt.init(e,t),Ge.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>Ic(i,n,r,e));Ic(o,n,r,e)}});function Ic(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Xr(o))}}var zc;class i1{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function a1(){return new i1}(zc=globalThis).__zod_globalRegistry??(zc.__zod_globalRegistry=a1());const Ur=globalThis.__zod_globalRegistry;function l1(e,t){return new e({type:"string",..._e(t)})}function c1(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._e(t)})}function Rc(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._e(t)})}function u1(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._e(t)})}function d1(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._e(t)})}function f1(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._e(t)})}function p1(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._e(t)})}function h1(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._e(t)})}function m1(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._e(t)})}function g1(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._e(t)})}function x1(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._e(t)})}function b1(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._e(t)})}function y1(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._e(t)})}function v1(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._e(t)})}function w1(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._e(t)})}function k1(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._e(t)})}function _1(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._e(t)})}function S1(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._e(t)})}function C1(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._e(t)})}function j1(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._e(t)})}function N1(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._e(t)})}function E1(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._e(t)})}function T1(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._e(t)})}function A1(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._e(t)})}function I1(e,t){return new e({type:"string",format:"date",check:"string_format",..._e(t)})}function z1(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._e(t)})}function R1(e,t){return new e({type:"string",format:"duration",check:"string_format",..._e(t)})}function P1(e,t){return new e({type:"number",checks:[],..._e(t)})}function O1(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._e(t)})}function M1(e,t){return new e({type:"boolean",..._e(t)})}function L1(e,t){return new e({type:"null",..._e(t)})}function D1(e){return new e({type:"unknown"})}function F1(e,t){return new e({type:"never",..._e(t)})}function Pc(e,t){return new Of({check:"less_than",..._e(t),value:e,inclusive:!1})}function pi(e,t){return new Of({check:"less_than",..._e(t),value:e,inclusive:!0})}function Oc(e,t){return new Mf({check:"greater_than",..._e(t),value:e,inclusive:!1})}function hi(e,t){return new Mf({check:"greater_than",..._e(t),value:e,inclusive:!0})}function Mc(e,t){return new Y0({check:"multiple_of",..._e(t),value:e})}function Hf(e,t){return new Q0({check:"max_length",..._e(t),maximum:e})}function os(e,t){return new eb({check:"min_length",..._e(t),minimum:e})}function Wf(e,t){return new tb({check:"length_equals",..._e(t),length:e})}function $1(e,t){return new nb({check:"string_format",format:"regex",..._e(t),pattern:e})}function B1(e){return new rb({check:"string_format",format:"lowercase",..._e(e)})}function U1(e){return new ob({check:"string_format",format:"uppercase",..._e(e)})}function H1(e,t){return new sb({check:"string_format",format:"includes",..._e(t),includes:e})}function W1(e,t){return new ib({check:"string_format",format:"starts_with",..._e(t),prefix:e})}function V1(e,t){return new ab({check:"string_format",format:"ends_with",..._e(t),suffix:e})}function wr(e){return new lb({check:"overwrite",tx:e})}function q1(e){return wr(t=>t.normalize(e))}function Z1(){return wr(e=>e.trim())}function G1(){return wr(e=>e.toLowerCase())}function K1(){return wr(e=>e.toUpperCase())}function J1(){return wr(e=>t0(e))}function Y1(e,t,n){return new e({type:"array",element:t,..._e(n)})}function X1(e,t,n){return new e({type:"custom",check:"custom",fn:t,..._e(n)})}function Q1(e){const t=ey(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Xr(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(Xr(o))}},e(n.value,n)));return t}function ey(e,t){const n=new mt({check:"custom",..._e(t)});return n._zod.check=e,n}function Vf(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??Ur,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 Qe(e,t,n={path:[],schemaPath:[]}){var r;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,p=t.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,h,d)}const f=e._zod.parent;f&&(a.ref||(a.ref=f),Qe(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"&&ct(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function qf(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const a of e.seen.entries()){const l=e.metadataRegistry.get(a[0])?.id;if(l){const c=r.get(l);if(c&&c!==a[0])throw new Error(`Duplicate schema id "${l}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(l,a[0])}}const o=a=>{const l=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const f=e.external.registry.get(a[0])?.id,h=e.external.uri??(y=>y);if(f)return{ref:h(f)};const p=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=p,{defId:p,ref:`${h("__shared")}#/${l}/${p}`}}if(a[1]===n)return{ref:"#"};const u=`#/${l}/`,d=a[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},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
+
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 Zf(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=a=>{const l=e.seen.get(a);if(l.ref===null)return;const c=l.def??l.schema,u={...c},d=l.ref;if(l.ref=null,d){r(d);const h=e.seen.get(d),p=h.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(p)):Object.assign(c,p),Object.assign(c,u),a._zod.parent===d)for(const m in c)m==="$ref"||m==="allOf"||m in u||delete c[m];if(p.$ref&&h.def)for(const m in c)m==="$ref"||m==="allOf"||m in h.def&&JSON.stringify(c[m])===JSON.stringify(h.def[m])&&delete c[m]}const f=a._zod.parent;if(f&&f!==d){r(f);const h=e.seen.get(f);if(h?.schema.$ref&&(c.$ref=h.schema.$ref,h.def))for(const p in c)p==="$ref"||p==="allOf"||p in h.def&&JSON.stringify(c[p])===JSON.stringify(h.def[p])&&delete c[p]}e.override({zodSchema:a,jsonSchema:c,path:l.path??[]})};for(const a of[...e.seen.entries()].reverse())r(a[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,n.def??n.schema);const 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:ss(t,"input",e.processors),output:ss(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function ct(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return ct(r.element,n);if(r.type==="set")return ct(r.valueType,n);if(r.type==="lazy")return ct(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return ct(r.innerType,n);if(r.type==="intersection")return ct(r.left,n)||ct(r.right,n);if(r.type==="record"||r.type==="map")return ct(r.keyType,n)||ct(r.valueType,n);if(r.type==="pipe")return ct(r.in,n)||ct(r.out,n);if(r.type==="object"){for(const o in r.shape)if(ct(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(ct(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(ct(o,n))return!0;return!!(r.rest&&ct(r.rest,n))}return!1}const ty=(e,t={})=>n=>{const r=Vf({...n,processors:t});return Qe(e,r),qf(r,e),Zf(r,e)},ss=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r??{},a=Vf({...o??{},target:i,io:t,processors:n});return Qe(e,a),qf(a,e),Zf(a,e)},ny={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ry=(e,t,n,r)=>{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=ny[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}))])}},oy=(e,t,n,r)=>{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)},sy=(e,t,n,r)=>{n.type="boolean"},iy=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},ay=(e,t,n,r)=>{n.not={}},ly=(e,t,n,r)=>{},cy=(e,t,n,r)=>{const o=e._zod.def,i=Sf(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},uy=(e,t,n,r)=>{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},dy=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},fy=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},py=(e,t,n,r)=>{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=Qe(i.element,t,{...r,path:[...r.path,"items"]})},hy=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const u in a)o.properties[u]=Qe(a[u],t,{...r,path:[...r.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=Qe(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},my=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((l,c)=>Qe(l,t,{...r,path:[...r.path,i?"oneOf":"anyOf",c]}));i?n.oneOf=a:n.anyOf=a},gy=(e,t,n,r)=>{const o=e._zod.def,i=Qe(o.left,t,{...r,path:[...r.path,"allOf",0]}),a=Qe(o.right,t,{...r,path:[...r.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},xy=(e,t,n,r)=>{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=Qe(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const f of c)o.patternProperties[f.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Qe(i.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Qe(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=a._zod.values;if(u){const d=[...u].filter(f=>typeof f=="string"||typeof f=="number");d.length>0&&(o.required=d)}},by=(e,t,n,r)=>{const o=e._zod.def,i=Qe(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},yy=(e,t,n,r)=>{const o=e._zod.def;Qe(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},vy=(e,t,n,r)=>{const o=e._zod.def;Qe(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},wy=(e,t,n,r)=>{const o=e._zod.def;Qe(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},ky=(e,t,n,r)=>{const o=e._zod.def;Qe(o.innerType,t,r);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},_y=(e,t,n,r)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Qe(i,t,r);const a=t.seen.get(e);a.ref=i},Sy=(e,t,n,r)=>{const o=e._zod.def;Qe(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},Gf=(e,t,n,r)=>{const o=e._zod.def;Qe(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Cy=(e,t,n,r)=>{const o=e._zod.innerType;Qe(o,t,r);const i=t.seen.get(e);i.ref=o},jy=ie("ZodISODateTime",(e,t)=>{kb.init(e,t),Xe.init(e,t)});function Ny(e){return A1(jy,e)}const Ey=ie("ZodISODate",(e,t)=>{_b.init(e,t),Xe.init(e,t)});function Ty(e){return I1(Ey,e)}const Ay=ie("ZodISOTime",(e,t)=>{Sb.init(e,t),Xe.init(e,t)});function Iy(e){return z1(Ay,e)}const zy=ie("ZodISODuration",(e,t)=>{Cb.init(e,t),Xe.init(e,t)});function Ry(e){return R1(zy,e)}const Py=(e,t)=>{Ef.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>h0(e,n)},flatten:{value:n=>p0(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Qi,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Qi,2)}},isEmpty:{get(){return e.issues.length===0}}})},At=ie("ZodError",Py,{Parent:Error}),Oy=tl(At),My=nl(At),Ly=Os(At),Dy=Ms(At),Fy=x0(At),$y=b0(At),By=y0(At),Uy=v0(At),Hy=w0(At),Wy=k0(At),Vy=_0(At),qy=S0(At),Ke=ie("ZodType",(e,t)=>(Ge.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ss(e,"input"),output:ss(e,"output")}}),e.toJSONSchema=ty(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(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0}),e.with=e.check,e.clone=(n,r)=>Cn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>Oy(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Ly(e,n,r),e.parseAsync=async(n,r)=>My(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>Dy(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Fy(e,n,r),e.decode=(n,r)=>$y(e,n,r),e.encodeAsync=async(n,r)=>By(e,n,r),e.decodeAsync=async(n,r)=>Uy(e,n,r),e.safeEncode=(n,r)=>Hy(e,n,r),e.safeDecode=(n,r)=>Wy(e,n,r),e.safeEncodeAsync=async(n,r)=>Vy(e,n,r),e.safeDecodeAsync=async(n,r)=>qy(e,n,r),e.refine=(n,r)=>e.check(Uv(n,r)),e.superRefine=n=>e.check(Hv(n)),e.overwrite=n=>e.check(wr(n)),e.optional=()=>Fc(e),e.exactOptional=()=>Nv(e),e.nullable=()=>$c(e),e.nullish=()=>Fc($c(e)),e.nonoptional=n=>Rv(e,n),e.array=()=>ge(e),e.or=n=>cn([e,n]),e.and=n=>wv(e,n),e.transform=n=>Bc(e,Cv(n)),e.default=n=>Av(e,n),e.prefault=n=>zv(e,n),e.catch=n=>Ov(e,n),e.pipe=n=>Bc(e,n),e.readonly=()=>Dv(e),e.describe=n=>{const r=e.clone();return Ur.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return Ur.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Ur.get(e);const r=e.clone();return Ur.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Kf=ie("_ZodString",(e,t)=>{rl.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(r,o,i)=>ry(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check($1(...r)),e.includes=(...r)=>e.check(H1(...r)),e.startsWith=(...r)=>e.check(W1(...r)),e.endsWith=(...r)=>e.check(V1(...r)),e.min=(...r)=>e.check(os(...r)),e.max=(...r)=>e.check(Hf(...r)),e.length=(...r)=>e.check(Wf(...r)),e.nonempty=(...r)=>e.check(os(1,...r)),e.lowercase=r=>e.check(B1(r)),e.uppercase=r=>e.check(U1(r)),e.trim=()=>e.check(Z1()),e.normalize=(...r)=>e.check(q1(...r)),e.toLowerCase=()=>e.check(G1()),e.toUpperCase=()=>e.check(K1()),e.slugify=()=>e.check(J1())}),Zy=ie("ZodString",(e,t)=>{rl.init(e,t),Kf.init(e,t),e.email=n=>e.check(c1(Gy,n)),e.url=n=>e.check(h1(Ky,n)),e.jwt=n=>e.check(T1(uv,n)),e.emoji=n=>e.check(m1(Jy,n)),e.guid=n=>e.check(Rc(Lc,n)),e.uuid=n=>e.check(u1(Co,n)),e.uuidv4=n=>e.check(d1(Co,n)),e.uuidv6=n=>e.check(f1(Co,n)),e.uuidv7=n=>e.check(p1(Co,n)),e.nanoid=n=>e.check(g1(Yy,n)),e.guid=n=>e.check(Rc(Lc,n)),e.cuid=n=>e.check(x1(Xy,n)),e.cuid2=n=>e.check(b1(Qy,n)),e.ulid=n=>e.check(y1(ev,n)),e.base64=n=>e.check(j1(av,n)),e.base64url=n=>e.check(N1(lv,n)),e.xid=n=>e.check(v1(tv,n)),e.ksuid=n=>e.check(w1(nv,n)),e.ipv4=n=>e.check(k1(rv,n)),e.ipv6=n=>e.check(_1(ov,n)),e.cidrv4=n=>e.check(S1(sv,n)),e.cidrv6=n=>e.check(C1(iv,n)),e.e164=n=>e.check(E1(cv,n)),e.datetime=n=>e.check(Ny(n)),e.date=n=>e.check(Ty(n)),e.time=n=>e.check(Iy(n)),e.duration=n=>e.check(Ry(n))});function T(e){return l1(Zy,e)}const Xe=ie("ZodStringFormat",(e,t)=>{Je.init(e,t),Kf.init(e,t)}),Gy=ie("ZodEmail",(e,t)=>{pb.init(e,t),Xe.init(e,t)}),Lc=ie("ZodGUID",(e,t)=>{db.init(e,t),Xe.init(e,t)}),Co=ie("ZodUUID",(e,t)=>{fb.init(e,t),Xe.init(e,t)}),Ky=ie("ZodURL",(e,t)=>{hb.init(e,t),Xe.init(e,t)}),Jy=ie("ZodEmoji",(e,t)=>{mb.init(e,t),Xe.init(e,t)}),Yy=ie("ZodNanoID",(e,t)=>{gb.init(e,t),Xe.init(e,t)}),Xy=ie("ZodCUID",(e,t)=>{xb.init(e,t),Xe.init(e,t)}),Qy=ie("ZodCUID2",(e,t)=>{bb.init(e,t),Xe.init(e,t)}),ev=ie("ZodULID",(e,t)=>{yb.init(e,t),Xe.init(e,t)}),tv=ie("ZodXID",(e,t)=>{vb.init(e,t),Xe.init(e,t)}),nv=ie("ZodKSUID",(e,t)=>{wb.init(e,t),Xe.init(e,t)}),rv=ie("ZodIPv4",(e,t)=>{jb.init(e,t),Xe.init(e,t)}),ov=ie("ZodIPv6",(e,t)=>{Nb.init(e,t),Xe.init(e,t)}),sv=ie("ZodCIDRv4",(e,t)=>{Eb.init(e,t),Xe.init(e,t)}),iv=ie("ZodCIDRv6",(e,t)=>{Tb.init(e,t),Xe.init(e,t)}),av=ie("ZodBase64",(e,t)=>{Ab.init(e,t),Xe.init(e,t)}),lv=ie("ZodBase64URL",(e,t)=>{zb.init(e,t),Xe.init(e,t)}),cv=ie("ZodE164",(e,t)=>{Rb.init(e,t),Xe.init(e,t)}),uv=ie("ZodJWT",(e,t)=>{Ob.init(e,t),Xe.init(e,t)}),Jf=ie("ZodNumber",(e,t)=>{Df.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(r,o,i)=>oy(e,r,o),e.gt=(r,o)=>e.check(Oc(r,o)),e.gte=(r,o)=>e.check(hi(r,o)),e.min=(r,o)=>e.check(hi(r,o)),e.lt=(r,o)=>e.check(Pc(r,o)),e.lte=(r,o)=>e.check(pi(r,o)),e.max=(r,o)=>e.check(pi(r,o)),e.int=r=>e.check(Dc(r)),e.safe=r=>e.check(Dc(r)),e.positive=r=>e.check(Oc(0,r)),e.nonnegative=r=>e.check(hi(0,r)),e.negative=r=>e.check(Pc(0,r)),e.nonpositive=r=>e.check(pi(0,r)),e.multipleOf=(r,o)=>e.check(Mc(r,o)),e.step=(r,o)=>e.check(Mc(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function te(e){return P1(Jf,e)}const dv=ie("ZodNumberFormat",(e,t)=>{Mb.init(e,t),Jf.init(e,t)});function Dc(e){return O1(dv,e)}const fv=ie("ZodBoolean",(e,t)=>{Lb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>sy(e,n,r)});function We(e){return M1(fv,e)}const pv=ie("ZodNull",(e,t)=>{Db.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>iy(e,n,r)});function ta(e){return L1(pv,e)}const hv=ie("ZodUnknown",(e,t)=>{Fb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ly()});function na(){return D1(hv)}const mv=ie("ZodNever",(e,t)=>{$b.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ay(e,n,r)});function gv(e){return F1(mv,e)}const xv=ie("ZodArray",(e,t)=>{Bb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>py(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(os(n,r)),e.nonempty=n=>e.check(os(1,n)),e.max=(n,r)=>e.check(Hf(n,r)),e.length=(n,r)=>e.check(Wf(n,r)),e.unwrap=()=>e.element});function ge(e,t){return Y1(xv,e,t)}const bv=ie("ZodObject",(e,t)=>{Hb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>hy(e,n,r,o),Oe(e,"shape",()=>t.shape),e.keyof=()=>Ae(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:na()}),e.loose=()=>e.clone({...e._zod.def,catchall:na()}),e.strict=()=>e.clone({...e._zod.def,catchall:gv()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>l0(e,n),e.safeExtend=n=>c0(e,n),e.merge=n=>u0(e,n),e.pick=n=>i0(e,n),e.omit=n=>a0(e,n),e.partial=(...n)=>d0(Xf,e,n[0]),e.required=(...n)=>f0(Qf,e,n[0])});function re(e,t){const n={type:"object",shape:e??{},..._e(t)};return new bv(n)}const Yf=ie("ZodUnion",(e,t)=>{Bf.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>my(e,n,r,o),e.options=t.options});function cn(e,t){return new Yf({type:"union",options:e,..._e(t)})}const yv=ie("ZodDiscriminatedUnion",(e,t)=>{Yf.init(e,t),Wb.init(e,t)});function Vn(e,t,n){return new yv({type:"union",options:t,discriminator:e,..._e(n)})}const vv=ie("ZodIntersection",(e,t)=>{Vb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gy(e,n,r,o)});function wv(e,t){return new vv({type:"intersection",left:e,right:t})}const kv=ie("ZodRecord",(e,t)=>{qb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xy(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function nt(e,t,n){return new kv({type:"record",keyType:e,valueType:t,..._e(n)})}const ra=ie("ZodEnum",(e,t)=>{Zb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(r,o,i)=>cy(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const a of r)if(n.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new ra({...t,checks:[],..._e(o),entries:i})},e.exclude=(r,o)=>{const i={...t.entries};for(const a of r)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new ra({...t,checks:[],..._e(o),entries:i})}});function Ae(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ra({type:"enum",entries:n,..._e(t)})}const _v=ie("ZodLiteral",(e,t)=>{Gb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>uy(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Te(e,t){return new _v({type:"literal",values:Array.isArray(e)?e:[e],..._e(t)})}const Sv=ie("ZodTransform",(e,t)=>{Kb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fy(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new kf(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(Xr(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(Xr(a))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Cv(e){return new Sv({type:"transform",transform:e})}const Xf=ie("ZodOptional",(e,t)=>{Uf.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Fc(e){return new Xf({type:"optional",innerType:e})}const jv=ie("ZodExactOptional",(e,t)=>{Jb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Nv(e){return new jv({type:"optional",innerType:e})}const Ev=ie("ZodNullable",(e,t)=>{Yb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>by(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function $c(e){return new Ev({type:"nullable",innerType:e})}const Tv=ie("ZodDefault",(e,t)=>{Xb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vy(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Av(e,t){return new Tv({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():jf(t)}})}const Iv=ie("ZodPrefault",(e,t)=>{Qb.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wy(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function zv(e,t){return new Iv({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():jf(t)}})}const Qf=ie("ZodNonOptional",(e,t)=>{e1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yy(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Rv(e,t){return new Qf({type:"nonoptional",innerType:e,..._e(t)})}const Pv=ie("ZodCatch",(e,t)=>{t1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ky(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ov(e,t){return new Pv({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Mv=ie("ZodPipe",(e,t)=>{n1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_y(e,n,r,o),e.in=t.in,e.out=t.out});function Bc(e,t){return new Mv({type:"pipe",in:e,out:t})}const Lv=ie("ZodReadonly",(e,t)=>{r1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sy(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Dv(e){return new Lv({type:"readonly",innerType:e})}const Fv=ie("ZodLazy",(e,t)=>{o1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cy(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function $v(e){return new Fv({type:"lazy",getter:e})}const Bv=ie("ZodCustom",(e,t)=>{s1.init(e,t),Ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>dy(e,n)});function Uv(e,t={}){return X1(Bv,e,t)}function Hv(e){return Q1(e)}const dt=$v(()=>cn([T(),te(),We(),ta(),ge(dt),nt(T(),dt)]));const ep=re({index:te(),timestamp:te(),type:T(),data:dt}),Wv=re({chunks:ge(ep),truncated:We().optional().default(!1)}),Vv=Ae(["request","response"]),qv=re({logId:te().int().positive(),part:Vv,text:T(),offset:te().int().nonnegative(),limit:te().int().positive(),totalBytes:te().int().nonnegative(),textBytes:te().int().nonnegative(),nextOffset:te().int().nonnegative().nullable(),hasMore:We(),contentMode:Ae(["empty","partial","full"])}),Qr=re({id:te(),timestamp:T(),method:T(),path:T(),model:T().nullable(),sessionId:T().nullable(),rawRequestBody:T().nullable(),responseStatus:te().nullable(),responseText:T().nullable(),inputTokens:te().nullable(),outputTokens:te().nullable(),cacheCreationInputTokens:te().nullable(),cacheReadInputTokens:te().nullable(),elapsedMs:te().nullable(),firstChunkMs:te().nullable().optional(),totalStreamMs:te().nullable().optional(),tokensPerSecond:te().nullable().optional(),streaming:We(),userAgent:T().nullable(),origin:T().nullable(),rawHeaders:nt(T(),T()).optional(),headers:nt(T(),T()).optional(),apiFormat:Ae(["anthropic","openai","unknown"]).default("unknown"),isTest:We().optional().default(!1),replayOfLogId:te().nullable().optional(),providerName:T().nullable().optional(),clientPort:te().nullable().optional(),clientPid:te().nullable().optional(),clientCwd:T().nullable().optional(),clientProjectFolder:T().nullable().optional(),streamingChunks:Wv.optional(),streamingChunksPath:T().nullable().optional(),rawRequestBodyBytes:te().int().nonnegative().nullable().optional(),responseTextBytes:te().int().nonnegative().nullable().optional(),bodyContentMode:Ae(["full","compact","truncated"]).optional(),warnings:ge(T()).optional(),error:T().nullable().optional()}),ol=re({type:T(),ttl:T().optional(),scope:T().optional()}),sl=re({type:Te("text"),text:T(),cache_control:ol.optional()}),tp=re({type:Te("thinking"),thinking:T(),signature:T().optional()}),Zv=re({type:Te("think"),thinking:T(),signature:T().optional()}),Gv=re({type:Te("base64"),media_type:T(),data:T()}),np=re({type:Te("image"),source:Gv}),rp=re({type:Te("tool_use"),id:T(),name:T(),input:nt(T(),dt)}),Kv=Vn("type",[sl,np]),Jv=re({type:Te("tool_result"),tool_use_id:T().optional(),content:cn([T(),ge(Kv)]),is_error:We().optional()}),Yv=Vn("type",[sl,tp,np,rp,Jv]),Xv=cn([T(),ge(Yv)]),Qv=re({role:Ae(["user","assistant"]),content:Xv}),e2=re({type:Te("text"),text:T(),cache_control:ol.optional()}),t2=re({type:T(),properties:nt(T(),nt(T(),dt)).optional(),required:ge(T()).optional(),additionalProperties:We().optional(),$schema:T().optional()}),n2=re({name:T(),description:T().optional(),input_schema:t2.optional(),cache_control:ol.optional()}),r2=Vn("type",[re({type:Te("enabled"),budget_tokens:te()}),re({type:Te("disabled")}),re({type:Te("adaptive")})]),op=re({model:T(),messages:ge(Qv),system:ge(e2).optional(),tools:ge(n2).optional(),max_tokens:te().optional(),temperature:te().optional(),stream:We().optional(),thinking:r2.optional(),metadata:re({user_id:T().optional()}).optional()}),il=Vn("type",[sl,tp,Zv,rp]),o2=re({input_tokens:te().nullable().optional(),output_tokens:te().nullable().optional(),cache_creation_input_tokens:te().nullable().optional(),cache_read_input_tokens:te().nullable().optional()}).passthrough(),sp=re({id:T(),type:Te("message"),model:T(),role:Te("assistant"),content:ge(il),stop_reason:T().nullable(),stop_sequence:T().nullable().optional(),usage:o2}).passthrough(),s2=re({type:Te("message_start"),message:re({id:T(),type:Te("message"),model:T(),role:Te("assistant"),content:ge(il),stop_reason:ta(),stop_sequence:ta(),usage:re({input_tokens:te(),cache_creation_input_tokens:te().optional(),cache_read_input_tokens:te().optional()}).passthrough()})}),i2=re({type:Te("content_block_start"),index:te(),content_block:il}),a2=Vn("type",[re({type:Te("text_delta"),text:T()}),re({type:Te("input_json_delta"),partial_json:T()}),re({type:Te("thinking_delta"),thinking:T()}),re({type:Te("signature_delta"),signature:T()})]),l2=re({type:Te("content_block_delta"),index:te(),delta:a2}),c2=re({type:Te("content_block_stop"),index:te()}),u2=re({type:Te("message_delta"),delta:re({stop_reason:T().nullable(),stop_sequence:T().nullable().optional()}),usage:re({output_tokens:te(),input_tokens:te().optional(),cache_creation_input_tokens:te().optional(),cache_read_input_tokens:te().optional()}).passthrough()}),d2=re({type:Te("message_stop")}),f2=re({type:Te("ping")}),p2=re({type:Te("error"),error:re({type:T(),message:T()})}),h2=Vn("type",[s2,i2,l2,c2,u2,d2,f2,p2]),m2=cn([T(),ge(Vn("type",[re({type:Te("text"),text:T()}),re({type:Te("image_url"),image_url:re({url:T(),detail:T().optional()})})]))]),ip=re({role:Ae(["system","user","assistant","tool"]),content:m2,name:T().optional(),reasoning_content:T().optional(),thinking:T().optional(),think:T().optional()}),g2=re({name:T(),arguments:T()}),ap=re({index:te().optional(),id:T().optional(),type:Te("function").optional(),function:re({name:T().optional(),arguments:T().optional()})});ip.extend({content:cn([T(),ge(re({type:Te("text"),text:T()}))]).optional(),function_call:g2.optional(),tool_calls:ge(ap).optional()});const x2=re({type:Te("function"),function:re({name:T(),description:T().optional(),parameters:nt(T(),dt)})}),lp=re({model:T(),messages:ge(ip),temperature:te().optional(),max_tokens:te().optional(),stream:We().optional(),tools:ge(x2).optional(),tool_choice:cn([Ae(["auto","none","required"]),re({type:Te("auto")}),re({type:Te("none")}),re({type:Te("function"),function:re({name:T()})})]).optional(),user:T().optional()}),cp=re({role:Ae(["assistant"]).optional(),content:T().nullable().optional(),reasoning_content:T().nullable().optional(),thinking:T().nullable().optional(),think:T().nullable().optional(),function_call:re({name:T().optional(),arguments:T().optional()}).nullable().optional(),tool_calls:ge(re({index:te(),id:T().optional(),type:Te("function").optional(),function:re({name:T().optional(),arguments:T().optional()})})).nullable().optional()}),b2=re({index:te(),message:re({role:Ae(["assistant"]),content:T().nullable(),reasoning_content:T().optional(),thinking:T().optional(),think:T().optional(),function_call:re({name:T(),arguments:T()}).nullable().optional(),tool_calls:ge(ap).optional()}).optional(),delta:cp.optional(),finish_reason:T().nullable()}),y2=re({id:T(),object:Te("chat.completion"),created:te(),model:T(),choices:ge(b2),usage:re({prompt_tokens:te().nullable().optional(),completion_tokens:te().nullable().optional(),total_tokens:te().nullable().optional()}).passthrough(),service_tier:T().nullable().optional(),system_fingerprint:T().nullable().optional()}).passthrough(),v2=re({id:T(),object:Te("chat.completion.chunk"),created:te(),model:T(),choices:ge(re({index:te(),delta:cp,finish_reason:T().nullable().optional()})),usage:re({prompt_tokens:te().nullable().optional(),completion_tokens:te().nullable().optional(),total_tokens:te().nullable().optional()}).passthrough().nullable().optional()}).passthrough();function up(e){try{const t=JSON.parse(e),n=y2.safeParse(t);return n.success?n.data:null}catch{return null}}const w2=re({error:T()});async function Mt(e,t){const n=await e.json();return t.parse(n)}async function on(e,t){try{const n=await e.json(),r=w2.safeParse(n);return r.success?r.data.error:t}catch{return t}}async function vn(e,t,n,r){const o=await fetch(e,n);if(!o.ok){const i=r?.(o)??`Request failed with status ${o.status}`;throw new Error(await on(o,i))}return Mt(o,t)}function k2(e){return e<1e3?`${String(e)}ms`:`${String(Math.round(e/1e3))}s`}class dp extends Error{constructor(t){super(`Request timed out after ${k2(t)}`),this.name="ApiTimeoutError"}}async function hr(e,t,n,r,o){const i=new AbortController,a=setTimeout(()=>i.abort(),n);try{return await vn(e,t,{...r,signal:i.signal},o)}catch(l){throw l instanceof DOMException&&l.name==="AbortError"?new dp(n):l}finally{clearTimeout(a)}}const fp=re({input:te().int().nonnegative(),output:te().int().nonnegative(),cacheCreate:te().int().nonnegative(),cacheRead:te().int().nonnegative(),total:te().int().nonnegative()}),_2=re({id:te().int().positive(),timestamp:T(),provider:T().nullable(),model:T().nullable(),apiFormat:Ae(["anthropic","openai","unknown"]),method:T(),path:T(),status:te().nullable(),isStreaming:We(),hasError:We(),error:T().nullable(),latencyMs:te().nullable(),firstChunkMs:te().nullable().optional(),totalStreamMs:te().nullable().optional(),tokensPerSecond:te().nullable().optional(),tokens:re({input:te().nullable(),output:te().nullable(),cacheCreate:te().nullable(),cacheRead:te().nullable()}),sessionId:T().nullable()}),pp=re({id:T(),status:Ae(["active","failed","completed","empty"]),logCoverage:Ae(["recent","history"]),source:Ae(["explicit","client-process","client-connection","provider-test"]).nullable(),runtimeMode:Ae(["in-process","worker-thread","child-process"]).nullable(),createdAt:T().nullable(),updatedAt:T().nullable(),requestCount:te().int().nonnegative(),activeRequests:te().int().nonnegative(),completedRequests:te().int().nonnegative(),failedRequests:te().int().nonnegative(),queuedTasks:te().int().nonnegative(),runningTasks:te().int().nonnegative(),lastTaskError:T().nullable(),logCount:te().int().nonnegative(),errorCount:te().int().nonnegative(),models:ge(T()),providers:ge(T()),tokenUsage:fp,lastLogId:te().nullable(),lastModel:T().nullable(),clientPid:te().nullable(),clientProjectFolder:T().nullable(),inspectorPath:T(),inspectorUrl:T(),apiPath:T(),apiUrl:T(),compactLogsPath:T(),compactLogsUrl:T(),latestLogLimit:te().int().positive(),latestLogs:ge(_2)}),lo=Ae(["created","running","completed","failed","cancelled"]),al=re({jsonPath:T(),markdownPath:T(),htmlPath:T(),exportedAt:T()}),S2=Ae(["run-created","session-started","request","session-finished","evidence-exported"]),C2=Ae(["info","success","warning","error"]),j2=re({timestamp:T(),kind:S2,severity:C2,title:T(),details:T(),logId:te().int().positive().nullable(),status:te().nullable(),model:T().nullable(),provider:T().nullable(),latencyMs:te().nullable(),isStreaming:We().nullable()}),N2=Ae(["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"]),hp=re({outcome:Ae(["success","failure","active","unknown"]),severity:Ae(["none","low","medium","high"]),category:N2,summary:T(),evidenceLogIds:ge(te().int().positive()),hints:ge(T())}),ll=re({status:Ae(["PASS","FAIL","RUNNING","UNKNOWN"]),summary:T(),markdown:T()}),mp=ll,cl=re({id:T(),sessionId:T(),groupId:T().nullable().default(null),title:T(),task:T().nullable(),project:T().nullable(),agent:T().nullable(),status:lo,tags:ge(T()),metadata:nt(T(),dt),evidence:al.nullable(),createdAt:T(),updatedAt:T()});re({runId:T().min(1).optional(),sessionId:T().min(1).optional(),groupId:T().min(1).nullable().optional(),title:T().min(1).optional(),task:T().nullable().optional(),project:T().nullable().optional(),agent:T().nullable().optional(),status:lo.optional(),tags:ge(T()).optional(),metadata:nt(T(),dt).optional()}).optional();re({sessionId:T().min(1).optional(),groupId:T().min(1).nullable().optional(),title:T().min(1).optional(),task:T().nullable().optional(),project:T().nullable().optional(),agent:T().nullable().optional(),status:lo.optional(),tags:ge(T()).optional(),metadata:nt(T(),dt).optional()});re({includeHistory:We().optional(),latestLogLimit:te().int().positive().max(50).optional()}).optional();re({run:cl,evidence:al,session:pp.nullable(),timeline:ge(j2),classification:hp,jenkinsReport:ll});const E2=re({run:cl,classification:hp,evidence:al.nullable(),jenkinsReport:ll.nullable(),sessionId:T(),inspectorUrl:T().nullable(),evidenceMarkdownPath:T().nullable(),updatedAt:T()});re({failures:ge(E2),total:te().int().nonnegative(),limit:te().int().positive()});const ul=Ae(["created","running","completed","failed","cancelled"]),dl=Ae(["evaluation","batch","manual"]),fl=re({jsonPath:T(),markdownPath:T(),htmlPath:T(),exportedAt:T()}),gp=re({id:T(),groupId:T(),sessionId:T(),runId:T().nullable(),label:T().nullable(),agent:T().nullable(),provider:T().nullable(),model:T().nullable(),status:lo.nullable(),metadata:nt(T(),dt),addedAt:T(),updatedAt:T()}),pl=re({id:T(),title:T(),kind:dl,task:T().nullable(),project:T().nullable(),status:ul,tags:ge(T()),metadata:nt(T(),dt),evidence:fl.nullable(),members:ge(gp),createdAt:T(),updatedAt:T()});re({groupId:T().min(1).optional(),title:T().min(1).optional(),kind:dl.optional(),task:T().nullable().optional(),project:T().nullable().optional(),status:ul.optional(),tags:ge(T()).optional(),metadata:nt(T(),dt).optional()}).optional();re({title:T().min(1).optional(),kind:dl.optional(),task:T().nullable().optional(),project:T().nullable().optional(),status:ul.optional(),tags:ge(T()).optional(),metadata:nt(T(),dt).optional()});re({memberId:T().min(1).optional(),sessionId:T().min(1),runId:T().min(1).nullable().optional(),label:T().min(1).nullable().optional(),agent:T().min(1).nullable().optional(),provider:T().min(1).nullable().optional(),model:T().min(1).nullable().optional(),status:lo.nullable().optional(),metadata:nt(T(),dt).optional()});re({includeHistory:We().optional(),latestLogLimit:te().int().positive().max(50).optional()}).optional();re({deleteEvidence:We().optional()});const T2=re({groupId:T(),deleted:We(),evidenceDeleted:We(),evidencePath:T().nullable()}),xp=re({member:gp,run:cl.nullable(),session:pp.nullable()}),bp=re({memberCount:te().int().nonnegative(),sessionsWithData:te().int().nonnegative(),missingSessions:te().int().nonnegative(),requestCount:te().int().nonnegative(),errorCount:te().int().nonnegative(),tokenUsage:fp,models:ge(T()),providers:ge(T()),completedMembers:te().int().nonnegative(),failedMembers:te().int().nonnegative(),runningMembers:te().int().nonnegative()}),A2=re({group:pl,evidence:fl,members:ge(xp).nullable(),markdown:T(),summary:bp.nullable(),report:mp.nullable()}),I2=re({group:pl,evidence:fl,members:ge(xp),summary:bp,jenkinsReport:mp}),yp=re({groups:ge(pl)}),z2=re({sessionId:T(),imported:te().int().nonnegative(),skipped:te().int().nonnegative(),warnings:ge(T()),logs:ge(Qr)}),is=10,oa=600,as=60,sa=600,ls="time",hl="simple",vp=Ae(["time","full"]),R2=Ae(["simple","full"]),Ds=re({stripClaudeCodeBillingHeader:We(),hasSeenOnboarding:We().default(!1),slowResponseThresholdSeconds:te().int().min(0).max(oa).default(is),providerTestTimeoutSeconds:te().int().min(1).max(sa).default(as),timeDisplayFormat:vp.default(ls),captureMode:R2.default(hl)}),rr="/api/config";async function P2(e){return vn(e,Ds,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function jo(e){return vn(rr,Ds,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function ml(){const e=Un(rr,P2,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=yf(),n=e.data?.stripClaudeCodeBillingHeader??!1,r=e.data?.captureMode??hl,o=e.data?.slowResponseThresholdSeconds??is,i=e.data?.providerTestTimeoutSeconds??as,a=e.data?.timeDisplayFormat??ls,l=h=>({stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:e.data?.hasSeenOnboarding??!1,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??is,providerTestTimeoutSeconds:e.data?.providerTestTimeoutSeconds??as,timeDisplayFormat:e.data?.timeDisplayFormat??ls,captureMode:r,...h}),c=async h=>{await t(rr,jo({stripClaudeCodeBillingHeader:h}),{optimisticData:l({stripClaudeCodeBillingHeader:h}),rollbackOnError:!0,revalidate:!1})},u=async h=>{await t(rr,jo({slowResponseThresholdSeconds:h}),{optimisticData:l({slowResponseThresholdSeconds:h}),rollbackOnError:!0,revalidate:!1})},d=async h=>{await t(rr,jo({timeDisplayFormat:h}),{optimisticData:l({timeDisplayFormat:h}),rollbackOnError:!0,revalidate:!1})},f=async h=>{await t(rr,jo({providerTestTimeoutSeconds:h}),{optimisticData:l({providerTestTimeoutSeconds:h}),rollbackOnError:!0,revalidate:!1})};return{strip:n,captureMode:r,slowResponseThresholdSeconds:o,providerTestTimeoutSeconds:i,timeDisplayFormat:a,isLoading:e.isLoading,isError:e.error!==void 0,setStrip:c,setSlowResponseThresholdSeconds:u,setProviderTestTimeoutSeconds:f,setTimeDisplayFormat:d}}const wp=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const O2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const M2=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const Uc=e=>{const t=M2(e);return t.charAt(0).toUpperCase()+t.slice(1)};var L2={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 D2=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const F2=g.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:a,...l},c)=>g.createElement("svg",{ref:c,...L2,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:wp("lucide",o),...!i&&!D2(l)&&{"aria-hidden":"true"},...l},[...a.map(([u,d])=>g.createElement(u,d)),...Array.isArray(i)?i:[i]]));const xe=(e,t)=>{const n=g.forwardRef(({className:r,...o},i)=>g.createElement(F2,{ref:i,iconNode:t,className:wp(`lucide-${O2(Uc(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Uc(e),n};const $2=[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]],B2=xe("arrow-down-right",$2);const U2=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],H2=xe("arrow-down",U2);const W2=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],V2=xe("arrow-left",W2);const q2=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],Z2=xe("arrow-up-right",q2);const G2=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],K2=xe("arrow-up",G2);const J2=[["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"}]],Y2=xe("bell",J2);const X2=[["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"}]],Q2=xe("blocks",X2);const ew=[["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"}]],kp=xe("brain",ew);const tw=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],tt=xe("check",tw);const nw=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],gt=xe("chevron-down",nw);const rw=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],ow=xe("chevron-left",rw);const sw=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Ft=xe("chevron-right",sw);const iw=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],gl=xe("chevron-up",iw);const aw=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],_p=xe("chevrons-down",aw);const lw=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],cw=xe("chevrons-left",lw);const uw=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],dw=xe("chevrons-right",uw);const fw=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],pw=xe("chevrons-up",fw);const hw=[["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"}]],eo=xe("circle-alert",hw);const mw=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],gw=xe("circle-check-big",mw);const xw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Hc=xe("circle-check",xw);const bw=[["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"}]],yw=xe("circle-question-mark",bw);const vw=[["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"}]],Sp=xe("circle-x",vw);const ww=[["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"}]],kw=xe("clapperboard",ww);const _w=[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Sw=xe("clock-3",_w);const Cw=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],wn=xe("clock",Cw);const jw=[["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"}]],Nw=xe("cloud-upload",jw);const Ew=[["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"}]],Tw=xe("code-xml",Ew);const Aw=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Iw=xe("columns-2",Aw);const zw=[["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"}]],St=xe("copy",zw);const Rw=[["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"}]],Fs=xe("download",Rw);const Pw=[["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"}]],Ow=xe("ellipsis",Pw);const Mw=[["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"}]],xl=xe("external-link",Mw);const Lw=[["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"}]],bl=xe("eye-off",Lw);const Dw=[["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"}]],yl=xe("eye",Dw);const Fw=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 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"}]],$w=xe("file-braces",Fw);const Bw=[["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"}]],Uw=xe("file-diff",Bw);const Hw=[["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"}]],Ww=xe("file-search",Hw);const Vw=[["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"}]],qw=xe("file-terminal",Vw);const Zw=[["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"}]],Gw=xe("file-text",Zw);const Kw=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],vl=xe("gauge",Kw);const Jw=[["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=xe("git-compare-arrows",Jw);const Xw=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],Cp=xe("globe",Xw);const Qw=[["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"}]],ek=xe("history",Qw);const tk=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],nk=xe("info",tk);const rk=[["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=xe("layers",rk);const ok=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Tt=xe("loader-circle",ok);const sk=[["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"}]],ik=xe("lock",sk);const ak=[["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"}]],$s=xe("message-square",ak);const lk=[["path",{d:"M5 12h14",key:"1ays0h"}]],ck=xe("minus",lk);const uk=[["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"}]],dk=xe("mouse-pointer-click",uk);const fk=[["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"}]],pk=xe("octagon-alert",fk);const hk=[["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"}]],jp=xe("pencil",hk);const mk=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ia=xe("plus",mk);const gk=[["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"}]],Vc=xe("radio",gk);const xk=[["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"}]],cs=xe("refresh-cw",xk);const bk=[["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"}]],yk=xe("rotate-ccw",bk);const vk=[["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"}]],aa=xe("rotate-cw",vk);const wk=[["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"}]],kk=xe("rows-3",wk);const _k=[["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"}]],Sk=xe("save",_k);const Ck=[["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"}]],jk=xe("scan",Ck);const Nk=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ek=xe("search",Nk);const Tk=[["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"}]],Ak=xe("server",Tk);const Ik=[["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"}]],zk=xe("settings",Ik);const Rk=[["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"}]],Pk=xe("shield-alert",Rk);const Ok=[["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"}]],qc=xe("shield-check",Ok);const Mk=[["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"}]],la=xe("siren",Mk);const Lk=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],wl=xe("terminal",Lk);const Dk=[["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"}]],mr=xe("trash-2",Dk);const Fk=[["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"}]],Pn=xe("triangle-alert",Fk);const $k=[["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=xe("upload",$k);const Bk=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Uk=xe("user",Bk);const Hk=[["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"}]],Wk=xe("wifi-off",Hk);const Vk=[["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"}]],qk=xe("wifi",Vk);const Zk=[["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"}]],co=xe("wrench",Zk);const Gk=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],kl=xe("x",Gk);const Kk=[["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"}]],to=xe("zap",Kk),ca="/api/config";async function Jk(e){return vn(e,Ds,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function Yk(e){return vn(ca,Ds,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function Xk(){const e=Un(ca,Jk,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=yf(),n=e.data?.hasSeenOnboarding??!1,r=e.data?.captureMode??hl,o=async()=>{await t(ca,Yk({hasSeenOnboarding:!0}),{optimisticData:{stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:!0,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??is,providerTestTimeoutSeconds:e.data?.providerTestTimeoutSeconds??as,timeDisplayFormat:e.data?.timeDisplayFormat??ls,captureMode:r},rollbackOnError:!0,revalidate:!1})};return{hasSeenOnboarding:n,captureMode:r,isLoading:e.isLoading,markSeen:o}}function Qk(){const{hasSeenOnboarding:e,isLoading:t,markSeen:n}=Xk(),[r,o]=g.useState(!1);if(t||e)return null;const i=r?"grid":"hidden sm:grid";return s.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:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(nk,{className:"mt-0.5 size-4 shrink-0 text-amber-300","aria-hidden":"true"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[s.jsx("span",{className:"font-medium text-amber-200",children:"Inspector ready"}),s.jsx("span",{className:"hidden truncate text-xs text-muted-foreground sm:inline",children:"Request, response, tool, timing, token, replay, and memory signals are active."})]}),s.jsx("div",{className:"mt-1 text-xs leading-relaxed text-muted-foreground sm:hidden",children:"Core capture is active."}),s.jsxs("div",{className:`${i} mt-2 gap-x-4 gap-y-1 text-xs leading-relaxed text-muted-foreground sm:grid-cols-2`,children:[s.jsxs("div",{children:[s.jsx("strong",{children:"Evidence"}),": logs, sessions, groups, and MCP exports are available."]}),s.jsxs("div",{children:[s.jsx("strong",{children:"Network"}),": replace ",s.jsx("code",{children:"localhost"})," if containers differ."]})]})]}),s.jsx("button",{type:"button",onClick:()=>o(a=>!a),className:"inline-flex h-8 shrink-0 items-center gap-1 rounded-md border border-amber-500/30 px-2 text-xs text-amber-200 transition-colors hover:bg-amber-500/10 sm:hidden","aria-expanded":r,"aria-label":r?"Hide onboarding details":"Show onboarding details",children:s.jsx(gt,{className:`size-3.5 transition-transform ${r?"rotate-180":""}`})}),s.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:[s.jsx(tt,{className:"size-3.5"}),"Got it"]}),s.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:s.jsx(kl,{className:"size-3.5"})})]})})}function No(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 mi={exports:{}};var Zc;function e_(){return Zc||(Zc=1,(function(e,t){(function(n){e.exports=n()})(function(){return(function n(r,o,i){function a(u,d){if(!o[u]){if(!r[u]){var f=typeof No=="function"&&No;if(!d&&f)return f(u,!0);if(l)return l(u,!0);var h=new Error("Cannot find module '"+u+"'");throw h.code="MODULE_NOT_FOUND",h}var p=o[u]={exports:{}};r[u][0].call(p.exports,function(y){var m=r[u][1][y];return a(m||y)},p,p.exports,n,r,o,i)}return o[u].exports}for(var l=typeof No=="function"&&No,c=0;c<i.length;c++)a(i[c]);return a})({1:[function(n,r,o){var i=n("./utils"),a=n("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(c){for(var u,d,f,h,p,y,m,x=[],b=0,v=c.length,w=v,C=i.getTypeOf(c)!=="string";b<c.length;)w=v-b,f=C?(u=c[b++],d=b<v?c[b++]:0,b<v?c[b++]:0):(u=c.charCodeAt(b++),d=b<v?c.charCodeAt(b++):0,b<v?c.charCodeAt(b++):0),h=u>>2,p=(3&u)<<4|d>>4,y=1<w?(15&d)<<2|f>>6:64,m=2<w?63&f:64,x.push(l.charAt(h)+l.charAt(p)+l.charAt(y)+l.charAt(m));return x.join("")},o.decode=function(c){var u,d,f,h,p,y,m=0,x=0,b="data:";if(c.substr(0,b.length)===b)throw new Error("Invalid base64 input, it looks like a data url.");var v,w=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&w--,c.charAt(c.length-2)===l.charAt(64)&&w--,w%1!=0)throw new Error("Invalid base64 input, bad content length.");for(v=a.uint8array?new Uint8Array(0|w):new Array(0|w);m<c.length;)u=l.indexOf(c.charAt(m++))<<2|(h=l.indexOf(c.charAt(m++)))>>4,d=(15&h)<<4|(p=l.indexOf(c.charAt(m++)))>>2,f=(3&p)<<6|(y=l.indexOf(c.charAt(m++))),v[x++]=u,p!==64&&(v[x++]=d),y!==64&&(v[x++]=f);return v}},{"./support":30,"./utils":32}],2:[function(n,r,o){var i=n("./external"),a=n("./stream/DataWorker"),l=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function u(d,f,h,p,y){this.compressedSize=d,this.uncompressedSize=f,this.crc32=h,this.compression=p,this.compressedContent=y}u.prototype={getContentWorker:function(){var d=new a(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)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,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,r,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})();r.exports=function(l,c){return l!==void 0&&l.length?i.getTypeOf(l)!=="string"?(function(u,d,f,h){var p=a,y=h+f;u^=-1;for(var m=h;m<y;m++)u=u>>>8^p[255&(u^d[m])];return-1^u})(0|c,l,l.length,0):(function(u,d,f,h){var p=a,y=h+f;u^=-1;for(var m=h;m<y;m++)u=u>>>8^p[255&(u^d.charCodeAt(m))];return-1^u})(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(n,r,o){o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){var i=null;i=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:i}},{lie:37}],7:[function(n,r,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,r,o){function i(p,y){var m,x="";for(m=0;m<y;m++)x+=String.fromCharCode(255&p),p>>>=8;return x}function a(p,y,m,x,b,v){var w,C,S=p.file,j=p.compression,N=v!==u.utf8encode,A=l.transformTo("string",v(S.name)),z=l.transformTo("string",u.utf8encode(S.name)),L=S.comment,U=l.transformTo("string",v(L)),E=l.transformTo("string",u.utf8encode(L)),O=z.length!==S.name.length,k=E.length!==L.length,D="",q="",W="",B=S.dir,J=S.date,I={crc32:0,compressedSize:0,uncompressedSize:0};y&&!m||(I.crc32=p.crc32,I.compressedSize=p.compressedSize,I.uncompressedSize=p.uncompressedSize);var K=0;y&&(K|=8),N||!O&&!k||(K|=2048);var Z=0,R=0;B&&(Z|=16),b==="UNIX"?(R=798,Z|=(function(de,ke){var pe=de;return de||(pe=ke?16893:33204),(65535&pe)<<16})(S.unixPermissions,B)):(R=20,Z|=(function(de){return 63&(de||0)})(S.dosPermissions)),w=J.getUTCHours(),w<<=6,w|=J.getUTCMinutes(),w<<=5,w|=J.getUTCSeconds()/2,C=J.getUTCFullYear()-1980,C<<=4,C|=J.getUTCMonth()+1,C<<=5,C|=J.getUTCDate(),O&&(q=i(1,1)+i(d(A),4)+z,D+="up"+i(q.length,2)+q),k&&(W=i(1,1)+i(d(U),4)+E,D+="uc"+i(W.length,2)+W);var ae="";return ae+=`
41
+ \0`,ae+=i(K,2),ae+=j.magic,ae+=i(w,2),ae+=i(C,2),ae+=i(I.crc32,4),ae+=i(I.compressedSize,4),ae+=i(I.uncompressedSize,4),ae+=i(A.length,2),ae+=i(D.length,2),{fileRecord:f.LOCAL_FILE_HEADER+ae+A+D,dirRecord:f.CENTRAL_FILE_HEADER+i(R,2)+ae+i(U.length,2)+"\0\0\0\0"+i(Z,4)+i(x,4)+A+D+U}}var l=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function h(p,y,m,x){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=y,this.zipPlatform=m,this.encodeFileName=x,this.streamFiles=p,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}l.inherits(h,c),h.prototype.push=function(p){var y=p.meta.percent||0,m=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(p):(this.bytesWritten+=p.data.length,c.prototype.push.call(this,{data:p.data,meta:{currentFile:this.currentFile,percent:m?(y+100*(m-x-1))/m:100}}))},h.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var y=this.streamFiles&&!p.file.dir;if(y){var m=a(p,y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(p){this.accumulate=!1;var y=this.streamFiles&&!p.file.dir,m=a(p,y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),y)this.push({data:(function(x){return f.DATA_DESCRIPTOR+i(x.crc32,4)+i(x.compressedSize,4)+i(x.uncompressedSize,4)})(p),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var p=this.bytesWritten,y=0;y<this.dirRecords.length;y++)this.push({data:this.dirRecords[y],meta:{percent:100}});var m=this.bytesWritten-p,x=(function(b,v,w,C,S){var j=l.transformTo("string",S(C));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(b,2)+i(b,2)+i(v,4)+i(w,4)+i(j.length,2)+j})(this.dirRecords.length,m,p,this.zipComment,this.encodeFileName);this.push({data:x,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(p){this._sources.push(p);var y=this;return p.on("data",function(m){y.processChunk(m)}),p.on("end",function(){y.closedSource(y.previous.streamInfo),y._sources.length?y.prepareNextSource():y.end()}),p.on("error",function(m){y.error(m)}),this},h.prototype.resume=function(){return!!c.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},h.prototype.error=function(p){var y=this._sources;if(!c.prototype.error.call(this,p))return!1;for(var m=0;m<y.length;m++)try{y[m].error(p)}catch{}return!0},h.prototype.lock=function(){c.prototype.lock.call(this);for(var p=this._sources,y=0;y<p.length;y++)p[y].lock()},r.exports=h},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){var 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,p){f++;var y=(function(v,w){var C=v||w,S=i[C];if(!S)throw new Error(C+" is not a valid compression method !");return S})(p.options.compression,c.compression),m=p.options.compressionOptions||c.compressionOptions||{},x=p.dir,b=p.date;p._compressWorker(y,m).withStreamInfo("file",{name:h,dir:x,date:b,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(h){d.error(h)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){function 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"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,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(p,y){var m=h.decompressed.getContentWorker().pipe(new u);m.on("error",function(x){y(x)}).on("end",function(){m.streamInfo.crc32!==h.decompressed.crc32?y(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}r.exports=function(h,p){var y=this;return p=i.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),d.isNode&&d.isStream(h)?a.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",h,!0,p.optimizedBinaryString,p.base64).then(function(m){var x=new c(p);return x.load(m),x}).then(function(m){var x=[a.Promise.resolve(m)],b=m.files;if(p.checkCRC32)for(var v=0;v<b.length;v++)x.push(f(b[v]));return a.Promise.all(x)}).then(function(m){for(var x=m.shift(),b=x.files,v=0;v<b.length;v++){var w=b[v],C=w.fileNameStr,S=i.resolve(w.fileNameStr);y.file(S,w.decompressed,{binary:!0,optimizedBinaryString:!0,date:w.date,dir:w.dir,comment:w.fileCommentStr.length?w.fileCommentStr:null,unixPermissions:w.unixPermissions,dosPermissions:w.dosPermissions,createFolders:p.createFolders}),w.dir||(y.file(S).unsafeOriginalName=C)}return x.zipComment.length&&(y.comment=x.zipComment),y})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){var 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)},r.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,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()},r.exports=a},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){r.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,r,o){function i(S,j,N){var A,z=l.getTypeOf(j),L=l.extend(N||{},d);L.date=L.date||new Date,L.compression!==null&&(L.compression=L.compression.toUpperCase()),typeof L.unixPermissions=="string"&&(L.unixPermissions=parseInt(L.unixPermissions,8)),L.unixPermissions&&16384&L.unixPermissions&&(L.dir=!0),L.dosPermissions&&16&L.dosPermissions&&(L.dir=!0),L.dir&&(S=b(S)),L.createFolders&&(A=x(S))&&v.call(this,A,!0);var U=z==="string"&&L.binary===!1&&L.base64===!1;N&&N.binary!==void 0||(L.binary=!U),(j instanceof f&&j.uncompressedSize===0||L.dir||!j||j.length===0)&&(L.base64=!1,L.binary=!0,j="",L.compression="STORE",z="string");var E=null;E=j instanceof f||j instanceof c?j:y.isNode&&y.isStream(j)?new m(S,j):l.prepareContent(S,j,L.binary,L.optimizedBinaryString,L.base64);var O=new h(S,E,L);this.files[S]=O}var a=n("./utf8"),l=n("./utils"),c=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),h=n("./zipObject"),p=n("./generate"),y=n("./nodejsUtils"),m=n("./nodejs/NodejsStreamInputAdapter"),x=function(S){S.slice(-1)==="/"&&(S=S.substring(0,S.length-1));var j=S.lastIndexOf("/");return 0<j?S.substring(0,j):""},b=function(S){return S.slice(-1)!=="/"&&(S+="/"),S},v=function(S,j){return j=j!==void 0?j:d.createFolders,S=b(S),this.files[S]||i.call(this,S,null,{dir:!0,createFolders:j}),this.files[S]};function w(S){return Object.prototype.toString.call(S)==="[object RegExp]"}var C={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(S){var j,N,A;for(j in this.files)A=this.files[j],(N=j.slice(this.root.length,j.length))&&j.slice(0,this.root.length)===this.root&&S(N,A)},filter:function(S){var j=[];return this.forEach(function(N,A){S(N,A)&&j.push(A)}),j},file:function(S,j,N){if(arguments.length!==1)return S=this.root+S,i.call(this,S,j,N),this;if(w(S)){var A=S;return this.filter(function(L,U){return!U.dir&&A.test(L)})}var z=this.files[this.root+S];return z&&!z.dir?z:null},folder:function(S){if(!S)return this;if(w(S))return this.filter(function(z,L){return L.dir&&S.test(z)});var j=this.root+S,N=v.call(this,j),A=this.clone();return A.root=N.name,A},remove:function(S){S=this.root+S;var j=this.files[S];if(j||(S.slice(-1)!=="/"&&(S+="/"),j=this.files[S]),j&&!j.dir)delete this.files[S];else for(var N=this.filter(function(z,L){return L.name.slice(0,S.length)===S}),A=0;A<N.length;A++)delete this.files[N[A].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(S){var j,N={};try{if((N=l.extend(S||{},{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 A=N.comment||this.comment||"";j=p.generateWorker(this,N,A)}catch(z){(j=new c("error")).error(z)}return new u(j,N.type||"string",N.mimeType)},generateAsync:function(S,j){return this.generateInternalStream(S).accumulate(j)},generateNodeStream:function(S,j){return(S=S||{}).type||(S.type="nodebuffer"),this.generateInternalStream(S).toNodejsStream(j)}};r.exports=C},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,o){r.exports=n("stream")},{stream:void 0}],17:[function(n,r,o){var 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},r.exports=a},{"../utils":32,"./DataReader":18}],18:[function(n,r,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))}},r.exports=a},{"../utils":32}],19:[function(n,r,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},r.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,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},r.exports=a},{"../utils":32,"./DataReader":18}],21:[function(n,r,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},r.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){var i=n("../utils"),a=n("../support"),l=n("./ArrayReader"),c=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.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,r,o){o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){var 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})},r.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,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)},r.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,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)},r.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,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}})},r.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,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}},r.exports=i},{}],29:[function(n,r,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(y,m){return new d.Promise(function(x,b){var v=[],w=y._internalType,C=y._outputType,S=y._mimeType;y.on("data",function(j,N){v.push(j),m&&m(N)}).on("error",function(j){v=[],b(j)}).on("end",function(){try{var j=(function(N,A,z){switch(N){case"blob":return i.newBlob(i.transformTo("arraybuffer",A),z);case"base64":return c.encode(A);default:return i.transformTo(N,A)}})(C,(function(N,A){var z,L=0,U=null,E=0;for(z=0;z<A.length;z++)E+=A[z].length;switch(N){case"string":return A.join("");case"array":return Array.prototype.concat.apply([],A);case"uint8array":for(U=new Uint8Array(E),z=0;z<A.length;z++)U.set(A[z],L),L+=A[z].length;return U;case"nodebuffer":return Buffer.concat(A);default:throw new Error("concat : unsupported type '"+N+"'")}})(w,v),S);x(j)}catch(N){b(N)}v=[]}).resume()})}function p(y,m,x){var b=m;switch(m){case"blob":case"arraybuffer":b="uint8array";break;case"base64":b="string"}try{this._internalType=b,this._outputType=m,this._mimeType=x,i.checkSupport(b),this._worker=y.pipe(new a(b)),y.lock()}catch(v){this._worker=new l("error"),this._worker.error(v)}}p.prototype={accumulate:function(y){return h(this,y)},on:function(y,m){var x=this;return y==="data"?this._worker.on(y,function(b){m.call(x,b.data,b.meta)}):this._worker.on(y,function(){i.delay(m,arguments,x)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(y){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"},y)}},r.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var 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,r,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(p){return a.nodebuffer?l.newBufferFrom(p,"utf-8"):(function(y){var m,x,b,v,w,C=y.length,S=0;for(v=0;v<C;v++)(64512&(x=y.charCodeAt(v)))==55296&&v+1<C&&(64512&(b=y.charCodeAt(v+1)))==56320&&(x=65536+(x-55296<<10)+(b-56320),v++),S+=x<128?1:x<2048?2:x<65536?3:4;for(m=a.uint8array?new Uint8Array(S):new Array(S),v=w=0;w<S;v++)(64512&(x=y.charCodeAt(v)))==55296&&v+1<C&&(64512&(b=y.charCodeAt(v+1)))==56320&&(x=65536+(x-55296<<10)+(b-56320),v++),x<128?m[w++]=x:(x<2048?m[w++]=192|x>>>6:(x<65536?m[w++]=224|x>>>12:(m[w++]=240|x>>>18,m[w++]=128|x>>>12&63),m[w++]=128|x>>>6&63),m[w++]=128|63&x);return m})(p)},o.utf8decode=function(p){return a.nodebuffer?i.transformTo("nodebuffer",p).toString("utf-8"):(function(y){var m,x,b,v,w=y.length,C=new Array(2*w);for(m=x=0;m<w;)if((b=y[m++])<128)C[x++]=b;else if(4<(v=u[b]))C[x++]=65533,m+=v-1;else{for(b&=v===2?31:v===3?15:7;1<v&&m<w;)b=b<<6|63&y[m++],v--;1<v?C[x++]=65533:b<65536?C[x++]=b:(b-=65536,C[x++]=55296|b>>10&1023,C[x++]=56320|1023&b)}return C.length!==x&&(C.subarray?C=C.subarray(0,x):C.length=x),i.applyFromCharCode(C)})(p=i.transformTo(a.uint8array?"uint8array":"array",p))},i.inherits(f,c),f.prototype.processChunk=function(p){var y=i.transformTo(a.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var m=y;(y=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),y.set(m,this.leftOver.length)}else y=this.leftOver.concat(y);this.leftOver=null}var x=(function(v,w){var C;for((w=w||v.length)>v.length&&(w=v.length),C=w-1;0<=C&&(192&v[C])==128;)C--;return C<0||C===0?w:C+u[v[C]]>w?C:w})(y),b=y;x!==y.length&&(a.uint8array?(b=y.subarray(0,x),this.leftOver=y.subarray(x,y.length)):(b=y.slice(0,x),this.leftOver=y.slice(x,y.length))),this.push({data:o.utf8decode(b),meta:p.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=f,i.inherits(h,c),h.prototype.processChunk=function(p){this.push({data:o.utf8encode(p.data),meta:p.meta})},o.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){var i=n("./support"),a=n("./base64"),l=n("./nodejsUtils"),c=n("./external");function u(m){return m}function d(m,x){for(var b=0;b<m.length;++b)x[b]=255&m.charCodeAt(b);return x}n("setimmediate"),o.newBlob=function(m,x){o.checkSupport("blob");try{return new Blob([m],{type:x})}catch{try{var b=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return b.append(m),b.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(m,x,b){var v=[],w=0,C=m.length;if(C<=b)return String.fromCharCode.apply(null,m);for(;w<C;)x==="array"||x==="nodebuffer"?v.push(String.fromCharCode.apply(null,m.slice(w,Math.min(w+b,C)))):v.push(String.fromCharCode.apply(null,m.subarray(w,Math.min(w+b,C)))),w+=b;return v.join("")},stringifyByChar:function(m){for(var x="",b=0;b<m.length;b++)x+=String.fromCharCode(m[b]);return x},applyCanBeUsed:{uint8array:(function(){try{return 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(m){var x=65536,b=o.getTypeOf(m),v=!0;if(b==="uint8array"?v=f.applyCanBeUsed.uint8array:b==="nodebuffer"&&(v=f.applyCanBeUsed.nodebuffer),v)for(;1<x;)try{return f.stringifyByChunk(m,b,x)}catch{x=Math.floor(x/2)}return f.stringifyByChar(m)}function p(m,x){for(var b=0;b<m.length;b++)x[b]=m[b];return x}o.applyFromCharCode=h;var y={};y.string={string:u,array:function(m){return d(m,new Array(m.length))},arraybuffer:function(m){return y.string.uint8array(m).buffer},uint8array:function(m){return d(m,new Uint8Array(m.length))},nodebuffer:function(m){return d(m,l.allocBuffer(m.length))}},y.array={string:h,array:u,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return l.newBufferFrom(m)}},y.arraybuffer={string:function(m){return h(new Uint8Array(m))},array:function(m){return p(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:u,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return l.newBufferFrom(new Uint8Array(m))}},y.uint8array={string:h,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:u,nodebuffer:function(m){return l.newBufferFrom(m)}},y.nodebuffer={string:h,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return y.nodebuffer.uint8array(m).buffer},uint8array:function(m){return p(m,new Uint8Array(m.length))},nodebuffer:u},o.transformTo=function(m,x){if(x=x||"",!m)return x;o.checkSupport(m);var b=o.getTypeOf(x);return y[b][m](x)},o.resolve=function(m){for(var x=m.split("/"),b=[],v=0;v<x.length;v++){var w=x[v];w==="."||w===""&&v!==0&&v!==x.length-1||(w===".."?b.pop():b.push(w))}return b.join("/")},o.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":i.nodebuffer&&l.isBuffer(m)?"nodebuffer":i.uint8array&&m instanceof Uint8Array?"uint8array":i.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(m){if(!i[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(m){var x,b,v="";for(b=0;b<(m||"").length;b++)v+="\\x"+((x=m.charCodeAt(b))<16?"0":"")+x.toString(16).toUpperCase();return v},o.delay=function(m,x,b){setImmediate(function(){m.apply(b||null,x||[])})},o.inherits=function(m,x){function b(){}b.prototype=x.prototype,m.prototype=new b},o.extend=function(){var m,x,b={};for(m=0;m<arguments.length;m++)for(x in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],x)&&b[x]===void 0&&(b[x]=arguments[m][x]);return b},o.prepareContent=function(m,x,b,v,w){return c.Promise.resolve(x).then(function(C){return i.blob&&(C instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(C))!==-1)&&typeof FileReader<"u"?new c.Promise(function(S,j){var N=new FileReader;N.onload=function(A){S(A.target.result)},N.onerror=function(A){j(A.target.error)},N.readAsArrayBuffer(C)}):C}).then(function(C){var S=o.getTypeOf(C);return S?(S==="arraybuffer"?C=o.transformTo("uint8array",C):S==="string"&&(w?C=a.decode(C):b&&v!==!0&&(C=(function(j){return d(j,i.uint8array?new Uint8Array(j.length):new Array(j.length))})(C))),C):c.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){var 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 p=this.reader.index;this.reader.setIndex(f);var y=this.reader.readString(4)===h;return this.reader.setIndex(p),y},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),h=u.uint8array?"uint8array":"array",p=a.transformTo(h,f);this.zipComment=this.loadOptions.decodeFileName(p)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,h,p,y=this.zip64EndOfCentralSize-44;0<y;)f=this.reader.readInt(2),h=this.reader.readInt(4),p=this.reader.readData(h),this.zip64ExtensibleData[f]={id:f,length:h,value:p}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,h;for(f=0;f<this.files.length;f++)h=this.files[f],this.reader.setIndex(h.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),h.readLocalPart(this.reader),h.handleUTF8(),h.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(l.CENTRAL_FILE_HEADER);)(f=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var f=this.reader.lastIndexOfSignature(l.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,l.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var h=f;if(this.checkSignature(l.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===a.MAX_VALUE_16BITS||this.diskWithCentralDirStart===a.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===a.MAX_VALUE_16BITS||this.centralDirRecords===a.MAX_VALUE_16BITS||this.centralDirSize===a.MAX_VALUE_32BITS||this.centralDirOffset===a.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,l.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(l.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var p=this.centralDirOffset+this.centralDirSize;this.zip64&&(p+=20,p+=12+this.zip64EndOfCentralSize);var y=h-p;if(0<y)this.isSignature(h,l.CENTRAL_FILE_HEADER)||(this.reader.zero=y);else if(y<0)throw new Error("Corrupted zip: missing "+Math.abs(y)+" bytes.")},prepareReader:function(f){this.reader=i(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){var i=n("./reader/readerFor"),a=n("./utils"),l=n("./compressedObject"),c=n("./crc32"),u=n("./utf8"),d=n("./compressions"),f=n("./support");function h(p,y){this.options=p,this.loadOptions=y}h.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var y,m;if(p.skip(22),this.fileNameLength=p.readInt(2),m=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(m),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((y=(function(x){for(var b in d)if(Object.prototype.hasOwnProperty.call(d,b)&&d[b].magic===x)return d[b];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+a.pretty(this.compressionMethod)+" unknown (inner file : "+a.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,y,p.readData(this.compressedSize))},readCentralPart:function(p){this.versionMadeBy=p.readInt(2),p.skip(2),this.bitFlag=p.readInt(2),this.compressionMethod=p.readString(2),this.date=p.readDate(),this.crc32=p.readInt(4),this.compressedSize=p.readInt(4),this.uncompressedSize=p.readInt(4);var y=p.readInt(2);if(this.extraFieldsLength=p.readInt(2),this.fileCommentLength=p.readInt(2),this.diskNumberStart=p.readInt(2),this.internalFileAttributes=p.readInt(2),this.externalFileAttributes=p.readInt(4),this.localHeaderOffset=p.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");p.skip(y),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=i(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var y,m,x,b=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<b;)y=p.readInt(2),m=p.readInt(2),x=p.readData(m),this.extraFields[y]={id:y,length:m,value:x};p.setIndex(b)},handleUTF8:function(){var p=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var y=this.findExtraFieldUnicodePath();if(y!==null)this.fileNameStr=y;else{var m=a.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var b=a.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(b)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var y=i(p.value);return y.readInt(1)!==1||c(this.fileName)!==y.readInt(4)?null:u.utf8decode(y.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var y=i(p.value);return y.readInt(1)!==1||c(this.fileComment)!==y.readInt(4)?null:u.utf8decode(y.readData(p.length-5))}return null}},r.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){function i(y,m,x){this.name=y,this.dir=x.dir,this.date=x.date,this.comment=x.comment,this.unixPermissions=x.unixPermissions,this.dosPermissions=x.dosPermissions,this._data=m,this._dataBinary=x.binary,this.options={compression:x.compression,compressionOptions:x.compressionOptions}}var a=n("./stream/StreamHelper"),l=n("./stream/DataWorker"),c=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");i.prototype={internalStream:function(y){var m=null,x="string";try{if(!y)throw new Error("No output type specified.");var b=(x=y.toLowerCase())==="string"||x==="text";x!=="binarystring"&&x!=="text"||(x="string"),m=this._decompressWorker();var v=!this._dataBinary;v&&!b&&(m=m.pipe(new c.Utf8EncodeWorker)),!v&&b&&(m=m.pipe(new c.Utf8DecodeWorker))}catch(w){(m=new d("error")).error(w)}return new a(m,x,"")},async:function(y,m){return this.internalStream(y).accumulate(m)},nodeStream:function(y,m){return this.internalStream(y||"nodebuffer").toNodejsStream(m)},_compressWorker:function(y,m){if(this._data instanceof u&&this._data.compression.magic===y.magic)return this._data.getCompressedWorker();var x=this._decompressWorker();return this._dataBinary||(x=x.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(x,y,m)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new l(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<f.length;p++)i.prototype[f[p]]=h;r.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(i){var a,l,c=i.MutationObserver||i.WebKitMutationObserver;if(c){var u=0,d=new c(y),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 m=i.document.createElement("script");m.onreadystatechange=function(){y(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},i.document.documentElement.appendChild(m)}:function(){setTimeout(y,0)};else{var h=new i.MessageChannel;h.port1.onmessage=y,a=function(){h.port2.postMessage(0)}}var p=[];function y(){var m,x;l=!0;for(var b=p.length;b;){for(x=p,p=[],m=-1;++m<b;)x[m]();b=p.length}l=!1}r.exports=function(m){p.push(m)!==1||l||a()}}).call(this,typeof ko<"u"?ko:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,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&&m(this,b)}function h(b,v,w){this.promise=b,typeof v=="function"&&(this.onFulfilled=v,this.callFulfilled=this.otherCallFulfilled),typeof w=="function"&&(this.onRejected=w,this.callRejected=this.otherCallRejected)}function p(b,v,w){i(function(){var C;try{C=v(w)}catch(S){return l.reject(b,S)}C===b?l.reject(b,new TypeError("Cannot resolve promise with itself")):l.resolve(b,C)})}function y(b){var v=b&&b.then;if(b&&(typeof b=="object"||typeof b=="function")&&typeof v=="function")return function(){v.apply(b,arguments)}}function m(b,v){var w=!1;function C(N){w||(w=!0,l.reject(b,N))}function S(N){w||(w=!0,l.resolve(b,N))}var j=x(function(){v(S,C)});j.status==="error"&&C(j.value)}function x(b,v){var w={};try{w.value=b(v),w.status="success"}catch(C){w.status="error",w.value=C}return w}(r.exports=f).prototype.finally=function(b){if(typeof b!="function")return this;var v=this.constructor;return this.then(function(w){return v.resolve(b()).then(function(){return w})},function(w){return v.resolve(b()).then(function(){throw w})})},f.prototype.catch=function(b){return this.then(null,b)},f.prototype.then=function(b,v){if(typeof b!="function"&&this.state===u||typeof v!="function"&&this.state===c)return this;var w=new this.constructor(a);return this.state!==d?p(w,this.state===u?b:v,this.outcome):this.queue.push(new h(w,b,v)),w},h.prototype.callFulfilled=function(b){l.resolve(this.promise,b)},h.prototype.otherCallFulfilled=function(b){p(this.promise,this.onFulfilled,b)},h.prototype.callRejected=function(b){l.reject(this.promise,b)},h.prototype.otherCallRejected=function(b){p(this.promise,this.onRejected,b)},l.resolve=function(b,v){var w=x(y,v);if(w.status==="error")return l.reject(b,w.value);var C=w.value;if(C)m(b,C);else{b.state=u,b.outcome=v;for(var S=-1,j=b.queue.length;++S<j;)b.queue[S].callFulfilled(v)}return b},l.reject=function(b,v){b.state=c,b.outcome=v;for(var w=-1,C=b.queue.length;++w<C;)b.queue[w].callRejected(v);return b},f.resolve=function(b){return b instanceof this?b:l.resolve(new this(a),b)},f.reject=function(b){var v=new this(a);return l.reject(v,b)},f.all=function(b){var v=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=b.length,C=!1;if(!w)return this.resolve([]);for(var S=new Array(w),j=0,N=-1,A=new this(a);++N<w;)z(b[N],N);return A;function z(L,U){v.resolve(L).then(function(E){S[U]=E,++j!==w||C||(C=!0,l.resolve(A,S))},function(E){C||(C=!0,l.reject(A,E))})}},f.race=function(b){var v=this;if(Object.prototype.toString.call(b)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=b.length,C=!1;if(!w)return this.resolve([]);for(var S=-1,j=new this(a);++S<w;)N=b[S],v.resolve(N).then(function(A){C||(C=!0,l.resolve(j,A))},function(A){C||(C=!0,l.reject(j,A))});var N;return j}},{immediate:36}],38:[function(n,r,o){var i={};(0,n("./lib/utils/common").assign)(i,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,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,p=0,y=8;function m(b){if(!(this instanceof m))return new m(b);this.options=a.assign({level:h,method:y,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},b||{});var v=this.options;v.raw&&0<v.windowBits?v.windowBits=-v.windowBits:v.gzip&&0<v.windowBits&&v.windowBits<16&&(v.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var w=i.deflateInit2(this.strm,v.level,v.method,v.windowBits,v.memLevel,v.strategy);if(w!==f)throw new Error(c[w]);if(v.header&&i.deflateSetHeader(this.strm,v.header),v.dictionary){var C;if(C=typeof v.dictionary=="string"?l.string2buf(v.dictionary):d.call(v.dictionary)==="[object ArrayBuffer]"?new Uint8Array(v.dictionary):v.dictionary,(w=i.deflateSetDictionary(this.strm,C))!==f)throw new Error(c[w]);this._dict_set=!0}}function x(b,v){var w=new m(v);if(w.push(b,!0),w.err)throw w.msg||c[w.err];return w.result}m.prototype.push=function(b,v){var w,C,S=this.strm,j=this.options.chunkSize;if(this.ended)return!1;C=v===~~v?v:v===!0?4:0,typeof b=="string"?S.input=l.string2buf(b):d.call(b)==="[object ArrayBuffer]"?S.input=new Uint8Array(b):S.input=b,S.next_in=0,S.avail_in=S.input.length;do{if(S.avail_out===0&&(S.output=new a.Buf8(j),S.next_out=0,S.avail_out=j),(w=i.deflate(S,C))!==1&&w!==f)return this.onEnd(w),!(this.ended=!0);S.avail_out!==0&&(S.avail_in!==0||C!==4&&C!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(a.shrinkBuf(S.output,S.next_out))):this.onData(a.shrinkBuf(S.output,S.next_out)))}while((0<S.avail_in||S.avail_out===0)&&w!==1);return C===4?(w=i.deflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===f):C!==2||(this.onEnd(f),!(S.avail_out=0))},m.prototype.onData=function(b){this.chunks.push(b)},m.prototype.onEnd=function(b){b===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=b,this.msg=this.strm.msg},o.Deflate=m,o.deflate=x,o.deflateRaw=function(b,v){return(v=v||{}).raw=!0,x(b,v)},o.gzip=function(b,v){return(v=v||{}).gzip=!0,x(b,v)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){var 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 p(m){if(!(this instanceof p))return new p(m);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},m||{});var x=this.options;x.raw&&0<=x.windowBits&&x.windowBits<16&&(x.windowBits=-x.windowBits,x.windowBits===0&&(x.windowBits=-15)),!(0<=x.windowBits&&x.windowBits<16)||m&&m.windowBits||(x.windowBits+=32),15<x.windowBits&&x.windowBits<48&&(15&x.windowBits)==0&&(x.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var b=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 y(m,x){var b=new p(x);if(b.push(m,!0),b.err)throw b.msg||u[b.err];return b.result}p.prototype.push=function(m,x){var b,v,w,C,S,j,N=this.strm,A=this.options.chunkSize,z=this.options.dictionary,L=!1;if(this.ended)return!1;v=x===~~x?x:x===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof m=="string"?N.input=l.binstring2buf(m):h.call(m)==="[object ArrayBuffer]"?N.input=new Uint8Array(m):N.input=m,N.next_in=0,N.avail_in=N.input.length;do{if(N.avail_out===0&&(N.output=new a.Buf8(A),N.next_out=0,N.avail_out=A),(b=i.inflate(N,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&z&&(j=typeof z=="string"?l.string2buf(z):h.call(z)==="[object ArrayBuffer]"?new Uint8Array(z):z,b=i.inflateSetDictionary(this.strm,j)),b===c.Z_BUF_ERROR&&L===!0&&(b=c.Z_OK,L=!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||v!==c.Z_FINISH&&v!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(w=l.utf8border(N.output,N.next_out),C=N.next_out-w,S=l.buf2string(N.output,w),N.next_out=C,N.avail_out=A-C,C&&a.arraySet(N.output,N.output,w,C,0),this.onData(S)):this.onData(a.shrinkBuf(N.output,N.next_out)))),N.avail_in===0&&N.avail_out===0&&(L=!0)}while((0<N.avail_in||N.avail_out===0)&&b!==c.Z_STREAM_END);return b===c.Z_STREAM_END&&(v=c.Z_FINISH),v===c.Z_FINISH?(b=i.inflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===c.Z_OK):v!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(N.avail_out=0))},p.prototype.onData=function(m){this.chunks.push(m)},p.prototype.onEnd=function(m){m===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},o.Inflate=p,o.inflate=y,o.inflateRaw=function(m,x){return(x=x||{}).raw=!0,y(m,x)},o.ungzip=y},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){var 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 p=0;p<f;p++)c[h+p]=u[d+p]},flattenChunks:function(c){var u,d,f,h,p,y;for(u=f=0,d=c.length;u<d;u++)f+=c[u].length;for(y=new Uint8Array(f),u=h=0,d=c.length;u<d;u++)p=c[u],y.set(p,h),h+=p.length;return y}},l={arraySet:function(c,u,d,f,h){for(var p=0;p<f;p++)c[h+p]=u[d+p]},flattenChunks:function(c){return[].concat.apply([],c)}};o.setTyped=function(c){c?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,a)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,l))},o.setTyped(i)},{}],42:[function(n,r,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 p="",y=0;y<h;y++)p+=String.fromCharCode(f[y]);return p}c[254]=c[254]=1,o.string2buf=function(f){var h,p,y,m,x,b=f.length,v=0;for(m=0;m<b;m++)(64512&(p=f.charCodeAt(m)))==55296&&m+1<b&&(64512&(y=f.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(y-56320),m++),v+=p<128?1:p<2048?2:p<65536?3:4;for(h=new i.Buf8(v),m=x=0;x<v;m++)(64512&(p=f.charCodeAt(m)))==55296&&m+1<b&&(64512&(y=f.charCodeAt(m+1)))==56320&&(p=65536+(p-55296<<10)+(y-56320),m++),p<128?h[x++]=p:(p<2048?h[x++]=192|p>>>6:(p<65536?h[x++]=224|p>>>12:(h[x++]=240|p>>>18,h[x++]=128|p>>>12&63),h[x++]=128|p>>>6&63),h[x++]=128|63&p);return h},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var h=new i.Buf8(f.length),p=0,y=h.length;p<y;p++)h[p]=f.charCodeAt(p);return h},o.buf2string=function(f,h){var p,y,m,x,b=h||f.length,v=new Array(2*b);for(p=y=0;p<b;)if((m=f[p++])<128)v[y++]=m;else if(4<(x=c[m]))v[y++]=65533,p+=x-1;else{for(m&=x===2?31:x===3?15:7;1<x&&p<b;)m=m<<6|63&f[p++],x--;1<x?v[y++]=65533:m<65536?v[y++]=m:(m-=65536,v[y++]=55296|m>>10&1023,v[y++]=56320|1023&m)}return d(v,y)},o.utf8border=function(f,h){var p;for((h=h||f.length)>f.length&&(h=f.length),p=h-1;0<=p&&(192&f[p])==128;)p--;return p<0||p===0?h:p+c[f[p]]>h?p:h}},{"./common":41}],43:[function(n,r,o){r.exports=function(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,r,o){r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){var 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})();r.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,r,o){var i,a=n("../utils/common"),l=n("./trees"),c=n("./adler32"),u=n("./crc32"),d=n("./messages"),f=0,h=4,p=0,y=-2,m=-1,x=4,b=2,v=8,w=9,C=286,S=30,j=19,N=2*C+1,A=15,z=3,L=258,U=L+z+1,E=42,O=113,k=1,D=2,q=3,W=4;function B(_,ne){return _.msg=d[ne],ne}function J(_){return(_<<1)-(4<_?9:0)}function I(_){for(var ne=_.length;0<=--ne;)_[ne]=0}function K(_){var ne=_.state,Q=ne.pending;Q>_.avail_out&&(Q=_.avail_out),Q!==0&&(a.arraySet(_.output,ne.pending_buf,ne.pending_out,Q,_.next_out),_.next_out+=Q,ne.pending_out+=Q,_.total_out+=Q,_.avail_out-=Q,ne.pending-=Q,ne.pending===0&&(ne.pending_out=0))}function Z(_,ne){l._tr_flush_block(_,0<=_.block_start?_.block_start:-1,_.strstart-_.block_start,ne),_.block_start=_.strstart,K(_.strm)}function R(_,ne){_.pending_buf[_.pending++]=ne}function ae(_,ne){_.pending_buf[_.pending++]=ne>>>8&255,_.pending_buf[_.pending++]=255&ne}function de(_,ne){var Q,M,P=_.max_chain_length,V=_.strstart,H=_.prev_length,X=_.nice_match,$=_.strstart>_.w_size-U?_.strstart-(_.w_size-U):0,oe=_.window,Y=_.w_mask,ee=_.prev,F=_.strstart+L,G=oe[V+H-1],ue=oe[V+H];_.prev_length>=_.good_match&&(P>>=2),X>_.lookahead&&(X=_.lookahead);do if(oe[(Q=ne)+H]===ue&&oe[Q+H-1]===G&&oe[Q]===oe[V]&&oe[++Q]===oe[V+1]){V+=2,Q++;do;while(oe[++V]===oe[++Q]&&oe[++V]===oe[++Q]&&oe[++V]===oe[++Q]&&oe[++V]===oe[++Q]&&oe[++V]===oe[++Q]&&oe[++V]===oe[++Q]&&oe[++V]===oe[++Q]&&oe[++V]===oe[++Q]&&V<F);if(M=L-(F-V),V=F-L,H<M){if(_.match_start=ne,X<=(H=M))break;G=oe[V+H-1],ue=oe[V+H]}}while((ne=ee[ne&Y])>$&&--P!=0);return H<=_.lookahead?H:_.lookahead}function ke(_){var ne,Q,M,P,V,H,X,$,oe,Y,ee=_.w_size;do{if(P=_.window_size-_.lookahead-_.strstart,_.strstart>=ee+(ee-U)){for(a.arraySet(_.window,_.window,ee,ee,0),_.match_start-=ee,_.strstart-=ee,_.block_start-=ee,ne=Q=_.hash_size;M=_.head[--ne],_.head[ne]=ee<=M?M-ee:0,--Q;);for(ne=Q=ee;M=_.prev[--ne],_.prev[ne]=ee<=M?M-ee:0,--Q;);P+=ee}if(_.strm.avail_in===0)break;if(H=_.strm,X=_.window,$=_.strstart+_.lookahead,oe=P,Y=void 0,Y=H.avail_in,oe<Y&&(Y=oe),Q=Y===0?0:(H.avail_in-=Y,a.arraySet(X,H.input,H.next_in,Y,$),H.state.wrap===1?H.adler=c(H.adler,X,Y,$):H.state.wrap===2&&(H.adler=u(H.adler,X,Y,$)),H.next_in+=Y,H.total_in+=Y,Y),_.lookahead+=Q,_.lookahead+_.insert>=z)for(V=_.strstart-_.insert,_.ins_h=_.window[V],_.ins_h=(_.ins_h<<_.hash_shift^_.window[V+1])&_.hash_mask;_.insert&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[V+z-1])&_.hash_mask,_.prev[V&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=V,V++,_.insert--,!(_.lookahead+_.insert<z)););}while(_.lookahead<U&&_.strm.avail_in!==0)}function pe(_,ne){for(var Q,M;;){if(_.lookahead<U){if(ke(_),_.lookahead<U&&ne===f)return k;if(_.lookahead===0)break}if(Q=0,_.lookahead>=z&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),Q!==0&&_.strstart-Q<=_.w_size-U&&(_.match_length=de(_,Q)),_.match_length>=z)if(M=l._tr_tally(_,_.strstart-_.match_start,_.match_length-z),_.lookahead-=_.match_length,_.match_length<=_.max_lazy_match&&_.lookahead>=z){for(_.match_length--;_.strstart++,_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart,--_.match_length!=0;);_.strstart++}else _.strstart+=_.match_length,_.match_length=0,_.ins_h=_.window[_.strstart],_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+1])&_.hash_mask;else M=l._tr_tally(_,0,_.window[_.strstart]),_.lookahead--,_.strstart++;if(M&&(Z(_,!1),_.strm.avail_out===0))return k}return _.insert=_.strstart<z-1?_.strstart:z-1,ne===h?(Z(_,!0),_.strm.avail_out===0?q:W):_.last_lit&&(Z(_,!1),_.strm.avail_out===0)?k:D}function se(_,ne){for(var Q,M,P;;){if(_.lookahead<U){if(ke(_),_.lookahead<U&&ne===f)return k;if(_.lookahead===0)break}if(Q=0,_.lookahead>=z&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),_.prev_length=_.match_length,_.prev_match=_.match_start,_.match_length=z-1,Q!==0&&_.prev_length<_.max_lazy_match&&_.strstart-Q<=_.w_size-U&&(_.match_length=de(_,Q),_.match_length<=5&&(_.strategy===1||_.match_length===z&&4096<_.strstart-_.match_start)&&(_.match_length=z-1)),_.prev_length>=z&&_.match_length<=_.prev_length){for(P=_.strstart+_.lookahead-z,M=l._tr_tally(_,_.strstart-1-_.prev_match,_.prev_length-z),_.lookahead-=_.prev_length-1,_.prev_length-=2;++_.strstart<=P&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,Q=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),--_.prev_length!=0;);if(_.match_available=0,_.match_length=z-1,_.strstart++,M&&(Z(_,!1),_.strm.avail_out===0))return k}else if(_.match_available){if((M=l._tr_tally(_,0,_.window[_.strstart-1]))&&Z(_,!1),_.strstart++,_.lookahead--,_.strm.avail_out===0)return k}else _.match_available=1,_.strstart++,_.lookahead--}return _.match_available&&(M=l._tr_tally(_,0,_.window[_.strstart-1]),_.match_available=0),_.insert=_.strstart<z-1?_.strstart:z-1,ne===h?(Z(_,!0),_.strm.avail_out===0?q:W):_.last_lit&&(Z(_,!1),_.strm.avail_out===0)?k:D}function le(_,ne,Q,M,P){this.good_length=_,this.max_lazy=ne,this.nice_length=Q,this.max_chain=M,this.func=P}function ce(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=v,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new a.Buf16(2*N),this.dyn_dtree=new a.Buf16(2*(2*S+1)),this.bl_tree=new a.Buf16(2*(2*j+1)),I(this.dyn_ltree),I(this.dyn_dtree),I(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new a.Buf16(A+1),this.heap=new a.Buf16(2*C+1),I(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new a.Buf16(2*C+1),I(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 fe(_){var ne;return _&&_.state?(_.total_in=_.total_out=0,_.data_type=b,(ne=_.state).pending=0,ne.pending_out=0,ne.wrap<0&&(ne.wrap=-ne.wrap),ne.status=ne.wrap?E:O,_.adler=ne.wrap===2?0:1,ne.last_flush=f,l._tr_init(ne),p):B(_,y)}function be(_){var ne=fe(_);return ne===p&&(function(Q){Q.window_size=2*Q.w_size,I(Q.head),Q.max_lazy_match=i[Q.level].max_lazy,Q.good_match=i[Q.level].good_length,Q.nice_match=i[Q.level].nice_length,Q.max_chain_length=i[Q.level].max_chain,Q.strstart=0,Q.block_start=0,Q.lookahead=0,Q.insert=0,Q.match_length=Q.prev_length=z-1,Q.match_available=0,Q.ins_h=0})(_.state),ne}function Se(_,ne,Q,M,P,V){if(!_)return y;var H=1;if(ne===m&&(ne=6),M<0?(H=0,M=-M):15<M&&(H=2,M-=16),P<1||w<P||Q!==v||M<8||15<M||ne<0||9<ne||V<0||x<V)return B(_,y);M===8&&(M=9);var X=new ce;return(_.state=X).strm=_,X.wrap=H,X.gzhead=null,X.w_bits=M,X.w_size=1<<X.w_bits,X.w_mask=X.w_size-1,X.hash_bits=P+7,X.hash_size=1<<X.hash_bits,X.hash_mask=X.hash_size-1,X.hash_shift=~~((X.hash_bits+z-1)/z),X.window=new a.Buf8(2*X.w_size),X.head=new a.Buf16(X.hash_size),X.prev=new a.Buf16(X.w_size),X.lit_bufsize=1<<P+6,X.pending_buf_size=4*X.lit_bufsize,X.pending_buf=new a.Buf8(X.pending_buf_size),X.d_buf=1*X.lit_bufsize,X.l_buf=3*X.lit_bufsize,X.level=ne,X.strategy=V,X.method=Q,be(_)}i=[new le(0,0,0,0,function(_,ne){var Q=65535;for(Q>_.pending_buf_size-5&&(Q=_.pending_buf_size-5);;){if(_.lookahead<=1){if(ke(_),_.lookahead===0&&ne===f)return k;if(_.lookahead===0)break}_.strstart+=_.lookahead,_.lookahead=0;var M=_.block_start+Q;if((_.strstart===0||_.strstart>=M)&&(_.lookahead=_.strstart-M,_.strstart=M,Z(_,!1),_.strm.avail_out===0)||_.strstart-_.block_start>=_.w_size-U&&(Z(_,!1),_.strm.avail_out===0))return k}return _.insert=0,ne===h?(Z(_,!0),_.strm.avail_out===0?q:W):(_.strstart>_.block_start&&(Z(_,!1),_.strm.avail_out),k)}),new le(4,4,8,4,pe),new le(4,5,16,8,pe),new le(4,6,32,32,pe),new le(4,4,16,16,se),new le(8,16,32,32,se),new le(8,16,128,128,se),new le(8,32,128,256,se),new le(32,128,258,1024,se),new le(32,258,258,4096,se)],o.deflateInit=function(_,ne){return Se(_,ne,v,15,8,0)},o.deflateInit2=Se,o.deflateReset=be,o.deflateResetKeep=fe,o.deflateSetHeader=function(_,ne){return _&&_.state?_.state.wrap!==2?y:(_.state.gzhead=ne,p):y},o.deflate=function(_,ne){var Q,M,P,V;if(!_||!_.state||5<ne||ne<0)return _?B(_,y):y;if(M=_.state,!_.output||!_.input&&_.avail_in!==0||M.status===666&&ne!==h)return B(_,_.avail_out===0?-5:y);if(M.strm=_,Q=M.last_flush,M.last_flush=ne,M.status===E)if(M.wrap===2)_.adler=0,R(M,31),R(M,139),R(M,8),M.gzhead?(R(M,(M.gzhead.text?1:0)+(M.gzhead.hcrc?2:0)+(M.gzhead.extra?4:0)+(M.gzhead.name?8:0)+(M.gzhead.comment?16:0)),R(M,255&M.gzhead.time),R(M,M.gzhead.time>>8&255),R(M,M.gzhead.time>>16&255),R(M,M.gzhead.time>>24&255),R(M,M.level===9?2:2<=M.strategy||M.level<2?4:0),R(M,255&M.gzhead.os),M.gzhead.extra&&M.gzhead.extra.length&&(R(M,255&M.gzhead.extra.length),R(M,M.gzhead.extra.length>>8&255)),M.gzhead.hcrc&&(_.adler=u(_.adler,M.pending_buf,M.pending,0)),M.gzindex=0,M.status=69):(R(M,0),R(M,0),R(M,0),R(M,0),R(M,0),R(M,M.level===9?2:2<=M.strategy||M.level<2?4:0),R(M,3),M.status=O);else{var H=v+(M.w_bits-8<<4)<<8;H|=(2<=M.strategy||M.level<2?0:M.level<6?1:M.level===6?2:3)<<6,M.strstart!==0&&(H|=32),H+=31-H%31,M.status=O,ae(M,H),M.strstart!==0&&(ae(M,_.adler>>>16),ae(M,65535&_.adler)),_.adler=1}if(M.status===69)if(M.gzhead.extra){for(P=M.pending;M.gzindex<(65535&M.gzhead.extra.length)&&(M.pending!==M.pending_buf_size||(M.gzhead.hcrc&&M.pending>P&&(_.adler=u(_.adler,M.pending_buf,M.pending-P,P)),K(_),P=M.pending,M.pending!==M.pending_buf_size));)R(M,255&M.gzhead.extra[M.gzindex]),M.gzindex++;M.gzhead.hcrc&&M.pending>P&&(_.adler=u(_.adler,M.pending_buf,M.pending-P,P)),M.gzindex===M.gzhead.extra.length&&(M.gzindex=0,M.status=73)}else M.status=73;if(M.status===73)if(M.gzhead.name){P=M.pending;do{if(M.pending===M.pending_buf_size&&(M.gzhead.hcrc&&M.pending>P&&(_.adler=u(_.adler,M.pending_buf,M.pending-P,P)),K(_),P=M.pending,M.pending===M.pending_buf_size)){V=1;break}V=M.gzindex<M.gzhead.name.length?255&M.gzhead.name.charCodeAt(M.gzindex++):0,R(M,V)}while(V!==0);M.gzhead.hcrc&&M.pending>P&&(_.adler=u(_.adler,M.pending_buf,M.pending-P,P)),V===0&&(M.gzindex=0,M.status=91)}else M.status=91;if(M.status===91)if(M.gzhead.comment){P=M.pending;do{if(M.pending===M.pending_buf_size&&(M.gzhead.hcrc&&M.pending>P&&(_.adler=u(_.adler,M.pending_buf,M.pending-P,P)),K(_),P=M.pending,M.pending===M.pending_buf_size)){V=1;break}V=M.gzindex<M.gzhead.comment.length?255&M.gzhead.comment.charCodeAt(M.gzindex++):0,R(M,V)}while(V!==0);M.gzhead.hcrc&&M.pending>P&&(_.adler=u(_.adler,M.pending_buf,M.pending-P,P)),V===0&&(M.status=103)}else M.status=103;if(M.status===103&&(M.gzhead.hcrc?(M.pending+2>M.pending_buf_size&&K(_),M.pending+2<=M.pending_buf_size&&(R(M,255&_.adler),R(M,_.adler>>8&255),_.adler=0,M.status=O)):M.status=O),M.pending!==0){if(K(_),_.avail_out===0)return M.last_flush=-1,p}else if(_.avail_in===0&&J(ne)<=J(Q)&&ne!==h)return B(_,-5);if(M.status===666&&_.avail_in!==0)return B(_,-5);if(_.avail_in!==0||M.lookahead!==0||ne!==f&&M.status!==666){var X=M.strategy===2?(function($,oe){for(var Y;;){if($.lookahead===0&&(ke($),$.lookahead===0)){if(oe===f)return k;break}if($.match_length=0,Y=l._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,Y&&(Z($,!1),$.strm.avail_out===0))return k}return $.insert=0,oe===h?(Z($,!0),$.strm.avail_out===0?q:W):$.last_lit&&(Z($,!1),$.strm.avail_out===0)?k:D})(M,ne):M.strategy===3?(function($,oe){for(var Y,ee,F,G,ue=$.window;;){if($.lookahead<=L){if(ke($),$.lookahead<=L&&oe===f)return k;if($.lookahead===0)break}if($.match_length=0,$.lookahead>=z&&0<$.strstart&&(ee=ue[F=$.strstart-1])===ue[++F]&&ee===ue[++F]&&ee===ue[++F]){G=$.strstart+L;do;while(ee===ue[++F]&&ee===ue[++F]&&ee===ue[++F]&&ee===ue[++F]&&ee===ue[++F]&&ee===ue[++F]&&ee===ue[++F]&&ee===ue[++F]&&F<G);$.match_length=L-(G-F),$.match_length>$.lookahead&&($.match_length=$.lookahead)}if($.match_length>=z?(Y=l._tr_tally($,1,$.match_length-z),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0):(Y=l._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++),Y&&(Z($,!1),$.strm.avail_out===0))return k}return $.insert=0,oe===h?(Z($,!0),$.strm.avail_out===0?q:W):$.last_lit&&(Z($,!1),$.strm.avail_out===0)?k:D})(M,ne):i[M.level].func(M,ne);if(X!==q&&X!==W||(M.status=666),X===k||X===q)return _.avail_out===0&&(M.last_flush=-1),p;if(X===D&&(ne===1?l._tr_align(M):ne!==5&&(l._tr_stored_block(M,0,0,!1),ne===3&&(I(M.head),M.lookahead===0&&(M.strstart=0,M.block_start=0,M.insert=0))),K(_),_.avail_out===0))return M.last_flush=-1,p}return ne!==h?p:M.wrap<=0?1:(M.wrap===2?(R(M,255&_.adler),R(M,_.adler>>8&255),R(M,_.adler>>16&255),R(M,_.adler>>24&255),R(M,255&_.total_in),R(M,_.total_in>>8&255),R(M,_.total_in>>16&255),R(M,_.total_in>>24&255)):(ae(M,_.adler>>>16),ae(M,65535&_.adler)),K(_),0<M.wrap&&(M.wrap=-M.wrap),M.pending!==0?p:1)},o.deflateEnd=function(_){var ne;return _&&_.state?(ne=_.state.status)!==E&&ne!==69&&ne!==73&&ne!==91&&ne!==103&&ne!==O&&ne!==666?B(_,y):(_.state=null,ne===O?B(_,-3):p):y},o.deflateSetDictionary=function(_,ne){var Q,M,P,V,H,X,$,oe,Y=ne.length;if(!_||!_.state||(V=(Q=_.state).wrap)===2||V===1&&Q.status!==E||Q.lookahead)return y;for(V===1&&(_.adler=c(_.adler,ne,Y,0)),Q.wrap=0,Y>=Q.w_size&&(V===0&&(I(Q.head),Q.strstart=0,Q.block_start=0,Q.insert=0),oe=new a.Buf8(Q.w_size),a.arraySet(oe,ne,Y-Q.w_size,Q.w_size,0),ne=oe,Y=Q.w_size),H=_.avail_in,X=_.next_in,$=_.input,_.avail_in=Y,_.next_in=0,_.input=ne,ke(Q);Q.lookahead>=z;){for(M=Q.strstart,P=Q.lookahead-(z-1);Q.ins_h=(Q.ins_h<<Q.hash_shift^Q.window[M+z-1])&Q.hash_mask,Q.prev[M&Q.w_mask]=Q.head[Q.ins_h],Q.head[Q.ins_h]=M,M++,--P;);Q.strstart=M,Q.lookahead=z-1,ke(Q)}return Q.strstart+=Q.lookahead,Q.block_start=Q.strstart,Q.insert=Q.lookahead,Q.lookahead=0,Q.match_length=Q.prev_length=z-1,Q.match_available=0,_.next_in=X,_.input=$,_.avail_in=H,Q.wrap=V,p},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){r.exports=function(i,a){var l,c,u,d,f,h,p,y,m,x,b,v,w,C,S,j,N,A,z,L,U,E,O,k,D;l=i.state,c=i.next_in,k=i.input,u=c+(i.avail_in-5),d=i.next_out,D=i.output,f=d-(a-i.avail_out),h=d+(i.avail_out-257),p=l.dmax,y=l.wsize,m=l.whave,x=l.wnext,b=l.window,v=l.hold,w=l.bits,C=l.lencode,S=l.distcode,j=(1<<l.lenbits)-1,N=(1<<l.distbits)-1;e:do{w<15&&(v+=k[c++]<<w,w+=8,v+=k[c++]<<w,w+=8),A=C[v&j];t:for(;;){if(v>>>=z=A>>>24,w-=z,(z=A>>>16&255)===0)D[d++]=65535&A;else{if(!(16&z)){if((64&z)==0){A=C[(65535&A)+(v&(1<<z)-1)];continue t}if(32&z){l.mode=12;break e}i.msg="invalid literal/length code",l.mode=30;break e}L=65535&A,(z&=15)&&(w<z&&(v+=k[c++]<<w,w+=8),L+=v&(1<<z)-1,v>>>=z,w-=z),w<15&&(v+=k[c++]<<w,w+=8,v+=k[c++]<<w,w+=8),A=S[v&N];n:for(;;){if(v>>>=z=A>>>24,w-=z,!(16&(z=A>>>16&255))){if((64&z)==0){A=S[(65535&A)+(v&(1<<z)-1)];continue n}i.msg="invalid distance code",l.mode=30;break e}if(U=65535&A,w<(z&=15)&&(v+=k[c++]<<w,(w+=8)<z&&(v+=k[c++]<<w,w+=8)),p<(U+=v&(1<<z)-1)){i.msg="invalid distance too far back",l.mode=30;break e}if(v>>>=z,w-=z,(z=d-f)<U){if(m<(z=U-z)&&l.sane){i.msg="invalid distance too far back",l.mode=30;break e}if(O=b,(E=0)===x){if(E+=y-z,z<L){for(L-=z;D[d++]=b[E++],--z;);E=d-U,O=D}}else if(x<z){if(E+=y+x-z,(z-=x)<L){for(L-=z;D[d++]=b[E++],--z;);if(E=0,x<L){for(L-=z=x;D[d++]=b[E++],--z;);E=d-U,O=D}}}else if(E+=x-z,z<L){for(L-=z;D[d++]=b[E++],--z;);E=d-U,O=D}for(;2<L;)D[d++]=O[E++],D[d++]=O[E++],D[d++]=O[E++],L-=3;L&&(D[d++]=O[E++],1<L&&(D[d++]=O[E++]))}else{for(E=d-U;D[d++]=D[E++],D[d++]=D[E++],D[d++]=D[E++],2<(L-=3););L&&(D[d++]=D[E++],1<L&&(D[d++]=D[E++]))}break}}break}}while(c<u&&d<h);c-=L=w>>3,v&=(1<<(w-=L<<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=v,l.bits=w}},{}],49:[function(n,r,o){var i=n("../utils/common"),a=n("./adler32"),l=n("./crc32"),c=n("./inffast"),u=n("./inftrees"),d=1,f=2,h=0,p=-2,y=1,m=852,x=592;function b(E){return(E>>>24&255)+(E>>>8&65280)+((65280&E)<<8)+((255&E)<<24)}function v(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new 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 w(E){var O;return E&&E.state?(O=E.state,E.total_in=E.total_out=O.total=0,E.msg="",O.wrap&&(E.adler=1&O.wrap),O.mode=y,O.last=0,O.havedict=0,O.dmax=32768,O.head=null,O.hold=0,O.bits=0,O.lencode=O.lendyn=new i.Buf32(m),O.distcode=O.distdyn=new i.Buf32(x),O.sane=1,O.back=-1,h):p}function C(E){var O;return E&&E.state?((O=E.state).wsize=0,O.whave=0,O.wnext=0,w(E)):p}function S(E,O){var k,D;return E&&E.state?(D=E.state,O<0?(k=0,O=-O):(k=1+(O>>4),O<48&&(O&=15)),O&&(O<8||15<O)?p:(D.window!==null&&D.wbits!==O&&(D.window=null),D.wrap=k,D.wbits=O,C(E))):p}function j(E,O){var k,D;return E?(D=new v,(E.state=D).window=null,(k=S(E,O))!==h&&(E.state=null),k):p}var N,A,z=!0;function L(E){if(z){var O;for(N=new i.Buf32(512),A=new i.Buf32(32),O=0;O<144;)E.lens[O++]=8;for(;O<256;)E.lens[O++]=9;for(;O<280;)E.lens[O++]=7;for(;O<288;)E.lens[O++]=8;for(u(d,E.lens,0,288,N,0,E.work,{bits:9}),O=0;O<32;)E.lens[O++]=5;u(f,E.lens,0,32,A,0,E.work,{bits:5}),z=!1}E.lencode=N,E.lenbits=9,E.distcode=A,E.distbits=5}function U(E,O,k,D){var q,W=E.state;return W.window===null&&(W.wsize=1<<W.wbits,W.wnext=0,W.whave=0,W.window=new i.Buf8(W.wsize)),D>=W.wsize?(i.arraySet(W.window,O,k-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(D<(q=W.wsize-W.wnext)&&(q=D),i.arraySet(W.window,O,k-D,q,W.wnext),(D-=q)?(i.arraySet(W.window,O,k-D,D,0),W.wnext=D,W.whave=W.wsize):(W.wnext+=q,W.wnext===W.wsize&&(W.wnext=0),W.whave<W.wsize&&(W.whave+=q))),0}o.inflateReset=C,o.inflateReset2=S,o.inflateResetKeep=w,o.inflateInit=function(E){return j(E,15)},o.inflateInit2=j,o.inflate=function(E,O){var k,D,q,W,B,J,I,K,Z,R,ae,de,ke,pe,se,le,ce,fe,be,Se,_,ne,Q,M,P=0,V=new i.Buf8(4),H=[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 p;(k=E.state).mode===12&&(k.mode=13),B=E.next_out,q=E.output,I=E.avail_out,W=E.next_in,D=E.input,J=E.avail_in,K=k.hold,Z=k.bits,R=J,ae=I,ne=h;e:for(;;)switch(k.mode){case y:if(k.wrap===0){k.mode=13;break}for(;Z<16;){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}if(2&k.wrap&&K===35615){V[k.check=0]=255&K,V[1]=K>>>8&255,k.check=l(k.check,V,2,0),Z=K=0,k.mode=2;break}if(k.flags=0,k.head&&(k.head.done=!1),!(1&k.wrap)||(((255&K)<<8)+(K>>8))%31){E.msg="incorrect header check",k.mode=30;break}if((15&K)!=8){E.msg="unknown compression method",k.mode=30;break}if(Z-=4,_=8+(15&(K>>>=4)),k.wbits===0)k.wbits=_;else if(_>k.wbits){E.msg="invalid window size",k.mode=30;break}k.dmax=1<<_,E.adler=k.check=1,k.mode=512&K?10:12,Z=K=0;break;case 2:for(;Z<16;){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}if(k.flags=K,(255&k.flags)!=8){E.msg="unknown compression method",k.mode=30;break}if(57344&k.flags){E.msg="unknown header flags set",k.mode=30;break}k.head&&(k.head.text=K>>8&1),512&k.flags&&(V[0]=255&K,V[1]=K>>>8&255,k.check=l(k.check,V,2,0)),Z=K=0,k.mode=3;case 3:for(;Z<32;){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}k.head&&(k.head.time=K),512&k.flags&&(V[0]=255&K,V[1]=K>>>8&255,V[2]=K>>>16&255,V[3]=K>>>24&255,k.check=l(k.check,V,4,0)),Z=K=0,k.mode=4;case 4:for(;Z<16;){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}k.head&&(k.head.xflags=255&K,k.head.os=K>>8),512&k.flags&&(V[0]=255&K,V[1]=K>>>8&255,k.check=l(k.check,V,2,0)),Z=K=0,k.mode=5;case 5:if(1024&k.flags){for(;Z<16;){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}k.length=K,k.head&&(k.head.extra_len=K),512&k.flags&&(V[0]=255&K,V[1]=K>>>8&255,k.check=l(k.check,V,2,0)),Z=K=0}else k.head&&(k.head.extra=null);k.mode=6;case 6:if(1024&k.flags&&(J<(de=k.length)&&(de=J),de&&(k.head&&(_=k.head.extra_len-k.length,k.head.extra||(k.head.extra=new Array(k.head.extra_len)),i.arraySet(k.head.extra,D,W,de,_)),512&k.flags&&(k.check=l(k.check,D,de,W)),J-=de,W+=de,k.length-=de),k.length))break e;k.length=0,k.mode=7;case 7:if(2048&k.flags){if(J===0)break e;for(de=0;_=D[W+de++],k.head&&_&&k.length<65536&&(k.head.name+=String.fromCharCode(_)),_&&de<J;);if(512&k.flags&&(k.check=l(k.check,D,de,W)),J-=de,W+=de,_)break e}else k.head&&(k.head.name=null);k.length=0,k.mode=8;case 8:if(4096&k.flags){if(J===0)break e;for(de=0;_=D[W+de++],k.head&&_&&k.length<65536&&(k.head.comment+=String.fromCharCode(_)),_&&de<J;);if(512&k.flags&&(k.check=l(k.check,D,de,W)),J-=de,W+=de,_)break e}else k.head&&(k.head.comment=null);k.mode=9;case 9:if(512&k.flags){for(;Z<16;){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}if(K!==(65535&k.check)){E.msg="header crc mismatch",k.mode=30;break}Z=K=0}k.head&&(k.head.hcrc=k.flags>>9&1,k.head.done=!0),E.adler=k.check=0,k.mode=12;break;case 10:for(;Z<32;){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}E.adler=k.check=b(K),Z=K=0,k.mode=11;case 11:if(k.havedict===0)return E.next_out=B,E.avail_out=I,E.next_in=W,E.avail_in=J,k.hold=K,k.bits=Z,2;E.adler=k.check=1,k.mode=12;case 12:if(O===5||O===6)break e;case 13:if(k.last){K>>>=7&Z,Z-=7&Z,k.mode=27;break}for(;Z<3;){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}switch(k.last=1&K,Z-=1,3&(K>>>=1)){case 0:k.mode=14;break;case 1:if(L(k),k.mode=20,O!==6)break;K>>>=2,Z-=2;break e;case 2:k.mode=17;break;case 3:E.msg="invalid block type",k.mode=30}K>>>=2,Z-=2;break;case 14:for(K>>>=7&Z,Z-=7&Z;Z<32;){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}if((65535&K)!=(K>>>16^65535)){E.msg="invalid stored block lengths",k.mode=30;break}if(k.length=65535&K,Z=K=0,k.mode=15,O===6)break e;case 15:k.mode=16;case 16:if(de=k.length){if(J<de&&(de=J),I<de&&(de=I),de===0)break e;i.arraySet(q,D,W,de,B),J-=de,W+=de,I-=de,B+=de,k.length-=de;break}k.mode=12;break;case 17:for(;Z<14;){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}if(k.nlen=257+(31&K),K>>>=5,Z-=5,k.ndist=1+(31&K),K>>>=5,Z-=5,k.ncode=4+(15&K),K>>>=4,Z-=4,286<k.nlen||30<k.ndist){E.msg="too many length or distance symbols",k.mode=30;break}k.have=0,k.mode=18;case 18:for(;k.have<k.ncode;){for(;Z<3;){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}k.lens[H[k.have++]]=7&K,K>>>=3,Z-=3}for(;k.have<19;)k.lens[H[k.have++]]=0;if(k.lencode=k.lendyn,k.lenbits=7,Q={bits:k.lenbits},ne=u(0,k.lens,0,19,k.lencode,0,k.work,Q),k.lenbits=Q.bits,ne){E.msg="invalid code lengths set",k.mode=30;break}k.have=0,k.mode=19;case 19:for(;k.have<k.nlen+k.ndist;){for(;le=(P=k.lencode[K&(1<<k.lenbits)-1])>>>16&255,ce=65535&P,!((se=P>>>24)<=Z);){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}if(ce<16)K>>>=se,Z-=se,k.lens[k.have++]=ce;else{if(ce===16){for(M=se+2;Z<M;){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}if(K>>>=se,Z-=se,k.have===0){E.msg="invalid bit length repeat",k.mode=30;break}_=k.lens[k.have-1],de=3+(3&K),K>>>=2,Z-=2}else if(ce===17){for(M=se+3;Z<M;){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}Z-=se,_=0,de=3+(7&(K>>>=se)),K>>>=3,Z-=3}else{for(M=se+7;Z<M;){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}Z-=se,_=0,de=11+(127&(K>>>=se)),K>>>=7,Z-=7}if(k.have+de>k.nlen+k.ndist){E.msg="invalid bit length repeat",k.mode=30;break}for(;de--;)k.lens[k.have++]=_}}if(k.mode===30)break;if(k.lens[256]===0){E.msg="invalid code -- missing end-of-block",k.mode=30;break}if(k.lenbits=9,Q={bits:k.lenbits},ne=u(d,k.lens,0,k.nlen,k.lencode,0,k.work,Q),k.lenbits=Q.bits,ne){E.msg="invalid literal/lengths set",k.mode=30;break}if(k.distbits=6,k.distcode=k.distdyn,Q={bits:k.distbits},ne=u(f,k.lens,k.nlen,k.ndist,k.distcode,0,k.work,Q),k.distbits=Q.bits,ne){E.msg="invalid distances set",k.mode=30;break}if(k.mode=20,O===6)break e;case 20:k.mode=21;case 21:if(6<=J&&258<=I){E.next_out=B,E.avail_out=I,E.next_in=W,E.avail_in=J,k.hold=K,k.bits=Z,c(E,ae),B=E.next_out,q=E.output,I=E.avail_out,W=E.next_in,D=E.input,J=E.avail_in,K=k.hold,Z=k.bits,k.mode===12&&(k.back=-1);break}for(k.back=0;le=(P=k.lencode[K&(1<<k.lenbits)-1])>>>16&255,ce=65535&P,!((se=P>>>24)<=Z);){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}if(le&&(240&le)==0){for(fe=se,be=le,Se=ce;le=(P=k.lencode[Se+((K&(1<<fe+be)-1)>>fe)])>>>16&255,ce=65535&P,!(fe+(se=P>>>24)<=Z);){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}K>>>=fe,Z-=fe,k.back+=fe}if(K>>>=se,Z-=se,k.back+=se,k.length=ce,le===0){k.mode=26;break}if(32&le){k.back=-1,k.mode=12;break}if(64&le){E.msg="invalid literal/length code",k.mode=30;break}k.extra=15&le,k.mode=22;case 22:if(k.extra){for(M=k.extra;Z<M;){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}k.length+=K&(1<<k.extra)-1,K>>>=k.extra,Z-=k.extra,k.back+=k.extra}k.was=k.length,k.mode=23;case 23:for(;le=(P=k.distcode[K&(1<<k.distbits)-1])>>>16&255,ce=65535&P,!((se=P>>>24)<=Z);){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}if((240&le)==0){for(fe=se,be=le,Se=ce;le=(P=k.distcode[Se+((K&(1<<fe+be)-1)>>fe)])>>>16&255,ce=65535&P,!(fe+(se=P>>>24)<=Z);){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}K>>>=fe,Z-=fe,k.back+=fe}if(K>>>=se,Z-=se,k.back+=se,64&le){E.msg="invalid distance code",k.mode=30;break}k.offset=ce,k.extra=15&le,k.mode=24;case 24:if(k.extra){for(M=k.extra;Z<M;){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}k.offset+=K&(1<<k.extra)-1,K>>>=k.extra,Z-=k.extra,k.back+=k.extra}if(k.offset>k.dmax){E.msg="invalid distance too far back",k.mode=30;break}k.mode=25;case 25:if(I===0)break e;if(de=ae-I,k.offset>de){if((de=k.offset-de)>k.whave&&k.sane){E.msg="invalid distance too far back",k.mode=30;break}ke=de>k.wnext?(de-=k.wnext,k.wsize-de):k.wnext-de,de>k.length&&(de=k.length),pe=k.window}else pe=q,ke=B-k.offset,de=k.length;for(I<de&&(de=I),I-=de,k.length-=de;q[B++]=pe[ke++],--de;);k.length===0&&(k.mode=21);break;case 26:if(I===0)break e;q[B++]=k.length,I--,k.mode=21;break;case 27:if(k.wrap){for(;Z<32;){if(J===0)break e;J--,K|=D[W++]<<Z,Z+=8}if(ae-=I,E.total_out+=ae,k.total+=ae,ae&&(E.adler=k.check=k.flags?l(k.check,q,ae,B-ae):a(k.check,q,ae,B-ae)),ae=I,(k.flags?K:b(K))!==k.check){E.msg="incorrect data check",k.mode=30;break}Z=K=0}k.mode=28;case 28:if(k.wrap&&k.flags){for(;Z<32;){if(J===0)break e;J--,K+=D[W++]<<Z,Z+=8}if(K!==(4294967295&k.total)){E.msg="incorrect length check",k.mode=30;break}Z=K=0}k.mode=29;case 29:ne=1;break e;case 30:ne=-3;break e;case 31:return-4;default:return p}return E.next_out=B,E.avail_out=I,E.next_in=W,E.avail_in=J,k.hold=K,k.bits=Z,(k.wsize||ae!==E.avail_out&&k.mode<30&&(k.mode<27||O!==4))&&U(E,E.output,E.next_out,ae-E.avail_out)?(k.mode=31,-4):(R-=E.avail_in,ae-=E.avail_out,E.total_in+=R,E.total_out+=ae,k.total+=ae,k.wrap&&ae&&(E.adler=k.check=k.flags?l(k.check,q,ae,E.next_out-ae):a(k.check,q,ae,E.next_out-ae)),E.data_type=k.bits+(k.last?64:0)+(k.mode===12?128:0)+(k.mode===20||k.mode===15?256:0),(R==0&&ae===0||O===4)&&ne===h&&(ne=-5),ne)},o.inflateEnd=function(E){if(!E||!E.state)return p;var O=E.state;return O.window&&(O.window=null),E.state=null,h},o.inflateGetHeader=function(E,O){var k;return E&&E.state?(2&(k=E.state).wrap)==0?p:((k.head=O).done=!1,h):p},o.inflateSetDictionary=function(E,O){var k,D=O.length;return E&&E.state?(k=E.state).wrap!==0&&k.mode!==11?p:k.mode===11&&a(1,O,D,0)!==k.check?-3:U(E,O,D,D)?(k.mode=31,-4):(k.havedict=1,h):p},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){var 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];r.exports=function(d,f,h,p,y,m,x,b){var v,w,C,S,j,N,A,z,L,U=b.bits,E=0,O=0,k=0,D=0,q=0,W=0,B=0,J=0,I=0,K=0,Z=null,R=0,ae=new i.Buf16(16),de=new i.Buf16(16),ke=null,pe=0;for(E=0;E<=15;E++)ae[E]=0;for(O=0;O<p;O++)ae[f[h+O]]++;for(q=U,D=15;1<=D&&ae[D]===0;D--);if(D<q&&(q=D),D===0)return y[m++]=20971520,y[m++]=20971520,b.bits=1,0;for(k=1;k<D&&ae[k]===0;k++);for(q<k&&(q=k),E=J=1;E<=15;E++)if(J<<=1,(J-=ae[E])<0)return-1;if(0<J&&(d===0||D!==1))return-1;for(de[1]=0,E=1;E<15;E++)de[E+1]=de[E]+ae[E];for(O=0;O<p;O++)f[h+O]!==0&&(x[de[f[h+O]]++]=O);if(N=d===0?(Z=ke=x,19):d===1?(Z=a,R-=257,ke=l,pe-=257,256):(Z=c,ke=u,-1),E=k,j=m,B=O=K=0,C=-1,S=(I=1<<(W=q))-1,d===1&&852<I||d===2&&592<I)return 1;for(;;){for(A=E-B,L=x[O]<N?(z=0,x[O]):x[O]>N?(z=ke[pe+x[O]],Z[R+x[O]]):(z=96,0),v=1<<E-B,k=w=1<<W;y[j+(K>>B)+(w-=v)]=A<<24|z<<16|L|0,w!==0;);for(v=1<<E-1;K&v;)v>>=1;if(v!==0?(K&=v-1,K+=v):K=0,O++,--ae[E]==0){if(E===D)break;E=f[h+x[O]]}if(q<E&&(K&S)!==C){for(B===0&&(B=q),j+=k,J=1<<(W=E-B);W+B<D&&!((J-=ae[W+B])<=0);)W++,J<<=1;if(I+=1<<W,d===1&&852<I||d===2&&592<I)return 1;y[C=K&S]=q<<24|W<<16|j-m|0}}return K!==0&&(y[j+K]=E-B<<24|64<<16|0),b.bits=q,0}},{"../utils/common":41}],51:[function(n,r,o){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){var i=n("../utils/common"),a=0,l=1;function c(P){for(var V=P.length;0<=--V;)P[V]=0}var u=0,d=29,f=256,h=f+1+d,p=30,y=19,m=2*h+1,x=15,b=16,v=7,w=256,C=16,S=17,j=18,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],A=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],z=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],L=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],U=new Array(2*(h+2));c(U);var E=new Array(2*p);c(E);var O=new Array(512);c(O);var k=new Array(256);c(k);var D=new Array(d);c(D);var q,W,B,J=new Array(p);function I(P,V,H,X,$){this.static_tree=P,this.extra_bits=V,this.extra_base=H,this.elems=X,this.max_length=$,this.has_stree=P&&P.length}function K(P,V){this.dyn_tree=P,this.max_code=0,this.stat_desc=V}function Z(P){return P<256?O[P]:O[256+(P>>>7)]}function R(P,V){P.pending_buf[P.pending++]=255&V,P.pending_buf[P.pending++]=V>>>8&255}function ae(P,V,H){P.bi_valid>b-H?(P.bi_buf|=V<<P.bi_valid&65535,R(P,P.bi_buf),P.bi_buf=V>>b-P.bi_valid,P.bi_valid+=H-b):(P.bi_buf|=V<<P.bi_valid&65535,P.bi_valid+=H)}function de(P,V,H){ae(P,H[2*V],H[2*V+1])}function ke(P,V){for(var H=0;H|=1&P,P>>>=1,H<<=1,0<--V;);return H>>>1}function pe(P,V,H){var X,$,oe=new Array(x+1),Y=0;for(X=1;X<=x;X++)oe[X]=Y=Y+H[X-1]<<1;for($=0;$<=V;$++){var ee=P[2*$+1];ee!==0&&(P[2*$]=ke(oe[ee]++,ee))}}function se(P){var V;for(V=0;V<h;V++)P.dyn_ltree[2*V]=0;for(V=0;V<p;V++)P.dyn_dtree[2*V]=0;for(V=0;V<y;V++)P.bl_tree[2*V]=0;P.dyn_ltree[2*w]=1,P.opt_len=P.static_len=0,P.last_lit=P.matches=0}function le(P){8<P.bi_valid?R(P,P.bi_buf):0<P.bi_valid&&(P.pending_buf[P.pending++]=P.bi_buf),P.bi_buf=0,P.bi_valid=0}function ce(P,V,H,X){var $=2*V,oe=2*H;return P[$]<P[oe]||P[$]===P[oe]&&X[V]<=X[H]}function fe(P,V,H){for(var X=P.heap[H],$=H<<1;$<=P.heap_len&&($<P.heap_len&&ce(V,P.heap[$+1],P.heap[$],P.depth)&&$++,!ce(V,X,P.heap[$],P.depth));)P.heap[H]=P.heap[$],H=$,$<<=1;P.heap[H]=X}function be(P,V,H){var X,$,oe,Y,ee=0;if(P.last_lit!==0)for(;X=P.pending_buf[P.d_buf+2*ee]<<8|P.pending_buf[P.d_buf+2*ee+1],$=P.pending_buf[P.l_buf+ee],ee++,X===0?de(P,$,V):(de(P,(oe=k[$])+f+1,V),(Y=N[oe])!==0&&ae(P,$-=D[oe],Y),de(P,oe=Z(--X),H),(Y=A[oe])!==0&&ae(P,X-=J[oe],Y)),ee<P.last_lit;);de(P,w,V)}function Se(P,V){var H,X,$,oe=V.dyn_tree,Y=V.stat_desc.static_tree,ee=V.stat_desc.has_stree,F=V.stat_desc.elems,G=-1;for(P.heap_len=0,P.heap_max=m,H=0;H<F;H++)oe[2*H]!==0?(P.heap[++P.heap_len]=G=H,P.depth[H]=0):oe[2*H+1]=0;for(;P.heap_len<2;)oe[2*($=P.heap[++P.heap_len]=G<2?++G:0)]=1,P.depth[$]=0,P.opt_len--,ee&&(P.static_len-=Y[2*$+1]);for(V.max_code=G,H=P.heap_len>>1;1<=H;H--)fe(P,oe,H);for($=F;H=P.heap[1],P.heap[1]=P.heap[P.heap_len--],fe(P,oe,1),X=P.heap[1],P.heap[--P.heap_max]=H,P.heap[--P.heap_max]=X,oe[2*$]=oe[2*H]+oe[2*X],P.depth[$]=(P.depth[H]>=P.depth[X]?P.depth[H]:P.depth[X])+1,oe[2*H+1]=oe[2*X+1]=$,P.heap[1]=$++,fe(P,oe,1),2<=P.heap_len;);P.heap[--P.heap_max]=P.heap[1],(function(ue,ye){var Ee,Pe,it,Me,Ut,en,Ye=ye.dyn_tree,tn=ye.max_code,Pt=ye.stat_desc.static_tree,Yx=ye.stat_desc.has_stree,Xx=ye.stat_desc.extra_bits,vc=ye.stat_desc.extra_base,Ar=ye.stat_desc.max_length,wo=0;for(Me=0;Me<=x;Me++)ue.bl_count[Me]=0;for(Ye[2*ue.heap[ue.heap_max]+1]=0,Ee=ue.heap_max+1;Ee<m;Ee++)Ar<(Me=Ye[2*Ye[2*(Pe=ue.heap[Ee])+1]+1]+1)&&(Me=Ar,wo++),Ye[2*Pe+1]=Me,tn<Pe||(ue.bl_count[Me]++,Ut=0,vc<=Pe&&(Ut=Xx[Pe-vc]),en=Ye[2*Pe],ue.opt_len+=en*(Me+Ut),Yx&&(ue.static_len+=en*(Pt[2*Pe+1]+Ut)));if(wo!==0){do{for(Me=Ar-1;ue.bl_count[Me]===0;)Me--;ue.bl_count[Me]--,ue.bl_count[Me+1]+=2,ue.bl_count[Ar]--,wo-=2}while(0<wo);for(Me=Ar;Me!==0;Me--)for(Pe=ue.bl_count[Me];Pe!==0;)tn<(it=ue.heap[--Ee])||(Ye[2*it+1]!==Me&&(ue.opt_len+=(Me-Ye[2*it+1])*Ye[2*it],Ye[2*it+1]=Me),Pe--)}})(P,V),pe(oe,G,P.bl_count)}function _(P,V,H){var X,$,oe=-1,Y=V[1],ee=0,F=7,G=4;for(Y===0&&(F=138,G=3),V[2*(H+1)+1]=65535,X=0;X<=H;X++)$=Y,Y=V[2*(X+1)+1],++ee<F&&$===Y||(ee<G?P.bl_tree[2*$]+=ee:$!==0?($!==oe&&P.bl_tree[2*$]++,P.bl_tree[2*C]++):ee<=10?P.bl_tree[2*S]++:P.bl_tree[2*j]++,oe=$,G=(ee=0)===Y?(F=138,3):$===Y?(F=6,3):(F=7,4))}function ne(P,V,H){var X,$,oe=-1,Y=V[1],ee=0,F=7,G=4;for(Y===0&&(F=138,G=3),X=0;X<=H;X++)if($=Y,Y=V[2*(X+1)+1],!(++ee<F&&$===Y)){if(ee<G)for(;de(P,$,P.bl_tree),--ee!=0;);else $!==0?($!==oe&&(de(P,$,P.bl_tree),ee--),de(P,C,P.bl_tree),ae(P,ee-3,2)):ee<=10?(de(P,S,P.bl_tree),ae(P,ee-3,3)):(de(P,j,P.bl_tree),ae(P,ee-11,7));oe=$,G=(ee=0)===Y?(F=138,3):$===Y?(F=6,3):(F=7,4)}}c(J);var Q=!1;function M(P,V,H,X){ae(P,(u<<1)+(X?1:0),3),(function($,oe,Y,ee){le($),R($,Y),R($,~Y),i.arraySet($.pending_buf,$.window,oe,Y,$.pending),$.pending+=Y})(P,V,H)}o._tr_init=function(P){Q||((function(){var V,H,X,$,oe,Y=new Array(x+1);for($=X=0;$<d-1;$++)for(D[$]=X,V=0;V<1<<N[$];V++)k[X++]=$;for(k[X-1]=$,$=oe=0;$<16;$++)for(J[$]=oe,V=0;V<1<<A[$];V++)O[oe++]=$;for(oe>>=7;$<p;$++)for(J[$]=oe<<7,V=0;V<1<<A[$]-7;V++)O[256+oe++]=$;for(H=0;H<=x;H++)Y[H]=0;for(V=0;V<=143;)U[2*V+1]=8,V++,Y[8]++;for(;V<=255;)U[2*V+1]=9,V++,Y[9]++;for(;V<=279;)U[2*V+1]=7,V++,Y[7]++;for(;V<=287;)U[2*V+1]=8,V++,Y[8]++;for(pe(U,h+1,Y),V=0;V<p;V++)E[2*V+1]=5,E[2*V]=ke(V,5);q=new I(U,N,f+1,h,x),W=new I(E,A,0,p,x),B=new I(new Array(0),z,0,y,v)})(),Q=!0),P.l_desc=new K(P.dyn_ltree,q),P.d_desc=new K(P.dyn_dtree,W),P.bl_desc=new K(P.bl_tree,B),P.bi_buf=0,P.bi_valid=0,se(P)},o._tr_stored_block=M,o._tr_flush_block=function(P,V,H,X){var $,oe,Y=0;0<P.level?(P.strm.data_type===2&&(P.strm.data_type=(function(ee){var F,G=4093624447;for(F=0;F<=31;F++,G>>>=1)if(1&G&&ee.dyn_ltree[2*F]!==0)return a;if(ee.dyn_ltree[18]!==0||ee.dyn_ltree[20]!==0||ee.dyn_ltree[26]!==0)return l;for(F=32;F<f;F++)if(ee.dyn_ltree[2*F]!==0)return l;return a})(P)),Se(P,P.l_desc),Se(P,P.d_desc),Y=(function(ee){var F;for(_(ee,ee.dyn_ltree,ee.l_desc.max_code),_(ee,ee.dyn_dtree,ee.d_desc.max_code),Se(ee,ee.bl_desc),F=y-1;3<=F&&ee.bl_tree[2*L[F]+1]===0;F--);return ee.opt_len+=3*(F+1)+5+5+4,F})(P),$=P.opt_len+3+7>>>3,(oe=P.static_len+3+7>>>3)<=$&&($=oe)):$=oe=H+5,H+4<=$&&V!==-1?M(P,V,H,X):P.strategy===4||oe===$?(ae(P,2+(X?1:0),3),be(P,U,E)):(ae(P,4+(X?1:0),3),(function(ee,F,G,ue){var ye;for(ae(ee,F-257,5),ae(ee,G-1,5),ae(ee,ue-4,4),ye=0;ye<ue;ye++)ae(ee,ee.bl_tree[2*L[ye]+1],3);ne(ee,ee.dyn_ltree,F-1),ne(ee,ee.dyn_dtree,G-1)})(P,P.l_desc.max_code+1,P.d_desc.max_code+1,Y+1),be(P,P.dyn_ltree,P.dyn_dtree)),se(P),X&&le(P)},o._tr_tally=function(P,V,H){return P.pending_buf[P.d_buf+2*P.last_lit]=V>>>8&255,P.pending_buf[P.d_buf+2*P.last_lit+1]=255&V,P.pending_buf[P.l_buf+P.last_lit]=255&H,P.last_lit++,V===0?P.dyn_ltree[2*H]++:(P.matches++,V--,P.dyn_ltree[2*(k[H]+f+1)]++,P.dyn_dtree[2*Z(V)]++),P.last_lit===P.lit_bufsize-1},o._tr_align=function(P){ae(P,2,3),de(P,w,U),(function(V){V.bi_valid===16?(R(V,V.bi_buf),V.bi_buf=0,V.bi_valid=0):8<=V.bi_valid&&(V.pending_buf[V.pending++]=255&V.bi_buf,V.bi_buf>>=8,V.bi_valid-=8)})(P)}},{"../utils/common":41}],53:[function(n,r,o){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(i){(function(a,l){if(!a.setImmediate){var c,u,d,f,h=1,p={},y=!1,m=a.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(a);x=x&&x.setTimeout?x:a,c={}.toString.call(a.process)==="[object process]"?function(C){process.nextTick(function(){v(C)})}:(function(){if(a.postMessage&&!a.importScripts){var C=!0,S=a.onmessage;return a.onmessage=function(){C=!1},a.postMessage("","*"),a.onmessage=S,C}})()?(f="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",w,!1):a.attachEvent("onmessage",w),function(C){a.postMessage(f+C,"*")}):a.MessageChannel?((d=new MessageChannel).port1.onmessage=function(C){v(C.data)},function(C){d.port2.postMessage(C)}):m&&"onreadystatechange"in m.createElement("script")?(u=m.documentElement,function(C){var S=m.createElement("script");S.onreadystatechange=function(){v(C),S.onreadystatechange=null,u.removeChild(S),S=null},u.appendChild(S)}):function(C){setTimeout(v,0,C)},x.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var S=new Array(arguments.length-1),j=0;j<S.length;j++)S[j]=arguments[j+1];var N={callback:C,args:S};return p[h]=N,c(h),h++},x.clearImmediate=b}function b(C){delete p[C]}function v(C){if(y)setTimeout(v,0,C);else{var S=p[C];if(S){y=!0;try{(function(j){var N=j.callback,A=j.args;switch(A.length){case 0:N();break;case 1:N(A[0]);break;case 2:N(A[0],A[1]);break;case 3:N(A[0],A[1],A[2]);break;default:N.apply(l,A)}})(S)}finally{b(C),y=!1}}}}function w(C){C.source===a&&typeof C.data=="string"&&C.data.indexOf(f)===0&&v(+C.data.slice(f.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof ko<"u"?ko:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(mi)),mi.exports}var t_=e_();const n_=Ya(t_),r_="2.1.7",ua={version:r_},Ep="[REDACTED]",o_=/(^|[-_])(api[-_]?key|authorization|cookie|token|secret|password|access[-_]?token|refresh[-_]?token)([-_]|$)/i,s_=[/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,i_=25e6,Tp=50;function a_(e){return e<1024?`${e} chars`:e<1024*1024?`${Math.ceil(e/1024)} KB`:`${Math.ceil(e/(1024*1024))} MB`}function l_(e){let t=0;for(const n of e)t+=n.rawRequestBody?.length??0,t+=n.responseText?.length??0;return t}function c_(e){if(e.length>Gc)return`Export is limited to ${Gc} logs at once. Narrow the filter and try again.`;const t=l_(e);return t>i_?`Export is too large (${a_(t)} of text). Narrow the filter and try again.`:null}async function u_(e){try{const t=await fetch(`/api/logs/${e}/chunks`);if(!t.ok)return null;const n=await t.json();return JSON.stringify(n,null,2)}catch{return null}}function d_(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function da(e){if(Array.isArray(e))return e.map(n=>da(n));if(!d_(e))return e;const t={};for(const[n,r]of Object.entries(e))t[n]=o_.test(n)?Ep:da(r);return t}function f_(e){const t=n=>{let r=n;for(const o of s_)r=r.replace(o,Ep);return r};try{const n=JSON.parse(e);return t(JSON.stringify(da(n),null,2))}catch{return t(e)}}function gi(e,t){return t==="redacted"?f_(e):e}function p_(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 h_(e,t,n,r=new Date().toISOString()){return{version:ua.version,exportedAt:r,mode:t,redacted:t==="redacted",logCount:e.length,logIds:e.map(o=>o.id),streamingChunkExportLimit:Tp,streamingChunkLogIds:n.map(o=>o.id)}}async function m_(e,t="redacted"){const n=c_(e);if(n!==null)return{ok:!1,message:n};const r=new n_,o=t==="redacted"?"redacted":"raw",i=e.filter(u=>u.streaming).slice(0,Tp);r.file("manifest.json",JSON.stringify(h_(e,t,i),null,2)),r.file("logs.json",JSON.stringify(e.map(u=>p_(u,t)),null,2));for(const u of e)u.rawRequestBody!==null&&r.file(`#${u.id}.Request.json`,gi(u.rawRequestBody,t)),u.responseText!==null&&r.file(`#${u.id}.Response.json`,gi(u.responseText,t));for(const u of i){const d=await u_(u.id);d!==null&&r.file(`#${u.id}.SSE.Response.json`,gi(d,t))}const a=await r.generateAsync({type:"blob"}),l=URL.createObjectURL(a),c=document.createElement("a");return c.href=l,c.download=`agent-inspector-export-${o}-${new Date().toISOString().slice(0,10)}.zip`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(l),{ok:!0}}function g_(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 b_(e){if(typeof document>"u")return!1;const t=document.activeElement,n=document.getSelection(),r=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),g_(n,r),typeof HTMLElement<"u"&&t instanceof HTMLElement&&t.focus({preventScroll:!0})}return i}async function $t(e){const t=globalThis.navigator?.clipboard;if(t!==void 0)try{return await t.writeText(e),!0}catch{}return b_(e)}function fa(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 _l(e,t,n){return`${fa(e,n)} - ${fa(t,n)}`}function Ap(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Ap(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ip(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Ap(e))&&(r&&(r+=" "),r+=t);return r}const y_=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},v_=(e,t)=>({classGroupId:e,validator:t}),zp=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),us="-",Kc=[],w_="arbitrary..",k_=e=>{const t=S_(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return __(a);const l=a.split(us),c=l[0]===""&&l.length>1?1:0;return Rp(l,c,t)},getConflictingClassGroupIds:(a,l)=>{if(l){const c=r[a],u=n[a];return c?u?y_(u,c):c:u||Kc}return n[a]||Kc}}},Rp=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],i=n.nextPart.get(o);if(i){const u=Rp(e,t+1,i);if(u)return u}const a=n.validators;if(a===null)return;const l=t===0?e.join(us):e.slice(t).join(us),c=a.length;for(let u=0;u<c;u++){const d=a[u];if(d.validator(l))return d.classGroupId}},__=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?w_+r:void 0})(),S_=e=>{const{theme:t,classGroups:n}=e;return C_(n,t)},C_=(e,t)=>{const n=zp();for(const r in e){const o=e[r];Sl(o,n,r,t)}return n},Sl=(e,t,n,r)=>{const o=e.length;for(let i=0;i<o;i++){const a=e[i];j_(a,t,n,r)}},j_=(e,t,n,r)=>{if(typeof e=="string"){N_(e,t,n);return}if(typeof e=="function"){E_(e,t,n,r);return}T_(e,t,n,r)},N_=(e,t,n)=>{const r=e===""?t:Pp(t,e);r.classGroupId=n},E_=(e,t,n,r)=>{if(A_(e)){Sl(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(v_(n,e))},T_=(e,t,n,r)=>{const o=Object.entries(e),i=o.length;for(let a=0;a<i;a++){const[l,c]=o[a];Sl(c,Pp(t,l),n,r)}},Pp=(e,t)=>{let n=e;const r=t.split(us),o=r.length;for(let i=0;i<o;i++){const a=r[i];let l=n.nextPart.get(a);l||(l=zp(),n.nextPart.set(a,l)),n=l}return n},A_=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,I_=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(i){let a=n[i];if(a!==void 0)return a;if((a=r[i])!==void 0)return o(i,a),a},set(i,a){i in n?n[i]=a:o(i,a)}}},pa="!",Jc=":",z_=[],Yc=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),R_=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const i=[];let a=0,l=0,c=0,u;const d=o.length;for(let m=0;m<d;m++){const x=o[m];if(a===0&&l===0){if(x===Jc){i.push(o.slice(c,m)),c=m+1;continue}if(x==="/"){u=m;continue}}x==="["?a++:x==="]"?a--:x==="("?l++:x===")"&&l--}const f=i.length===0?o:o.slice(c);let h=f,p=!1;f.endsWith(pa)?(h=f.slice(0,-1),p=!0):f.startsWith(pa)&&(h=f.slice(1),p=!0);const y=u&&u>c?u-c:void 0;return Yc(i,p,h,y)};if(t){const o=t+Jc,i=r;r=a=>a.startsWith(o)?i(a.slice(o.length)):Yc(z_,!1,a,void 0,!0)}if(n){const o=r;r=i=>n({className:i,parseClassName:o})}return r},P_=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];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(),r.push(...o),o=[]),r.push(a)):o.push(a)}return o.length>0&&(o.sort(),r.push(...o)),r}},O_=e=>({cache:I_(e.cacheSize),parseClassName:R_(e),sortModifiers:P_(e),...k_(e)}),M_=/\s+/,L_=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:i}=t,a=[],l=e.trim().split(M_);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:f,modifiers:h,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:m}=n(d);if(f){c=d+(c.length>0?" "+c:c);continue}let x=!!m,b=r(x?y.substring(0,m):y);if(!b){if(!x){c=d+(c.length>0?" "+c:c);continue}if(b=r(y),!b){c=d+(c.length>0?" "+c:c);continue}x=!1}const v=h.length===0?"":h.length===1?h[0]:i(h).join(":"),w=p?v+pa:v,C=w+b;if(a.indexOf(C)>-1)continue;a.push(C);const S=o(b,x);for(let j=0;j<S.length;++j){const N=S[j];a.push(w+N)}c=d+(c.length>0?" "+c:c)}return c},D_=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=Op(n))&&(o&&(o+=" "),o+=r);return o},Op=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Op(e[r]))&&(n&&(n+=" "),n+=t);return n},F_=(e,...t)=>{let n,r,o,i;const a=c=>{const u=t.reduce((d,f)=>f(d),e());return n=O_(u),r=n.cache.get,o=n.cache.set,i=l,l(c)},l=c=>{const u=r(c);if(u)return u;const d=L_(c,n);return o(c,d),d};return i=a,(...c)=>i(D_(...c))},$_=[],rt=e=>{const t=n=>n[e]||$_;return t.isThemeGetter=!0,t},Mp=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Lp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,B_=/^\d+\/\d+$/,U_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,H_=/\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$/,W_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,V_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,q_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Gn=e=>B_.test(e),Re=e=>!!e&&!Number.isNaN(Number(e)),dn=e=>!!e&&Number.isInteger(Number(e)),xi=e=>e.endsWith("%")&&Re(e.slice(0,-1)),nn=e=>U_.test(e),Z_=()=>!0,G_=e=>H_.test(e)&&!W_.test(e),Dp=()=>!1,K_=e=>V_.test(e),J_=e=>q_.test(e),Y_=e=>!ve(e)&&!we(e),X_=e=>kr(e,Bp,Dp),ve=e=>Mp.test(e),An=e=>kr(e,Up,G_),bi=e=>kr(e,rS,Re),Xc=e=>kr(e,Fp,Dp),Q_=e=>kr(e,$p,J_),Eo=e=>kr(e,Hp,K_),we=e=>Lp.test(e),Ir=e=>_r(e,Up),eS=e=>_r(e,oS),Qc=e=>_r(e,Fp),tS=e=>_r(e,Bp),nS=e=>_r(e,$p),To=e=>_r(e,Hp,!0),kr=(e,t,n)=>{const r=Mp.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},_r=(e,t,n=!1)=>{const r=Lp.exec(e);return r?r[1]?t(r[1]):n:!1},Fp=e=>e==="position"||e==="percentage",$p=e=>e==="image"||e==="url",Bp=e=>e==="length"||e==="size"||e==="bg-size",Up=e=>e==="length",rS=e=>e==="number",oS=e=>e==="family-name",Hp=e=>e==="shadow",sS=()=>{const e=rt("color"),t=rt("font"),n=rt("text"),r=rt("font-weight"),o=rt("tracking"),i=rt("leading"),a=rt("breakpoint"),l=rt("container"),c=rt("spacing"),u=rt("radius"),d=rt("shadow"),f=rt("inset-shadow"),h=rt("text-shadow"),p=rt("drop-shadow"),y=rt("blur"),m=rt("perspective"),x=rt("aspect"),b=rt("ease"),v=rt("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],S=()=>[...C(),we,ve],j=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],A=()=>[we,ve,c],z=()=>[Gn,"full","auto",...A()],L=()=>[dn,"none","subgrid",we,ve],U=()=>["auto",{span:["full",dn,we,ve]},dn,we,ve],E=()=>[dn,"auto",we,ve],O=()=>["auto","min","max","fr",we,ve],k=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],D=()=>["start","end","center","stretch","center-safe","end-safe"],q=()=>["auto",...A()],W=()=>[Gn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],B=()=>[e,we,ve],J=()=>[...C(),Qc,Xc,{position:[we,ve]}],I=()=>["no-repeat",{repeat:["","x","y","space","round"]}],K=()=>["auto","cover","contain",tS,X_,{size:[we,ve]}],Z=()=>[xi,Ir,An],R=()=>["","none","full",u,we,ve],ae=()=>["",Re,Ir,An],de=()=>["solid","dashed","dotted","double"],ke=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],pe=()=>[Re,xi,Qc,Xc],se=()=>["","none",y,we,ve],le=()=>["none",Re,we,ve],ce=()=>["none",Re,we,ve],fe=()=>[Re,we,ve],be=()=>[Gn,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[nn],breakpoint:[nn],color:[Z_],container:[nn],"drop-shadow":[nn],ease:["in","out","in-out"],font:[Y_],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[nn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[nn],shadow:[nn],spacing:["px",Re],text:[nn],"text-shadow":[nn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Gn,ve,we,x]}],container:["container"],columns:[{columns:[Re,ve,we,l]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:S()}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{start:z()}],end:[{end:z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[dn,"auto",we,ve]}],basis:[{basis:[Gn,"full","auto",l,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Re,Gn,"auto","initial","none",ve]}],grow:[{grow:["",Re,we,ve]}],shrink:[{shrink:["",Re,we,ve]}],order:[{order:[dn,"first","last","none",we,ve]}],"grid-cols":[{"grid-cols":L()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":L()}],"row-start-end":[{row:U()}],"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":O()}],"auto-rows":[{"auto-rows":O()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...k(),"normal"]}],"justify-items":[{"justify-items":[...D(),"normal"]}],"justify-self":[{"justify-self":["auto",...D()]}],"align-content":[{content:["normal",...k()]}],"align-items":[{items:[...D(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...D(),{baseline:["","last"]}]}],"place-content":[{"place-content":k()}],"place-items":[{"place-items":[...D(),"baseline"]}],"place-self":[{"place-self":["auto",...D()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:q()}],mx:[{mx:q()}],my:[{my:q()}],ms:[{ms:q()}],me:[{me:q()}],mt:[{mt:q()}],mr:[{mr:q()}],mb:[{mb:q()}],ml:[{ml:q()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],w:[{w:[l,"screen",...W()]}],"min-w":[{"min-w":[l,"screen","none",...W()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[a]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",n,Ir,An]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,we,bi]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",xi,ve]}],"font-family":[{font:[eS,ve,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,ve]}],"line-clamp":[{"line-clamp":[Re,"none",we,bi]}],leading:[{leading:[i,...A()]}],"list-image":[{"list-image":["none",we,ve]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",we,ve]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:B()}],"text-color":[{text:B()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...de(),"wavy"]}],"text-decoration-thickness":[{decoration:[Re,"from-font","auto",we,An]}],"text-decoration-color":[{decoration:B()}],"underline-offset":[{"underline-offset":[Re,"auto",we,ve]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",we,ve]}],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,ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:J()}],"bg-repeat":[{bg:I()}],"bg-size":[{bg:K()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},dn,we,ve],radial:["",we,ve],conic:[dn,we,ve]},nS,Q_]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:Z()}],"gradient-via-pos":[{via:Z()}],"gradient-to-pos":[{to:Z()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],rounded:[{rounded:R()}],"rounded-s":[{"rounded-s":R()}],"rounded-e":[{"rounded-e":R()}],"rounded-t":[{"rounded-t":R()}],"rounded-r":[{"rounded-r":R()}],"rounded-b":[{"rounded-b":R()}],"rounded-l":[{"rounded-l":R()}],"rounded-ss":[{"rounded-ss":R()}],"rounded-se":[{"rounded-se":R()}],"rounded-ee":[{"rounded-ee":R()}],"rounded-es":[{"rounded-es":R()}],"rounded-tl":[{"rounded-tl":R()}],"rounded-tr":[{"rounded-tr":R()}],"rounded-br":[{"rounded-br":R()}],"rounded-bl":[{"rounded-bl":R()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...de(),"hidden","none"]}],"divide-style":[{divide:[...de(),"hidden","none"]}],"border-color":[{border:B()}],"border-color-x":[{"border-x":B()}],"border-color-y":[{"border-y":B()}],"border-color-s":[{"border-s":B()}],"border-color-e":[{"border-e":B()}],"border-color-t":[{"border-t":B()}],"border-color-r":[{"border-r":B()}],"border-color-b":[{"border-b":B()}],"border-color-l":[{"border-l":B()}],"divide-color":[{divide:B()}],"outline-style":[{outline:[...de(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Re,we,ve]}],"outline-w":[{outline:["",Re,Ir,An]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","none",d,To,Eo]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",f,To,Eo]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:ae()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[Re,An]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",h,To,Eo]}],"text-shadow-color":[{"text-shadow":B()}],opacity:[{opacity:[Re,we,ve]}],"mix-blend":[{"mix-blend":[...ke(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ke()}],"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":[Re]}],"mask-image-linear-from-pos":[{"mask-linear-from":pe()}],"mask-image-linear-to-pos":[{"mask-linear-to":pe()}],"mask-image-linear-from-color":[{"mask-linear-from":B()}],"mask-image-linear-to-color":[{"mask-linear-to":B()}],"mask-image-t-from-pos":[{"mask-t-from":pe()}],"mask-image-t-to-pos":[{"mask-t-to":pe()}],"mask-image-t-from-color":[{"mask-t-from":B()}],"mask-image-t-to-color":[{"mask-t-to":B()}],"mask-image-r-from-pos":[{"mask-r-from":pe()}],"mask-image-r-to-pos":[{"mask-r-to":pe()}],"mask-image-r-from-color":[{"mask-r-from":B()}],"mask-image-r-to-color":[{"mask-r-to":B()}],"mask-image-b-from-pos":[{"mask-b-from":pe()}],"mask-image-b-to-pos":[{"mask-b-to":pe()}],"mask-image-b-from-color":[{"mask-b-from":B()}],"mask-image-b-to-color":[{"mask-b-to":B()}],"mask-image-l-from-pos":[{"mask-l-from":pe()}],"mask-image-l-to-pos":[{"mask-l-to":pe()}],"mask-image-l-from-color":[{"mask-l-from":B()}],"mask-image-l-to-color":[{"mask-l-to":B()}],"mask-image-x-from-pos":[{"mask-x-from":pe()}],"mask-image-x-to-pos":[{"mask-x-to":pe()}],"mask-image-x-from-color":[{"mask-x-from":B()}],"mask-image-x-to-color":[{"mask-x-to":B()}],"mask-image-y-from-pos":[{"mask-y-from":pe()}],"mask-image-y-to-pos":[{"mask-y-to":pe()}],"mask-image-y-from-color":[{"mask-y-from":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"mask-image-radial":[{"mask-radial":[we,ve]}],"mask-image-radial-from-pos":[{"mask-radial-from":pe()}],"mask-image-radial-to-pos":[{"mask-radial-to":pe()}],"mask-image-radial-from-color":[{"mask-radial-from":B()}],"mask-image-radial-to-color":[{"mask-radial-to":B()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[Re]}],"mask-image-conic-from-pos":[{"mask-conic-from":pe()}],"mask-image-conic-to-pos":[{"mask-conic-to":pe()}],"mask-image-conic-from-color":[{"mask-conic-from":B()}],"mask-image-conic-to-color":[{"mask-conic-to":B()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:J()}],"mask-repeat":[{mask:I()}],"mask-size":[{mask:K()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",we,ve]}],filter:[{filter:["","none",we,ve]}],blur:[{blur:se()}],brightness:[{brightness:[Re,we,ve]}],contrast:[{contrast:[Re,we,ve]}],"drop-shadow":[{"drop-shadow":["","none",p,To,Eo]}],"drop-shadow-color":[{"drop-shadow":B()}],grayscale:[{grayscale:["",Re,we,ve]}],"hue-rotate":[{"hue-rotate":[Re,we,ve]}],invert:[{invert:["",Re,we,ve]}],saturate:[{saturate:[Re,we,ve]}],sepia:[{sepia:["",Re,we,ve]}],"backdrop-filter":[{"backdrop-filter":["","none",we,ve]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[Re,we,ve]}],"backdrop-contrast":[{"backdrop-contrast":[Re,we,ve]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Re,we,ve]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Re,we,ve]}],"backdrop-invert":[{"backdrop-invert":["",Re,we,ve]}],"backdrop-opacity":[{"backdrop-opacity":[Re,we,ve]}],"backdrop-saturate":[{"backdrop-saturate":[Re,we,ve]}],"backdrop-sepia":[{"backdrop-sepia":["",Re,we,ve]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",we,ve]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Re,"initial",we,ve]}],ease:[{ease:["linear","initial",b,we,ve]}],delay:[{delay:[Re,we,ve]}],animate:[{animate:["none",v,we,ve]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,we,ve]}],"perspective-origin":[{"perspective-origin":S()}],rotate:[{rotate:le()}],"rotate-x":[{"rotate-x":le()}],"rotate-y":[{"rotate-y":le()}],"rotate-z":[{"rotate-z":le()}],scale:[{scale:ce()}],"scale-x":[{"scale-x":ce()}],"scale-y":[{"scale-y":ce()}],"scale-z":[{"scale-z":ce()}],"scale-3d":["scale-3d"],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[we,ve,"","none","gpu","cpu"]}],"transform-origin":[{origin:S()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:be()}],"translate-x":[{"translate-x":be()}],"translate-y":[{"translate-y":be()}],"translate-z":[{"translate-z":be()}],"translate-none":["translate-none"],accent:[{accent:B()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:B()}],"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,ve]}],"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":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"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,ve]}],fill:[{fill:["none",...B()]}],"stroke-w":[{stroke:[Re,Ir,An,bi]}],stroke:[{stroke:["none",...B()]}],"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"]}},iS=F_(sS);function me(...e){return iS(Ip(e))}function Ve(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":(e/1e3).toFixed(1).replace(/\.0$/,"")+"K"}function Wp(e){return e>=1024*1024?(e/(1024*1024)).toFixed(1).replace(/\.0$/,"")+"M":(e/1024).toFixed(1).replace(/\.0$/,"")+"K"}function eu(e,t,n){const r=e*10;return!Number.isSafeInteger(r)||r%t!==0?null:(r/t/10).toFixed(1).replace(/\.0$/,"")+n}function aS(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 lS(e){if(e===void 0||e==="")return 1;switch(e.toLowerCase()){case"k":return 1024;case"m":return 1024*1024;default:return null}}function ds(e){const t=e.trim().replaceAll(",","");if(t==="")return null;const n=/^(\d+(?:\.\d+)?)\s*([kKmM])?$/.exec(t);if(n===null)return null;const r=n[1];if(r===void 0)return null;const o=Number(r),i=n[2],a=lS(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 cS(e){return e===null?"pending":e>=200&&e<300?"success":e>=400&&e<500?"client_error":e>=500?"server_error":"pending"}const uS=re({model:T().min(1),contextWindow:te().int().positive().optional(),outputLimit:te().int().positive().optional(),source:Ae(["manual","registry"]).optional(),sourceUrl:T().optional(),updatedAt:T().optional()}),fs=re({id:T(),name:T(),apiKey:T(),model:T().optional(),models:ge(T()).min(1),format:Ae(["anthropic","openai"]).optional(),baseUrl:T().optional(),anthropicBaseUrl:T().optional(),openaiBaseUrl:T().optional(),authHeader:Ae(["bearer","x-api-key"]).optional().default("bearer"),apiDocsUrl:T().optional(),modelMetadataUrl:T().optional(),modelMetadata:ge(uS).optional(),source:Ae(["company","personal"]).optional(),createdAt:T(),updatedAt:T()});async function dS(e){return vn(e,fs.array(),void 0,t=>`Failed to fetch ${e}: ${t.status}`)}function Vp(){const e=Un("/api/providers?includeSecrets=1",dS,{revalidateOnFocus:!1,revalidateIfStale:!1});return{providers:e.data??[],isLoading:e.isLoading,isError:e.error,mutate:e.mutate}}const tu=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,nu=Ip,Cl=(e,t)=>n=>{var r;if(t?.variants==null)return nu(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=tu(d)||tu(f);return o[u][h]}),l=n&&Object.entries(n).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(y=>{let[m,x]=y;return Array.isArray(x)?x.includes({...i,...l}[m]):{...i,...l}[m]===x})?[...u,f,h]:u},[]);return nu(e,a,c,n?.class,n?.className)};function ru(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function qp(...e){return t=>{let n=!1;const r=e.map(o=>{const i=ru(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():ru(e[o],null)}}}}function Fe(...e){return g.useCallback(qp(...e),e)}function gr(e){const t=pS(e),n=g.forwardRef((r,o)=>{const{children:i,...a}=r,l=g.Children.toArray(i),c=l.find(mS);if(c){const u=c.props.children,d=l.map(f=>f===c?g.Children.count(u)>1?g.Children.only(null):g.isValidElement(u)?u.props.children:null:f);return s.jsx(t,{...a,ref:o,children:g.isValidElement(u)?g.cloneElement(u,void 0,d):null})}return s.jsx(t,{...a,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}var fS=gr("Slot");function pS(e){const t=g.forwardRef((n,r)=>{const{children:o,...i}=n;if(g.isValidElement(o)){const a=xS(o),l=gS(i,o.props);return o.type!==g.Fragment&&(l.ref=r?qp(r,a):a),g.cloneElement(o,l)}return g.Children.count(o)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Zp=Symbol("radix.slottable");function hS(e){const t=({children:n})=>s.jsx(s.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Zp,t}function mS(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Zp}function gS(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...l)=>{const c=i(...l);return o(...l),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function xS(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 bS=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ze=bS.reduce((e,t)=>{const n=gr(`Primitive.${t}`),r=g.forwardRef((o,i)=>{const{asChild:a,...l}=o,c=a?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function yS(e,t){e&&ao.flushSync(()=>e.dispatchEvent(t))}var Gp=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"}),vS="VisuallyHidden",Kp=g.forwardRef((e,t)=>s.jsx(ze.span,{...e,ref:t,style:{...Gp,...e.style}}));Kp.displayName=vS;var wS=Kp;function kS(e,t){const n=g.createContext(t),r=i=>{const{children:a,...l}=i,c=g.useMemo(()=>l,Object.values(l));return s.jsx(n.Provider,{value:c,children:a})};r.displayName=e+"Provider";function o(i){const a=g.useContext(n);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function un(e,t=[]){let n=[];function r(i,a){const l=g.createContext(a),c=n.length;n=[...n,a];const u=f=>{const{scope:h,children:p,...y}=f,m=h?.[e]?.[c]||l,x=g.useMemo(()=>y,Object.values(y));return s.jsx(m.Provider,{value:x,children:p})};u.displayName=i+"Provider";function d(f,h){const p=h?.[e]?.[c]||l,y=g.useContext(p);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[u,d]}const o=()=>{const i=n.map(a=>g.createContext(a));return function(l){const c=l?.[e]||i;return g.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[r,_S(o,...t)]}function _S(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const a=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...l,...f}},{});return g.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function Jp(e){const t=e+"CollectionProvider",[n,r]=un(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),a=m=>{const{scope:x,children:b}=m,v=pt.useRef(null),w=pt.useRef(new Map).current;return s.jsx(o,{scope:x,itemMap:w,collectionRef:v,children:b})};a.displayName=t;const l=e+"CollectionSlot",c=gr(l),u=pt.forwardRef((m,x)=>{const{scope:b,children:v}=m,w=i(l,b),C=Fe(x,w.collectionRef);return s.jsx(c,{ref:C,children:v})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",h=gr(d),p=pt.forwardRef((m,x)=>{const{scope:b,children:v,...w}=m,C=pt.useRef(null),S=Fe(x,C),j=i(d,b);return pt.useEffect(()=>(j.itemMap.set(C,{ref:C,...w}),()=>{j.itemMap.delete(C)})),s.jsx(h,{[f]:"",ref:S,children:v})});p.displayName=d;function y(m){const x=i(e+"CollectionConsumer",m);return pt.useCallback(()=>{const v=x.collectionRef.current;if(!v)return[];const w=Array.from(v.querySelectorAll(`[${f}]`));return Array.from(x.itemMap.values()).sort((j,N)=>w.indexOf(j.ref.current)-w.indexOf(N.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:a,Slot:u,ItemSlot:p},y,r]}function Ce(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}var st=globalThis?.document?g.useLayoutEffect:()=>{},SS=vf[" useInsertionEffect ".trim().toString()]||st;function Mn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,a]=CS({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:o;{const d=g.useRef(e!==void 0);g.useEffect(()=>{const f=d.current;f!==l&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=l},[l,r])}const u=g.useCallback(d=>{if(l){const f=jS(d)?d(e):d;f!==e&&a.current?.(f)}else i(d)},[l,e,i,a]);return[c,u]}function CS({defaultProp:e,onChange:t}){const[n,r]=g.useState(e),o=g.useRef(n),i=g.useRef(t);return SS(()=>{i.current=t},[t]),g.useEffect(()=>{o.current!==n&&(i.current?.(n),o.current=n)},[n,o]),[n,r,i]}function jS(e){return typeof e=="function"}function NS(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var It=e=>{const{present:t,children:n}=e,r=ES(t),o=typeof n=="function"?n({present:r.isPresent}):g.Children.only(n),i=Fe(r.ref,TS(o));return typeof n=="function"||r.isPresent?g.cloneElement(o,{ref:i}):null};It.displayName="Presence";function ES(e){const[t,n]=g.useState(),r=g.useRef(null),o=g.useRef(e),i=g.useRef("none"),a=e?"mounted":"unmounted",[l,c]=NS(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const u=Ao(r.current);i.current=l==="mounted"?u:"none"},[l]),st(()=>{const u=r.current,d=o.current;if(d!==e){const h=i.current,p=Ao(u);e?c("MOUNT"):p==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),st(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const m=Ao(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&m&&(c("ANIMATION_END"),!o.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},h=p=>{p.target===t&&(i.current=Ao(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:g.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function Ao(e){return e?.animationName||"none"}function TS(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 AS=vf[" useId ".trim().toString()]||(()=>{}),IS=0;function Gt(e){const[t,n]=g.useState(AS());return st(()=>{n(r=>r??String(IS++))},[e]),e||(t?`radix-${t}`:"")}var Bs="Collapsible",[zS]=un(Bs),[RS,jl]=zS(Bs),Yp=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:i,onOpenChange:a,...l}=e,[c,u]=Mn({prop:r,defaultProp:o??!1,onChange:a,caller:Bs});return s.jsx(RS,{scope:n,disabled:i,contentId:Gt(),open:c,onOpenToggle:g.useCallback(()=>u(d=>!d),[u]),children:s.jsx(ze.div,{"data-state":El(c),"data-disabled":i?"":void 0,...l,ref:t})})});Yp.displayName=Bs;var Xp="CollapsibleTrigger",Qp=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=jl(Xp,n);return s.jsx(ze.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":El(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:Ce(e.onClick,o.onOpenToggle)})});Qp.displayName=Xp;var Nl="CollapsibleContent",eh=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=jl(Nl,e.__scopeCollapsible);return s.jsx(It,{present:n||o.open,children:({present:i})=>s.jsx(PS,{...r,ref:t,present:i})})});eh.displayName=Nl;var PS=g.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...i}=e,a=jl(Nl,n),[l,c]=g.useState(r),u=g.useRef(null),d=Fe(t,u),f=g.useRef(0),h=f.current,p=g.useRef(0),y=p.current,m=a.open||l,x=g.useRef(m),b=g.useRef(void 0);return g.useEffect(()=>{const v=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(v)},[]),st(()=>{const v=u.current;if(v){b.current=b.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const w=v.getBoundingClientRect();f.current=w.height,p.current=w.width,x.current||(v.style.transitionDuration=b.current.transitionDuration,v.style.animationName=b.current.animationName),c(r)}},[a.open,r]),s.jsx(ze.div,{"data-state":El(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!m,...i,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...e.style},children:m&&o})});function El(e){return e?"open":"closed"}var OS=Yp,MS=g.createContext(void 0);function Us(e){const t=g.useContext(MS);return e||t||"ltr"}function ut(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...n)=>t.current?.(...n),[])}function LS(e,t=globalThis?.document){const n=ut(e);g.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var DS="DismissableLayer",ha="dismissableLayer.update",FS="dismissableLayer.pointerDownOutside",$S="dismissableLayer.focusOutside",ou,th=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Hs=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:a,onDismiss:l,...c}=e,u=g.useContext(th),[d,f]=g.useState(null),h=d?.ownerDocument??globalThis?.document,[,p]=g.useState({}),y=Fe(t,N=>f(N)),m=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(x),v=d?m.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,C=v>=b,S=HS(N=>{const A=N.target,z=[...u.branches].some(L=>L.contains(A));!C||z||(o?.(N),a?.(N),N.defaultPrevented||l?.())},h),j=WS(N=>{const A=N.target;[...u.branches].some(L=>L.contains(A))||(i?.(N),a?.(N),N.defaultPrevented||l?.())},h);return LS(N=>{v===u.layers.size-1&&(r?.(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},h),g.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(ou=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=ou)}},[d,h,n,u]),g.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),su())},[d,u]),g.useEffect(()=>{const N=()=>p({});return document.addEventListener(ha,N),()=>document.removeEventListener(ha,N)},[]),s.jsx(ze.div,{...c,ref:y,style:{pointerEvents:w?C?"auto":"none":void 0,...e.style},onFocusCapture:Ce(e.onFocusCapture,j.onFocusCapture),onBlurCapture:Ce(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:Ce(e.onPointerDownCapture,S.onPointerDownCapture)})});Hs.displayName=DS;var BS="DismissableLayerBranch",US=g.forwardRef((e,t)=>{const n=g.useContext(th),r=g.useRef(null),o=Fe(t,r);return g.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),s.jsx(ze.div,{...e,ref:o})});US.displayName=BS;function HS(e,t=globalThis?.document){const n=ut(e),r=g.useRef(!1),o=g.useRef(()=>{});return g.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let c=function(){nh(FS,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function WS(e,t=globalThis?.document){const n=ut(e),r=g.useRef(!1);return g.useEffect(()=>{const o=i=>{i.target&&!r.current&&nh($S,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function su(){const e=new CustomEvent(ha);document.dispatchEvent(e)}function nh(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?yS(o,i):o.dispatchEvent(i)}var yi="focusScope.autoFocusOnMount",vi="focusScope.autoFocusOnUnmount",iu={bubbles:!1,cancelable:!0},VS="FocusScope",Tl=g.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...a}=e,[l,c]=g.useState(null),u=ut(o),d=ut(i),f=g.useRef(null),h=Fe(t,m=>c(m)),p=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(r){let m=function(w){if(p.paused||!l)return;const C=w.target;l.contains(C)?f.current=C:gn(f.current,{select:!0})},x=function(w){if(p.paused||!l)return;const C=w.relatedTarget;C!==null&&(l.contains(C)||gn(f.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const S of w)S.removedNodes.length>0&&gn(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",x);const v=new MutationObserver(b);return l&&v.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",x),v.disconnect()}}},[r,l,p.paused]),g.useEffect(()=>{if(l){lu.add(p);const m=document.activeElement;if(!l.contains(m)){const b=new CustomEvent(yi,iu);l.addEventListener(yi,u),l.dispatchEvent(b),b.defaultPrevented||(qS(YS(rh(l)),{select:!0}),document.activeElement===m&&gn(l))}return()=>{l.removeEventListener(yi,u),setTimeout(()=>{const b=new CustomEvent(vi,iu);l.addEventListener(vi,d),l.dispatchEvent(b),b.defaultPrevented||gn(m??document.body,{select:!0}),l.removeEventListener(vi,d),lu.remove(p)},0)}}},[l,u,d,p]);const y=g.useCallback(m=>{if(!n&&!r||p.paused)return;const x=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(x&&b){const v=m.currentTarget,[w,C]=ZS(v);w&&C?!m.shiftKey&&b===C?(m.preventDefault(),n&&gn(w,{select:!0})):m.shiftKey&&b===w&&(m.preventDefault(),n&&gn(C,{select:!0})):b===v&&m.preventDefault()}},[n,r,p.paused]);return s.jsx(ze.div,{tabIndex:-1,...a,ref:h,onKeyDown:y})});Tl.displayName=VS;function qS(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(gn(r,{select:t}),document.activeElement!==n)return}function ZS(e){const t=rh(e),n=au(t,e),r=au(t.reverse(),e);return[n,r]}function rh(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function au(e,t){for(const n of e)if(!GS(n,{upTo:t}))return n}function GS(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 KS(e){return e instanceof HTMLInputElement&&"select"in e}function gn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&KS(e)&&t&&e.select()}}var lu=JS();function JS(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=cu(e,t),e.unshift(t)},remove(t){e=cu(e,t),e[0]?.resume()}}}function cu(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function YS(e){return e.filter(t=>t.tagName!=="A")}var XS="Portal",Ws=g.forwardRef((e,t)=>{const{container:n,...r}=e,[o,i]=g.useState(!1);st(()=>i(!0),[]);const a=n||o&&globalThis?.document?.body;return a?Qx.createPortal(s.jsx(ze.div,{...r,ref:t}),a):null});Ws.displayName=XS;var wi=0;function oh(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??uu()),document.body.insertAdjacentElement("beforeend",e[1]??uu()),wi++,()=>{wi===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),wi--}},[])}function uu(){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 Vt=function(){return Vt=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Vt.apply(this,arguments)};function sh(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function QS(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var Xo="right-scroll-bar-position",Qo="width-before-scroll-bar",eC="with-scroll-bars-hidden",tC="--removed-body-scroll-bar-size";function ki(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function nC(e,t){var n=g.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var rC=typeof window<"u"?g.useLayoutEffect:g.useEffect,du=new WeakMap;function oC(e,t){var n=nC(null,function(r){return e.forEach(function(o){return ki(o,r)})});return rC(function(){var r=du.get(n);if(r){var o=new Set(r),i=new Set(e),a=n.current;o.forEach(function(l){i.has(l)||ki(l,null)}),i.forEach(function(l){o.has(l)||ki(l,a)})}du.set(n,e)},[e]),n}function sC(e){return e}function iC(e,t){t===void 0&&(t=sC);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var a=t(i,r);return n.push(a),function(){n=n.filter(function(l){return l!==a})}},assignSyncMedium:function(i){for(r=!0;n.length;){var a=n;n=[],a.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!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 aC(e){e===void 0&&(e={});var t=iC(null);return t.options=Vt({async:!0,ssr:!1},e),t}var ih=function(e){var t=e.sideCar,n=sh(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return g.createElement(r,Vt({},n))};ih.isSideCarExport=!0;function lC(e,t){return e.useMedium(t),ih}var ah=aC(),_i=function(){},Vs=g.forwardRef(function(e,t){var n=g.useRef(null),r=g.useState({onScrollCapture:_i,onWheelCapture:_i,onTouchMoveCapture:_i}),o=r[0],i=r[1],a=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,h=e.sideCar,p=e.noRelative,y=e.noIsolation,m=e.inert,x=e.allowPinchZoom,b=e.as,v=b===void 0?"div":b,w=e.gapMode,C=sh(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=h,j=oC([n,t]),N=Vt(Vt({},C),o);return g.createElement(g.Fragment,null,d&&g.createElement(S,{sideCar:ah,removeScrollBar:u,shards:f,noRelative:p,noIsolation:y,inert:m,setCallbacks:i,allowPinchZoom:!!x,lockRef:n,gapMode:w}),a?g.cloneElement(g.Children.only(l),Vt(Vt({},N),{ref:j})):g.createElement(v,Vt({},N,{className:c,ref:j}),l))});Vs.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Vs.classNames={fullWidth:Qo,zeroRight:Xo};var cC=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function uC(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=cC();return t&&e.setAttribute("nonce",t),e}function dC(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function fC(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var pC=function(){var e=0,t=null;return{add:function(n){e==0&&(t=uC())&&(dC(t,n),fC(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},hC=function(){var e=pC();return function(t,n){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},lh=function(){var e=hC(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},mC={left:0,top:0,right:0,gap:0},Si=function(e){return parseInt(e||"",10)||0},gC=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Si(n),Si(r),Si(o)]},xC=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return mC;var t=gC(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},bC=lh(),ar="data-scroll-locked",yC=function(e,t,n,r){var o=e.left,i=e.top,a=e.right,l=e.gap;return n===void 0&&(n="margin"),`
42
+ .`.concat(eC,` {
43
+ overflow: hidden `).concat(r,`;
44
+ padding-right: `).concat(l,"px ").concat(r,`;
45
+ }
46
+ body[`).concat(ar,`] {
47
+ overflow: hidden `).concat(r,`;
48
+ overscroll-behavior: contain;
49
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
50
+ padding-left: `.concat(o,`px;
51
+ padding-top: `).concat(i,`px;
52
+ padding-right: `).concat(a,`px;
53
+ margin-left:0;
54
+ margin-top:0;
55
+ margin-right: `).concat(l,"px ").concat(r,`;
56
+ `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
57
+ }
58
+
59
+ .`).concat(Xo,` {
60
+ right: `).concat(l,"px ").concat(r,`;
61
+ }
62
+
63
+ .`).concat(Qo,` {
64
+ margin-right: `).concat(l,"px ").concat(r,`;
65
+ }
66
+
67
+ .`).concat(Xo," .").concat(Xo,` {
68
+ right: 0 `).concat(r,`;
69
+ }
70
+
71
+ .`).concat(Qo," .").concat(Qo,` {
72
+ margin-right: 0 `).concat(r,`;
73
+ }
74
+
75
+ body[`).concat(ar,`] {
76
+ `).concat(tC,": ").concat(l,`px;
77
+ }
78
+ `)},fu=function(){var e=parseInt(document.body.getAttribute(ar)||"0",10);return isFinite(e)?e:0},vC=function(){g.useEffect(function(){return document.body.setAttribute(ar,(fu()+1).toString()),function(){var e=fu()-1;e<=0?document.body.removeAttribute(ar):document.body.setAttribute(ar,e.toString())}},[])},wC=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;vC();var i=g.useMemo(function(){return xC(o)},[o]);return g.createElement(bC,{styles:yC(i,!t,o,n?"":"!important")})},ma=!1;if(typeof window<"u")try{var Io=Object.defineProperty({},"passive",{get:function(){return ma=!0,!0}});window.addEventListener("test",Io,Io),window.removeEventListener("test",Io,Io)}catch{ma=!1}var Kn=ma?{passive:!1}:!1,kC=function(e){return e.tagName==="TEXTAREA"},ch=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!kC(e)&&n[t]==="visible")},_C=function(e){return ch(e,"overflowY")},SC=function(e){return ch(e,"overflowX")},pu=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=uh(e,r);if(o){var i=dh(e,r),a=i[1],l=i[2];if(a>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},CC=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},jC=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},uh=function(e,t){return e==="v"?_C(t):SC(t)},dh=function(e,t){return e==="v"?CC(t):jC(t)},NC=function(e,t){return e==="h"&&t==="rtl"?-1:1},EC=function(e,t,n,r,o){var i=NC(e,window.getComputedStyle(t).direction),a=i*r,l=n.target,c=t.contains(l),u=!1,d=a>0,f=0,h=0;do{if(!l)break;var p=dh(e,l),y=p[0],m=p[1],x=p[2],b=m-x-i*y;(y||b)&&uh(e,l)&&(f+=b,h+=y);var v=l.parentNode;l=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}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},zo=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},hu=function(e){return[e.deltaX,e.deltaY]},mu=function(e){return e&&"current"in e?e.current:e},TC=function(e,t){return e[0]===t[0]&&e[1]===t[1]},AC=function(e){return`
79
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
80
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
81
+ `)},IC=0,Jn=[];function zC(e){var t=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),o=g.useState(IC++)[0],i=g.useState(lh)[0],a=g.useRef(e);g.useEffect(function(){a.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=QS([e.lockRef.current],(e.shards||[]).map(mu),!0).filter(Boolean);return m.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=g.useCallback(function(m,x){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!a.current.allowPinchZoom;var b=zo(m),v=n.current,w="deltaX"in m?m.deltaX:v[0]-b[0],C="deltaY"in m?m.deltaY:v[1]-b[1],S,j=m.target,N=Math.abs(w)>Math.abs(C)?"h":"v";if("touches"in m&&N==="h"&&j.type==="range")return!1;var A=window.getSelection(),z=A&&A.anchorNode,L=z?z===j||z.contains(j):!1;if(L)return!1;var U=pu(N,j);if(!U)return!0;if(U?S=N:(S=N==="v"?"h":"v",U=pu(N,j)),!U)return!1;if(!r.current&&"changedTouches"in m&&(w||C)&&(r.current=S),!S)return!0;var E=r.current||S;return EC(E,x,m,E==="h"?w:C)},[]),c=g.useCallback(function(m){var x=m;if(!(!Jn.length||Jn[Jn.length-1]!==i)){var b="deltaY"in x?hu(x):zo(x),v=t.current.filter(function(S){return S.name===x.type&&(S.target===x.target||x.target===S.shadowParent)&&TC(S.delta,b)})[0];if(v&&v.should){x.cancelable&&x.preventDefault();return}if(!v){var w=(a.current.shards||[]).map(mu).filter(Boolean).filter(function(S){return S.contains(x.target)}),C=w.length>0?l(x,w[0]):!a.current.noIsolation;C&&x.cancelable&&x.preventDefault()}}},[]),u=g.useCallback(function(m,x,b,v){var w={name:m,delta:x,target:b,should:v,shadowParent:RC(b)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(C){return C!==w})},1)},[]),d=g.useCallback(function(m){n.current=zo(m),r.current=void 0},[]),f=g.useCallback(function(m){u(m.type,hu(m),m.target,l(m,e.lockRef.current))},[]),h=g.useCallback(function(m){u(m.type,zo(m),m.target,l(m,e.lockRef.current))},[]);g.useEffect(function(){return Jn.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Kn),document.addEventListener("touchmove",c,Kn),document.addEventListener("touchstart",d,Kn),function(){Jn=Jn.filter(function(m){return m!==i}),document.removeEventListener("wheel",c,Kn),document.removeEventListener("touchmove",c,Kn),document.removeEventListener("touchstart",d,Kn)}},[]);var p=e.removeScrollBar,y=e.inert;return g.createElement(g.Fragment,null,y?g.createElement(i,{styles:AC(o)}):null,p?g.createElement(wC,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function RC(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const PC=lC(ah,zC);var Al=g.forwardRef(function(e,t){return g.createElement(Vs,Vt({},e,{ref:t,sideCar:PC}))});Al.classNames=Vs.classNames;var OC=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Yn=new WeakMap,Ro=new WeakMap,Po={},Ci=0,fh=function(e){return e&&(e.host||fh(e.parentNode))},MC=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=fh(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},LC=function(e,t,n,r){var o=MC(t,Array.isArray(e)?e:[e]);Po[n]||(Po[n]=new WeakMap);var i=Po[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 p=h.getAttribute(r),y=p!==null&&p!=="false",m=(Yn.get(h)||0)+1,x=(i.get(h)||0)+1;Yn.set(h,m),i.set(h,x),a.push(h),m===1&&y&&Ro.set(h,!0),x===1&&h.setAttribute(n,"true"),y||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return d(t),l.clear(),Ci++,function(){a.forEach(function(f){var h=Yn.get(f)-1,p=i.get(f)-1;Yn.set(f,h),i.set(f,p),h||(Ro.has(f)||f.removeAttribute(r),Ro.delete(f)),p||f.removeAttribute(n)}),Ci--,Ci||(Yn=new WeakMap,Yn=new WeakMap,Ro=new WeakMap,Po={})}},ph=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=OC(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),LC(r,o,n,"aria-hidden")):function(){return null}},qs="Dialog",[hh]=un(qs),[DC,Bt]=hh(qs),mh=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:a=!0}=e,l=g.useRef(null),c=g.useRef(null),[u,d]=Mn({prop:r,defaultProp:o??!1,onChange:i,caller:qs});return s.jsx(DC,{scope:t,triggerRef:l,contentRef:c,contentId:Gt(),titleId:Gt(),descriptionId:Gt(),open:u,onOpenChange:d,onOpenToggle:g.useCallback(()=>d(f=>!f),[d]),modal:a,children:n})};mh.displayName=qs;var gh="DialogTrigger",xh=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Bt(gh,n),i=Fe(t,o.triggerRef);return s.jsx(ze.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Rl(o.open),...r,ref:i,onClick:Ce(e.onClick,o.onOpenToggle)})});xh.displayName=gh;var Il="DialogPortal",[FC,bh]=hh(Il,{forceMount:void 0}),yh=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=Bt(Il,t);return s.jsx(FC,{scope:t,forceMount:n,children:g.Children.map(r,a=>s.jsx(It,{present:n||i.open,children:s.jsx(Ws,{asChild:!0,container:o,children:a})}))})};yh.displayName=Il;var ps="DialogOverlay",vh=g.forwardRef((e,t)=>{const n=bh(ps,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=Bt(ps,e.__scopeDialog);return i.modal?s.jsx(It,{present:r||i.open,children:s.jsx(BC,{...o,ref:t})}):null});vh.displayName=ps;var $C=gr("DialogOverlay.RemoveScroll"),BC=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Bt(ps,n);return s.jsx(Al,{as:$C,allowPinchZoom:!0,shards:[o.contentRef],children:s.jsx(ze.div,{"data-state":Rl(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Ln="DialogContent",wh=g.forwardRef((e,t)=>{const n=bh(Ln,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=Bt(Ln,e.__scopeDialog);return s.jsx(It,{present:r||i.open,children:i.modal?s.jsx(UC,{...o,ref:t}):s.jsx(HC,{...o,ref:t})})});wh.displayName=Ln;var UC=g.forwardRef((e,t)=>{const n=Bt(Ln,e.__scopeDialog),r=g.useRef(null),o=Fe(t,n.contentRef,r);return g.useEffect(()=>{const i=r.current;if(i)return ph(i)},[]),s.jsx(kh,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ce(e.onCloseAutoFocus,i=>{i.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Ce(e.onPointerDownOutside,i=>{const a=i.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0;(a.button===2||l)&&i.preventDefault()}),onFocusOutside:Ce(e.onFocusOutside,i=>i.preventDefault())})}),HC=g.forwardRef((e,t)=>{const n=Bt(Ln,e.__scopeDialog),r=g.useRef(!1),o=g.useRef(!1);return s.jsx(kh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(r.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()}})}),kh=g.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...a}=e,l=Bt(Ln,n),c=g.useRef(null),u=Fe(t,c);return oh(),s.jsxs(s.Fragment,{children:[s.jsx(Tl,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:s.jsx(Hs,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Rl(l.open),...a,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),s.jsxs(s.Fragment,{children:[s.jsx(WC,{titleId:l.titleId}),s.jsx(qC,{contentRef:c,descriptionId:l.descriptionId})]})]})}),zl="DialogTitle",_h=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Bt(zl,n);return s.jsx(ze.h2,{id:o.titleId,...r,ref:t})});_h.displayName=zl;var Sh="DialogDescription",Ch=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Bt(Sh,n);return s.jsx(ze.p,{id:o.descriptionId,...r,ref:t})});Ch.displayName=Sh;var jh="DialogClose",Nh=g.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Bt(jh,n);return s.jsx(ze.button,{type:"button",...r,ref:t,onClick:Ce(e.onClick,()=>o.onOpenChange(!1))})});Nh.displayName=jh;function Rl(e){return e?"open":"closed"}var Eh="DialogTitleWarning",[W6,Th]=kS(Eh,{contentName:Ln,titleName:zl,docsSlug:"dialog"}),WC=({titleId:e})=>{const t=Th(Eh),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
82
+
83
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
84
+
85
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return g.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},VC="DialogDescriptionWarning",qC=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Th(VC).contentName}}.`;return g.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},ZC=mh,GC=xh,KC=yh,JC=vh,YC=wh,XC=_h,QC=Ch,ej=Nh;function tj(e){const t=g.useRef({value:e,previous:e});return g.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function nj(e){const[t,n]=g.useState(void 0);return st(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=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 r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const rj=["top","right","bottom","left"],kn=Math.min,vt=Math.max,hs=Math.round,Oo=Math.floor,Kt=e=>({x:e,y:e}),oj={left:"right",right:"left",bottom:"top",top:"bottom"},sj={start:"end",end:"start"};function ga(e,t,n){return vt(e,kn(t,n))}function sn(e,t){return typeof e=="function"?e(t):e}function an(e){return e.split("-")[0]}function Sr(e){return e.split("-")[1]}function Pl(e){return e==="x"?"y":"x"}function Ol(e){return e==="y"?"height":"width"}const ij=new Set(["top","bottom"]);function Zt(e){return ij.has(an(e))?"y":"x"}function Ml(e){return Pl(Zt(e))}function aj(e,t,n){n===void 0&&(n=!1);const r=Sr(e),o=Ml(e),i=Ol(o);let a=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=ms(a)),[a,ms(a)]}function lj(e){const t=ms(e);return[xa(e),t,xa(t)]}function xa(e){return e.replace(/start|end/g,t=>sj[t])}const gu=["left","right"],xu=["right","left"],cj=["top","bottom"],uj=["bottom","top"];function dj(e,t,n){switch(e){case"top":case"bottom":return n?t?xu:gu:t?gu:xu;case"left":case"right":return t?cj:uj;default:return[]}}function fj(e,t,n,r){const o=Sr(e);let i=dj(an(e),n==="start",r);return o&&(i=i.map(a=>a+"-"+o),t&&(i=i.concat(i.map(xa)))),i}function ms(e){return e.replace(/left|right|bottom|top/g,t=>oj[t])}function pj(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ah(e){return typeof e!="number"?pj(e):{top:e,right:e,bottom:e,left:e}}function gs(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function bu(e,t,n){let{reference:r,floating:o}=e;const i=Zt(t),a=Ml(t),l=Ol(a),c=an(t),u=i==="y",d=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,h=r[l]/2-o[l]/2;let p;switch(c){case"top":p={x:d,y:r.y-o.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Sr(t)){case"start":p[a]-=h*(n&&u?-1:1);break;case"end":p[a]+=h*(n&&u?-1:1);break}return p}async function hj(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=sn(t,e),y=Ah(p),x=l[h?f==="floating"?"reference":"floating":f],b=gs(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})),v=f==="floating"?{x:r,y:o,width:a.floating.width,height:a.floating.height}:a.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),C=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},S=gs(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:w,strategy:c}):v);return{top:(b.top-S.top+y.top)/C.y,bottom:(S.bottom-b.bottom+y.bottom)/C.y,left:(b.left-S.left+y.left)/C.x,right:(S.right-b.right+y.right)/C.x}}const mj=async(e,t,n)=>{const{placement:r="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,r,c),h=r,p={},y=0;for(let x=0;x<l.length;x++){var m;const{name:b,fn:v}=l[x],{x:w,y:C,data:S,reset:j}=await v({x:d,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:p,rects:u,platform:{...a,detectOverflow:(m=a.detectOverflow)!=null?m:hj},elements:{reference:e,floating:t}});d=w??d,f=C??f,p={...p,[b]:{...p[b],...S}},j&&y<=50&&(y++,typeof j=="object"&&(j.placement&&(h=j.placement),j.rects&&(u=j.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:o}):j.rects),{x:d,y:f}=bu(u,h,c)),x=-1)}return{x:d,y:f,placement:h,strategy:o,middlewareData:p}},gj=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:a,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=sn(e,t)||{};if(u==null)return{};const f=Ah(d),h={x:n,y:r},p=Ml(o),y=Ol(p),m=await a.getDimensions(u),x=p==="y",b=x?"top":"left",v=x?"bottom":"right",w=x?"clientHeight":"clientWidth",C=i.reference[y]+i.reference[p]-h[p]-i.floating[y],S=h[p]-i.reference[p],j=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let N=j?j[w]:0;(!N||!await(a.isElement==null?void 0:a.isElement(j)))&&(N=l.floating[w]||i.floating[y]);const A=C/2-S/2,z=N/2-m[y]/2-1,L=kn(f[b],z),U=kn(f[v],z),E=L,O=N-m[y]-U,k=N/2-m[y]/2+A,D=ga(E,k,O),q=!c.arrow&&Sr(o)!=null&&k!==D&&i.reference[y]/2-(k<E?L:U)-m[y]/2<0,W=q?k<E?k-E:k-O:0;return{[p]:h[p]+W,data:{[p]:D,centerOffset:k-D-W,...q&&{alignmentOffset:W}},reset:q}}}),xj=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:a,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:m=!0,...x}=sn(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=an(o),v=Zt(l),w=an(l)===l,C=await(c.isRTL==null?void 0:c.isRTL(u.floating)),S=h||(w||!m?[ms(l)]:lj(l)),j=y!=="none";!h&&j&&S.push(...fj(l,m,y,C));const N=[l,...S],A=await c.detectOverflow(t,x),z=[];let L=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&z.push(A[b]),f){const k=aj(o,a,C);z.push(A[k[0]],A[k[1]])}if(L=[...L,{placement:o,overflows:z}],!z.every(k=>k<=0)){var U,E;const k=(((U=i.flip)==null?void 0:U.index)||0)+1,D=N[k];if(D&&(!(f==="alignment"?v!==Zt(D):!1)||L.every(B=>Zt(B.placement)===v?B.overflows[0]>0:!0)))return{data:{index:k,overflows:L},reset:{placement:D}};let q=(E=L.filter(W=>W.overflows[0]<=0).sort((W,B)=>W.overflows[1]-B.overflows[1])[0])==null?void 0:E.placement;if(!q)switch(p){case"bestFit":{var O;const W=(O=L.filter(B=>{if(j){const J=Zt(B.placement);return J===v||J==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(J=>J>0).reduce((J,I)=>J+I,0)]).sort((B,J)=>B[1]-J[1])[0])==null?void 0:O[0];W&&(q=W);break}case"initialPlacement":q=l;break}if(o!==q)return{reset:{placement:q}}}return{}}}};function yu(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function vu(e){return rj.some(t=>e[t]>=0)}const bj=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=sn(e,t);switch(o){case"referenceHidden":{const a=await r.detectOverflow(t,{...i,elementContext:"reference"}),l=yu(a,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:vu(l)}}}case"escaped":{const a=await r.detectOverflow(t,{...i,altBoundary:!0}),l=yu(a,n.floating);return{data:{escapedOffsets:l,escaped:vu(l)}}}default:return{}}}}},Ih=new Set(["left","top"]);async function yj(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),a=an(n),l=Sr(n),c=Zt(n)==="y",u=Ih.has(a)?-1:1,d=i&&c?-1:1,f=sn(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof y=="number"&&(p=l==="end"?y*-1:y),c?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const vj=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:a,middlewareData:l}=t,c=await yj(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:a}}}}},wj=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:b=>{let{x:v,y:w}=b;return{x:v,y:w}}},...u}=sn(e,t),d={x:n,y:r},f=await i.detectOverflow(t,u),h=Zt(an(o)),p=Pl(h);let y=d[p],m=d[h];if(a){const b=p==="y"?"top":"left",v=p==="y"?"bottom":"right",w=y+f[b],C=y-f[v];y=ga(w,y,C)}if(l){const b=h==="y"?"top":"left",v=h==="y"?"bottom":"right",w=m+f[b],C=m-f[v];m=ga(w,m,C)}const x=c.fn({...t,[p]:y,[h]:m});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[p]:a,[h]:l}}}}}},kj=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:a}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=sn(e,t),d={x:n,y:r},f=Zt(o),h=Pl(f);let p=d[h],y=d[f];const m=sn(l,t),x=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const w=h==="y"?"height":"width",C=i.reference[h]-i.floating[w]+x.mainAxis,S=i.reference[h]+i.reference[w]-x.mainAxis;p<C?p=C:p>S&&(p=S)}if(u){var b,v;const w=h==="y"?"width":"height",C=Ih.has(an(o)),S=i.reference[f]-i.floating[w]+(C&&((b=a.offset)==null?void 0:b[f])||0)+(C?0:x.crossAxis),j=i.reference[f]+i.reference[w]+(C?0:((v=a.offset)==null?void 0:v[f])||0)-(C?x.crossAxis:0);y<S?y=S:y>j&&(y=j)}return{[h]:p,[f]:y}}}},_j=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:a,elements:l}=t,{apply:c=()=>{},...u}=sn(e,t),d=await a.detectOverflow(t,u),f=an(o),h=Sr(o),p=Zt(o)==="y",{width:y,height:m}=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 v=m-d.top-d.bottom,w=y-d.left-d.right,C=kn(m-d[x],v),S=kn(y-d[b],w),j=!t.middlewareData.shift;let N=C,A=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(N=v),j&&!h){const L=vt(d.left,0),U=vt(d.right,0),E=vt(d.top,0),O=vt(d.bottom,0);p?A=y-2*(L!==0||U!==0?L+U:vt(d.left,d.right)):N=m-2*(E!==0||O!==0?E+O:vt(d.top,d.bottom))}await c({...t,availableWidth:A,availableHeight:N});const z=await a.getDimensions(l.floating);return y!==z.width||m!==z.height?{reset:{rects:!0}}:{}}}};function Zs(){return typeof window<"u"}function Cr(e){return zh(e)?(e.nodeName||"").toLowerCase():"#document"}function _t(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Xt(e){var t;return(t=(zh(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function zh(e){return Zs()?e instanceof Node||e instanceof _t(e).Node:!1}function Lt(e){return Zs()?e instanceof Element||e instanceof _t(e).Element:!1}function Jt(e){return Zs()?e instanceof HTMLElement||e instanceof _t(e).HTMLElement:!1}function wu(e){return!Zs()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _t(e).ShadowRoot}const Sj=new Set(["inline","contents"]);function uo(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Dt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Sj.has(o)}const Cj=new Set(["table","td","th"]);function jj(e){return Cj.has(Cr(e))}const Nj=[":popover-open",":modal"];function Gs(e){return Nj.some(t=>{try{return e.matches(t)}catch{return!1}})}const Ej=["transform","translate","scale","rotate","perspective"],Tj=["transform","translate","scale","rotate","perspective","filter"],Aj=["paint","layout","strict","content"];function Ll(e){const t=Dl(),n=Lt(e)?Dt(e):e;return Ej.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Tj.some(r=>(n.willChange||"").includes(r))||Aj.some(r=>(n.contain||"").includes(r))}function Ij(e){let t=_n(e);for(;Jt(t)&&!xr(t);){if(Ll(t))return t;if(Gs(t))return null;t=_n(t)}return null}function Dl(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const zj=new Set(["html","body","#document"]);function xr(e){return zj.has(Cr(e))}function Dt(e){return _t(e).getComputedStyle(e)}function Ks(e){return Lt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function _n(e){if(Cr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||wu(e)&&e.host||Xt(e);return wu(t)?t.host:t}function Rh(e){const t=_n(e);return xr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Jt(t)&&uo(t)?t:Rh(t)}function no(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Rh(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),a=_t(o);if(i){const l=ba(a);return t.concat(a,a.visualViewport||[],uo(o)?o:[],l&&n?no(l):[])}return t.concat(o,no(o,[],n))}function ba(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ph(e){const t=Dt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Jt(e),i=o?e.offsetWidth:n,a=o?e.offsetHeight:r,l=hs(n)!==i||hs(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function Fl(e){return Lt(e)?e:e.contextElement}function lr(e){const t=Fl(e);if(!Jt(t))return Kt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Ph(t);let a=(i?hs(n.width):n.width)/r,l=(i?hs(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const Rj=Kt(0);function Oh(e){const t=_t(e);return!Dl()||!t.visualViewport?Rj:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Pj(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==_t(e)?!1:t}function Dn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Fl(e);let a=Kt(1);t&&(r?Lt(r)&&(a=lr(r)):a=lr(e));const l=Pj(i,n,r)?Oh(i):Kt(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=_t(i),p=r&&Lt(r)?_t(r):r;let y=h,m=ba(y);for(;m&&r&&p!==y;){const x=lr(m),b=m.getBoundingClientRect(),v=Dt(m),w=b.left+(m.clientLeft+parseFloat(v.paddingLeft))*x.x,C=b.top+(m.clientTop+parseFloat(v.paddingTop))*x.y;c*=x.x,u*=x.y,d*=x.x,f*=x.y,c+=w,u+=C,y=_t(m),m=ba(y)}}return gs({width:d,height:f,x:c,y:u})}function Js(e,t){const n=Ks(e).scrollLeft;return t?t.left+n:Dn(Xt(e)).left+n}function Mh(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Js(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Oj(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",a=Xt(r),l=t?Gs(t.floating):!1;if(r===a||l&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Kt(1);const d=Kt(0),f=Jt(r);if((f||!f&&!i)&&((Cr(r)!=="body"||uo(a))&&(c=Ks(r)),Jt(r))){const p=Dn(r);u=lr(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const h=a&&!f&&!i?Mh(a,c):Kt(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 Mj(e){return Array.from(e.getClientRects())}function Lj(e){const t=Xt(e),n=Ks(e),r=e.ownerDocument.body,o=vt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=vt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Js(e);const l=-n.scrollTop;return Dt(r).direction==="rtl"&&(a+=vt(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:a,y:l}}const ku=25;function Dj(e,t){const n=_t(e),r=Xt(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,c=0;if(o){i=o.width,a=o.height;const d=Dl();(!d||d&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}const u=Js(r);if(u<=0){const d=r.ownerDocument,f=d.body,h=getComputedStyle(f),p=d.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,y=Math.abs(r.clientWidth-f.clientWidth-p);y<=ku&&(i-=y)}else u<=ku&&(i+=u);return{width:i,height:a,x:l,y:c}}const Fj=new Set(["absolute","fixed"]);function $j(e,t){const n=Dn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Jt(e)?lr(e):Kt(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,c=o*i.x,u=r*i.y;return{width:a,height:l,x:c,y:u}}function _u(e,t,n){let r;if(t==="viewport")r=Dj(e,n);else if(t==="document")r=Lj(Xt(e));else if(Lt(t))r=$j(t,n);else{const o=Oh(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return gs(r)}function Lh(e,t){const n=_n(e);return n===t||!Lt(n)||xr(n)?!1:Dt(n).position==="fixed"||Lh(n,t)}function Bj(e,t){const n=t.get(e);if(n)return n;let r=no(e,[],!1).filter(l=>Lt(l)&&Cr(l)!=="body"),o=null;const i=Dt(e).position==="fixed";let a=i?_n(e):e;for(;Lt(a)&&!xr(a);){const l=Dt(a),c=Ll(a);!c&&l.position==="fixed"&&(o=null),(i?!c&&!o:!c&&l.position==="static"&&!!o&&Fj.has(o.position)||uo(a)&&!c&&Lh(e,a))?r=r.filter(d=>d!==a):o=l,a=_n(a)}return t.set(e,r),r}function Uj(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[...n==="clippingAncestors"?Gs(t)?[]:Bj(t,this._c):[].concat(n),r],l=a[0],c=a.reduce((u,d)=>{const f=_u(t,d,o);return u.top=vt(f.top,u.top),u.right=kn(f.right,u.right),u.bottom=kn(f.bottom,u.bottom),u.left=vt(f.left,u.left),u},_u(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Hj(e){const{width:t,height:n}=Ph(e);return{width:t,height:n}}function Wj(e,t,n){const r=Jt(t),o=Xt(t),i=n==="fixed",a=Dn(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=Kt(0);function u(){c.x=Js(o)}if(r||!r&&!i)if((Cr(t)!=="body"||uo(o))&&(l=Ks(t)),r){const p=Dn(t,!0,i,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else o&&u();i&&!r&&o&&u();const d=o&&!r&&!i?Mh(o,l):Kt(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 ji(e){return Dt(e).position==="static"}function Su(e,t){if(!Jt(e)||Dt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Xt(e)===n&&(n=n.ownerDocument.body),n}function Dh(e,t){const n=_t(e);if(Gs(e))return n;if(!Jt(e)){let o=_n(e);for(;o&&!xr(o);){if(Lt(o)&&!ji(o))return o;o=_n(o)}return n}let r=Su(e,t);for(;r&&jj(r)&&ji(r);)r=Su(r,t);return r&&xr(r)&&ji(r)&&!Ll(r)?n:r||Ij(e)||n}const Vj=async function(e){const t=this.getOffsetParent||Dh,n=this.getDimensions,r=await n(e.floating);return{reference:Wj(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function qj(e){return Dt(e).direction==="rtl"}const Zj={convertOffsetParentRelativeRectToViewportRelativeRect:Oj,getDocumentElement:Xt,getClippingRect:Uj,getOffsetParent:Dh,getElementRects:Vj,getClientRects:Mj,getDimensions:Hj,getScale:lr,isElement:Lt,isRTL:qj};function Fh(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Gj(e,t){let n=null,r;const o=Xt(e);function i(){var l;clearTimeout(r),(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:p}=u;if(l||t(),!h||!p)return;const y=Oo(f),m=Oo(o.clientWidth-(d+h)),x=Oo(o.clientHeight-(f+p)),b=Oo(d),w={rootMargin:-y+"px "+-m+"px "+-x+"px "+-b+"px",threshold:vt(0,kn(1,c))||1};let C=!0;function S(j){const N=j[0].intersectionRatio;if(N!==c){if(!C)return a();N?a(!1,N):r=setTimeout(()=>{a(!1,1e-7)},1e3)}N===1&&!Fh(u,e.getBoundingClientRect())&&a(),C=!1}try{n=new IntersectionObserver(S,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,w)}n.observe(e)}return a(!0),i}function Kj(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=Fl(e),d=o||i?[...u?no(u):[],...no(t)]:[];d.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const f=u&&l?Gj(u,n):null;let h=-1,p=null;a&&(p=new ResizeObserver(b=>{let[v]=b;v&&v.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),u&&!c&&p.observe(u),p.observe(t));let y,m=c?Dn(e):null;c&&x();function x(){const b=Dn(e);m&&!Fh(m,b)&&n(),m=b,y=requestAnimationFrame(x)}return n(),()=>{var b;d.forEach(v=>{o&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),f?.(),(b=p)==null||b.disconnect(),p=null,c&&cancelAnimationFrame(y)}}const Jj=vj,Yj=wj,Xj=xj,Qj=_j,e5=bj,Cu=gj,t5=kj,n5=(e,t,n)=>{const r=new Map,o={platform:Zj,...n},i={...o.platform,_c:r};return mj(e,t,{...o,platform:i})};var r5=typeof document<"u",o5=function(){},es=r5?g.useLayoutEffect:o5;function xs(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,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!xs(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!xs(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function $h(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ju(e,t){const n=$h(e);return Math.round(t*n)/n}function Ni(e){const t=g.useRef(e);return es(()=>{t.current=e}),t}function s5(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:a}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=g.useState(r);xs(h,r)||p(r);const[y,m]=g.useState(null),[x,b]=g.useState(null),v=g.useCallback(B=>{B!==j.current&&(j.current=B,m(B))},[]),w=g.useCallback(B=>{B!==N.current&&(N.current=B,b(B))},[]),C=i||y,S=a||x,j=g.useRef(null),N=g.useRef(null),A=g.useRef(d),z=c!=null,L=Ni(c),U=Ni(o),E=Ni(u),O=g.useCallback(()=>{if(!j.current||!N.current)return;const B={placement:t,strategy:n,middleware:h};U.current&&(B.platform=U.current),n5(j.current,N.current,B).then(J=>{const I={...J,isPositioned:E.current!==!1};k.current&&!xs(A.current,I)&&(A.current=I,ao.flushSync(()=>{f(I)}))})},[h,t,n,U,E]);es(()=>{u===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,f(B=>({...B,isPositioned:!1})))},[u]);const k=g.useRef(!1);es(()=>(k.current=!0,()=>{k.current=!1}),[]),es(()=>{if(C&&(j.current=C),S&&(N.current=S),C&&S){if(L.current)return L.current(C,S,O);O()}},[C,S,O,L,z]);const D=g.useMemo(()=>({reference:j,floating:N,setReference:v,setFloating:w}),[v,w]),q=g.useMemo(()=>({reference:C,floating:S}),[C,S]),W=g.useMemo(()=>{const B={position:n,left:0,top:0};if(!q.floating)return B;const J=ju(q.floating,d.x),I=ju(q.floating,d.y);return l?{...B,transform:"translate("+J+"px, "+I+"px)",...$h(q.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:J,top:I}},[n,l,q.floating,d.x,d.y]);return g.useMemo(()=>({...d,update:O,refs:D,elements:q,floatingStyles:W}),[d,O,D,q,W])}const i5=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Cu({element:r.current,padding:o}).fn(n):{}:r?Cu({element:r,padding:o}).fn(n):{}}}},a5=(e,t)=>({...Jj(e),options:[e,t]}),l5=(e,t)=>({...Yj(e),options:[e,t]}),c5=(e,t)=>({...t5(e),options:[e,t]}),u5=(e,t)=>({...Xj(e),options:[e,t]}),d5=(e,t)=>({...Qj(e),options:[e,t]}),f5=(e,t)=>({...e5(e),options:[e,t]}),p5=(e,t)=>({...i5(e),options:[e,t]});var h5="Arrow",Bh=g.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return s.jsx(ze.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});Bh.displayName=h5;var m5=Bh,$l="Popper",[Uh,Ys]=un($l),[g5,Hh]=Uh($l),Wh=e=>{const{__scopePopper:t,children:n}=e,[r,o]=g.useState(null);return s.jsx(g5,{scope:t,anchor:r,onAnchorChange:o,children:n})};Wh.displayName=$l;var Vh="PopperAnchor",qh=g.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=Hh(Vh,n),a=g.useRef(null),l=Fe(t,a),c=g.useRef(null);return g.useEffect(()=>{const u=c.current;c.current=r?.current||a.current,u!==c.current&&i.onAnchorChange(c.current)}),r?null:s.jsx(ze.div,{...o,ref:l})});qh.displayName=Vh;var Bl="PopperContent",[x5,b5]=Uh(Bl),Zh=g.forwardRef((e,t)=>{const{__scopePopper:n,side:r="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:p="optimized",onPlaced:y,...m}=e,x=Hh(Bl,n),[b,v]=g.useState(null),w=Fe(t,pe=>v(pe)),[C,S]=g.useState(null),j=nj(C),N=j?.width??0,A=j?.height??0,z=r+(i!=="center"?"-"+i:""),L=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},U=Array.isArray(u)?u:[u],E=U.length>0,O={padding:L,boundary:U.filter(v5),altBoundary:E},{refs:k,floatingStyles:D,placement:q,isPositioned:W,middlewareData:B}=s5({strategy:"fixed",placement:z,whileElementsMounted:(...pe)=>Kj(...pe,{animationFrame:p==="always"}),elements:{reference:x.anchor},middleware:[a5({mainAxis:o+A,alignmentAxis:a}),c&&l5({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?c5():void 0,...O}),c&&u5({...O}),d5({...O,apply:({elements:pe,rects:se,availableWidth:le,availableHeight:ce})=>{const{width:fe,height:be}=se.reference,Se=pe.floating.style;Se.setProperty("--radix-popper-available-width",`${le}px`),Se.setProperty("--radix-popper-available-height",`${ce}px`),Se.setProperty("--radix-popper-anchor-width",`${fe}px`),Se.setProperty("--radix-popper-anchor-height",`${be}px`)}}),C&&p5({element:C,padding:l}),w5({arrowWidth:N,arrowHeight:A}),h&&f5({strategy:"referenceHidden",...O})]}),[J,I]=Jh(q),K=ut(y);st(()=>{W&&K?.()},[W,K]);const Z=B.arrow?.x,R=B.arrow?.y,ae=B.arrow?.centerOffset!==0,[de,ke]=g.useState();return st(()=>{b&&ke(window.getComputedStyle(b).zIndex)},[b]),s.jsx("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:W?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:de,"--radix-popper-transform-origin":[B.transformOrigin?.x,B.transformOrigin?.y].join(" "),...B.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(x5,{scope:n,placedSide:J,onArrowChange:S,arrowX:Z,arrowY:R,shouldHideArrow:ae,children:s.jsx(ze.div,{"data-side":J,"data-align":I,...m,ref:w,style:{...m.style,animation:W?void 0:"none"}})})})});Zh.displayName=Bl;var Gh="PopperArrow",y5={top:"bottom",right:"left",bottom:"top",left:"right"},Kh=g.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=b5(Gh,r),a=y5[i.placedSide];return s.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:s.jsx(m5,{...o,ref:n,style:{...o.style,display:"block"}})})});Kh.displayName=Gh;function v5(e){return e!==null}var w5=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,a=o.arrow?.centerOffset!==0,l=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[u,d]=Jh(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(o.arrow?.x??0)+l/2,p=(o.arrow?.y??0)+c/2;let y="",m="";return u==="bottom"?(y=a?f:`${h}px`,m=`${-c}px`):u==="top"?(y=a?f:`${h}px`,m=`${r.floating.height+c}px`):u==="right"?(y=`${-c}px`,m=a?f:`${p}px`):u==="left"&&(y=`${r.floating.width+c}px`,m=a?f:`${p}px`),{data:{x:y,y:m}}}});function Jh(e){const[t,n="center"]=e.split("-");return[t,n]}var Yh=Wh,Xh=qh,Qh=Zh,em=Kh,Ei="rovingFocusGroup.onEntryFocus",k5={bubbles:!1,cancelable:!0},fo="RovingFocusGroup",[ya,tm,_5]=Jp(fo),[S5,nm]=un(fo,[_5]),[C5,j5]=S5(fo),rm=g.forwardRef((e,t)=>s.jsx(ya.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(ya.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(N5,{...e,ref:t})})}));rm.displayName=fo;var N5=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,h=g.useRef(null),p=Fe(t,h),y=Us(i),[m,x]=Mn({prop:a,defaultProp:l??null,onChange:c,caller:fo}),[b,v]=g.useState(!1),w=ut(u),C=tm(n),S=g.useRef(!1),[j,N]=g.useState(0);return g.useEffect(()=>{const A=h.current;if(A)return A.addEventListener(Ei,w),()=>A.removeEventListener(Ei,w)},[w]),s.jsx(C5,{scope:n,orientation:r,dir:y,loop:o,currentTabStopId:m,onItemFocus:g.useCallback(A=>x(A),[x]),onItemShiftTab:g.useCallback(()=>v(!0),[]),onFocusableItemAdd:g.useCallback(()=>N(A=>A+1),[]),onFocusableItemRemove:g.useCallback(()=>N(A=>A-1),[]),children:s.jsx(ze.div,{tabIndex:b||j===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:Ce(e.onMouseDown,()=>{S.current=!0}),onFocus:Ce(e.onFocus,A=>{const z=!S.current;if(A.target===A.currentTarget&&z&&!b){const L=new CustomEvent(Ei,k5);if(A.currentTarget.dispatchEvent(L),!L.defaultPrevented){const U=C().filter(q=>q.focusable),E=U.find(q=>q.active),O=U.find(q=>q.id===m),D=[E,O,...U].filter(Boolean).map(q=>q.ref.current);im(D,d)}}S.current=!1}),onBlur:Ce(e.onBlur,()=>v(!1))})})}),om="RovingFocusGroupItem",sm=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:a,...l}=e,c=Gt(),u=i||c,d=j5(om,n),f=d.currentTabStopId===u,h=tm(n),{onFocusableItemAdd:p,onFocusableItemRemove:y,currentTabStopId:m}=d;return g.useEffect(()=>{if(r)return p(),()=>y()},[r,p,y]),s.jsx(ya.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:s.jsx(ze.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:Ce(e.onMouseDown,x=>{r?d.onItemFocus(u):x.preventDefault()}),onFocus:Ce(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:Ce(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){d.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const b=A5(x,d.orientation,d.dir);if(b!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let w=h().filter(C=>C.focusable).map(C=>C.ref.current);if(b==="last")w.reverse();else if(b==="prev"||b==="next"){b==="prev"&&w.reverse();const C=w.indexOf(x.currentTarget);w=d.loop?I5(w,C+1):w.slice(C+1)}setTimeout(()=>im(w))}}),children:typeof a=="function"?a({isCurrentTabStop:f,hasTabStop:m!=null}):a})})});sm.displayName=om;var E5={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function T5(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function A5(e,t,n){const r=T5(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return E5[r]}function im(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function I5(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var z5=rm,R5=sm;function va(e,[t,n]){return Math.min(n,Math.max(t,e))}function P5(e,t){return g.useReducer((n,r)=>t[n][r]??n,e)}var Ul="ScrollArea",[am]=un(Ul),[O5,zt]=am(Ul),lm=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:i=600,...a}=e,[l,c]=g.useState(null),[u,d]=g.useState(null),[f,h]=g.useState(null),[p,y]=g.useState(null),[m,x]=g.useState(null),[b,v]=g.useState(0),[w,C]=g.useState(0),[S,j]=g.useState(!1),[N,A]=g.useState(!1),z=Fe(t,U=>c(U)),L=Us(o);return s.jsx(O5,{scope:n,type:r,dir:L,scrollHideDelay:i,scrollArea:l,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:y,scrollbarXEnabled:S,onScrollbarXEnabledChange:j,scrollbarY:m,onScrollbarYChange:x,scrollbarYEnabled:N,onScrollbarYEnabledChange:A,onCornerWidthChange:v,onCornerHeightChange:C,children:s.jsx(ze.div,{dir:L,...a,ref:z,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});lm.displayName=Ul;var cm="ScrollAreaViewport",um=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...i}=e,a=zt(cm,n),l=g.useRef(null),c=Fe(t,l,a.onViewportChange);return s.jsxs(s.Fragment,{children:[s.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}),s.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:s.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});um.displayName=cm;var Qt="ScrollAreaScrollbar",dm=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=zt(Qt,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=o,l=e.orientation==="horizontal";return g.useEffect(()=>(l?i(!0):a(!0),()=>{l?i(!1):a(!1)}),[l,i,a]),o.type==="hover"?s.jsx(M5,{...r,ref:t,forceMount:n}):o.type==="scroll"?s.jsx(L5,{...r,ref:t,forceMount:n}):o.type==="auto"?s.jsx(fm,{...r,ref:t,forceMount:n}):o.type==="always"?s.jsx(Hl,{...r,ref:t}):null});dm.displayName=Qt;var M5=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=zt(Qt,e.__scopeScrollArea),[i,a]=g.useState(!1);return g.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]),s.jsx(It,{present:n||i,children:s.jsx(fm,{"data-state":i?"visible":"hidden",...r,ref:t})})}),L5=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=zt(Qt,e.__scopeScrollArea),i=e.orientation==="horizontal",a=Qs(()=>c("SCROLL_END"),100),[l,c]=P5("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 g.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,o.scrollHideDelay,c]),g.useEffect(()=>{const u=o.viewport,d=i?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const p=u[d];f!==p&&(c("SCROLL"),a()),f=p};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[o.viewport,i,c,a]),s.jsx(It,{present:n||l!=="hidden",children:s.jsx(Hl,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Ce(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Ce(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),fm=g.forwardRef((e,t)=>{const n=zt(Qt,e.__scopeScrollArea),{forceMount:r,...o}=e,[i,a]=g.useState(!1),l=e.orientation==="horizontal",c=Qs(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;a(l?u:d)}},10);return br(n.viewport,c),br(n.content,c),s.jsx(It,{present:r||i,children:s.jsx(Hl,{"data-state":i?"visible":"hidden",...o,ref:t})})}),Hl=g.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=zt(Qt,e.__scopeScrollArea),i=g.useRef(null),a=g.useRef(0),[l,c]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=xm(l.viewport,l.content),d={...r,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,p){return H5(h,a.current,l,p)}return n==="horizontal"?s.jsx(D5,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const h=o.viewport.scrollLeft,p=Nu(h,l,o.dir);i.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:h=>{o.viewport&&(o.viewport.scrollLeft=h)},onDragScroll:h=>{o.viewport&&(o.viewport.scrollLeft=f(h,o.dir))}}):n==="vertical"?s.jsx(F5,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const h=o.viewport.scrollTop,p=Nu(h,l);i.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:h=>{o.viewport&&(o.viewport.scrollTop=h)},onDragScroll:h=>{o.viewport&&(o.viewport.scrollTop=f(h))}}):null}),D5=g.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=zt(Qt,e.__scopeScrollArea),[a,l]=g.useState(),c=g.useRef(null),u=Fe(t,c,i.onScrollbarXChange);return g.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),s.jsx(hm,{"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":Xs(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),ym(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:ys(a.paddingLeft),paddingEnd:ys(a.paddingRight)}})}})}),F5=g.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=zt(Qt,e.__scopeScrollArea),[a,l]=g.useState(),c=g.useRef(null),u=Fe(t,c,i.onScrollbarYChange);return g.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),s.jsx(hm,{"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":Xs(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),ym(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:ys(a.paddingTop),paddingEnd:ys(a.paddingBottom)}})}})}),[$5,pm]=am(Qt),hm=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...h}=e,p=zt(Qt,n),[y,m]=g.useState(null),x=Fe(t,z=>m(z)),b=g.useRef(null),v=g.useRef(""),w=p.viewport,C=r.content-r.viewport,S=ut(d),j=ut(c),N=Qs(f,10);function A(z){if(b.current){const L=z.clientX-b.current.left,U=z.clientY-b.current.top;u({x:L,y:U})}}return g.useEffect(()=>{const z=L=>{const U=L.target;y?.contains(U)&&S(L,C)};return document.addEventListener("wheel",z,{passive:!1}),()=>document.removeEventListener("wheel",z,{passive:!1})},[w,y,C,S]),g.useEffect(j,[r,j]),br(y,N),br(p.content,N),s.jsx($5,{scope:n,scrollbar:y,hasThumb:o,onThumbChange:ut(i),onThumbPointerUp:ut(a),onThumbPositionChange:j,onThumbPointerDown:ut(l),children:s.jsx(ze.div,{...h,ref:x,style:{position:"absolute",...h.style},onPointerDown:Ce(e.onPointerDown,z=>{z.button===0&&(z.target.setPointerCapture(z.pointerId),b.current=y.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),A(z))}),onPointerMove:Ce(e.onPointerMove,A),onPointerUp:Ce(e.onPointerUp,z=>{const L=z.target;L.hasPointerCapture(z.pointerId)&&L.releasePointerCapture(z.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=""),b.current=null})})})}),bs="ScrollAreaThumb",mm=g.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=pm(bs,e.__scopeScrollArea);return s.jsx(It,{present:n||o.hasThumb,children:s.jsx(B5,{ref:t,...r})})}),B5=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,i=zt(bs,n),a=pm(bs,n),{onThumbPositionChange:l}=a,c=Fe(t,f=>a.onThumbChange(f)),u=g.useRef(void 0),d=Qs(()=>{u.current&&(u.current(),u.current=void 0)},100);return g.useEffect(()=>{const f=i.viewport;if(f){const h=()=>{if(d(),!u.current){const p=W5(f,l);u.current=p,l()}};return l(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[i.viewport,d,l]),s.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)",...r},onPointerDownCapture:Ce(e.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),y=f.clientX-p.left,m=f.clientY-p.top;a.onThumbPointerDown({x:y,y:m})}),onPointerUp:Ce(e.onPointerUp,a.onThumbPointerUp)})});mm.displayName=bs;var Wl="ScrollAreaCorner",gm=g.forwardRef((e,t)=>{const n=zt(Wl,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?s.jsx(U5,{...e,ref:t}):null});gm.displayName=Wl;var U5=g.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=zt(Wl,n),[i,a]=g.useState(0),[l,c]=g.useState(0),u=!!(i&&l);return br(o.scrollbarX,()=>{const d=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(d),c(d)}),br(o.scrollbarY,()=>{const d=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(d),a(d)}),u?s.jsx(ze.div,{...r,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 ys(e){return e?parseInt(e,10):0}function xm(e,t){const n=e/t;return isNaN(n)?0:n}function Xs(e){const t=xm(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function H5(e,t,n,r="ltr"){const o=Xs(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=r==="ltr"?[0,d]:[d*-1,0];return bm([c,u],f)(e)}function Nu(e,t,n="ltr"){const r=Xs(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-o,a=t.content-t.viewport,l=i-r,c=n==="ltr"?[0,a]:[a*-1,0],u=va(e,c);return bm([0,a],[0,l])(u)}function bm(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function ym(e,t){return e>0&&e<t}var W5=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=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,r=window.requestAnimationFrame(o)})(),()=>window.cancelAnimationFrame(r)};function Qs(e,t){const n=ut(e),r=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),g.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function br(e,t){const n=ut(t);st(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}var V5=lm,q5=um,Z5=gm,G5=[" ","Enter","ArrowUp","ArrowDown"],K5=[" ","Enter"],Fn="Select",[ei,ti,J5]=Jp(Fn),[jr]=un(Fn,[J5,Ys]),ni=Ys(),[Y5,jn]=jr(Fn),[X5,Q5]=jr(Fn),vm=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:i,value:a,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:h,required:p,form:y}=e,m=ni(t),[x,b]=g.useState(null),[v,w]=g.useState(null),[C,S]=g.useState(!1),j=Us(u),[N,A]=Mn({prop:r,defaultProp:o??!1,onChange:i,caller:Fn}),[z,L]=Mn({prop:a,defaultProp:l,onChange:c,caller:Fn}),U=g.useRef(null),E=x?y||!!x.closest("form"):!0,[O,k]=g.useState(new Set),D=Array.from(O).map(q=>q.props.value).join(";");return s.jsx(Yh,{...m,children:s.jsxs(Y5,{required:p,scope:t,trigger:x,onTriggerChange:b,valueNode:v,onValueNodeChange:w,valueNodeHasChildren:C,onValueNodeHasChildrenChange:S,contentId:Gt(),value:z,onValueChange:L,open:N,onOpenChange:A,dir:j,triggerPointerDownPosRef:U,disabled:h,children:[s.jsx(ei.Provider,{scope:t,children:s.jsx(X5,{scope:e.__scopeSelect,onNativeOptionAdd:g.useCallback(q=>{k(W=>new Set(W).add(q))},[]),onNativeOptionRemove:g.useCallback(q=>{k(W=>{const B=new Set(W);return B.delete(q),B})},[]),children:n})}),E?s.jsxs(Um,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:f,value:z,onChange:q=>L(q.target.value),disabled:h,form:y,children:[z===void 0?s.jsx("option",{value:""}):null,Array.from(O)]},D):null]})})};vm.displayName=Fn;var wm="SelectTrigger",km=g.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=ni(n),a=jn(wm,n),l=a.disabled||r,c=Fe(t,a.onTriggerChange),u=ti(n),d=g.useRef("touch"),[f,h,p]=Wm(m=>{const x=u().filter(w=>!w.disabled),b=x.find(w=>w.value===a.value),v=Vm(x,m,b);v!==void 0&&a.onValueChange(v.value)}),y=m=>{l||(a.onOpenChange(!0),p()),m&&(a.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return s.jsx(Xh,{asChild:!0,...i,children:s.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":Hm(a.value)?"":void 0,...o,ref:c,onClick:Ce(o.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&y(m)}),onPointerDown:Ce(o.onPointerDown,m=>{d.current=m.pointerType;const x=m.target;x.hasPointerCapture(m.pointerId)&&x.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(y(m),m.preventDefault())}),onKeyDown:Ce(o.onKeyDown,m=>{const x=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&h(m.key),!(x&&m.key===" ")&&G5.includes(m.key)&&(y(),m.preventDefault())})})})});km.displayName=wm;var _m="SelectValue",Sm=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:a="",...l}=e,c=jn(_m,n),{onValueNodeHasChildrenChange:u}=c,d=i!==void 0,f=Fe(t,c.onValueNodeChange);return st(()=>{u(d)},[u,d]),s.jsx(ze.span,{...l,ref:f,style:{pointerEvents:"none"},children:Hm(c.value)?s.jsx(s.Fragment,{children:a}):i})});Sm.displayName=_m;var eN="SelectIcon",Cm=g.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return s.jsx(ze.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});Cm.displayName=eN;var tN="SelectPortal",jm=e=>s.jsx(Ws,{asChild:!0,...e});jm.displayName=tN;var $n="SelectContent",Nm=g.forwardRef((e,t)=>{const n=jn($n,e.__scopeSelect),[r,o]=g.useState();if(st(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?ao.createPortal(s.jsx(Em,{scope:e.__scopeSelect,children:s.jsx(ei.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),i):null}return s.jsx(Tm,{...e,ref:t})});Nm.displayName=$n;var Ot=10,[Em,Nn]=jr($n),nN="SelectContentImpl",rN=gr("SelectContent.RemoveScroll"),Tm=g.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:a,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:y,hideWhenDetached:m,avoidCollisions:x,...b}=e,v=jn($n,n),[w,C]=g.useState(null),[S,j]=g.useState(null),N=Fe(t,pe=>C(pe)),[A,z]=g.useState(null),[L,U]=g.useState(null),E=ti(n),[O,k]=g.useState(!1),D=g.useRef(!1);g.useEffect(()=>{if(w)return ph(w)},[w]),oh();const q=g.useCallback(pe=>{const[se,...le]=E().map(be=>be.ref.current),[ce]=le.slice(-1),fe=document.activeElement;for(const be of pe)if(be===fe||(be?.scrollIntoView({block:"nearest"}),be===se&&S&&(S.scrollTop=0),be===ce&&S&&(S.scrollTop=S.scrollHeight),be?.focus(),document.activeElement!==fe))return},[E,S]),W=g.useCallback(()=>q([A,w]),[q,A,w]);g.useEffect(()=>{O&&W()},[O,W]);const{onOpenChange:B,triggerPointerDownPosRef:J}=v;g.useEffect(()=>{if(w){let pe={x:0,y:0};const se=ce=>{pe={x:Math.abs(Math.round(ce.pageX)-(J.current?.x??0)),y:Math.abs(Math.round(ce.pageY)-(J.current?.y??0))}},le=ce=>{pe.x<=10&&pe.y<=10?ce.preventDefault():w.contains(ce.target)||B(!1),document.removeEventListener("pointermove",se),J.current=null};return J.current!==null&&(document.addEventListener("pointermove",se),document.addEventListener("pointerup",le,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",se),document.removeEventListener("pointerup",le,{capture:!0})}}},[w,B,J]),g.useEffect(()=>{const pe=()=>B(!1);return window.addEventListener("blur",pe),window.addEventListener("resize",pe),()=>{window.removeEventListener("blur",pe),window.removeEventListener("resize",pe)}},[B]);const[I,K]=Wm(pe=>{const se=E().filter(fe=>!fe.disabled),le=se.find(fe=>fe.ref.current===document.activeElement),ce=Vm(se,pe,le);ce&&setTimeout(()=>ce.ref.current.focus())}),Z=g.useCallback((pe,se,le)=>{const ce=!D.current&&!le;(v.value!==void 0&&v.value===se||ce)&&(z(pe),ce&&(D.current=!0))},[v.value]),R=g.useCallback(()=>w?.focus(),[w]),ae=g.useCallback((pe,se,le)=>{const ce=!D.current&&!le;(v.value!==void 0&&v.value===se||ce)&&U(pe)},[v.value]),de=r==="popper"?wa:Am,ke=de===wa?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:y,hideWhenDetached:m,avoidCollisions:x}:{};return s.jsx(Em,{scope:n,content:w,viewport:S,onViewportChange:j,itemRefCallback:Z,selectedItem:A,onItemLeave:R,itemTextRefCallback:ae,focusSelectedItem:W,selectedItemText:L,position:r,isPositioned:O,searchRef:I,children:s.jsx(Al,{as:rN,allowPinchZoom:!0,children:s.jsx(Tl,{asChild:!0,trapped:v.open,onMountAutoFocus:pe=>{pe.preventDefault()},onUnmountAutoFocus:Ce(o,pe=>{v.trigger?.focus({preventScroll:!0}),pe.preventDefault()}),children:s.jsx(Hs,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:pe=>pe.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:s.jsx(de,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:pe=>pe.preventDefault(),...b,...ke,onPlaced:()=>k(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Ce(b.onKeyDown,pe=>{const se=pe.ctrlKey||pe.altKey||pe.metaKey;if(pe.key==="Tab"&&pe.preventDefault(),!se&&pe.key.length===1&&K(pe.key),["ArrowUp","ArrowDown","Home","End"].includes(pe.key)){let ce=E().filter(fe=>!fe.disabled).map(fe=>fe.ref.current);if(["ArrowUp","End"].includes(pe.key)&&(ce=ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(pe.key)){const fe=pe.target,be=ce.indexOf(fe);ce=ce.slice(be+1)}setTimeout(()=>q(ce)),pe.preventDefault()}})})})})})})});Tm.displayName=nN;var oN="SelectItemAlignedPosition",Am=g.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=jn($n,n),a=Nn($n,n),[l,c]=g.useState(null),[u,d]=g.useState(null),f=Fe(t,N=>d(N)),h=ti(n),p=g.useRef(!1),y=g.useRef(!0),{viewport:m,selectedItem:x,selectedItemText:b,focusSelectedItem:v}=a,w=g.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&m&&x&&b){const N=i.trigger.getBoundingClientRect(),A=u.getBoundingClientRect(),z=i.valueNode.getBoundingClientRect(),L=b.getBoundingClientRect();if(i.dir!=="rtl"){const fe=L.left-A.left,be=z.left-fe,Se=N.left-be,_=N.width+Se,ne=Math.max(_,A.width),Q=window.innerWidth-Ot,M=va(be,[Ot,Math.max(Ot,Q-ne)]);l.style.minWidth=_+"px",l.style.left=M+"px"}else{const fe=A.right-L.right,be=window.innerWidth-z.right-fe,Se=window.innerWidth-N.right-be,_=N.width+Se,ne=Math.max(_,A.width),Q=window.innerWidth-Ot,M=va(be,[Ot,Math.max(Ot,Q-ne)]);l.style.minWidth=_+"px",l.style.right=M+"px"}const U=h(),E=window.innerHeight-Ot*2,O=m.scrollHeight,k=window.getComputedStyle(u),D=parseInt(k.borderTopWidth,10),q=parseInt(k.paddingTop,10),W=parseInt(k.borderBottomWidth,10),B=parseInt(k.paddingBottom,10),J=D+q+O+B+W,I=Math.min(x.offsetHeight*5,J),K=window.getComputedStyle(m),Z=parseInt(K.paddingTop,10),R=parseInt(K.paddingBottom,10),ae=N.top+N.height/2-Ot,de=E-ae,ke=x.offsetHeight/2,pe=x.offsetTop+ke,se=D+q+pe,le=J-se;if(se<=ae){const fe=U.length>0&&x===U[U.length-1].ref.current;l.style.bottom="0px";const be=u.clientHeight-m.offsetTop-m.offsetHeight,Se=Math.max(de,ke+(fe?R:0)+be+W),_=se+Se;l.style.height=_+"px"}else{const fe=U.length>0&&x===U[0].ref.current;l.style.top="0px";const Se=Math.max(ae,D+m.offsetTop+(fe?Z:0)+ke)+le;l.style.height=Se+"px",m.scrollTop=se-ae+m.offsetTop}l.style.margin=`${Ot}px 0`,l.style.minHeight=I+"px",l.style.maxHeight=E+"px",r?.(),requestAnimationFrame(()=>p.current=!0)}},[h,i.trigger,i.valueNode,l,u,m,x,b,i.dir,r]);st(()=>w(),[w]);const[C,S]=g.useState();st(()=>{u&&S(window.getComputedStyle(u).zIndex)},[u]);const j=g.useCallback(N=>{N&&y.current===!0&&(w(),v?.(),y.current=!1)},[w,v]);return s.jsx(iN,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:j,children:s.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:s.jsx(ze.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Am.displayName=oN;var sN="SelectPopperPosition",wa=g.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Ot,...i}=e,a=ni(n);return s.jsx(Qh,{...a,...i,ref:t,align:r,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)"}})});wa.displayName=sN;var[iN,Vl]=jr($n,{}),ka="SelectViewport",Im=g.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,i=Nn(ka,n),a=Vl(ka,n),l=Fe(t,i.onViewportChange),c=g.useRef(0);return s.jsxs(s.Fragment,{children:[s.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:r}),s.jsx(ei.Slot,{scope:n,children:s.jsx(ze.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Ce(o.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=a;if(h?.current&&f){const p=Math.abs(c.current-d.scrollTop);if(p>0){const y=window.innerHeight-Ot*2,m=parseFloat(f.style.minHeight),x=parseFloat(f.style.height),b=Math.max(m,x);if(b<y){const v=b+p,w=Math.min(y,v),C=v-w;f.style.height=w+"px",f.style.bottom==="0px"&&(d.scrollTop=C>0?C:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});Im.displayName=ka;var zm="SelectGroup",[aN,lN]=jr(zm),cN=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Gt();return s.jsx(aN,{scope:n,id:o,children:s.jsx(ze.div,{role:"group","aria-labelledby":o,...r,ref:t})})});cN.displayName=zm;var Rm="SelectLabel",uN=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=lN(Rm,n);return s.jsx(ze.div,{id:o.id,...r,ref:t})});uN.displayName=Rm;var vs="SelectItem",[dN,Pm]=jr(vs),Om=g.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...a}=e,l=jn(vs,n),c=Nn(vs,n),u=l.value===r,[d,f]=g.useState(i??""),[h,p]=g.useState(!1),y=Fe(t,v=>c.itemRefCallback?.(v,r,o)),m=Gt(),x=g.useRef("touch"),b=()=>{o||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")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 s.jsx(dN,{scope:n,value:r,disabled:o,textId:m,isSelected:u,onItemTextChange:g.useCallback(v=>{f(w=>w||(v?.textContent??"").trim())},[]),children:s.jsx(ei.ItemSlot,{scope:n,value:r,disabled:o,textValue:d,children:s.jsx(ze.div,{role:"option","aria-labelledby":m,"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:y,onFocus:Ce(a.onFocus,()=>p(!0)),onBlur:Ce(a.onBlur,()=>p(!1)),onClick:Ce(a.onClick,()=>{x.current!=="mouse"&&b()}),onPointerUp:Ce(a.onPointerUp,()=>{x.current==="mouse"&&b()}),onPointerDown:Ce(a.onPointerDown,v=>{x.current=v.pointerType}),onPointerMove:Ce(a.onPointerMove,v=>{x.current=v.pointerType,o?c.onItemLeave?.():x.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ce(a.onPointerLeave,v=>{v.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:Ce(a.onKeyDown,v=>{c.searchRef?.current!==""&&v.key===" "||(K5.includes(v.key)&&b(),v.key===" "&&v.preventDefault())})})})})});Om.displayName=vs;var Hr="SelectItemText",Mm=g.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,a=jn(Hr,n),l=Nn(Hr,n),c=Pm(Hr,n),u=Q5(Hr,n),[d,f]=g.useState(null),h=Fe(t,b=>f(b),c.onItemTextChange,b=>l.itemTextRefCallback?.(b,c.value,c.disabled)),p=d?.textContent,y=g.useMemo(()=>s.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:x}=u;return st(()=>(m(y),()=>x(y)),[m,x,y]),s.jsxs(s.Fragment,{children:[s.jsx(ze.span,{id:c.textId,...i,ref:h}),c.isSelected&&a.valueNode&&!a.valueNodeHasChildren?ao.createPortal(i.children,a.valueNode):null]})});Mm.displayName=Hr;var Lm="SelectItemIndicator",Dm=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Pm(Lm,n).isSelected?s.jsx(ze.span,{"aria-hidden":!0,...r,ref:t}):null});Dm.displayName=Lm;var _a="SelectScrollUpButton",Fm=g.forwardRef((e,t)=>{const n=Nn(_a,e.__scopeSelect),r=Vl(_a,e.__scopeSelect),[o,i]=g.useState(!1),a=Fe(t,r.onScrollButtonChange);return st(()=>{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?s.jsx(Bm,{...e,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Fm.displayName=_a;var Sa="SelectScrollDownButton",$m=g.forwardRef((e,t)=>{const n=Nn(Sa,e.__scopeSelect),r=Vl(Sa,e.__scopeSelect),[o,i]=g.useState(!1),a=Fe(t,r.onScrollButtonChange);return st(()=>{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?s.jsx(Bm,{...e,ref:a,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});$m.displayName=Sa;var Bm=g.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,i=Nn("SelectScrollButton",n),a=g.useRef(null),l=ti(n),c=g.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return g.useEffect(()=>()=>c(),[c]),st(()=>{l().find(d=>d.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),s.jsx(ze.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:Ce(o.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(r,50))}),onPointerMove:Ce(o.onPointerMove,()=>{i.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(r,50))}),onPointerLeave:Ce(o.onPointerLeave,()=>{c()})})}),fN="SelectSeparator",pN=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return s.jsx(ze.div,{"aria-hidden":!0,...r,ref:t})});pN.displayName=fN;var Ca="SelectArrow",hN=g.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=ni(n),i=jn(Ca,n),a=Nn(Ca,n);return i.open&&a.position==="popper"?s.jsx(em,{...o,...r,ref:t}):null});hN.displayName=Ca;var mN="SelectBubbleInput",Um=g.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=g.useRef(null),i=Fe(r,o),a=tj(t);return g.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]),s.jsx(ze.select,{...n,style:{...Gp,...n.style},ref:i,defaultValue:t})});Um.displayName=mN;function Hm(e){return e===""||e===void 0}function Wm(e){const t=ut(e),n=g.useRef(""),r=g.useRef(0),o=g.useCallback(a=>{const l=n.current+a;t(l),(function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(l)},[t]),i=g.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}function Vm(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=gN(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 gN(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var xN=vm,bN=km,yN=Sm,vN=Cm,wN=jm,kN=Nm,_N=Im,SN=Om,CN=Mm,jN=Dm,NN=Fm,EN=$m,ri="Tabs",[TN]=un(ri,[nm]),qm=nm(),[AN,ql]=TN(ri),Zm=g.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:a="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=Us(l),[f,h]=Mn({prop:r,onChange:o,defaultProp:i??"",caller:ri});return s.jsx(AN,{scope:n,baseId:Gt(),value:f,onValueChange:h,orientation:a,dir:d,activationMode:c,children:s.jsx(ze.div,{dir:d,"data-orientation":a,...u,ref:t})})});Zm.displayName=ri;var Gm="TabsList",Km=g.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=ql(Gm,n),a=qm(n);return s.jsx(z5,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:r,children:s.jsx(ze.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});Km.displayName=Gm;var Jm="TabsTrigger",Ym=g.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,a=ql(Jm,n),l=qm(n),c=eg(a.baseId,r),u=tg(a.baseId,r),d=r===a.value;return s.jsx(R5,{asChild:!0,...l,focusable:!o,active:d,children:s.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:Ce(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?a.onValueChange(r):f.preventDefault()}),onKeyDown:Ce(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&a.onValueChange(r)}),onFocus:Ce(e.onFocus,()=>{const f=a.activationMode!=="manual";!d&&!o&&f&&a.onValueChange(r)})})})});Ym.displayName=Jm;var Xm="TabsContent",Qm=g.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...a}=e,l=ql(Xm,n),c=eg(l.baseId,r),u=tg(l.baseId,r),d=r===l.value,f=g.useRef(d);return g.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),s.jsx(It,{present:o||d,children:({present:h})=>s.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})})});Qm.displayName=Xm;function eg(e,t){return`${e}-trigger-${t}`}function tg(e,t){return`${e}-content-${t}`}var IN=Zm,zN=Km,RN=Ym,PN=Qm,[oi]=un("Tooltip",[Ys]),si=Ys(),ng="TooltipProvider",ON=700,ja="tooltip.open",[MN,Zl]=oi(ng),rg=e=>{const{__scopeTooltip:t,delayDuration:n=ON,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,a=g.useRef(!0),l=g.useRef(!1),c=g.useRef(0);return g.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),s.jsx(MN,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:g.useCallback(()=>{window.clearTimeout(c.current),a.current=!1},[]),onClose:g.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:g.useCallback(u=>{l.current=u},[]),disableHoverableContent:o,children:i})};rg.displayName=ng;var ro="Tooltip",[LN,po]=oi(ro),og=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:i,disableHoverableContent:a,delayDuration:l}=e,c=Zl(ro,e.__scopeTooltip),u=si(t),[d,f]=g.useState(null),h=Gt(),p=g.useRef(0),y=a??c.disableHoverableContent,m=l??c.delayDuration,x=g.useRef(!1),[b,v]=Mn({prop:r,defaultProp:o??!1,onChange:N=>{N?(c.onOpen(),document.dispatchEvent(new CustomEvent(ja))):c.onClose(),i?.(N)},caller:ro}),w=g.useMemo(()=>b?x.current?"delayed-open":"instant-open":"closed",[b]),C=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,x.current=!1,v(!0)},[v]),S=g.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),j=g.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{x.current=!0,v(!0),p.current=0},m)},[m,v]);return g.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),s.jsx(Yh,{...u,children:s.jsx(LN,{scope:t,contentId:h,open:b,stateAttribute:w,trigger:d,onTriggerChange:f,onTriggerEnter:g.useCallback(()=>{c.isOpenDelayedRef.current?j():C()},[c.isOpenDelayedRef,j,C]),onTriggerLeave:g.useCallback(()=>{y?S():(window.clearTimeout(p.current),p.current=0)},[S,y]),onOpen:C,onClose:S,disableHoverableContent:y,children:n})})};og.displayName=ro;var Na="TooltipTrigger",sg=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=po(Na,n),i=Zl(Na,n),a=si(n),l=g.useRef(null),c=Fe(t,l,o.onTriggerChange),u=g.useRef(!1),d=g.useRef(!1),f=g.useCallback(()=>u.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),s.jsx(Xh,{asChild:!0,...a,children:s.jsx(ze.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:c,onPointerMove:Ce(e.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:Ce(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:Ce(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Ce(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:Ce(e.onBlur,o.onClose),onClick:Ce(e.onClick,o.onClose)})})});sg.displayName=Na;var Gl="TooltipPortal",[DN,FN]=oi(Gl,{forceMount:void 0}),ig=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,i=po(Gl,t);return s.jsx(DN,{scope:t,forceMount:n,children:s.jsx(It,{present:n||i.open,children:s.jsx(Ws,{asChild:!0,container:o,children:r})})})};ig.displayName=Gl;var yr="TooltipContent",ag=g.forwardRef((e,t)=>{const n=FN(yr,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,a=po(yr,e.__scopeTooltip);return s.jsx(It,{present:r||a.open,children:a.disableHoverableContent?s.jsx(lg,{side:o,...i,ref:t}):s.jsx($N,{side:o,...i,ref:t})})}),$N=g.forwardRef((e,t)=>{const n=po(yr,e.__scopeTooltip),r=Zl(yr,e.__scopeTooltip),o=g.useRef(null),i=Fe(t,o),[a,l]=g.useState(null),{trigger:c,onClose:u}=n,d=o.current,{onPointerInTransitChange:f}=r,h=g.useCallback(()=>{l(null),f(!1)},[f]),p=g.useCallback((y,m)=>{const x=y.currentTarget,b={x:y.clientX,y:y.clientY},v=WN(b,x.getBoundingClientRect()),w=VN(b,v),C=qN(m.getBoundingClientRect()),S=GN([...w,...C]);l(S),f(!0)},[f]);return g.useEffect(()=>()=>h(),[h]),g.useEffect(()=>{if(c&&d){const y=x=>p(x,d),m=x=>p(x,c);return c.addEventListener("pointerleave",y),d.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",y),d.removeEventListener("pointerleave",m)}}},[c,d,p,h]),g.useEffect(()=>{if(a){const y=m=>{const x=m.target,b={x:m.clientX,y:m.clientY},v=c?.contains(x)||d?.contains(x),w=!ZN(b,a);v?h():w&&(h(),u())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,d,a,u,h]),s.jsx(lg,{...e,ref:i})}),[BN,UN]=oi(ro,{isInside:!1}),HN=hS("TooltipContent"),lg=g.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:a,...l}=e,c=po(yr,n),u=si(n),{onClose:d}=c;return g.useEffect(()=>(document.addEventListener(ja,d),()=>document.removeEventListener(ja,d)),[d]),g.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]),s.jsx(Hs,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:s.jsxs(Qh,{"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:[s.jsx(HN,{children:r}),s.jsx(BN,{scope:n,isInside:!0,children:s.jsx(wS,{id:c.contentId,role:"tooltip",children:o||r})})]})})});ag.displayName=yr;var cg="TooltipArrow",ug=g.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=si(n);return UN(cg,n).isInside?null:s.jsx(em,{...o,...r,ref:t})});ug.displayName=cg;function WN(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function VN(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function qN(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function ZN(e,t){const{x:n,y:r}=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>r!=h>r&&n<(f-u)*(r-d)/(h-d)+u&&(o=!o)}return o}function GN(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),KN(t)}function KN(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];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 r=e.length-1;r>=0;r--){const o=e[r];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 JN=rg,YN=og,XN=sg,QN=ig,eE=ag,tE=ug;const nE=Cl("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 He({className:e,variant:t="default",asChild:n=!1,...r}){const o=n?fS:"span";return s.jsx(o,{"data-slot":"badge","data-variant":t,className:me(nE({variant:t}),e),...r})}function ho({...e}){return s.jsx(ZC,{"data-slot":"dialog",...e})}function Kl({...e}){return s.jsx(GC,{"data-slot":"dialog-trigger",...e})}function rE({...e}){return s.jsx(KC,{"data-slot":"dialog-portal",...e})}function oE({className:e,...t}){return s.jsx(JC,{"data-slot":"dialog-overlay",className:me("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 mo({className:e,children:t,...n}){return s.jsxs(rE,{children:[s.jsx(oE,{}),s.jsxs(YC,{"data-slot":"dialog-content",className:me("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,s.jsxs(ej,{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:[s.jsx(kl,{className:"size-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function go({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-header",className:me("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function xo({className:e,...t}){return s.jsx(XC,{"data-slot":"dialog-title",className:me("text-lg font-semibold leading-none tracking-tight",e),...t})}function sE({className:e,...t}){return s.jsx(QC,{"data-slot":"dialog-description",className:me("text-sm text-muted-foreground",e),...t})}const iE=Cl("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 Ne({className:e,variant:t,size:n,...r}){return s.jsx("button",{"data-slot":"button",className:me(iE({variant:t,size:n,className:e})),...r})}function dg({open:e,onOpenChange:t,title:n,description:r,confirmLabel:o="Confirm",variant:i="default",onConfirm:a}){return s.jsx(ho,{open:e,onOpenChange:t,children:s.jsxs(mo,{children:[s.jsx(go,{children:s.jsx(xo,{children:n})}),s.jsx("p",{className:"text-sm text-muted-foreground",children:r}),s.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[s.jsx(Ne,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Cancel"}),s.jsx(Ne,{variant:i,size:"sm",onClick:()=>{a(),t(!1)},children:o})]})]})})}const aE="/v1/chat/completions",lE="/chat/completions",cE="/v1/messages";class uE{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]??"",r=this.pathMap.get(n);return r===void 0?void 0:this.handlers.get(r)}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 Nr=new uE;function dE(e){return Nr.getApiFormatByPath(e)??"unknown"}Nr.registerPath(cE,"anthropic");Nr.registerPath(aE,"openai");Nr.registerPath(lE,"openai");function fE(e){if(e==="")return{};try{const t=JSON.parse(e);return t!==null&&typeof t=="object"&&!Array.isArray(t)?{...t}:{}}catch{return{}}}function pE(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:fE(e.inputJson)}}}function fg(e,t,n,r){const o=new Map;let i="",a="",l=null,c=null,u=0,d=0;const f=1e3;let h=0,p=0;const y=[];for(const x of e.split(`
86
+ `)){const b=x.trim();if(b.startsWith("data: "))try{const v=JSON.parse(b.slice(6)),w=h2.safeParse(v);if(!w.success)continue;const C=w.data;switch(h===0&&(p=Date.now()),r===!0&&y.length<f&&y.push({index:h,timestamp:Date.now()-p,type:C.type,data:C}),h++,C.type){case"message_start":i=C.message.id,a=C.message.model,u=C.message.usage.input_tokens,t.inputTokens=u,t.cacheCreationInputTokens=C.message.usage.cache_creation_input_tokens??null,t.cacheReadInputTokens=C.message.usage.cache_read_input_tokens??null,t.model===null&&(t.model=a);break;case"content_block_start":{const S=C.content_block;switch(S.type){case"text":o.set(C.index,{type:"text",text:S.text??""});break;case"thinking":o.set(C.index,{type:"thinking",thinking:S.thinking??"",signature:S.signature??""});break;case"think":o.set(C.index,{type:"think",thinking:S.thinking??"",signature:S.signature??""});break;case"tool_use":o.set(C.index,{type:"tool_use",id:S.id,name:S.name,inputJson:""});break}break}case"content_block_delta":{const S=o.get(C.index);if(S===void 0)break;const j=C.delta;j.type==="text_delta"&&S.type==="text"?S.text+=j.text:j.type==="thinking_delta"&&(S.type==="thinking"||S.type==="think")?S.thinking+=j.thinking:j.type==="signature_delta"&&(S.type==="thinking"||S.type==="think")?S.signature+=j.signature:j.type==="input_json_delta"&&S.type==="tool_use"&&(S.inputJson+=j.partial_json);break}case"message_delta":l=C.delta.stop_reason,c=C.delta.stop_sequence??null,d=C.usage.output_tokens,t.outputTokens=d,C.usage.cache_creation_input_tokens!==void 0&&(t.cacheCreationInputTokens=C.usage.cache_creation_input_tokens),C.usage.cache_read_input_tokens!==void 0&&(t.cacheReadInputTokens=C.usage.cache_read_input_tokens);break;case"error":t.error=C.error.message;break;case"content_block_stop":case"message_stop":case"ping":break}}catch{}}r===!0&&(t.streamingChunks={chunks:y,truncated:h>f});const m=[...o.entries()].sort(([x],[b])=>x-b).map(([,x])=>pE(x));return JSON.stringify({id:i,type:"message",model:a!==""?a:n??"",role:"assistant",content:m,stop_reason:l,stop_sequence:c,usage:{input_tokens:u,output_tokens:d}})}const hE={format:"anthropic",parseRequest(e,t){try{const n=JSON.parse(e),r=op.safeParse(n);return r.success?{model:r.data.model,sessionId:r.data.metadata?.user_id??t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){try{const t=JSON.parse(e),n=sp.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,r){return fg(e,t,n,r)},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}}};Nr.register(hE);class mE{providers=[];register(t){this.providers.push(t)}findProvider(t){let n=null;for(const r of this.providers)if(r.matches(t)){if(r.name!=="anthropic")return r;n=r}return n}getAll(){return[...this.providers]}}const ii=new mE,gE="https://api.anthropic.com",xE={MiniMax:"https://api.minimaxi.com/anthropic"},bE={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(xE))if(t.startsWith(n.toLowerCase()))return!0;return!0},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:gE},extractStream(e,t,n,r){return fg(e,t,n,r)}};ii.register(bE);function ai(e,t,n,r=!0){let o="",i="",a="",l="",c=null,u=0,d=0,f=!1,h=!1;const p=new Map,y=1e3;let m=0,x=0;const b=[];for(const w of e.split(`
87
+ `)){const C=w.trim();if(!C.startsWith("data: "))continue;const S=C.slice(6);if(S==="[DONE]")break;try{const j=JSON.parse(S);if(typeof j=="object"&&j!==null&&!Array.isArray(j)){const z=Object.getOwnPropertyDescriptor(j,"error");if(z!==void 0&&typeof z.value=="object"&&z.value!==null){const L=Object.getOwnPropertyDescriptor(z.value,"message");L!==void 0&&typeof L.value=="string"&&(t.error=L.value);continue}}const N=v2.safeParse(j);if(!N.success)continue;const A=N.data;if(m===0&&(x=Date.now()),r===!0&&b.length<y&&b.push({index:m,timestamp:Date.now()-x,type:"chat.completion.chunk",data:A}),m++,h||(o=A.id,i=A.model,h=!0),!f&&A.usage!==void 0&&A.usage!==null){if(u=A.usage.prompt_tokens??0,d=A.usage.completion_tokens??0,t.inputTokens=u,typeof j=="object"&&j!==null&&!Array.isArray(j)){const z=Object.getOwnPropertyDescriptor(j,"usage");if(z!==void 0&&typeof z.value=="object"&&z.value!==null){const L=Object.getOwnPropertyDescriptor(z.value,"prompt_tokens_details");if(L!==void 0&&typeof L.value=="object"&&L.value!==null){const U=Object.getOwnPropertyDescriptor(L.value,"cached_tokens");U!==void 0&&typeof U.value=="number"&&(t.cacheReadInputTokens=U.value)}}}f=!0}for(const z of A.choices){const L=z.delta;L.content!==void 0&&L.content!==null&&(a+=L.content),L.reasoning_content!==void 0&&L.reasoning_content!==null&&(l+=L.reasoning_content),L.thinking!==void 0&&L.thinking!==null&&(l+=L.thinking);const U=L.think;if(U!=null&&(l+=U),z.finish_reason!==void 0&&z.finish_reason!==null&&(c=z.finish_reason),L.tool_calls!==void 0&&L.tool_calls!==null)for(const E of L.tool_calls){let O=p.get(E.index);O===void 0&&(O={index:E.index,type:"function",function:{name:"",arguments:""}},p.set(E.index,O)),E.id!==void 0&&(O.id=E.id),E.function?.name!==void 0&&(O.function.name+=E.function.name),E.function?.arguments!==void 0&&(O.function.arguments+=E.function.arguments)}}}catch{}}r===!0&&(t.streamingChunks={chunks:b,truncated:m>y}),f||(d=Math.ceil(a.length/4)),t.outputTokens=d;const v={role:"assistant",content:a};return l&&(v.reasoning_content=l),p.size>0&&(v.tool_calls=[...p.values()]),JSON.stringify({id:o,object:"chat.completion",created:Math.floor(Date.now()/1e3),model:i!==""?i:n??"",choices:[{index:0,message:v,finish_reason:c}],usage:{prompt_tokens:u,completion_tokens:d,total_tokens:u+d}})}const yE={format:"openai",parseRequest(e,t){try{const n=JSON.parse(e),r=lp.safeParse(n);return r.success?{model:r.data.model,sessionId:t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){const t=up(e);if(t){let n=null;try{const r=JSON.parse(e);if(r!==null&&typeof r=="object"&&!Array.isArray(r)){const o=Object.getOwnPropertyDescriptor(r,"usage");if(o!==void 0&&typeof o.value=="object"&&o.value!==null){const i=Object.getOwnPropertyDescriptor(o.value,"prompt_tokens_details");if(i!==void 0&&typeof i.value=="object"&&i.value!==null){const a=Object.getOwnPropertyDescriptor(i.value,"cached_tokens");a!==void 0&&typeof a.value=="number"&&(n=a.value)}}}}catch{}return{inputTokens:t.usage.prompt_tokens??null,outputTokens:t.usage.completion_tokens??null,cacheCreationInputTokens:null,cacheReadInputTokens:n}}return{inputTokens:null,outputTokens:null,cacheCreationInputTokens:null,cacheReadInputTokens:null}},extractStream(e,t,n,r){return ai(e,t,n,r)},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}}};Nr.register(yE);const vE="https://api.openai.com/v1",wE={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:vE},extractStream(e,t,n,r){return ai(e,t,n,r)}};ii.register(wE);const kE="https://open.bigmodel.cn/api/paas/v4",_E=["glm-","charglm-","cogview-","embedding-","rerank-"],SE={name:"zhipu",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return _E.some(n=>t.startsWith(n))},getUpstreamBase(e,t){return t?.baseUrl??kE},extractStream(e,t,n,r){return ai(e,t,n,r)}};ii.register(SE);const CE="https://dashscope.aliyuncs.com/compatible-mode/v1",jE={name:"alibaba",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return!!(t.startsWith("glm-5")||t.startsWith("qwen"))},getUpstreamBase(e,t){return CE},extractStream(e,t,n){return ai(e,t,n)}};ii.register(jE);function pg(e,t){for(const n of Array.from(e))t(n)}const NE=/[\u3000-\u9FFF\uAC00-\uD7FF\uF900-\uFAFF\uFF00-\uFFEF\u{1F300}-\u{1FAFF}]/u;function Jl(e){if(e.length===0)return 0;let t=0,n=0;return pg(e,r=>{NE.test(r)?t+=1:n+=1}),Math.ceil(t*1)+Math.ceil(n/4)}function Yl(e){if(e.length===0)return 0;let t=0;return pg(e,()=>{t+=1}),t}function On(e){return{parsed:null,comparisonValue:e,messageCount:null,toolCount:null}}const cr={parsed:null,toolNames:null};function EE(e){if(typeof e=="string")return e;if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const r=n;switch(r.type){case"text":typeof r.text=="string"&&t.push(r.text);break;case"thinking":case"think":typeof r.thinking=="string"&&t.push(r.thinking);break;case"tool_use":{const i=typeof r.name=="string"?r.name:"",a=r.input!==void 0?JSON.stringify(r.input):"";t.push(`${i} ${a}`.trim());break}case"tool_result":{const i=r.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(`
88
+ `)}function TE(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 r=n.text;n.type==="text"&&typeof r=="string"&&t.push(r)}return t.join(`
89
+ `)}function AE(e){if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const r=n;typeof r.name=="string"&&t.push(r.name),typeof r.description=="string"&&t.push(r.description),r.input_schema!==void 0&&t.push(JSON.stringify(r.input_schema))}return t.join(`
90
+ `)}function Ti(e,t,n,r){return{role:e,label:t,text:n,size:Jl(n),characters:Yl(n),path:r}}const IE={format:"anthropic",analyzeRequest(e){if(e===null)return On(e);try{const t=op.safeParse(JSON.parse(e));return t.success?{parsed:t.data,comparisonValue:t.data,messageCount:t.data.messages.length,toolCount:t.data.tools!==void 0&&t.data.tools.length>0?t.data.tools.length:null}:On(e)}catch{return On(e)}},analyzeResponse(e){if(e===null)return cr;try{let t=JSON.parse(e);typeof t=="string"&&(t=JSON.parse(t));const n=sp.safeParse(t);if(!n.success)return cr;const r=n.data.content.filter(o=>o.type==="tool_use").map(o=>o.name);return{parsed:n.data,toolNames:r.length>0?r:null}}catch{return cr}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(t.system!==void 0){const r=TE(t.system);r.length>0&&n.push(Ti("system","system",r,"/system"))}if(Array.isArray(t.messages)&&t.messages.forEach((r,o)=>{if(r===null||typeof r!="object")return;const i=r,a=i.role==="user"||i.role==="assistant"?i.role:"user",l=EE(i.content);n.push(Ti(a,`[${o}] ${a}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=AE(t.tools);n.push(Ti("tools","tools",r,"/tools"))}return n.length>0?n:null}};function zE(e){if(typeof e=="string")return e;if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const r=n,o=r.type;o==="text"&&typeof r.text=="string"?t.push(r.text):o==="image_url"&&t.push("[image]")}return t.join(`
91
+ `)}function RE(e){const t=[],n=zE(e.content);n.length>0&&t.push(n);const r=typeof e.reasoning_content=="string"?e.reasoning_content:typeof e.thinking=="string"?e.thinking:typeof e.think=="string"?e.think:"";r.length>0&&t.push(r);const o=e.tool_calls;if(Array.isArray(o))for(const 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(`
92
+ `)}function PE(e){if(!Array.isArray(e))return"";const t=[];for(const n of e){if(n===null||typeof n!="object")continue;const o=n.function;o!==void 0&&(typeof o.name=="string"&&t.push(o.name),typeof o.description=="string"&&t.push(o.description),o.parameters!==void 0&&t.push(JSON.stringify(o.parameters)))}return t.join(`
93
+ `)}function Eu(e,t,n,r){return{role:e,label:t,text:n,size:Jl(n),characters:Yl(n),path:r}}const OE={format:"openai",analyzeRequest(e){if(e===null)return On(e);try{const t=lp.safeParse(JSON.parse(e));return t.success?{parsed:t.data,comparisonValue:t.data,messageCount:t.data.messages.length,toolCount:t.data.tools!==void 0&&t.data.tools.length>0?t.data.tools.length:null}:On(e)}catch{return On(e)}},analyzeResponse(e){if(e===null)return cr;const t=up(e);if(t===null)return cr;const n=t.choices[0]?.message?.tool_calls?.map(r=>r.function?.name??"").filter(r=>r!=="")??[];return{parsed:t,toolNames:n.length>0?n:null}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(Array.isArray(t.messages)&&t.messages.forEach((r,o)=>{if(r===null||typeof r!="object")return;const i=r,a=i.role==="user"||i.role==="assistant"||i.role==="system"||i.role==="tool"?i.role:"user",l=RE(i);n.push(Eu(a,`[${o}] ${a}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=PE(t.tools);n.push(Eu("tools","tools",r,"/tools"))}return n.length>0?n:null}},ME={format:"unknown",analyzeRequest(e){return On(e)},analyzeResponse(){return cr},anatomySegments(){return null}},LE={anthropic:IE,openai:OE,unknown:ME};function hg(e){return LE[e]}function Bn(e){const t=dE(e.path);return t==="unknown"?e.apiFormat:t}const DE={anthropic:"Anthropic",openai:"OpenAI",unknown:"Unknown"};function FE({conversationId:e,startTime:t,endTime:n,totalCalls:r,totalInputTokens:o,totalOutputTokens:i,apiFormat:a,expanded:l,onToggle:c,hideApiFormat:u=!1,isLoading:d=!1,userAgent:f,timeDisplayFormat:h,onClear:p}){const[y,m]=g.useState(!1),x=v=>{v.stopPropagation(),p!==void 0&&m(!0)},b=g.useCallback(v=>{v.stopPropagation(),window.open(wf(e),"_blank","noopener,noreferrer")},[e]);return s.jsxs("div",{role:"button",tabIndex:0,"data-nav-id":`conv-${e}`,"data-nav-action":l?"collapse":"expand",className:me("flex items-center gap-3 px-3 py-2 cursor-pointer transition-colors","hover:bg-muted/50","select-none","border border-border rounded-lg mb-2 bg-background sticky top-0 z-10","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),onClick:c,onKeyDown:v=>{v.target===v.currentTarget&&(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),c())},children:[l?s.jsx(gt,{className:"size-4 text-muted-foreground shrink-0"}):d?s.jsx(Tt,{className:"size-4 animate-spin text-muted-foreground shrink-0"}):s.jsx(Ft,{className:"size-4 text-muted-foreground shrink-0"}),s.jsx("span",{className:"text-purple-400/90 font-mono text-xs font-semibold shrink-0",title:e,children:e.startsWith("PID:")||e.includes("|")?e:e.length>24?e.slice(0,12)+"..."+e.slice(-12):e}),f!=null&&f!==""&&s.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:f,children:[s.jsx(Uk,{className:"size-3"}),s.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",children:f})]}),!u&&s.jsx(He,{variant:"outline",className:me("text-[10px] px-1.5 py-0 h-5 font-mono shrink-0",a==="openai"&&"border-blue-500/40 text-blue-400",a==="anthropic"&&"border-orange-500/40 text-orange-400",a==="unknown"&&"border-muted text-muted-foreground"),children:DE[a]}),s.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[s.jsx(wn,{className:"size-3"}),s.jsx("span",{className:"font-mono tabular-nums",children:_l(t,n,h)})]}),s.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[s.jsx($s,{className:"size-3"}),s.jsxs("span",{className:"font-mono tabular-nums",children:[r," call",r!==1?"s":""]})]}),s.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[s.jsx(to,{className:"size-3 text-muted-foreground"}),s.jsxs("span",{className:"font-mono tabular-nums",children:[s.jsx("span",{className:"text-blue-400",children:Ve(o)})," / ",s.jsx("span",{className:"text-amber-400",children:Ve(i)})]})]}),s.jsx("span",{className:"flex-1 min-w-0"}),s.jsx("button",{type:"button",onClick:b,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&b(v)},"aria-label":`Open session ${e} in a new tab`,title:"Open this session in a new tab",className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 inline-flex items-center justify-center size-8 rounded hover:bg-muted cursor-pointer",children:s.jsx(xl,{className:"size-3.5"})}),p!==void 0&&s.jsx("button",{type:"button",onClick:x,"aria-label":`Clear group (${r} request${r!==1?"s":""})`,title:"Clear this group",className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 inline-flex items-center justify-center size-8 rounded hover:bg-muted cursor-pointer",children:s.jsx(mr,{className:"size-3.5"})}),s.jsx(dg,{open:y,onOpenChange:m,title:"Clear this group?",description:`This will remove ${r} request${r!==1?"s":""} from this conversation. This action cannot be undone.`,confirmLabel:"Clear",variant:"destructive",onConfirm:()=>{p?.()}})]})}function $E(e){for(const t of e){const n=Bn(t);if(n!=="unknown")return n}return"unknown"}function BE(e){let t=!1,n=!1;for(const r of e){const o=Bn(r);if(o==="anthropic"?t=!0:o==="openai"&&(n=!0),t&&n)return!0}return!1}function UE(e){if(e.isTest===!0)return"provider-test";if(e.sessionId!==null&&e.sessionId!==""&&e.sessionId!==void 0)return e.sessionId;const t=e.clientPid!==null&&e.clientPid!==void 0,n=e.clientProjectFolder!==null&&e.clientProjectFolder!==void 0;if(!t&&!n)return"default";const r=t?`PID:${e.clientPid}`:"unknown",o=n?e.clientProjectFolder:"no-folder";return`${r}|${o}`}function HE(e){const t=new Map;for(const r of e){const o=UE(r),i=t.get(o);i!==void 0?i.push(r):t.set(o,[r])}const n=[];for(const[r,o]of t){const i=[...o].sort((a,l)=>a.timestamp.localeCompare(l.timestamp));n.push({id:r,conversationId:r,logs:i})}return n.sort((r,o)=>(r.logs[0]?.timestamp??"").localeCompare(o.logs[0]?.timestamp??"")),n}function Tu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function WE(e){if(e.responseText===null)return null;try{let t=JSON.parse(e.responseText);return typeof t=="string"&&(t=JSON.parse(t)),Tu(t)?typeof t.stop_reason=="string"?t.stop_reason==="end_turn"||t.stop_reason==="tool_use"?t.stop_reason:null:Array.isArray(t.choices)&&t.choices.length>0&&Tu(t.choices[0])&&typeof t.choices[0].finish_reason=="string"&&t.choices[0].finish_reason==="stop"?"stop":null:null}catch{return null}}function mg(e){return e==="end_turn"||e==="stop"}function Rt({className:e,style:t,d:n,eyeStalks:r,eyes:o,legs:i,extras:a}){return s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:t,className:me("inline-block size-5",e),children:[s.jsx("path",{d:n}),r,o,i,a]})}const En=s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),s.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),s.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),s.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]}),gg=s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"7",y1:"16",x2:"5.5",y2:"18.5"}),s.jsx("line",{x1:"9.5",y1:"17",x2:"8.5",y2:"19.5"}),s.jsx("line",{x1:"14.5",y1:"17",x2:"15.5",y2:"19.5"}),s.jsx("line",{x1:"17",y1:"16",x2:"18.5",y2:"18.5"})]});function xg({className:e}){return s.jsx(Rt,{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:s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),s.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),s.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"})]}),legs:En,extras:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),s.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 VE({className:e}){return s.jsx(Rt,{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:s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"9.5",y1:"6.5",x2:"9.5",y2:"4.5"}),s.jsx("line",{x1:"14.5",y1:"6.5",x2:"14.5",y2:"4.5"})]}),eyes:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"9.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"}),s.jsx("circle",{cx:"14.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"})]}),legs:gg,extras:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M5 11 C4 9.5 2.5 10 3 12 C3.5 13.5 4.5 13 5 12"}),s.jsx("path",{d:"M19 11 C20 9.5 21.5 10 21 12 C20.5 13.5 19.5 13 19 12"})]})})}function qE({className:e}){return s.jsx(Rt,{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:s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"7",y1:"7",x2:"6.5",y2:"4.5"}),s.jsx("line",{x1:"17",y1:"7",x2:"17.5",y2:"4.5"})]}),eyes:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"6.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"}),s.jsx("circle",{cx:"17.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:En,extras:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M4 12 C2.5 10.5 1 11 1.5 13 C2 14.5 3.5 14 4.5 13"}),s.jsx("path",{d:"M20 12 C21.5 10.5 23 11 22.5 13 C22 14.5 20.5 14 19.5 13"})]})})}function ZE({className:e}){return s.jsx(Rt,{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:s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"10",y1:"6.5",x2:"10",y2:"3.5"}),s.jsx("line",{x1:"14",y1:"6.5",x2:"14",y2:"3.5"})]}),eyes:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"10",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"}),s.jsx("circle",{cx:"14",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"7",y1:"17",x2:"5",y2:"20.5"}),s.jsx("line",{x1:"9.5",y1:"18.5",x2:"8.5",y2:"21.5"}),s.jsx("line",{x1:"14.5",y1:"18.5",x2:"15.5",y2:"21.5"}),s.jsx("line",{x1:"17",y1:"17",x2:"19",y2:"20.5"})]}),extras:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M6.5 11 C5 8.5 3 9 3.5 11.5 C4 13.5 5 13 6 12"}),s.jsx("path",{d:"M17.5 11 C19 8.5 21 9 20.5 11.5 C20 13.5 19 13 18 12"})]})})}function GE({className:e}){return s.jsx(Rt,{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:s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),s.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"}),s.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:En,extras:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),s.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 KE({className:e}){return s.jsx(Rt,{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:s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),s.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),s.jsx("line",{x1:"13.5",y1:"4",x2:"15.5",y2:"5"})]}),legs:En,extras:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),s.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 JE({className:e}){return s.jsx(Rt,{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:s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"10",y1:"8",x2:"10",y2:"6"}),s.jsx("line",{x1:"14",y1:"8",x2:"14",y2:"6"})]}),eyes:s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"9",y1:"6",x2:"11",y2:"6.5"}),s.jsx("line",{x1:"13",y1:"6",x2:"15",y2:"6.5"})]}),legs:gg,extras:s.jsxs(s.Fragment,{children:[s.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"}),s.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 YE({className:e}){return s.jsx(Rt,{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:s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),s.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"}),s.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:En,extras:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),s.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),s.jsx("line",{x1:"8.5",y1:"4",x2:"10.5",y2:"4.5"}),s.jsx("line",{x1:"15.5",y1:"4",x2:"13.5",y2:"4.5"}),s.jsx("path",{d:"M9 15.5 C10 14.5 14 14.5 15 15.5"})]})})}function XE({className:e}){return s.jsx(Rt,{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:s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),s.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"9.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"}),s.jsx("circle",{cx:"14.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"})]}),legs:En,extras:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),s.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),s.jsx("ellipse",{cx:"12",cy:"15",rx:"2",ry:"1.5",fill:"currentColor",stroke:"none"})]})})}function QE({className:e}){return s.jsx(Rt,{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:s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"9.5",y1:"7",x2:"9",y2:"5"}),s.jsx("line",{x1:"14.5",y1:"7",x2:"15",y2:"5"})]}),eyes:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"9",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"}),s.jsx("circle",{cx:"15",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"})]}),legs:En,extras:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M5 11 C3.5 9 2 9.5 2.5 12 C3 14 4 13 5 12"}),s.jsx("path",{d:"M19 11 C20.5 9 22 9.5 21.5 12 C21 14 20 13 19 12"}),s.jsx("path",{d:"M9 14.5 C10 16 14 16 15 14.5"}),s.jsx("circle",{cx:"7",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"}),s.jsx("circle",{cx:"17",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"})]})})}function e3({className:e}){return s.jsx(Rt,{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:s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5.5"}),s.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5.5"})]}),eyes:s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"7.5",y1:"5.5",x2:"16.5",y2:"5.5"}),s.jsx("rect",{x:"7",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"}),s.jsx("rect",{x:"13",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"})]}),legs:En,extras:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),s.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),s.jsx("path",{d:"M9.5 15 C10.5 16 13.5 16 14.5 15"})]})})}function t3({className:e}){return s.jsx(Rt,{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:s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"10.5",y1:"9.5",x2:"10.5",y2:"8"}),s.jsx("line",{x1:"13.5",y1:"9.5",x2:"13.5",y2:"8"})]}),eyes:s.jsxs(s.Fragment,{children:[s.jsx("circle",{cx:"10.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),s.jsx("circle",{cx:"13.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:s.jsxs(s.Fragment,{children:[s.jsx("line",{x1:"8",y1:"16",x2:"6.5",y2:"18"}),s.jsx("line",{x1:"10",y1:"17",x2:"9.5",y2:"19"}),s.jsx("line",{x1:"14",y1:"17",x2:"14.5",y2:"19"}),s.jsx("line",{x1:"16",y1:"16",x2:"17.5",y2:"18"})]}),extras:s.jsxs(s.Fragment,{children:[s.jsx("path",{d:"M7.5 12 C6.5 11 5.5 11.5 6 13 C6.5 14 7 13.5 7.5 13"}),s.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 oo=[xg,VE,qE,ZE,GE,KE,JE,YE,XE,QE,e3,t3];function ws(e){return oo[Math.abs(e)%oo.length]??xg}function n3(e){const t=oo.length-2;return t<=0?0:1+((Number.isFinite(e)?Math.trunc(e):0)%t+t)%t}function r3(e){return ws(n3(e))}const o3="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",s3="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",i3="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",a3="/assets/minimax-BPMzvuL-.jpeg",l3="/assets/alibaba-TTwafVwX.svg",c3="/assets/qwen-CONDcHqt.png",u3="/assets/zhipuai-BPNAnxo-.svg",d3={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen","glm-":"zhipuai"};function bg(e){if(e===null)return"unknown";const t=e.toLowerCase();for(const[n,r]of Object.entries(d3))if(t.startsWith(n.toLowerCase()))return r;return"unknown"}const qn={width:24,height:24,objectFit:"contain"},f3=pt.memo(({className:e})=>s.jsx("img",{src:o3,alt:"Anthropic",className:e,style:qn})),p3=pt.memo(({className:e})=>s.jsx("img",{src:s3,alt:"OpenAI",className:e,style:{...qn,background:"white",borderRadius:"4px"}})),h3=pt.memo(({className:e})=>s.jsx("img",{src:i3,alt:"DeepSeek",className:e,style:qn})),m3=pt.memo(({className:e})=>s.jsx("img",{src:a3,alt:"MiniMax",className:e,style:qn})),g3=pt.memo(({className:e})=>s.jsx("img",{src:l3,alt:"Alibaba",className:e,style:qn})),x3=pt.memo(({className:e})=>s.jsx("img",{src:c3,alt:"Qwen",className:e,style:qn})),b3=pt.memo(({className:e})=>s.jsx("img",{src:u3,alt:"ZhipuAI",className:e,style:qn}));function yg({provider:e,className:t}){switch(e){case"anthropic":return s.jsx(f3,{className:t});case"openai":return s.jsx(p3,{className:t});case"deepseek":return s.jsx(h3,{className:t});case"minimax":return s.jsx(m3,{className:t});case"alibaba":return s.jsx(g3,{className:t});case"qwen":return s.jsx(x3,{className:t});case"zhipuai":return s.jsx(b3,{className:t});case"unknown":return null}}function ot({delayDuration:e=0,...t}){return s.jsx(JN,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function $e({...e}){return s.jsx(YN,{"data-slot":"tooltip",...e})}function Be({...e}){return s.jsx(XN,{"data-slot":"tooltip-trigger",...e})}function Ue({className:e,sideOffset:t=0,children:n,...r}){return s.jsx(QN,{children:s.jsxs(eE,{"data-slot":"tooltip-content",sideOffset:t,className:me("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,s.jsx(tE,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function Xl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Le(e,t){return e===null||typeof e!="object"||Array.isArray(e)?void 0:Object.getOwnPropertyDescriptor(e,t)?.value}const y3="x-anthropic-billing-header:";function v3(e){return e.trimStart().toLowerCase().startsWith(y3)}function w3(e){return Xl(e)?Object.prototype.hasOwnProperty.call(e,"system"):!1}function k3(e){if(!Xl(e))return!1;const t=Le(e,"type"),n=Le(e,"text");return typeof t!="string"||t!=="text"||typeof n!="string"?!1:v3(n)}function _3(e){let t;try{t=JSON.parse(e)}catch{return{body:e,removed:0}}if(!w3(t))return{body:e,removed:0};const n=t.system;if(!Array.isArray(n)||n.length===0)return{body:e,removed:0};const r=[];let o=0;for(const i of n){if(k3(i)){o+=1;continue}r.push(i)}return o===0?{body:e,removed:0}:(r.length===0?delete t.system:t.system=r,{body:JSON.stringify(t),removed:o})}function S3(e){return{depth:Number.POSITIVE_INFINITY}}function vg(e){try{const t=JSON.parse(e);return{kind:"json",data:ks(t)}}catch{return{kind:"text"}}}function Ai(e){const t=g.useMemo(()=>e===null?null:vg(e),[e]),n=t?.kind==="json"?t.data:null,r=g.useMemo(()=>n===null?null:S3(),[n]),[o,i]=g.useState(!1),[a,l]=g.useState(0),[c,u]=g.useState(0),[d,f]=g.useTransition(),h=g.useCallback(()=>{const p=!o,y=p&&r!==null?r.depth:0;f(()=>{i(p),l(y),u(m=>m+1)})},[o,r]);return{parsedData:n,policy:r,isExpanded:o,toggle:h,isPending:d,bulkDepth:a,bulkRevision:c}}function ks(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=>ks(n));const t={};for(const n of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,n);t[n]=ks(r?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function wg({className:e,orientation:t="horizontal",...n}){return s.jsx(IN,{"data-slot":"tabs","data-orientation":t,orientation:t,className:me("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",e),...n})}const C3=Cl("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 kg({className:e,variant:t="default",...n}){return s.jsx(zN,{"data-slot":"tabs-list","data-variant":t,className:me(C3({variant:t}),e),...n})}function Ct({className:e,...t}){return s.jsx(RN,{"data-slot":"tabs-trigger",className:me("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 jt({className:e,...t}){return s.jsx(PN,{"data-slot":"tabs-content",className:me("flex-1 outline-none",e),...t})}function rn(e){const[t,n]=g.useState(!1),r=g.useRef(null);g.useEffect(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);const o=g.useCallback(i=>{i.stopPropagation(),e!==null&&$t(e).then(a=>{a&&(n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),2e3))})},[e]);return{copied:t,copy:o}}const j3=g.lazy(()=>Hn(()=>import("./CompareDrawer-BLS7CVvA.js"),__vite__mapDeps([0,1])).then(e=>({default:e.CompareDrawer}))),N3=g.lazy(()=>Hn(()=>import("./ReplayDialog-DIGF807X.js"),__vite__mapDeps([2,1,3])).then(e=>({default:e.ReplayDialog}))),E3=g.lazy(()=>Hn(()=>import("./RequestAnatomy-C3Nlvp9P.js"),__vite__mapDeps([4,1])).then(e=>({default:e.RequestAnatomy}))),T3=g.lazy(()=>Hn(()=>import("./ResponseView-BbZywqHe.js"),__vite__mapDeps([3,1])).then(e=>({default:e.ResponseView}))),A3=g.lazy(()=>Hn(()=>import("./StreamingChunkSequence-Dk27PfPn.js"),__vite__mapDeps([5,1])).then(e=>({default:e.StreamingChunkSequence}))),Au=g.lazy(()=>Hn(()=>Promise.resolve().then(()=>mx),void 0).then(e=>({default:e.JsonViewer}))),I3=g.lazy(()=>Hn(()=>Promise.resolve().then(()=>mx),void 0).then(e=>({default:e.JsonViewerFromString}))),z3=1200,R3=12;function P3(e){const{containerRef:t,setExpandToPath:n,ensureTabActive:r,highlightMs:o}=e,i=g.useRef(null);return g.useCallback(a=>{r?.(),n(a.path);const l=f=>{f.scrollIntoView({behavior:"smooth",block:"center"}),f.classList.add("ring-2","ring-primary/60","ring-offset-1","ring-offset-background","rounded-sm","transition-shadow"),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??z3)},u=`[data-anatomy-path="${(f=>typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(f):f.replace(/(["'\\[\](){}])/g,"\\$1"))(a.path)}"]`,d=f=>{const h=t.current;if(h!==null){const p=h.querySelector(u);if(p!==null){l(p);return}}f>0?window.requestAnimationFrame(()=>d(f-1)):n(null)};window.requestAnimationFrame(()=>d(R3))},[t,r,o,n])}class _g{diff(t,n,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);const i=this.castInput(t,r),a=this.castInput(n,r),l=this.removeEmpty(this.tokenize(i,r)),c=this.removeEmpty(this.tokenize(a,r));return this.diffWithOptionsObj(l,c,r,o)}diffWithOptionsObj(t,n,r,o){var i;const a=v=>{if(v=this.postProcess(v,r),o){setTimeout(function(){o(v)},0);return}else return v},l=n.length,c=t.length;let u=1,d=l+c;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));const f=(i=r.timeout)!==null&&i!==void 0?i:1/0,h=Date.now()+f,p=[{oldPos:-1,lastComponent:void 0}];let y=this.extractCommon(p[0],n,t,0,r);if(p[0].oldPos+1>=c&&y+1>=l)return a(this.buildValues(p[0].lastComponent,n,t));let m=-1/0,x=1/0;const b=()=>{for(let v=Math.max(m,-u);v<=Math.min(x,u);v+=2){let w;const C=p[v-1],S=p[v+1];C&&(p[v-1]=void 0);let j=!1;if(S){const A=S.oldPos-v;j=S&&0<=A&&A<l}const N=C&&C.oldPos+1<c;if(!j&&!N){p[v]=void 0;continue}if(!N||j&&C.oldPos<S.oldPos?w=this.addToPath(S,!0,!1,0,r):w=this.addToPath(C,!1,!0,1,r),y=this.extractCommon(w,n,t,v,r),w.oldPos+1>=c&&y+1>=l)return a(this.buildValues(w.lastComponent,n,t))||!0;p[v]=w,w.oldPos+1>=c&&(x=Math.min(x,v-1)),y+1>=l&&(m=Math.max(m,v+1))}u++};if(o)(function v(){setTimeout(function(){if(u>d||Date.now()>h)return o(void 0);b()||v()},0)})();else for(;u<=d&&Date.now()<=h;){const v=b();if(v)return v}}addToPath(t,n,r,o,i){const a=t.lastComponent;return a&&!i.oneChangePerToken&&a.added===n&&a.removed===r?{oldPos:t.oldPos+o,lastComponent:{count:a.count+1,added:n,removed:r,previousComponent:a.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:n,removed:r,previousComponent:a}}}extractCommon(t,n,r,o,i){const a=n.length,l=r.length;let c=t.oldPos,u=c-o,d=0;for(;u+1<a&&c+1<l&&this.equals(r[c+1],n[u+1],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,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const o=[];let 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(r.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let f=n.slice(c,c+d.count);f=f.map(function(h,p){const y=r[u+p];return y.length>h.length?y:h}),d.value=this.join(f)}else d.value=this.join(n.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return o}}class O3 extends _g{constructor(){super(...arguments),this.tokenize=Cg}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
94
+ `))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
95
+ `))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
96
+ `)&&(t=t.slice(0,-1)),n.endsWith(`
97
+ `)&&(n=n.slice(0,-1))),super.equals(t,n,r)}}const M3=new O3;function Sg(e,t,n){return M3.diff(e,t,n)}function Cg(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
98
+ `));const n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let o=0;o<r.length;o++){const i=r[o];o%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}class L3 extends _g{constructor(){super(...arguments),this.tokenize=Cg}get useLongestToken(){return!0}castInput(t,n){const{undefinedReplacement:r,stringifyReplacer:o=(i,a)=>typeof a>"u"?r:a}=n;return typeof t=="string"?t:JSON.stringify(Ea(t,null,null,o),null," ")}equals(t,n,r){return super.equals(t.replace(/,([\r\n])/g,"$1"),n.replace(/,([\r\n])/g,"$1"),r)}}const D3=new L3;function F3(e,t,n){return D3.diff(e,t,n)}function Ea(e,t,n,r,o){t=t||[],n=n||[],r&&(e=r(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]=Ea(e[i],t,n,r,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]=Ea(e[c],t,n,r,c);t.pop(),n.pop()}else a=e;return a}function Iu(e){return e===void 0?[]:Object.entries(e).map(t=>[t[0].toLowerCase(),t[1]]).sort(([t],[n])=>t.localeCompare(n))}function zu([e,t]){return`${e}: ${t}`}function Ta(e){const t=[];let n=0,r=0;for(const o of e){const i=o.value.split(`
99
+ `);i.length>0&&i[i.length-1]===""&&i.pop();for(const a of i)o.added?(r+=1,t.push({kind:"added",text:a,oldLineNumber:null,newLineNumber:r})):o.removed?(n+=1,t.push({kind:"removed",text:a,oldLineNumber:n,newLineNumber:null})):(n+=1,r+=1,t.push({kind:"context",text:a,oldLineNumber:n,newLineNumber:r}))}return t}function $3(e,t){const n=Iu(e).map(zu).join(`
100
+ `),r=Iu(t).map(zu).join(`
101
+ `);if(n===r)return{lines:[],isEmpty:!0};const o=Sg(n,r);return{lines:Ta(o),isEmpty:!1}}function Ru(e){try{const t=JSON.parse(e);return t===null||typeof t=="string"||typeof t=="object"?t:null}catch{return null}}function B3(e,t){const n=e??"",r=t??"";if(n===r)return{lines:[],isEmpty:!0};const o=Ru(n),i=Ru(r);if(o!==null&&i!==null){const l=F3(o,i)??[];if(l.length===1){const c=l[0];if(c!==void 0&&!c.added&&!c.removed)return{lines:[],isEmpty:!0}}return{lines:Ta(l),isEmpty:!1}}const a=Sg(n,r);return{lines:Ta(a),isEmpty:!1}}function U3(e,t,n){const r=new Array(e);return new Proxy(r,{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 Xn(e,t,n){let r=n.initialDeps??[],o,i=!0;function a(){const l=e();return(l.length!==r.length||l.some((u,d)=>r[d]!==u))&&(r=l,o=t(...l),n?.onChange&&!(i&&n.skipInitialOnChange)&&n.onChange(o),i=!1),o}return a.updateDeps=l=>{r=l},a}function Pu(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const Ou=(e,t)=>Math.abs(e-t)<1.01,H3=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}};let zr;const Mu=()=>{if(zr!==void 0)return zr;if(typeof navigator>"u")return zr=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return zr=!0;const e=navigator.maxTouchPoints;return zr=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Lu=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},W3=e=>e,V3=e=>{const t=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,o=new Array(r);for(let i=0;i<r;i++)o[i]=t+i;return o},q3=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=a=>{const{width:l,height:c}=a;t({width:Math.round(l),height:Math.round(c)})};if(o(Lu(n)),!r.ResizeObserver)return()=>{};const i=new r.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(Lu(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},so={passive:!0},Z3=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=()=>{t({width:n.innerWidth,height:n.innerHeight})};return r(),n.addEventListener("resize",r,so),()=>{n.removeEventListener("resize",r)}},G3=typeof window>"u"?!0:"onscrollend"in window,jg=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const o=e.targetWindow;if(!o)return;const i=e.options.useScrollendEvent&&G3;let a=0;const l=i?null:H3(o,()=>t(a,!1),e.options.isScrollingResetDelay),c=f=>()=>{a=n(r),l?.(),t(a,f)},u=c(!0),d=c(!1);return r.addEventListener("scroll",u,so),i&&r.addEventListener("scrollend",d,so),()=>{r.removeEventListener("scroll",u),i&&r.removeEventListener("scrollend",d)}},K3=(e,t)=>jg(e,t,n=>{const{horizontal:r,isRtl:o}=e.options;return r?n.scrollLeft*(o&&-1||1):n.scrollTop}),J3=(e,t)=>jg(e,t,n=>e.options.horizontal?n.scrollX:n.scrollY),Y3=(e,t,n)=>{if(t?.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},Ng=(e,{adjustments:t=0,behavior:n},r)=>{var o,i;(i=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||i.call(o,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})},X3=Ng,Q3=Ng;class eT{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,r,o;return((o=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:o.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>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=r())==null||o.disconnect(),n=null},observe:o=>{var i;return(i=r())==null?void 0:i.observe(o,{box:"border-box"})},unobserve:o=>{var i;return(i=r())==null?void 0:i.unobserve(o)}}})(),this.range=null,this.setOptions=n=>{var r,o;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:W3,rangeExtractor:V3,onChange:()=>{},measureElement:Y3,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?((r=f[0])==null?void 0:r.key)??a.getItemKey(0):null,p=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)!==p)){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)!==p)&&(c=b)}}this.options=i,(l||c)&&(this.pendingScrollAnchor=[l?.[0]??null,l?.[1]??0,c])},this.notify=n=>{var r,o;(o=(r=this.options).onChange)==null||o.call(r,this,n)},this.maybeNotify=Xn(()=>(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 r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,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,!(!Mu()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",a,so),i.addEventListener("touchend",l,so),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();Ou(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(),r=this.getMaxScrollOffset();if(n<0||n>r)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,r)=>{const o=new Map,i=new Map;for(let a=r-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=Xn(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,r,o,i,a,l,c)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:o,getItemKey:i,enabled:a,lanes:l,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=Xn(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,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 y of this.laneAssignments.keys())y>=n&&this.laneAssignments.delete(y);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(y=>{this.itemSizeCache.set(y.key,y.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 y=this.options.gap,m=n*2;let x=this._flatMeasurements;if(!x||x.length<m){const w=new Float64Array(m);x&&f>0&&w.set(x.subarray(0,f*2)),x=w,this._flatMeasurements=x}let b;if(f===0)b=r+o;else{const w=f-1;b=x[w*2]+x[w*2+1]+y}for(let w=f;w<n;w++){const C=i(w),S=d.get(C),j=typeof S=="number"?S:this.options.estimateSize(w);x[w*2]=b,x[w*2+1]=j,b+=j+y}const v=U3(n,x,i);return this.measurementsCache=v,v}const h=this.measurementsCache.slice(0,f),p=new Array(l).fill(void 0);for(let y=0;y<f;y++){const m=h[y];m&&(p[m.lane]=y)}for(let y=f;y<n;y++){const m=i(y),x=this.laneAssignments.get(y);let b,v;const w=c==="estimate"||d.has(m);if(x!==void 0&&this.options.lanes>1){b=x;const N=p[b],A=N!==void 0?h[N]:void 0;v=A?A.end+this.options.gap:r+o}else{const N=this.options.lanes===1?h[y-1]:this.getFurthestMeasurement(h,y);v=N?N.end+this.options.gap:r+o,b=N?N.lane:y%this.options.lanes,this.options.lanes>1&&w&&this.laneAssignments.set(y,b)}const C=d.get(m),S=typeof C=="number"?C:this.options.estimateSize(y),j=v+S;h[y]={index:y,start:v,size:S,end:j,key:m,lane:b},p[b]=y}return this.measurementsCache=h,h},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Xn(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,i)=>this.range=n.length>0&&r>0?tT({measurements:n,outerSize:r,scrollOffset:o,lanes:i,flat:i===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Xn(()=>{let n=null,r=null;const o=this.calculateRange();return o&&(n=o.startIndex,r=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,o,i,a)=>i===null||a===null?[]:n({startIndex:i,endIndex:a,overscan:r,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,o=n.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.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 r=this.indexFromElement(n),o=this.options.getItemKey(r),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(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{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=r-d;if(f!==0){const h=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=h?this.getTotalSize():0,y=((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,r),this.itemSizeCacheVersion++,h?this.applyScrollAdjustment(this.getTotalSize()-p):y&&this.applyScrollAdjustment(f),this.notify(!1)}},this.getVirtualItems=Xn(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let i=0,a=n.length;i<a;i++){const l=n[i],c=r[l];o.push(c)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length===0)return;const o=this._flatMeasurements,i=this.options.lanes===1&&o!=null,a=Eg(0,r.length-1,i?l=>o[l*2]:l=>Pu(r[l]).start,n);return Pu(r[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,r,o=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),a=this.getScrollOffset();r==="auto"&&(r=n>=a+i?"end":"start"),r==="center"?n+=(o-i)/2:r==="end"&&(n-=i);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,r="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(r==="auto")if(a.end>=i+o-this.options.scrollPaddingEnd)r="end";else if(a.start<=i+this.options.scrollPaddingStart)r="start";else return[i,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const l=r==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,r,a.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:o="auto"}={})=>{const i=this.getOffsetForAlignment(n,r),a=this.now();this.scrollState={index:null,align:r,behavior:o,startedAt:a,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:o="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getOffsetForIndex(n,r);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:r="auto"}={})=>{const o=this.getScrollOffset()+n,i=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:i,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:r}),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 r=this.getMeasurements();let o;if(r.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const i=r.length-1,a=this._flatMeasurements;a!=null?o=a[i*2]+a[i*2+1]:o=((n=r[i])==null?void 0:n.end)??0}else{const i=Array(this.options.lanes).fill(null);let a=r.length-1;for(;a>=0&&i.some(l=>l===null);){const l=r[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 r=this.getMeasurements();for(const o of r)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:r,behavior:o})=>{this._intendedScrollOffset=n+(r??0),this.options.scrollToFn(n,{behavior:o,adjustments:r},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&&(Mu()&&(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 r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=r?r[0]:this.scrollState.lastTargetOffset,i=1,a=o!==this.scrollState.lastTargetOffset;if(!a&&Ou(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 Eg=(e,t,n,r)=>{for(;e<=t;){const o=(e+t)/2|0,i=n(o);if(i<r)e=o+1;else if(i>r)t=o-1;else return o}return e>0?e-1:0};function tT({measurements:e,outerSize:t,scrollOffset:n,lanes:r,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<=r)return{startIndex:0,endIndex:i};let c=Eg(0,i,a,n),u=c;if(r===1)for(;u<i&&l(u)<n+t;)u++;else if(r>1){const d=Array(r).fill(0);for(;u<i&&d.some(h=>h<n+t);){const h=e[u];d[h.lane]=h.end,u++}const f=Array(r).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%r),u=Math.min(i,u+(r-1-u%r))}return{startIndex:c,endIndex:u}}const Du=typeof document<"u"?g.useLayoutEffect:g.useEffect;function Tg({useFlushSync:e=!0,...t}){const n=g.useReducer(i=>i+1,0)[1],r={...t,onChange:(i,a)=>{var l;e&&a?ao.flushSync(n):n(),(l=t.onChange)==null||l.call(t,i,a)}},[o]=g.useState(()=>new eT(r));return o.setOptions(r),Du(()=>o._didMount(),[]),Du(()=>o._willUpdate()),o}function nT(e){return Tg({observeElementRect:q3,observeElementOffset:K3,scrollToFn:Q3,...e})}function rT(e){return Tg({getScrollElement:()=>typeof document<"u"?window:null,observeElementRect:Z3,observeElementOffset:J3,scrollToFn:X3,initialOffset:()=>typeof document<"u"?window.scrollY:0,...e})}const oT=22,Ii=1e4;function sT(e){return e==="added"?"+":e==="removed"?"-":" "}function iT(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 aT=function({result:t,emptyLabel:n}){const[r,o]=g.useState("unified"),i=g.useRef(null),a=nT({count:t.lines.length,getScrollElement:()=>i.current,estimateSize:()=>oT,overscan:10});if(t.isEmpty)return s.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>Ii,u=c?t.lines.slice(0,Ii):t.lines;return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[s.jsxs("span",{children:[l.toLocaleString()," line",l===1?"":"s",c&&` (showing first ${Ii.toLocaleString()})`]}),s.jsxs("div",{className:"inline-flex rounded-md border border-border overflow-hidden",children:[s.jsxs("button",{type:"button",onClick:()=>o("unified"),"aria-pressed":r==="unified",className:me("flex items-center gap-1 px-2 py-1 transition-colors",r==="unified"?"bg-muted text-foreground":"hover:bg-muted/50"),title:"Unified diff (single column)",children:[s.jsx(kk,{className:"size-3"}),"Unified"]}),s.jsxs("button",{type:"button",onClick:()=>o("split"),"aria-pressed":r==="split",className:me("flex items-center gap-1 px-2 py-1 transition-colors border-l border-border",r==="split"?"bg-muted text-foreground":"hover:bg-muted/50"),title:"Split diff (side by side)",children:[s.jsx(Iw,{className:"size-3"}),"Split"]})]})]}),s.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:r==="unified"?s.jsx(lT,{virtualizer:a,lines:u}):s.jsx(dT,{lines:u})})]})};function lT({virtualizer:e,lines:t}){return s.jsx("div",{style:{height:`${e.getTotalSize()}px`,width:"100%",position:"relative"},children:e.getVirtualItems().map(n=>{const r=t[n.index];return r===void 0?null:s.jsxs("div",{"data-index":n.index,ref:e.measureElement,className:me("flex items-start gap-3 px-2",iT(r.kind)),style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${n.start}px)`},children:[s.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:r.oldLineNumber??""}),s.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:r.newLineNumber??""}),s.jsx("span",{className:me("select-none w-3 text-right font-bold",r.kind==="added"&&"text-green-600 dark:text-green-400",r.kind==="removed"&&"text-red-600 dark:text-red-400"),children:sT(r.kind)}),s.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:r.text})]},n.key)})})}function cT(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if(r===void 0)break;if(r.kind==="context"){t.push({left:{text:r.text,lineNumber:r.oldLineNumber},right:{text:r.text,lineNumber:r.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 uT(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 dT({lines:e}){const t=cT(e);return s.jsx("div",{"data-testid":"diff-split",children:t.map((n,r)=>s.jsxs("div",{className:me("grid grid-cols-2 font-mono text-xs",uT(n.kind)),children:[s.jsxs("div",{className:"flex items-start gap-2 px-2 border-r border-border/50",children:[s.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.left?.lineNumber??""}),s.jsx("span",{className:me("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?"-":" "}),s.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.left?.text??""})]}),s.jsxs("div",{className:"flex items-start gap-2 px-2",children:[s.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.right?.lineNumber??""}),s.jsx("span",{className:me("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?"+":" "}),s.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.right?.text??""})]})]},r))})}const Ag=g.memo(aT),fT={success:"bg-emerald-500/15 text-emerald-400 border-emerald-500/25",client_error:"bg-amber-500/15 text-amber-400 border-amber-500/25",server_error:"bg-rose-500/15 text-rose-400 border-rose-500/25",pending:"bg-muted text-muted-foreground border-border"},Rr="size-8 border-white/10 bg-[#0a0d11] text-muted-foreground shadow-none hover:border-cyan-300/30 hover:bg-cyan-400/10 hover:text-cyan-100";function Mo(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function pT(e){return e>=10?`${e.toFixed(0)}/s`:`${e.toFixed(1)}/s`}function Fu({trend:e}){if(e===null)return null;const t=e.direction==="up",n=t?K2:H2,r=t?"+":"-";return s.jsxs("span",{className:"flex items-center gap-0.5 text-muted-foreground tabular-nums",children:[s.jsx(n,{className:t?"size-3 text-emerald-400":"size-3 text-rose-400"}),s.jsxs("span",{className:"font-mono",children:[r,Ve(e.delta)]})]})}const hT=g.memo(function({log:e,messageCount:t=null,toolCount:n=null,expanded:r,onToggle:o,cacheTrend:i=null,activeTab:a,tabActions:l,onReplay:c,slowResponseThresholdSeconds:u=0,timeDisplayFormat:d}){const f=cS(e.responseStatus),h=e.elapsedMs!==null&&u>0&&e.elapsedMs>u*1e3,p=e.inputTokens!==null||e.outputTokens!==null,y=e.firstChunkMs??null,m=e.tokensPerSecond??null,x=y===null?null:Mo(y),b=m===null||m<=0?null:pT(m),v=e.warnings?.length??0;return s.jsx(ot,{children:s.jsxs("div",{id:`log-${e.id}`,role:"button",tabIndex:0,"data-nav-id":`log-${e.id}`,"data-nav-action":r?"collapse":"expand",className:me("flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 px-3 py-1.5 cursor-pointer transition-colors",r?"bg-[#0c1015]":"hover:bg-muted/30","select-none","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),onClick:o,onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),o())},children:[s.jsxs("span",{className:"text-blue-400/80 font-mono text-xs font-semibold tabular-nums shrink-0",children:["#",e.id]}),s.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[s.jsx(wn,{className:"size-3"}),s.jsx("span",{className:"font-mono tabular-nums",title:e.timestamp,children:fa(e.timestamp,d)})]}),e.model!==null&&s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsx("span",{className:"shrink-0",children:s.jsx(yg,{provider:bg(e.model),className:"size-4"})})}),s.jsx(Ue,{children:e.model})]}),f!=="success"&&s.jsxs(He,{variant:"outline",className:me("text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums gap-1",fT[f]),children:[f==="server_error"?s.jsx(pk,{className:"size-3","aria-label":"Server error"}):f==="client_error"?s.jsx(Pn,{className:"size-3","aria-label":"Client error"}):f==="pending"?s.jsx(Tt,{className:"size-3 animate-spin","aria-label":"Pending"}):null,e.responseStatus]}),v>0&&s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsxs(He,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums gap-1 bg-amber-500/15 text-amber-400 border-amber-500/25",children:[s.jsx(Pn,{className:"size-3","aria-label":"Tool schema warnings"}),v]})}),s.jsx(Ue,{children:v===1?"1 tool schema warning":`${v} tool schema warnings`})]}),e.elapsedMs!==null&&s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsxs("span",{className:me("flex items-center gap-1 text-xs shrink-0",h?"text-amber-400":"text-muted-foreground"),children:[s.jsx(wn,{className:"size-3"}),s.jsx("span",{className:"font-mono tabular-nums",children:Mo(e.elapsedMs)}),h&&s.jsx(Pn,{className:"size-3","aria-label":"Slow response"})]})}),s.jsx(Ue,{children:h?`Slow response: ${Mo(e.elapsedMs)} exceeds ${Mo(u*1e3)}`:e.streaming?"Total streaming response time":"Elapsed response time"})]}),e.streaming&&x!==null&&s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsxs("span",{className:"flex items-center gap-1 text-xs text-cyan-400 shrink-0",children:[s.jsx(Vc,{className:"size-3"}),s.jsxs("span",{className:"font-mono tabular-nums",children:["first ",x]})]})}),s.jsx(Ue,{children:"Time to first streaming chunk"})]}),e.streaming&&b!==null&&s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsxs("span",{className:"flex items-center gap-1 text-xs text-emerald-400 shrink-0",children:[s.jsx(vl,{className:"size-3"}),s.jsx("span",{className:"font-mono tabular-nums",children:b})]})}),s.jsx(Ue,{children:"Output token throughput after first chunk"})]}),p&&s.jsxs("span",{className:"flex min-w-0 items-center gap-1 text-xs sm:shrink-0",children:[s.jsx(to,{className:"size-3 text-muted-foreground"}),s.jsxs("span",{className:"flex min-w-0 flex-wrap items-center gap-x-1 font-mono tabular-nums",children:[s.jsxs("span",{className:me("whitespace-nowrap",e.inputTokens!==null?"text-blue-400":"text-muted-foreground"),children:["IN ",e.inputTokens!==null?Ve(e.inputTokens):"—"]}),s.jsx("span",{className:"text-muted-foreground",children:"/"}),s.jsxs("span",{className:me("whitespace-nowrap",e.outputTokens!==null?"text-amber-400":"text-muted-foreground"),children:["OUT ",e.outputTokens!==null?Ve(e.outputTokens):"—"]})]})]}),e.cacheCreationInputTokens!==null&&e.cacheCreationInputTokens>0&&s.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[s.jsx(Fu,{trend:i?.creation??null}),s.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["KV Cache +",Ve(e.cacheCreationInputTokens)]})]}),e.cacheReadInputTokens!==null&&e.cacheReadInputTokens>0&&s.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[s.jsx(Fu,{trend:i?.read??null}),s.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["KV Cache ~",Ve(e.cacheReadInputTokens)]})]}),t!==null&&s.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[s.jsx($s,{className:"size-3"}),s.jsx("span",{className:"font-mono tabular-nums",children:t})]}),n!==null&&s.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[s.jsx(co,{className:"size-3"}),s.jsx("span",{className:"font-mono tabular-nums",children:n})]}),e.origin!==null&&s.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:`Origin: ${e.origin}`,children:[s.jsx(Cp,{className:"size-3"}),s.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",title:e.origin,children:e.origin})]}),(e.clientPid!==null||e.clientProjectFolder!==null)&&s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-purple-400/80 text-xs shrink-0",children:[s.jsx(qw,{className:"size-3"}),e.clientProjectFolder!==null?s.jsx("span",{className:"font-mono tabular-nums",children:e.clientProjectFolder}):s.jsxs("span",{className:"font-mono tabular-nums",children:["PID ",e.clientPid]})]})}),s.jsx(Ue,{children:e.clientCwd!==null?`PID: ${e.clientPid??"?"} CWD: ${e.clientCwd}`:`Process ID: ${e.clientPid??"?"}`})]}),e.streaming&&s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsx(Vc,{className:"size-3 text-muted-foreground/60 shrink-0"})}),s.jsx(Ue,{children:"Request used SSE streaming"})]}),s.jsx("span",{className:"flex-1 min-w-0"}),r&&s.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",onClick:w=>w.stopPropagation(),onKeyDown:w=>w.stopPropagation(),children:[l!==void 0&&a!==void 0&&(()=>{const w=l[a];return w===void 0?null:s.jsxs(s.Fragment,{children:[w.expansion!==null&&s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsx(Ne,{variant:"outline",size:"icon",className:Rr,onClick:w.expansion.onToggle,disabled:w.expansion.isPending,"aria-pressed":w.expansion.isExpanded,"aria-label":w.expansion.isExpanded?"Collapse all JSON":"Expand all JSON",children:w.expansion.isExpanded?s.jsx(pw,{className:"size-3.5"}):s.jsx(_p,{className:"size-3.5"})})}),s.jsx(Ue,{children:w.expansion.isExpanded?"Collapse all JSON nodes":"Expand all JSON nodes"})]}),w.diffWithRaw!==void 0&&s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsx(Ne,{variant:"outline",size:"icon",className:me(Rr,w.diffWithRaw.active&&"border-cyan-300/35 bg-cyan-400/15 text-cyan-100"),onClick:w.diffWithRaw.onToggle,"aria-pressed":w.diffWithRaw.active,"aria-label":w.diffWithRaw.active?"Hide raw diff":"Diff with raw",children:s.jsx(Uw,{className:"size-3.5"})})}),s.jsx(Ue,{children:w.diffWithRaw.active?"Hide diff with raw request":"Show diff between displayed and raw request body"})]}),w.diffWithPrevious!==void 0&&s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsx(Ne,{variant:"outline",size:"icon",className:Rr,onClick:w.diffWithPrevious,"aria-label":"Diff with previous",children:s.jsx(ek,{className:"size-3.5"})})}),s.jsx(Ue,{children:"Compare this request with the immediately preceding one"})]}),w.copyText!==null&&s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsx(Ne,{variant:"outline",size:"icon",className:Rr,onClick:w.onCopy,"aria-label":w.copyCopied?"Copied":w.copyLabel,children:w.copyCopied?s.jsx(tt,{className:"size-3.5 text-emerald-500"}):s.jsx(St,{className:"size-3.5"})})}),s.jsx(Ue,{children:w.copyCopied?"Copied to clipboard":w.copyLabel})]})]})})(),c!==void 0&&s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsx(Ne,{variant:"outline",size:"icon",className:Rr,onClick:c,"aria-label":"Replay request",children:s.jsx(yk,{className:"size-3.5"})})}),s.jsx(Ue,{children:"Re-send this request to the provider"})]})]}),r?s.jsx(gt,{className:"size-4 text-muted-foreground shrink-0"}):s.jsx(Ft,{className:"size-4 text-muted-foreground shrink-0"})]})})});function mT({...e}){return s.jsx(OS,{"data-slot":"collapsible",...e})}function V6({...e}){return s.jsx(Qp,{"data-slot":"collapsible-trigger",...e})}function gT({...e}){return s.jsx(eh,{"data-slot":"collapsible-content",...e})}function xT(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const bT=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,yT=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,vT={};function $u(e,t){return(vT.jsx?yT:bT).test(e)}const wT=/[ \t\n\f\r]/g;function kT(e){return typeof e=="object"?e.type==="text"?Bu(e.value):!1:Bu(e)}function Bu(e){return e.replace(wT,"")===""}class bo{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}bo.prototype.normal={};bo.prototype.property={};bo.prototype.space=void 0;function Ig(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new bo(n,r,t)}function Aa(e){return e.toLowerCase()}class xt{constructor(t,n){this.attribute=n,this.property=t}}xt.prototype.attribute="";xt.prototype.booleanish=!1;xt.prototype.boolean=!1;xt.prototype.commaOrSpaceSeparated=!1;xt.prototype.commaSeparated=!1;xt.prototype.defined=!1;xt.prototype.mustUseProperty=!1;xt.prototype.number=!1;xt.prototype.overloadedBoolean=!1;xt.prototype.property="";xt.prototype.spaceSeparated=!1;xt.prototype.space=void 0;let _T=0;const Ie=Zn(),et=Zn(),Ia=Zn(),he=Zn(),qe=Zn(),ur=Zn(),bt=Zn();function Zn(){return 2**++_T}const za=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ie,booleanish:et,commaOrSpaceSeparated:bt,commaSeparated:ur,number:he,overloadedBoolean:Ia,spaceSeparated:qe},Symbol.toStringTag,{value:"Module"})),zi=Object.keys(za);class Ql extends xt{constructor(t,n,r,o){let i=-1;if(super(t,n),Uu(this,"space",o),typeof r=="number")for(;++i<zi.length;){const a=zi[i];Uu(this,zi[i],(r&za[a])===za[a])}}}Ql.prototype.defined=!0;function Uu(e,t,n){n&&(e[t]=n)}function Er(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const i=new Ql(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Aa(r)]=r,n[Aa(i.attribute)]=r}return new bo(t,n,e.space)}const zg=Er({properties:{ariaActiveDescendant:null,ariaAtomic:et,ariaAutoComplete:null,ariaBusy:et,ariaChecked:et,ariaColCount:he,ariaColIndex:he,ariaColSpan:he,ariaControls:qe,ariaCurrent:null,ariaDescribedBy:qe,ariaDetails:null,ariaDisabled:et,ariaDropEffect:qe,ariaErrorMessage:null,ariaExpanded:et,ariaFlowTo:qe,ariaGrabbed:et,ariaHasPopup:null,ariaHidden:et,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:qe,ariaLevel:he,ariaLive:null,ariaModal:et,ariaMultiLine:et,ariaMultiSelectable:et,ariaOrientation:null,ariaOwns:qe,ariaPlaceholder:null,ariaPosInSet:he,ariaPressed:et,ariaReadOnly:et,ariaRelevant:null,ariaRequired:et,ariaRoleDescription:qe,ariaRowCount:he,ariaRowIndex:he,ariaRowSpan:he,ariaSelected:et,ariaSetSize:he,ariaSort:null,ariaValueMax:he,ariaValueMin:he,ariaValueNow:he,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Rg(e,t){return t in e?e[t]:t}function Pg(e,t){return Rg(e,t.toLowerCase())}const ST=Er({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ur,acceptCharset:qe,accessKey:qe,action:null,allow:null,allowFullScreen:Ie,allowPaymentRequest:Ie,allowUserMedia:Ie,alt:null,as:null,async:Ie,autoCapitalize:null,autoComplete:qe,autoFocus:Ie,autoPlay:Ie,blocking:qe,capture:null,charSet:null,checked:Ie,cite:null,className:qe,cols:he,colSpan:null,content:null,contentEditable:et,controls:Ie,controlsList:qe,coords:he|ur,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ie,defer:Ie,dir:null,dirName:null,disabled:Ie,download:Ia,draggable:et,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ie,formTarget:null,headers:qe,height:he,hidden:Ia,high:he,href:null,hrefLang:null,htmlFor:qe,httpEquiv:qe,id:null,imageSizes:null,imageSrcSet:null,inert:Ie,inputMode:null,integrity:null,is:null,isMap:Ie,itemId:null,itemProp:qe,itemRef:qe,itemScope:Ie,itemType:qe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ie,low:he,manifest:null,max:null,maxLength:he,media:null,method:null,min:null,minLength:he,multiple:Ie,muted:Ie,name:null,nonce:null,noModule:Ie,noValidate:Ie,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ie,optimum:he,pattern:null,ping:qe,placeholder:null,playsInline:Ie,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ie,referrerPolicy:null,rel:qe,required:Ie,reversed:Ie,rows:he,rowSpan:he,sandbox:qe,scope:null,scoped:Ie,seamless:Ie,selected:Ie,shadowRootClonable:Ie,shadowRootDelegatesFocus:Ie,shadowRootMode:null,shape:null,size:he,sizes:null,slot:null,span:he,spellCheck:et,src:null,srcDoc:null,srcLang:null,srcSet:null,start:he,step:null,style:null,tabIndex:he,target:null,title:null,translate:null,type:null,typeMustMatch:Ie,useMap:null,value:et,width:he,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:qe,axis:null,background:null,bgColor:null,border:he,borderColor:null,bottomMargin:he,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ie,declare:Ie,event:null,face:null,frame:null,frameBorder:null,hSpace:he,leftMargin:he,link:null,longDesc:null,lowSrc:null,marginHeight:he,marginWidth:he,noResize:Ie,noHref:Ie,noShade:Ie,noWrap:Ie,object:null,profile:null,prompt:null,rev:null,rightMargin:he,rules:null,scheme:null,scrolling:et,standby:null,summary:null,text:null,topMargin:he,valueType:null,version:null,vAlign:null,vLink:null,vSpace:he,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ie,disableRemotePlayback:Ie,prefix:null,property:null,results:he,security:null,unselectable:null},space:"html",transform:Pg}),CT=Er({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:bt,accentHeight:he,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:he,amplitude:he,arabicForm:null,ascent:he,attributeName:null,attributeType:null,azimuth:he,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:he,by:null,calcMode:null,capHeight:he,className:qe,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:he,diffuseConstant:he,direction:null,display:null,dur:null,divisor:he,dominantBaseline:null,download:Ie,dx:null,dy:null,edgeMode:null,editable:null,elevation:he,enableBackground:null,end:null,event:null,exponent:he,externalResourcesRequired:null,fill:null,fillOpacity:he,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ur,g2:ur,glyphName:ur,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:he,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:he,horizOriginX:he,horizOriginY:he,id:null,ideographic:he,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:he,k:he,k1:he,k2:he,k3:he,k4:he,kernelMatrix:bt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:he,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:he,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:he,overlineThickness:he,paintOrder:null,panose1:null,path:null,pathLength:he,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:qe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:he,pointsAtY:he,pointsAtZ:he,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:bt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:bt,rev:bt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:bt,requiredFeatures:bt,requiredFonts:bt,requiredFormats:bt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:he,specularExponent:he,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:he,strikethroughThickness:he,string:null,stroke:null,strokeDashArray:bt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:he,strokeOpacity:he,strokeWidth:null,style:null,surfaceScale:he,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:bt,tabIndex:he,tableValues:null,target:null,targetX:he,targetY:he,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:bt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:he,underlineThickness:he,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:he,values:null,vAlphabetic:he,vMathematical:he,vectorEffect:null,vHanging:he,vIdeographic:he,version:null,vertAdvY:he,vertOriginX:he,vertOriginY:he,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:he,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Rg}),Og=Er({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Mg=Er({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Pg}),Lg=Er({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),jT={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},NT=/[A-Z]/g,Hu=/-[a-z]/g,ET=/^data[-\w.:]+$/i;function TT(e,t){const n=Aa(t);let r=t,o=xt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ET.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(Hu,IT);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!Hu.test(i)){let a=i.replace(NT,AT);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}o=Ql}return new o(r,t)}function AT(e){return"-"+e.toLowerCase()}function IT(e){return e.charAt(1).toUpperCase()}const zT=Ig([zg,ST,Og,Mg,Lg],"html"),ec=Ig([zg,CT,Og,Mg,Lg],"svg");function RT(e){return e.join(" ").trim()}var Qn={},Ri,Wu;function PT(){if(Wu)return Ri;Wu=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,l=/^\s+|\s+$/g,c=`
102
+ `,u="/",d="*",f="",h="comment",p="declaration";function y(x,b){if(typeof x!="string")throw new TypeError("First argument must be a string");if(!x)return[];b=b||{};var v=1,w=1;function C(k){var D=k.match(t);D&&(v+=D.length);var q=k.lastIndexOf(c);w=~q?k.length-q:w+k.length}function S(){var k={line:v,column:w};return function(D){return D.position=new j(k),z(),D}}function j(k){this.start=k,this.end={line:v,column:w},this.source=b.source}j.prototype.content=x;function N(k){var D=new Error(b.source+":"+v+":"+w+": "+k);if(D.reason=k,D.filename=b.source,D.line=v,D.column=w,D.source=x,!b.silent)throw D}function A(k){var D=k.exec(x);if(D){var q=D[0];return C(q),x=x.slice(q.length),D}}function z(){A(n)}function L(k){var D;for(k=k||[];D=U();)D!==!1&&k.push(D);return k}function U(){var k=S();if(!(u!=x.charAt(0)||d!=x.charAt(1))){for(var D=2;f!=x.charAt(D)&&(d!=x.charAt(D)||u!=x.charAt(D+1));)++D;if(D+=2,f===x.charAt(D-1))return N("End of comment missing");var q=x.slice(2,D-2);return w+=2,C(q),x=x.slice(D),w+=2,k({type:h,comment:q})}}function E(){var k=S(),D=A(r);if(D){if(U(),!A(o))return N("property missing ':'");var q=A(i),W=k({type:p,property:m(D[0].replace(e,f)),value:q?m(q[0].replace(e,f)):f});return A(a),W}}function O(){var k=[];L(k);for(var D;D=E();)D!==!1&&(k.push(D),L(k));return k}return z(),O()}function m(x){return x?x.replace(l,f):f}return Ri=y,Ri}var Vu;function OT(){if(Vu)return Qn;Vu=1;var e=Qn&&Qn.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Qn,"__esModule",{value:!0}),Qn.default=n;const t=e(PT());function n(r,o){let i=null;if(!r||typeof r!="string")return i;const a=(0,t.default)(r),l=typeof o=="function";return a.forEach(c=>{if(c.type!=="declaration")return;const{property:u,value:d}=c;l?o(u,d,c):d&&(i=i||{},i[u]=d)}),i}return Qn}var Pr={},qu;function MT(){if(qu)return Pr;qu=1,Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,i=function(u){return!u||n.test(u)||e.test(u)},a=function(u,d){return d.toUpperCase()},l=function(u,d){return"".concat(d,"-")},c=function(u,d){return d===void 0&&(d={}),i(u)?u:(u=u.toLowerCase(),d.reactCompat?u=u.replace(o,l):u=u.replace(r,l),u.replace(t,a))};return Pr.camelCase=c,Pr}var Or,Zu;function LT(){if(Zu)return Or;Zu=1;var e=Or&&Or.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(OT()),n=MT();function r(o,i){var a={};return!o||typeof o!="string"||(0,t.default)(o,function(l,c){l&&c&&(a[(0,n.camelCase)(l,i)]=c)}),a}return r.default=r,Or=r,Or}var DT=LT();const FT=Ya(DT),Dg=Fg("end"),tc=Fg("start");function Fg(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function $T(e){const t=tc(e),n=Dg(e);if(t&&n)return{start:t,end:n}}function qr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Gu(e.position):"start"in e||"end"in e?Gu(e):"line"in e||"column"in e?Ra(e):""}function Ra(e){return Ku(e&&e.line)+":"+Ku(e&&e.column)}function Gu(e){return Ra(e&&e.start)+"-"+Ra(e&&e.end)}function Ku(e){return e&&typeof e=="number"?e:1}class lt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?o=t:!i.cause&&t&&(a=!0,o=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=l?l.line:void 0,this.name=qr(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}lt.prototype.file="";lt.prototype.name="";lt.prototype.reason="";lt.prototype.message="";lt.prototype.stack="";lt.prototype.column=void 0;lt.prototype.line=void 0;lt.prototype.ancestors=void 0;lt.prototype.cause=void 0;lt.prototype.fatal=void 0;lt.prototype.place=void 0;lt.prototype.ruleId=void 0;lt.prototype.source=void 0;const nc={}.hasOwnProperty,BT=new Map,UT=/[A-Z]/g,HT=new Set(["table","tbody","thead","tfoot","tr"]),WT=new Set(["td","th"]),$g="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function VT(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=QT(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=XT(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?ec:zT,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=Bg(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function Bg(e,t,n){if(t.type==="element")return qT(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return ZT(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return KT(e,t,n);if(t.type==="mdxjsEsm")return GT(e,t);if(t.type==="root")return JT(e,t,n);if(t.type==="text")return YT(e,t)}function qT(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=ec,e.schema=o),e.ancestors.push(t);const i=Hg(e,t.tagName,!1),a=e4(e,t);let l=oc(e,t);return HT.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!kT(c):!0})),Ug(e,a,i,t),rc(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function ZT(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}io(e,t.position)}function GT(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);io(e,t.position)}function KT(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=ec,e.schema=o),e.ancestors.push(t);const i=t.name===null?e.Fragment:Hg(e,t.name,!0),a=t4(e,t),l=oc(e,t);return Ug(e,a,i,t),rc(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function JT(e,t,n){const r={};return rc(r,oc(e,t)),e.create(t,e.Fragment,r,n)}function YT(e,t){return t.value}function Ug(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function rc(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function XT(e,t,n){return r;function r(o,i,a,l){const u=Array.isArray(a.children)?n:t;return l?u(i,a,l):u(i,a)}}function QT(e,t){return n;function n(r,o,i,a){const l=Array.isArray(i.children),c=tc(r);return t(o,i,a,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function e4(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&nc.call(t.properties,o)){const i=n4(e,o,t.properties[o]);if(i){const[a,l]=i;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&WT.has(t.tagName)?r=l:n[a]=l}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function t4(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else io(e,t.position);else{const o=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else io(e,t.position);else i=r.value===null?!0:r.value;n[o]=i}return n}function oc(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:BT;for(;++r<t.children.length;){const i=t.children[r];let a;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const u=o.get(c)||0;a=c+"-"+u,o.set(c,u+1)}}const l=Bg(e,i,a);l!==void 0&&n.push(l)}return n}function n4(e,t,n){const r=TT(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?xT(n):RT(n)),r.property==="style"){let o=typeof n=="object"?n:r4(e,String(n));return e.stylePropertyNameCase==="css"&&(o=o4(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?jT[r.property]||r.property:r.attribute,n]}}function r4(e,t){try{return FT(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,o=new lt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=$g+"#cannot-parse-style-attribute",o}}function Hg(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let i=-1,a;for(;++i<o.length;){const l=$u(o[i])?{type:"Identifier",name:o[i]}:{type:"Literal",value:o[i]};a=a?{type:"MemberExpression",object:a,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=a}else r=$u(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return nc.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);io(e)}function io(e,t){const n=new lt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=$g+"#cannot-handle-mdx-estrees-without-createevaluater",n}function o4(e){const t={};let n;for(n in e)nc.call(e,n)&&(t[s4(n)]=e[n]);return t}function s4(e){let t=e.replace(UT,i4);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function i4(e){return"-"+e.toLowerCase()}const Pi={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},a4={};function l4(e,t){const n=a4,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Wg(e,r,o)}function Wg(e,t,n){if(c4(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Ju(e.children,t,n)}return Array.isArray(e)?Ju(e,t,n):""}function Ju(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=Wg(e[o],t,n);return r.join("")}function c4(e){return!!(e&&typeof e=="object")}const Yu=document.createElement("i");function sc(e){const t="&"+e+";";Yu.innerHTML=t;const n=Yu.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Yt(e,t,n,r){const o=e.length;let i=0,a;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);i<r.length;)a=r.slice(i,i+1e4),a.unshift(t,0),e.splice(...a),i+=1e4,t+=1e4}function Nt(e,t){return e.length>0?(Yt(e,e.length,0,t),e):t}const Xu={}.hasOwnProperty;function u4(e){const t={};let n=-1;for(;++n<e.length;)d4(t,e[n]);return t}function d4(e,t){let n;for(n in t){const o=(Xu.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let a;if(i)for(a in i){Xu.call(o,a)||(o[a]=[]);const l=i[a];f4(o[a],Array.isArray(l)?l:l?[l]:[])}}}function f4(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Yt(e,0,0,r)}function Vg(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function dr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const qt=Tn(/[A-Za-z]/),kt=Tn(/[\dA-Za-z]/),p4=Tn(/[#-'*+\--9=?A-Z^-~]/);function Pa(e){return e!==null&&(e<32||e===127)}const Oa=Tn(/\d/),h4=Tn(/[\dA-Fa-f]/),m4=Tn(/[!-/:-@[-`{-~]/);function je(e){return e!==null&&e<-2}function ht(e){return e!==null&&(e<0||e===32)}function De(e){return e===-2||e===-1||e===32}const g4=Tn(new RegExp("\\p{P}|\\p{S}","u")),x4=Tn(/\s/);function Tn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Tr(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const i=e.charCodeAt(n);let a="";if(i===37&&kt(e.charCodeAt(n+1))&&kt(e.charCodeAt(n+2)))o=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(a=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(a=String.fromCharCode(i,l),o=1):a="�"}else a=String.fromCharCode(i);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+o+1,a=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function Ze(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return De(c)?(e.enter(n),l(c)):t(c)}function l(c){return De(c)&&i++<o?(e.consume(c),l):(e.exit(n),t(c))}}const b4={tokenize:y4};function y4(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Ze(e,t,"linePrefix")}function o(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,a(l)}function a(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return je(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),a)}}const v4={tokenize:w4},Qu={tokenize:k4};function w4(e){const t=this,n=[];let r=0,o,i,a;return l;function l(w){if(r<n.length){const C=n[r];return t.containerState=C[1],e.attempt(C[0].continuation,c,u)(w)}return u(w)}function c(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&v();const C=t.events.length;let S=C,j;for(;S--;)if(t.events[S][0]==="exit"&&t.events[S][1].type==="chunkFlow"){j=t.events[S][1].end;break}b(r);let N=C;for(;N<t.events.length;)t.events[N][1].end={...j},N++;return Yt(t.events,S+1,0,t.events.slice(C)),t.events.length=N,u(w)}return l(w)}function u(w){if(r===n.length){if(!o)return h(w);if(o.currentConstruct&&o.currentConstruct.concrete)return y(w);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Qu,d,f)(w)}function d(w){return o&&v(),b(r),h(w)}function f(w){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,y(w)}function h(w){return t.containerState={},e.attempt(Qu,p,y)(w)}function p(w){return r++,n.push([t.currentConstruct,t.containerState]),h(w)}function y(w){if(w===null){o&&v(),b(0),e.consume(w);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:i}),m(w)}function m(w){if(w===null){x(e.exit("chunkFlow"),!0),b(0),e.consume(w);return}return je(w)?(e.consume(w),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(w),m)}function x(w,C){const S=t.sliceStream(w);if(C&&S.push(null),w.previous=i,i&&(i.next=w),i=w,o.defineSkip(w.start),o.write(S),t.parser.lazy[w.start.line]){let j=o.events.length;for(;j--;)if(o.events[j][1].start.offset<a&&(!o.events[j][1].end||o.events[j][1].end.offset>a))return;const N=t.events.length;let A=N,z,L;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){if(z){L=t.events[A][1].end;break}z=!0}for(b(r),j=N;j<t.events.length;)t.events[j][1].end={...L},j++;Yt(t.events,A+1,0,t.events.slice(N)),t.events.length=j}}function b(w){let C=n.length;for(;C-- >w;){const S=n[C];t.containerState=S[1],S[0].exit.call(t,e)}n.length=w}function v(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function k4(e,t,n){return Ze(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ed(e){if(e===null||ht(e)||x4(e))return 1;if(g4(e))return 2}function ic(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const i=e[o].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const Ma={name:"attention",resolveAll:_4,tokenize:S4};function _4(e,t){let n=-1,r,o,i,a,l,c,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},h={...e[n][1].start};td(f,-c),td(h,c),a={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:h},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},e[r][1].end={...a.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Nt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Nt(u,[["enter",o,t],["enter",a,t],["exit",a,t],["enter",i,t]]),u=Nt(u,ic(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Nt(u,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Nt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Yt(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function S4(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=ed(r);let i;return a;function a(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const u=e.exit("attentionSequence"),d=ed(c),f=!d||d===2&&o||n.includes(c),h=!o||o===2&&d||n.includes(r);return u._open=!!(i===42?f:f&&(o||!h)),u._close=!!(i===42?h:h&&(d||!f)),t(c)}}function td(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const C4={name:"autolink",tokenize:j4};function j4(e,t,n){let r=0;return o;function o(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return qt(p)?(e.consume(p),a):p===64?n(p):u(p)}function a(p){return p===43||p===45||p===46||kt(p)?(r=1,l(p)):u(p)}function l(p){return p===58?(e.consume(p),r=0,c):(p===43||p===45||p===46||kt(p))&&r++<32?(e.consume(p),l):(r=0,u(p))}function c(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||Pa(p)?n(p):(e.consume(p),c)}function u(p){return p===64?(e.consume(p),d):p4(p)?(e.consume(p),u):n(p)}function d(p){return kt(p)?f(p):n(p)}function f(p){return p===46?(e.consume(p),r=0,d):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):h(p)}function h(p){if((p===45||kt(p))&&r++<63){const y=p===45?h:f;return e.consume(p),y}return n(p)}}const li={partial:!0,tokenize:N4};function N4(e,t,n){return r;function r(i){return De(i)?Ze(e,o,"linePrefix")(i):o(i)}function o(i){return i===null||je(i)?t(i):n(i)}}const qg={continuation:{tokenize:T4},exit:A4,name:"blockQuote",tokenize:E4};function E4(e,t,n){const r=this;return o;function o(a){if(a===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),i}return n(a)}function i(a){return De(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function T4(e,t,n){const r=this;return o;function o(a){return De(a)?Ze(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(qg,t,n)(a)}}function A4(e){e.exit("blockQuote")}const Zg={name:"characterEscape",tokenize:I4};function I4(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),o}function o(i){return m4(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Gg={name:"characterReference",tokenize:z4};function z4(e,t,n){const r=this;let o=0,i,a;return l;function l(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),c}function c(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,a=kt,d(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,a=h4,d):(e.enter("characterReferenceValue"),i=7,a=Oa,d(f))}function d(f){if(f===59&&o){const h=e.exit("characterReferenceValue");return a===kt&&!sc(r.sliceSerialize(h))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(f)&&o++<i?(e.consume(f),d):n(f)}}const nd={partial:!0,tokenize:P4},rd={concrete:!0,name:"codeFenced",tokenize:R4};function R4(e,t,n){const r=this,o={partial:!0,tokenize:S};let i=0,a=0,l;return c;function c(j){return u(j)}function u(j){const N=r.events[r.events.length-1];return i=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,l=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(j)}function d(j){return j===l?(a++,e.consume(j),d):a<3?n(j):(e.exit("codeFencedFenceSequence"),De(j)?Ze(e,f,"whitespace")(j):f(j))}function f(j){return j===null||je(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(nd,m,C)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),h(j))}function h(j){return j===null||je(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(j)):De(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ze(e,p,"whitespace")(j)):j===96&&j===l?n(j):(e.consume(j),h)}function p(j){return j===null||je(j)?f(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(j))}function y(j){return j===null||je(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(j)):j===96&&j===l?n(j):(e.consume(j),y)}function m(j){return e.attempt(o,C,x)(j)}function x(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),b}function b(j){return i>0&&De(j)?Ze(e,v,"linePrefix",i+1)(j):v(j)}function v(j){return j===null||je(j)?e.check(nd,m,C)(j):(e.enter("codeFlowValue"),w(j))}function w(j){return j===null||je(j)?(e.exit("codeFlowValue"),v(j)):(e.consume(j),w)}function C(j){return e.exit("codeFenced"),t(j)}function S(j,N,A){let z=0;return L;function L(D){return j.enter("lineEnding"),j.consume(D),j.exit("lineEnding"),U}function U(D){return j.enter("codeFencedFence"),De(D)?Ze(j,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):E(D)}function E(D){return D===l?(j.enter("codeFencedFenceSequence"),O(D)):A(D)}function O(D){return D===l?(z++,j.consume(D),O):z>=a?(j.exit("codeFencedFenceSequence"),De(D)?Ze(j,k,"whitespace")(D):k(D)):A(D)}function k(D){return D===null||je(D)?(j.exit("codeFencedFence"),N(D)):A(D)}}}function P4(e,t,n){const r=this;return o;function o(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const Oi={name:"codeIndented",tokenize:M4},O4={partial:!0,tokenize:L4};function M4(e,t,n){const r=this;return o;function o(u){return e.enter("codeIndented"),Ze(e,i,"linePrefix",5)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?c(u):je(u)?e.attempt(O4,a,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||je(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function L4(e,t,n){const r=this;return o;function o(a){return r.parser.lazy[r.now().line]?n(a):je(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):Ze(e,i,"linePrefix",5)(a)}function i(a){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):je(a)?o(a):n(a)}}const D4={name:"codeText",previous:$4,resolve:F4,tokenize:B4};function F4(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function $4(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function B4(e,t,n){let r=0,o,i;return a;function a(f){return e.enter("codeText"),e.enter("codeTextSequence"),l(f)}function l(f){return f===96?(e.consume(f),r++,l):(e.exit("codeTextSequence"),c(f))}function c(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),c):f===96?(i=e.enter("codeTextSequence"),o=0,d(f)):je(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||je(f)?(e.exit("codeTextData"),c(f)):(e.consume(f),u)}function d(f){return f===96?(e.consume(f),o++,d):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",u(f))}}class U4{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const o=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&Mr(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Mr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Mr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Mr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Mr(this.left,n.reverse())}}}function Mr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Kg(e){const t={};let n=-1,r,o,i,a,l,c,u;const d=new U4(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,H4(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,o=void 0;i--;)if(a=d.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(o&&(d.get(o)[1].type="lineEndingBlank"),a[1].type="lineEnding",o=i);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;o&&(r[1].end={...d.get(o)[1].start},l=d.slice(o,n),l.unshift(r),d.splice(o,n-o+1,l))}}return Yt(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function H4(e,t){const n=e.get(t)[1],r=e.get(t)[2];let o=t-1;const i=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const l=a.events,c=[],u={};let d,f,h=-1,p=n,y=0,m=0;const x=[m];for(;p;){for(;e.get(++o)[1]!==p;);i.push(o),p._tokenizer||(d=r.sliceStream(p),p.next||d.push(null),f&&a.defineSkip(p.start),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(d),p._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),f=p,p=p.next}for(p=n;++h<l.length;)l[h][0]==="exit"&&l[h-1][0]==="enter"&&l[h][1].type===l[h-1][1].type&&l[h][1].start.line!==l[h][1].end.line&&(m=h+1,x.push(m),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(a.events=[],p?(p._tokenizer=void 0,p.previous=void 0):x.pop(),h=x.length;h--;){const b=l.slice(x[h],x[h+1]),v=i.pop();c.push([v,v+b.length-1]),e.splice(v,2,b)}for(c.reverse(),h=-1;++h<c.length;)u[y+c[h][0]]=y+c[h][1],y+=c[h][1]-c[h][0]-1;return u}const W4={resolve:q4,tokenize:Z4},V4={partial:!0,tokenize:G4};function q4(e){return Kg(e),e}function Z4(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(l)}function o(l){return l===null?i(l):je(l)?e.check(V4,a,i)(l):(e.consume(l),o)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function a(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function G4(e,t,n){const r=this;return o;function o(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Ze(e,i,"linePrefix")}function i(a){if(a===null||je(a))return n(a);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function Jg(e,t,n,r,o,i,a,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(b){return b===60?(e.enter(r),e.enter(o),e.enter(i),e.consume(b),e.exit(i),h):b===null||b===32||b===41||Pa(b)?n(b):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),m(b))}function h(b){return b===62?(e.enter(i),e.consume(b),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),p(b))}function p(b){return b===62?(e.exit("chunkString"),e.exit(l),h(b)):b===null||b===60||je(b)?n(b):(e.consume(b),b===92?y:p)}function y(b){return b===60||b===62||b===92?(e.consume(b),p):p(b)}function m(b){return!d&&(b===null||b===41||ht(b))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(b)):d<u&&b===40?(e.consume(b),d++,m):b===41?(e.consume(b),d--,m):b===null||b===32||b===40||Pa(b)?n(b):(e.consume(b),b===92?x:m)}function x(b){return b===40||b===41||b===92?(e.consume(b),m):m(b)}}function Yg(e,t,n,r,o,i){const a=this;let l=0,c;return u;function u(p){return e.enter(r),e.enter(o),e.consume(p),e.exit(o),e.enter(i),d}function d(p){return l>999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(p):p===93?(e.exit(i),e.enter(o),e.consume(p),e.exit(o),e.exit(r),t):je(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||je(p)||l++>999?(e.exit("chunkString"),d(p)):(e.consume(p),c||(c=!De(p)),p===92?h:f)}function h(p){return p===91||p===92||p===93?(e.consume(p),l++,f):f(p)}}function Xg(e,t,n,r,o,i){let a;return l;function l(h){return h===34||h===39||h===40?(e.enter(r),e.enter(o),e.consume(h),e.exit(o),a=h===40?41:h,c):n(h)}function c(h){return h===a?(e.enter(o),e.consume(h),e.exit(o),e.exit(r),t):(e.enter(i),u(h))}function u(h){return h===a?(e.exit(i),c(a)):h===null?n(h):je(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),Ze(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===a||h===null||je(h)?(e.exit("chunkString"),u(h)):(e.consume(h),h===92?f:d)}function f(h){return h===a||h===92?(e.consume(h),d):d(h)}}function Zr(e,t){let n;return r;function r(o){return je(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):De(o)?Ze(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const K4={name:"definition",tokenize:Y4},J4={partial:!0,tokenize:X4};function Y4(e,t,n){const r=this;let o;return i;function i(p){return e.enter("definition"),a(p)}function a(p){return Yg.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return o=dr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),c):n(p)}function c(p){return ht(p)?Zr(e,u)(p):u(p)}function u(p){return Jg(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return e.attempt(J4,f,f)(p)}function f(p){return De(p)?Ze(e,h,"whitespace")(p):h(p)}function h(p){return p===null||je(p)?(e.exit("definition"),r.parser.defined.push(o),t(p)):n(p)}}function X4(e,t,n){return r;function r(l){return ht(l)?Zr(e,o)(l):n(l)}function o(l){return Xg(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return De(l)?Ze(e,a,"whitespace")(l):a(l)}function a(l){return l===null||je(l)?t(l):n(l)}}const Q4={name:"hardBreakEscape",tokenize:eA};function eA(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),o}function o(i){return je(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const tA={name:"headingAtx",resolve:nA,tokenize:rA};function nA(e,t){let n=e.length-2,r=3,o,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Yt(e,r,n-r+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function rA(e,t,n){let r=0;return o;function o(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(e.consume(d),a):d===null||ht(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||je(d)?(e.exit("atxHeading"),t(d)):De(d)?Ze(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||ht(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const oA=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],od=["pre","script","style","textarea"],sA={concrete:!0,name:"htmlFlow",resolveTo:lA,tokenize:cA},iA={partial:!0,tokenize:dA},aA={partial:!0,tokenize:uA};function lA(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function cA(e,t,n){const r=this;let o,i,a,l,c;return u;function u(R){return d(R)}function d(R){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(R),f}function f(R){return R===33?(e.consume(R),h):R===47?(e.consume(R),i=!0,m):R===63?(e.consume(R),o=3,r.interrupt?t:I):qt(R)?(e.consume(R),a=String.fromCharCode(R),x):n(R)}function h(R){return R===45?(e.consume(R),o=2,p):R===91?(e.consume(R),o=5,l=0,y):qt(R)?(e.consume(R),o=4,r.interrupt?t:I):n(R)}function p(R){return R===45?(e.consume(R),r.interrupt?t:I):n(R)}function y(R){const ae="CDATA[";return R===ae.charCodeAt(l++)?(e.consume(R),l===ae.length?r.interrupt?t:E:y):n(R)}function m(R){return qt(R)?(e.consume(R),a=String.fromCharCode(R),x):n(R)}function x(R){if(R===null||R===47||R===62||ht(R)){const ae=R===47,de=a.toLowerCase();return!ae&&!i&&od.includes(de)?(o=1,r.interrupt?t(R):E(R)):oA.includes(a.toLowerCase())?(o=6,ae?(e.consume(R),b):r.interrupt?t(R):E(R)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(R):i?v(R):w(R))}return R===45||kt(R)?(e.consume(R),a+=String.fromCharCode(R),x):n(R)}function b(R){return R===62?(e.consume(R),r.interrupt?t:E):n(R)}function v(R){return De(R)?(e.consume(R),v):L(R)}function w(R){return R===47?(e.consume(R),L):R===58||R===95||qt(R)?(e.consume(R),C):De(R)?(e.consume(R),w):L(R)}function C(R){return R===45||R===46||R===58||R===95||kt(R)?(e.consume(R),C):S(R)}function S(R){return R===61?(e.consume(R),j):De(R)?(e.consume(R),S):w(R)}function j(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),c=R,N):De(R)?(e.consume(R),j):A(R)}function N(R){return R===c?(e.consume(R),c=null,z):R===null||je(R)?n(R):(e.consume(R),N)}function A(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||ht(R)?S(R):(e.consume(R),A)}function z(R){return R===47||R===62||De(R)?w(R):n(R)}function L(R){return R===62?(e.consume(R),U):n(R)}function U(R){return R===null||je(R)?E(R):De(R)?(e.consume(R),U):n(R)}function E(R){return R===45&&o===2?(e.consume(R),q):R===60&&o===1?(e.consume(R),W):R===62&&o===4?(e.consume(R),K):R===63&&o===3?(e.consume(R),I):R===93&&o===5?(e.consume(R),J):je(R)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(iA,Z,O)(R)):R===null||je(R)?(e.exit("htmlFlowData"),O(R)):(e.consume(R),E)}function O(R){return e.check(aA,k,Z)(R)}function k(R){return e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),D}function D(R){return R===null||je(R)?O(R):(e.enter("htmlFlowData"),E(R))}function q(R){return R===45?(e.consume(R),I):E(R)}function W(R){return R===47?(e.consume(R),a="",B):E(R)}function B(R){if(R===62){const ae=a.toLowerCase();return od.includes(ae)?(e.consume(R),K):E(R)}return qt(R)&&a.length<8?(e.consume(R),a+=String.fromCharCode(R),B):E(R)}function J(R){return R===93?(e.consume(R),I):E(R)}function I(R){return R===62?(e.consume(R),K):R===45&&o===2?(e.consume(R),I):E(R)}function K(R){return R===null||je(R)?(e.exit("htmlFlowData"),Z(R)):(e.consume(R),K)}function Z(R){return e.exit("htmlFlow"),t(R)}}function uA(e,t,n){const r=this;return o;function o(a){return je(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function dA(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(li,t,n)}}const fA={name:"htmlText",tokenize:pA};function pA(e,t,n){const r=this;let o,i,a;return l;function l(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),c}function c(I){return I===33?(e.consume(I),u):I===47?(e.consume(I),S):I===63?(e.consume(I),w):qt(I)?(e.consume(I),A):n(I)}function u(I){return I===45?(e.consume(I),d):I===91?(e.consume(I),i=0,y):qt(I)?(e.consume(I),v):n(I)}function d(I){return I===45?(e.consume(I),p):n(I)}function f(I){return I===null?n(I):I===45?(e.consume(I),h):je(I)?(a=f,W(I)):(e.consume(I),f)}function h(I){return I===45?(e.consume(I),p):f(I)}function p(I){return I===62?q(I):I===45?h(I):f(I)}function y(I){const K="CDATA[";return I===K.charCodeAt(i++)?(e.consume(I),i===K.length?m:y):n(I)}function m(I){return I===null?n(I):I===93?(e.consume(I),x):je(I)?(a=m,W(I)):(e.consume(I),m)}function x(I){return I===93?(e.consume(I),b):m(I)}function b(I){return I===62?q(I):I===93?(e.consume(I),b):m(I)}function v(I){return I===null||I===62?q(I):je(I)?(a=v,W(I)):(e.consume(I),v)}function w(I){return I===null?n(I):I===63?(e.consume(I),C):je(I)?(a=w,W(I)):(e.consume(I),w)}function C(I){return I===62?q(I):w(I)}function S(I){return qt(I)?(e.consume(I),j):n(I)}function j(I){return I===45||kt(I)?(e.consume(I),j):N(I)}function N(I){return je(I)?(a=N,W(I)):De(I)?(e.consume(I),N):q(I)}function A(I){return I===45||kt(I)?(e.consume(I),A):I===47||I===62||ht(I)?z(I):n(I)}function z(I){return I===47?(e.consume(I),q):I===58||I===95||qt(I)?(e.consume(I),L):je(I)?(a=z,W(I)):De(I)?(e.consume(I),z):q(I)}function L(I){return I===45||I===46||I===58||I===95||kt(I)?(e.consume(I),L):U(I)}function U(I){return I===61?(e.consume(I),E):je(I)?(a=U,W(I)):De(I)?(e.consume(I),U):z(I)}function E(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),o=I,O):je(I)?(a=E,W(I)):De(I)?(e.consume(I),E):(e.consume(I),k)}function O(I){return I===o?(e.consume(I),o=void 0,D):I===null?n(I):je(I)?(a=O,W(I)):(e.consume(I),O)}function k(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||ht(I)?z(I):(e.consume(I),k)}function D(I){return I===47||I===62||ht(I)?z(I):n(I)}function q(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function W(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),B}function B(I){return De(I)?Ze(e,J,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):J(I)}function J(I){return e.enter("htmlTextData"),a(I)}}const ac={name:"labelEnd",resolveAll:xA,resolveTo:bA,tokenize:yA},hA={tokenize:vA},mA={tokenize:wA},gA={tokenize:kA};function xA(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==n.length&&Yt(e,0,e.length,n),e}function bA(e,t){let n=e.length,r=0,o,i,a,l;for(;n--;)if(o=e[n][1],i){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(i=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(a=n);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[a][1].end}},d={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return l=[["enter",c,t],["enter",u,t]],l=Nt(l,e.slice(i+1,i+r+3)),l=Nt(l,[["enter",d,t]]),l=Nt(l,ic(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),l=Nt(l,[["exit",d,t],e[a-2],e[a-1],["exit",u,t]]),l=Nt(l,e.slice(a+1)),l=Nt(l,[["exit",c,t]]),Yt(e,i,e.length,l),e}function yA(e,t,n){const r=this;let o=r.events.length,i,a;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){i=r.events[o][1];break}return l;function l(h){return i?i._inactive?f(h):(a=r.parser.defined.includes(dr(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelEnd"),c):n(h)}function c(h){return h===40?e.attempt(hA,d,a?d:f)(h):h===91?e.attempt(mA,d,a?u:f)(h):a?d(h):f(h)}function u(h){return e.attempt(gA,d,f)(h)}function d(h){return t(h)}function f(h){return i._balanced=!0,n(h)}}function vA(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),o}function o(f){return ht(f)?Zr(e,i)(f):i(f)}function i(f){return f===41?d(f):Jg(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function a(f){return ht(f)?Zr(e,c)(f):d(f)}function l(f){return n(f)}function c(f){return f===34||f===39||f===40?Xg(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return ht(f)?Zr(e,d)(f):d(f)}function d(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function wA(e,t,n){const r=this;return o;function o(l){return Yg.call(r,e,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(dr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function kA(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),o}function o(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const _A={name:"labelStartImage",resolveAll:ac.resolveAll,tokenize:SA};function SA(e,t,n){const r=this;return o;function o(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),a):n(l)}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const CA={name:"labelStartLink",resolveAll:ac.resolveAll,tokenize:jA};function jA(e,t,n){const r=this;return o;function o(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),i}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Mi={name:"lineEnding",tokenize:NA};function NA(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ze(e,t,"linePrefix")}}const ts={name:"thematicBreak",tokenize:EA};function EA(e,t,n){let r=0,o;return i;function i(u){return e.enter("thematicBreak"),a(u)}function a(u){return o=u,l(u)}function l(u){return u===o?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||je(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===o?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),De(u)?Ze(e,l,"whitespace")(u):l(u))}}const ft={continuation:{tokenize:zA},exit:PA,name:"list",tokenize:IA},TA={partial:!0,tokenize:OA},AA={partial:!0,tokenize:RA};function IA(e,t,n){const r=this,o=r.events[r.events.length-1];let i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,a=0;return l;function l(p){const y=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Oa(p)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(ts,n,u)(p):u(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(p)}return n(p)}function c(p){return Oa(p)&&++a<10?(e.consume(p),c):(!r.interrupt||a<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),u(p)):n(p)}function u(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(li,r.interrupt?n:d,e.attempt(TA,h,f))}function d(p){return r.containerState.initialBlankLine=!0,i++,h(p)}function f(p){return De(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),h):n(p)}function h(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function zA(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(li,o,i);function o(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ze(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!De(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(AA,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ze(e,e.attempt(ft,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function RA(e,t,n){const r=this;return Ze(e,o,"listItemIndent",r.containerState.size+1);function o(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(i):n(i)}}function PA(e){e.exit(this.containerState.type)}function OA(e,t,n){const r=this;return Ze(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(i){const a=r.events[r.events.length-1];return!De(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const sd={name:"setextUnderline",resolveTo:MA,tokenize:LA};function MA(e,t){let n=e.length,r,o,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",i?(e.splice(o,0,["enter",a,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function LA(e,t,n){const r=this;let o;return i;function i(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),o=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===o?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),De(u)?Ze(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||je(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const DA={tokenize:FA};function FA(e){const t=this,n=e.attempt(li,r,e.attempt(this.parser.constructs.flowInitial,o,Ze(e,e.attempt(this.parser.constructs.flow,o,e.attempt(W4,o)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const $A={resolveAll:ex()},BA=Qg("string"),UA=Qg("text");function Qg(e){return{resolveAll:ex(e==="text"?HA:void 0),tokenize:t};function t(n){const r=this,o=this.parser.constructs[e],i=n.attempt(o,a,l);return a;function a(d){return u(d)?i(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),i(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const f=o[d];let h=-1;if(f)for(;++h<f.length;){const p=f[h];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function ex(e){return t;function t(n,r){let o=-1,i;for(;++o<=n.length;)i===void 0?n[o]&&n[o][1].type==="data"&&(i=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==i+2&&(n[i][1].end=n[o-1][1].end,n.splice(i+2,o-i-2),o=i+2),i=void 0);return e?e(n,r):n}}function HA(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],o=t.sliceStream(r);let i=o.length,a=-1,l=0,c;for(;i--;){const u=o[i];if(typeof u=="string"){for(a=u.length;u.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(u===-2)c=!0,l++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:r.start._bufferIndex+a,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const WA={42:ft,43:ft,45:ft,48:ft,49:ft,50:ft,51:ft,52:ft,53:ft,54:ft,55:ft,56:ft,57:ft,62:qg},VA={91:K4},qA={[-2]:Oi,[-1]:Oi,32:Oi},ZA={35:tA,42:ts,45:[sd,ts],60:sA,61:sd,95:ts,96:rd,126:rd},GA={38:Gg,92:Zg},KA={[-5]:Mi,[-4]:Mi,[-3]:Mi,33:_A,38:Gg,42:Ma,60:[C4,fA],91:CA,92:[Q4,Zg],93:ac,95:Ma,96:D4},JA={null:[Ma,$A]},YA={null:[42,95]},XA={null:[]},QA=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:YA,contentInitial:VA,disable:XA,document:WA,flow:ZA,flowInitial:qA,insideSpan:JA,string:GA,text:KA},Symbol.toStringTag,{value:"Module"}));function eI(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},i=[];let a=[],l=[];const c={attempt:N(S),check:N(j),consume:v,enter:w,exit:C,interrupt:N(j,{interrupt:!0})},u={code:null,containerState:{},defineSkip:m,events:[],now:y,parser:e,previous:null,sliceSerialize:h,sliceStream:p,write:f};let d=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function f(U){return a=Nt(a,U),x(),a[a.length-1]!==null?[]:(A(t,0),u.events=ic(i,u.events,u),u.events)}function h(U,E){return nI(p(U),E)}function p(U){return tI(a,U)}function y(){const{_bufferIndex:U,_index:E,line:O,column:k,offset:D}=r;return{_bufferIndex:U,_index:E,line:O,column:k,offset:D}}function m(U){o[U.line]=U.column,L()}function x(){let U;for(;r._index<a.length;){const E=a[r._index];if(typeof E=="string")for(U=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===U&&r._bufferIndex<E.length;)b(E.charCodeAt(r._bufferIndex));else b(E)}}function b(U){d=d(U)}function v(U){je(U)?(r.line++,r.column=1,r.offset+=U===-3?2:1,L()):U!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=U}function w(U,E){const O=E||{};return O.type=U,O.start=y(),u.events.push(["enter",O,u]),l.push(O),O}function C(U){const E=l.pop();return E.end=y(),u.events.push(["exit",E,u]),E}function S(U,E){A(U,E.from)}function j(U,E){E.restore()}function N(U,E){return O;function O(k,D,q){let W,B,J,I;return Array.isArray(k)?Z(k):"tokenize"in k?Z([k]):K(k);function K(ke){return pe;function pe(se){const le=se!==null&&ke[se],ce=se!==null&&ke.null,fe=[...Array.isArray(le)?le:le?[le]:[],...Array.isArray(ce)?ce:ce?[ce]:[]];return Z(fe)(se)}}function Z(ke){return W=ke,B=0,ke.length===0?q:R(ke[B])}function R(ke){return pe;function pe(se){return I=z(),J=ke,ke.partial||(u.currentConstruct=ke),ke.name&&u.parser.constructs.disable.null.includes(ke.name)?de():ke.tokenize.call(E?Object.assign(Object.create(u),E):u,c,ae,de)(se)}}function ae(ke){return U(J,I),D}function de(ke){return I.restore(),++B<W.length?R(W[B]):q}}}function A(U,E){U.resolveAll&&!i.includes(U)&&i.push(U),U.resolve&&Yt(u.events,E,u.events.length-E,U.resolve(u.events.slice(E),u)),U.resolveTo&&(u.events=U.resolveTo(u.events,u))}function z(){const U=y(),E=u.previous,O=u.currentConstruct,k=u.events.length,D=Array.from(l);return{from:k,restore:q};function q(){r=U,u.previous=E,u.currentConstruct=O,u.events.length=k,l=D,L()}}function L(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function tI(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,i=t.end._bufferIndex;let a;if(n===o)a=[e[n].slice(r,i)];else{if(a=e.slice(n,o),r>-1){const l=a[0];typeof l=="string"?a[0]=l.slice(r):a.shift()}i>0&&a.push(e[o].slice(0,i))}return a}function nI(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const i=e[n];let a;if(typeof i=="string")a=i;else switch(i){case-5:{a="\r";break}case-4:{a=`
103
+ `;break}case-3:{a=`\r
104
+ `;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&o)continue;a=" ";break}default:a=String.fromCharCode(i)}o=i===-2,r.push(a)}return r.join("")}function rI(e){const r={constructs:u4([QA,...(e||{}).extensions||[]]),content:o(b4),defined:[],document:o(v4),flow:o(DA),lazy:{},string:o(BA),text:o(UA)};return r;function o(i){return a;function a(l){return eI(r,i,l)}}}function oI(e){for(;!Kg(e););return e}const id=/[\0\t\n\r]/g;function sI(){let e=1,t="",n=!0,r;return o;function o(i,a,l){const c=[];let u,d,f,h,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(id.lastIndex=f,u=id.exec(i),h=u&&u.index!==void 0?u.index:i.length,p=i.charCodeAt(h),!u){t=i.slice(f);break}if(p===10&&f===h&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),f<h&&(c.push(i.slice(f,h)),e+=h-f),p){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}f=h+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const iI=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function aI(e){return e.replace(iI,lI)}function lI(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),i=o===120||o===88;return Vg(n.slice(i?2:1),i?16:10)}return sc(n)||e}const tx={}.hasOwnProperty;function cI(e,t,n){return typeof t!="string"&&(n=t,t=void 0),uI(n)(oI(rI(n).document().write(sI()(e,t,!0))))}function uI(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(V),autolinkProtocol:z,autolinkEmail:z,atxHeading:i(ne),blockQuote:i(ce),characterEscape:z,characterReference:z,codeFenced:i(fe),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(fe,a),codeText:i(be,a),codeTextData:z,data:z,codeFlowValue:z,definition:i(Se),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(_),hardBreakEscape:i(Q),hardBreakTrailing:i(Q),htmlFlow:i(M,a),htmlFlowData:z,htmlText:i(M,a),htmlTextData:z,image:i(P),label:a,link:i(V),listItem:i(X),listItemValue:h,listOrdered:i(H,f),listUnordered:i(H),paragraph:i($),reference:R,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(ne),strong:i(oe),thematicBreak:i(ee)},exit:{atxHeading:c(),atxHeadingSequence:S,autolink:c(),autolinkEmail:le,autolinkProtocol:se,blockQuote:c(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:de,characterReferenceMarkerNumeric:de,characterReferenceValue:ke,characterReference:pe,codeFenced:c(x),codeFencedFence:m,codeFencedFenceInfo:p,codeFencedFenceMeta:y,codeFlowValue:L,codeIndented:c(b),codeText:c(D),codeTextData:L,data:L,definition:c(),definitionDestinationString:C,definitionLabelString:v,definitionTitleString:w,emphasis:c(),hardBreakEscape:c(E),hardBreakTrailing:c(E),htmlFlow:c(O),htmlFlowData:L,htmlText:c(k),htmlTextData:L,image:c(W),label:J,labelText:B,lineEnding:U,link:c(q),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ae,resourceDestinationString:I,resourceTitleString:K,resource:Z,setextHeading:c(A),setextHeadingLineSequence:N,setextHeadingText:j,strong:c(),thematicBreak:c()}};nx(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(F){let G={type:"root",children:[]};const ue={stack:[G],tokenStack:[],config:t,enter:l,exit:u,buffer:a,resume:d,data:n},ye=[];let Ee=-1;for(;++Ee<F.length;)if(F[Ee][1].type==="listOrdered"||F[Ee][1].type==="listUnordered")if(F[Ee][0]==="enter")ye.push(Ee);else{const Pe=ye.pop();Ee=o(F,Pe,Ee)}for(Ee=-1;++Ee<F.length;){const Pe=t[F[Ee][0]];tx.call(Pe,F[Ee][1].type)&&Pe[F[Ee][1].type].call(Object.assign({sliceSerialize:F[Ee][2].sliceSerialize},ue),F[Ee][1])}if(ue.tokenStack.length>0){const Pe=ue.tokenStack[ue.tokenStack.length-1];(Pe[1]||ad).call(ue,void 0,Pe[0])}for(G.position={start:fn(F.length>0?F[0][1].start:{line:1,column:1,offset:0}),end:fn(F.length>0?F[F.length-2][1].end:{line:1,column:1,offset:0})},Ee=-1;++Ee<t.transforms.length;)G=t.transforms[Ee](G)||G;return G}function o(F,G,ue){let ye=G-1,Ee=-1,Pe=!1,it,Me,Ut,en;for(;++ye<=ue;){const Ye=F[ye];switch(Ye[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ye[0]==="enter"?Ee++:Ee--,en=void 0;break}case"lineEndingBlank":{Ye[0]==="enter"&&(it&&!en&&!Ee&&!Ut&&(Ut=ye),en=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:en=void 0}if(!Ee&&Ye[0]==="enter"&&Ye[1].type==="listItemPrefix"||Ee===-1&&Ye[0]==="exit"&&(Ye[1].type==="listUnordered"||Ye[1].type==="listOrdered")){if(it){let tn=ye;for(Me=void 0;tn--;){const Pt=F[tn];if(Pt[1].type==="lineEnding"||Pt[1].type==="lineEndingBlank"){if(Pt[0]==="exit")continue;Me&&(F[Me][1].type="lineEndingBlank",Pe=!0),Pt[1].type="lineEnding",Me=tn}else if(!(Pt[1].type==="linePrefix"||Pt[1].type==="blockQuotePrefix"||Pt[1].type==="blockQuotePrefixWhitespace"||Pt[1].type==="blockQuoteMarker"||Pt[1].type==="listItemIndent"))break}Ut&&(!Me||Ut<Me)&&(it._spread=!0),it.end=Object.assign({},Me?F[Me][1].start:Ye[1].end),F.splice(Me||ye,0,["exit",it,Ye[2]]),ye++,ue++}if(Ye[1].type==="listItemPrefix"){const tn={type:"listItem",_spread:!1,start:Object.assign({},Ye[1].start),end:void 0};it=tn,F.splice(ye,0,["enter",tn,Ye[2]]),ye++,ue++,Ut=void 0,en=!0}}}return F[G][1]._spread=Pe,ue}function i(F,G){return ue;function ue(ye){l.call(this,F(ye),ye),G&&G.call(this,ye)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(F,G,ue){this.stack[this.stack.length-1].children.push(F),this.stack.push(F),this.tokenStack.push([G,ue||void 0]),F.position={start:fn(G.start),end:void 0}}function c(F){return G;function G(ue){F&&F.call(this,ue),u.call(this,ue)}}function u(F,G){const ue=this.stack.pop(),ye=this.tokenStack.pop();if(ye)ye[0].type!==F.type&&(G?G.call(this,F,ye[0]):(ye[1]||ad).call(this,F,ye[0]));else throw new Error("Cannot close `"+F.type+"` ("+qr({start:F.start,end:F.end})+"): it’s not open");ue.position.end=fn(F.end)}function d(){return l4(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function h(F){if(this.data.expectingFirstListItemValue){const G=this.stack[this.stack.length-2];G.start=Number.parseInt(this.sliceSerialize(F),10),this.data.expectingFirstListItemValue=void 0}}function p(){const F=this.resume(),G=this.stack[this.stack.length-1];G.lang=F}function y(){const F=this.resume(),G=this.stack[this.stack.length-1];G.meta=F}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const F=this.resume(),G=this.stack[this.stack.length-1];G.value=F.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const F=this.resume(),G=this.stack[this.stack.length-1];G.value=F.replace(/(\r?\n|\r)$/g,"")}function v(F){const G=this.resume(),ue=this.stack[this.stack.length-1];ue.label=G,ue.identifier=dr(this.sliceSerialize(F)).toLowerCase()}function w(){const F=this.resume(),G=this.stack[this.stack.length-1];G.title=F}function C(){const F=this.resume(),G=this.stack[this.stack.length-1];G.url=F}function S(F){const G=this.stack[this.stack.length-1];if(!G.depth){const ue=this.sliceSerialize(F).length;G.depth=ue}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function N(F){const G=this.stack[this.stack.length-1];G.depth=this.sliceSerialize(F).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function z(F){const ue=this.stack[this.stack.length-1].children;let ye=ue[ue.length-1];(!ye||ye.type!=="text")&&(ye=Y(),ye.position={start:fn(F.start),end:void 0},ue.push(ye)),this.stack.push(ye)}function L(F){const G=this.stack.pop();G.value+=this.sliceSerialize(F),G.position.end=fn(F.end)}function U(F){const G=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ue=G.children[G.children.length-1];ue.position.end=fn(F.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(G.type)&&(z.call(this,F),L.call(this,F))}function E(){this.data.atHardBreak=!0}function O(){const F=this.resume(),G=this.stack[this.stack.length-1];G.value=F}function k(){const F=this.resume(),G=this.stack[this.stack.length-1];G.value=F}function D(){const F=this.resume(),G=this.stack[this.stack.length-1];G.value=F}function q(){const F=this.stack[this.stack.length-1];if(this.data.inReference){const G=this.data.referenceType||"shortcut";F.type+="Reference",F.referenceType=G,delete F.url,delete F.title}else delete F.identifier,delete F.label;this.data.referenceType=void 0}function W(){const F=this.stack[this.stack.length-1];if(this.data.inReference){const G=this.data.referenceType||"shortcut";F.type+="Reference",F.referenceType=G,delete F.url,delete F.title}else delete F.identifier,delete F.label;this.data.referenceType=void 0}function B(F){const G=this.sliceSerialize(F),ue=this.stack[this.stack.length-2];ue.label=aI(G),ue.identifier=dr(G).toLowerCase()}function J(){const F=this.stack[this.stack.length-1],G=this.resume(),ue=this.stack[this.stack.length-1];if(this.data.inReference=!0,ue.type==="link"){const ye=F.children;ue.children=ye}else ue.alt=G}function I(){const F=this.resume(),G=this.stack[this.stack.length-1];G.url=F}function K(){const F=this.resume(),G=this.stack[this.stack.length-1];G.title=F}function Z(){this.data.inReference=void 0}function R(){this.data.referenceType="collapsed"}function ae(F){const G=this.resume(),ue=this.stack[this.stack.length-1];ue.label=G,ue.identifier=dr(this.sliceSerialize(F)).toLowerCase(),this.data.referenceType="full"}function de(F){this.data.characterReferenceType=F.type}function ke(F){const G=this.sliceSerialize(F),ue=this.data.characterReferenceType;let ye;ue?(ye=Vg(G,ue==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ye=sc(G);const Ee=this.stack[this.stack.length-1];Ee.value+=ye}function pe(F){const G=this.stack.pop();G.position.end=fn(F.end)}function se(F){L.call(this,F);const G=this.stack[this.stack.length-1];G.url=this.sliceSerialize(F)}function le(F){L.call(this,F);const G=this.stack[this.stack.length-1];G.url="mailto:"+this.sliceSerialize(F)}function ce(){return{type:"blockquote",children:[]}}function fe(){return{type:"code",lang:null,meta:null,value:""}}function be(){return{type:"inlineCode",value:""}}function Se(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function _(){return{type:"emphasis",children:[]}}function ne(){return{type:"heading",depth:0,children:[]}}function Q(){return{type:"break"}}function M(){return{type:"html",value:""}}function P(){return{type:"image",title:null,url:"",alt:null}}function V(){return{type:"link",title:null,url:"",children:[]}}function H(F){return{type:"list",ordered:F.type==="listOrdered",start:null,spread:F._spread,children:[]}}function X(F){return{type:"listItem",spread:F._spread,checked:null,children:[]}}function $(){return{type:"paragraph",children:[]}}function oe(){return{type:"strong",children:[]}}function Y(){return{type:"text",value:""}}function ee(){return{type:"thematicBreak"}}}function fn(e){return{line:e.line,column:e.column,offset:e.offset}}function nx(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?nx(e,r):dI(e,r)}}function dI(e,t){let n;for(n in t)if(tx.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function ad(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+qr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+qr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+qr({start:t.start,end:t.end})+") is still open")}function fI(e){const t=this;t.parser=n;function n(r){return cI(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function pI(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function hI(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
105
+ `}]}function mI(e,t){const n=t.value?t.value+`
106
+ `:"",r={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function gI(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function xI(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function bI(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=Tr(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let a,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=i+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function yI(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vI(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function rx(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const o=e.all(t),i=o[0];i&&i.type==="text"?i.value="["+i.value:o.unshift({type:"text",value:"["});const a=o[o.length-1];return a&&a.type==="text"?a.value+=r:o.push({type:"text",value:r}),o}function wI(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return rx(e,t);const o={src:Tr(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(o.title=r.title);const i={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,i),e.applyData(t,i)}function kI(e,t){const n={src:Tr(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function _I(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function SI(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return rx(e,t);const o={href:Tr(r.url||"")};r.title!==null&&r.title!==void 0&&(o.title=r.title);const i={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function CI(e,t){const n={href:Tr(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function jI(e,t,n){const r=e.all(t),o=n?NI(n):ox(t),i={},a=[];if(typeof t.checked=="boolean"){const d=r[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const d=r[l];(o||l!==0||d.type!=="element"||d.tagName!=="p")&&a.push({type:"text",value:`
107
+ `}),d.type==="element"&&d.tagName==="p"&&!o?a.push(...d.children):a.push(d)}const c=r[r.length-1];c&&(o||c.type!=="element"||c.tagName!=="p")&&a.push({type:"text",value:`
108
+ `});const u={type:"element",tagName:"li",properties:i,children:a};return e.patch(t,u),e.applyData(t,u)}function NI(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=ox(n[r])}return t}function ox(e){const t=e.spread;return t??e.children.length>1}function EI(e,t){const n={},r=e.all(t);let o=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++o<r.length;){const a=r[o];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function TI(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function AI(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function II(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function zI(e,t){const n=e.all(t),r=n.shift(),o=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],a),o.push(a)}if(n.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=tc(t.children[1]),c=Dg(t.children[t.children.length-1]);l&&c&&(a.position={start:l,end:c}),o.push(a)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,i),e.applyData(t,i)}function RI(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:t.children.length;let c=-1;const u=[];for(;++c<l;){const f=t.children[c],h={},p=a?a[c]:void 0;p&&(h.align=p);let y={type:"element",tagName:i,properties:h,children:[]};f&&(y.children=e.all(f),e.patch(f,y),y=e.applyData(f,y)),u.push(y)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function PI(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const ld=9,cd=32;function OI(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const i=[];for(;r;)i.push(ud(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return i.push(ud(t.slice(o),o>0,!1)),i.join("")}function ud(e,t,n){let r=0,o=e.length;if(t){let i=e.codePointAt(r);for(;i===ld||i===cd;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(o-1);for(;i===ld||i===cd;)o--,i=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function MI(e,t){const n={type:"text",value:OI(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function LI(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const DI={blockquote:pI,break:hI,code:mI,delete:gI,emphasis:xI,footnoteReference:bI,heading:yI,html:vI,imageReference:wI,image:kI,inlineCode:_I,linkReference:SI,link:CI,listItem:jI,list:EI,paragraph:TI,root:AI,strong:II,table:zI,tableCell:PI,tableRow:RI,text:MI,thematicBreak:LI,toml:Lo,yaml:Lo,definition:Lo,footnoteDefinition:Lo};function Lo(){}const sx=-1,ci=0,Gr=1,_s=2,lc=3,cc=4,uc=5,dc=6,ix=7,ax=8,dd=typeof self=="object"?self:globalThis,FI=(e,t)=>{const n=(o,i)=>(e.set(i,o),o),r=o=>{if(e.has(o))return e.get(o);const[i,a]=t[o];switch(i){case ci:case sx:return n(a,o);case Gr:{const l=n([],o);for(const c of a)l.push(r(c));return l}case _s:{const l=n({},o);for(const[c,u]of a)l[r(c)]=r(u);return l}case lc:return n(new Date(a),o);case cc:{const{source:l,flags:c}=a;return n(new RegExp(l,c),o)}case uc:{const l=n(new Map,o);for(const[c,u]of a)l.set(r(c),r(u));return l}case dc:{const l=n(new Set,o);for(const c of a)l.add(r(c));return l}case ix:{const{name:l,message:c}=a;return n(new dd[l](c),o)}case ax:return n(BigInt(a),o);case"BigInt":return n(Object(BigInt(a)),o);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:l}=new Uint8Array(a);return n(new DataView(l),a)}}return n(new dd[i](a),o)};return r},fd=e=>FI(new Map,e)(0),er="",{toString:$I}={},{keys:BI}=Object,Lr=e=>{const t=typeof e;if(t!=="object"||!e)return[ci,t];const n=$I.call(e).slice(8,-1);switch(n){case"Array":return[Gr,er];case"Object":return[_s,er];case"Date":return[lc,er];case"RegExp":return[cc,er];case"Map":return[uc,er];case"Set":return[dc,er];case"DataView":return[Gr,n]}return n.includes("Array")?[Gr,n]:n.includes("Error")?[ix,n]:[_s,n]},Do=([e,t])=>e===ci&&(t==="function"||t==="symbol"),UI=(e,t,n,r)=>{const o=(a,l)=>{const c=r.push(a)-1;return n.set(l,c),c},i=a=>{if(n.has(a))return n.get(a);let[l,c]=Lr(a);switch(l){case ci:{let d=a;switch(c){case"bigint":l=ax,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return o([sx],a)}return o([l,d],a)}case Gr:{if(c){let h=a;return c==="DataView"?h=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(h=new Uint8Array(a)),o([c,[...h]],a)}const d=[],f=o([l,d],a);for(const h of a)d.push(i(h));return f}case _s:{if(c)switch(c){case"BigInt":return o([c,a.toString()],a);case"Boolean":case"Number":case"String":return o([c,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const d=[],f=o([l,d],a);for(const h of BI(a))(e||!Do(Lr(a[h])))&&d.push([i(h),i(a[h])]);return f}case lc:return o([l,a.toISOString()],a);case cc:{const{source:d,flags:f}=a;return o([l,{source:d,flags:f}],a)}case uc:{const d=[],f=o([l,d],a);for(const[h,p]of a)(e||!(Do(Lr(h))||Do(Lr(p))))&&d.push([i(h),i(p)]);return f}case dc:{const d=[],f=o([l,d],a);for(const h of a)(e||!Do(Lr(h)))&&d.push(i(h));return f}}const{message:u}=a;return o([l,{name:c,message:u}],a)};return i},pd=(e,{json:t,lossy:n}={})=>{const r=[];return UI(!(t||n),!!t,new Map,r)(e),r},Ss=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?fd(pd(e,t)):structuredClone(e):(e,t)=>fd(pd(e,t));function HI(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function WI(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function VI(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||HI,r=e.options.footnoteBackLabel||WI,o=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),f=String(u.identifier).toUpperCase(),h=Tr(f.toLowerCase());let p=0;const y=[],m=e.footnoteCounts.get(f);for(;m!==void 0&&++p<=m;){y.length>0&&y.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,p);typeof v=="string"&&(v={type:"text",value:v}),y.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+h+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const x=d[d.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const v=x.children[x.children.length-1];v&&v.type==="text"?v.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...y)}else d.push(...y);const b={type:"element",tagName:"li",properties:{id:t+"fn-"+h},children:e.wrap(d,!0)};e.patch(u,b),l.push(b)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Ss(a),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
109
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
110
+ `}]}}const lx=(function(e){if(e==null)return KI;if(typeof e=="function")return ui(e);if(typeof e=="object")return Array.isArray(e)?qI(e):ZI(e);if(typeof e=="string")return GI(e);throw new Error("Expected function, string, or object as test")});function qI(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=lx(e[n]);return ui(r);function r(...o){let i=-1;for(;++i<t.length;)if(t[i].apply(this,o))return!0;return!1}}function ZI(e){const t=e;return ui(n);function n(r){const o=r;let i;for(i in e)if(o[i]!==t[i])return!1;return!0}}function GI(e){return ui(t);function t(n){return n&&n.type===e}}function ui(e){return t;function t(n,r,o){return!!(JI(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function KI(){return!0}function JI(e){return e!==null&&typeof e=="object"&&"type"in e}const cx=[],YI=!0,hd=!1,XI="skip";function QI(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;const i=lx(o),a=r?-1:1;l(e,void 0,[])();function l(c,u,d){const f=c&&typeof c=="object"?c:{};if(typeof f.type=="string"){const p=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(h,"name",{value:"node ("+(c.type+(p?"<"+p+">":""))+")"})}return h;function h(){let p=cx,y,m,x;if((!t||i(c,u,d[d.length-1]||void 0))&&(p=ez(n(c,d)),p[0]===hd))return p;if("children"in c&&c.children){const b=c;if(b.children&&p[0]!==XI)for(m=(r?b.children.length:-1)+a,x=d.concat(b);m>-1&&m<b.children.length;){const v=b.children[m];if(y=l(v,m,x)(),y[0]===hd)return y;m=typeof y[1]=="number"?y[1]:m+a}}return p}}}function ez(e){return Array.isArray(e)?e:typeof e=="number"?[YI,e]:e==null?cx:[e]}function ux(e,t,n,r){let o,i,a;typeof t=="function"&&typeof n!="function"?(i=void 0,a=t,o=n):(i=t,a=n,o=r),QI(e,i,l,o);function l(c,u){const d=u[u.length-1],f=d?d.children.indexOf(c):void 0;return a(c,f,d)}}const La={}.hasOwnProperty,tz={};function nz(e,t){const n=t||tz,r=new Map,o=new Map,i=new Map,a={...DI,...n.handlers},l={all:u,applyData:oz,definitionById:r,footnoteById:o,footnoteCounts:i,footnoteOrder:[],handlers:a,one:c,options:n,patch:rz,wrap:iz};return ux(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const f=d.type==="definition"?r:o,h=String(d.identifier).toUpperCase();f.has(h)||f.set(h,d)}}),l;function c(d,f){const h=d.type,p=l.handlers[h];if(La.call(l.handlers,h)&&p)return p(l,d,f);if(l.options.passThrough&&l.options.passThrough.includes(h)){if("children"in d){const{children:m,...x}=d,b=Ss(x);return b.children=l.all(d),b}return Ss(d)}return(l.options.unknownHandler||sz)(l,d,f)}function u(d){const f=[];if("children"in d){const h=d.children;let p=-1;for(;++p<h.length;){const y=l.one(h[p],d);if(y){if(p&&h[p-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=md(y.value)),!Array.isArray(y)&&y.type==="element")){const m=y.children[0];m&&m.type==="text"&&(m.value=md(m.value))}Array.isArray(y)?f.push(...y):f.push(y)}}}return f}}function rz(e,t){e.position&&(t.position=$T(e))}function oz(e,t){let n=t;if(e&&e.data){const r=e.data.hName,o=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&i&&Object.assign(n.properties,Ss(i)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function sz(e,t){const n=t.data||{},r="value"in t&&!(La.call(n,"hProperties")||La.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function iz(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
111
+ `});++r<e.length;)r&&n.push({type:"text",value:`
112
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
113
+ `}),n}function md(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function gd(e,t){const n=nz(e,t),r=n.one(e,void 0),o=VI(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&i.children.push({type:"text",value:`
114
+ `},o),i}function az(e,t){return e&&"run"in e?async function(n,r){const o=gd(n,{file:r,...t});await e.run(o,r)}:function(n,r){return gd(n,{file:r,...e||t})}}function xd(e){if(e)throw e}var Li,bd;function lz(){if(bd)return Li;bd=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},i=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var d=e.call(u,"constructor"),f=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!d&&!f)return!1;var h;for(h in u);return typeof h>"u"||e.call(u,h)},a=function(u,d){n&&d.name==="__proto__"?n(u,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):u[d.name]=d.newValue},l=function(u,d){if(d==="__proto__")if(e.call(u,d)){if(r)return r(u,d).value}else return;return u[d]};return Li=function c(){var u,d,f,h,p,y,m=arguments[0],x=1,b=arguments.length,v=!1;for(typeof m=="boolean"&&(v=m,m=arguments[1]||{},x=2),(m==null||typeof m!="object"&&typeof m!="function")&&(m={});x<b;++x)if(u=arguments[x],u!=null)for(d in u)f=l(m,d),h=l(u,d),m!==h&&(v&&h&&(i(h)||(p=o(h)))?(p?(p=!1,y=f&&o(f)?f:[]):y=f&&i(f)?f:{},a(m,{name:d,newValue:c(v,y,h)})):typeof h<"u"&&a(m,{name:d,newValue:h}));return m},Li}var cz=lz();const Di=Ya(cz);function Da(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function uz(){const e=[],t={run:n,use:r};return t;function n(...o){let i=-1;const a=o.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);l(null,...o);function l(c,...u){const d=e[++i];let f=-1;if(c){a(c);return}for(;++f<o.length;)(u[f]===null||u[f]===void 0)&&(u[f]=o[f]);o=u,d?dz(d,l)(...u):a(null,...u)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function dz(e,t){let n;return r;function r(...a){const l=e.length>a.length;let c;l&&a.push(o);try{c=e.apply(this,a)}catch(u){const d=u;if(l&&n)throw d;return o(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,o):c instanceof Error?o(c):i(c))}function o(a,...l){n||(n=!0,t(a,...l))}function i(a){o(null,a)}}const Ht={basename:fz,dirname:pz,extname:hz,join:mz,sep:"/"};function fz(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');yo(e);let n=0,r=-1,o=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else r<0&&(i=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,l=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else a<0&&(i=!0,a=o+1),l>-1&&(e.codePointAt(o)===t.codePointAt(l--)?l<0&&(r=o):(l=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function pz(e){if(yo(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function hz(e){yo(e);let t=e.length,n=-1,r=0,o=-1,i=0,a;for(;t--;){const l=e.codePointAt(t);if(l===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),l===46?o<0?o=t:i!==1&&(i=1):o>-1&&(i=-1)}return o<0||n<0||i===0||i===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function mz(...e){let t=-1,n;for(;++t<e.length;)yo(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":gz(n)}function gz(e){yo(e);const t=e.codePointAt(0)===47;let n=xz(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function xz(e,t){let n="",r=0,o=-1,i=0,a=-1,l,c;for(;++a<=e.length;){if(a<e.length)l=e.codePointAt(a);else{if(l===47)break;l=47}if(l===47){if(!(o===a-1||i===1))if(o!==a-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),o=a,i=0;continue}}else if(n.length>0){n="",r=0,o=a,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,a):n=e.slice(o+1,a),r=a-o-1;o=a,i=0}else l===46&&i>-1?i++:i=-1}return n}function yo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const bz={cwd:yz};function yz(){return"/"}function Fa(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function vz(e){if(typeof e=="string")e=new URL(e);else if(!Fa(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return wz(e)}function wz(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const Fi=["history","path","basename","stem","extname","dirname"];class dx{constructor(t){let n;t?Fa(t)?n={path:t}:typeof t=="string"||kz(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":bz.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Fi.length;){const i=Fi[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let o;for(o in n)Fi.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?Ht.basename(this.path):void 0}set basename(t){Bi(t,"basename"),$i(t,"basename"),this.path=Ht.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ht.dirname(this.path):void 0}set dirname(t){yd(this.basename,"dirname"),this.path=Ht.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ht.extname(this.path):void 0}set extname(t){if($i(t,"extname"),yd(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ht.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Fa(t)&&(t=vz(t)),Bi(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ht.basename(this.path,this.extname):void 0}set stem(t){Bi(t,"stem"),$i(t,"stem"),this.path=Ht.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){const o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){const o=new lt(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function $i(e,t){if(e&&e.includes(Ht.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ht.sep+"`")}function Bi(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function yd(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function kz(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const _z=(function(e){const r=this.constructor.prototype,o=r[e],i=function(){return o.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),Sz={}.hasOwnProperty;class fc extends _z{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=uz()}copy(){const t=new fc;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Di(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Wi("data",this.frozen),this.namespace[t]=n,this):Sz.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Wi("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Fo(t),r=this.parser||this.Parser;return Ui("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ui("process",this.parser||this.Parser),Hi("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(i,a){const l=Fo(t),c=r.parse(l);r.run(c,l,function(d,f,h){if(d||!f||!h)return u(d);const p=f,y=r.stringify(p,h);Nz(y)?h.value=y:h.result=y,u(d,h)});function u(d,f){d||!f?a(d):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),Ui("processSync",this.parser||this.Parser),Hi("processSync",this.compiler||this.Compiler),this.process(t,o),wd("processSync","process",n),r;function o(i,a){n=!0,xd(i),r=a}}run(t,n,r){vd(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(a,l){const c=Fo(n);o.run(t,c,u);function u(d,f,h){const p=f||t;d?l(d):a?a(p):r(void 0,p,h)}}}runSync(t,n){let r=!1,o;return this.run(t,n,i),wd("runSync","run",r),o;function i(a,l){xd(a),o=l,r=!0}}stringify(t,n){this.freeze();const r=Fo(n),o=this.compiler||this.Compiler;return Hi("stringify",o),vd(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(Wi("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...f]=u;c(d,f)}else a(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function a(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(o.settings=Di(!0,o.settings,u.settings))}function l(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const f=u[d];i(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let f=-1,h=-1;for(;++f<r.length;)if(r[f][0]===u){h=f;break}if(h===-1)r.push([u,...d]);else if(d.length>0){let[p,...y]=d;const m=r[h][1];Da(m)&&Da(p)&&(p=Di(!0,m,p)),r[h]=[u,p,...y]}}}}const Cz=new fc().freeze();function Ui(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Hi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Wi(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function vd(e){if(!Da(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function wd(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Fo(e){return jz(e)?e:new dx(e)}function jz(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Nz(e){return typeof e=="string"||Ez(e)}function Ez(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Tz="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",kd=[],_d={allowDangerousHtml:!0},Az=/^(https?|ircs?|mailto|xmpp)$/i,Iz=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Sd(e){const t=zz(e),n=Rz(e);return Pz(t.runSync(t.parse(n),n),e)}function zz(e){const t=e.rehypePlugins||kd,n=e.remarkPlugins||kd,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,..._d}:_d;return Cz().use(fI).use(n).use(az,r).use(t)}function Rz(e){const t=e.children||"",n=new dx;return typeof t=="string"&&(n.value=t),n}function Pz(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,i=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||Oz;for(const d of Iz)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+Tz+d.id,void 0);return ux(e,u),VT(e,{Fragment:s.Fragment,components:o,ignoreInvalidStyle:!0,jsx:s.jsx,jsxs:s.jsxs,passKeys:!0,passNode:!0});function u(d,f,h){if(d.type==="raw"&&h&&typeof f=="number")return a?h.children.splice(f,1):h.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let p;for(p in Pi)if(Object.hasOwn(Pi,p)&&Object.hasOwn(d.properties,p)){const y=d.properties[p],m=Pi[p];(m===null||m.includes(d.tagName))&&(d.properties[p]=c(String(y||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(d,f,h)),p&&h&&typeof f=="number")return l&&d.children?h.children.splice(f,1,...d.children):h.children.splice(f,1),f}}}function Oz(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||r!==-1&&t>r||Az.test(e.slice(0,t))?e:""}function fx(e){if(e===null)return"null";if(Array.isArray(e))return"array";switch(typeof e){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"object":return"object";case"bigint":case"symbol":case"undefined":case"function":return"object"}}function Wr(e){return e!==null&&(Array.isArray(e)||typeof e=="object")}function px(e){return Array.isArray(e)?e.map((t,n)=>[String(n),t]):typeof e=="object"&&e!==null?Object.entries(e):[]}const Cd=120;function Mz({text:e}){const[t,n]=g.useState(!1);return e.length>Cd?s.jsxs("span",{className:"text-emerald-400 break-all",children:['"',t?s.jsx("span",{className:"cursor-pointer prose prose-sm dark:prose-invert inline max-w-none [&_p]:inline [&_p]:my-0 [&_code]:text-emerald-300 [&_a]:text-emerald-300",onClick:o=>{o.stopPropagation(),n(!1)},onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.stopPropagation(),n(!1))},role:"button",tabIndex:0,children:s.jsx(Sd,{children:e})}):s.jsxs($e,{delayDuration:300,children:[s.jsxs(Be,{onClick:o=>{o.stopPropagation(),n(!0)},className:"text-left cursor-pointer",children:[s.jsx("span",{children:e.slice(0,Cd)}),s.jsx("span",{className:"text-emerald-400/50",children:"…"})]}),s.jsxs(Ue,{side:"bottom",className:"max-w-md text-xs p-2 break-words whitespace-pre-wrap",children:[e.slice(0,500),e.length>500?"…":""]})]}),'"']}):s.jsxs("span",{className:"text-emerald-400 break-all",children:['"',s.jsx("span",{className:"prose prose-sm dark:prose-invert inline max-w-none [&_p]:inline [&_p]:my-0 [&_code]:text-emerald-300 [&_a]:text-emerald-300",children:s.jsx(Sd,{children:e})}),'"']})}function hx({value:e}){if(e===null)return s.jsx("span",{className:"text-rose-400 italic",children:"null"});switch(typeof e){case"string":return s.jsx(Mz,{text:e});case"number":return s.jsx("span",{className:"text-amber-400",children:e});case"boolean":return s.jsx("span",{className:"text-blue-400",children:e?"true":"false"});case"object":case"bigint":case"symbol":case"undefined":case"function":return s.jsx("span",{className:"text-muted-foreground",children:JSON.stringify(e)})}}function jd({value:e}){const[t,n]=g.useState(!1);function r(o){o.stopPropagation(),$t(JSON.stringify(e,null,2)).then(i=>{i&&(n(!0),setTimeout(()=>{n(!1)},2e3))})}return s.jsx("button",{type:"button",onClick:r,className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors","aria-label":t?"Copied JSON":"Copy JSON",title:"Copy JSON",children:t?s.jsx(tt,{className:"size-3 text-green-500"}):s.jsx(St,{className:"size-3"})})}function Lz({value:e}){const[t,n]=g.useState(!1);function r(o){o.stopPropagation(),$t(JSON.stringify(e,null,2)).then(i=>{i&&(n(!0),setTimeout(()=>{n(!1)},2e3))})}return s.jsx("button",{type:"button",onClick:r,className:"opacity-0 group-hover/row:opacity-100 hover:bg-muted p-0.5 rounded transition-opacity shrink-0","aria-label":t?"Copied JSON value":"Copy JSON value",title:"Copy to clipboard",children:t?s.jsx(tt,{className:"size-3 text-green-500"}):s.jsx(St,{className:"size-3 text-muted-foreground"})})}function Dz({onClick:e}){return s.jsx("button",{type:"button",onClick:e,className:"opacity-0 group-hover/row:opacity-100 hover:bg-muted p-0.5 rounded transition-opacity shrink-0",title:"Expand all descendants",children:s.jsx(_p,{className:"size-3.5 text-muted-foreground"})})}const Fz=g.memo(function e({name:t,value:n,level:r,defaultExpandDepth:o,isArrayItem:i,path:a,expandTargetPath:l,anatomyPaths:c}){const u=g.useMemo(()=>l===null?!1:a===""?l.length>0:l===a||l.startsWith(`${a}/`),[l,a]),d=r<o||u&&Wr(n),[f,h]=g.useState(d);g.useEffect(()=>{u&&Wr(n)&&!f&&h(!0)},[l]);const[p,y]=g.useState(0),[m,x]=g.useState(null),b=Wr(n),v=m===Number.POSITIVE_INFINITY,w=g.useMemo(()=>px(n),[n]),C=g.useMemo(()=>w.some(([,k])=>Wr(k)),[w]),S=fx(n),j=S==="array"?"[":"{",N=S==="array"?"]":"}",A=c!==null&&c.has(a);function z(){h(!0),x(Number.POSITIVE_INFINITY),y(k=>k+1)}function L(){h(!1),x(0),y(k=>k+1)}function U(){v?L():h(!f)}function E(k){k.stopPropagation(),z()}const O=m??o;return s.jsxs("div",{className:me(r>0&&"border-l border-border/50 ml-2"),children:[s.jsxs("div",{className:me("flex items-start gap-1 py-0.5 px-1 -ml-1 rounded-sm group/row",b&&"cursor-pointer hover:bg-muted/50"),"data-anatomy-path":A?a:void 0,onClick:b?U:void 0,onKeyDown:b?k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),U())}:void 0,onDoubleClick:b&&C?()=>z():void 0,role:b?"button":void 0,tabIndex:b?0:void 0,children:[b?s.jsx("span",{className:"w-4 h-5 flex items-center justify-center shrink-0",children:f?s.jsx(gt,{className:"size-3 text-muted-foreground"}):s.jsx(Ft,{className:"size-3 text-muted-foreground"})}):s.jsx("span",{className:"w-4 shrink-0"}),s.jsx("span",{className:me("shrink-0",i?"text-muted-foreground":"text-cyan-400"),children:i?t:`"${t}"`}),s.jsx("span",{className:"text-muted-foreground shrink-0",children:b?"":":"}),b?s.jsxs("span",{className:"text-muted-foreground",children:[j,s.jsxs("span",{className:"text-muted-foreground/60 text-xs",children:[" ",w.length," ",w.length===1?"item":"items"," ",N]})]}):s.jsx("span",{className:"min-w-0",children:s.jsx(hx,{value:n})}),b&&C&&!v&&s.jsx(Dz,{onClick:E}),s.jsx(Lz,{value:n})]}),b&&f&&s.jsxs("div",{className:"pl-4",children:[w.map(([k,D])=>s.jsx(e,{name:k,value:D,level:r+1,defaultExpandDepth:O,isArrayItem:S==="array",path:a===""?`/${k}`:`${a}/${k}`,expandTargetPath:l,anatomyPaths:c},k)),s.jsx("div",{className:"text-muted-foreground py-0.5 px-1",children:N})]},p)]})});function pc({data:e,defaultExpandDepth:t=0,className:n,showCopy:r=!1,bulkDepth:o,bulkRevision:i,anatomyPaths:a=null,expandToPath:l=null}){const c=Wr(e),u=g.useMemo(()=>px(e),[e]),d=o??t,f=i??0;if(!c)return s.jsx(ot,{children:s.jsx("div",{className:me("font-mono text-xs leading-relaxed",n),children:s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(hx,{value:e}),r&&s.jsx(jd,{value:e})]})})});const p=fx(e)==="array";return s.jsx(ot,{children:s.jsxs("div",{className:me("font-mono text-xs leading-relaxed",n),children:[r&&s.jsx("div",{className:"mb-2 flex items-center justify-end gap-2",children:s.jsx(jd,{value:e})}),u.length===0&&s.jsxs("div",{className:"rounded-md border border-white/10 bg-black/20 px-3 py-2 text-muted-foreground",children:[s.jsx("span",{className:"text-cyan-300",children:p?"[]":"{}"}),s.jsx("span",{className:"ml-2 text-[10px] uppercase",children:"0 items"})]}),s.jsx("div",{children:u.map(([y,m])=>s.jsx(Fz,{name:y,value:m,level:0,defaultExpandDepth:d,isArrayItem:p,path:`/${y}`,expandTargetPath:l,anatomyPaths:a},y))},f)]})})}const $z=g.memo(function({text:t,defaultExpandDepth:n=0,className:r,bulkDepth:o,bulkRevision:i}){const a=g.useMemo(()=>vg(t),[t]);return a.kind==="json"?s.jsx(pc,{data:a.data,defaultExpandDepth:n,className:r,bulkDepth:o,bulkRevision:i}):s.jsx("pre",{className:me("font-mono text-xs whitespace-pre-wrap break-words",r),children:t})}),mx=Object.freeze(Object.defineProperty({__proto__:null,JsonViewer:pc,JsonViewerFromString:$z},Symbol.toStringTag,{value:"Module"}));function Bz({className:e,children:t,...n}){return s.jsxs(V5,{"data-slot":"scroll-area",className:me("relative overflow-hidden",e),...n,children:[s.jsx(q5,{"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}),s.jsx(Uz,{}),s.jsx(Z5,{})]})}function Uz({className:e,orientation:t="vertical",...n}){return s.jsx(dm,{"data-slot":"scroll-area-scrollbar",orientation:t,className:me("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:s.jsx(mm,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}const gx={file:"file",shell:"shell",browser:"browser",web:"web",mcp:"MCP",code:"code",other:"other"},Hz={file:"border-blue-400/20 bg-blue-400/5 text-blue-300",shell:"border-teal-400/20 bg-teal-400/5 text-teal-300",browser:"border-cyan-400/20 bg-cyan-400/5 text-cyan-300",web:"border-sky-400/20 bg-sky-400/5 text-sky-300",mcp:"border-violet-400/20 bg-violet-400/5 text-violet-300",code:"border-emerald-400/20 bg-emerald-400/5 text-emerald-300",other:"border-muted-foreground/20 bg-muted/30 text-muted-foreground"};function Wz({category:e}){switch(e){case"file":return s.jsx(Gw,{className:"size-3.5"});case"shell":return s.jsx(wl,{className:"size-3.5"});case"browser":return s.jsx(dk,{className:"size-3.5"});case"web":return s.jsx(Cp,{className:"size-3.5"});case"mcp":return s.jsx(Q2,{className:"size-3.5"});case"code":return s.jsx(Tw,{className:"size-3.5"});case"other":return s.jsx(Ow,{className:"size-3.5"})}}function Vz({names:e}){return e.length===0?null:s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1",children:[s.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:"required"}),e.slice(0,4).map(t=>s.jsx(He,{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&&s.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:["+",e.length-4]})]})}function qz({tool:e,called:t}){const[n,r]=g.useState(!1),o=rn(e.name),i=e.description!==null||e.requiredParameters.length>0||e.schema!==null;return s.jsx(mT,{open:n,onOpenChange:r,children:s.jsxs("div",{className:"rounded-md border border-white/10 bg-black/20 shadow-[inset_0_1px_0_rgba(255,255,255,0.03)]",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-2.5 py-2",children:[s.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-2 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:()=>r(a=>!a),"aria-expanded":n,disabled:!i,children:[s.jsx(Wz,{category:e.category}),s.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-semibold text-foreground/90",children:e.name}),t&&s.jsx(He,{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"}),s.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:[e.parameterCount," params"]}),e.descriptionPreview!==null&&s.jsx("span",{className:"hidden min-w-0 truncate text-xs text-muted-foreground md:inline",children:e.descriptionPreview}),s.jsx("span",{className:"flex-1"}),i&&(n?s.jsx(gt,{className:"size-3.5 shrink-0 text-muted-foreground"}):s.jsx(Ft,{className:"size-3.5 shrink-0 text-muted-foreground"}))]}),s.jsx("button",{type:"button",className:"inline-flex size-7 shrink-0 items-center justify-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",onClick:o.copy,"aria-label":o.copied?"Copied tool name":"Copy tool name",children:o.copied?s.jsx(tt,{className:"size-3.5 text-emerald-400"}):s.jsx(St,{className:"size-3.5"})})]}),s.jsx(gT,{children:s.jsxs("div",{className:"space-y-2 border-t border-white/10 bg-white/[0.02] px-2.5 py-2",children:[e.description!==null&&s.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:e.description}),s.jsx(Vz,{names:e.requiredParameters}),e.schema!==null&&s.jsx(Bz,{className:"max-h-64 rounded-md border border-white/10 bg-[#06080b] p-2",children:s.jsx(pc,{data:ks(e.schema),defaultExpandDepth:0})})]})})]})})}function Zz(e,t){return t.length===0?!0:`${e.name} ${e.description??""} ${gx[e.category]}`.toLowerCase().trim().includes(t)}const Gz=g.memo(function({summary:t,calledToolNames:n}){const[r,o]=g.useState(!1),[i,a]=g.useState(""),l=g.useMemo(()=>new Set(n),[n]),c=i.trim().toLowerCase(),u=g.useMemo(()=>t===null?[]:t.tools.filter(h=>Zz(h,c)),[c,t]);if(t===null)return null;const d=t.tools.slice(0,6),f=t.tools.length-d.length;return s.jsxs("section",{className:"mb-3 overflow-hidden rounded-md border border-white/10 bg-[#080b0f] shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]",children:[s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 px-3 py-2",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[s.jsx(co,{className:"size-4 shrink-0 text-sky-300/80"}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[s.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Request Tools"}),s.jsx(He,{variant:"outline",className:"h-5 rounded-md px-1.5 py-0 font-mono text-[10px]",children:t.tools.length}),t.toolChoiceLabel!==null&&s.jsxs(He,{variant:"outline",className:"h-5 rounded-md px-1.5 py-0 font-mono text-[10px] text-muted-foreground",children:["tool_choice: ",t.toolChoiceLabel]})]}),s.jsx("div",{className:"mt-1 flex min-w-0 flex-wrap gap-1",children:t.categories.map(h=>s.jsxs(He,{variant:"outline",className:me("h-5 rounded-md px-1.5 py-0 font-mono text-[10px]",Hz[h.category]),children:[h.count," ",gx[h.category]]},h.category))})]})]}),s.jsxs(Ne,{type:"button",variant:"ghost",size:"sm",className:"h-7 border border-white/10 bg-black/20 px-2 text-muted-foreground hover:border-cyan-300/30 hover:bg-cyan-400/10 hover:text-cyan-100",onClick:()=>o(h=>!h),"aria-expanded":r,children:[r?s.jsx(gt,{className:"size-3.5"}):s.jsx(Ft,{className:"size-3.5"}),r?"Hide":"Show"]})]}),s.jsxs("div",{className:"flex min-w-0 flex-wrap gap-1.5 border-t border-white/10 bg-black/10 px-3 py-2",children:[d.map(h=>s.jsx(He,{variant:"outline",className:me("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&&s.jsxs("span",{className:"font-mono text-[10px] leading-5 text-muted-foreground",children:["+",f]})]}),r&&s.jsxs("div",{className:"space-y-2 border-t border-white/10 bg-black/15 px-3 py-3",children:[s.jsxs("label",{className:"flex h-8 items-center gap-2 rounded-md border border-white/10 bg-[#06080b] px-2 text-xs",children:[s.jsx(Ek,{className:"size-3.5 shrink-0 text-muted-foreground"}),s.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"})]}),s.jsx("div",{className:"grid gap-1.5",children:u.length>0?u.map(h=>s.jsx(qz,{tool:h,called:l.has(h.name)},h.name)):s.jsx("p",{className:"py-2 text-xs text-muted-foreground",children:"No matching tools"})})]})]})}),ln="agent-inspector:focus-log";function $a(e){window.dispatchEvent(new CustomEvent(ln,{detail:e}))}function di(e){if(typeof CustomEvent>"u"||!(e instanceof CustomEvent))return null;const t=e.detail,n=Le(t,"logId");if(typeof n!="number"||!Number.isInteger(n)||n<0)return null;const r=Le(t,"tab");switch(r){case"anatomy":case"request":return{logId:n,tab:r};case void 0:return{logId:n,tab:"request"};default:return null}}function Nd(e,t,n){return e==="anthropic"&&t==="full"&&n}function Kz(e,t){return e==="full"&&t}function Jz(e,t,n,r){return e==="anthropic"&&t==="full"&&n&&r}const Yz=["file","shell","browser","web","mcp","code","other"];function Ba(e){const t=e.replace(/\s+/g," ").trim();return t.length<=120?t:`${t.slice(0,119)}...`}function xx(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?Ba(t.slice(0,n+1)):Ba(t)}function Xz(e,t){return`${e} ${t??""}`.toLowerCase()}function tr(e,t){return t.some(n=>e.includes(n))}function bx(e,t){const n=Xz(e,t);return e.startsWith("mcp__")||e.startsWith("inspector_")||tr(n,[" mcp","model context protocol"])?"mcp":tr(n,["bash","shell","terminal","command","powershell","exec","process"])?"shell":tr(n,["browser","playwright","screenshot","click","navigate","page","tab"])?"browser":tr(n,["read","write","edit","file","glob","grep","patch","filesystem","directory"])?"file":tr(n,["web","search","http","url","fetch"])?"web":tr(n,["code","typescript","javascript","python","repl"])?"code":"other"}function yx(e){const t=Le(e,"properties");return t===null||typeof t!="object"||Array.isArray(t)?[]:Object.keys(t).sort((n,r)=>n.localeCompare(r))}function vx(e){const t=Le(e,"required");if(!Array.isArray(t))return[];const n=[];for(const r of t)typeof r=="string"&&r.length>0&&n.push(r);return n.sort((r,o)=>r.localeCompare(o))}function Qz(e){const t=Le(e,"name");if(typeof t!="string"||t.length===0)return null;const n=Le(e,"description"),r=Le(e,"input_schema")??null,o=typeof n=="string"?n:null;return{name:t,description:o,descriptionPreview:xx(o),category:bx(t,o),parameterCount:yx(r).length,requiredParameters:vx(r),schema:r}}function eR(e){const t=Le(e,"function"),n=Le(t,"name");if(typeof n!="string"||n.length===0)return null;const r=Le(t,"description"),o=Le(t,"parameters")??null,i=typeof r=="string"?r:null;return{name:n,description:i,descriptionPreview:xx(i),category:bx(n,i),parameterCount:yx(o).length,requiredParameters:vx(o),schema:o}}function tR(e){const t=eR(e);return t!==null?t:Qz(e)}function nR(e){if(e==null)return null;if(typeof e=="string")return e;const t=Le(e,"type"),n=Le(e,"name"),r=Le(Le(e,"function"),"name");if(typeof t=="string"&&typeof r=="string"&&r.length>0)return`${t}: ${r}`;if(typeof t=="string"&&typeof n=="string"&&n.length>0)return`${t}: ${n}`;if(typeof t=="string")return t;const o=JSON.stringify(e);return o===void 0?null:Ba(o)}function rR(e){const t=new Map;for(const n of e)t.set(n.category,(t.get(n.category)??0)+1);return Yz.flatMap(n=>{const r=t.get(n)??0;return r>0?[{category:n,count:r}]:[]})}function oR(e){const t=Le(e,"tools");if(!Array.isArray(t)||t.length===0)return null;const n=[];for(const r of t){const o=tR(r);o!==null&&n.push(o)}return n.length===0?null:{tools:n,toolChoiceLabel:nR(Le(e,"tool_choice")),categories:rR(n)}}function nr(){return s.jsx("div",{className:"h-1","aria-hidden":"true"})}function sR(e,t){switch(e){case"anatomy":return t===null?"request":"anatomy";case"request":return"request"}}const iR=15e3,aR=15e3,lR=256*1024,Cs=1024*1024,In="h-9 flex-none rounded-none border-0 border-b-2 border-transparent bg-transparent px-3 text-xs font-semibold text-muted-foreground shadow-none hover:bg-cyan-400/[0.04] hover:text-foreground data-[state=active]:border-cyan-300 data-[state=active]:bg-transparent data-[state=active]:text-cyan-100 data-[state=active]:shadow-none";function $o(e=null){return{status:"idle",text:"",offset:0,totalBytes:e,hasMore:e!==null&&e>0,error:null}}function js(e){return e??0}function wx(e){return e.bodyContentMode==="compact"||e.bodyContentMode==="truncated"}function kx(e){return wx(e)?js(e.rawRequestBodyBytes)>Cs||js(e.responseTextBytes)>Cs:!1}function cR(e){return wx(e)&&!kx(e)}function Bo(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 uR(e){return e instanceof dp?"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 Ed(e,t){return e?t.text!==""?t.text:t.status==="success"?"":null:null}function zn({children:e,className:t}){return s.jsx("div",{className:me("inspector-scrollbar mx-3 mb-3 max-h-[72vh] overflow-auto rounded-md border border-white/10 bg-[#06080b] p-3 shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]",t),children:e})}function ns({children:e}){return s.jsx("div",{className:"rounded-md border border-dashed border-white/10 bg-white/[0.02] px-3 py-5 text-center text-xs italic text-muted-foreground",children:e})}function Uo({children:e}){return s.jsx("pre",{className:"inspector-scrollbar max-h-[64vh] overflow-auto whitespace-pre-wrap break-words rounded-md border border-white/10 bg-black/30 p-3 font-mono text-xs leading-relaxed text-muted-foreground",children:e})}const dR={loading:"border-cyan-400/25 bg-cyan-400/[0.06] text-cyan-100",warning:"border-amber-400/25 bg-amber-400/[0.08] text-amber-100",danger:"border-rose-400/25 bg-rose-400/[0.08] text-rose-100"};function Vr({tone:e,title:t,children:n}){return s.jsxs("div",{className:me("mb-3 rounded-md border px-3 py-2 text-xs shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]",dR[e]),children:[t!==void 0&&s.jsx("div",{className:"mb-1 font-semibold",children:t}),s.jsx("div",{className:"leading-relaxed text-muted-foreground",children:n})]})}function Ho({label:e,state:t,expectedBytes:n,onLoadMore:r}){const o=t.totalBytes??n,i=o===null?Bo(t.offset):`${Bo(t.offset)} / ${Bo(o)}`,a=t.status!=="loading"&&t.hasMore,l=t.status==="failed"?"Retry":"Load more";return s.jsx(Vr,{tone:t.status==="failed"?"warning":"loading",title:`${e} body preview`,children:s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("span",{children:[t.status==="idle"&&o!==null?`${e} body is ${Bo(o)}. Loading the first preview chunk.`:`Loaded ${i}.`,t.status==="failed"&&t.error!==null&&` ${t.error}`]}),a&&s.jsx(Ne,{type:"button",variant:"outline",size:"sm",className:"h-7 border-white/10 bg-black/20 text-xs text-cyan-100 hover:border-cyan-300/35 hover:bg-cyan-400/10",onClick:r,children:l})]})})}function Td({headers:e,emptyLabel:t}){const n=e===void 0?[]:Object.entries(e).sort(([r],[o])=>r.localeCompare(o));return n.length===0?s.jsx(ns,{children:t}):s.jsx("div",{className:"overflow-hidden rounded-md border border-white/10 bg-black/20 font-mono text-xs",children:n.map(([r,o])=>s.jsxs("div",{className:"grid min-w-0 grid-cols-[minmax(140px,0.32fr)_minmax(0,1fr)] border-b border-white/5 last:border-b-0",children:[s.jsx("div",{className:"min-w-0 truncate border-r border-white/5 bg-white/[0.03] px-2.5 py-2 font-semibold text-cyan-200",children:r}),s.jsx("div",{className:"min-w-0 truncate px-2.5 py-2 text-muted-foreground",title:o,children:o})]},r))})}function fR({active:e,onClick:t}){return s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsxs(Ne,{variant:e?"default":"outline",size:"sm",className:me("h-8 border-white/10 text-xs shadow-none",e?"bg-cyan-300 text-black hover:bg-cyan-200":"bg-[#0a0d11] text-muted-foreground hover:border-cyan-300/30 hover:bg-cyan-400/10 hover:text-cyan-100"),onClick:t,"aria-pressed":e,children:[s.jsx(Yw,{className:"size-3.5 mr-1"}),e?"Showing diff":"Diff with Raw"]})}),s.jsx(Ue,{children:e?"Hide diff view":"Compare proxy output against the original raw version"})]})}const pR=g.memo(function({rawBody:e,displayedBody:t,emptyLabel:n}){const r=g.useMemo(()=>B3(e,t),[e,t]);return s.jsx(Ag,{result:r,emptyLabel:n})}),hR=g.memo(function({rawHeaders:e,headers:t,emptyLabel:n}){const r=g.useMemo(()=>$3(e,t),[e,t]);return s.jsx(Ag,{result:r,emptyLabel:n})}),mR=g.memo(function({log:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,timeDisplayFormat:o,cacheTrend:i=null,onCompareWithPrevious:a}){const[l,c]=g.useState(!1),[u,d]=g.useState(!1),[f,h]=g.useState(!1),[p,y]=g.useState(!1),[m,x]=g.useState("request"),[b,v]=g.useState(null),[w,C]=g.useState(null),[S,j]=g.useState("idle"),[N,A]=g.useState(()=>$o(e.rawRequestBodyBytes??null)),[z,L]=g.useState(()=>$o(e.responseTextBytes??null)),U=g.useRef(null),E=g.useRef(e.id),O=w??e,k=w===null&&kx(e),D=Ed(k,N),q=Ed(k,z),W=O.rawRequestBody??D,B=O.responseText??q,J=O.rawRequestBody===null&&D!==null,I=O.responseText===null&&q!==null,K=!J||N.hasMore===!1&&js(N.totalBytes)<=Cs,Z=!I||z.hasMore===!1&&js(z.totalBytes)<=Cs,R=Bn(O),ae=hg(R),de=g.useMemo(()=>ae.analyzeRequest(O.rawRequestBody),[ae,O.rawRequestBody]),ke=g.useMemo(()=>ae.analyzeResponse(O.responseText),[ae,O.responseText]),se=g.useMemo(()=>!n||R!=="anthropic"||O.rawRequestBody===null?null:_3(O.rawRequestBody).body,[O.rawRequestBody,R,n])??W,le=Ai(K?se:null),ce=Ai(K?W:null),fe=Ai(Z?B:null),be=g.useMemo(()=>O.headers&&Object.keys(O.headers).length>0?JSON.stringify(O.headers,null,2):null,[O.headers]),Se=g.useMemo(()=>O.rawHeaders&&Object.keys(O.rawHeaders).length>0?JSON.stringify(O.rawHeaders,null,2):null,[O.rawHeaders]),_=rn(se),ne=rn(W),Q=rn(be),M=rn(Se),P=rn(B),V=g.useMemo(()=>({request:{copyLabel:J?"Copy loaded request preview":"Copy request body",copyText:se,copyCopied:_.copied,onCopy:_.copy,expansion:K?{isExpanded:le.isExpanded,isPending:le.isPending,onToggle:le.toggle}:null,diffWithRaw:Jz(R,t,n,O.rawRequestBody!==null)?{active:p,onToggle:()=>y(!p)}:void 0,diffWithPrevious:a===void 0?void 0:()=>{a(O)}},"raw-request":{copyLabel:J?"Copy loaded raw request preview":"Copy raw request",copyText:W,copyCopied:ne.copied,onCopy:ne.copy,expansion:K?{isExpanded:ce.isExpanded,isPending:ce.isPending,onToggle:ce.toggle}:null},headers:{copyLabel:"Copy headers",copyText:be,copyCopied:Q.copied,onCopy:Q.copy,expansion:null},"raw-headers":{copyLabel:"Copy raw headers",copyText:Se,copyCopied:M.copied,onCopy:M.copy,expansion:null},raw:{copyLabel:I?"Copy loaded response preview":"Copy response",copyText:B,copyCopied:P.copied,onCopy:P.copy,expansion:Z?{isExpanded:fe.isExpanded,isPending:fe.isPending,onToggle:fe.toggle}:null}}),[se,J,K,_,le,p,O,O.rawRequestBody,W,ne,ce,be,Q,Se,M,O.responseText,I,Z,B,P,fe,R,t,n,a]),H=g.useMemo(()=>le.parsedData!==null?ae.anatomySegments(le.parsedData):null,[ae,le.parsedData]),X=g.useMemo(()=>oR(le.parsedData),[le.parsedData]),$=O.warnings??[],oe=g.useMemo(()=>{if(H!==null)return new Set(H.map(G=>G.path))},[H]),Y=P3({containerRef:U,setExpandToPath:v,ensureTabActive:()=>{m!=="request"&&x("request")}}),ee=g.useCallback((G,ue)=>{const ye=G==="request"?A:L;ye(Pe=>({...Pe,status:"loading",error:null}));const Ee=new URLSearchParams({part:G,offset:String(ue),limit:String(lR)});hr(`/api/logs/${String(e.id)}/body?${Ee.toString()}`,qv,aR).then(Pe=>{E.current===e.id&&ye(it=>({status:"success",text:Pe.offset===0?Pe.text:`${it.text}${Pe.text}`,offset:Pe.nextOffset??Pe.totalBytes,totalBytes:Pe.totalBytes,hasMore:Pe.hasMore,error:null}))}).catch(Pe=>{E.current===e.id&&ye(it=>({...it,status:"failed",error:uR(Pe)}))})},[e.id]),F=g.useCallback(()=>{const G=!l;G&&x(H!==null?"anatomy":"request"),c(G)},[H,l]);return g.useEffect(()=>{E.current=e.id,C(null),j("idle"),A($o(e.rawRequestBodyBytes??null)),L($o(e.responseTextBytes??null))},[e.id,e.rawRequestBodyBytes,e.responseTextBytes]),g.useEffect(()=>{if(!l||!cR(e)||w!==null||S!=="idle")return;let G=!1;return j("loading"),hr(`/api/logs/${String(e.id)}`,Qr,iR).then(ue=>{G||(C(ue),j("idle"))}).catch(()=>{G||j("failed")}),()=>{G=!0}},[S,l,w,e.bodyContentMode,e.id,e.rawRequestBodyBytes,e.responseTextBytes]),g.useEffect(()=>{l&&k&&N.status==="idle"&&(m!=="request"&&m!=="raw-request"&&m!=="anatomy"||ee("request",0))},[m,l,ee,N.status,k]),g.useEffect(()=>{l&&k&&z.status==="idle"&&(m!=="parsed"&&m!=="raw"||ee("response",0))},[m,l,ee,z.status,k]),g.useEffect(()=>{const G=ue=>{const ye=di(ue);ye!==null&&ye.logId===e.id&&(c(!0),x(sR(ye.tab,H)))};return window.addEventListener(ln,G),()=>{window.removeEventListener(ln,G)}},[H,e.id]),s.jsxs(ot,{children:[s.jsxs("div",{className:me("mb-2 overflow-hidden rounded-md border bg-[#090a0d] transition-[background-color,border-color,box-shadow]",l?"border-cyan-300/20 shadow-[0_18px_60px_rgba(0,0,0,0.28),inset_0_1px_0_rgba(255,255,255,0.05)]":"border-border/70 hover:border-border"),children:[s.jsx(hT,{log:O,messageCount:de.messageCount,toolCount:de.toolCount,expanded:l,onToggle:F,cacheTrend:i,slowResponseThresholdSeconds:r,timeDisplayFormat:o,activeTab:m,tabActions:V,onReplay:a===void 0?void 0:()=>{d(!0)}}),l&&s.jsx("div",{className:"border-t border-white/10 bg-[#050607]/80 pt-2",onClick:G=>G.stopPropagation(),onKeyDown:G=>G.stopPropagation(),children:s.jsxs(wg,{value:m,onValueChange:x,className:"gap-2",children:[s.jsxs(kg,{variant:"line",className:"inspector-scrollbar mx-3 h-auto w-[calc(100%-1.5rem)] justify-start overflow-x-auto rounded-none border-b border-white/10 bg-transparent p-0",children:[t==="full"&&s.jsx(Ct,{className:In,value:"raw-headers",children:"Raw Headers"}),t==="full"&&s.jsx(Ct,{className:In,value:"headers",children:"Headers"}),H!==null&&s.jsx(Ct,{className:In,value:"anatomy",children:"Context"}),Nd(R,t,n)&&s.jsx(Ct,{className:In,value:"raw-request",children:"Raw Request"}),s.jsx(Ct,{className:In,value:"request",children:"Request"}),t==="full"&&s.jsx(Ct,{className:In,value:"raw",children:"Raw Response"}),s.jsx(Ct,{className:In,value:"parsed",children:"Response"})]}),Nd(R,t,n)&&s.jsx(jt,{value:"raw-request",children:m==="raw-request"&&s.jsxs(zn,{children:[k&&s.jsx(Ho,{label:"Request",state:N,expectedBytes:e.rawRequestBodyBytes??null,onLoadMore:()=>ee("request",N.offset)}),W===null?s.jsx(ns,{children:k?"Request preview is loading":"No request body"}):ce.parsedData!==null?s.jsx(g.Suspense,{fallback:s.jsx(nr,{}),children:s.jsx(Au,{data:ce.parsedData,bulkDepth:ce.bulkDepth,bulkRevision:ce.bulkRevision})}):s.jsx(Uo,{children:W})]})}),s.jsx(jt,{value:"request",children:m==="request"&&s.jsxs(zn,{children:[S==="loading"&&s.jsx(Vr,{tone:"loading",children:"Loading full request and response bodies..."}),S==="failed"&&s.jsx(Vr,{tone:"warning",children:"Full request and response bodies could not be loaded. Compact metadata is still available."}),k&&s.jsx(Ho,{label:"Request",state:N,expectedBytes:e.rawRequestBodyBytes??null,onLoadMore:()=>ee("request",N.offset)}),$.length>0&&s.jsxs(Vr,{tone:"warning",children:[s.jsxs("div",{className:"flex items-center gap-2 font-semibold text-amber-300",children:[s.jsx(Pn,{className:"size-3.5"}),"Tool schema warnings"]}),s.jsx("ul",{className:"mt-2 space-y-1 text-muted-foreground",children:$.map(G=>s.jsx("li",{children:G},G))})]}),s.jsx(Gz,{summary:X,calledToolNames:ke.toolNames??[]}),p?s.jsx(pR,{rawBody:O.rawRequestBody,displayedBody:se,emptyLabel:"No transformation applied; raw and sent request bodies are identical."}):s.jsx("div",{ref:U,children:se===null?s.jsx(ns,{children:k?"Request preview is loading":"No request body"}):le.parsedData!==null?s.jsx(g.Suspense,{fallback:s.jsx(nr,{}),children:s.jsx(Au,{data:le.parsedData,bulkDepth:le.bulkDepth,bulkRevision:le.bulkRevision,anatomyPaths:oe,expandToPath:b})}):s.jsx(Uo,{children:se})})]})}),H!==null&&s.jsx(jt,{value:"anatomy",children:m==="anatomy"&&s.jsx(zn,{className:"p-0",children:s.jsx(g.Suspense,{fallback:s.jsx(nr,{}),children:s.jsx(E3,{parsed:le.parsedData,inputTokens:O.inputTokens??null,model:O.model,segments:H,onSegmentActivate:Y})})})}),t==="full"&&s.jsx(jt,{value:"headers",children:m==="headers"&&s.jsxs(zn,{children:[s.jsx("div",{className:"flex justify-end gap-2 mb-2",children:Kz(t,O.rawHeaders!==void 0&&Object.keys(O.rawHeaders).length>0)&&s.jsx(fR,{active:f,onClick:G=>{G.stopPropagation(),h(!f)}})}),f?s.jsx(hR,{rawHeaders:O.rawHeaders,headers:O.headers,emptyLabel:"No transformation applied; raw and processed headers are identical."}):s.jsx(Td,{headers:O.headers,emptyLabel:"No headers captured"})]})}),t==="full"&&s.jsx(jt,{value:"raw-headers",children:m==="raw-headers"&&s.jsx(zn,{children:s.jsx(Td,{headers:O.rawHeaders,emptyLabel:"No raw headers captured"})})}),s.jsx(jt,{value:"raw",children:m==="raw"&&s.jsxs(zn,{className:"space-y-3",children:[k&&s.jsx(Ho,{label:"Response",state:z,expectedBytes:e.responseTextBytes??null,onLoadMore:()=>ee("response",z.offset)}),O.error!==void 0&&O.error!==null&&s.jsx(Vr,{tone:"danger",title:"SSE Error",children:s.jsx("span",{className:"font-mono",children:O.error})}),B!==null&&Z?s.jsx(g.Suspense,{fallback:s.jsx(nr,{}),children:s.jsx(I3,{text:B,defaultExpandDepth:0,bulkDepth:fe.bulkDepth,bulkRevision:fe.bulkRevision})}):B!==null?s.jsx(Uo,{children:B}):s.jsx(ns,{children:k?"Response preview is loading":"No response"}),O.streaming===!0&&s.jsx(g.Suspense,{fallback:s.jsx(nr,{}),children:s.jsx(A3,{logId:O.id,truncated:O.streamingChunksPath!==null})})]})}),s.jsx(jt,{value:"parsed",children:m==="parsed"&&s.jsxs(zn,{children:[k&&s.jsx(Ho,{label:"Response",state:z,expectedBytes:e.responseTextBytes??null,onLoadMore:()=>ee("response",z.offset)}),I&&!Z?s.jsx(Uo,{children:B}):s.jsx(g.Suspense,{fallback:s.jsx(nr,{}),children:s.jsx(T3,{responseText:B,responseStatus:O.responseStatus,streaming:O.streaming,inputTokens:O.inputTokens,outputTokens:O.outputTokens,cacheCreationInputTokens:O.cacheCreationInputTokens,cacheReadInputTokens:O.cacheReadInputTokens,apiFormat:R,error:O.error})})]})})]})})]}),s.jsx(g.Suspense,{fallback:null,children:s.jsx(N3,{log:O,open:u,onOpenChange:d})})]})});function gR({stopReason:e,isPending:t,isFirst:n,isTurnStart:r,isOnlyEntry:o=!1,crabIndex:i=0,collapsible:a=!1,onToggle:l}){const c=e==="end_turn"||e==="stop",u=o&&r&&c,d=t&&!c,f=g.useMemo(()=>ws(i),[i]),h=g.useMemo(()=>r3(i),[i]),p=a&&l?{role:"button",tabIndex:0,className:"cursor-pointer",onClick:y=>{y.stopPropagation(),l()},onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),l())}}:{};return s.jsxs("div",{className:"flex flex-col items-center w-6 shrink-0 pt-0.5 pb-0.5",children:[s.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]",children:!n&&s.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),u?s.jsx("span",{title:"Start and end of turn",children:s.jsx(h,{className:me("size-3.5 text-[#80FF00]","animate-crab-settle","drop-shadow-[0_0_4px_rgba(128,255,0,0.5)]")})}):c?s.jsx("span",{title:e==="end_turn"?"End of Turn (Anthropic)":"End of Turn (OpenAI)",...p,children:s.jsx(f,{className:me("size-3.5 text-amber-400","animate-crab-settle","drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})}):r?s.jsx("span",{title:"Start of turn",...p,children:s.jsx(f,{className:me("size-3.5 text-emerald-400","animate-crab-appear","drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}):d?s.jsx("span",{title:"Processing…",children:s.jsx(f,{className:me("size-3.5 text-amber-300/80","animate-crab-crawl")})}):s.jsx("span",{children:s.jsx(f,{className:"size-3.5 text-muted-foreground/40"})}),s.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:!c&&s.jsx("div",{className:me("w-0.5 h-full",t?"border-dashed bg-transparent border-l-2 border-muted-foreground/20":"bg-muted-foreground/30")})})]})}function xR({event:e}){const t=rn(e.argumentsText),n=e.argumentsText!==null;return s.jsxs("div",{className:"group/tool-trace flex min-w-0 items-center gap-2 rounded-md border border-border/70 bg-muted/20 px-2.5 py-1.5 text-xs",children:[s.jsx(co,{className:"size-3.5 shrink-0 text-sky-400/70"}),s.jsx("span",{className:"font-mono font-semibold text-foreground/80",children:e.name}),e.argumentsPreview!==null&&s.jsxs(s.Fragment,{children:[s.jsx(Ft,{className:"size-3 shrink-0 text-muted-foreground/60"}),s.jsx("span",{className:"min-w-0 truncate font-mono text-muted-foreground",children:e.argumentsPreview})]}),n&&s.jsx("button",{type:"button",className:"ml-auto inline-flex size-6 shrink-0 items-center justify-center rounded text-muted-foreground opacity-0 transition-opacity hover:bg-background/80 hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/tool-trace:opacity-100 group-focus-within/tool-trace:opacity-100",onClick:t.copy,"aria-label":t.copied?"Copied tool arguments":"Copy tool arguments",title:t.copied?"Copied tool arguments":"Copy tool arguments",children:t.copied?s.jsx(tt,{className:"size-3.5"}):s.jsx(St,{className:"size-3.5"})})]},e.id)}function bR({events:e}){return e.length===0?null:s.jsx("div",{className:"mx-3 mb-2 grid gap-1.5",children:e.map(t=>s.jsx(xR,{event:t},t.id))})}const Ad=180;function yR(e,t){return e||t}function vR(e,t,n){return e>1&&t&&!n}function wR(e){const t=[];let n=[],r=0;for(const o of e){n.push({log:o,stopReason:WE(o)});const i=n[n.length-1];i!==void 0&&mg(i.stopReason)&&(t.push({entries:n,turnIndex:r}),n=[],r+=1)}return n.length>0&&t.push({entries:n,turnIndex:r}),t}function kR(e){const t=new Map;for(const n of e)for(let r=1;r<n.logs.length;r+=1){const o=n.logs[r],i=n.logs[r-1];if(o===void 0||i===void 0)continue;const a=Bn(o),l=Bn(i);a==="unknown"||a!==l||t.set(o.id,i)}return t}function _x(e){if(e===null)return null;try{const t=JSON.parse(e);return typeof t=="string"?JSON.parse(t):t}catch{return null}}function Sx(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>Ad?`${n.slice(0,Ad-1)}...`:n}function Cx(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 _R(e){const t=_x(e.responseText),n=Le(t,"content");if(!Array.isArray(n))return[];const r=[];for(const o of n){if(Le(o,"type")!=="tool_use")continue;const a=Le(o,"name");if(typeof a!="string"||a.length===0)continue;const l=Le(o,"input");r.push({id:`${String(e.id)}-anthropic-tool-${String(r.length)}`,logId:e.id,index:r.length,provider:"anthropic",name:a,argumentsText:Cx(l),argumentsPreview:Sx(l)})}return r}function SR(e){const t=_x(e.responseText),n=Le(t,"choices");if(!Array.isArray(n))return[];const r=[];for(const o of n){const i=Le(o,"message"),a=Le(i,"tool_calls");if(Array.isArray(a))for(const l of a){const c=Le(l,"function"),u=Le(c,"name");if(typeof u!="string"||u.length===0)continue;const d=Le(c,"arguments");r.push({id:`${String(e.id)}-openai-tool-${String(r.length)}`,logId:e.id,index:r.length,provider:"openai",name:u,argumentsText:Cx(d),argumentsPreview:Sx(d)})}}return r}function hc(e){switch(Bn(e)){case"anthropic":return _R(e);case"openai":return SR(e);case"unknown":return[]}}function CR(e,t,n=0){let r=0,o=0,i=0,a=0,l=0,c=0,u=0,d=0,f=null,h=0;for(const p of e)p.responseStatus===null?o+=1:p.responseStatus>=400&&(r+=1),p.elapsedMs!==null&&t>0&&p.elapsedMs>t*1e3&&(i+=1),p.inputTokens!==null&&(a+=p.inputTokens),p.outputTokens!==null&&(l+=p.outputTokens),p.cacheCreationInputTokens!==null&&(c+=p.cacheCreationInputTokens),p.cacheReadInputTokens!==null&&(u+=p.cacheReadInputTokens),p.elapsedMs!==null&&(d+=p.elapsedMs,f=f===null?p.elapsedMs:Math.max(f,p.elapsedMs)),h+=hc(p).length;return{llmCallCount:e.length,toolCallCount:h,failedCallCount:r,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 Vi(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const jR=g.memo(function({entries:t,viewMode:n,strip:r,slowResponseThresholdSeconds:o,cacheTrends:i,onCompareWithPrevious:a,comparisonPredecessors:l,turnIndex:c=0,timeDisplayFormat:u}){const d=t.length-1,f=t[d]?.stopReason??null,h=f!==null?mg(f):!1,p=t[d]?.log.responseStatus===null,y=t.length===1,m=vR(t.length,h,p),[x,b]=g.useState(!1),v=g.useRef(!1);g.useEffect(()=>{m?h&&!v.current&&b(!0):b(!1),v.current=h},[m,h]),g.useEffect(()=>{const q=W=>{const B=di(W);B!==null&&t.some(J=>J.log.id===B.logId)&&m&&b(!1)};return window.addEventListener(ln,q),()=>{window.removeEventListener(ln,q)}},[m,t]);const w=g.useCallback(()=>{m&&b(q=>!q)},[m]),C=g.useMemo(()=>{let q=0,W=0,B=null,J=!1;for(const I of t)I.log.inputTokens!==null&&(q+=I.log.inputTokens,J=!0),I.log.outputTokens!==null&&(W+=I.log.outputTokens,J=!0),I.log.elapsedMs!==null&&(B=B===null?I.log.elapsedMs:Math.max(B,I.log.elapsedMs));return{totalInput:q,totalOutput:W,hasTokens:J,maxElapsed:B}},[t,d]),S=g.useMemo(()=>{const q=new Set;for(const W of t){const B=bg(W.log.model);B!=="unknown"&&q.add(B)}return[...q]},[t]),j=g.useMemo(()=>ws(t[0]?.log.id??0),[t]),N=g.useMemo(()=>ws(t[d]?.log.id??0),[t,d]),A=c%2===0?"bg-muted/10":"bg-muted/25",z=C.maxElapsed!==null&&o>0&&C.maxElapsed>o*1e3,L=g.useMemo(()=>{const q=new Map;for(const W of t){const B=hc(W.log);B.length>0&&q.set(W.log.id,B)}return q},[t]),[U,E]=g.useState(0),O=g.useRef(null);g.useEffect(()=>{const q=O.current;if(!q)return;let W=0;const B=new ResizeObserver(()=>{window.cancelAnimationFrame(W),W=window.requestAnimationFrame(()=>E(J=>J+1))});return B.observe(q),()=>{B.disconnect(),window.cancelAnimationFrame(W)}},[]);const k=t[0]?.log.id??c,D=`Turn ${String(c+1)}`;return s.jsx("div",{ref:O,tabIndex:x?void 0:0,role:x?void 0:"group","aria-label":x?void 0:D,"data-nav-id":x?void 0:`turn-${String(k)}`,className:me("border rounded-lg",p?"border-amber-500/10":"border-transparent",!x&&"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),children:x?s.jsxs("div",{"data-nav-id":`turn-collapsed-${String(k)}`,"data-nav-action":"expand",role:"button",tabIndex:0,className:"flex items-stretch cursor-pointer focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none rounded-lg",onClick:w,onKeyDown:q=>{(q.key==="Enter"||q.key===" ")&&(q.preventDefault(),w())},children:[s.jsx("div",{className:"w-5 shrink-0 flex items-start pt-1.5",children:s.jsx("span",{className:"text-[10px] text-muted-foreground/50 font-mono tabular-nums leading-none select-none",children:c+1})}),s.jsxs("div",{className:"w-6 shrink-0 flex flex-col items-center pt-0.5 pb-0.5",children:[s.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]"}),s.jsx("span",{role:"button",tabIndex:0,title:"Start of turn — click to expand",className:"cursor-pointer",onClick:q=>{q.stopPropagation(),w()},onKeyDown:q=>{(q.key==="Enter"||q.key===" ")&&(q.preventDefault(),w())},children:s.jsx(j,{className:me("size-3.5 text-emerald-400","animate-crab-appear drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}),s.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:s.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),s.jsx("span",{role:"button",tabIndex:0,title:"End of Turn — click to expand",className:"cursor-pointer",onClick:q=>{q.stopPropagation(),w()},onKeyDown:q=>{(q.key==="Enter"||q.key===" ")&&(q.preventDefault(),w())},children:s.jsx(N,{className:me("size-3.5 text-amber-400","animate-crab-settle drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})})]}),t.length>1&&s.jsxs("div",{className:me("flex-1 min-w-0 mb-0.5 rounded-lg border border-border py-1 px-3 flex items-center gap-3 text-xs",A),children:[s.jsxs("span",{className:"text-blue-400/80 font-mono font-semibold tabular-nums shrink-0",children:["#",t[0]?.log.id??"?"," ~ #",t[d]?.log.id??"?"]}),s.jsxs("span",{className:"text-muted-foreground shrink-0",children:[t.length," request",t.length>1?"s":""]}),S.length>0&&s.jsx("span",{className:"flex items-center gap-0.5 shrink-0",children:S.map(q=>s.jsx(yg,{provider:q,className:"size-4"},q))}),C.maxElapsed!==null&&s.jsx(ot,{children:s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsxs("span",{className:me("flex items-center gap-1 shrink-0",z?"text-amber-400":"text-muted-foreground"),children:[s.jsx(wn,{className:"size-3"}),s.jsx("span",{className:"font-mono tabular-nums",children:Vi(C.maxElapsed)}),z&&s.jsx(Pn,{className:"size-3","aria-label":"Slow response"})]})}),s.jsx(Ue,{children:z?`Slow response: ${Vi(C.maxElapsed)} exceeds ${Vi(o*1e3)}`:"Slowest request in this turn"})]})}),C.hasTokens&&s.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[s.jsx(to,{className:"size-3 text-muted-foreground"}),s.jsxs("span",{className:"font-mono tabular-nums",children:[s.jsxs("span",{className:"text-blue-400",children:["IN ",Ve(C.totalInput)]})," / ",s.jsxs("span",{className:"text-amber-400",children:["OUT ",Ve(C.totalOutput)]})]})]}),s.jsx("span",{className:"flex-1 min-w-0"}),s.jsx(Ft,{className:"size-4 text-muted-foreground shrink-0"})]})]}):t.map((q,W)=>{const{log:B,stopReason:J}=q,I=W===0;return s.jsxs("div",{className:"flex items-stretch",children:[I?s.jsx("div",{className:"w-5 shrink-0 flex items-start pt-1.5",children:s.jsx("span",{className:"text-[10px] text-muted-foreground/50 font-mono tabular-nums leading-none select-none",children:c+1})}):s.jsx("div",{className:"w-5 shrink-0"}),s.jsx(gR,{stopReason:J,isPending:B.responseStatus===null,isFirst:W===0,isTurnStart:I,isOnlyEntry:y,crabIndex:B.id%12,collapsible:m&&I,onToggle:w}),s.jsxs("div",{className:me("flex-1 min-w-0 mb-0.5 rounded-lg",A),children:[s.jsx(mR,{log:B,viewMode:n,strip:r,slowResponseThresholdSeconds:o,timeDisplayFormat:u,cacheTrend:i?.get(B.id)??null,onCompareWithPrevious:l.has(B.id)?a:void 0}),s.jsx(bR,{events:L.get(B.id)??[]})]})]},B.id)})})}),mc=Ae(["episode","procedure","preference","project-fact"]),NR=Ae(["draft","promoted","failed"]),jx=re({source:Te("agent-inspector"),sessionId:T(),logIds:ge(te().int().positive()),project:T().nullable(),models:ge(T())}),ER=re({redacted:We(),patterns:ge(T())}),vo=re({id:T(),type:mc,title:T(),content:T(),tags:ge(T()),source:Te("agent-inspector"),sessionId:T(),logIds:ge(te().int().positive()),evidence:jx,status:NR,createdAt:T(),updatedAt:T(),openClawMemoryId:T().nullable(),error:T().nullable(),redaction:ER});re({idempotencyKey:T(),type:mc,title:T(),content:T(),tags:ge(T()),source:Te("agent-inspector"),project:T().nullable(),evidence:jx});const TR=re({id:T(),type:mc.or(T()),title:T(),content:T(),score:te().nullable(),source:T().nullable(),project:T().nullable(),evidence:na().optional()});re({results:ge(TR),warning:T().nullable()});const AR=re({candidates:ge(vo)}),IR=re({candidate:vo}),zR=re({error:T().optional(),candidate:vo.optional()}),RR=re({candidate:vo}),PR={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 Ua(e){return e===null?"-":e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`}function OR(e,t,n){return e===null||t===null?null:_l(e,t,n)}function MR(e){return`${String(e)} candidate${e===1?"":"s"}`}function Nx(e){return`log-${String(e)}`}function Ex(e){const t=Nx(e),n=document.getElementById(t);window.history.replaceState(null,"",`#${t}`),n instanceof HTMLElement&&(n.scrollIntoView({block:"center",behavior:"smooth"}),n.focus({preventScroll:!0}))}function LR(e){for(const t of e)if(t.responseStatus!==null&&t.responseStatus>=400)return t;return null}function DR(e){let t=null,n=-1;for(const r of e)r.elapsedMs!==null&&r.elapsedMs>n&&(t=r,n=r.elapsedMs);return t}function FR(e){for(const t of e)if(hc(t).length>0)return t;return null}function $R(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=FR(e.logs);e.summary.toolCallCount>0&&n!==null&&t.push({kind:"tool",title:`${String(e.summary.toolCallCount)} tool call${e.summary.toolCallCount===1?"":"s"}`,detail:`First tool evidence at #${String(n.id)}`,logId:n.id});const r=LR(e.logs);r!==null&&t.push({kind:"failure",title:`Failure #${String(r.responseStatus)}`,detail:`First failed request is #${String(r.id)}`,logId:r.id});const o=DR(e.logs);if(o!==null&&e.summary.maxElapsedMs!==null&&t.push({kind:"slow",title:`Slowest ${Ua(e.summary.maxElapsedMs)}`,detail:`Max latency observed at #${String(o.id)}`,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 BR(e){switch(e){case"session":return s.jsx($s,{className:"size-3.5 text-blue-400"});case"tool":return s.jsx(co,{className:"size-3.5 text-sky-400/70"});case"slow":return s.jsx(wn,{className:"size-3.5 text-amber-400"});case"failure":return s.jsx(Sp,{className:"size-3.5 text-destructive"});case"candidate":return s.jsx(kp,{className:"size-3.5 text-emerald-400"})}}function UR({insights:e}){return e.length===0?null:s.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=>s.jsxs("button",{type:"button",className:me("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&&Ex(t.logId)},disabled:t.logId===null,children:[BR(t.kind),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block truncate font-medium text-foreground/90",children:t.title}),s.jsx("span",{className:"block truncate font-mono text-[10px]",children:t.detail})]})]},`${t.kind}-${t.title}`))})}function HR(e){switch(e){case"draft":return"Draft";case"promoted":return"Promoted";case"failed":return"Failed"}}function WR(e,t){if(t)return"Promoting";switch(e.status){case"draft":return"Promote";case"failed":return"Retry";case"promoted":return"Promoted"}}function VR(e){return e.redaction.redacted?`Redacted ${e.redaction.patterns.join(", ")}`:"No sensitive pattern matched"}function qR(e,t){const n=e.replace(/\s+/g," ").trim();return n.length<=t?n:`${n.slice(0,t-3)}...`}function ZR(e){const t=e[0],n=e[e.length-1];return t===void 0?"No evidence logs":n===void 0||t===n?`#${String(t)}`:`#${String(t)}-#${String(n)}`}function Id(e){return e.join(", ")}function GR(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function KR({candidate:e,isPromoting:t,isUpdating:n,onPromoteCandidate:r,onUpdateCandidate:o}){const[i,a]=g.useState(!1),[l,c]=g.useState(e.type),[u,d]=g.useState(e.title),[f,h]=g.useState(e.content),[p,y]=g.useState(Id(e.tags)),[m,x]=g.useState(null),b=e.status!=="promoted",v=e.status!=="promoted",w=g.useCallback(()=>{c(e.type),d(e.title),h(e.content),y(Id(e.tags)),x(null)},[e.content,e.tags,e.title,e.type]),C=g.useCallback(async()=>{const S=u.trim(),j=f.trim(),N=GR(p);if(S.length===0){x("Title is required.");return}if(j.length===0){x("Content is required.");return}if(N.length===0){x("At least one tag is required.");return}x(null),await o(e.id,{type:l,title:S,content:j,tags:N})&&a(!1)},[e.id,f,p,u,l,o]);return i?s.jsx("div",{className:"rounded-md border border-border/80 bg-background/60 px-2.5 py-2",children:s.jsxs("div",{className:"grid gap-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("select",{value:l,disabled:n,onChange:S=>{const j=vo.shape.type.safeParse(S.currentTarget.value);j.success&&c(j.data)},className:"h-7 rounded-md border border-input bg-background px-2 text-xs","aria-label":"Candidate type",children:[s.jsx("option",{value:"episode",children:"episode"}),s.jsx("option",{value:"procedure",children:"procedure"}),s.jsx("option",{value:"preference",children:"preference"}),s.jsx("option",{value:"project-fact",children:"project-fact"})]}),s.jsx("input",{value:u,disabled:n,onChange:S=>d(S.currentTarget.value),className:"h-7 min-w-[220px] flex-1 rounded-md border border-input bg-background px-2 text-xs","aria-label":"Candidate title"})]}),s.jsx("textarea",{value:f,disabled:n,onChange:S=>h(S.currentTarget.value),className:"min-h-28 rounded-md border border-input bg-background px-2 py-1.5 font-mono text-[11px] leading-relaxed","aria-label":"Candidate content"}),s.jsx("input",{value:p,disabled:n,onChange:S=>y(S.currentTarget.value),className:"h-7 rounded-md border border-input bg-background px-2 text-xs","aria-label":"Candidate tags"}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground",children:[s.jsx(qc,{className:"size-3"}),"Saving reruns Inspector redaction before promotion."]}),s.jsx("span",{className:"flex-1"}),m!==null&&s.jsx("span",{className:"text-[10px] text-destructive",children:m}),s.jsxs(Ne,{type:"button",variant:"ghost",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:n,onClick:()=>{w(),a(!1)},children:[s.jsx(kl,{className:"size-3.5"}),"Cancel"]}),s.jsxs(Ne,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 px-2 text-xs",disabled:n,onClick:()=>{C()},children:[n?s.jsx(cs,{className:"size-3.5 animate-spin"}):s.jsx(Sk,{className:"size-3.5"}),"Save"]})]})]})}):s.jsxs("div",{className:"rounded-md border border-border/80 bg-background/60 px-2.5 py-2",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx(He,{variant:"outline",className:"h-5 px-1.5 text-[10px] font-mono",children:e.type}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",title:e.title,children:e.title}),s.jsx(He,{variant:"outline",className:me("h-5 shrink-0 px-1.5 text-[10px] font-mono",PR[e.status]),children:HR(e.status)})]}),s.jsx("p",{className:"mt-1 text-[11px] leading-relaxed text-muted-foreground",title:e.content,children:qR(e.content,360)}),s.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-[10px] text-muted-foreground",children:[s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(Ww,{className:"size-3"}),ZR(e.logIds)]}),s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx(qc,{className:"size-3"}),VR(e)]}),e.status==="promoted"&&s.jsxs("span",{className:"inline-flex items-center gap-1 text-emerald-500",children:[s.jsx(Hc,{className:"size-3"}),e.openClawMemoryId??"OpenClaw"]}),e.status==="failed"&&e.error!==null&&s.jsxs("span",{className:"inline-flex items-center gap-1 text-destructive",children:[s.jsx(Sp,{className:"size-3"}),e.error]})]}),s.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-1.5",children:[e.logIds.map(S=>s.jsxs("a",{href:`#${Nx(S)}`,onClick:j=>{j.preventDefault(),Ex(S)},className:"rounded border border-blue-400/25 px-1.5 py-0.5 font-mono text-[10px] text-blue-400 underline-offset-2 transition-colors hover:bg-blue-400/10 hover:text-blue-300 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":`Jump to evidence log ${String(S)}`,children:["#",S]},S)),s.jsx("span",{className:"flex-1"}),v&&s.jsxs(Ne,{type:"button",variant:"ghost",size:"sm",className:"h-6 gap-1.5 px-2 text-[10px]",disabled:n||t,onClick:()=>a(!0),children:[s.jsx(jp,{className:"size-3"}),"Review"]}),s.jsxs(Ne,{type:"button",variant:b?"outline":"ghost",size:"sm",className:"h-6 gap-1.5 px-2 text-[10px]",onClick:()=>r(e.id),disabled:!b||t||n,children:[t?s.jsx(cs,{className:"size-3 animate-spin"}):b?s.jsx(Nw,{className:"size-3"}):s.jsx(Hc,{className:"size-3"}),WR(e,t)]})]})]})}function JR({candidates:e,promotingCandidateIds:t,updatingCandidateIds:n,onPromoteCandidate:r,onUpdateCandidate:o}){return e.length===0?null:s.jsx("div",{className:"mt-2 grid gap-1.5",children:e.map(i=>s.jsx(KR,{candidate:i,isPromoting:t.has(i.id),isUpdating:n.has(i.id),onPromoteCandidate:r,onUpdateCandidate:o},i.id))})}function YR({logs:e,scopeId:t,slowResponseThresholdSeconds:n,showRollupMetrics:r,timeDisplayFormat:o}){const[i,a]=g.useState([]),[l,c]=g.useState(!0),[u,d]=g.useState({status:"idle",error:null}),[f,h]=g.useState(()=>new Set),[p,y]=g.useState(()=>new Set),m=i.length>0,x=g.useMemo(()=>CR(e,n,i.length),[i.length,e,n]),b=g.useMemo(()=>$R({logs:e,scopeId:t,summary:x,candidates:i}),[i,e,t,x]),v=r||x.maxElapsedMs!==null,w=g.useMemo(()=>OR(x.startedAt,x.endedAt,o),[x.endedAt,x.startedAt,o]),C=g.useCallback(()=>{e.length===0||u.status==="loading"||(d({status:"loading",error:null}),(async()=>{try{const N=await fetch(`/api/knowledge/sessions/${encodeURIComponent(t)}/candidates`,{method:"POST"});if(!N.ok){const z=await on(N,`Candidate generation failed with ${String(N.status)}`);d({status:"failed",error:z});return}const A=await Mt(N,AR);a(A.candidates),c(A.candidates.length>0),d(A.candidates.length>0?{status:"ready",error:null}:{status:"failed",error:"No candidate was generated for this trace scope."})}catch(N){d({status:"failed",error:N instanceof Error?N.message:"Candidate response was invalid"})}})())},[u.status,e.length,t]),S=g.useCallback(N=>{h(A=>{if(A.has(N))return A;const z=new Set(A);return z.add(N),z}),(async()=>{try{const A=await fetch(`/api/knowledge/candidates/${encodeURIComponent(N)}/promote`,{method:"POST"}),z=await A.json().catch(()=>null),L=IR.safeParse(z);if(A.ok&&L.success){a(E=>E.map(O=>O.id===L.data.candidate.id?L.data.candidate:O)),d({status:"ready",error:null});return}const U=zR.safeParse(z);U.success&&U.data.candidate!==void 0&&a(E=>E.map(O=>O.id===U.data.candidate?.id?U.data.candidate:O)),d({status:"failed",error:U.success?U.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(N),z})}})()},[]),j=g.useCallback(async(N,A)=>{y(z=>{if(z.has(N))return z;const L=new Set(z);return L.add(N),L});try{const z=await fetch(`/api/knowledge/candidates/${encodeURIComponent(N)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)});if(!z.ok){const U=await on(z,`Candidate update failed with ${String(z.status)}`);return d({status:"failed",error:U}),!1}const L=await Mt(z,RR);return a(U=>U.map(E=>E.id===L.candidate.id?L.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{y(z=>{const L=new Set(z);return L.delete(N),L})}},[]);return e.length===0?null:s.jsxs("section",{className:"mb-2 rounded-lg border border-border bg-muted/10 px-3 py-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 text-xs",children:[r&&s.jsxs("span",{className:"inline-flex items-center gap-1.5 font-semibold text-foreground",children:[s.jsx($s,{className:"size-3.5 text-blue-400"}),x.llmCallCount," LLM"]}),s.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[s.jsx(co,{className:"size-3.5 text-sky-400/70"}),x.toolCallCount," tools"]}),r&&s.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[s.jsx(to,{className:"size-3.5 text-emerald-400"}),s.jsxs("span",{className:"font-mono",children:[Ve(x.totalInputTokens)," / ",Ve(x.totalOutputTokens)]})]}),(x.totalCacheCreationInputTokens>0||x.totalCacheReadInputTokens>0)&&s.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[s.jsx(to,{className:"size-3.5 text-purple-400"}),s.jsxs("span",{className:"font-mono",children:["KV Cache +",Ve(x.totalCacheCreationInputTokens)," / ~",Ve(x.totalCacheReadInputTokens)]})]}),v&&s.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[s.jsx(wn,{className:"size-3.5"}),r&&s.jsx("span",{className:"font-mono",children:Ua(x.totalElapsedMs)}),x.maxElapsedMs!==null&&s.jsxs("span",{className:"font-mono text-muted-foreground/70",children:["max ",Ua(x.maxElapsedMs)]})]}),r&&w!==null&&s.jsx("span",{className:"font-mono text-muted-foreground/70",children:w}),(x.failedCallCount>0||x.pendingCallCount>0||x.slowCallCount>0)&&s.jsxs("span",{className:"inline-flex items-center gap-1.5 text-amber-400",children:[s.jsx(Pn,{className:"size-3.5"}),s.jsxs("span",{className:"font-mono",children:[x.failedCallCount," fail / ",x.pendingCallCount," pending /"," ",x.slowCallCount," slow"]})]}),s.jsx("span",{className:"flex-1"}),m&&s.jsx(He,{variant:"outline",className:"h-6 px-2 text-[10px] font-mono",children:MR(x.knowledgeCandidateCount)}),s.jsxs(Ne,{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"?s.jsx(Tt,{className:"size-3.5 animate-spin"}):s.jsx(kp,{className:"size-3.5"}),"Candidate"]}),m&&s.jsx(Ne,{type:"button",variant:"ghost",size:"icon",className:"size-7 text-muted-foreground",onClick:()=>c(N=>!N),"aria-expanded":l,"aria-label":l?"Collapse memory candidates":"Expand memory candidates",children:l?s.jsx(gt,{className:"size-3.5"}):s.jsx(Ft,{className:"size-3.5"})})]}),u.status==="failed"&&s.jsx("p",{className:"mt-2 text-xs text-destructive",children:u.error}),s.jsx(UR,{insights:b}),l&&s.jsx(JR,{candidates:i,promotingCandidateIds:f,updatingCandidateIds:p,onPromoteCandidate:S,onUpdateCandidate:j})]})}function XR(e){let t=0,n=0;for(const r of e)r.inputTokens!==null&&(t+=r.inputTokens),r.outputTokens!==null&&(n+=r.outputTokens);return{totalInputTokens:t,totalOutputTokens:n}}const Tx=g.memo(function({group:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,cacheTrends:o,onCompareWithPrevious:i,comparisonPredecessors:a,onClearGroup:l,standalone:c=!1,hasPinnedSessionContext:u=!1,timeDisplayFormat:d,expanded:f,onExpandedChange:h}){const[p,y]=g.useState(!1),m=f??p,x=g.useCallback(A=>{if(h!==void 0){h(A);return}y(A)},[h]),b=g.useMemo(()=>XR(e.logs),[e.logs]),v=e.logs[0]?.timestamp??new Date().toISOString(),w=e.logs[e.logs.length-1]?.timestamp??new Date().toISOString(),C=BE(e.logs),S=e.logs.some(A=>A.responseStatus===null),j=c&&!u,N=g.useMemo(()=>wR(e.logs),[e.logs]);return g.useEffect(()=>{const A=z=>{if(c)return;const L=di(z);L!==null&&e.logs.some(U=>U.id===L.logId)&&x(!0)};return window.addEventListener(ln,A),()=>{window.removeEventListener(ln,A)}},[e.logs,x,c]),s.jsxs("div",{className:"mb-2",children:[!c&&s.jsx(FE,{conversationId:e.conversationId,startTime:v,endTime:w,totalCalls:e.logs.length,totalInputTokens:b.totalInputTokens,totalOutputTokens:b.totalOutputTokens,apiFormat:$E(e.logs),expanded:m,onToggle:()=>x(!m),hideApiFormat:C,isLoading:S,userAgent:e.logs[0]?.userAgent??null,timeDisplayFormat:d,onClear:()=>l(e.logs.map(A=>A.id))}),yR(c,m)&&s.jsxs("div",{children:[s.jsx(YR,{logs:e.logs,scopeId:e.conversationId,slowResponseThresholdSeconds:r,showRollupMetrics:j,timeDisplayFormat:d}),N.map(A=>s.jsx(jR,{entries:A.entries,viewMode:t,strip:n,slowResponseThresholdSeconds:r,timeDisplayFormat:d,cacheTrends:o,onCompareWithPrevious:i,comparisonPredecessors:a,turnIndex:A.turnIndex},A.turnIndex))]})]})});function zd({className:e}){return s.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:me("inline-block size-5",e),children:[s.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"}),s.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),s.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),s.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),s.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"}),s.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),s.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),s.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),s.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),s.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),s.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]})}const QR="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 eP({className:e}){return s.jsx("img",{src:QR,alt:"Model Context Protocol","aria-hidden":"true",className:me("inline-block size-8 object-contain invert",e)})}function Ns({...e}){return s.jsx(xN,{"data-slot":"select",...e})}function Es({...e}){return s.jsx(yN,{"data-slot":"select-value",...e})}function Ts({className:e,size:t="default",children:n,...r}){return s.jsxs(bN,{"data-slot":"select-trigger","data-size":t,className:me("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,s.jsx(vN,{asChild:!0,children:s.jsx(gt,{className:"size-4 opacity-50"})})]})}function As({className:e,children:t,position:n="popper",align:r="center",...o}){return s.jsx(wN,{children:s.jsxs(kN,{"data-slot":"select-content",className:me("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,align:r,...o,children:[s.jsx(tP,{}),s.jsx(_N,{className:me("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),s.jsx(nP,{})]})})}function Wt({className:e,children:t,...n}){return s.jsxs(SN,{"data-slot":"select-item",className:me("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:[s.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:s.jsx(jN,{children:s.jsx(tt,{className:"size-4"})})}),s.jsx(CN,{children:t})]})}function tP({className:e,...t}){return s.jsx(NN,{"data-slot":"select-scroll-up-button",className:me("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(gl,{className:"size-4"})})}function nP({className:e,...t}){return s.jsx(EN,{"data-slot":"select-scroll-down-button",className:me("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(gt,{className:"size-4"})})}const rP=Ae(["critical","warning","notice"]),oP=Ae(["open"]),sP=Ae(["proxy","tool-schema","run","group"]),Ax=Ae(["request-failure","request-timeout","slow-response","tool-schema","run-failure","group-failure","group-incomplete"]),iP=Ae(["log","session","run","group"]),aP=Ae(["anthropic","openai","unknown"]),lP=re({kind:iP,id:T(),label:T(),href:T().nullable()}),cP=re({id:T(),fingerprint:T(),severity:rP,category:Ax,source:sP,status:oP,title:T(),message:T(),count:te().int().positive(),firstSeenAt:T(),lastSeenAt:T(),logIds:ge(te().int().positive()),sessionIds:ge(T()),runIds:ge(T()),groupIds:ge(T()),provider:T().nullable(),model:T().nullable(),apiFormat:aP.nullable(),evidence:ge(lP),metadata:nt(T(),dt)}),uP=re({category:Ax,count:te().int().nonnegative()}),Ix=re({total:te().int().nonnegative(),open:te().int().nonnegative(),critical:te().int().nonnegative(),warning:te().int().nonnegative(),notice:te().int().nonnegative(),byCategory:ge(uP)}),dP=re({alerts:ge(cP),total:te().int().nonnegative(),limit:te().int().positive(),summary:Ix}),fP=8e3,pP=1e4;function hP(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 mP(e,t){const n=Un(t?hP(e):null,r=>hr(r,dP,pP));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 gP(){const e=Un("/api/alerts/summary",t=>hr(t,Ix,fP),{refreshInterval:5e3,revalidateOnFocus:!0});return{summary:e.data??null,isLoading:e.isLoading,error:e.error,mutate:e.mutate}}const xP=["request-failure","request-timeout","slow-response","tool-schema","run-failure","group-failure","group-incomplete"];function zx(e){switch(e){case"critical":return"Critical";case"warning":return"Warning";case"notice":return"Notice"}}function bP(e){switch(e){case"proxy":return"Proxy";case"tool-schema":return"Tool schema";case"run":return"Run";case"group":return"Group"}}function gc(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 yP(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 vP(e){switch(e){case"critical":return"bg-red-400";case"warning":return"bg-amber-300";case"notice":return"bg-sky-300"}}function wP(e){switch(e){case"critical":return"text-red-200";case"warning":return"text-amber-100";case"notice":return"text-sky-100"}}function kP(e){switch(e){case"request-failure":case"run-failure":case"group-failure":return s.jsx(Pk,{className:"size-3.5"});case"request-timeout":case"slow-response":return s.jsx(Sw,{className:"size-3.5"});case"tool-schema":return s.jsx(Pn,{className:"size-3.5"});case"group-incomplete":return s.jsx(Y2,{className:"size-3.5"})}}function Ha(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 wt(e){return e.toLocaleString()}function Rx(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 _P(e,t){const n={limit:100};return e!=="all"&&(n.severity=e),t!=="all"&&(n.category=t),n}function SP(e,t){if(t!==null){const n=e.find(r=>r.id===t);if(n!==void 0)return n}return e[0]??null}function Wo({label:e,count:t,tone:n}){const r=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 s.jsxs("div",{className:me("rounded-md border px-3 py-2",r),children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase opacity-75",children:e}),s.jsx("div",{className:"mt-1 text-lg font-semibold leading-none",children:wt(t)})]})}function Vo({value:e,active:t,label:n,count:r,onClick:o}){return s.jsxs(Ne,{type:"button",variant:t?"secondary":"ghost",size:"sm","aria-pressed":t,onClick:()=>o(e),className:"h-7 px-2",children:[n,r!==null?s.jsx(He,{variant:"outline",children:wt(r)}):null]})}function CP({category:e,active:t,count:n,onClick:r}){return s.jsxs(Ne,{type:"button",variant:t?"secondary":"ghost",size:"sm","aria-pressed":t,onClick:()=>r(e),className:"h-7 px-2",children:[kP(e),gc(e),s.jsx(He,{variant:"outline",children:wt(n)})]})}function jP({alerts:e,selectedAlertId:t,isLoading:n,error:r,onSelect:o}){return n?s.jsxs("div",{className:"flex min-h-56 items-center justify-center rounded-md border border-dashed border-border text-xs text-muted-foreground",children:[s.jsx(Tt,{className:"mr-2 size-3.5 animate-spin"}),"Loading alerts..."]}):r!==void 0?s.jsx("div",{className:"rounded-md border border-red-300/30 bg-red-500/10 px-3 py-2 text-xs text-red-100",children:r.message}):e.length===0?s.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."}):s.jsx("div",{className:"min-h-0 space-y-2 overflow-y-auto pr-1",children:e.map(i=>{const a=i.id===t;return s.jsxs("button",{type:"button",onClick:()=>o(i.id),className:me("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:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx("span",{className:me("size-2 rounded-full",vP(i.severity))}),s.jsx("span",{className:me("text-xs font-semibold",wP(i.severity)),children:zx(i.severity)}),s.jsx("span",{className:"truncate text-xs text-muted-foreground",children:gc(i.category)})]}),s.jsx("div",{className:"mt-1 truncate text-sm font-semibold",children:i.title}),s.jsx("div",{className:"mt-1 line-clamp-2 text-xs text-muted-foreground",children:i.message})]}),i.count>1?s.jsxs(He,{variant:"outline",className:"shrink-0",children:["x",wt(i.count)]}):null]}),s.jsxs("div",{className:"mt-2 flex min-w-0 items-center justify-between gap-2 text-[11px] text-muted-foreground",children:[s.jsx("span",{className:"truncate",children:Rx(i)}),s.jsx("span",{className:"shrink-0",children:Ha(i.lastSeenAt)})]})]},i.id)})})}function NP({alert:e,onNavigate:t}){return e.evidence.length===0?s.jsx("span",{className:"text-xs text-muted-foreground",children:"No linked evidence"}):s.jsx("div",{className:"flex flex-wrap gap-2",children:e.evidence.map(n=>n.href===null?s.jsx(He,{variant:"outline",children:n.label},`${n.kind}:${n.id}`):s.jsx(He,{variant:"outline",asChild:!0,children:s.jsx("a",{href:n.href,onClick:t,children:n.label})},`${n.kind}:${n.id}`))})}function EP({alert:e,onNavigate:t}){return e===null?s.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."}):s.jsxs("div",{className:"min-h-0 overflow-y-auto rounded-md border border-border bg-background/70",children:[s.jsx("div",{className:me("border-b px-4 py-3",yP(e.severity)),children:s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(He,{variant:"outline",children:zx(e.severity)}),s.jsx(He,{variant:"outline",children:bP(e.source)}),s.jsx(He,{variant:"outline",children:gc(e.category)})]}),s.jsx("h3",{className:"mt-3 text-base font-semibold",children:e.title}),s.jsx("p",{className:"mt-1 text-sm opacity-85",children:e.message})]}),e.count>1?s.jsxs(He,{variant:"outline",className:"shrink-0",children:[wt(e.count)," hits"]}):null]})}),s.jsxs("div",{className:"space-y-4 p-4",children:[s.jsxs("div",{className:"grid gap-2 text-xs sm:grid-cols-2",children:[s.jsx(pn,{label:"Target",value:Rx(e)}),s.jsx(pn,{label:"Last seen",value:Ha(e.lastSeenAt)}),s.jsx(pn,{label:"First seen",value:Ha(e.firstSeenAt)}),s.jsx(pn,{label:"Protocol",value:e.apiFormat??"n/a"})]}),s.jsxs("div",{children:[s.jsx("div",{className:"mb-2 text-xs font-semibold text-muted-foreground",children:"Evidence"}),s.jsx(NP,{alert:e,onNavigate:t})]}),s.jsxs("div",{className:"grid gap-2 text-xs sm:grid-cols-2",children:[s.jsx(pn,{label:"Logs",value:e.logIds.length===0?"n/a":wt(e.logIds.length)}),s.jsx(pn,{label:"Sessions",value:e.sessionIds.length===0?"n/a":wt(e.sessionIds.length)}),s.jsx(pn,{label:"Runs",value:e.runIds.length===0?"n/a":wt(e.runIds.length)}),s.jsx(pn,{label:"Groups",value:e.groupIds.length===0?"n/a":wt(e.groupIds.length)})]})]})]})}function pn({label:e,value:t}){return s.jsxs("div",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase text-muted-foreground",children:e}),s.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-foreground",children:t})]})}function Rd(){const[e,t]=g.useState(!1),[n,r]=g.useState("all"),[o,i]=g.useState("all"),[a,l]=g.useState(null),{summary:c,isLoading:u}=gP(),d=g.useMemo(()=>_P(n,o),[o,n]),{alerts:f,total:h,isLoading:p,error:y,mutate:m}=mP(d,e),x=g.useMemo(()=>SP(f,a),[f,a]);g.useEffect(()=>{!e||a!==null&&f.some(N=>N.id===a)||l(f[0]?.id??null)},[f,e,a]);const b=c?.total??0,v=c?.critical??0,w=c?.warning??0,C=c?.notice??0,S=v>0?"bg-red-500":w>0?"bg-amber-400":"bg-sky-400";return s.jsxs(ho,{open:e,onOpenChange:t,children:[s.jsx(Kl,{asChild:!0,children:s.jsxs(Ne,{type:"button",variant:"ghost",size:"icon",className:"relative size-8","aria-label":"Alerts",title:"Alerts",children:[s.jsx(la,{className:"size-4"}),u?s.jsx(Tt,{className:"absolute -right-0.5 -top-0.5 size-3 animate-spin text-muted-foreground"}):b>0?s.jsx("span",{className:me("absolute -right-1 -top-1 min-w-4 rounded-full px-1 text-[10px] font-semibold leading-4 text-white",S),children:wt(b)}):null,s.jsx("span",{className:"sr-only",children:"Alerts"})]})}),s.jsxs(mo,{className:"flex max-h-[86vh] max-w-6xl flex-col overflow-hidden",children:[s.jsxs(go,{children:[s.jsxs(xo,{className:"flex items-center gap-2 pr-8",children:[s.jsx(la,{className:"size-5 text-red-300"}),s.jsx("span",{children:"Alerts"}),s.jsx(He,{variant:"outline",children:wt(b)})]}),s.jsx(sE,{className:"sr-only",children:"Local alert board for captured Inspector evidence."})]}),s.jsxs("div",{className:"grid gap-2 sm:grid-cols-4",children:[s.jsx(Wo,{label:"Open",count:c?.open??0,tone:"neutral"}),s.jsx(Wo,{label:"Critical",count:v,tone:"critical"}),s.jsx(Wo,{label:"Warning",count:w,tone:"warning"}),s.jsx(Wo,{label:"Notice",count:C,tone:"notice"})]}),s.jsxs("div",{className:"flex min-h-0 flex-wrap items-center justify-between gap-2 border-y border-border py-3",children:[s.jsxs("div",{className:"flex flex-wrap gap-1",children:[s.jsx(Vo,{value:"all",active:n==="all",label:"All",count:c?.total??null,onClick:r}),s.jsx(Vo,{value:"critical",active:n==="critical",label:"Critical",count:v,onClick:r}),s.jsx(Vo,{value:"warning",active:n==="warning",label:"Warning",count:w,onClick:r}),s.jsx(Vo,{value:"notice",active:n==="notice",label:"Notice",count:C,onClick:r})]}),s.jsxs(Ne,{type:"button",variant:"outline",size:"sm",className:"h-7 shrink-0 px-2",onClick:()=>{m()},children:[s.jsx(cs,{className:"size-3.5"}),"Refresh"]})]}),s.jsxs("div",{className:"flex flex-wrap gap-1",children:[s.jsx(Ne,{type:"button",variant:o==="all"?"secondary":"ghost",size:"sm","aria-pressed":o==="all",onClick:()=>i("all"),className:"h-7 px-2",children:"All categories"}),xP.map(j=>{const N=c?.byCategory.find(A=>A.category===j)?.count??0;return N===0?null:s.jsx(CP,{category:j,active:o===j,count:N,onClick:i},j)})]}),s.jsxs("div",{className:"grid min-h-0 flex-1 gap-4 md:grid-cols-[360px_minmax(0,1fr)]",children:[s.jsxs("div",{className:"flex min-h-0 flex-col",children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs text-muted-foreground",children:[s.jsxs("span",{children:[wt(h)," matched"]}),s.jsx("span",{children:f.length<h?`${wt(f.length)} shown`:"Latest"})]}),s.jsx(jP,{alerts:f,selectedAlertId:x?.id??null,isLoading:p,error:y,onSelect:l})]}),s.jsx(EP,{alert:x,onNavigate:()=>t(!1)})]})]})]})}const TP=12e3;function AP(e){return e===null||e.evidence===null?null:`/api/groups/${encodeURIComponent(e.id)}/evidence`}function IP(e){const t=Un(AP(e),n=>hr(n,A2,TP));return{evidenceResponse:t.data??null,isLoading:t.isLoading,error:t.error,mutate:t.mutate}}const zP=8e3;function RP(){const e=Un("/api/groups",t=>hr(t,yp,zP));return{groups:e.data?.groups??[],isLoading:e.isLoading,error:e.error,mutate:e.mutate}}function PP(e,t){const n=`/api/groups/${encodeURIComponent(e)}`;return t?`${n}?deleteEvidence=1`:n}function Px(e){let t=0,n=0,r=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":r+=1;break;case"created":break;case null:o+=1;break}return{memberCount:e.members.length,completedMembers:t,failedMembers:n,runningMembers:r,missingStatusMembers:o}}function OP(e,t,n=null){return t!==null&&t.group.id===e.id?t.members.map(r=>({member:r.member,exportMember:r,source:"export"})):n!==null&&n.group.id===e.id&&n.members!==null?n.members.map(r=>({member:r.member,exportMember:r,source:"evidence"})):e.members.map(r=>({member:r,exportMember:null,source:"group"}))}function xc(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 bc(e){return e??"unknown"}function MP(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 fi(e){return e===null||e.trim().length===0?"-":e}function Et(e){return e.toLocaleString()}function Wa(e){return e==null?"-":e<1e3?`${Et(e)} ms`:`${(e/1e3).toFixed(1)} s`}function vr(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 Pd(e){return e===null?"-":vr(e)}function LP(e){const t=JSON.stringify(e),n=t===void 0?String(e):t;return n.length<=160?n:`${n.slice(0,157)}...`}function Ox(...e){for(const t of e)if(t!==null&&t.trim().length>0)return t;return"-"}function DP(e){const t=e.provider,n=e.model;return t!==null&&t.length>0&&n!==null&&n.length>0?`${t} / ${n}`:Ox(t,n)}function FP(e,t){if(t!==null){const n=e.find(r=>r.id===t);if(n!==void 0)return n}return e[0]??null}function $P(e){return(e.exportMember?.session?.latestLogs??[])[0]??null}function BP(e){switch(e){case"export":return"fresh export";case"evidence":return"evidence";case"group":return"group"}}function UP(e,t){return t!==null&&t.group.id===e.id?t.evidence:e.evidence}function HP(e,t,n){return t!==null&&t.group.id===e.id?t.summary:n!==null&&n.group.id===e.id?n.summary:null}function WP(e,t,n){return t!==null&&t.group.id===e.id?t.jenkinsReport:n!==null&&n.group.id===e.id?n.report:null}function Od(){const[e,t]=g.useState(!1),[n,r]=g.useState(null),[o,i]=g.useState(null),[a,l]=g.useState(null),[c,u]=g.useState(null),[d,f]=g.useState(null),[h,p]=g.useState(!1),[y,m]=g.useState(null),[x,b]=g.useState(null),{groups:v,isLoading:w,error:C,mutate:S}=RP(),j=g.useMemo(()=>FP(v,n),[v,n]);g.useEffect(()=>{!e||n!==null&&v.some(J=>J.id===n)||r(v[0]?.id??null)},[v,e,n]);const N=j!==null&&c!==null&&c.group.id===j.id?c:null,{evidenceResponse:A,isLoading:z,error:L,mutate:U}=IP(j),E=g.useCallback(()=>{S()},[S]),O=g.useCallback(async B=>{i(B.id),l(null);try{const J=await fetch(`/api/groups/${encodeURIComponent(B.id)}/evidence`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({latestLogLimit:10})});if(!J.ok){l(await on(J,`Export failed with status ${String(J.status)}`));return}const I=await Mt(J,I2);u(I),await S(),await U()}catch(J){l(J instanceof Error?J.message:String(J))}finally{i(null)}},[S,U]),k=g.useCallback(B=>{f(B),p(!1),b(null)},[]),D=g.useCallback(()=>{y===null&&(f(null),p(!1),b(null))},[y]),q=g.useCallback(B=>{r(B),f(null),p(!1),b(null)},[]),W=g.useCallback(async()=>{const B=d;if(B!==null){m(B.id),b(null);try{const J=await fetch(PP(B.id,h),{method:"DELETE"});if(!J.ok){b(await on(J,`Delete failed with status ${String(J.status)}`));return}await Mt(J,T2),u(I=>I!==null&&I.group.id===B.id?null:I),r(I=>I===B.id?null:I),f(null),p(!1),await S(),await U()}catch(J){b(J instanceof Error?J.message:String(J))}finally{m(null)}}},[h,d,S,U]);return s.jsxs(ho,{open:e,onOpenChange:t,children:[s.jsx(Kl,{asChild:!0,children:s.jsxs(Ne,{type:"button",variant:"ghost",size:"icon",className:"relative size-8","aria-label":"Evaluation groups",title:"Evaluation groups",children:[s.jsx(Wc,{className:"size-4"}),w?s.jsx(Tt,{className:"absolute -right-0.5 -top-0.5 size-3 animate-spin text-muted-foreground"}):v.length>0?s.jsx("span",{className:"absolute -right-1 -top-1 min-w-4 rounded-full bg-primary px-1 text-[10px] leading-4 text-primary-foreground",children:v.length}):null,s.jsx("span",{className:"sr-only",children:"Evaluation groups"})]})}),s.jsxs(mo,{className:"flex max-h-[85vh] max-w-5xl flex-col overflow-hidden",children:[s.jsx(go,{children:s.jsxs(xo,{className:"flex items-center gap-2 pr-8",children:[s.jsx(Wc,{className:"size-5 text-muted-foreground"}),s.jsx("span",{children:"Groups"}),s.jsx(He,{variant:"outline",children:Et(v.length)})]})}),s.jsxs("div",{className:"flex min-h-0 items-center justify-between gap-3 border-b border-border pb-3",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:"Evaluation batches, model runs, and exported evidence packs."}),s.jsxs(Ne,{type:"button",variant:"outline",size:"sm",className:"shrink-0",onClick:E,children:[s.jsx(cs,{className:"size-3.5"}),"Refresh"]})]}),s.jsxs("div",{className:"grid min-h-0 flex-1 gap-4 md:grid-cols-[260px_minmax(0,1fr)]",children:[s.jsx(VP,{groups:v,selectedGroupId:j?.id??null,isLoading:w,error:C,onSelect:q}),s.jsx(qP,{group:j,deleteTarget:d,deleteEvidence:h,exportResult:N,evidenceResponse:A,evidenceLoading:z,evidenceError:L,exportError:a,deleteError:x,exportingGroupId:o,deletingGroupId:y,onDeleteEvidenceChange:p,onExport:O,onRequestDelete:k,onCancelDelete:D,onConfirmDelete:()=>{W()}})]})]})]})}function VP({groups:e,selectedGroupId:t,isLoading:n,error:r,onSelect:o}){return n?s.jsx("div",{className:"flex min-h-48 items-center justify-center rounded-md border border-dashed border-border text-xs text-muted-foreground",children:"Loading groups..."}):r!==void 0?s.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:r.message}):e.length===0?s.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."}):s.jsx("div",{className:"min-h-0 overflow-y-auto pr-1",children:s.jsx("div",{className:"space-y-2",children:e.map(i=>{const a=Px(i),l=t===i.id;return s.jsxs("button",{type:"button",onClick:()=>o(i.id),className:me("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:[s.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[s.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:i.title}),s.jsx(He,{variant:"outline",className:xc(i.status),children:bc(i.status)})]}),s.jsxs("div",{className:"mt-1 flex items-center gap-2 text-muted-foreground",children:[s.jsxs("span",{children:[a.memberCount," sessions"]}),s.jsx("span",{children:vr(i.updatedAt)})]})]},i.id)})})})}function qP({group:e,deleteTarget:t,deleteEvidence:n,exportResult:r,evidenceResponse:o,evidenceLoading:i,evidenceError:a,exportError:l,deleteError:c,exportingGroupId:u,deletingGroupId:d,onDeleteEvidenceChange:f,onExport:h,onRequestDelete:p,onCancelDelete:y,onConfirmDelete:m}){if(e===null)return s.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=Px(e),b=HP(e,r,o),v=WP(e,r,o),w=UP(e,r),C=OP(e,r,o),S=u===e.id,j=d===e.id,N=t?.id===e.id;return s.jsx("div",{className:"min-h-0 overflow-y-auto pr-1",children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex min-w-0 flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[s.jsx("h3",{className:"min-w-0 truncate text-base font-semibold",children:e.title}),s.jsx(He,{variant:"outline",className:xc(e.status),children:bc(e.status)}),s.jsx(He,{variant:"outline",children:e.kind})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[s.jsx("span",{children:fi(e.project)}),s.jsxs("span",{children:["updated ",vr(e.updatedAt)]})]})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.jsx(Ne,{type:"button",variant:"outline",size:"icon",className:"size-8 text-red-600 hover:text-red-700","aria-label":"Delete group",title:"Delete group",disabled:j,onClick:()=>p(e),children:j?s.jsx(Tt,{className:"size-3.5 animate-spin"}):s.jsx(mr,{className:"size-3.5"})}),s.jsxs(Ne,{type:"button",variant:"default",size:"sm",className:"shrink-0",disabled:S||j,onClick:()=>{h(e)},children:[S?s.jsx(Tt,{className:"size-3.5 animate-spin"}):s.jsx(Fs,{className:"size-3.5"}),"Export evidence"]})]})]}),e.task!==null&&e.task.trim().length>0&&s.jsx("p",{className:"rounded-md border border-border bg-muted/20 px-3 py-2 text-xs text-muted-foreground",children:e.task}),N&&s.jsx(ZP,{group:e,deleteEvidence:n,isDeleting:j,error:c,onDeleteEvidenceChange:f,onCancel:y,onConfirm:m}),s.jsxs("div",{className:"grid gap-2 sm:grid-cols-4",children:[s.jsx(hn,{label:"Members",value:x.memberCount}),s.jsx(hn,{label:"Done",value:x.completedMembers}),s.jsx(hn,{label:"Failed",value:x.failedMembers}),s.jsx(hn,{label:"Running",value:x.runningMembers})]}),b!==null&&s.jsxs("div",{className:"grid gap-2 sm:grid-cols-4",children:[s.jsx(hn,{label:"Requests",value:b.requestCount}),s.jsx(hn,{label:"Errors",value:b.errorCount}),s.jsx(hn,{label:"Tokens",value:b.tokenUsage.total}),s.jsx(hn,{label:"Missing",value:b.missingSessions})]}),s.jsx(GP,{report:v,loading:i,error:a,hasEvidence:w!==null}),s.jsx(KP,{evidence:w}),l!==null&&s.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&&s.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700",children:c}),s.jsx(JP,{rows:C})]})})}function ZP({group:e,deleteEvidence:t,isDeleting:n,error:r,onDeleteEvidenceChange:o,onCancel:i,onConfirm:a}){const l=e.evidence!==null,c=e.evidence?.markdownPath??"No evidence pack exported.";return s.jsx("div",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-3 text-red-900",children:s.jsxs("div",{className:"flex min-w-0 flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[s.jsxs("div",{className:"min-w-0 space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[s.jsx(mr,{className:"size-4 text-red-600"}),s.jsx("span",{children:"Delete group?"})]}),s.jsxs("p",{className:"text-xs text-red-800",children:["Delete ",s.jsx("span",{className:"font-medium",children:e.title}),". Session logs and run records stay intact."]}),s.jsxs("label",{className:me("flex min-w-0 items-start gap-2 text-xs",l?"cursor-pointer":"opacity-60"),children:[s.jsx("input",{type:"checkbox",className:"mt-0.5 size-4 shrink-0",checked:t,disabled:!l||n,onChange:u=>o(u.currentTarget.checked)}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block font-medium",children:"Also delete exported evidence files"}),s.jsx("code",{className:"mt-1 block truncate font-mono text-[11px] text-red-700",children:c})]})]}),r!==null&&s.jsx("div",{className:"rounded-md border border-red-200 bg-white px-2 py-1.5 text-xs text-red-700",children:r})]}),s.jsxs("div",{className:"flex shrink-0 justify-end gap-2",children:[s.jsx(Ne,{type:"button",variant:"outline",size:"sm",disabled:n,onClick:i,children:"Cancel"}),s.jsxs(Ne,{type:"button",variant:"destructive",size:"sm",disabled:n,onClick:a,children:[n?s.jsx(Tt,{className:"size-3.5 animate-spin"}):s.jsx(mr,{className:"size-3.5"}),"Delete"]})]})]})})}function hn({label:e,value:t}){return s.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[s.jsx("div",{className:"text-[11px] font-medium uppercase text-muted-foreground",children:e}),s.jsx("div",{className:"mt-1 font-mono text-sm font-semibold",children:Et(t)})]})}function GP({report:e,loading:t,error:n,hasEvidence:r}){const{copied:o,copy:i}=rn(e?.markdown??null);return e===null&&!t&&n===void 0?null:t?s.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:[s.jsx(Tt,{className:"size-3.5 animate-spin"}),"Loading evidence report..."]}):n!==void 0&&r?s.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:s.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[s.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx("span",{className:"text-xs font-semibold",children:"Evidence report"}),s.jsx(He,{variant:"outline",className:MP(e.status),children:e.status})]}),s.jsx(Ne,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":o?"Copied evidence report":"Copy evidence report",onClick:i,children:o?s.jsx(tt,{className:"size-3.5 text-emerald-500"}):s.jsx(St,{className:"size-3.5"})})]}),s.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:e.summary})]})}function KP({evidence:e}){return e===null?s.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."}):s.jsxs("div",{className:"space-y-2 rounded-md border border-border bg-muted/20 px-3 py-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"text-xs font-semibold",children:"Evidence paths"}),s.jsx("span",{className:"text-[11px] text-muted-foreground",children:vr(e.exportedAt)})]}),s.jsxs("div",{className:"grid gap-2",children:[s.jsx(qi,{label:"JSON",value:e.jsonPath}),s.jsx(qi,{label:"Markdown",value:e.markdownPath}),s.jsx(qi,{label:"HTML",value:e.htmlPath})]})]})}function qi({label:e,value:t}){const{copied:n,copy:r}=rn(t);return s.jsxs("div",{className:"flex min-w-0 items-center gap-2 rounded-md border border-border bg-background px-2 py-1.5",children:[s.jsx("span",{className:"w-16 shrink-0 text-[11px] font-medium text-muted-foreground",children:e}),s.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs",children:t}),s.jsx(Ne,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0","aria-label":n?`Copied ${e} path`:`Copy ${e} path`,onClick:r,children:n?s.jsx(tt,{className:"size-3.5 text-emerald-500"}):s.jsx(St,{className:"size-3.5"})})]})}function JP({rows:e}){const[t,n]=g.useState(null),r=g.useCallback(o=>{n(i=>i===o?null:o)},[]);return e.length===0?s.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."}):s.jsxs("div",{className:"overflow-hidden rounded-md border border-border",children:[s.jsx("div",{className:"border-b border-border bg-muted/30 px-3 py-2 text-xs font-semibold",children:"Members"}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full min-w-[760px] text-left text-xs",children:[s.jsx("thead",{className:"border-b border-border bg-muted/20 text-muted-foreground",children:s.jsxs("tr",{children:[s.jsx("th",{className:"px-3 py-2 font-medium",children:"Session"}),s.jsx("th",{className:"px-3 py-2 font-medium",children:"Provider / Model"}),s.jsx("th",{className:"px-3 py-2 font-medium",children:"Status"}),s.jsx("th",{className:"px-3 py-2 font-medium",children:"Requests"}),s.jsx("th",{className:"px-3 py-2 font-medium",children:"Errors"}),s.jsx("th",{className:"px-3 py-2 font-medium",children:"First chunk"}),s.jsx("th",{className:"px-3 py-2 font-medium",children:"Tokens"})]})}),s.jsx("tbody",{children:e.map(o=>{const i=t===o.member.id;return s.jsxs(g.Fragment,{children:[s.jsx(YP,{row:o,isExpanded:i,onToggleDetails:r}),s.jsx(XP,{row:o,isExpanded:i})]},o.member.id)})})]})})]})}function YP({row:e,isExpanded:t,onToggleDetails:n}){const r=e.member,o=e.exportMember?.session??null,i=$P(e),a=o?.inspectorPath??wf(r.sessionId),l=e.source!=="evidence",c=o?.requestCount??null,u=o?.errorCount??null,d=o?.tokenUsage.total??null,f=i?.firstChunkMs??null,h=Ox(r.label,r.sessionId);return s.jsxs("tr",{className:"border-b border-border last:border-0 hover:bg-muted/20",children:[s.jsxs("td",{className:"max-w-56 px-3 py-2",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx(Ne,{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(r.id)},children:t?s.jsx(gt,{className:"size-3.5"}):s.jsx(Ft,{className:"size-3.5"})}),l?s.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:[s.jsx("span",{className:"min-w-0 truncate",children:h}),s.jsx(xl,{className:"size-3 shrink-0 text-muted-foreground"})]}):s.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(r.id)},children:[s.jsx("span",{className:"min-w-0 truncate",children:h}),s.jsx(He,{variant:"outline",className:"shrink-0 border-zinc-200 bg-zinc-50 text-zinc-600",children:"evidence"})]})]}),s.jsx("div",{className:"mt-0.5 truncate text-[11px] text-muted-foreground",children:fi(r.agent)})]}),s.jsx("td",{className:"max-w-52 px-3 py-2",children:s.jsx("span",{className:"block truncate",children:DP(r)})}),s.jsx("td",{className:"px-3 py-2",children:s.jsx(He,{variant:"outline",className:xc(r.status),children:bc(r.status)})}),s.jsx("td",{className:"px-3 py-2 font-mono",children:c===null?"-":Et(c)}),s.jsx("td",{className:"px-3 py-2 font-mono",children:u===null?"-":Et(u)}),s.jsx("td",{className:"px-3 py-2 font-mono",children:Wa(f)}),s.jsx("td",{className:"px-3 py-2 font-mono",children:d===null?"-":Et(d)})]})}function XP({row:e,isExpanded:t}){if(!t)return null;const n=e.member,r=e.exportMember,o=r?.session??null,i=r?.run??null,a=Object.entries(n.metadata);return s.jsx("tr",{className:"border-b border-border bg-muted/10",children:s.jsx("td",{colSpan:7,className:"px-3 pb-4 pt-2",children:s.jsxs("div",{className:"space-y-3 rounded-md border border-border bg-background p-3",children:[s.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-4",children:[s.jsx(at,{label:"Source",value:BP(e.source)}),s.jsx(at,{label:"Member ID",value:n.id,mono:!0}),s.jsx(at,{label:"Session ID",value:n.sessionId,mono:!0}),s.jsx(at,{label:"Run ID",value:i?.id??n.runId??"-",mono:!0}),s.jsx(at,{label:"Created",value:vr(n.addedAt)}),s.jsx(at,{label:"Updated",value:vr(n.updatedAt)}),s.jsx(at,{label:"Session created",value:Pd(o?.createdAt??null)}),s.jsx(at,{label:"Session updated",value:Pd(o?.updatedAt??null)})]}),o===null?s.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."}):s.jsxs("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-4",children:[s.jsx(at,{label:"Log coverage",value:o.logCoverage}),s.jsx(at,{label:"Runtime",value:fi(o.runtimeMode)}),s.jsx(at,{label:"Requests",value:Et(o.requestCount),mono:!0}),s.jsx(at,{label:"Errors",value:Et(o.errorCount),mono:!0}),s.jsx(at,{label:"Input tokens",value:Et(o.tokenUsage.input),mono:!0}),s.jsx(at,{label:"Output tokens",value:Et(o.tokenUsage.output),mono:!0}),s.jsx(at,{label:"Cache read",value:Et(o.tokenUsage.cacheRead),mono:!0}),s.jsx(at,{label:"Total tokens",value:Et(o.tokenUsage.total),mono:!0})]}),s.jsx(QP,{logs:o?.latestLogs??[]}),s.jsx(eO,{entries:a})]})})})}function at({label:e,value:t,mono:n=!1}){return s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:e}),s.jsx("div",{className:me("truncate text-xs text-foreground",n?"font-mono":""),title:t,children:t})]})}function QP({logs:e}){const t=e.slice(0,5);return t.length===0?s.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."}):s.jsxs("div",{className:"overflow-hidden rounded-md border border-border",children:[s.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"}),s.jsx("div",{className:"divide-y divide-border",children:t.map(n=>s.jsxs("div",{className:"grid gap-2 px-3 py-2 text-xs sm:grid-cols-[72px_1fr_88px_88px]",children:[s.jsxs("span",{className:"font-mono text-muted-foreground",children:["#",n.id]}),s.jsxs("span",{className:"min-w-0 truncate",children:[fi(n.model)," · ",n.apiFormat," · ",n.path]}),s.jsx("span",{className:"font-mono text-muted-foreground",children:Wa(n.firstChunkMs)}),s.jsx("span",{className:"font-mono text-muted-foreground",children:Wa(n.latencyMs)})]},n.id))})]})}function eO({entries:e}){return e.length===0?null:s.jsxs("div",{className:"overflow-hidden rounded-md border border-border",children:[s.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"}),s.jsx("div",{className:"grid gap-x-3 gap-y-2 p-3 text-xs sm:grid-cols-2",children:e.map(([t,n])=>{const r=LP(n);return s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"mr-2 text-muted-foreground",children:t}),s.jsx("span",{className:"font-mono text-foreground",title:r,children:r})]},t)})})]})}function tO(){return s.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[s.jsx("title",{children:"Claude Code"}),s.jsx("path",{clipRule:"evenodd",d:"M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z"})]})}function nO(){return s.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[s.jsx("title",{children:"OpenCode"}),s.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})]})}function rO(){return s.jsxs("svg",{fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[s.jsx("title",{children:"MiMo Code"}),s.jsx("text",{x:"12",y:"18",textAnchor:"middle",fontSize:"16",fontWeight:"800",fontFamily:"system-ui, sans-serif",children:"M"})]})}const oO=re({name:T(),apiKey:T(),format:Ae(["anthropic","openai"]),anthropicBaseUrl:T(),openaiBaseUrl:T(),models:ge(T()),sourceTool:Ae(["claude-code","opencode","mimo-code"]),alreadyExists:We()}),sO=re({providers:ge(oO),warnings:ge(T()).optional()}),iO=re({success:We().optional(),imported:te().optional(),message:T().optional(),errors:ge(T()).optional()}),aO={"claude-code":tO,opencode:nO,"mimo-code":rO};function lO({open:e,onOpenChange:t,onImportComplete:n}){const[r,o]=g.useState(!1),[i,a]=g.useState(null),[l,c]=g.useState([]),[u,d]=g.useState([]),[f,h]=g.useState(new Set),[p,y]=g.useState(!1),[m,x]=g.useState(null),[b,v]=g.useState(null),w=g.useCallback(()=>{o(!0),a(null),d([]),c([]),h(new Set),x(null),v(null),fetch("/api/providers/scan").then(N=>N.ok?N.json().then(A=>{const z=sO.safeParse(A);if(!z.success){a(`Invalid response: ${z.error.message}`);return}c(z.data.providers),d(z.data.warnings??[]);const L=new Set;z.data.providers.forEach((U,E)=>{U.alreadyExists||L.add(E)}),h(L)}):N.text().then(A=>{a(`Scan failed (${N.status}): ${A}`)})).catch(N=>{a(N instanceof Error?N.message:String(N))}).finally(()=>{o(!1)})},[]);g.useEffect(()=>{e&&w()},[e,w]);const C=g.useCallback(N=>{h(A=>{const z=new Set(A);return z.has(N)?z.delete(N):z.add(N),z})},[]),S=g.useCallback(()=>{const N=l.filter((L,U)=>f.has(U));if(N.length===0)return;y(!0),v(null),x(null);const A=new Date().toISOString(),z=N.map(L=>({id:window.crypto.randomUUID(),name:L.name,apiKey:L.apiKey,format:L.format,anthropicBaseUrl:L.anthropicBaseUrl,openaiBaseUrl:L.openaiBaseUrl,models:L.models,createdAt:A,updatedAt:A}));fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providers:z})}).then(L=>L.json()).then(L=>{const U=iO.safeParse(L);if(!U.success){v(`Invalid response: ${U.error.message}`);return}const E=U.data;c(O=>O.map((k,D)=>f.has(D)?{...k,alreadyExists:!0}:k)),h(new Set),E.errors!==void 0&&E.errors.length>0&&E.message!==void 0?x(E.message):x(`Imported ${E.imported??N.length} provider(s)`),n()}).catch(L=>{v(L instanceof Error?L.message:String(L))}).finally(()=>{y(!1)})},[l,f,n]),j=l.some(N=>!N.alreadyExists);return s.jsx(ho,{open:e,onOpenChange:t,children:s.jsxs(mo,{className:"max-w-xl max-h-[80vh] overflow-hidden flex flex-col",children:[s.jsxs(go,{children:[s.jsx(xo,{children:"Import from External Tools"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Detect provider configurations from Claude Code, OpenCode, and MiMo Code."})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto space-y-3",children:[r&&s.jsxs("div",{className:"flex items-center justify-center py-8 gap-2 text-muted-foreground",children:[s.jsx(Tt,{className:"size-4 animate-spin"}),s.jsx("span",{className:"text-sm",children:"Scanning for external providers..."})]}),i!==null&&s.jsxs("div",{className:"flex items-center gap-2 text-destructive text-sm py-4",children:[s.jsx(eo,{className:"size-4"}),i]}),!r&&i===null&&l.length===0&&s.jsxs("p",{className:"text-sm text-muted-foreground py-8 text-center",children:["No external provider configurations found.",s.jsx("br",{}),s.jsx("span",{className:"text-xs",children:"Supported tools: Claude Code (~/.claude/settings.json), OpenCode (~/.config/opencode/opencode.json), MiMo Code (~/.config/mimocode/mimocode.jsonc)"})]}),!r&&l.map((N,A)=>s.jsxs("label",{className:`flex items-start gap-3 p-3 border rounded-md ${N.alreadyExists?"":"cursor-pointer hover:bg-muted/50"}`,children:[!N.alreadyExists&&s.jsx("input",{type:"checkbox",checked:f.has(A),disabled:p,onChange:()=>C(A),className:"mt-0.5 size-4"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[(()=>{const z=aO[N.sourceTool];return z===void 0?null:s.jsx(z,{})})(),N.alreadyExists&&s.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Already added"})]}),s.jsxs("div",{className:"text-xs text-muted-foreground mt-1 truncate",children:[N.models.slice(0,4).join(", "),N.models.length>4?` +${N.models.length-4} more`:""]}),s.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:N.format==="anthropic"?N.anthropicBaseUrl:N.openaiBaseUrl}),s.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 font-mono",children:N.apiKey.length>8?`${N.apiKey.slice(0,4)}••••${N.apiKey.slice(-4)}`:"••••"})]})]},`${N.sourceTool}-${N.name}`)),u.length>0&&s.jsx("div",{className:"text-xs text-muted-foreground space-y-1 border-t pt-2",children:u.map((N,A)=>s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(eo,{className:"size-3"}),N]},A))}),m!==null&&s.jsx("div",{className:"text-sm text-green-500 border-t pt-2",children:m}),b!==null&&s.jsx("div",{className:"text-sm text-destructive border-t pt-2",children:b})]}),s.jsxs("div",{className:"flex items-center justify-between pt-3 border-t",children:[s.jsxs(Ne,{variant:"outline",size:"sm",onClick:w,disabled:r,children:[s.jsx(Tt,{className:`size-3 mr-1 ${r?"animate-spin":""}`}),"Rescan"]}),s.jsxs(Ne,{size:"sm",onClick:S,disabled:!j||f.size===0||p,children:[s.jsx(Fs,{className:"size-3 mr-1"}),p?"Importing...":`Import Selected (${f.size})`]})]})]})})}function Mx(e){return e.length<=8?"••••••••":e.slice(0,4)+"••••••••"+e.slice(-4)}const Lx=re({id:T().min(1),aliases:ge(T()).optional().default([]),contextWindow:te().int().positive().optional(),outputLimit:te().int().positive().optional(),sourceUrl:T().optional()}),cO=re({name:T().min(1).optional(),aliases:ge(T()).optional().default([]),baseUrls:ge(T()).optional().default([]),models:ge(Lx).min(1)});re({version:te().int().positive().optional(),updatedAt:T().optional(),providers:ge(cO).optional().default([]),models:ge(Lx).optional().default([])});function Md(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}function uO(e){const t=e.models.filter(n=>n.trim()!=="");return t.length>0?t:e.model!==void 0&&e.model.trim()!==""?[e.model]:[]}function yc(e,t){const n=Md(t);return(e.modelMetadata??[]).find(o=>Md(o.model)===n)??null}function dO(e){const t=uO(e);return t.length===0?!1:t.every(n=>{const r=yc(e,n);return r!==null&&r.contextWindow!==void 0})}function fO(e,t){if(e===null)return null;for(const n of t){const r=yc(n,e);if(r!==null&&r.contextWindow!==void 0)return{providerName:n.name,model:r.model,tokens:r.contextWindow,sourceUrl:r.sourceUrl}}return null}const pO={deepseek:"https://api-docs.deepseek.com/zh-cn/"};function hO(e){return Object.prototype.hasOwnProperty.call(e,"success")}function mO(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,r])=>`${n}: ${r}`);if(t.length!==0)return t.join(`
115
+ `)}function Ld(e){return Va(e)!==void 0}function Dd(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function gO(e){return e>=10?`${e.toFixed(0)}/s`:`${e.toFixed(1)}/s`}function xO(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)||Ld(t?.requestHeaders)||Ld(t?.responseHeaders)||t?.responseStatus!==void 0}function mn({title:e,children:t}){return s.jsxs("div",{className:"space-y-1",children:[s.jsx("div",{className:"font-medium text-foreground/80",children:e}),t]})}function Dr({value:e}){return s.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 bO({result:e}){const t=e.debug,n=t?.requestUrl,r=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 s.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)&&s.jsx(mn,{title:"Hint",children:s.jsx("div",{children:e.error.hint})}),yt(e.error?.details)&&s.jsx(mn,{title:"Error",children:s.jsx(Dr,{value:e.error.details})}),yt(n)&&s.jsx(mn,{title:"Request",children:s.jsxs("div",{className:"rounded-md bg-background/80 p-2 font-mono text-[11px] break-all text-foreground/80",children:[r," ",n]})}),o!==void 0&&s.jsx(mn,{title:"Request Headers",children:s.jsx(Dr,{value:o})}),yt(t?.requestBody)&&s.jsx(mn,{title:"Request Body",children:s.jsx(Dr,{value:t.requestBody})}),yt(a)&&s.jsx(mn,{title:"Response Status",children:s.jsx("div",{className:"rounded-md bg-background/80 p-2 font-mono text-[11px] text-foreground/80",children:a})}),i!==void 0&&s.jsx(mn,{title:"Response Headers",children:s.jsx(Dr,{value:i})}),yt(l)&&s.jsx(mn,{title:"Response Body",children:s.jsx(Dr,{value:l})})]})}function qo({results:e}){return s.jsxs("div",{className:"flex min-w-0 flex-col gap-2",children:[s.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[s.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Non-stream"}),s.jsx(Fd,{result:e.nonStreaming})]}),s.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[s.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Stream"}),s.jsx(Fd,{result:e.streaming})]})]})}function yO(e){const t={className:"size-3",strokeWidth:2};switch(e){case"timeout":return s.jsx(wn,{...t});case"network_unreachable":return s.jsx(Wk,{...t});case"connection_refused":return s.jsx(qk,{...t});case"auth_failed":return s.jsx(ik,{...t});case"rate_limited":return s.jsx(vl,{...t});case"server_error":return s.jsx(Ak,{...t});case"invalid_response":return s.jsx(yw,{...t});case"unknown":return s.jsx(eo,{...t});default:return s.jsx(eo,{...t})}}function Fd({result:e}){const[t,n]=g.useState(!1);if(!hO(e))return mO(e)?s.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[s.jsx(ck,{className:"size-3"}),s.jsx("span",{children:"Not configured"})]}):s.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[s.jsx(aa,{className:"size-3 animate-spin"}),s.jsx("span",{children:"Testing..."})]});if(e.success){const l=[],c=[];e.inputTokens!==void 0&&l.push(s.jsxs("span",{children:[e.inputTokens," in"]},"in")),e.outputTokens!==void 0&&l.push(s.jsxs("span",{children:[e.outputTokens," out"]},"out")),e.cacheCreationInputTokens!==void 0&&e.cacheCreationInputTokens>0&&l.push(s.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(s.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(s.jsxs("span",{children:["first ",Dd(e.firstChunkMs)]},"first")),e.totalStreamMs!==void 0&&e.totalStreamMs!==null&&c.push(s.jsxs("span",{children:["total ",Dd(e.totalStreamMs)]},"total")),e.tokensPerSecond!==void 0&&e.tokensPerSecond!==null&&e.tokensPerSecond>0&&c.push(s.jsxs("span",{children:[gO(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 s.jsx(ot,{children:s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 shrink-0",children:[s.jsx(gw,{className:"size-3"}),s.jsx("span",{children:"Connected"}),l.length>0&&s.jsxs("span",{className:"text-muted-foreground",children:["(",u,")"]}),c.length>0&&s.jsxs("span",{className:"hidden text-muted-foreground lg:inline",children:["(",d,")"]})]})}),s.jsx(Ue,{children:"Connection test passed"})]})})}const r=e.error,o=r?.message??"Connection failed",i=r?.type??"unknown",a=xO(e);return s.jsxs("div",{className:"flex flex-col gap-1 shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-1 text-xs text-red-600 max-w-[200px]",children:[yO(i),s.jsx(ot,{children:s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsx("span",{className:"truncate",children:o})}),s.jsx(Ue,{children:"Connection test failed"})]})}),a&&s.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?s.jsx(bl,{className:"size-3"}):s.jsx(yl,{className:"size-3"}),s.jsx("span",{children:t?"Hide":"Details"})]})]}),t&&a&&s.jsx(bO,{result:e})]})}function vO(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n,o=Math.floor(r/1e3);if(o<60)return"just now";const 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 wO(e){if(e===void 0||e.trim()==="")return null;try{const t=new URL(e);if(t.protocol!=="https:"&&t.protocol!=="http:")return null;const n=t.hostname.toLowerCase(),r=n==="huggingface.co"||n.endsWith(".huggingface.co");return{label:r?"HF":"Source",title:r?"Open Hugging Face model source":"Open model metadata source",url:e}}catch{return null}}function kO({provider:e,testResults:t,isTesting:n,testingTimeLeft:r,isHighlighted:o,onEdit:i,onDelete:a,onTest:l,onRefreshMetadata:c,isRefreshingMetadata:u=!1}){const[d,f]=g.useState(!1),[h,p]=g.useState(!1),[y,m]=g.useState(!1);function x(){$t(e.apiKey).then(S=>{S&&(p(!0),setTimeout(()=>p(!1),2e3))})}const b=e.apiDocsUrl??Object.entries(pO).find(([S])=>e.name.toLowerCase().includes(S))?.[1],v=dO(e),w=e.modelMetadataUrl!==void 0&&e.modelMetadataUrl.trim()!=="",C=w?"Refresh":"Import defaults";return s.jsxs("div",{className:`border rounded-lg p-4 flex flex-col gap-3 bg-card transition-all duration-500 ${o===!0?"ring-2 ring-primary shadow-md":""}`,children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("span",{className:"font-medium truncate",children:e.name}),e.source==="company"&&s.jsx(ot,{children:s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400 shrink-0",children:"公司"})}),s.jsx(Ue,{children:"Company-provided API key"})]})}),e.source==="personal"&&s.jsx(ot,{children:s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400 shrink-0",children:"个人"})}),s.jsx(Ue,{children:"Your personal API key"})]})})]}),b!==void 0&&s.jsxs("a",{href:b,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1 text-xs",title:"View API documentation",children:[s.jsx(xl,{className:"size-3"}),s.jsx("span",{className:"sr-only",children:"Docs"})]})]}),e.models!==void 0&&e.models.length>0&&s.jsx("div",{className:"flex flex-wrap gap-1",children:e.models.map(S=>{const j=yc(e,S),N=wO(j?.sourceUrl);return s.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:[s.jsx("span",{children:S}),j!==null&&j.contextWindow!==void 0&&s.jsx("span",{className:"font-mono text-foreground/80",children:Wp(j.contextWindow)}),N!==null&&s.jsx(ot,{children:s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsx("a",{href:N.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":N.title,children:N.label})}),s.jsx(Ue,{children:N.title})]})})]},S)})}),!v&&s.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:[s.jsx("span",{children:"Context window metadata missing"}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s.jsxs(Ne,{type:"button",variant:"outline",size:"sm",onClick:()=>c?.(e.id),className:"h-6 gap-1 px-2 text-xs",disabled:u,children:[s.jsx(aa,{className:`size-3 ${u?"animate-spin":""}`}),C]}),!w&&s.jsx(Ne,{type:"button",variant:"ghost",size:"sm",onClick:()=>i(e),className:"h-6 px-2 text-xs",children:"Set URL"})]})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("code",{className:"text-xs text-muted-foreground bg-muted px-2 py-1 rounded flex-1 truncate",children:d?e.apiKey:Mx(e.apiKey)}),s.jsx("button",{type:"button",onClick:()=>f(S=>!S),className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":d?"Hide API key":"Show API key",children:d?s.jsx(bl,{className:"size-4"}):s.jsx(yl,{className:"size-4"})}),s.jsx("button",{type:"button",onClick:x,className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":"Copy API key",children:h?s.jsx(tt,{className:"size-4 text-green-500"}):s.jsx(St,{className:"size-4"})})]}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&s.jsxs("div",{className:"flex min-w-0 flex-col gap-2",children:[s.jsxs("div",{className:"min-w-0 text-xs text-muted-foreground",children:[s.jsx("span",{className:"font-medium",children:"Anthropic:"})," ",s.jsx("span",{className:"truncate",children:e.anthropicBaseUrl})]}),t!==void 0&&s.jsx(qo,{results:t.anthropic})]}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&s.jsxs("div",{className:"flex min-w-0 flex-col gap-2",children:[s.jsxs("div",{className:"min-w-0 text-xs text-muted-foreground",children:[s.jsx("span",{className:"font-medium",children:"OpenAI:"})," ",s.jsx("span",{className:"truncate",children:e.openaiBaseUrl})]}),t!==void 0&&s.jsx(qo,{results:t.openai})]}),t?.testedAt!==void 0&&s.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[s.jsx(wn,{className:"size-3"}),s.jsxs("span",{children:["Tested ",vO(t.testedAt)]})]}),t?.models!==void 0&&Object.keys(t.models).length>0&&s.jsxs("div",{className:"border-t pt-2",children:[s.jsxs("button",{type:"button",onClick:()=>m(S=>!S),className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",children:[y?s.jsx(gt,{className:"size-3"}):s.jsx(Ft,{className:"size-3"}),"Model Test Results (",Object.keys(t.models).length,")"]}),y&&s.jsx("div",{className:"mt-2 overflow-x-auto",children:s.jsxs("table",{className:"w-full text-xs border-collapse",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border",children:[s.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Model"}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&s.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Anthropic"}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&s.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"OpenAI"})]})}),s.jsx("tbody",{children:Object.entries(t.models).map(([S,j])=>s.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[s.jsx("td",{className:"py-1 px-2 font-medium",children:S}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&s.jsx("td",{className:"py-1 px-2 align-top",children:s.jsx(qo,{results:j.anthropic})}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&s.jsx("td",{className:"py-1 px-2 align-top",children:s.jsx(qo,{results:j.openai})})]},S))})]})})]}),s.jsxs("div",{className:"flex gap-2 pt-1 border-t",children:[l!==void 0&&s.jsxs(Ne,{variant:"outline",size:"sm",onClick:()=>l(e.id),className:"text-xs h-7 gap-1",disabled:n??!1,children:[s.jsx(aa,{className:`size-3 ${n??!1?"animate-spin":""}`}),n??!1?r!==void 0?`Testing (${r}s)`:"Testing...":"Test"]}),s.jsxs(Ne,{variant:"outline",size:"sm",onClick:()=>i(e),className:"text-xs h-7 gap-1",disabled:n??!1,children:[s.jsx(jp,{className:"size-3"}),"Edit"]}),s.jsxs(Ne,{variant:"outline",size:"sm",onClick:()=>a(e.id),className:"text-xs h-7 gap-1 text-destructive hover:text-destructive",disabled:n??!1,children:[s.jsx(mr,{className:"size-3"}),"Delete"]})]})]})}const $d=["zhipu","zhipuai","bigmodel","z.ai","zai","glm"],Bd=["zhipu coding","glm coding","bigmodel coding","z.ai coding","zai coding"],_O={deepseek:{openaiBaseUrl:"https://api.deepseek.com"},minimax:{anthropicBaseUrl:"https://api.minimaxi.com/anthropic",apiDocsUrl:"https://platform.minimaxi.com/docs/api-reference/api-overview"},"zhipu coding":{anthropicBaseUrl:"https://open.bigmodel.cn/api/anthropic",openaiBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/coding-plan/quick-start"},"glm coding":{anthropicBaseUrl:"https://open.bigmodel.cn/api/anthropic",openaiBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/coding-plan/quick-start"},"bigmodel coding":{anthropicBaseUrl:"https://open.bigmodel.cn/api/anthropic",openaiBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/coding-plan/quick-start"},"z.ai coding":{anthropicBaseUrl:"https://open.bigmodel.cn/api/anthropic",openaiBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/coding-plan/quick-start"},"zai coding":{anthropicBaseUrl:"https://open.bigmodel.cn/api/anthropic",openaiBaseUrl:"https://open.bigmodel.cn/api/coding/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/coding-plan/quick-start"},zhipu:{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},zhipuai:{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},bigmodel:{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},"z.ai":{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},zai:{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},glm:{openaiBaseUrl:"https://open.bigmodel.cn/api/paas/v4",apiDocsUrl:"https://docs.bigmodel.cn/cn/guide/develop/openai/introduction"},alibaba:{openaiBaseUrl:"https://dashscope.aliyuncs.com/compatible-mode"}},Ud=["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"],Hd=["glm-5","glm-5.1","glm-5.2","qwen3.6-plus","qwen3.7-max"],Wd=["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"],qa="__unset__",Is="__custom__",Dx=[{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 Rn(){return{contextWindow:"",contextWindowMode:"unset",outputLimit:""}}function Vd(e){return e.trim().toLowerCase().replace(/\s+/g,"-")}function Fx(e,t){const n=Vd(t);return e?.modelMetadata?.find(r=>Vd(r.model)===n)??null}function $x(e){const t=ds(e);if(t===null)return null;for(const n of Dx)if(ds(n.value)===t)return n.value;return null}function SO(e){return e.trim()===""?"unset":$x(e)!==null?"preset":"custom"}function CO(e){switch(e.contextWindowMode){case"unset":return qa;case"custom":return Is;case"preset":return $x(e.contextWindow)??Is}}function Zi(e){const t=e.trim().replaceAll(",","");if(t==="")return{amount:"",unit:"K"};const n=/^(\d+(?:\.\d+)?)\s*([kKmM])?$/.exec(t);if(n===null)return{amount:t,unit:"K"};const r=n[1];if(r===void 0)return{amount:t,unit:"K"};const o=n[2];if(o===void 0||o==="")return{amount:r,unit:"tokens"};switch(o.toLowerCase()){case"k":return{amount:r,unit:"K"};case"m":return{amount:r,unit:"M"};default:return{amount:t,unit:"K"}}}function qd(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 Zd(e,t){return t.map(n=>{const r=Fx(e,n),o=r?.contextWindow!==void 0?aS(r.contextWindow):"";return{contextWindow:o,contextWindowMode:SO(o),outputLimit:r?.outputLimit?.toString()??""}})}function Gd(e){const t=e.trim();if(t==="")return null;const n=Number(t);return!Number.isInteger(n)||n<=0?null:n}function jO({provider:e,onSubmit:t,onCancel:n}){const[r,o]=g.useState(e?.name??""),[i,a]=g.useState(e?.apiKey??""),[l,c]=g.useState(!1),[u,d]=g.useState(!1),f=e?.models,[h,p]=g.useState(f!==void 0&&f.length>0?f:[""]),[y,m]=g.useState(()=>Zd(e,f!==void 0&&f.length>0?f:[""])),[x,b]=g.useState("anthropic"),[v,w]=g.useState(e?.anthropicBaseUrl??""),[C,S]=g.useState(e?.openaiBaseUrl??""),[j,N]=g.useState(e?.apiDocsUrl??""),[A,z]=g.useState(e?.modelMetadataUrl??""),[L,U]=g.useState(e?.source),[E,O]=g.useState({}),[k,D]=g.useState(!1),[q,W]=g.useState(null),B=g.useRef([]);g.useEffect(()=>{if(q===null)return;const H=q;function X($){if(!($.target instanceof Node))return;const oe=B.current[H];oe!=null&&!oe.contains($.target)&&W(null)}return document.addEventListener("mousedown",X),()=>document.removeEventListener("mousedown",X)},[q]);const[J,I]=g.useState(!1),[K,Z]=g.useState(!1),R=r.toLowerCase().includes("minimax"),ae=r.toLowerCase().includes("alibaba"),de=[...$d,...Bd].some(H=>r.toLowerCase().includes(H)),ke=R?Ud:de?Wd:ae?Hd:[],pe=e?.modelMetadata?.some(H=>H.contextWindow!==void 0)??!1;function se(){$t(i).then(H=>{H&&(d(!0),setTimeout(()=>d(!1),2e3))})}g.useEffect(()=>{if(e){o(e.name),a(e.apiKey);const H=(e.models?.length??0)>0?e.models:[""];p(H),m(Zd(e,H)),w(e.anthropicBaseUrl??""),S(e.openaiBaseUrl??""),N(e.apiDocsUrl??""),z(e.modelMetadataUrl??""),U(e.source),I(!1),Z(!1)}},[e]),g.useEffect(()=>{const H=r.toLowerCase();for(const[X,$]of Object.entries(_O))if(H.includes(X)){$.anthropicBaseUrl!==void 0&&!J&&w($.anthropicBaseUrl),$.openaiBaseUrl!==void 0&&!K&&S($.openaiBaseUrl),$.apiDocsUrl!==void 0&&!j&&N($.apiDocsUrl),X==="minimax"&&h.length===1&&h[0]===""&&p([Ud[0]??""]),X==="alibaba"&&h.length===1&&h[0]===""&&p([Hd[0]??""]),($d.includes(X)||Bd.includes(X))&&h.length===1&&h[0]===""&&p([Wd[0]??""]);break}},[r]);function le(){const H={};return r.trim()||(H.name="Name is required"),i.trim()||(H.apiKey="API key is required"),(h.length===0||h.every(X=>!X.trim()))&&(H.models="At least one model is required"),v.trim()&&!ce(v.trim())&&(H.anthropicBaseUrl="Invalid URL format"),C.trim()&&!ce(C.trim())&&(H.openaiBaseUrl="Invalid URL format"),A.trim()&&!ce(A.trim())&&(H.modelMetadataUrl="Invalid URL format"),y.forEach((X,$)=>{const oe=ds(X.contextWindow),Y=Gd(X.outputLimit);X.contextWindow.trim()!==""&&oe===null&&(H[`modelMetadata.${$}.contextWindow`]="Context window must be a positive number, optionally using K or M"),X.outputLimit.trim()!==""&&Y===null&&(H[`modelMetadata.${$}.outputLimit`]="Output limit must be a positive integer"),oe!==null&&Y!==null&&Y>oe&&(H[`modelMetadata.${$}.outputLimit`]="Output limit should not exceed context window")}),!v.trim()&&!C.trim()&&(H.format="At least one format URL (Anthropic or OpenAI) is required"),O(H),Object.keys(H).length===0}function ce(H){try{return new URL(H),!0}catch{return!1}}function fe(H,X){p($=>{const oe=[...$];return oe[H]=X,oe})}function be(H,X){m($=>{const oe=[...$];return oe[H]={...oe[H]??Rn(),...X},oe})}function Se(H,X){switch(X){case qa:be(H,{contextWindow:"",contextWindowMode:"unset"});return;case Is:{const $=y[H]??Rn();be(H,{contextWindow:$.contextWindow,contextWindowMode:"custom"});return}default:be(H,{contextWindow:X,contextWindowMode:"preset"});return}}function _(H,X){const $=y[H]??Rn(),oe=Zi($.contextWindow);be(H,{contextWindow:qd(X,oe.unit),contextWindowMode:"custom"})}function ne(H,X){const $=y[H]??Rn(),oe=Zi($.contextWindow);switch(X){case"K":case"M":case"tokens":be(H,{contextWindow:qd(oe.amount,X),contextWindowMode:"custom"});return;default:return}}function Q(H){p(X=>X.filter(($,oe)=>oe!==H)),m(X=>X.filter(($,oe)=>oe!==H))}function M(){p(H=>[...H,""]),m(H=>[...H,Rn()])}function P(){const H=new Date().toISOString(),X=[];return h.forEach(($,oe)=>{const Y=$.trim();if(Y==="")return;const ee=y[oe]??Rn(),F=ds(ee.contextWindow),G=Gd(ee.outputLimit);if(F===null&&G===null)return;const ue=Fx(e,Y);if(ue!==null&&ue.contextWindow===(F??void 0)&&ue.outputLimit===(G??void 0)){X.push({...ue,model:Y});return}const ye={model:Y,source:"manual",updatedAt:H};F!==null&&(ye.contextWindow=F),G!==null&&(ye.outputLimit=G),X.push(ye)}),X.length>0?X:e?.modelMetadata!==void 0?[]:void 0}function V(H){if(H.preventDefault(),!!le()){D(!0);try{t({name:r.trim(),apiKey:i.trim(),models:h.map(X=>X.trim()).filter(X=>X!==""),anthropicBaseUrl:v.trim()||void 0,openaiBaseUrl:C.trim()||void 0,apiDocsUrl:j.trim()||void 0,modelMetadataUrl:A.trim()||void 0,modelMetadata:P(),source:L})}finally{D(!1)}}}return s.jsxs("form",{onSubmit:V,className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("label",{htmlFor:"provider-name",className:"text-sm font-medium",children:["Name ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx("input",{id:"provider-name",type:"text",value:r,onChange:H=>o(H.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"}),E.name!==void 0&&s.jsx("p",{className:"text-xs text-destructive",children:E.name})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{htmlFor:"provider-source",className:"text-sm font-medium",children:"Token Source"}),s.jsxs("select",{id:"provider-source",value:L??"",onChange:H=>U(H.target.value==="company"||H.target.value==="personal"?H.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:[s.jsx("option",{value:"",children:"—"}),s.jsx("option",{value:"personal",children:"个人 (Personal)"}),s.jsx("option",{value:"company",children:"公司 (Company)"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Label whether this API key is company-provided or personal."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{htmlFor:"provider-model-metadata-url",className:"text-sm font-medium",children:"Model Metadata URL"}),s.jsx("input",{id:"provider-model-metadata-url",type:"text",value:A,onChange:H=>z(H.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"}),E.modelMetadataUrl!==void 0&&s.jsx("p",{className:"text-xs text-destructive",children:E.modelMetadataUrl}),A.trim()===""&&s.jsx("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2 text-xs text-muted-foreground",children:"Built-in limits cover DeepSeek v4 pro/flash, MiniMax M3/M2.7/M2.5/M2.1, and GLM coding models. Use a registry URL for private or custom model limits."}),e!==void 0&&!pe&&A.trim()===""&&s.jsx("p",{className:"text-xs text-amber-400",children:"This provider has no matching context metadata yet."}),A.trim()!==""&&s.jsx("p",{className:"text-xs text-muted-foreground",children:"Agent Inspector will refresh model limits from this JSON registry after save."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("label",{htmlFor:"provider-apikey",className:"text-sm font-medium",children:["API Key ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{id:"provider-apikey",type:"text",value:l||i.length===0?i:Mx(i),onChange:H=>a(H.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"}),s.jsx("button",{type:"button",onClick:()=>c(H=>!H),className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":l?"Hide API key":"Show API key",children:l?s.jsx(bl,{className:"size-4"}):s.jsx(yl,{className:"size-4"})}),s.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?s.jsx(tt,{className:"size-4 text-green-500"}):s.jsx(St,{className:"size-4"})})]}),E.apiKey!==void 0&&s.jsx("p",{className:"text-xs text-destructive",children:E.apiKey})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("label",{className:"text-sm font-medium",children:["Models ",s.jsx("span",{className:"text-destructive",children:"*"})]}),h.map((H,X)=>{const $=y[X]??Rn(),oe=E[`modelMetadata.${X}.contextWindow`],Y=E[`modelMetadata.${X}.outputLimit`],ee=CO($),F=Zi($.contextWindow);return s.jsxs("div",{ref:G=>{B.current[X]=G},className:"space-y-2 rounded-md border border-border bg-muted/10 p-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx("input",{type:"text",value:H,onChange:G=>fe(X,G.target.value),placeholder:ke.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"}),ke.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",onClick:()=>W(q===X?null:X),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:s.jsx(gt,{className:"size-4"})}),q===X&&s.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 z-50 bg-popover border border-border rounded-md shadow-md max-h-48 overflow-y-auto",children:ke.map(G=>s.jsx("button",{type:"button",onClick:()=>{fe(X,G),W(null)},className:"w-full text-left px-3 py-2 text-sm hover:bg-muted transition-colors",children:G},G))})]})]}),h.length>1&&s.jsx("button",{type:"button",onClick:()=>Q(X),className:"text-muted-foreground hover:text-destructive transition-colors p-1 shrink-0","aria-label":"Remove model",children:s.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:[s.jsx("path",{d:"M3 6h18"}),s.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),s.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]})})]}),s.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[s.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[s.jsx("span",{children:"Context Window"}),s.jsxs(Ns,{value:ee,onValueChange:G=>Se(X,G),children:[s.jsx(Ts,{size:"sm",className:"w-full bg-background font-mono text-xs",children:s.jsx(Es,{})}),s.jsxs(As,{className:"max-h-64",children:[s.jsx(Wt,{value:qa,children:"Not set"}),Dx.map(G=>s.jsxs(Wt,{value:G.value,children:[G.label," · ",G.value]},G.value)),s.jsx(Wt,{value:Is,children:"Custom"})]})]}),$.contextWindowMode==="custom"&&s.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_5.75rem] gap-1.5",children:[s.jsx("input",{type:"text",inputMode:"decimal",value:F.amount,onChange:G=>_(X,G.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]"}),s.jsxs(Ns,{value:F.unit,onValueChange:G=>ne(X,G),children:[s.jsx(Ts,{size:"sm",className:"w-full bg-background font-mono text-xs",children:s.jsx(Es,{})}),s.jsxs(As,{children:[s.jsx(Wt,{value:"K",children:"K"}),s.jsx(Wt,{value:"M",children:"M"}),s.jsx(Wt,{value:"tokens",children:"tokens"})]})]})]}),oe!==void 0&&s.jsx("span",{className:"block text-destructive",children:oe})]}),s.jsxs("label",{className:"space-y-1 text-xs text-muted-foreground",children:[s.jsx("span",{children:"Output Limit"}),s.jsx("input",{type:"number",min:1,step:1e3,value:$.outputLimit,onChange:G=>be(X,{outputLimit:G.target.value}),placeholder:"e.g. 8192",className:"w-full rounded-md border border-input bg-background px-3 py-2 font-mono text-xs text-foreground ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px]"}),Y!==void 0&&s.jsx("span",{className:"block text-destructive",children:Y})]})]})]},X)}),s.jsx("button",{type:"button",onClick:M,className:"text-xs text-primary hover:underline flex items-center gap-1",children:"+ Add Model"}),E.models!==void 0&&s.jsx("p",{className:"text-xs text-destructive",children:E.models})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex gap-1 border-b border-border",children:[s.jsx(ot,{children:s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.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"})}),s.jsx(Ue,{children:"Anthropic Messages API format"})]})}),s.jsx(ot,{children:s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.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"})}),s.jsx(Ue,{children:"OpenAI Chat Completions API format"})]})})]}),E.format!==void 0&&s.jsx("p",{className:"text-xs text-destructive",children:E.format})]}),x==="anthropic"&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{htmlFor:"provider-anthropic-base-url",className:"text-sm font-medium",children:"Anthropic Base URL"}),s.jsx("input",{id:"provider-anthropic-base-url",type:"text",value:v,onChange:H=>{I(!0),w(H.target.value)},placeholder:"https://api.anthropic.com",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),E.anthropicBaseUrl!==void 0&&s.jsx("p",{className:"text-xs text-destructive",children:E.anthropicBaseUrl}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Anthropic-compatible endpoint URL. Leave empty if this provider does not support Anthropic format."})]}),x==="openai"&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{htmlFor:"provider-openai-base-url",className:"text-sm font-medium",children:"OpenAI Base URL"}),s.jsx("input",{id:"provider-openai-base-url",type:"text",value:C,onChange:H=>{Z(!0),S(H.target.value)},placeholder:"https://api.openai.com/v1",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),E.openaiBaseUrl!==void 0&&s.jsx("p",{className:"text-xs text-destructive",children:E.openaiBaseUrl}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"OpenAI-compatible endpoint URL. Leave empty if this provider does not support OpenAI format."})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("label",{htmlFor:"provider-api-docs-url",className:"text-sm font-medium",children:"API Docs URL"}),s.jsx("input",{id:"provider-api-docs-url",type:"text",value:j,onChange:H=>N(H.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"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional API documentation URL. If not set, uses known provider docs."})]}),s.jsxs("div",{className:"sticky bottom-0 bg-card border-t flex gap-2 justify-end pt-2 pb-2",children:[s.jsx(Ne,{type:"button",variant:"outline",onClick:n,disabled:k,children:"Cancel"}),s.jsx(Ne,{type:"submit",disabled:k,children:k?"Saving...":e?"Update Provider":"Add Provider"})]})]})}const NO=Ae(["timeout","network_unreachable","connection_refused","auth_failed","rate_limited","server_error","invalid_response","unknown"]),EO=re({message:T(),type:NO,details:T().optional(),hint:T().optional()}),TO=re({type:Ae(["text","thinking"]),text:T().optional(),thinking:T().optional()}),AO=re({requestUrl:T().optional(),requestMethod:T().optional(),requestHeaders:nt(T(),T()).optional(),requestBody:T().optional(),responseStatus:te().optional(),responseStatusText:T().optional(),responseHeaders:nt(T(),T()).optional(),responseBody:T().optional()}),IO=re({success:We(),error:EO.optional(),model:T().optional(),inputTokens:te().optional(),outputTokens:te().optional(),cacheCreationInputTokens:te().optional(),cacheReadInputTokens:te().optional(),latencyMs:te().optional(),firstChunkMs:te().nullable().optional(),totalStreamMs:te().nullable().optional(),tokensPerSecond:te().nullable().optional(),content:ge(TO).optional(),rawResponse:T().optional(),streaming:We().optional(),streamingChunks:re({chunks:ge(ep),truncated:We().default(!1)}).optional(),requestHeaders:nt(T(),T()).optional(),debug:AO.optional()}),Kd=cn([IO,re({notConfigured:Te(!0)}),re({testing:Te(!0)})]),zs=re({nonStreaming:Kd,streaming:Kd}),zO=re({anthropic:zs,openai:zs}),RO=re({anthropic:zs,openai:zs,models:nt(T(),zO).optional(),testedAt:T().optional()});function PO(){return{anthropic:{nonStreaming:{testing:!0},streaming:{testing:!0}},openai:{nonStreaming:{testing:!0},streaming:{testing:!0}}}}function Jd(e,t){const n=()=>({nonStreaming:{success:!1,error:{message:e,type:t}},streaming:{notConfigured:!0}});return{anthropic:n(),openai:n()}}const OO=re({providerConfig:T()}),MO=re({success:We().optional(),imported:te().optional(),message:T().optional(),errors:ge(T()).optional()}),LO=re({provider:fs,imported:te(),matchedModels:ge(T()),missingModels:ge(T()),sourceUrl:T()}),Zo="Network error: could not reach the server. Is the proxy running?";function Yd(e){return{name:e.name,apiKey:e.apiKey,models:e.models,anthropicBaseUrl:(e.anthropicBaseUrl?.length??0)>0?e.anthropicBaseUrl:void 0,openaiBaseUrl:(e.openaiBaseUrl?.length??0)>0?e.openaiBaseUrl:void 0,apiDocsUrl:(e.apiDocsUrl?.length??0)>0?e.apiDocsUrl:void 0,modelMetadataUrl:(e.modelMetadataUrl?.length??0)>0?e.modelMetadataUrl:void 0,modelMetadata:e.modelMetadata,source:e.source}}function DO(e,t){const n=e?.models?.map(r=>r.trim()).filter(r=>r!=="").length??0;return Math.max(1,n)*t}async function FO(e,t){if(t.models!==void 0)try{await fetch(`/api/providers/${e}/test/log`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}catch{}}function $O({externalProviders:e,isLoading:t=!1,externalTestResults:n,externalTestingProviders:r,externalTestingTimeLeft:o,onProvidersMutate:i,onTestResultsChange:a,onTestingProvidersChange:l,onTestingTimeLeftChange:c}){const[u,d]=g.useState(!1),[f,h]=g.useState(),[p,y]=g.useState(null),[m,x]=g.useState({}),[b,v]=g.useState(new Set),[w,C]=g.useState({}),[S,j]=g.useState(null),[N,A]=g.useState(!1),[z,L]=g.useState(null),[U,E]=g.useState(!1),[O,k]=g.useState(!1),[D,q]=g.useState(null),[W,B]=g.useState("all"),[J,I]=g.useState(new Set),{providerTestTimeoutSeconds:K}=ml(),Z=g.useRef(null),R=g.useRef(null),ae=e??[],de=g.useMemo(()=>{const Y=W==="all"?ae:ae.filter(ee=>ee.source===W);return W==="all"?[...Y].sort((ee,F)=>{const G={personal:0,company:1};return(G[ee.source??""]??2)-(G[F.source??""]??2)}):Y},[ae,W]),ke=n??m,pe=r??b,se=o??w,le=c?(Y,ee)=>c(Y,ee):(Y,ee)=>{C(ee===void 0?F=>{const G={...F};return delete G[Y],G}:F=>({...F,[Y]:ee}))};g.useEffect(()=>{(async()=>{try{const Y=await fetch("/api/config/paths");if(Y.ok){const ee=await Mt(Y,OO);j(ee.providerConfig)}}catch{}})()},[]);const ce=g.useCallback(Y=>{R.current!==null&&clearTimeout(R.current),L(Y),Z.current?.scrollTo({top:Z.current.scrollHeight,behavior:"smooth"}),R.current=setTimeout(()=>{L(null),R.current=null},2e3)},[]);g.useEffect(()=>()=>{R.current!==null&&clearTimeout(R.current)},[]);const fe=g.useCallback(()=>{i?.().catch(()=>{})},[i]),be=g.useCallback((Y,ee)=>{a?a(Y,ee):x(F=>({...F,[Y]:ee}))},[a]),Se=g.useCallback((Y,ee)=>{if(l){l(Y,ee);return}v(F=>{const G=new Set(F);return ee?G.add(Y):G.delete(Y),G})},[l]),_=g.useCallback(async Y=>{be(Y,PO()),Se(Y,!0);const ee=new AbortController,F=ae.find(Ee=>Ee.id===Y);let ue=DO(F,K);le(Y,ue);const ye=setInterval(()=>{ue--,le(Y,ue),ue<=0&&(clearInterval(ye),ee.abort())},1e3);try{const Ee=await fetch(`/api/providers/${Y}/test`,{method:"POST",signal:ee.signal});if(Ee.ok){const Pe=await Mt(Ee,RO);be(Y,Pe),await FO(Y,Pe)}else be(Y,Jd(`HTTP ${Ee.status}: ${Ee.statusText}`,"server_error"))}catch(Ee){Ee instanceof Error&&Ee.name==="AbortError"&&be(Y,Jd("Request timed out","timeout"))}finally{clearInterval(ye),le(Y,void 0),Se(Y,!1)}},[K,ae,le,be,Se]),ne=g.useCallback(async(Y,ee,F=!0)=>{I(G=>{const ue=new Set(G);return ue.add(Y),ue});try{const G=ee!==void 0&&ee.trim()!==""?{url:ee}:{},ue=await fetch(`/api/providers/${Y}/model-metadata`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(G)});if(!ue.ok)return F&&y(await on(ue,"Failed to refresh model metadata")),!1;const ye=await Mt(ue,LO);return ye.imported===0&&F?y("No matching model metadata found for this provider."):y(null),ce(ye.provider.id),fe(),ye.imported>0}catch{return F&&y(Zo),!1}finally{I(G=>{const ue=new Set(G);return ue.delete(Y),ue})}},[fe,ce]);function Q(Y){(async()=>{try{const ee=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Yd(Y))});if(!ee.ok){y(await on(ee,"Failed to add provider"));return}const F=await Mt(ee,fs);d(!1),ce(F.id),Y.modelMetadataUrl!==void 0&&Y.modelMetadataUrl.trim()!==""&&await ne(F.id,Y.modelMetadataUrl,!1),fe(),await _(F.id)}catch{y(Zo)}})()}function M(Y){f&&(async()=>{try{const ee=await fetch(`/api/providers/${f.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(Yd(Y))});if(!ee.ok){y(await on(ee,"Failed to update provider"));return}const F=await Mt(ee,fs);h(void 0),ce(F.id),Y.modelMetadataUrl!==void 0&&Y.modelMetadataUrl.trim()!==""&&await ne(F.id,Y.modelMetadataUrl,!1),fe(),((Y.apiKey??"")!==(f.apiKey??"")||JSON.stringify(Y.models)!==JSON.stringify(f.models)||(Y.anthropicBaseUrl??"")!==(f.anthropicBaseUrl??"")||(Y.openaiBaseUrl??"")!==(f.openaiBaseUrl??""))&&await _(F.id)}catch{y(Zo)}})()}function P(Y){q(Y),k(!0)}function V(){const Y=D;Y!==null&&(async()=>{let ee;try{ee=await fetch(`/api/providers/${Y}`,{method:"DELETE"})}catch{y(Zo);return}if(!ee.ok){y(await on(ee,"Failed to delete provider"));return}fe()})()}const H=g.useRef(null);function X(Y){const ee="/api/providers/export";(async()=>{try{const F=await fetch(ee);if(!F.ok){y("Failed to export providers");return}const G=await F.blob(),ue=URL.createObjectURL(G),ye=document.createElement("a");ye.href=ue,ye.download=F.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]??"providers.json",document.body.appendChild(ye),ye.click(),document.body.removeChild(ye),URL.revokeObjectURL(ue)}catch{y("Failed to export providers")}})()}function $(){H.current?.click()}function oe(Y){const ee=Y.target.files?.[0];ee&&(async()=>{try{const F=await ee.text(),G=await fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F)}),ue=await Mt(G,MO);G.ok&&ue.imported!==void 0&&ue.imported>0?(fe(),y(null)):ue.errors&&ue.errors.length>0?y(ue.errors.join("; ")):y(ue.message??"Import failed")}catch{y("Failed to import providers")}Y.target.value=""})()}return t?s.jsx("div",{className:"flex items-center justify-center py-8",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading providers..."})}):u||f?s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex items-center justify-between sticky top-0 bg-background z-10 pb-2",children:s.jsx("h3",{className:"text-lg font-medium",children:f?"Edit Provider":"Add New Provider"})}),s.jsx(jO,{provider:f,onSubmit:f?M:Q,onCancel:()=>{d(!1),h(void 0)}})]}):s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between sticky top-0 z-10 bg-background pb-2",children:[s.jsx("h3",{className:"text-lg font-medium",children:"Providers"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ot,{children:s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsxs(Ne,{variant:"outline",size:"sm",onClick:()=>X(),className:"gap-1 hover:bg-muted",children:[s.jsx(Fs,{className:"size-3"}),"Export"]})}),s.jsx(Ue,{children:"Download providers as JSON for backup or sharing"})]})}),s.jsx(ot,{children:s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsxs(Ne,{variant:"outline",size:"sm",onClick:$,className:"gap-1 hover:bg-muted",children:[s.jsx(Np,{className:"size-3"}),"Import"]})}),s.jsx(Ue,{children:"Import providers from an exported JSON file"})]})}),s.jsx("input",{type:"file",ref:H,accept:".json",onChange:oe,style:{display:"none"}}),s.jsx(ot,{children:s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsxs(Ne,{variant:"outline",size:"sm",onClick:()=>E(!0),className:"gap-1",children:[s.jsx(jk,{className:"size-3"}),"Scan"]})}),s.jsx(Ue,{children:"Detect and import provider configs from Claude Code and OpenCode"})]})}),s.jsxs(Ne,{onClick:()=>d(!0),size:"sm",className:"gap-1",children:[s.jsx(ia,{className:"size-4"}),"Add Provider"]})]})]}),S!==null&&s.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/30 rounded-md px-3 py-2",children:[s.jsx("span",{className:"shrink-0",children:"Config:"}),s.jsx("span",{className:"font-mono truncate",title:S,children:S}),s.jsx(ot,{children:s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsx("button",{type:"button",onClick:()=>{$t(S).then(Y=>{Y&&(A(!0),setTimeout(()=>A(!1),2e3))})},className:"shrink-0 ml-auto text-muted-foreground hover:text-foreground transition-colors","aria-label":N?"Copied config file path":"Copy config file path",children:N?s.jsx(tt,{className:"size-3 text-green-500"}):s.jsx(St,{className:"size-3"})})}),s.jsx(Ue,{children:"Copy config file path to clipboard"})]})})]}),p!==null&&s.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive bg-destructive/10 rounded-md px-3 py-2",children:[s.jsx(eo,{className:"size-4 shrink-0"}),p]}),ae.length===0?s.jsxs("div",{className:"text-center py-12 space-y-3",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"No providers configured yet."}),s.jsxs(Ne,{onClick:()=>d(!0),variant:"outline",size:"sm",children:[s.jsx(ia,{className:"size-4"}),"Add Your First Provider"]})]}):s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"flex gap-1 border-b border-border",children:["all","personal","company"].map(Y=>s.jsx(ot,{children:s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsx("button",{type:"button",onClick:()=>B(Y),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${W===Y?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:Y==="all"?"All":Y==="personal"?"Personal":"Company"})}),s.jsx(Ue,{children:Y==="all"?"Show all providers":Y==="personal"?"Providers you configured yourself":"Providers set by your organization"})]})},Y))}),s.jsx("div",{ref:Z,className:"space-y-3",children:de.map(Y=>s.jsx(kO,{provider:Y,testResults:ke[Y.id],isTesting:pe.has(Y.id),testingTimeLeft:se[Y.id],isHighlighted:Y.id===z,onEdit:ee=>h(ee),onDelete:P,onRefreshMetadata:ee=>{ne(ee)},isRefreshingMetadata:J.has(Y.id),onTest:ee=>{_(ee)}},Y.id))})]}),s.jsx(lO,{open:U,onOpenChange:E,onImportComplete:()=>{i!==void 0&&i()}}),s.jsx(dg,{open:O,onOpenChange:k,title:"Delete Provider",description:"Are you sure you want to delete this provider? This action cannot be undone.",confirmLabel:"Delete",variant:"destructive",onConfirm:V})]})}function Xd(){const[e,t]=g.useState(!1),[n,r]=g.useState("providers"),{providers:o,isLoading:i,mutate:a}=Vp(),[l,c]=g.useState({}),[u,d]=g.useState(new Set),[f,h]=g.useState({}),p=g.useCallback((x,b)=>{c(v=>({...v,[x]:b}))},[]),y=g.useCallback((x,b)=>{d(v=>{const w=new Set(v);return b?w.add(x):w.delete(x),w})},[]),m=g.useCallback((x,b)=>{h(v=>{if(b===void 0){const w={...v};return delete w[x],w}return{...v,[x]:b}})},[]);return s.jsxs(ho,{open:e,onOpenChange:t,children:[s.jsx(Kl,{asChild:!0,children:s.jsxs(Ne,{variant:"ghost",size:"icon",className:"size-8",children:[s.jsx(zk,{className:"size-4"}),s.jsx("span",{className:"sr-only",children:"Settings"})]})}),s.jsxs(mo,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[s.jsx(go,{children:s.jsx(xo,{children:"Settings"})}),s.jsxs(wg,{value:n,onValueChange:r,className:"flex-1 overflow-hidden",children:[s.jsxs(kg,{children:[s.jsx(Ct,{value:"providers",children:"Providers"}),s.jsx(Ct,{value:"proxy",children:"Proxy"}),s.jsx(Ct,{value:"storage",children:"Storage"}),s.jsx(Ct,{value:"mcp",children:"MCP"}),s.jsx(Ct,{value:"onboarding",children:"Onboarding"})]}),s.jsxs("div",{className:"mt-4 flex-1 overflow-x-hidden overflow-y-auto pr-3",children:[s.jsx(jt,{value:"providers",children:s.jsx($O,{externalProviders:o,isLoading:i,externalTestResults:l,externalTestingProviders:u,externalTestingTimeLeft:f,onProvidersMutate:()=>a(),onTestResultsChange:p,onTestingProvidersChange:y,onTestingTimeLeftChange:m})}),s.jsx(jt,{value:"proxy",children:s.jsx(VO,{})}),s.jsx(jt,{value:"storage",children:s.jsx(UO,{})}),s.jsx(jt,{value:"mcp",children:s.jsx(WO,{})}),s.jsx(jt,{value:"onboarding",children:s.jsx(HO,{})})]})]})]})]})}const BO=re({memoryCount:te(),logDir:T(),logFileCount:te(),logBytes:te(),chunkDir:T(),chunkFileCount:te(),chunkBytes:te(),sessionArchiveDir:T(),sessionArchiveFileCount:te(),sessionArchiveBytes:te()});function Gi(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 UO(){const[e,t]=g.useState(null),[n,r]=g.useState(null),[o,i]=g.useState(!1),[a,l]=g.useState(null),c=g.useCallback(async()=>{i(!0),r(null);try{const d=await fetch("/api/logs?stats=1");if(!d.ok){r(`Failed to load storage stats: HTTP ${String(d.status)}`);return}const f=await d.json(),h=BO.safeParse(f);if(!h.success){r("Storage stats response was not valid.");return}t(h.data)}catch(d){r(d instanceof Error?d.message:String(d))}finally{i(!1)}},[]);g.useEffect(()=>{c()},[c]);const u=g.useCallback((d,f)=>{$t(f).then(h=>{h&&(l(d),setTimeout(()=>l(null),1600))})},[]);return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-semibold",children:"Log storage"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Inspect local log and streaming chunk footprint before exporting or clearing sessions."})]}),s.jsx(Ne,{type:"button",variant:"outline",size:"sm",onClick:()=>{c()},children:o?"Refreshing...":"Refresh"})]}),e!==null&&s.jsxs("div",{className:"grid gap-2 text-xs",children:[s.jsx(Kr,{id:"log-dir",label:"Log storage path",value:e.logDir,copiedId:a,onCopy:u}),s.jsx(Kr,{id:"chunk-dir",label:"Streaming chunks storage path",value:e.chunkDir,copiedId:a,onCopy:u}),s.jsx(Kr,{id:"session-archive-dir",label:"Session archive storage path",value:e.sessionArchiveDir,copiedId:a,onCopy:u}),s.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[s.jsx("div",{className:"font-medium",children:"In-memory logs"}),s.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.memoryCount.toLocaleString()," loaded"]})]}),s.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[s.jsx("div",{className:"font-medium",children:"Log files"}),s.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.logFileCount.toLocaleString()," files / ",Gi(e.logBytes)]})]}),s.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[s.jsx("div",{className:"font-medium",children:"Streaming chunks"}),s.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.chunkFileCount.toLocaleString()," files / ",Gi(e.chunkBytes)]})]}),s.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2",children:[s.jsx("div",{className:"font-medium",children:"Session archives"}),s.jsxs("div",{className:"mt-1 font-mono text-muted-foreground",children:[e.sessionArchiveFileCount.toLocaleString()," files /"," ",Gi(e.sessionArchiveBytes)]})]})]}),n!==null&&s.jsx("p",{className:"text-xs text-destructive",children:n})]})}function Kr({id:e,label:t,value:n,copiedId:r,onCopy:o}){const i=r===e;return s.jsxs("div",{className:"min-w-0 rounded-md border border-border bg-muted/20 px-3 py-2",children:[s.jsx("div",{className:"mb-1 text-xs font-medium text-muted-foreground",children:t}),s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:n}),s.jsx(Ne,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0",onClick:()=>o(e,n),"aria-label":i?`Copied ${t}`:`Copy ${t}`,children:i?s.jsx(tt,{className:"size-3.5 text-emerald-500"}):s.jsx(St,{className:"size-3.5"})})]})]})}function HO(){const[e,t]=g.useState(null),n=g.useMemo(()=>typeof window>"u"?"http://localhost:25947":window.location.origin,[]),r=g.useMemo(()=>[{id:"status",label:"Check onboarding",value:"agent-inspector onboard --status"},{id:"status-json",label:"Check onboarding JSON",value:"agent-inspector onboard --status --json"},{id:"refresh",label:"Refresh generated files",value:"agent-inspector onboard --force"},{id:"uninstall",label:"Remove matching generated files",value:"agent-inspector onboard --uninstall"},{id:"claude",label:"Claude Code command",value:"/agent-inspector:onboard"},{id:"codex",label:"Codex prompt",value:"Use the agent-inspector-onboard skill"},{id:"opencode-config",label:"OpenCode config",value:"agent-inspector onboard --opencode-only"},{id:"opencode-status",label:"OpenCode status",value:"agent-inspector onboard --status --opencode-only"},{id:"opencode-verify",label:"OpenCode verify",value:"opencode mcp list"},{id:"opencode-proxy",label:"OpenCode proxy",value:`LLM_BASE_URL=${n}/proxy`},{id:"mcp",label:"MCP URL",value:`${n}/api/mcp`},{id:"proxy",label:"Proxy URL",value:`${n}/proxy`},{id:"anthropic",label:"Anthropic base",value:`ANTHROPIC_BASE_URL=${n}/proxy`},{id:"openai",label:"OpenAI base",value:`OPENAI_BASE_URL=${n}/proxy`}],[n]),o=g.useCallback((i,a)=>{$t(a).then(l=>{l&&(t(i),setTimeout(()=>t(null),1600))})},[]);return s.jsxs("div",{className:"min-w-0 space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(wl,{className:"size-4 text-muted-foreground"}),s.jsx("h3",{className:"text-sm font-semibold",children:"Agent onboarding"})]}),s.jsx("div",{className:"grid gap-2",children:r.map(i=>s.jsx(Kr,{id:i.id,label:i.label,value:i.value,copiedId:e,onCopy:o},i.id))}),s.jsxs("div",{className:"grid gap-2 rounded-md border border-border bg-background px-3 py-2 text-xs text-muted-foreground",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(tt,{className:"size-3.5 text-emerald-500"}),s.jsx("span",{children:"Provider test creates a traceable memory probe session."})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(tt,{className:"size-3.5 text-emerald-500"}),s.jsx("span",{children:"Captured sessions can produce reviewable memory candidates."})]}),s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(tt,{className:"mt-0.5 size-3.5 text-emerald-500"}),s.jsxs("span",{children:["Streamable HTTP clients should use the MCP URL directly. Stdio-only clients should use",s.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."]})]}),s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(tt,{className:"mt-0.5 size-3.5 text-emerald-500"}),s.jsxs("span",{children:["OpenCode onboarding safely merges"," ",s.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[11px] text-foreground",children:"mcp.agent-inspector"})," ","into"," ",s.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[11px] text-foreground",children:"opencode.json"}),", then verify with"," ",s.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[11px] text-foreground",children:"opencode mcp list"}),"."]})]}),s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(tt,{className:"mt-0.5 size-3.5 text-emerald-500"}),s.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 WO(){const[e,t]=g.useState(null),r=`${g.useMemo(()=>typeof window>"u"?"http://localhost:25947":window.location.origin,[])}/api/mcp`,o=g.useMemo(()=>[{id:"mcp-url",label:"Streamable HTTP MCP URL",value:r},{id:"stdio",label:"Stdio bridge command",value:`agent-inspector-mcp stdio --url ${r}`},{id:"doctor",label:"Bridge doctor",value:`agent-inspector-mcp doctor --url ${r}`},{id:"readonly",label:"Readonly mode",value:"AGENT_INSPECTOR_MCP_READONLY=1 agent-inspector"},{id:"capabilities",label:"Capabilities resource",value:"inspector://mcp/capabilities"},{id:"context",label:"Current context resource",value:"inspector://context/current"},{id:"streamable-json",label:"Streamable HTTP JSON",value:JSON.stringify({mcpServers:{"agent-inspector":{type:"streamableHttp",url:r}}},null,2)},{id:"stdio-json",label:"Stdio MCP JSON",value:JSON.stringify({mcpServers:{"agent-inspector":{command:"agent-inspector-mcp",args:["stdio","--url",r]}}},null,2)},{id:"opencode-local",label:"OpenCode local MCP",value:JSON.stringify({mcp:{"agent-inspector":{type:"local",command:["agent-inspector-mcp","stdio","--url",r],enabled:!0}}},null,2)},{id:"codex-toml",label:"Codex TOML",value:`[mcp_servers.agent-inspector]
116
+ command = "agent-inspector-mcp"
117
+ args = ["stdio", "--url", "${r}"]`}],[r]),i=g.useCallback((a,l)=>{$t(l).then(c=>{c&&(t(a),setTimeout(()=>t(null),1600))})},[]);return s.jsxs("div",{className:"min-w-0 space-y-4",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(wl,{className:"size-4 text-muted-foreground"}),s.jsx("h3",{className:"text-sm font-semibold",children:"MCP access"})]}),s.jsxs("div",{className:"grid gap-2 rounded-md border border-border bg-background px-3 py-2 text-xs text-muted-foreground",children:[s.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."}),s.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."})]}),s.jsx("div",{className:"grid gap-2",children:o.map(a=>s.jsx(Kr,{id:a.id,label:a.label,value:a.value,copiedId:e,onCopy:i},a.id))})]})}function VO(){const{strip:e,slowResponseThresholdSeconds:t,providerTestTimeoutSeconds:n,timeDisplayFormat:r,isLoading:o,setStrip:i,setSlowResponseThresholdSeconds:a,setProviderTestTimeoutSeconds:l,setTimeDisplayFormat:c}=ml(),[u,d]=g.useState(null),[f,h]=g.useState(!1),p=g.useCallback(async b=>{d(null),h(!0);try{await i(b)}catch(v){d(v instanceof Error?v.message:String(v))}finally{h(!1)}},[i]),y=g.useCallback(async b=>{d(null),h(!0);try{await a(b)}catch(v){d(v instanceof Error?v.message:String(v))}finally{h(!1)}},[a]),m=g.useCallback(async b=>{d(null),h(!0);try{await l(b)}catch(v){d(v instanceof Error?v.message:String(v))}finally{h(!1)}},[l]),x=g.useCallback(async b=>{d(null),h(!0);try{await c(b)}catch(v){d(v instanceof Error?v.message:String(v))}finally{h(!1)}},[c]);return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"Claude Code billing header"}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["When enabled, the proxy strips the synthetic ",s.jsx("code",{children:"x-anthropic-billing-header"})," text block that Claude Code prepends to the system prompt before forwarding to upstream. Improves prefix-cache hit rates against third-party upstreams. The default at startup is controlled by the ",s.jsx("code",{children:"AGENT_INSPECTOR_STRIP_CLAUDE_CODE_BILLING_HEADER"})," ","environment variable; your choice is persisted to ",s.jsx("code",{children:"config.json"})," and overrides the env var for subsequent requests."]})]}),s.jsxs("label",{className:"flex items-center gap-3",children:[s.jsx("input",{type:"checkbox",role:"switch",checked:e,disabled:o||f,onChange:b=>{p(b.currentTarget.checked)},className:"size-4 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"}),s.jsx("span",{className:"text-sm",children:o?"Loading...":e?"Stripping enabled":"Stripping disabled"})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{htmlFor:"slow-response-threshold",className:"text-sm font-semibold",children:"Slow response threshold"}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Logs whose elapsed time exceeds this many seconds show a warning icon next to the duration. Set to ",s.jsx("code",{children:"0"})," to disable the indicator."]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{id:"slow-response-threshold",type:"number",min:0,max:oa,step:1,value:t,disabled:o||f,onChange:b=>{const v=Number(b.currentTarget.value);Number.isInteger(v)&&(v<0||v>oa||y(v))},className:"h-8 w-24 rounded-md border border-input bg-transparent px-2 text-sm font-mono disabled:cursor-not-allowed disabled:opacity-50"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"seconds"})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{htmlFor:"provider-test-timeout",className:"text-sm font-semibold",children:"Provider test timeout"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Provider Test waits this many seconds per configured model before aborting slow probes. The full test window scales with model count."}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{id:"provider-test-timeout",type:"number",min:1,max:sa,step:1,value:n,disabled:o||f,onChange:b=>{const v=Number(b.currentTarget.value);Number.isInteger(v)&&(v<1||v>sa||m(v))},className:"h-8 w-24 rounded-md border border-input bg-transparent px-2 text-sm font-mono disabled:cursor-not-allowed disabled:opacity-50"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"seconds / model"})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("label",{htmlFor:"time-display-format",className:"text-sm font-semibold",children:"Time display"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Controls timestamps in session summaries, conversation headers, and log rows."}),s.jsxs("select",{id:"time-display-format",value:r,disabled:o||f,onChange:b=>{const v=vp.safeParse(b.currentTarget.value);v.success&&x(v.data)},className:"h-8 rounded-md border border-input bg-background px-2 text-sm disabled:cursor-not-allowed disabled:opacity-50",children:[s.jsx("option",{value:"time",children:"Time only"}),s.jsx("option",{value:"full",children:"Full ISO"})]})]}),u!==null&&s.jsxs("p",{className:"text-xs text-destructive",children:["Failed to save: ",u]})]})}function qO(e){const t=new Map;for(const n of e){const r=n.logs;for(let o=1;o<r.length;o++){const i=r[o-1],a=r[o];i===void 0||a===void 0||t.set(a.id,{creation:Qd(i.cacheCreationInputTokens,a.cacheCreationInputTokens),read:Qd(i.cacheReadInputTokens,a.cacheReadInputTokens)})}}return t}function Qd(e,t){return t===null||e===null?null:t>e?{direction:"up",delta:t-e}:t<e?{direction:"down",delta:e-t}:null}const ZO=30,GO=112,KO=6;function JO(e){return e>ZO}function YO({groups:e,standalone:t,...n}){return JO(e.length)?s.jsx(XO,{groups:e,standalone:t,...n}):s.jsx(s.Fragment,{children:e.map(r=>s.jsx(Tx,{group:r,standalone:t,...n},r.id))})}function XO({groups:e,standalone:t,...n}){const[r,o]=g.useState(()=>new Map),i=rT({count:e.length,estimateSize:()=>GO,overscan:KO,getItemKey:c=>e[c]?.id??c}),a=g.useCallback((c,u)=>{o(d=>{const f=new Map(d);return u?f.set(c,!0):f.delete(c),f})},[]),l=g.useMemo(()=>{const c=new Map;for(let u=0;u<e.length;u++){const d=e[u];if(d!==void 0)for(const f of d.logs)c.set(f.id,u)}return c},[e]);return g.useEffect(()=>{const c=u=>{const d=di(u);if(d===null)return;const f=l.get(d.logId);if(f===void 0)return;const h=e[f];h!==void 0&&(a(h.id,!0),i.scrollToIndex(f,{align:"center"}))};return window.addEventListener(ln,c),()=>{window.removeEventListener(ln,c)}},[e,l,a,i]),s.jsx("div",{className:"relative w-full",style:{height:`${i.getTotalSize()}px`},"data-virtualized-conversation-list":"true",children:i.getVirtualItems().map(c=>{const u=e[c.index];return u===void 0?null:s.jsx("div",{"data-index":c.index,ref:i.measureElement,className:"absolute left-0 top-0 w-full",style:{transform:`translateY(${c.start}px)`},children:s.jsx(Tx,{group:u,standalone:t,expanded:r.get(u.id)??!1,onExpandedChange:d=>a(u.id,d),...n})},c.key)})})}const Rs="data-nav-id",QO="data-nav-action";function ef(e){return Array.from(e.querySelectorAll(`[${Rs}]`))}function tf(e){return e instanceof HTMLElement}function eM(e,t){let n=e;for(;n!==null&&n!==t;){if(n.hasAttribute(Rs))return n;n=n.parentElement}return e.hasAttribute(Rs)?e:null}function Ki(e){const t=e.getAttribute(QO);return t==="toggle"||t==="expand"||t==="collapse"?t:null}function Fr(e){e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",behavior:"smooth"})}function $r(e,t){return e[t]??null}function Bx(e){const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)}function nf(e){const t=e.tagName;return t==="BUTTON"||t==="A"||Bx(e)?!0:e.closest("[role='button'],[role='menuitem'],[role='option']")!==null}function tM(e){return e.closest("[role='dialog'],[role='menu'],[role='listbox']")!==null?!0:document.querySelector("[role='dialog'],[role='menu'],[role='listbox']")!==null}function nM(){const e=window.getSelection();return e===null?!1:e.type==="Range"&&e.toString().length>0}function Go(e,t){return e.key===t&&e.shiftKey}function rM(e,t,n={}){const r=t??e,o=n.pageWide===!0,i=g.useCallback(a=>{const l=e.current,c=r.current;if(!l||!c)return;const u=a.target;if(!tf(u)||u!==c)return;const d=ef(l),f=$r(d,0);f!==null&&Fr(f)},[e,r]);g.useEffect(()=>{const a=l=>{if(l.altKey||l.ctrlKey||l.metaKey)return;const c=e.current;if(!c)return;const u=l.target;if(!tf(u)||Bx(u)||nM())return;const d=c.contains(u);if(d&&nf(u)&&!u.hasAttribute(Rs)||!d&&(!o||nf(u)||tM(u)))return;const f=ef(c);if(f.length===0)return;const h=eM(u,c),p=h!==null?f.indexOf(h):-1;let y=!1;switch(l.key){case"ArrowUp":case"W":{if(l.shiftKey&&l.key==="ArrowUp"||l.key==="W"&&!Go(l,"W"))break;l.preventDefault();const m=p>0?p-1:p===-1?f.length-1:-1;if(m!==-1){const x=$r(f,m);x!==null&&Fr(x)}y=!0;break}case"ArrowDown":case"S":{if(l.shiftKey&&l.key==="ArrowDown"||l.key==="S"&&!Go(l,"S"))break;l.preventDefault();const m=p<f.length-1?p+1:p===-1?0:-1;if(m!==-1){const x=$r(f,m);x!==null&&Fr(x)}y=!0;break}case"ArrowLeft":case"A":{if(l.shiftKey&&l.key==="ArrowLeft"||l.key==="A"&&!Go(l,"A")||h===null)break;if(l.preventDefault(),Ki(h)==="collapse")h.click();else if(p>0){const x=$r(f,p-1);x!==null&&Fr(x)}y=!0;break}case"ArrowRight":case"D":{if(l.shiftKey&&l.key==="ArrowRight"||l.key==="D"&&!Go(l,"D")||h===null)break;if(l.preventDefault(),Ki(h)==="expand")h.click();else if(p<f.length-1){const x=$r(f,p+1);x!==null&&Fr(x)}y=!0;break}case" ":{if(h===null)break;l.preventDefault(),Ki(h)!==null&&h.click(),y=!0;break}}y&&l.stopPropagation()};return document.addEventListener("keydown",a,{capture:!0}),()=>document.removeEventListener("keydown",a,{capture:!0})},[e,o,r]),g.useEffect(()=>(document.addEventListener("focusin",i),()=>document.removeEventListener("focusin",i)),[i])}const oM={system:"System",user:"User",assistant:"Assistant",tool:"Tool Results",tools:"Tool Definitions"},sM={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"},iM={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"},Ji=12,Ko=1,rf=80,of=24;function aM(e){return e.length<=of?e:`${e.slice(0,of-3)}...`}function lM(e){const t=e.replace(/\s+/g," ").trim();return t.length<=rf?t:`${t.slice(0,rf)}...`}function Jo(e){return e>=10?`${e.toFixed(0)}%`:e>=1?`${e.toFixed(1)}%`:e>0?"<1%":"0%"}const cM=g.memo(function({segments:t,totalTokens:n,showLabels:r=!0,onActivate:o}){const i=g.useMemo(()=>n>0?n:t.reduce((x,b)=>x+b.size,0),[t,n]),a=t.slice(0,Ji),l=t.slice(Ji),c=l.reduce((x,b)=>x+b.size,0),u=l.length,d=Ji,f=d+u-1,h=u>0,p=o!==void 0,y=g.useMemo(()=>a.reduce((x,b)=>x+b.size,0),[a]),m=g.useMemo(()=>`Request context: ~${Ve(i)} tokens across ${t.length} segment${t.length===1?"":"s"}`,[t.length,i]);return t.length===0||i<=0?s.jsx("div",{role:"img","aria-label":m,className:"h-6"}):s.jsx(ot,{delayDuration:150,children:s.jsxs("div",{role:"img","aria-label":m,className:"flex flex-col gap-1.5",children:[s.jsxs("div",{className:"relative flex h-6 w-full overflow-hidden rounded border border-border/40 bg-muted/30","data-testid":"anatomy-segment-bar",children:[a.map((x,b)=>{const v=i>0?x.size/i*100:0,w=Math.max(Ko,v),C=me("h-full border-r border-background/80 last:border-r-0",p?"opacity-90 hover:opacity-100 focus:opacity-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-background":"opacity-90",sM[x.role],p?iM[x.role]:""),S={width:`${w}%`},j=`${x.label}, ${Jo(v)}, ~${Ve(x.size)} tokens`;return s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:p?s.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":j,className:C,style:S}):s.jsx("span",{"aria-label":j,className:C,style:S})}),s.jsxs(Ue,{side:"bottom",className:"max-w-sm text-xs p-2 space-y-0.5",children:[s.jsxs("div",{className:"font-semibold",children:[x.label," - ",Jo(v)," - ~",Ve(x.size)," ","tokens"]}),s.jsx("div",{className:"text-muted-foreground",children:oM[x.role]}),s.jsxs("div",{className:"text-muted-foreground",children:[x.characters.toLocaleString()," chars"]}),x.text.length>0&&s.jsx("div",{className:"text-muted-foreground/90 break-words whitespace-pre-wrap",children:lM(x.text)})]})]},`${x.path}-${b}`)}),h&&s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.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(Ko,c/i*100)}%`},children:["... +",u]})}),s.jsxs(Ue,{side:"bottom",className:"text-xs",children:[u," more segment",u===1?"":"s"," (indices"," ",d,"-",f,")"]})]})]}),r&&s.jsxs("div",{className:"flex w-full gap-1 text-[10px] text-muted-foreground",children:[a.map((x,b)=>{const v=i>0?x.size/i*100:0,w=Math.max(Ko,v);return s.jsxs("div",{className:"flex flex-col gap-0.5 truncate",style:{width:`${w}%`},title:`${x.label} - ${Jo(v)} - ~${Ve(x.size)} tokens`,children:[s.jsx("span",{className:"truncate font-mono text-foreground/80",children:aM(x.label)}),s.jsxs("span",{className:"truncate font-mono text-muted-foreground/70",children:[Jo(v)," - ~",Ve(x.size)]})]},`label-${x.path}-${b}`)}),h&&s.jsxs("div",{className:"flex flex-col gap-0.5 truncate text-muted-foreground",style:{width:`${Math.max(Ko,c/i*100)}%`},children:[s.jsxs("span",{className:"truncate font-mono text-foreground/60",children:["... +",u]}),s.jsxs("span",{className:"truncate font-mono text-muted-foreground/60",children:["~",Ve(c)]})]})]}),y<i*.1&&s.jsx("div",{className:"h-0"})]})})}),Ux=.75,Hx=.9,Za=8e3,uM=.35,Wx=40,Vx=160,dM=5,fM=8,pM=18,hM=6e4,mM=.7,sf=3e3,gM=.3,af=160,xM=new Set(["answer","body","content","data","error","message","markdown","output","response","result","stderr","stdout","text","transcript"]),bM=["context_window","contextWindow","context_length","contextLength","max_context_length","maxContextLength","max_input_tokens","maxInputTokens"],yM=["max_tokens","maxTokens","max_completion_tokens","maxCompletionTokens","max_output_tokens","maxOutputTokens"],vM=[{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"]}],wM={system:"System",user:"User messages",assistant:"Assistant messages",tool:"Tool results",tools:"Tool definitions"};function kM(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 qx(e,t){for(const n of t){const r=kM(Le(e,n));if(r!==null)return r}return null}function _M(e){const t=Le(e,"model");if(typeof t!="string")return null;const n=t.trim();return n===""?null:n}function SM(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 CM(e,t,n=[]){const r=qx(t,bM);if(r!==null)return{tokens:r,label:"Request metadata",source:"request"};const o=fO(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 vM)if(SM(i,a))return{tokens:a.tokens,label:`${a.family} local rule`,source:"model-rule"};return{tokens:null,label:"No local rule",source:"unknown"}}function jM(e){return e<0?0:e>1?1:e}function NM(e){return e===null?"unknown":e>=Hx?"danger":e>=Ux?"watch":"ok"}function EM(e,t){return e.filter(n=>n.role===t).reduce((n,r)=>n+r.size,0)}function TM(e,t){return["system","user","assistant","tool","tools"].map(r=>{const o=EM(e,r);return{role:r,label:wM[r],tokens:o,percent:t>0?o/t:0}}).filter(r=>r.tokens>0).sort((r,o)=>o.tokens-r.tokens)}function Ga(e){return e.replace(/\s+/g," ").trim().toLowerCase()}function AM(e){const t=e.replace(/\s+/g," ").trim();return t.length<=af?t:`${t.slice(0,af-3)}...`}function IM(e){return{role:e.role,label:e.label,path:e.path,tokens:e.tokens,characters:e.characters}}function zM(e){return{role:e.role,label:e.label,path:e.path,tokens:e.size,characters:e.characters,text:e.text}}function RM(e){const t=e.trim();return t.startsWith("{")||t.startsWith("[")}function PM(e){if(!RM(e))return null;try{return JSON.parse(e)}catch{return null}}function OM(e){return e.toLowerCase().replace(/[^a-z0-9]/g,"")}function MM(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 LM(e){const t=MM(e);return t===null?!1:xM.has(OM(t))}function DM(e){return e.map(t=>t.startsWith("[")?t:`.${t}`).join("").replace(/^\./,"")}function FM(e,t,n){const r=Yl(t);if(r<Vx)return null;const o=Jl(t);return o<Wx?null:{role:e.role,label:`${e.label} ${DM(n)}`,path:e.path,tokens:o,characters:r,text:t}}function Ka({value:e,segment:t,path:n,depth:r,candidates:o}){if(!(o.length>=fM)&&!(r>dM)){if(typeof e=="string"){if(!LM(n))return;const i=FM(t,e,n);i!==null&&o.push(i);return}if(Array.isArray(e)){e.forEach((i,a)=>Ka({value:i,segment:t,path:[...n,`[${String(a)}]`],depth:r+1,candidates:o}));return}Xl(e)&&Object.entries(e).forEach(([i,a])=>Ka({value:a,segment:t,path:[...n,i],depth:r+1,candidates:o}))}}function $M(e){const t=zM(e),n=PM(e.text);if(n===null)return[t];const r=[];Ka({value:n,segment:e,path:[],depth:0,candidates:r});const o=Ga(e.text),i=new Set([o]),a=r.filter(l=>{const c=Ga(l.text);return c===""||i.has(c)?!1:(i.add(c),!0)});return[t,...a]}function BM(e){const t=new Map;for(const r of e){const o=$M(r);for(const i of o){if(i.tokens<Wx||i.characters<Vx)continue;const a=Ga(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 r of t.values()){if(r.candidates.length<2)continue;const o=r.candidates[0]??null;if(o===null)continue;const i=r.tokens-o.tokens;n.push({key:`${o.path}:${o.label}:${String(r.candidates.length)}:${String(r.tokens)}`,count:r.candidates.length,totalTokens:r.tokens,repeatedTokens:i,preview:AM(o.text),firstLabel:o.label,segments:r.candidates.map(IM)})}return n.sort((r,o)=>o.repeatedTokens-r.repeatedTokens||o.totalTokens-r.totalTokens)}function UM(e){if(e.length===0)return null;const t=e.length,n=e.reduce((o,i)=>o+i.count,0),r=e.reduce((o,i)=>o+i.repeatedTokens,0);return{kind:"duplicate",severity:r>=Za?"danger":"watch",title:"Duplicate context",detail:`${String(n)} repeated blocks across ${String(t)} group${t===1?"":"s"}, ~${String(r)} repeated tokens.`}}function HM(e){return e.reduce((t,n)=>t+n.repeatedTokens,0)}function WM(e,t,n){const r=[],o=e.find(c=>c.role==="tools")??null;o!==null&&(o.tokens>=Za||o.percent>=uM&&o.tokens>=sf)&&r.push({kind:"tool-schema",severity:o.tokens>=Za?"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>=sf&&i.percent>=gM&&r.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>=pM&&(a>=hM||l>=mM)&&r.push({kind:"history-bloat",severity:l>=.85?"danger":"watch",title:"Conversation history growth",detail:`${String(n)} message blocks take ${Math.round(l*100)}% of request context.`}),r}function VM({risk:e,contextWindow:t,diagnostics:n,duplicateGroups:r}){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:HM(r)}}function qM({segments:e,inputTokens:t,parsed:n,model:r,providers:o=[]}){const i=e.reduce((j,N)=>j+N.size,0),a=r??_M(n),l=t??i,c=qx(n,yM),u=CM(a,n,o),d=c??0,f=u.tokens===null?null:l+d,h=u.tokens===null?null:u.tokens-l,p=u.tokens===null?null:u.tokens-l-d,y=u.tokens===null||f===null?null:jM(f/u.tokens),m=TM(e,i),x=m[0]??null,b=e.filter(j=>j.role!=="tools").length,v=BM(e),w=UM(v),C=WM(m,i,b);w!==null&&C.unshift(w);const S=NM(y);return{model:a,contextWindow:u,estimatedInputTokens:l,outputReserveTokens:c,windowUsedTokens:f,remainingInputTokens:h,remainingAfterReserveTokens:p,usagePercent:y,riskLevel:S,roleUsages:m,largestRole:x,diagnostics:C,duplicateGroups:v,health:VM({risk:S,contextWindow:u,diagnostics:C,duplicateGroups:v})}}const q6={watch:Ux,danger:Hx};function ZM(e){if(e===null)return null;try{return JSON.parse(e)}catch{return null}}function GM(e){return{role:e.role,label:e.label,size:e.tokens,characters:e.tokens*4,text:"",path:`role:${e.role}`}}function KM(e,t){const n=ZM(e.rawRequestBody);if(n===null)return null;const o=hg(Bn(e)).anatomySegments(n);if(o===null)return null;const i=qM({segments:o,inputTokens:e.inputTokens??null,parsed:n,model:e.model,providers:t}),a=i.model??e.model??"Unknown model",l=i.roleUsages.map(GM);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 JM(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 lf(e){switch(e){case"danger":return 4;case"watch":return 3;case"unknown":return 2;case"ok":return 1}}function YM(e,t){const n=lf(t.latest.riskLevel)-lf(e.latest.riskLevel);if(n!==0)return n;const r=e.peak.usagePercent??-1,i=(t.peak.usagePercent??-1)-r;return i!==0?i:t.latest.logId-e.latest.logId}function XM(e,t){return e.usagePercent===null||t.usagePercent===null?null:(t.usagePercent-e.usagePercent)*100}function QM(e,t=[]){const n=[...e].sort((i,a)=>i.id-a.id),r=new Map;for(const i of n){const a=KM(i,t);if(a===null)continue;const l=r.get(a.model);if(l===void 0){r.set(a.model,{model:a.model,requestCount:1,first:a,latest:a,peak:a});continue}r.set(a.model,{model:l.model,requestCount:l.requestCount+1,first:l.first,latest:a,peak:JM(a,l.peak)?a:l.peak})}return{models:[...r.values()].map(i=>({model:i.model,requestCount:i.requestCount,first:i.first,latest:i.latest,peak:i.peak,trendPercent:XM(i.first,i.latest)})).sort(YM)}}function xn(e){return e.length<=30?e:`${e.slice(0,12)}...${e.slice(-12)}`}function e6(e){return e==="full"}function t6(e,t){const n=t>0;return{redacted:n,raw:n&&e6(e)}}function cf(e){let t=0,n=0;for(const r of e)r.inputTokens!==null&&(t+=r.inputTokens),r.outputTokens!==null&&(n+=r.outputTokens);return{totalIn:t,totalOut:n}}function Zx(e,t){const n=e[0],r=e[e.length-1];return n===void 0||r===void 0?null:_l(n.timestamp,r.timestamp,t)}function n6(e){for(const t of e)if(t.userAgent!==null&&t.userAgent!==void 0&&t.userAgent!=="")return t.userAgent;return null}function r6(e){return e.error!==null&&e.error!==void 0&&e.error.length>0?!0:e.responseStatus!==null&&e.responseStatus>=400}function o6(e){const t=new Set;for(const r of e)r.model!==null&&r.model.length>0&&t.add(r.model);const n=[...t].sort();return n.length===0?"Model unknown":n.length===1?n[0]??"Model unknown":`${n.length} models`}function s6({logs:e,isLoading:t,timeDisplayFormat:n,slowResponseThresholdSeconds:r}){let o=0,i=0,a=0,l=0;const c=r*1e3;for(const f of e)r6(f)&&(o+=1),r>0&&f.elapsedMs!==null&&f.elapsedMs>=c&&(i+=1),f.inputTokens!==null&&(a+=f.inputTokens),f.outputTokens!==null&&(l+=f.outputTokens);const u=t?"rolling":o>0?"failed":i>0?"watch":"clear";return{status:u,statusLabel:u==="rolling"?"Rolling":u==="failed"?"Failure":u==="watch"?"Watch":"Clear",modelLabel:o6(e),requests:e.length,failures:o,slow:i,timeRange:Zx(e,n),tokenLabel:`${Ve(a)} in / ${Ve(l)} out`}}function i6(e){switch(e){case"rolling":return"border-cyan-400/35 bg-cyan-500/10 text-cyan-200";case"failed":return"border-red-400/35 bg-red-500/10 text-red-100";case"watch":return"border-amber-300/35 bg-amber-400/10 text-amber-100";case"clear":return"border-emerald-400/30 bg-emerald-500/10 text-emerald-100"}}function a6({stats:e}){return e.requests===0?null:s.jsx("div",{className:"mb-4 rounded-md border border-border bg-[#0c0d0f] shadow-[0_14px_50px_rgba(0,0,0,0.25)]",children:s.jsxs("div",{className:"grid grid-cols-2 gap-0 md:grid-cols-[minmax(220px,1.2fr)_repeat(4,minmax(120px,1fr))]",children:[s.jsxs("div",{className:"col-span-2 border-b border-border/70 px-4 py-3 md:col-span-1 md:border-b-0 md:border-r",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-semibold uppercase text-muted-foreground",children:[s.jsx(kw,{className:"size-3.5 text-cyan-300"}),"Opening Slate"]}),s.jsx("div",{className:"mt-2 min-w-0 truncate font-mono text-sm font-semibold text-foreground",children:e.modelLabel}),s.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",children:e.timeRange??"Timeline pending"})]}),s.jsxs("div",{className:"border-r border-b border-border/70 px-4 py-3 md:border-b-0",children:[s.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Status"}),s.jsx("div",{className:me("mt-2 inline-flex h-7 items-center rounded-md border px-2.5 font-mono text-xs font-semibold",i6(e.status)),children:e.statusLabel})]}),s.jsxs("div",{className:"border-b border-border/70 px-4 py-3 md:border-b-0 md:border-r",children:[s.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Requests"}),s.jsx("div",{className:"mt-2 font-mono text-xl font-semibold text-foreground",children:e.requests})]}),s.jsxs("div",{className:"border-r border-border/70 px-4 py-3 md:border-r",children:[s.jsxs("div",{className:"flex items-center gap-1 text-[10px] uppercase text-muted-foreground",children:[s.jsx(la,{className:"size-3 text-red-300"}),"Failure"]}),s.jsx("div",{className:"mt-2 font-mono text-xl font-semibold text-red-100",children:e.failures})]}),s.jsxs("div",{className:"px-4 py-3",children:[s.jsxs("div",{className:"flex items-center gap-1 text-[10px] uppercase text-muted-foreground",children:[s.jsx(vl,{className:"size-3 text-amber-200"}),"Tempo"]}),s.jsxs("div",{className:"mt-2 font-mono text-sm font-semibold text-foreground",children:[e.slow," slow"]}),s.jsx("div",{className:"mt-1 truncate font-mono text-[11px] text-muted-foreground",children:e.tokenLabel})]})]})})}function l6({pinnedSessionId:e,selectedSession:t,sessions:n,logs:r}){if(e!==void 0){const a=r.filter(l=>l.sessionId===e);return a.length===0?null:{label:e,logs:a,showBackLink:!0}}if(t!=="__all__"){const a=r.filter(l=>l.sessionId===t);return a.length===0?null:{label:t,logs:a,showBackLink:!0}}const o=n.length===1?n[0]??null:null;return o!==null&&r.every(l=>l.sessionId===o)?{label:o,logs:[...r],showBackLink:!1}:n.length===0&&r.length>0&&r.every(a=>a.sessionId===null)?{label:"Visible requests",logs:[...r],showBackLink:!1}:null}function Jr(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 c6(e){return e===null?"n/a":Math.abs(e)<.1?"0%":`${e>0?"+":""}${e.toFixed(1)}%`}function Ja(e){return e===null||!Number.isFinite(e)?0:Math.min(Math.max(e*100,0),100)}function u6(e,t){if(t===null)return null;const n=Ja(e),r=Ja(t);return r<=0||Math.abs(r-n)<.5?null:r}function d6(e){switch(e){case"danger":return"bg-red-400";case"watch":return"bg-amber-300";case"unknown":return"bg-muted-foreground/50";case"ok":return"bg-emerald-400"}}function f6(e){const t=e.latest.contextWindow.tokens;return t===null?"Context window unknown":`Context window ${Wp(t)}`}const p6=["score","decision","final_status","validation_pass_ratio","semantic_memory_score","opencode_exit","actual_model","run_dir","workspace","project_dir","work_dir"];function Gx(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 Yi(e,t){if(e===null)return null;const n=e.metadata[t];return n===void 0?null:Gx(n)}function h6(e){const t=e.toLowerCase();return t.includes("reject")||t.includes("fail")||t.includes("error")?"border-red-400/35 bg-red-500/10 text-red-100":t.includes("partial")||t.includes("pending")||t.includes("slow")?"border-amber-300/35 bg-amber-400/10 text-amber-100":t.includes("pass")||t.includes("complete")||t.includes("accept")?"border-emerald-400/30 bg-emerald-500/10 text-emerald-100":"border-border/70 bg-background/70 text-muted-foreground"}function m6(e){const t=[];for(const n of p6){const r=e.metadata[n];if(r===void 0)continue;const o=Gx(r);o!==null&&t.push({key:n,value:o})}return t}function uf({memberships:e,defaultOpen:t=!1}){const[n,r]=g.useState(t);if(e.length===0)return null;const o=e[0],i=o?.member??null,a=Yi(i,"score"),l=Yi(i,"decision"),c=Yi(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 s.jsxs("div",{className:"mb-3 overflow-hidden rounded-md border border-border bg-[#0c0d0f] text-xs",children:[s.jsxs("button",{type:"button",onClick:()=>r(d=>!d),className:"flex w-full items-center gap-3 px-3 py-2 text-left transition-colors hover:bg-muted/30","aria-expanded":n,children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[s.jsx("span",{className:"font-semibold text-foreground",children:"Case File"}),o!==void 0&&s.jsx("span",{className:"truncate text-muted-foreground",title:o.groupTitle,children:o.groupTitle}),s.jsxs("span",{className:"font-mono text-[10px] uppercase text-muted-foreground",children:[e.length," group",e.length===1?"":"s"]})]}),u.length>0&&s.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=>s.jsx("span",{className:me("rounded border px-1.5 py-0.5 font-mono text-[10px]",h6(d.value)),children:d.label},d.label))})]}),n?s.jsx(gl,{className:"size-4 shrink-0 text-muted-foreground"}):s.jsx(gt,{className:"size-4 shrink-0 text-muted-foreground"})]}),n&&s.jsx("div",{className:"space-y-2 border-t border-border/70 px-3 py-2",children:e.map(d=>{const f=d.member,h=m6(f);return s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[s.jsx("span",{className:"truncate font-medium text-foreground",title:d.groupTitle,children:d.groupTitle}),s.jsx("span",{className:"font-mono text-[10px] uppercase text-muted-foreground",children:d.groupStatus}),f.status!==null&&s.jsxs("span",{className:"font-mono text-[10px] text-muted-foreground",children:["member ",f.status]})]}),s.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground",children:[s.jsx("span",{className:"font-mono",title:f.sessionId,children:xn(f.sessionId)}),f.label!==null&&s.jsx("span",{children:f.label}),f.provider!==null&&s.jsx("span",{children:f.provider}),f.model!==null&&s.jsx("span",{className:"font-mono",children:f.model}),f.runId!==null&&s.jsxs("span",{className:"font-mono",title:f.runId,children:["run ",xn(f.runId)]})]}),h.length>0&&s.jsx("div",{className:"mt-2 grid gap-1 sm:grid-cols-2 xl:grid-cols-3",children:h.map(p=>s.jsxs("div",{className:"min-w-0 rounded border border-border/60 px-2 py-1",children:[s.jsx("div",{className:"font-mono text-[10px] text-muted-foreground",children:p.key}),s.jsx("div",{className:"truncate font-mono text-[11px] text-foreground",title:p.value,children:p.value})]},p.key))})]},`${d.groupId}:${f.id}`)})})]})}function g6({logs:e,pagination:t}){if(t.isLoading&&e.length===0)return"Loading logs...";if(e.length===0)return"No logs on this page";const n=e[0],r=e[e.length-1],o=n===void 0||r===void 0?"Current page":`#${n.id}-#${r.id}`,i=t.total===null?"logs":`${t.total} logs`;return`Showing ${o} of ${i}`}function Yo({label:e,title:t,icon:n,disabled:r,onClick:o}){return s.jsxs("button",{type:"button",onClick:o,disabled:r,className:"inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-45",title:t,children:[n,s.jsx("span",{children:e})]})}function df({logs:e,pagination:t,embedded:n=!1}){if(t===void 0)return null;const r=t.isLoading;return s.jsxs("div",{className:me("flex min-h-9 flex-col gap-2 px-1 py-1 sm:flex-row sm:items-center",n?"border-t border-border/70 pt-2":"mb-3 rounded-md border border-border bg-muted/10 px-2"),children:[s.jsxs("div",{className:"w-full min-w-0 px-1 font-mono text-[11px] text-muted-foreground sm:flex-1",children:[g6({logs:e,pagination:t}),t.isLoading&&e.length>0&&s.jsx("span",{className:"ml-2",children:"Loading..."})]}),s.jsxs("div",{className:"flex w-full items-center gap-1 overflow-x-auto sm:w-auto",children:[s.jsx(Yo,{label:"Oldest",title:"Load the oldest logs in this session",icon:s.jsx(cw,{className:"size-3.5"}),disabled:r||!t.hasOlder,onClick:t.onOldest}),s.jsx(Yo,{label:"Older",title:"Load older logs",icon:s.jsx(ow,{className:"size-3.5"}),disabled:r||!t.hasOlder,onClick:t.onOlder}),s.jsx(Yo,{label:"Newer",title:"Load newer logs",icon:s.jsx(Ft,{className:"size-3.5"}),disabled:r||!t.hasNewer,onClick:t.onNewer}),s.jsx(Yo,{label:"Newest",title:"Load the newest logs in this session",icon:s.jsx(dw,{className:"size-3.5"}),disabled:r||!t.hasNewer,onClick:t.onNewest})]})]})}function x6(e){return`${e} ${e===1?"request":"requests"}`}function ff(e){return`#${String(e)}`}function pf(e){switch(e){case"danger":return"text-red-300";case"watch":return"text-amber-200";case"unknown":return"text-muted-foreground";case"ok":return"text-emerald-300"}}function b6(e){switch(e){case"risk":return"border-red-400/30 bg-red-500/10 text-red-100";case"optimizable":return"border-amber-400/25 bg-amber-400/8 text-amber-100";case"ok":return"border-emerald-400/25 bg-emerald-400/8 text-emerald-100"}}function y6(e){switch(e){case"risk":return"Risk";case"optimizable":return"Optimizable";case"ok":return"OK"}}const v6=10,w6=80;function k6(e){e.setAttribute("data-deep-link-highlight","true"),window.setTimeout(()=>{e.removeAttribute("data-deep-link-highlight")},1800)}function _6(e){const t=document.getElementById(`log-${String(e)}`);return t instanceof HTMLElement?(t.scrollIntoView({block:"center",behavior:"smooth"}),t.focus({preventScroll:!0}),k6(t),!0):!1}function Kx(e){$a({logId:e,tab:"anatomy"});let t=0;const n=()=>{$a({logId:e,tab:"anatomy"}),!_6(e)&&(t+=1,t<v6&&window.setTimeout(n,w6))};window.setTimeout(n,0)}function hf({command:e}){const[t,n]=g.useState(!1),r=g.useCallback(()=>{$t(e).then(o=>{o&&(n(!0),setTimeout(()=>n(!1),2e3))})},[e]);return s.jsxs("div",{className:"inline-flex items-center gap-2 bg-muted rounded-md px-3 py-2",children:[s.jsx("pre",{className:"text-blue-500 font-mono text-sm m-0",children:e}),s.jsx("button",{type:"button",onClick:r,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 cursor-pointer","aria-label":"Copy command",children:t?s.jsx(tt,{className:"size-4"}):s.jsx(St,{className:"size-4"})})]})}function mf(){return s.jsx(ot,{children:s.jsxs($e,{children:[s.jsx(Be,{asChild:!0,children:s.jsxs("span",{className:"inline-flex h-7 items-center gap-2 rounded-md border border-cyan-400/30 bg-cyan-500/10 px-2.5 font-mono text-[11px] font-medium text-cyan-300 shadow-[0_0_16px_rgba(34,211,238,0.08)]",children:[s.jsx("span",{className:"size-1.5 rounded-full bg-emerald-300 shadow-[0_0_8px_rgba(110,231,183,0.8)]"}),"MCP Ready",s.jsx("span",{className:"hidden text-cyan-200/70 sm:inline",children:"/api/mcp"})]})}),s.jsx(Ue,{sideOffset:8,className:"max-w-[320px] text-left leading-relaxed",children:"Coding agents can inspect logs, replay requests, test providers, and debug sessions through MCP at /api/mcp."})]})})}const S6=["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 gf({compact:e,entrancePhase:t}){return e?s.jsx(zd,{className:"size-7 text-amber-500"}):s.jsxs("span",{className:"flex shrink-0 items-end gap-1 group cursor-default","aria-hidden":"true",children:[s.jsx(zd,{className:"size-10 text-amber-500 transition-all duration-300 group-hover:scale-125 group-hover:-translate-y-1.5"}),s.jsx("span",{className:"hidden items-end gap-0.5 sm:flex",children:oo.map((n,r)=>{const o=S6[r]??"text-amber-500",i=t==="hidden"?"opacity-0 scale-0":t==="playing"?"animate-crab-piano-pop":"";return s.jsx(n,{className:`size-5 ${o} transition-all duration-300 ease-out group-hover:scale-125 group-hover:-translate-y-1 ${i}`,style:{transitionDelay:`${r*50}ms`,...t==="playing"?{animationDelay:`${r*400}ms`}:{}}},r)})})]})}function C6({compact:e,crabEntrancePhase:t}){return e?s.jsxs("div",{className:"pb-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[s.jsx(gf,{compact:!0,entrancePhase:t}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[s.jsx("span",{className:"truncate text-base font-bold",children:"Inspector"}),s.jsxs("span",{className:"hidden shrink-0 font-mono text-[11px] font-semibold text-muted-foreground sm:inline",children:["v",ua.version]})]}),s.jsx("div",{className:"hidden text-[11px] font-semibold text-muted-foreground sm:block",children:"Local First. Evidence First."})]})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s.jsx(Rd,{}),s.jsx(Od,{}),s.jsx(Xd,{})]})]}),s.jsx("div",{className:"mt-2 hidden sm:block",children:s.jsx(mf,{})})]}):s.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] items-start gap-3 pb-6",children:[s.jsx("div",{}),s.jsxs("h1",{className:"flex min-w-0 flex-col items-center gap-2 text-center",children:[s.jsxs("span",{className:"flex max-w-[calc(100vw-7rem)] items-end gap-2 whitespace-nowrap",children:[s.jsx(gf,{compact:!1,entrancePhase:t}),s.jsxs("span",{className:"flex min-w-0 items-baseline gap-2 pl-1",children:[s.jsx("span",{className:"truncate text-lg font-bold",children:"Agent Inspector"}),s.jsxs("span",{className:"shrink-0 font-mono text-xs font-semibold text-muted-foreground",children:["v",ua.version]})]}),s.jsx(ia,{className:"size-4 shrink-0 text-muted-foreground/70","aria-hidden":"true"}),s.jsx(eP,{className:"size-10 shrink-0"})]}),s.jsx("span",{className:"max-w-[calc(100vw-7rem)] text-sm font-semibold text-muted-foreground",children:"Local First. Evidence First."}),s.jsx(mf,{})]}),s.jsxs("div",{className:"justify-self-end flex items-center gap-1",children:[s.jsx(Rd,{}),s.jsx(Od,{}),s.jsx(Xd,{})]})]})}function xf({label:e,logId:t}){return s.jsxs("button",{type:"button",onClick:()=>Kx(t),className:"inline-flex h-5 items-center rounded px-1 font-mono text-[10px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:`Open Context for ${ff(t)}`,children:[e," ",ff(t)]})}function j6({latestPercent:e,peakPercent:t,risk:n,onOpenContext:r}){const o=Ja(e),i=u6(e,t),a=t===null?`Latest context window usage ${Jr(e)}`:`Latest context window usage ${Jr(e)}, peak ${Jr(t)}`;return s.jsx("button",{type:"button",onClick:r,className:"group block w-full rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1","aria-label":`${a}. Open latest Context details`,title:"Open latest Context details",children:s.jsxs("span",{className:"relative block h-2.5 overflow-hidden rounded-full border border-border/70 bg-background transition-colors group-hover:border-foreground/30",role:"meter","aria-label":a,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(o),children:[s.jsx("span",{className:me("block h-full rounded-full transition-[width]",d6(n)),style:{width:`${o}%`}}),i!==null&&s.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 N6({summary:e}){const t=e.trendPercent,n=t===null||Math.abs(t)<.1?null:t>0?Z2:B2,r=e.latest.diagnostics[0]??null,o=Jr(e.latest.usagePercent),i=Jr(e.peak.usagePercent),a=()=>{Kx(e.latest.logId)};return s.jsxs("div",{className:"grid gap-x-4 gap-y-2 border-t border-border/60 py-2 first:border-t-0 lg:grid-cols-[minmax(180px,1fr)_minmax(260px,1fr)_minmax(260px,1.4fr)]",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.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}),s.jsx("span",{className:me("inline-flex h-5 shrink-0 items-center rounded border px-1.5 font-mono text-[10px]",b6(e.latest.health.level)),children:y6(e.latest.health.level)})]}),s.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:[s.jsx("span",{children:x6(e.requestCount)}),s.jsx("span",{children:f6(e)})]})]}),s.jsxs("div",{className:"min-w-0 space-y-2 text-xs",children:[s.jsx(j6,{latestPercent:e.latest.usagePercent,peakPercent:e.peak.usagePercent,risk:e.latest.riskLevel,onOpenContext:a}),s.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Latest"}),s.jsx("div",{className:me("mt-0.5 font-mono",pf(e.latest.riskLevel)),children:o}),s.jsx(xf,{label:"Log",logId:e.latest.logId})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Peak"}),s.jsx("div",{className:me("mt-0.5 font-mono",pf(e.peak.riskLevel)),children:i}),s.jsx(xf,{label:"Log",logId:e.peak.logId})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Trend"}),s.jsxs("div",{className:"mt-0.5 flex items-center gap-1 font-mono text-foreground",children:[n!==null&&s.jsx(n,{className:me("size-3",t!==null&&t>0?"text-amber-300":"text-emerald-300")}),c6(t)]}),s.jsx("div",{className:"h-5","aria-hidden":"true"})]})]})]}),s.jsxs("div",{className:"min-w-0 space-y-1.5",children:[s.jsx(cM,{segments:e.latest.roleSegments,totalTokens:e.latest.roleTotalTokens,showLabels:!1}),s.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-[11px] text-muted-foreground",children:[s.jsxs("span",{className:"font-mono",children:["~",Ve(e.latest.estimatedInputTokens)," input"]}),e.latest.windowUsedTokens!==null&&s.jsxs("span",{className:"font-mono",children:["~",Ve(e.latest.windowUsedTokens)," used"]}),r!==null&&s.jsx("span",{className:"truncate",children:r})]})]})]})}function E6({summary:e}){return e.models.length===0?null:s.jsxs("div",{className:"mt-3 border-t border-border/70 pt-2",children:[s.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[s.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-normal text-muted-foreground",children:"Session Context"}),s.jsxs("div",{className:"font-mono text-[10px] text-muted-foreground",children:[e.models.length," model",e.models.length===1?"":"s"]})]}),s.jsx("div",{className:"max-h-52 overflow-y-auto pr-1",children:e.models.map(t=>s.jsx(N6,{summary:t},t.model))})]})}function T6(e){const t=e.models.filter(r=>r.latest.health.level==="risk").length;if(t>0)return`${t} risk`;const n=e.models.filter(r=>r.latest.health.level==="optimizable").length;return n>0?`${n} optimizable`:`${e.models.length} model${e.models.length===1?"":"s"}`}function A6({label:e,logs:t,totalIn:n,totalOut:r,timeDisplayFormat:o,contextSummary:i,showBackLink:a}){const[l,c]=g.useState(!1),[u,d]=g.useState(!1),f=g.useMemo(()=>Zx(t,o),[t,o]),h=g.useMemo(()=>n6(t),[t]),p=g.useMemo(()=>T6(i),[i]),y=g.useCallback(()=>{$t(window.location.href).then(m=>{m&&(c(!0),setTimeout(()=>c(!1),2e3))})},[]);return s.jsxs("div",{className:"mb-3 rounded-md border border-border bg-muted/15 px-3 py-2 text-xs",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a&&s.jsx("a",{href:"/",className:"inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":"Back to all sessions",title:"Back to all sessions",children:s.jsx(V2,{className:"size-3.5"})}),s.jsxs("div",{className:"min-w-[180px] flex-1",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx("span",{className:"font-mono font-semibold text-purple-400/90 truncate",title:e,children:xn(e)}),h!==null&&s.jsx("span",{className:"font-mono text-muted-foreground truncate max-w-[220px]",title:h,children:h})]}),s.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground",children:[s.jsxs("span",{children:[t.length," request",t.length!==1?"s":""]}),f!==null&&s.jsx("span",{children:f}),(n>0||r>0)&&s.jsxs("span",{className:"font-mono",children:[Ve(n)," in / ",Ve(r)," out"]})]})]}),i.models.length>0&&s.jsxs("button",{type:"button",onClick:()=>d(m=>!m),className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-border bg-background/60 px-2.5 font-mono text-[11px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-expanded":u,title:u?"Hide context details":"Show context details",children:[s.jsx("span",{children:p}),u?s.jsx(gl,{className:"size-3.5"}):s.jsx(gt,{className:"size-3.5"})]}),s.jsx("button",{type:"button",onClick:y,className:"inline-flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":l?"Copied session link":"Copy session link",title:l?"Copied session link":"Copy session link",children:l?s.jsx(tt,{className:"size-3.5"}):s.jsx(St,{className:"size-3.5"})})]}),u&&s.jsx(E6,{summary:i})]})}function I6({logs:e,sessions:t,models:n,selectedSession:r,selectedModel:o,onSessionChange:i,onModelChange:a,onClearAll:l,onClearGroup:c,onImportLogs:u,viewMode:d,captureMode:f,strip:h,slowResponseThresholdSeconds:p,timeDisplayFormat:y,isLoading:m=!1,pagination:x,sessionMemberships:b=[],hideSessionFilter:v=!1,pinnedSessionId:w}){const{totalIn:C,totalOut:S}=g.useMemo(()=>cf(e),[e]),{providers:j}=Vp(),[N,A]=g.useState(null),[z,L]=g.useState(null),[U,E]=g.useState(!1),[O,k]=g.useState(null),[D,q]=g.useState(null),[W,B]=g.useState(null),[J,I]=g.useState("hidden"),K=g.useRef(null),Z=g.useRef(null),R=g.useRef(null);rM(K,Z,{pageWide:!0}),g.useEffect(()=>{const Y=50+oo.length*400,ee=setTimeout(()=>I("playing"),50),F=setTimeout(()=>I("done"),Y);return()=>{clearTimeout(ee),clearTimeout(F)}},[]),g.useEffect(()=>{if(w===void 0){document.title="Agent Inspector";return}const $=e.length===1?"1 req":`${e.length} req`;document.title=`${xn(w)} - ${$} - Agent Inspector`},[e.length,w]);const ae=g.useCallback(async $=>{A($),L(null);try{const oe=await m_(e,$);oe.ok||L(oe.message)}finally{A(null)}},[e]),de=g.useCallback(()=>{R.current?.click()},[]),ke=g.useCallback($=>{const oe=$.currentTarget.files?.[0];$.currentTarget.value="",!(oe===void 0||u===void 0)&&(E(!0),q(null),k(null),u(oe).then(Y=>{const ee=Y.skipped>0?`, skipped ${String(Y.skipped)}`:"";k(`Imported ${String(Y.imported)} logs as ${Y.sessionId}${ee}.`)}).catch(Y=>{q(Y instanceof Error?Y.message:"Failed to import logs")}).finally(()=>{E(!1)}))},[u]);g.useEffect(()=>{B(null)},[r,o]);const pe=g.useCallback(()=>{B(null)},[]),se=g.useMemo(()=>HE(e),[e]),le=g.useMemo(()=>l6({pinnedSessionId:w,selectedSession:r,sessions:t,logs:e}),[e,w,r,t]),ce=le?.logs??[],fe=le!==null&&ce.length>0,{totalIn:be,totalOut:Se}=g.useMemo(()=>cf(ce),[ce]),_=g.useMemo(()=>QM(ce,j),[ce,j]),ne=g.useMemo(()=>qO(se),[se]),Q=g.useMemo(()=>kR(se),[se]),M=t6(f,e.length),P=w!==void 0,V=fe&&le!==null?xn(le.label):r==="__all__"?"All sessions":xn(r),H=g.useMemo(()=>s6({logs:e,isLoading:m,timeDisplayFormat:y,slowResponseThresholdSeconds:p}),[m,e,p,y]),X=g.useCallback($=>{const oe=Q.get($.id);oe!==void 0&&B([oe,$])},[Q]);return s.jsxs("div",{className:"min-h-screen w-full bg-[#070809] text-foreground",children:[s.jsxs("div",{className:"grid min-h-screen w-full grid-cols-1 lg:grid-cols-[340px_minmax(0,1fr)] xl:grid-cols-[360px_minmax(0,1fr)]",children:[s.jsx("aside",{className:"border-b border-border bg-[#090a0c] lg:sticky lg:top-0 lg:h-screen lg:overflow-y-auto lg:border-b-0 lg:border-r",children:s.jsxs("div",{className:"space-y-4 p-4",children:[s.jsx(C6,{compact:!0,crabEntrancePhase:J}),s.jsxs("div",{className:"grid grid-cols-3 gap-2 border-y border-border/70 py-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"font-mono text-lg font-semibold text-foreground",children:e.length}),s.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Requests"})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"font-mono text-lg font-semibold text-foreground",children:Ve(fe?be:C)}),s.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Input"})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"font-mono text-lg font-semibold text-foreground",children:Ve(fe?Se:S)}),s.jsx("div",{className:"text-[10px] uppercase text-muted-foreground",children:"Output"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-normal text-muted-foreground",children:"Workspace"}),s.jsxs("div",{className:"rounded-md border border-border bg-[#0c0d0f] px-3 py-2",children:[s.jsx("div",{className:"font-mono text-xs font-semibold text-purple-300",title:V,children:V}),s.jsx("div",{className:"mt-1 text-[11px] text-muted-foreground",children:P?"Session workspace":"Live workspace"})]})]}),fe&&le!==null&&s.jsx(A6,{label:le.label,logs:ce,totalIn:be,totalOut:Se,timeDisplayFormat:y,contextSummary:_,showBackLink:le.showBackLink}),fe&&w!==void 0&&b.length>0&&s.jsx(uf,{memberships:b}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-normal text-muted-foreground",children:"Filters"}),!v&&s.jsxs(Ns,{value:r,onValueChange:i,children:[s.jsx(Ts,{className:"h-9 w-full text-xs",children:s.jsx(Es,{placeholder:"All sessions"})}),s.jsxs(As,{children:[s.jsx(Wt,{value:"__all__",children:"All sessions"}),t.map($=>s.jsx(Wt,{value:$,children:xn($)},$))]})]}),s.jsxs(Ns,{value:o,onValueChange:a,children:[s.jsx(Ts,{className:"h-9 w-full text-xs",children:s.jsx(Es,{placeholder:"All models"})}),s.jsxs(As,{children:[s.jsx(Wt,{value:"__all__",children:"All models"}),n.map($=>s.jsx(Wt,{value:$,children:$},$))]})]})]})]})}),s.jsxs("main",{className:"min-w-0",children:[s.jsxs("div",{className:"sticky top-0 z-30 border-b border-border bg-[#08090b]/95 px-4 py-3 shadow-[0_12px_40px_rgba(0,0,0,0.24)] backdrop-blur lg:px-5",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("div",{className:"min-w-[180px] flex-1",children:[s.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Logs"}),s.jsx("div",{className:"mt-0.5 font-mono text-[11px] text-muted-foreground",children:V})]}),u!==void 0&&s.jsxs(s.Fragment,{children:[s.jsx("input",{ref:R,type:"file",accept:".zip,.json,.jsonl,application/zip,application/json",className:"hidden",onChange:ke}),s.jsx("button",{type:"button",onClick:de,disabled:U,className:"inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",title:"Import Agent Inspector export",children:U?s.jsx("span",{children:"Importing..."}):s.jsxs(s.Fragment,{children:[s.jsx(Np,{className:"size-3.5"}),s.jsx("span",{children:"Import"})]})})]}),M.redacted&&s.jsx("button",{type:"button",onClick:()=>{ae("redacted")},disabled:N!==null,className:"inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",title:"Export redacted logs as JSON ZIP",children:N==="redacted"?s.jsx("span",{children:"Exporting..."}):s.jsxs(s.Fragment,{children:[s.jsx(Fs,{className:"size-3.5"}),s.jsx("span",{children:"Export"})]})}),M.raw&&s.jsx("button",{type:"button",onClick:()=>{ae("raw")},disabled:N!==null,className:"inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",title:"Export raw logs without redaction",children:N==="raw"?s.jsx("span",{children:"Exporting..."}):s.jsxs(s.Fragment,{children:[s.jsx($w,{className:"size-3.5"}),s.jsx("span",{children:"Raw"})]})}),s.jsxs("button",{type:"button",onClick:l,className:"inline-flex h-8 items-center gap-1.5 rounded-md px-3 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",title:"Clear all logs",children:[s.jsx(mr,{className:"size-3.5"}),s.jsx("span",{children:"Clear"})]})]}),s.jsx(df,{logs:e,pagination:x,embedded:!0}),z!==null&&s.jsx("div",{className:"mt-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:z}),D!==null&&s.jsx("div",{className:"mt-2 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:D}),O!==null&&D===null&&s.jsx("div",{className:"mt-2 rounded-md border border-emerald-500/25 bg-emerald-500/10 px-3 py-2 text-xs text-emerald-200",children:O})]}),s.jsxs("div",{className:"px-4 py-4 lg:px-5",children:[s.jsx(a6,{stats:H}),e.length===0?r!=="__all__"?s.jsx("div",{className:"py-16 text-center text-muted-foreground",children:s.jsxs("div",{className:"mx-auto max-w-xl space-y-4 rounded-md border border-border bg-muted/10 px-4 py-8",children:[s.jsx("p",{className:"text-sm font-medium",children:m?"Loading session data...":"Session not found"}),s.jsx("p",{className:"inline-block max-w-full rounded bg-muted px-3 py-1 font-mono text-xs break-all",children:xn(r)}),b.length>0&&s.jsx("div",{className:"text-left",children:s.jsx(uf,{memberships:b})}),!m&&s.jsxs("p",{className:"text-xs",children:["This session may have been cleared or never existed."," ",v?s.jsx("a",{href:"/",className:"underline transition-colors hover:text-foreground",children:"Back to all sessions"}):s.jsx("button",{type:"button",onClick:()=>i("__all__"),className:"underline transition-colors hover:text-foreground",children:"Show all sessions"})]})]})}):s.jsx("div",{className:"py-16 text-center text-muted-foreground",children:s.jsxs("div",{className:"mx-auto max-w-2xl space-y-4 rounded-md border border-border bg-muted/10 px-4 py-8",children:[s.jsx("p",{className:"text-sm",children:"No requests captured yet."}),s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx(hf,{command:"ANTHROPIC_BASE_URL=http://localhost:25947/proxy <your-tool>"}),s.jsx(hf,{command:"OPENAI_BASE_URL=http://localhost:25947/proxy <your-tool>"})]}),s.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."})]})}):s.jsxs("div",{ref:Z,tabIndex:0,className:"flex flex-col gap-2 focus:outline-none",children:[s.jsx("div",{ref:K,children:s.jsx(YO,{groups:se,viewMode:d,strip:h,slowResponseThresholdSeconds:p,cacheTrends:ne,onCompareWithPrevious:X,comparisonPredecessors:Q,onClearGroup:c,standalone:se.length===1,hasPinnedSessionContext:fe,timeDisplayFormat:y})}),s.jsx("div",{className:"mt-3",children:s.jsx(df,{logs:e,pagination:x})})]})]})]})]}),W!==null&&s.jsx(g.Suspense,{fallback:null,children:s.jsx(j3,{left:W[0],right:W[1],onClose:pe})})]})}const z6=cn([re({type:Te("init"),logs:ge(Qr)}),re({type:Te("update"),log:Qr})]),R6=re({logs:ge(Qr),total:te().int().nonnegative(),limit:te().int().positive(),hasOlder:We(),hasNewer:We(),oldestLogId:te().int().positive().nullable(),newestLogId:te().int().positive().nullable()});function P6(e,t){const n=[];for(const r of e)for(const o of r.members)o.sessionId===t&&n.push({groupId:r.id,groupTitle:r.title,groupKind:r.kind,groupStatus:r.status,groupTask:r.task,groupProject:r.project,groupEvidence:r.evidence,member:o});return n}function O6(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function M6(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function L6(e,t,n){return t==="__all__"&&n==="__all__"?e:e.filter(r=>!(t!=="__all__"&&r.sessionId!==t||n!=="__all__"&&r.model!==n))}const D6=50,F6=12,$6=1800,bf=500,Jx=100;function B6(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 U6(e,t){const n=new URLSearchParams({cursor:"1",compact:"1",limit:String(Jx),sessionId:e});switch(t.kind){case"oldest":n.set("anchor","oldest");break;case"older":n.set("beforeLogId",String(t.beforeLogId));break;case"newer":n.set("afterLogId",String(t.afterLogId));break}return`/api/logs?${n.toString()}`}function Br(e){const t=new Map;for(let n=0;n<e.length;n++){const r=e[n];r!==void 0&&t.set(r.id,n)}return t}function Xi(e){return e.length<=bf?e:e.slice(e.length-bf)}function Z6({initialSessionId:e}={}){const[t,n]=g.useState([]),[r,o]=g.useState(e??"__all__"),[i,a]=g.useState("__all__"),[l,c]=g.useState(null),[u,d]=g.useState(e===void 0),[f,h]=g.useState(null),[p,y]=g.useState(e!==void 0),[m,x]=g.useState([]),b=g.useRef(null),v=g.useRef(null),w=g.useRef(null),C=g.useRef(0),S=g.useRef(new Map),j=g.useRef([]),N=g.useRef(null),A=g.useMemo(()=>L6(t,r,i),[t,r,i]),z=g.useMemo(()=>O6(t),[t]),L=g.useMemo(()=>M6(t),[t]),U=g.useCallback(()=>{N.current=null;const se=j.current;j.current=[],se.length!==0&&n(le=>{let ce=le;for(const fe of se){const be=S.current.get(fe.id);be!==void 0?ce=[...ce.slice(0,be),fe,...ce.slice(be+1)]:(S.current.set(fe.id,ce.length),ce=[...ce,fe])}return ce=Xi(ce),S.current=Br(ce),ce})},[]),E=g.useCallback(se=>{j.current.push(se),N.current===null&&(N.current=setTimeout(U,D6))},[U]),O=g.useCallback(()=>{b.current&&b.current.close(),d(!1);const se=new EventSource(B6(e));b.current=se,se.onmessage=le=>{try{const ce=String(le.data),fe=JSON.parse(ce),be=z6.safeParse(fe);if(!be.success){c("Failed to parse SSE data");return}const Se=be.data;if(Se.type==="init"){N.current!==null&&(clearTimeout(N.current),N.current=null),j.current=[];const _=Xi(Se.logs);S.current=Br(_),n(_),d(!0),c(null)}else Se.type==="update"&&E(Se.log)}catch{c("Failed to parse SSE data")}},se.onerror=()=>{c("SSE connection lost, reconnecting..."),d(!0),se.close(),v.current!==null&&clearTimeout(v.current),v.current=setTimeout(O,3e3)}},[e,E]),k=g.useCallback(se=>{if(e===void 0)return;const le=C.current+1;C.current=le,y(!0),c(null),vn(U6(e,se),R6).then(ce=>{if(C.current!==le)return;const fe=ce.logs;S.current=Br(fe),n(fe),h(ce),o(e),y(!1),c(null)}).catch(ce=>{C.current===le&&(n([]),h(null),y(!1),c(ce instanceof Error?ce.message:"Failed to load session logs"))})},[e]);g.useEffect(()=>{if(e===void 0){x([]);return}let se=!1;return fetch("/api/groups").then(async le=>{if(!le.ok)return null;const ce=await le.json(),fe=yp.safeParse(ce);return fe.success?fe.data.groups:null}).then(le=>{se||le===null||x(P6(le,e))}).catch(()=>{se||x([])}),()=>{se=!0}},[e]),g.useEffect(()=>{e!==void 0&&k({kind:"newest"})},[e,k]),g.useEffect(()=>{if(e===void 0)return O(),()=>{b.current&&(b.current.close(),b.current=null),v.current!==null&&(clearTimeout(v.current),v.current=null),N.current!==null&&(clearTimeout(N.current),N.current=null)}},[O,e]),g.useEffect(()=>{const se=window.location.hash;if(!se.startsWith("#log-")||w.current===se)return;const le=se.slice(1),ce=Number(le.replace(/^log-/,""));Number.isInteger(ce)&&ce>0&&$a({logId:ce,tab:"request"});let fe=!1,be=0,Se=null,_=null;const ne=()=>{if(fe)return;const Q=document.getElementById(le);if(Q!==null){w.current=se,Q.scrollIntoView({block:"center",behavior:"smooth"}),Q instanceof HTMLElement&&(Se=Q,Q.setAttribute("data-deep-link-highlight","true"),_=window.setTimeout(()=>{Q.removeAttribute("data-deep-link-highlight")},$6),Q.focus({preventScroll:!0}),Q.getAttribute("data-nav-action")==="expand"&&Q.click());return}be+=1,be<F6&&window.setTimeout(ne,100)};return ne(),()=>{fe=!0,_!==null&&window.clearTimeout(_),Se!==null&&Se.removeAttribute("data-deep-link-highlight")}},[A.length]);const D=g.useCallback(()=>{e!==void 0&&t.length===0||(async()=>{try{const se=e===void 0?void 0:JSON.stringify({ids:t.map(ce=>ce.id)});if(!(await fetch("/api/logs",{method:"DELETE",...se===void 0?{}:{headers:{"Content-Type":"application/json"},body:se}})).ok){c("Failed to clear logs");return}S.current.clear(),n([]),c(null)}catch(se){c(se instanceof Error?se.message:"Unknown error clearing logs")}})()},[t,e]),q=g.useCallback(se=>{se.length!==0&&(async()=>{try{if(!(await fetch("/api/logs",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:se})})).ok){c("Failed to clear group");return}const ce=new Set(se);n(fe=>{const be=fe.filter(Se=>!ce.has(Se.id));return S.current=Br(be),be}),c(null)}catch(le){c(le instanceof Error?le.message:"Unknown error clearing group")}})()},[]),W=g.useCallback(async se=>{const le=new FormData;le.set("file",se);const ce=await vn("/api/logs/import",z2,{method:"POST",body:le});return n(fe=>{const be=new Set(ce.logs.map(ne=>ne.id)),Se=[...fe.filter(ne=>!be.has(ne.id)),...ce.logs].sort((ne,Q)=>ne.id-Q.id),_=Xi(Se);return S.current=Br(_),_}),o(ce.sessionId),a("__all__"),h(null),c(null),ce},[]),{strip:B,captureMode:J,slowResponseThresholdSeconds:I,timeDisplayFormat:K}=ml(),Z=J,R=g.useCallback(()=>{k({kind:"oldest"})},[k]),ae=g.useCallback(()=>{k({kind:"newest"})},[k]),de=g.useCallback(()=>{const se=t[0],le=f?.oldestLogId??se?.id??null;le!==null&&k({kind:"older",beforeLogId:le})},[t,k,f]),ke=g.useCallback(()=>{const se=t[t.length-1],le=f?.newestLogId??se?.id??null;le!==null&&k({kind:"newer",afterLogId:le})},[t,k,f]),pe=g.useMemo(()=>{if(e!==void 0)return{isLoading:p,total:f?.total??null,pageSize:f?.limit??Jx,hasOlder:f?.hasOlder??!1,hasNewer:f?.hasNewer??!1,oldestLogId:f?.oldestLogId??null,newestLogId:f?.newestLogId??null,onOldest:R,onOlder:de,onNewer:ke,onNewest:ae}},[e,ae,ke,de,R,f,p]);return s.jsxs(s.Fragment,{children:[l!==null&&s.jsx("div",{className:"fixed top-4 right-4 bg-destructive text-destructive-foreground px-4 py-2 rounded-md text-sm z-50",children:l}),s.jsx(Qk,{}),s.jsx(I6,{logs:A,sessions:z,models:L,selectedSession:r,selectedModel:i,onSessionChange:o,onModelChange:a,onClearAll:D,onClearGroup:q,onImportLogs:e===void 0?W:void 0,isLoading:e===void 0?!u:p,pagination:pe,sessionMemberships:m,viewMode:Z,captureMode:J,strip:B,slowResponseThresholdSeconds:I,timeDisplayFormat:K,hideSessionFilter:e!==void 0,pinnedSessionId:e})]})}export{kp as $,te as A,He as B,Iw as C,ho as D,ge as E,$a as F,We as G,T as H,Qr as I,$z as J,qM as K,nk as L,ck as M,sM as N,oM as O,Z6 as P,Wp as Q,kk as R,cM as S,wg as T,q6 as U,gt as V,ze as W,kl as X,Sd as Y,mT as Z,V6 as _,UE as a,gT as a0,Bz as a1,wl as a2,pc as a3,ks as a4,to as a5,Pn as a6,cS as a7,Tt as a8,me as b,xe as c,ia as d,jp as e,Ve as f,hg as g,Ft as h,tt as i,St as j,$t as k,mo as l,go as m,xo as n,yk as o,kg as p,Ct as q,Bn as r,jt as s,Ne as t,Vp as u,ot as v,$e as w,Be as x,Ue as y,re as z};