@tonyclaw/llm-inspector 1.18.1 → 1.18.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/assets/{CompareDrawer-CAhlM_Gq.js → CompareDrawer-C-4ypEWs.js} +1 -1
- package/.output/public/assets/ProxyViewerContainer-WRenRpeh.js +101 -0
- package/.output/public/assets/{ReplayDialog-Bqu2f5HE.js → ReplayDialog-CyBKOgba.js} +1 -1
- package/.output/public/assets/{RequestAnatomy-CpVNH0CD.js → RequestAnatomy-C0IrVQ3q.js} +1 -1
- package/.output/public/assets/{ResponseView-B_Gg37Lr.js → ResponseView-MogToC4i.js} +1 -1
- package/.output/public/assets/{StreamingChunkSequence-E2M_SS1A.js → StreamingChunkSequence-ClhUhT-s.js} +1 -1
- package/.output/public/assets/_sessionId-BO47oA3Z.js +1 -0
- package/.output/public/assets/index-BRvz6-L6.css +1 -0
- package/.output/public/assets/index-Btw8ec7-.js +1 -0
- package/.output/public/assets/{json-viewer-DqhA-ODG.js → json-viewer-BicGakI5.js} +1 -1
- package/.output/public/assets/{main-DpH7JlHv.js → main-Be2qqUUW.js} +7 -7
- package/.output/server/_libs/lucide-react.mjs +20 -14
- package/.output/server/{_sessionId-DcJ0RDNl.mjs → _sessionId-DhKJIdQC.mjs} +3 -3
- package/.output/server/_ssr/{CompareDrawer-DajC3x7u.mjs → CompareDrawer-BGUgukJ8.mjs} +5 -5
- package/.output/server/_ssr/{ProxyViewerContainer-C2dnFXoC.mjs → ProxyViewerContainer--3K3o3Sm.mjs} +212 -74
- package/.output/server/_ssr/{ReplayDialog-BnCLuA5z.mjs → ReplayDialog-Bo86xZI4.mjs} +5 -5
- package/.output/server/_ssr/{RequestAnatomy-OHE3iT-f.mjs → RequestAnatomy-jRU5qgwB.mjs} +4 -4
- package/.output/server/_ssr/{ResponseView-NPshHwOv.mjs → ResponseView-DdO_-79a.mjs} +5 -5
- package/.output/server/_ssr/{StreamingChunkSequence-BfukoR7F.mjs → StreamingChunkSequence-BigLwhh4.mjs} +5 -5
- package/.output/server/_ssr/{index-CF8M0tsv.mjs → index-BHG6vOnr.mjs} +3 -3
- package/.output/server/_ssr/index.mjs +2 -2
- package/.output/server/_ssr/{json-viewer-CHBa-Oas.mjs → json-viewer-B4c_WjXD.mjs} +4 -4
- package/.output/server/_ssr/{router-B5hOtKSn.mjs → router-DVixpJO-.mjs} +32 -17
- package/.output/server/{_tanstack-start-manifest_v-CFyWvIH6.mjs → _tanstack-start-manifest_v-BbvWUF4v.mjs} +1 -1
- package/.output/server/index.mjs +63 -63
- package/README.md +109 -59
- package/package.json +1 -1
- package/src/assets/logos/mcp.png +0 -0
- package/src/components/ProxyViewer.tsx +203 -53
- package/src/components/ProxyViewerContainer.tsx +24 -9
- package/src/components/proxy-viewer/ConversationHeader.tsx +7 -22
- package/src/components/ui/mcp-logo.tsx +20 -0
- package/src/lib/sessionUrl.ts +44 -0
- package/src/routes/session/$sessionId.tsx +5 -57
- package/.output/public/assets/ProxyViewerContainer--miVHNPZ.js +0 -101
- package/.output/public/assets/_sessionId-P9LgC1bF.js +0 -1
- package/.output/public/assets/index-C0wv3YP9.css +0 -1
- package/.output/public/assets/index-kboKku6a.js +0 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CompareDrawer-C-4ypEWs.js","assets/main-Be2qqUUW.js","assets/json-viewer-BicGakI5.js","assets/ReplayDialog-CyBKOgba.js","assets/ResponseView-MogToC4i.js","assets/RequestAnatomy-C0IrVQ3q.js","assets/StreamingChunkSequence-ClhUhT-s.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as Uo,a as ha,r as y,j as a,c as Un,g as Xu,b as Rn,d as We,e as pa,f as Qu,h as ed,_ as Dt}from"./main-Be2qqUUW.js";function G(e,t,n){function r(l,c){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,c);const u=i.prototype,d=Object.keys(u);for(let f=0;f<d.length;f++){const m=d[f];m in l||(l[m]=u[m].bind(l))}}const o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(l){var c;const u=n?.Parent?new s:this;r(u,l),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:l=>n?.Parent&&l instanceof n.Parent?!0:l?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Xt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ma extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const ga={};function bt(e){return ga}function xa(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 po(e,t){return typeof t=="bigint"?t.toString():t}function Cr(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Zo(e){return e==null}function Wo(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function td(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}const s=n>o?n:o,i=Number.parseInt(e.toFixed(s).replace(".","")),l=Number.parseInt(t.toFixed(s).replace(".",""));return i%l/10**s}const zs=Symbol("evaluating");function _e(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==zs)return r===void 0&&(r=zs,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Lt(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function St(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Os(e){return JSON.stringify(e)}function nd(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const va="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Nn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const rd=Cr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function nn(e){if(Nn(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Nn(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function ya(e){return nn(e)?{...e}:Array.isArray(e)?[...e]:e}const od=new Set(["string","number","symbol"]);function rn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function jt(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function de(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 sd(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const id={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 ad(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=St(e._zod.def,{get shape(){const i={};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&(i[l]=n.shape[l])}return Lt(this,"shape",i),i},checks:[]});return jt(e,s)}function ld(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=St(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&delete i[l]}return Lt(this,"shape",i),i},checks:[]});return jt(e,s)}function cd(e,t){if(!nn(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=St(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return Lt(this,"shape",s),s}});return jt(e,o)}function ud(e,t){if(!nn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=St(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Lt(this,"shape",r),r}});return jt(e,n)}function dd(e,t){const n=St(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Lt(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return jt(e,n)}function fd(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 i=St(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 Lt(this,"shape",c),c},checks:[]});return jt(t,i)}function hd(e,t,n){const r=St(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const i in n){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return Lt(this,"shape",s),s}});return jt(t,r)}function Gt(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 Yt(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Zn(e){return typeof e=="string"?e:e?.message}function wt(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=Zn(e.inst?._zod.def?.error?.(e))??Zn(t?.error?.(e))??Zn(n.customError?.(e))??Zn(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Vo(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Tn(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const ba=(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,po,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},wa=G("$ZodError",ba),_a=G("$ZodError",ba,{Parent:Error});function pd(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 md(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>r({issues:i}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let i=n,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s))):i[c]=i[c]||{_errors:[]},i=i[c],l++}}};return r(e),n}const Ho=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new Xt;if(i.issues.length){const l=new(o?.Err??e)(i.issues.map(c=>wt(c,s,bt())));throw va(l,o?.callee),l}return i.value},qo=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const l=new(o?.Err??e)(i.issues.map(c=>wt(c,s,bt())));throw va(l,o?.callee),l}return i.value},Sr=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new Xt;return s.issues.length?{success:!1,error:new(e??wa)(s.issues.map(i=>wt(i,o,bt())))}:{success:!0,data:s.value}},gd=Sr(_a),jr=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>wt(i,o,bt())))}:{success:!0,data:s.value}},xd=jr(_a),vd=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ho(e)(t,n,o)},yd=e=>(t,n,r)=>Ho(e)(t,n,r),bd=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return qo(e)(t,n,o)},wd=e=>async(t,n,r)=>qo(e)(t,n,r),_d=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Sr(e)(t,n,o)},kd=e=>(t,n,r)=>Sr(e)(t,n,r),Cd=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return jr(e)(t,n,o)},Sd=e=>async(t,n,r)=>jr(e)(t,n,r),jd=/^[cC][^\s-]{8,}$/,Ed=/^[0-9a-z]+$/,Nd=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Td=/^[0-9a-vA-V]{20}$/,Ad=/^[A-Za-z0-9]{27}$/,zd=/^[a-zA-Z0-9_-]{21}$/,Od=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Id=/^([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})$/,Is=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)$/,Rd=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Pd="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Md(){return new RegExp(Pd,"u")}const Dd=/^(?:(?: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])$/,Ld=/^(([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}|:))$/,Fd=/^((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])$/,$d=/^(([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])$/,Bd=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ka=/^[A-Za-z0-9_-]*$/,Ud=/^\+[1-9]\d{6,14}$/,Ca="(?:(?:\\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])))",Zd=new RegExp(`^${Ca}$`);function Sa(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 Wd(e){return new RegExp(`^${Sa(e)}$`)}function Vd(e){const t=Sa({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(`^${Ca}T(?:${r})$`)}const Hd=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},qd=/^-?\d+$/,ja=/^-?\d+(?:\.\d+)?$/,Jd=/^(?:true|false)$/i,Kd=/^null$/i,Gd=/^[^A-Z]*$/,Yd=/^[^a-z]*$/,He=G("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ea={number:"number",bigint:"bigint",object:"date"},Na=G("$ZodCheckLessThan",(e,t)=>{He.init(e,t);const n=Ea[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ta=G("$ZodCheckGreaterThan",(e,t)=>{He.init(e,t);const n=Ea[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Xd=G("$ZodCheckMultipleOf",(e,t)=>{He.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):td(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})}}),Qd=G("$ZodCheckNumberFormat",(e,t)=>{He.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,s]=id[t.format];e._zod.onattach.push(i=>{const l=i._zod.bag;l.format=t.format,l.minimum=o,l.maximum=s,n&&(l.pattern=qd)}),e._zod.check=i=>{const l=i.value;if(n){if(!Number.isInteger(l)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?i.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}):i.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&&i.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>s&&i.issues.push({origin:"number",input:l,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),ef=G("$ZodCheckMaxLength",(e,t)=>{var n;He.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Zo(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 i=Vo(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),tf=G("$ZodCheckMinLength",(e,t)=>{var n;He.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Zo(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 i=Vo(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),nf=G("$ZodCheckLengthEquals",(e,t)=>{var n;He.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Zo(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const i=Vo(o),l=s>t.length;r.issues.push({origin:i,...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})}}),Er=G("$ZodCheckStringFormat",(e,t)=>{var n,r;He.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),rf=G("$ZodCheckRegex",(e,t)=>{Er.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})}}),of=G("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Gd),Er.init(e,t)}),sf=G("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Yd),Er.init(e,t)}),af=G("$ZodCheckIncludes",(e,t)=>{He.init(e,t);const n=rn(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),lf=G("$ZodCheckStartsWith",(e,t)=>{He.init(e,t);const n=new RegExp(`^${rn(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})}}),cf=G("$ZodCheckEndsWith",(e,t)=>{He.init(e,t);const n=new RegExp(`.*${rn(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})}}),uf=G("$ZodCheckOverwrite",(e,t)=>{He.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class df{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(i=>i),o=Math.min(...r.map(i=>i.length-i.trimStart().length)),s=r.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,n=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...n,o.join(`
|
|
4
|
+
`))}}const ff={major:4,minor:3,patch:6},ze=G("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ff;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const s of o._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(i,l,c)=>{let u=Gt(i),d;for(const f of l){if(f._zod.def.when){if(!f._zod.def.when(i))continue}else if(u)continue;const m=i.issues.length,p=f._zod.check(i);if(p instanceof Promise&&c?.async===!1)throw new Xt;if(d||p instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await p,i.issues.length!==m&&(u||(u=Gt(i,m)))});else{if(i.issues.length===m)continue;u||(u=Gt(i,m))}}return d?d.then(()=>i):i},s=(i,l,c)=>{if(Gt(i))return i.aborted=!0,i;const u=o(l,r,c);if(u instanceof Promise){if(c.async===!1)throw new Xt;return u.then(d=>e._zod.parse(d,c))}return e._zod.parse(u,c)};e._zod.run=(i,l)=>{if(l.skipChecks)return e._zod.parse(i,l);if(l.direction==="backward"){const u=e._zod.parse({value:i.value,issues:[]},{...l,skipChecks:!0});return u instanceof Promise?u.then(d=>s(d,i,l)):s(u,i,l)}const c=e._zod.parse(i,l);if(c instanceof Promise){if(l.async===!1)throw new Xt;return c.then(u=>o(u,r,l))}return o(c,r,l)}}_e(e,"~standard",()=>({validate:o=>{try{const s=gd(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return xd(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Jo=G("$ZodString",(e,t)=>{ze.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Hd(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}}),Re=G("$ZodStringFormat",(e,t)=>{Er.init(e,t),Jo.init(e,t)}),hf=G("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Id),Re.init(e,t)}),pf=G("$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=Is(r))}else t.pattern??(t.pattern=Is());Re.init(e,t)}),mf=G("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Rd),Re.init(e,t)}),gf=G("$ZodURL",(e,t)=>{Re.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})}}}),xf=G("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Md()),Re.init(e,t)}),vf=G("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=zd),Re.init(e,t)}),yf=G("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=jd),Re.init(e,t)}),bf=G("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ed),Re.init(e,t)}),wf=G("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Nd),Re.init(e,t)}),_f=G("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Td),Re.init(e,t)}),kf=G("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ad),Re.init(e,t)}),Cf=G("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Vd(t)),Re.init(e,t)}),Sf=G("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Zd),Re.init(e,t)}),jf=G("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Wd(t)),Re.init(e,t)}),Ef=G("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Od),Re.init(e,t)}),Nf=G("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Dd),Re.init(e,t),e._zod.bag.format="ipv4"}),Tf=G("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ld),Re.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})}}}),Af=G("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Fd),Re.init(e,t)}),zf=G("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=$d),Re.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,s]=r;if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>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 Aa(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Of=G("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Bd),Re.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Aa(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function If(e){if(!ka.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Aa(n)}const Rf=G("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ka),Re.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{If(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Pf=G("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ud),Re.init(e,t)});function Mf(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 Df=G("$ZodJWT",(e,t)=>{Re.init(e,t),e._zod.check=n=>{Mf(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),za=G("$ZodNumber",(e,t)=>{ze.init(e,t),e._zod.pattern=e._zod.bag.pattern??ja,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),Lf=G("$ZodNumberFormat",(e,t)=>{Qd.init(e,t),za.init(e,t)}),Ff=G("$ZodBoolean",(e,t)=>{ze.init(e,t),e._zod.pattern=Jd,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}}),$f=G("$ZodNull",(e,t)=>{ze.init(e,t),e._zod.pattern=Kd,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}}),Bf=G("$ZodUnknown",(e,t)=>{ze.init(e,t),e._zod.parse=n=>n}),Uf=G("$ZodNever",(e,t)=>{ze.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Rs(e,t,n){e.issues.length&&t.issues.push(...Yt(n,e.issues)),t.value[n]=e.value}const Zf=G("$ZodArray",(e,t)=>{ze.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const s=[];for(let i=0;i<o.length;i++){const l=o[i],c=t.element._zod.run({value:l,issues:[]},r);c instanceof Promise?s.push(c.then(u=>Rs(u,n,i))):Rs(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function cr(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Yt(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Oa(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=sd(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Ia(e,t,n,r,o,s){const i=[],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"){i.push(f);continue}const m=c.run({value:t[f],issues:[]},r);m instanceof Promise?e.push(m.then(p=>cr(p,n,f,t,d))):cr(m,n,f,t,d)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const Wf=G("$ZodObject",(e,t)=>{if(ze.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=Cr(()=>Oa(t));_e(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=Nn,s=t.catchall;let i;e._zod.parse=(l,c)=>{i??(i=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=i.shape;for(const m of i.keys){const p=f[m],g=p._zod.optout==="optional",h=p._zod.run({value:u[m],issues:[]},c);h instanceof Promise?d.push(h.then(x=>cr(x,l,m,u,g))):cr(h,l,m,u,g)}return s?Ia(d,u,l,c,r.value,e):d.length?Promise.all(d).then(()=>l):l}}),Vf=G("$ZodObjectJIT",(e,t)=>{Wf.init(e,t);const n=e._zod.parse,r=Cr(()=>Oa(t)),o=m=>{const p=new df(["shape","payload","ctx"]),g=r.value,h=k=>{const C=Os(k);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};p.write("const input = payload.value;");const x=Object.create(null);let v=0;for(const k of g.keys)x[k]=`key_${v++}`;p.write("const newResult = {};");for(const k of g.keys){const C=x[k],j=Os(k),E=m[k]?._zod?.optout==="optional";p.write(`const ${C} = ${h(k)};`),E?p.write(`
|
|
5
|
+
if (${C}.issues.length) {
|
|
6
|
+
if (${j} in input) {
|
|
7
|
+
payload.issues = payload.issues.concat(${C}.issues.map(iss => ({
|
|
8
|
+
...iss,
|
|
9
|
+
path: iss.path ? [${j}, ...iss.path] : [${j}]
|
|
10
|
+
})));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (${C}.value === undefined) {
|
|
15
|
+
if (${j} in input) {
|
|
16
|
+
newResult[${j}] = undefined;
|
|
17
|
+
}
|
|
18
|
+
} else {
|
|
19
|
+
newResult[${j}] = ${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 ? [${j}, ...iss.path] : [${j}]
|
|
27
|
+
})));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (${C}.value === undefined) {
|
|
31
|
+
if (${j} in input) {
|
|
32
|
+
newResult[${j}] = undefined;
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
newResult[${j}] = ${C}.value;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
`)}p.write("payload.value = newResult;"),p.write("return payload;");const _=p.compile();return(k,C)=>_(m,k,C)};let s;const i=Nn,l=!ga.jitless,u=l&&rd.value,d=t.catchall;let f;e._zod.parse=(m,p)=>{f??(f=r.value);const g=m.value;return i(g)?l&&u&&p?.async===!1&&p.jitless!==!0?(s||(s=o(t.shape)),m=s(m,p),d?Ia([],g,m,p,f,e):m):n(m,p):(m.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),m)}});function Ps(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!Gt(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(i=>wt(i,r,bt())))}),t)}const Ra=G("$ZodUnion",(e,t)=>{ze.init(e,t),_e(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),_e(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),_e(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),_e(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>Wo(s.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(n)return r(o,s);let i=!1;const l=[];for(const c of t.options){const u=c._zod.run({value:o.value,issues:[]},s);if(u instanceof Promise)l.push(u),i=!0;else{if(u.issues.length===0)return u;l.push(u)}}return i?Promise.all(l).then(c=>Ps(c,o,e,s)):Ps(l,o,e,s)}}),Hf=G("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ra.init(e,t);const n=e._zod.parse;_e(e._zod,"propValues",()=>{const o={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[l,c]of Object.entries(i)){o[l]||(o[l]=new Set);for(const u of c)o[l].add(u)}}return o});const r=Cr(()=>{const o=t.options,s=new Map;for(const i of o){const l=i._zod.propValues?.[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const c of l){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(o,s)=>{const i=o.value;if(!Nn(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;const l=r.value.get(i?.[t.discriminator]);return l?l._zod.run(o,s):t.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),o)}}),qf=G("$ZodIntersection",(e,t)=>{ze.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),i=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>Ms(n,c,u)):Ms(n,s,i)}});function mo(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(nn(e)&&nn(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of r){const i=mo(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r],i=mo(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ms(e,t,n){const r=new Map;let o;for(const l of t.issues)if(l.code==="unrecognized_keys"){o??(o=l);for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(l);for(const l of n.issues)if(l.code==="unrecognized_keys")for(const c of l.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(l);const s=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(s.length&&o&&e.issues.push({...o,keys:s}),Gt(e))return e;const i=mo(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Jf=G("$ZodRecord",(e,t)=>{ze.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!nn(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[],i=t.keyType._zod.values;if(i){n.value={};const l=new Set;for(const u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){l.add(typeof u=="number"?u.toString():u);const d=t.valueType._zod.run({value:o[u],issues:[]},r);d instanceof Promise?s.push(d.then(f=>{f.issues.length&&n.issues.push(...Yt(u,f.issues)),n.value[u]=f.value})):(d.issues.length&&n.issues.push(...Yt(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"&&ja.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=>wt(f,r,bt())),input:l,path:[l],inst:e});continue}const d=t.valueType._zod.run({value:o[l],issues:[]},r);d instanceof Promise?s.push(d.then(f=>{f.issues.length&&n.issues.push(...Yt(l,f.issues)),n.value[c.value]=f.value})):(d.issues.length&&n.issues.push(...Yt(l,d.issues)),n.value[c.value]=d.value)}}return s.length?Promise.all(s).then(()=>n):n}}),Kf=G("$ZodEnum",(e,t)=>{ze.init(e,t);const n=xa(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>od.has(typeof o)).map(o=>typeof o=="string"?rn(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:n,input:i,inst:e}),o}}),Gf=G("$ZodLiteral",(e,t)=>{if(ze.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"?rn(r):r?rn(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),Yf=G("$ZodTransform",(e,t)=>{ze.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ma(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(n.value=i,n));if(o instanceof Promise)throw new Xt;return n.value=o,n}});function Ds(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Pa=G("$ZodOptional",(e,t)=>{ze.init(e,t),e._zod.optin="optional",e._zod.optout="optional",_e(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),_e(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Wo(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Ds(s,n.value)):Ds(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Xf=G("$ZodExactOptional",(e,t)=>{Pa.init(e,t),_e(e._zod,"values",()=>t.innerType._zod.values),_e(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Qf=G("$ZodNullable",(e,t)=>{ze.init(e,t),_e(e._zod,"optin",()=>t.innerType._zod.optin),_e(e._zod,"optout",()=>t.innerType._zod.optout),_e(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Wo(n.source)}|null)$`):void 0}),_e(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)}),eh=G("$ZodDefault",(e,t)=>{ze.init(e,t),e._zod.optin="optional",_e(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Ls(s,t)):Ls(o,t)}});function Ls(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const th=G("$ZodPrefault",(e,t)=>{ze.init(e,t),e._zod.optin="optional",_e(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))}),nh=G("$ZodNonOptional",(e,t)=>{ze.init(e,t),_e(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Fs(s,e)):Fs(o,e)}});function Fs(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 rh=G("$ZodCatch",(e,t)=>{ze.init(e,t),_e(e._zod,"optin",()=>t.innerType._zod.optin),_e(e._zod,"optout",()=>t.innerType._zod.optout),_e(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>wt(i,r,bt()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>wt(s,r,bt()))},input:n.value}),n.issues=[]),n)}}),oh=G("$ZodPipe",(e,t)=>{ze.init(e,t),_e(e._zod,"values",()=>t.in._zod.values),_e(e._zod,"optin",()=>t.in._zod.optin),_e(e._zod,"optout",()=>t.out._zod.optout),_e(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(i=>Wn(i,t.in,r)):Wn(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>Wn(s,t.out,r)):Wn(o,t.out,r)}});function Wn(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const sh=G("$ZodReadonly",(e,t)=>{ze.init(e,t),_e(e._zod,"propValues",()=>t.innerType._zod.propValues),_e(e._zod,"values",()=>t.innerType._zod.values),_e(e._zod,"optin",()=>t.innerType?._zod?.optin),_e(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($s):$s(o)}});function $s(e){return e.value=Object.freeze(e.value),e}const ih=G("$ZodLazy",(e,t)=>{ze.init(e,t),_e(e._zod,"innerType",()=>t.getter()),_e(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),_e(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),_e(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),_e(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),ah=G("$ZodCustom",(e,t)=>{He.init(e,t),ze.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>Bs(s,n,r,e));Bs(o,n,r,e)}});function Bs(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(Tn(o))}}var Us;class lh{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 ch(){return new lh}(Us=globalThis).__zod_globalRegistry??(Us.__zod_globalRegistry=ch());const jn=globalThis.__zod_globalRegistry;function uh(e,t){return new e({type:"string",...de(t)})}function dh(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...de(t)})}function Zs(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...de(t)})}function fh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...de(t)})}function hh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...de(t)})}function ph(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...de(t)})}function mh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...de(t)})}function gh(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...de(t)})}function xh(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...de(t)})}function vh(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...de(t)})}function yh(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...de(t)})}function bh(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...de(t)})}function wh(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...de(t)})}function _h(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...de(t)})}function kh(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...de(t)})}function Ch(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...de(t)})}function Sh(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...de(t)})}function jh(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...de(t)})}function Eh(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...de(t)})}function Nh(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...de(t)})}function Th(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...de(t)})}function Ah(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...de(t)})}function zh(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...de(t)})}function Oh(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...de(t)})}function Ih(e,t){return new e({type:"string",format:"date",check:"string_format",...de(t)})}function Rh(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...de(t)})}function Ph(e,t){return new e({type:"string",format:"duration",check:"string_format",...de(t)})}function Mh(e,t){return new e({type:"number",checks:[],...de(t)})}function Dh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...de(t)})}function Lh(e,t){return new e({type:"boolean",...de(t)})}function Fh(e,t){return new e({type:"null",...de(t)})}function $h(e){return new e({type:"unknown"})}function Bh(e,t){return new e({type:"never",...de(t)})}function Ws(e,t){return new Na({check:"less_than",...de(t),value:e,inclusive:!1})}function Vr(e,t){return new Na({check:"less_than",...de(t),value:e,inclusive:!0})}function Vs(e,t){return new Ta({check:"greater_than",...de(t),value:e,inclusive:!1})}function Hr(e,t){return new Ta({check:"greater_than",...de(t),value:e,inclusive:!0})}function Hs(e,t){return new Xd({check:"multiple_of",...de(t),value:e})}function Ma(e,t){return new ef({check:"max_length",...de(t),maximum:e})}function ur(e,t){return new tf({check:"min_length",...de(t),minimum:e})}function Da(e,t){return new nf({check:"length_equals",...de(t),length:e})}function Uh(e,t){return new rf({check:"string_format",format:"regex",...de(t),pattern:e})}function Zh(e){return new of({check:"string_format",format:"lowercase",...de(e)})}function Wh(e){return new sf({check:"string_format",format:"uppercase",...de(e)})}function Vh(e,t){return new af({check:"string_format",format:"includes",...de(t),includes:e})}function Hh(e,t){return new lf({check:"string_format",format:"starts_with",...de(t),prefix:e})}function qh(e,t){return new cf({check:"string_format",format:"ends_with",...de(t),suffix:e})}function dn(e){return new uf({check:"overwrite",tx:e})}function Jh(e){return dn(t=>t.normalize(e))}function Kh(){return dn(e=>e.trim())}function Gh(){return dn(e=>e.toLowerCase())}function Yh(){return dn(e=>e.toUpperCase())}function Xh(){return dn(e=>nd(e))}function Qh(e,t,n){return new e({type:"array",element:t,...de(n)})}function ep(e,t,n){return new e({type:"custom",check:"custom",fn:t,...de(n)})}function tp(e){const t=np(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Tn(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(Tn(o))}},e(n.value,n)));return t}function np(e,t){const n=new He({check:"custom",...de(t)});return n._zod.check=e,n}function La(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??jn,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 Le(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const l=e._zod.toJSONSchema?.();if(l)i.schema=l;else{const d={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,d);else{const m=i.schema,p=t.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(e,t,m,d)}const f=e._zod.parent;f&&(i.ref||(i.ref=f),Le(f,t,d),t.seen.get(f).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&Ze(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&i.schema._prefault&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Fa(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 i of e.seen.entries()){const l=e.metadataRegistry.get(i[0])?.id;if(l){const c=r.get(l);if(c&&c!==i[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,i[0])}}const o=i=>{const l=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const f=e.external.registry.get(i[0])?.id,m=e.external.uri??(g=>g);if(f)return{ref:m(f)};const p=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=p,{defId:p,ref:`${m("__shared")}#/${l}/${p}`}}if(i[1]===n)return{ref:"#"};const u=`#/${l}/`,d=i[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},s=i=>{if(i[1].schema.$ref)return;const l=i[1],{ref:c,defId:u}=o(i);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 i of e.seen.entries()){const l=i[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 i of e.seen.entries()){const l=i[1];if(t===i[0]){s(i);continue}if(e.external){const u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(l.cycle){s(i);continue}if(l.count>1&&e.reused==="ref"){s(i);continue}}}function $a(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=i=>{const l=e.seen.get(i);if(l.ref===null)return;const c=l.def??l.schema,u={...c},d=l.ref;if(l.ref=null,d){r(d);const m=e.seen.get(d),p=m.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),i._zod.parent===d)for(const h in c)h==="$ref"||h==="allOf"||h in u||delete c[h];if(p.$ref&&m.def)for(const h in c)h==="$ref"||h==="allOf"||h in m.def&&JSON.stringify(c[h])===JSON.stringify(m.def[h])&&delete c[h]}const f=i._zod.parent;if(f&&f!==d){r(f);const m=e.seen.get(f);if(m?.schema.$ref&&(c.$ref=m.schema.$ref,m.def))for(const p in c)p==="$ref"||p==="allOf"||p in m.def&&JSON.stringify(c[p])===JSON.stringify(m.def[p])&&delete c[p]}e.override({zodSchema:i,jsonSchema:c,path:l.path??[]})};for(const i of[...e.seen.entries()].reverse())r(i[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 i=e.external.registry.get(t)?.id;if(!i)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(i)}Object.assign(o,n.def??n.schema);const s=e.external?.defs??{};for(const i of e.seen.entries()){const l=i[1];l.def&&l.defId&&(s[l.defId]=l.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const i=JSON.parse(JSON.stringify(o));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:dr(t,"input",e.processors),output:dr(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function Ze(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 Ze(r.element,n);if(r.type==="set")return Ze(r.valueType,n);if(r.type==="lazy")return Ze(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 Ze(r.innerType,n);if(r.type==="intersection")return Ze(r.left,n)||Ze(r.right,n);if(r.type==="record"||r.type==="map")return Ze(r.keyType,n)||Ze(r.valueType,n);if(r.type==="pipe")return Ze(r.in,n)||Ze(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Ze(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Ze(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Ze(o,n))return!0;return!!(r.rest&&Ze(r.rest,n))}return!1}const rp=(e,t={})=>n=>{const r=La({...n,processors:t});return Le(e,r),Fa(r,e),$a(r,e)},dr=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=La({...o??{},target:s,io:t,processors:n});return Le(e,i),Fa(i,e),$a(i,e)},op={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},sp=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:i,format:l,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),l&&(o.format=op[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}))])}},ip=(e,t,n,r)=>{const o=n,{minimum:s,maximum:i,format:l,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;typeof l=="string"&&l.includes("int")?o.type="integer":o.type="number",typeof d=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=d,o.exclusiveMinimum=!0):o.exclusiveMinimum=d),typeof s=="number"&&(o.minimum=s,typeof d=="number"&&t.target!=="draft-04"&&(d>=s?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof i=="number"&&(o.maximum=i,typeof u=="number"&&t.target!=="draft-04"&&(u<=i?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},ap=(e,t,n,r)=>{n.type="boolean"},lp=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},cp=(e,t,n,r)=>{n.not={}},up=(e,t,n,r)=>{},dp=(e,t,n,r)=>{const o=e._zod.def,s=xa(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},fp=(e,t,n,r)=>{const o=e._zod.def,s=[];for(const i of o.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){const i=s[0];n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[i]:n.const=i}else s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),s.every(i=>typeof i=="boolean")&&(n.type="boolean"),s.every(i=>i===null)&&(n.type="null"),n.enum=s},hp=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},pp=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},mp=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:i,maximum:l}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof l=="number"&&(o.maxItems=l),o.type="array",o.items=Le(s.element,t,{...r,path:[...r.path,"items"]})},gp=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object",o.properties={};const i=s.shape;for(const u in i)o.properties[u]=Le(i[u],t,{...r,path:[...r.path,"properties",u]});const l=new Set(Object.keys(i)),c=new Set([...l].filter(u=>{const d=s.shape[u]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));c.size>0&&(o.required=Array.from(c)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=Le(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},xp=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((l,c)=>Le(l,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},vp=(e,t,n,r)=>{const o=e._zod.def,s=Le(o.left,t,{...r,path:[...r.path,"allOf",0]}),i=Le(o.right,t,{...r,path:[...r.path,"allOf",1]}),l=u=>"allOf"in u&&Object.keys(u).length===1,c=[...l(s)?s.allOf:[s],...l(i)?i.allOf:[i]];n.allOf=c},yp=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object";const i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){const d=Le(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const f of c)o.patternProperties[f.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Le(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Le(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=i._zod.values;if(u){const d=[...u].filter(f=>typeof f=="string"||typeof f=="number");d.length>0&&(o.required=d)}},bp=(e,t,n,r)=>{const o=e._zod.def,s=Le(o.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},wp=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},_p=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},kp=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Cp=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},Sp=(e,t,n,r)=>{const o=e._zod.def,s=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Le(s,t,r);const i=t.seen.get(e);i.ref=s},jp=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},Ba=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Ep=(e,t,n,r)=>{const o=e._zod.innerType;Le(o,t,r);const s=t.seen.get(e);s.ref=o},Np=G("ZodISODateTime",(e,t)=>{Cf.init(e,t),Pe.init(e,t)});function Tp(e){return Oh(Np,e)}const Ap=G("ZodISODate",(e,t)=>{Sf.init(e,t),Pe.init(e,t)});function zp(e){return Ih(Ap,e)}const Op=G("ZodISOTime",(e,t)=>{jf.init(e,t),Pe.init(e,t)});function Ip(e){return Rh(Op,e)}const Rp=G("ZodISODuration",(e,t)=>{Ef.init(e,t),Pe.init(e,t)});function Pp(e){return Ph(Rp,e)}const Mp=(e,t)=>{wa.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>md(e,n)},flatten:{value:n=>pd(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,po,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,po,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ye=G("ZodError",Mp,{Parent:Error}),Dp=Ho(Ye),Lp=qo(Ye),Fp=Sr(Ye),$p=jr(Ye),Bp=vd(Ye),Up=yd(Ye),Zp=bd(Ye),Wp=wd(Ye),Vp=_d(Ye),Hp=kd(Ye),qp=Cd(Ye),Jp=Sd(Ye),Oe=G("ZodType",(e,t)=>(ze.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:dr(e,"input"),output:dr(e,"output")}}),e.toJSONSchema=rp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(St(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)=>jt(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>Dp(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Fp(e,n,r),e.parseAsync=async(n,r)=>Lp(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>$p(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Bp(e,n,r),e.decode=(n,r)=>Up(e,n,r),e.encodeAsync=async(n,r)=>Zp(e,n,r),e.decodeAsync=async(n,r)=>Wp(e,n,r),e.safeEncode=(n,r)=>Vp(e,n,r),e.safeDecode=(n,r)=>Hp(e,n,r),e.safeEncodeAsync=async(n,r)=>qp(e,n,r),e.safeDecodeAsync=async(n,r)=>Jp(e,n,r),e.refine=(n,r)=>e.check(Wm(n,r)),e.superRefine=n=>e.check(Vm(n)),e.overwrite=n=>e.check(dn(n)),e.optional=()=>Gs(e),e.exactOptional=()=>Tm(e),e.nullable=()=>Ys(e),e.nullish=()=>Gs(Ys(e)),e.nonoptional=n=>Pm(e,n),e.array=()=>Ne(e),e.or=n=>xt([e,n]),e.and=n=>km(e,n),e.transform=n=>Xs(e,Em(n)),e.default=n=>Om(e,n),e.prefault=n=>Rm(e,n),e.catch=n=>Dm(e,n),e.pipe=n=>Xs(e,n),e.readonly=()=>$m(e),e.describe=n=>{const r=e.clone();return jn.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return jn.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return jn.get(e);const r=e.clone();return jn.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Ua=G("_ZodString",(e,t)=>{Jo.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>sp(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(Uh(...r)),e.includes=(...r)=>e.check(Vh(...r)),e.startsWith=(...r)=>e.check(Hh(...r)),e.endsWith=(...r)=>e.check(qh(...r)),e.min=(...r)=>e.check(ur(...r)),e.max=(...r)=>e.check(Ma(...r)),e.length=(...r)=>e.check(Da(...r)),e.nonempty=(...r)=>e.check(ur(1,...r)),e.lowercase=r=>e.check(Zh(r)),e.uppercase=r=>e.check(Wh(r)),e.trim=()=>e.check(Kh()),e.normalize=(...r)=>e.check(Jh(...r)),e.toLowerCase=()=>e.check(Gh()),e.toUpperCase=()=>e.check(Yh()),e.slugify=()=>e.check(Xh())}),Kp=G("ZodString",(e,t)=>{Jo.init(e,t),Ua.init(e,t),e.email=n=>e.check(dh(Gp,n)),e.url=n=>e.check(gh(Yp,n)),e.jwt=n=>e.check(zh(fm,n)),e.emoji=n=>e.check(xh(Xp,n)),e.guid=n=>e.check(Zs(qs,n)),e.uuid=n=>e.check(fh(Vn,n)),e.uuidv4=n=>e.check(hh(Vn,n)),e.uuidv6=n=>e.check(ph(Vn,n)),e.uuidv7=n=>e.check(mh(Vn,n)),e.nanoid=n=>e.check(vh(Qp,n)),e.guid=n=>e.check(Zs(qs,n)),e.cuid=n=>e.check(yh(em,n)),e.cuid2=n=>e.check(bh(tm,n)),e.ulid=n=>e.check(wh(nm,n)),e.base64=n=>e.check(Nh(cm,n)),e.base64url=n=>e.check(Th(um,n)),e.xid=n=>e.check(_h(rm,n)),e.ksuid=n=>e.check(kh(om,n)),e.ipv4=n=>e.check(Ch(sm,n)),e.ipv6=n=>e.check(Sh(im,n)),e.cidrv4=n=>e.check(jh(am,n)),e.cidrv6=n=>e.check(Eh(lm,n)),e.e164=n=>e.check(Ah(dm,n)),e.datetime=n=>e.check(Tp(n)),e.date=n=>e.check(zp(n)),e.time=n=>e.check(Ip(n)),e.duration=n=>e.check(Pp(n))});function Z(e){return uh(Kp,e)}const Pe=G("ZodStringFormat",(e,t)=>{Re.init(e,t),Ua.init(e,t)}),Gp=G("ZodEmail",(e,t)=>{mf.init(e,t),Pe.init(e,t)}),qs=G("ZodGUID",(e,t)=>{hf.init(e,t),Pe.init(e,t)}),Vn=G("ZodUUID",(e,t)=>{pf.init(e,t),Pe.init(e,t)}),Yp=G("ZodURL",(e,t)=>{gf.init(e,t),Pe.init(e,t)}),Xp=G("ZodEmoji",(e,t)=>{xf.init(e,t),Pe.init(e,t)}),Qp=G("ZodNanoID",(e,t)=>{vf.init(e,t),Pe.init(e,t)}),em=G("ZodCUID",(e,t)=>{yf.init(e,t),Pe.init(e,t)}),tm=G("ZodCUID2",(e,t)=>{bf.init(e,t),Pe.init(e,t)}),nm=G("ZodULID",(e,t)=>{wf.init(e,t),Pe.init(e,t)}),rm=G("ZodXID",(e,t)=>{_f.init(e,t),Pe.init(e,t)}),om=G("ZodKSUID",(e,t)=>{kf.init(e,t),Pe.init(e,t)}),sm=G("ZodIPv4",(e,t)=>{Nf.init(e,t),Pe.init(e,t)}),im=G("ZodIPv6",(e,t)=>{Tf.init(e,t),Pe.init(e,t)}),am=G("ZodCIDRv4",(e,t)=>{Af.init(e,t),Pe.init(e,t)}),lm=G("ZodCIDRv6",(e,t)=>{zf.init(e,t),Pe.init(e,t)}),cm=G("ZodBase64",(e,t)=>{Of.init(e,t),Pe.init(e,t)}),um=G("ZodBase64URL",(e,t)=>{Rf.init(e,t),Pe.init(e,t)}),dm=G("ZodE164",(e,t)=>{Pf.init(e,t),Pe.init(e,t)}),fm=G("ZodJWT",(e,t)=>{Df.init(e,t),Pe.init(e,t)}),Za=G("ZodNumber",(e,t)=>{za.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>ip(e,r,o),e.gt=(r,o)=>e.check(Vs(r,o)),e.gte=(r,o)=>e.check(Hr(r,o)),e.min=(r,o)=>e.check(Hr(r,o)),e.lt=(r,o)=>e.check(Ws(r,o)),e.lte=(r,o)=>e.check(Vr(r,o)),e.max=(r,o)=>e.check(Vr(r,o)),e.int=r=>e.check(Js(r)),e.safe=r=>e.check(Js(r)),e.positive=r=>e.check(Vs(0,r)),e.nonnegative=r=>e.check(Hr(0,r)),e.negative=r=>e.check(Ws(0,r)),e.nonpositive=r=>e.check(Vr(0,r)),e.multipleOf=(r,o)=>e.check(Hs(r,o)),e.step=(r,o)=>e.check(Hs(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 me(e){return Mh(Za,e)}const hm=G("ZodNumberFormat",(e,t)=>{Lf.init(e,t),Za.init(e,t)});function Js(e){return Dh(hm,e)}const pm=G("ZodBoolean",(e,t)=>{Ff.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ap(e,n,r)});function Be(e){return Lh(pm,e)}const mm=G("ZodNull",(e,t)=>{$f.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lp(e,n,r)});function go(e){return Fh(mm,e)}const gm=G("ZodUnknown",(e,t)=>{Bf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>up()});function Ks(){return $h(gm)}const xm=G("ZodNever",(e,t)=>{Uf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cp(e,n,r)});function vm(e){return Bh(xm,e)}const ym=G("ZodArray",(e,t)=>{Zf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mp(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(ur(n,r)),e.nonempty=n=>e.check(ur(1,n)),e.max=(n,r)=>e.check(Ma(n,r)),e.length=(n,r)=>e.check(Da(n,r)),e.unwrap=()=>e.element});function Ne(e,t){return Qh(ym,e,t)}const bm=G("ZodObject",(e,t)=>{Vf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gp(e,n,r,o),_e(e,"shape",()=>t.shape),e.keyof=()=>Ve(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ks()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ks()}),e.strict=()=>e.clone({...e._zod.def,catchall:vm()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>cd(e,n),e.safeExtend=n=>ud(e,n),e.merge=n=>dd(e,n),e.pick=n=>ad(e,n),e.omit=n=>ld(e,n),e.partial=(...n)=>fd(Va,e,n[0]),e.required=(...n)=>hd(Ha,e,n[0])});function ne(e,t){const n={type:"object",shape:e??{},...de(t)};return new bm(n)}const Wa=G("ZodUnion",(e,t)=>{Ra.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xp(e,n,r,o),e.options=t.options});function xt(e,t){return new Wa({type:"union",options:e,...de(t)})}const wm=G("ZodDiscriminatedUnion",(e,t)=>{Wa.init(e,t),Hf.init(e,t)});function Ft(e,t,n){return new wm({type:"union",options:t,discriminator:e,...de(n)})}const _m=G("ZodIntersection",(e,t)=>{qf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vp(e,n,r,o)});function km(e,t){return new _m({type:"intersection",left:e,right:t})}const Cm=G("ZodRecord",(e,t)=>{Jf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yp(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function pt(e,t,n){return new Cm({type:"record",keyType:e,valueType:t,...de(n)})}const xo=G("ZodEnum",(e,t)=>{Kf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>dp(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new xo({...t,checks:[],...de(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new xo({...t,checks:[],...de(o),entries:s})}});function Ve(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new xo({type:"enum",entries:n,...de(t)})}const Sm=G("ZodLiteral",(e,t)=>{Gf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fp(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 ve(e,t){return new Sm({type:"literal",values:Array.isArray(e)?e:[e],...de(t)})}const jm=G("ZodTransform",(e,t)=>{Yf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>pp(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ma(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Tn(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(Tn(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function Em(e){return new jm({type:"transform",transform:e})}const Va=G("ZodOptional",(e,t)=>{Pa.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ba(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Gs(e){return new Va({type:"optional",innerType:e})}const Nm=G("ZodExactOptional",(e,t)=>{Xf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ba(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Tm(e){return new Nm({type:"optional",innerType:e})}const Am=G("ZodNullable",(e,t)=>{Qf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ys(e){return new Am({type:"nullable",innerType:e})}const zm=G("ZodDefault",(e,t)=>{eh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_p(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Om(e,t){return new zm({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():ya(t)}})}const Im=G("ZodPrefault",(e,t)=>{th.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Rm(e,t){return new Im({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():ya(t)}})}const Ha=G("ZodNonOptional",(e,t)=>{nh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Pm(e,t){return new Ha({type:"nonoptional",innerType:e,...de(t)})}const Mm=G("ZodCatch",(e,t)=>{rh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Dm(e,t){return new Mm({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Lm=G("ZodPipe",(e,t)=>{oh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sp(e,n,r,o),e.in=t.in,e.out=t.out});function Xs(e,t){return new Lm({type:"pipe",in:e,out:t})}const Fm=G("ZodReadonly",(e,t)=>{sh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function $m(e){return new Fm({type:"readonly",innerType:e})}const Bm=G("ZodLazy",(e,t)=>{ih.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ep(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function Um(e){return new Bm({type:"lazy",getter:e})}const Zm=G("ZodCustom",(e,t)=>{ah.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>hp(e,n)});function Wm(e,t={}){return ep(Zm,e,t)}function Vm(e){return tp(e)}const on=Um(()=>xt([Z(),me(),Be(),go(),Ne(on),pt(Z(),on)]));function qa(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Qs(e,t){return e===null||typeof e!="object"||Array.isArray(e)?void 0:Object.getOwnPropertyDescriptor(e,t)?.value}const Ko=ne({type:Z(),ttl:Z().optional(),scope:Z().optional()}),Go=ne({type:ve("text"),text:Z(),cache_control:Ko.optional()}),Ja=ne({type:ve("thinking"),thinking:Z(),signature:Z().optional()}),Hm=ne({type:ve("think"),thinking:Z(),signature:Z().optional()}),qm=ne({type:ve("base64"),media_type:Z(),data:Z()}),Ka=ne({type:ve("image"),source:qm}),Ga=ne({type:ve("tool_use"),id:Z(),name:Z(),input:pt(Z(),on)}),Jm=Ft("type",[Go,Ka]),Km=ne({type:ve("tool_result"),tool_use_id:Z().optional(),content:xt([Z(),Ne(Jm)]),is_error:Be().optional()}),Gm=Ft("type",[Go,Ja,Ka,Ga,Km]),Ym=xt([Z(),Ne(Gm)]),Xm=ne({role:Ve(["user","assistant"]),content:Ym}),Qm=ne({type:ve("text"),text:Z(),cache_control:Ko.optional()}),eg=ne({type:Z(),properties:pt(Z(),pt(Z(),on)).optional(),required:Ne(Z()).optional(),additionalProperties:Be().optional(),$schema:Z().optional()}),tg=ne({name:Z(),description:Z().optional(),input_schema:eg.optional(),cache_control:Ko.optional()}),ng=Ft("type",[ne({type:ve("enabled"),budget_tokens:me()}),ne({type:ve("disabled")}),ne({type:ve("adaptive")})]),Ya=ne({model:Z(),messages:Ne(Xm),system:Ne(Qm).optional(),tools:Ne(tg).optional(),max_tokens:me().optional(),temperature:me().optional(),stream:Be().optional(),thinking:ng.optional(),metadata:ne({user_id:Z().optional()}).optional()}),Yo=Ft("type",[Go,Ja,Hm,Ga]),rg=ne({input_tokens:me().nullable().optional(),output_tokens:me().nullable().optional(),cache_creation_input_tokens:me().nullable().optional(),cache_read_input_tokens:me().nullable().optional()}).passthrough(),Xa=ne({id:Z(),type:ve("message"),model:Z(),role:ve("assistant"),content:Ne(Yo),stop_reason:Z().nullable(),stop_sequence:Z().nullable().optional(),usage:rg}).passthrough(),og=ne({type:ve("message_start"),message:ne({id:Z(),type:ve("message"),model:Z(),role:ve("assistant"),content:Ne(Yo),stop_reason:go(),stop_sequence:go(),usage:ne({input_tokens:me(),cache_creation_input_tokens:me().optional(),cache_read_input_tokens:me().optional()}).passthrough()})}),sg=ne({type:ve("content_block_start"),index:me(),content_block:Yo}),ig=Ft("type",[ne({type:ve("text_delta"),text:Z()}),ne({type:ve("input_json_delta"),partial_json:Z()}),ne({type:ve("thinking_delta"),thinking:Z()}),ne({type:ve("signature_delta"),signature:Z()})]),ag=ne({type:ve("content_block_delta"),index:me(),delta:ig}),lg=ne({type:ve("content_block_stop"),index:me()}),cg=ne({type:ve("message_delta"),delta:ne({stop_reason:Z().nullable(),stop_sequence:Z().nullable().optional()}),usage:ne({output_tokens:me(),input_tokens:me().optional(),cache_creation_input_tokens:me().optional(),cache_read_input_tokens:me().optional()}).passthrough()}),ug=ne({type:ve("message_stop")}),dg=ne({type:ve("ping")}),fg=ne({type:ve("error"),error:ne({type:Z(),message:Z()})}),hg=Ft("type",[og,sg,ag,lg,cg,ug,dg,fg]),pg=xt([Z(),Ne(Ft("type",[ne({type:ve("text"),text:Z()}),ne({type:ve("image_url"),image_url:ne({url:Z(),detail:Z().optional()})})]))]),Qa=ne({role:Ve(["system","user","assistant","tool"]),content:pg,name:Z().optional(),reasoning_content:Z().optional(),thinking:Z().optional(),think:Z().optional()}),mg=ne({name:Z(),arguments:Z()}),el=ne({index:me().optional(),id:Z().optional(),type:ve("function").optional(),function:ne({name:Z().optional(),arguments:Z().optional()})});Qa.extend({content:xt([Z(),Ne(ne({type:ve("text"),text:Z()}))]).optional(),function_call:mg.optional(),tool_calls:Ne(el).optional()});const gg=ne({type:ve("function"),function:ne({name:Z(),description:Z().optional(),parameters:pt(Z(),on)})}),tl=ne({model:Z(),messages:Ne(Qa),temperature:me().optional(),max_tokens:me().optional(),stream:Be().optional(),tools:Ne(gg).optional(),tool_choice:xt([Ve(["auto","none","required"]),ne({type:ve("auto")}),ne({type:ve("none")}),ne({type:ve("function"),function:ne({name:Z()})})]).optional(),user:Z().optional()}),nl=ne({role:Ve(["assistant"]).optional(),content:Z().nullable().optional(),reasoning_content:Z().nullable().optional(),thinking:Z().nullable().optional(),think:Z().nullable().optional(),function_call:ne({name:Z().optional(),arguments:Z().optional()}).nullable().optional(),tool_calls:Ne(ne({index:me(),id:Z().optional(),type:ve("function").optional(),function:ne({name:Z().optional(),arguments:Z().optional()})})).nullable().optional()}),xg=ne({index:me(),message:ne({role:Ve(["assistant"]),content:Z().nullable(),reasoning_content:Z().optional(),thinking:Z().optional(),think:Z().optional(),function_call:ne({name:Z(),arguments:Z()}).nullable().optional(),tool_calls:Ne(el).optional()}).optional(),delta:nl.optional(),finish_reason:Z().nullable()}),vg=ne({id:Z(),object:ve("chat.completion"),created:me(),model:Z(),choices:Ne(xg),usage:ne({prompt_tokens:me().nullable().optional(),completion_tokens:me().nullable().optional(),total_tokens:me().nullable().optional()}).passthrough(),service_tier:Z().nullable().optional(),system_fingerprint:Z().nullable().optional()}).passthrough(),yg=ne({id:Z(),object:ve("chat.completion.chunk"),created:me(),model:Z(),choices:Ne(ne({index:me(),delta:nl,finish_reason:Z().nullable().optional()})),usage:ne({prompt_tokens:me().nullable().optional(),completion_tokens:me().nullable().optional(),total_tokens:me().nullable().optional()}).passthrough().nullable().optional()}).passthrough();function rl(e){try{const t=JSON.parse(e),n=vg.safeParse(t);return n.success?n.data:null}catch{return null}}const ol=ne({index:me(),timestamp:me(),type:Z(),data:on}),bg=ne({chunks:Ne(ol),truncated:Be().optional().default(!1)}),ei=ne({id:me(),timestamp:Z(),method:Z(),path:Z(),model:Z().nullable(),sessionId:Z().nullable(),rawRequestBody:Z().nullable(),responseStatus:me().nullable(),responseText:Z().nullable(),inputTokens:me().nullable(),outputTokens:me().nullable(),cacheCreationInputTokens:me().nullable(),cacheReadInputTokens:me().nullable(),elapsedMs:me().nullable(),streaming:Be(),userAgent:Z().nullable(),origin:Z().nullable(),rawHeaders:pt(Z(),Z()).optional(),headers:pt(Z(),Z()).optional(),apiFormat:Ve(["anthropic","openai","unknown"]).default("unknown"),isTest:Be().optional().default(!1),providerName:Z().nullable().optional(),clientPort:me().nullable().optional(),clientPid:me().nullable().optional(),clientCwd:Z().nullable().optional(),clientProjectFolder:Z().nullable().optional(),streamingChunks:bg.optional(),streamingChunksPath:Z().nullable().optional(),error:Z().nullable().optional()});ne({model:Z()});ne({model:Z().optional(),metadata:ne({user_id:Z().optional()}).passthrough().optional()});const wg=ne({error:Z()});async function Kt(e,t){const n=await e.json();return t.parse(n)}async function rr(e,t){try{const n=await e.json(),r=wg.safeParse(n);return r.success?r.data.error:t}catch{return t}}async function Pn(e,t,n,r){const o=await fetch(e,n);if(!o.ok){const s=r?.(o)??`Request failed with status ${o.status}`;throw new Error(await rr(o,s))}return Kt(o,t)}const fr=10,vo=600,Nr=ne({stripClaudeCodeBillingHeader:Be(),hasSeenOnboarding:Be().default(!1),slowResponseThresholdSeconds:me().int().min(0).max(vo).default(fr)}),or="/api/config";async function _g(e){return Pn(e,Nr,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function ti(e){return Pn(or,Nr,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function sl(){const e=Uo(or,_g,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=ha(),n=e.data?.stripClaudeCodeBillingHeader??!1,r=e.data?.slowResponseThresholdSeconds??fr,o=l=>({stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:e.data?.hasSeenOnboarding??!1,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??fr,...l}),s=async l=>{await t(or,ti({stripClaudeCodeBillingHeader:l}),{optimisticData:o({stripClaudeCodeBillingHeader:l}),rollbackOnError:!0,revalidate:!1})},i=async l=>{await t(or,ti({slowResponseThresholdSeconds:l}),{optimisticData:o({slowResponseThresholdSeconds:l}),rollbackOnError:!0,revalidate:!1})};return{strip:n,slowResponseThresholdSeconds:r,isLoading:e.isLoading,isError:e.error!==void 0,setStrip:s,setSlowResponseThresholdSeconds:i}}const il=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const kg=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Cg=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const ni=e=>{const t=Cg(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Sg={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 jg=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const Eg=y.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...l},c)=>y.createElement("svg",{ref:c,...Sg,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:il("lucide",o),...!s&&!jg(l)&&{"aria-hidden":"true"},...l},[...i.map(([u,d])=>y.createElement(u,d)),...Array.isArray(s)?s:[s]]));const ge=(e,t)=>{const n=y.forwardRef(({className:r,...o},s)=>y.createElement(Eg,{ref:s,iconNode:t,className:il(`lucide-${kg(ni(e))}`,`lucide-${e}`,r),...o}));return n.displayName=ni(e),n};const Ng=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Tg=ge("arrow-down",Ng);const Ag=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],zg=ge("arrow-left",Ag);const Og=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Ig=ge("arrow-up",Og);const Rg=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Et=ge("check",Rg);const Pg=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Mn=ge("chevron-down",Pg);const Mg=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Xo=ge("chevron-right",Mg);const Dg=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Lg=ge("chevron-up",Dg);const Fg=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],al=ge("chevrons-down",Fg);const $g=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],ll=ge("chevrons-up",$g);const Bg=[["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"}]],An=ge("circle-alert",Bg);const Ug=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Zg=ge("circle-check-big",Ug);const Wg=[["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"}]],Vg=ge("circle-question-mark",Wg);const Hg=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],sn=ge("clock",Hg);const qg=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Jg=ge("columns-2",qg);const Kg=[["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"}]],fn=ge("copy",Kg);const Gg=[["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"}]],Qo=ge("download",Gg);const Yg=[["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"}]],cl=ge("external-link",Yg);const Xg=[["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"}]],es=ge("eye-off",Xg);const Qg=[["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"}]],ts=ge("eye",Qg);const e0=[["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"}]],t0=ge("file-terminal",e0);const n0=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],r0=ge("gauge",n0);const o0=[["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"}]],ul=ge("git-compare-arrows",o0);const s0=[["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"}]],i0=ge("globe",s0);const a0=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],hr=ge("loader-circle",a0);const l0=[["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"}]],c0=ge("lock",l0);const u0=[["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"}]],dl=ge("message-square",u0);const d0=[["path",{d:"M5 12h14",key:"1ays0h"}]],f0=ge("minus",d0);const h0=[["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"}]],p0=ge("octagon-alert",h0);const m0=[["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"}]],g0=ge("pencil",m0);const x0=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],yo=ge("plus",x0);const v0=[["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"}]],y0=ge("radio",v0);const b0=[["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"}]],w0=ge("rotate-ccw",b0);const _0=[["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"}]],fl=ge("rotate-cw",_0);const k0=[["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"}]],C0=ge("rows-3",k0);const S0=[["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"}]],j0=ge("scan",S0);const E0=[["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"}]],N0=ge("server",E0);const T0=[["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"}]],A0=ge("settings",T0);const z0=[["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"}]],hl=ge("trash-2",z0);const O0=[["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"}]],bo=ge("triangle-alert",O0);const I0=[["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"}]],R0=ge("upload",I0);const P0=[["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"}]],M0=ge("user",P0);const D0=[["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"}]],L0=ge("wifi-off",D0);const F0=[["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"}]],$0=ge("wifi",F0);const B0=[["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"}]],ri=ge("wrench",B0);const U0=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],pl=ge("x",U0);const Z0=[["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"}]],ns=ge("zap",Z0),wo="/api/config";async function W0(e){return Pn(e,Nr,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function V0(e){return Pn(wo,Nr,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function H0(){const e=Uo(wo,W0,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=ha(),n=e.data?.hasSeenOnboarding??!1,r=async()=>{await t(wo,V0({hasSeenOnboarding:!0}),{optimisticData:{stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:!0,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??fr},rollbackOnError:!0,revalidate:!1})};return{hasSeenOnboarding:n,isLoading:e.isLoading,markSeen:r}}function q0(){const{hasSeenOnboarding:e,isLoading:t,markSeen:n}=H0();return t||e?null:a.jsxs("div",{role:"note","aria-label":"Onboarding tip",className:"mx-4 mt-2 mb-1 flex items-start gap-3 rounded-md border border-amber-500/30 bg-amber-500/5 px-4 py-3 text-sm",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"font-medium text-amber-600 dark:text-amber-400 mb-1",children:"Quick tour of the log tabs"}),a.jsxs("ul",{className:"space-y-0.5 text-muted-foreground text-xs leading-relaxed",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"Request"})," / ",a.jsx("strong",{children:"Response"})," — structured views of what the proxy sent and received."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Headers"})," — request and response headers after proxy processing."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Raw Headers"})," / ",a.jsx("strong",{children:"Raw Request"})," /"," ",a.jsx("strong",{children:"Raw Response"})," — exact bytes from the upstream provider (visible in Full mode)."]})]})]}),a.jsxs("button",{type:"button",onClick:()=>{n()},className:"inline-flex items-center gap-1.5 text-xs h-8 px-3 rounded-md border border-amber-500/40 text-amber-700 dark:text-amber-300 hover:bg-amber-500/10 transition-colors shrink-0","aria-label":"Dismiss onboarding tip",children:[a.jsx(Et,{className:"size-3.5"}),"Got it"]}),a.jsx("button",{type:"button",onClick:()=>{n()},className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 p-1 -m-1","aria-label":"Dismiss",children:a.jsx(pl,{className:"size-3.5"})})]})}function Hn(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 qr={exports:{}};var oi;function J0(){return oi||(oi=1,(function(e,t){(function(n){e.exports=n()})(function(){return(function n(r,o,s){function i(u,d){if(!o[u]){if(!r[u]){var f=typeof Hn=="function"&&Hn;if(!d&&f)return f(u,!0);if(l)return l(u,!0);var m=new Error("Cannot find module '"+u+"'");throw m.code="MODULE_NOT_FOUND",m}var p=o[u]={exports:{}};r[u][0].call(p.exports,function(g){var h=r[u][1][g];return i(h||g)},p,p.exports,n,r,o,s)}return o[u].exports}for(var l=typeof Hn=="function"&&Hn,c=0;c<s.length;c++)i(s[c]);return i})({1:[function(n,r,o){var s=n("./utils"),i=n("./support"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(c){for(var u,d,f,m,p,g,h,x=[],v=0,_=c.length,k=_,C=s.getTypeOf(c)!=="string";v<c.length;)k=_-v,f=C?(u=c[v++],d=v<_?c[v++]:0,v<_?c[v++]:0):(u=c.charCodeAt(v++),d=v<_?c.charCodeAt(v++):0,v<_?c.charCodeAt(v++):0),m=u>>2,p=(3&u)<<4|d>>4,g=1<k?(15&d)<<2|f>>6:64,h=2<k?63&f:64,x.push(l.charAt(m)+l.charAt(p)+l.charAt(g)+l.charAt(h));return x.join("")},o.decode=function(c){var u,d,f,m,p,g,h=0,x=0,v="data:";if(c.substr(0,v.length)===v)throw new Error("Invalid base64 input, it looks like a data url.");var _,k=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===l.charAt(64)&&k--,c.charAt(c.length-2)===l.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(_=i.uint8array?new Uint8Array(0|k):new Array(0|k);h<c.length;)u=l.indexOf(c.charAt(h++))<<2|(m=l.indexOf(c.charAt(h++)))>>4,d=(15&m)<<4|(p=l.indexOf(c.charAt(h++)))>>2,f=(3&p)<<6|(g=l.indexOf(c.charAt(h++))),_[x++]=u,p!==64&&(_[x++]=d),g!==64&&(_[x++]=f);return _}},{"./support":30,"./utils":32}],2:[function(n,r,o){var s=n("./external"),i=n("./stream/DataWorker"),l=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function u(d,f,m,p,g){this.compressedSize=d,this.uncompressedSize=f,this.crc32=m,this.compression=p,this.compressedContent=g}u.prototype={getContentWorker:function(){var d=new i(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),f=this;return d.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new i(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,f,m){return d.pipe(new l).pipe(new c("uncompressedSize")).pipe(f.compressWorker(m)).pipe(new c("compressedSize")).withStreamInfo("compression",f)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){var s=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){var s=n("./utils"),i=(function(){for(var l,c=[],u=0;u<256;u++){l=u;for(var d=0;d<8;d++)l=1&l?3988292384^l>>>1:l>>>1;c[u]=l}return c})();r.exports=function(l,c){return l!==void 0&&l.length?s.getTypeOf(l)!=="string"?(function(u,d,f,m){var p=i,g=m+f;u^=-1;for(var h=m;h<g;h++)u=u>>>8^p[255&(u^d[h])];return-1^u})(0|c,l,l.length,0):(function(u,d,f,m){var p=i,g=m+f;u^=-1;for(var h=m;h<g;h++)u=u>>>8^p[255&(u^d.charCodeAt(h))];return-1^u})(0|c,l,l.length,0):0}},{"./utils":32}],5:[function(n,r,o){o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){var s=null;s=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:s}},{lie:37}],7:[function(n,r,o){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=n("pako"),l=n("./utils"),c=n("./stream/GenericWorker"),u=s?"uint8array":"array";function d(f,m){c.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=m,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 i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(m){f.push({data:m,meta:f.meta})}},o.compressWorker=function(f){return new d("Deflate",f)},o.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){function s(p,g){var h,x="";for(h=0;h<g;h++)x+=String.fromCharCode(255&p),p>>>=8;return x}function i(p,g,h,x,v,_){var k,C,j=p.file,z=p.compression,E=_!==u.utf8encode,A=l.transformTo("string",_(j.name)),O=l.transformTo("string",u.utf8encode(j.name)),R=j.comment,q=l.transformTo("string",_(R)),S=l.transformTo("string",u.utf8encode(R)),I=O.length!==j.name.length,b=S.length!==R.length,P="",H="",L="",B=j.dir,K=j.date,se={crc32:0,compressedSize:0,uncompressedSize:0};g&&!h||(se.crc32=p.crc32,se.compressedSize=p.compressedSize,se.uncompressedSize=p.uncompressedSize);var U=0;g&&(U|=8),E||!I&&!b||(U|=2048);var $=0,oe=0;B&&($|=16),v==="UNIX"?(oe=798,$|=(function(J,ue){var X=J;return J||(X=ue?16893:33204),(65535&X)<<16})(j.unixPermissions,B)):(oe=20,$|=(function(J){return 63&(J||0)})(j.dosPermissions)),k=K.getUTCHours(),k<<=6,k|=K.getUTCMinutes(),k<<=5,k|=K.getUTCSeconds()/2,C=K.getUTCFullYear()-1980,C<<=4,C|=K.getUTCMonth()+1,C<<=5,C|=K.getUTCDate(),I&&(H=s(1,1)+s(d(A),4)+O,P+="up"+s(H.length,2)+H),b&&(L=s(1,1)+s(d(q),4)+S,P+="uc"+s(L.length,2)+L);var ee="";return ee+=`
|
|
41
|
+
\0`,ee+=s(U,2),ee+=z.magic,ee+=s(k,2),ee+=s(C,2),ee+=s(se.crc32,4),ee+=s(se.compressedSize,4),ee+=s(se.uncompressedSize,4),ee+=s(A.length,2),ee+=s(P.length,2),{fileRecord:f.LOCAL_FILE_HEADER+ee+A+P,dirRecord:f.CENTRAL_FILE_HEADER+s(oe,2)+ee+s(q.length,2)+"\0\0\0\0"+s($,4)+s(x,4)+A+P+q}}var l=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function m(p,g,h,x){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=h,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(m,c),m.prototype.push=function(p){var g=p.meta.percent||0,h=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:h?(g+100*(h-x-1))/h:100}}))},m.prototype.openedSource=function(p){this.currentSourceOffset=this.bytesWritten,this.currentFile=p.file.name;var g=this.streamFiles&&!p.file.dir;if(g){var h=i(p,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:h.fileRecord,meta:{percent:0}})}else this.accumulate=!0},m.prototype.closedSource=function(p){this.accumulate=!1;var g=this.streamFiles&&!p.file.dir,h=i(p,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(h.dirRecord),g)this.push({data:(function(x){return f.DATA_DESCRIPTOR+s(x.crc32,4)+s(x.compressedSize,4)+s(x.uncompressedSize,4)})(p),meta:{percent:100}});else for(this.push({data:h.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},m.prototype.flush=function(){for(var p=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var h=this.bytesWritten-p,x=(function(v,_,k,C,j){var z=l.transformTo("string",j(C));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(v,2)+s(v,2)+s(_,4)+s(k,4)+s(z.length,2)+z})(this.dirRecords.length,h,p,this.zipComment,this.encodeFileName);this.push({data:x,meta:{percent:100}})},m.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},m.prototype.registerPrevious=function(p){this._sources.push(p);var g=this;return p.on("data",function(h){g.processChunk(h)}),p.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),p.on("error",function(h){g.error(h)}),this},m.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))},m.prototype.error=function(p){var g=this._sources;if(!c.prototype.error.call(this,p))return!1;for(var h=0;h<g.length;h++)try{g[h].error(p)}catch{}return!0},m.prototype.lock=function(){c.prototype.lock.call(this);for(var p=this._sources,g=0;g<p.length;g++)p[g].lock()},r.exports=m},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){var s=n("../compressions"),i=n("./ZipFileWorker");o.generateWorker=function(l,c,u){var d=new i(c.streamFiles,u,c.platform,c.encodeFileName),f=0;try{l.forEach(function(m,p){f++;var g=(function(_,k){var C=_||k,j=s[C];if(!j)throw new Error(C+" is not a valid compression method !");return j})(p.options.compression,c.compression),h=p.options.compressionOptions||c.compressionOptions||{},x=p.dir,v=p.date;p._compressWorker(g,h).withStreamInfo("file",{name:m,dir:x,date:v,comment:p.comment||"",unixPermissions:p.unixPermissions,dosPermissions:p.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(m){d.error(m)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){function s(){if(!(this instanceof s))return new s;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var i=new s;for(var l in this)typeof this[l]!="function"&&(i[l]=this[l]);return i}}(s.prototype=n("./object")).loadAsync=n("./load"),s.support=n("./support"),s.defaults=n("./defaults"),s.version="3.10.1",s.loadAsync=function(i,l){return new s().loadAsync(i,l)},s.external=n("./external"),r.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){var s=n("./utils"),i=n("./external"),l=n("./utf8"),c=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function f(m){return new i.Promise(function(p,g){var h=m.decompressed.getContentWorker().pipe(new u);h.on("error",function(x){g(x)}).on("end",function(){h.streamInfo.crc32!==m.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):p()}).resume()})}r.exports=function(m,p){var g=this;return p=s.extend(p||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:l.utf8decode}),d.isNode&&d.isStream(m)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",m,!0,p.optimizedBinaryString,p.base64).then(function(h){var x=new c(p);return x.load(h),x}).then(function(h){var x=[i.Promise.resolve(h)],v=h.files;if(p.checkCRC32)for(var _=0;_<v.length;_++)x.push(f(v[_]));return i.Promise.all(x)}).then(function(h){for(var x=h.shift(),v=x.files,_=0;_<v.length;_++){var k=v[_],C=k.fileNameStr,j=s.resolve(k.fileNameStr);g.file(j,k.decompressed,{binary:!0,optimizedBinaryString:!0,date:k.date,dir:k.dir,comment:k.fileCommentStr.length?k.fileCommentStr:null,unixPermissions:k.unixPermissions,dosPermissions:k.dosPermissions,createFolders:p.createFolders}),k.dir||(g.file(j).unsafeOriginalName=C)}return x.zipComment.length&&(g.comment=x.zipComment),g})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){var s=n("../utils"),i=n("../stream/GenericWorker");function l(c,u){i.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}s.inherits(l,i),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!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},l.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=l},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){var s=n("readable-stream").Readable;function i(l,c,u){s.call(this,c),this._helper=l;var d=this;l.on("data",function(f,m){d.push(f)||d._helper.pause(),u&&u(m)}).on("error",function(f){d.emit("error",f)}).on("end",function(){d.push(null)})}n("../utils").inherits(i,s),i.prototype._read=function(){this._helper.resume()},r.exports=i},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(s,i){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(s,i);if(typeof s=="number")throw new Error('The "data" argument must not be a number');return new Buffer(s,i)},allocBuffer:function(s){if(Buffer.alloc)return Buffer.alloc(s);var i=new Buffer(s);return i.fill(0),i},isBuffer:function(s){return Buffer.isBuffer(s)},isStream:function(s){return s&&typeof s.on=="function"&&typeof s.pause=="function"&&typeof s.resume=="function"}}},{}],15:[function(n,r,o){function s(j,z,E){var A,O=l.getTypeOf(z),R=l.extend(E||{},d);R.date=R.date||new Date,R.compression!==null&&(R.compression=R.compression.toUpperCase()),typeof R.unixPermissions=="string"&&(R.unixPermissions=parseInt(R.unixPermissions,8)),R.unixPermissions&&16384&R.unixPermissions&&(R.dir=!0),R.dosPermissions&&16&R.dosPermissions&&(R.dir=!0),R.dir&&(j=v(j)),R.createFolders&&(A=x(j))&&_.call(this,A,!0);var q=O==="string"&&R.binary===!1&&R.base64===!1;E&&E.binary!==void 0||(R.binary=!q),(z instanceof f&&z.uncompressedSize===0||R.dir||!z||z.length===0)&&(R.base64=!1,R.binary=!0,z="",R.compression="STORE",O="string");var S=null;S=z instanceof f||z instanceof c?z:g.isNode&&g.isStream(z)?new h(j,z):l.prepareContent(j,z,R.binary,R.optimizedBinaryString,R.base64);var I=new m(j,S,R);this.files[j]=I}var i=n("./utf8"),l=n("./utils"),c=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),m=n("./zipObject"),p=n("./generate"),g=n("./nodejsUtils"),h=n("./nodejs/NodejsStreamInputAdapter"),x=function(j){j.slice(-1)==="/"&&(j=j.substring(0,j.length-1));var z=j.lastIndexOf("/");return 0<z?j.substring(0,z):""},v=function(j){return j.slice(-1)!=="/"&&(j+="/"),j},_=function(j,z){return z=z!==void 0?z:d.createFolders,j=v(j),this.files[j]||s.call(this,j,null,{dir:!0,createFolders:z}),this.files[j]};function k(j){return Object.prototype.toString.call(j)==="[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(j){var z,E,A;for(z in this.files)A=this.files[z],(E=z.slice(this.root.length,z.length))&&z.slice(0,this.root.length)===this.root&&j(E,A)},filter:function(j){var z=[];return this.forEach(function(E,A){j(E,A)&&z.push(A)}),z},file:function(j,z,E){if(arguments.length!==1)return j=this.root+j,s.call(this,j,z,E),this;if(k(j)){var A=j;return this.filter(function(R,q){return!q.dir&&A.test(R)})}var O=this.files[this.root+j];return O&&!O.dir?O:null},folder:function(j){if(!j)return this;if(k(j))return this.filter(function(O,R){return R.dir&&j.test(O)});var z=this.root+j,E=_.call(this,z),A=this.clone();return A.root=E.name,A},remove:function(j){j=this.root+j;var z=this.files[j];if(z||(j.slice(-1)!=="/"&&(j+="/"),z=this.files[j]),z&&!z.dir)delete this.files[j];else for(var E=this.filter(function(O,R){return R.name.slice(0,j.length)===j}),A=0;A<E.length;A++)delete this.files[E[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(j){var z,E={};try{if((E=l.extend(j||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=E.type.toLowerCase(),E.compression=E.compression.toUpperCase(),E.type==="binarystring"&&(E.type="string"),!E.type)throw new Error("No output type specified.");l.checkSupport(E.type),E.platform!=="darwin"&&E.platform!=="freebsd"&&E.platform!=="linux"&&E.platform!=="sunos"||(E.platform="UNIX"),E.platform==="win32"&&(E.platform="DOS");var A=E.comment||this.comment||"";z=p.generateWorker(this,E,A)}catch(O){(z=new c("error")).error(O)}return new u(z,E.type||"string",E.mimeType)},generateAsync:function(j,z){return this.generateInternalStream(j).accumulate(z)},generateNodeStream:function(j,z){return(j=j||{}).type||(j.type="nodebuffer"),this.generateInternalStream(j).toNodejsStream(z)}};r.exports=C},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,o){r.exports=n("stream")},{stream:void 0}],17:[function(n,r,o){var s=n("./DataReader");function i(l){s.call(this,l);for(var c=0;c<this.data.length;c++)l[c]=255&l[c]}n("../utils").inherits(i,s),i.prototype.byteAt=function(l){return this.data[this.zero+l]},i.prototype.lastIndexOfSignature=function(l){for(var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),f=l.charCodeAt(3),m=this.length-4;0<=m;--m)if(this.data[m]===c&&this.data[m+1]===u&&this.data[m+2]===d&&this.data[m+3]===f)return m-this.zero;return-1},i.prototype.readAndCheckSignature=function(l){var c=l.charCodeAt(0),u=l.charCodeAt(1),d=l.charCodeAt(2),f=l.charCodeAt(3),m=this.readData(4);return c===m[0]&&u===m[1]&&d===m[2]&&f===m[3]},i.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=i},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){var s=n("../utils");function i(l){this.data=l,this.length=l.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(l){this.checkIndex(this.index+l)},checkIndex:function(l){if(this.length<this.zero+l||l<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+l+"). Corrupted zip ?")},setIndex:function(l){this.checkIndex(l),this.index=l},skip:function(l){this.setIndex(this.index+l)},byteAt:function(){},readInt:function(l){var c,u=0;for(this.checkOffset(l),c=this.index+l-1;c>=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=l,u},readString:function(l){return s.transformTo("string",this.readData(l))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var l=this.readInt(4);return new Date(Date.UTC(1980+(l>>25&127),(l>>21&15)-1,l>>16&31,l>>11&31,l>>5&63,(31&l)<<1))}},r.exports=i},{"../utils":32}],19:[function(n,r,o){var s=n("./Uint8ArrayReader");function i(l){s.call(this,l)}n("../utils").inherits(i,s),i.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=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){var s=n("./DataReader");function i(l){s.call(this,l)}n("../utils").inherits(i,s),i.prototype.byteAt=function(l){return this.data.charCodeAt(this.zero+l)},i.prototype.lastIndexOfSignature=function(l){return this.data.lastIndexOf(l)-this.zero},i.prototype.readAndCheckSignature=function(l){return l===this.readData(4)},i.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=i},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){var s=n("./ArrayReader");function i(l){s.call(this,l)}n("../utils").inherits(i,s),i.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=i},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){var s=n("../utils"),i=n("../support"),l=n("./ArrayReader"),c=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(f){var m=s.getTypeOf(f);return s.checkSupport(m),m!=="string"||i.uint8array?m==="nodebuffer"?new u(f):i.uint8array?new d(s.transformTo("uint8array",f)):new l(s.transformTo("array",f)):new c(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){var s=n("./GenericWorker"),i=n("../utils");function l(c){s.call(this,"ConvertWorker to "+c),this.destType=c}i.inherits(l,s),l.prototype.processChunk=function(c){this.push({data:i.transformTo(this.destType,c.data),meta:c.meta})},r.exports=l},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){var s=n("./GenericWorker"),i=n("../crc32");function l(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(l,s),l.prototype.processChunk=function(c){this.streamInfo.crc32=i(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=l},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function l(c){i.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}s.inherits(l,i),l.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}i.prototype.processChunk.call(this,c)},r.exports=l},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function l(c){i.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=s.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}s.inherits(l,i),l.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},l.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},l.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},l.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=l},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){function s(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,l){return this._listeners[i].push(l),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,l){if(this._listeners[i])for(var c=0;c<this._listeners[i].length;c++)this._listeners[i][c].call(this,l)},pipe:function(i){return i.registerPrevious(this)},registerPrevious:function(i){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=i.streamInfo,this.mergeStreamInfo(),this.previous=i;var l=this;return i.on("data",function(c){l.processChunk(c)}),i.on("end",function(){l.end()}),i.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 i=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),i=!0),this.previous&&this.previous.resume(),!i},flush:function(){},processChunk:function(i){this.push(i)},withStreamInfo:function(i,l){return this.extraStreamInfo[i]=l,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var i in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,i)&&(this.streamInfo[i]=this.extraStreamInfo[i])},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 i="Worker "+this.name;return this.previous?this.previous+" -> "+i:i}},r.exports=s},{}],29:[function(n,r,o){var s=n("../utils"),i=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 m(g,h){return new d.Promise(function(x,v){var _=[],k=g._internalType,C=g._outputType,j=g._mimeType;g.on("data",function(z,E){_.push(z),h&&h(E)}).on("error",function(z){_=[],v(z)}).on("end",function(){try{var z=(function(E,A,O){switch(E){case"blob":return s.newBlob(s.transformTo("arraybuffer",A),O);case"base64":return c.encode(A);default:return s.transformTo(E,A)}})(C,(function(E,A){var O,R=0,q=null,S=0;for(O=0;O<A.length;O++)S+=A[O].length;switch(E){case"string":return A.join("");case"array":return Array.prototype.concat.apply([],A);case"uint8array":for(q=new Uint8Array(S),O=0;O<A.length;O++)q.set(A[O],R),R+=A[O].length;return q;case"nodebuffer":return Buffer.concat(A);default:throw new Error("concat : unsupported type '"+E+"'")}})(k,_),j);x(z)}catch(E){v(E)}_=[]}).resume()})}function p(g,h,x){var v=h;switch(h){case"blob":case"arraybuffer":v="uint8array";break;case"base64":v="string"}try{this._internalType=v,this._outputType=h,this._mimeType=x,s.checkSupport(v),this._worker=g.pipe(new i(v)),g.lock()}catch(_){this._worker=new l("error"),this._worker.error(_)}}p.prototype={accumulate:function(g){return m(this,g)},on:function(g,h){var x=this;return g==="data"?this._worker.on(g,function(v){h.call(x,v.data,v.meta)}):this._worker.on(g,function(){s.delay(h,arguments,x)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(g){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},g)}},r.exports=p},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var s=new ArrayBuffer(0);try{o.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(s),o.blob=i.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){for(var s=n("./utils"),i=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 m(){c.call(this,"utf-8 encode")}o.utf8encode=function(p){return i.nodebuffer?l.newBufferFrom(p,"utf-8"):(function(g){var h,x,v,_,k,C=g.length,j=0;for(_=0;_<C;_++)(64512&(x=g.charCodeAt(_)))==55296&&_+1<C&&(64512&(v=g.charCodeAt(_+1)))==56320&&(x=65536+(x-55296<<10)+(v-56320),_++),j+=x<128?1:x<2048?2:x<65536?3:4;for(h=i.uint8array?new Uint8Array(j):new Array(j),_=k=0;k<j;_++)(64512&(x=g.charCodeAt(_)))==55296&&_+1<C&&(64512&(v=g.charCodeAt(_+1)))==56320&&(x=65536+(x-55296<<10)+(v-56320),_++),x<128?h[k++]=x:(x<2048?h[k++]=192|x>>>6:(x<65536?h[k++]=224|x>>>12:(h[k++]=240|x>>>18,h[k++]=128|x>>>12&63),h[k++]=128|x>>>6&63),h[k++]=128|63&x);return h})(p)},o.utf8decode=function(p){return i.nodebuffer?s.transformTo("nodebuffer",p).toString("utf-8"):(function(g){var h,x,v,_,k=g.length,C=new Array(2*k);for(h=x=0;h<k;)if((v=g[h++])<128)C[x++]=v;else if(4<(_=u[v]))C[x++]=65533,h+=_-1;else{for(v&=_===2?31:_===3?15:7;1<_&&h<k;)v=v<<6|63&g[h++],_--;1<_?C[x++]=65533:v<65536?C[x++]=v:(v-=65536,C[x++]=55296|v>>10&1023,C[x++]=56320|1023&v)}return C.length!==x&&(C.subarray?C=C.subarray(0,x):C.length=x),s.applyFromCharCode(C)})(p=s.transformTo(i.uint8array?"uint8array":"array",p))},s.inherits(f,c),f.prototype.processChunk=function(p){var g=s.transformTo(i.uint8array?"uint8array":"array",p.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var h=g;(g=new Uint8Array(h.length+this.leftOver.length)).set(this.leftOver,0),g.set(h,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var x=(function(_,k){var C;for((k=k||_.length)>_.length&&(k=_.length),C=k-1;0<=C&&(192&_[C])==128;)C--;return C<0||C===0?k:C+u[_[C]]>k?C:k})(g),v=g;x!==g.length&&(i.uint8array?(v=g.subarray(0,x),this.leftOver=g.subarray(x,g.length)):(v=g.slice(0,x),this.leftOver=g.slice(x,g.length))),this.push({data:o.utf8decode(v),meta:p.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=f,s.inherits(m,c),m.prototype.processChunk=function(p){this.push({data:o.utf8encode(p.data),meta:p.meta})},o.Utf8EncodeWorker=m},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){var s=n("./support"),i=n("./base64"),l=n("./nodejsUtils"),c=n("./external");function u(h){return h}function d(h,x){for(var v=0;v<h.length;++v)x[v]=255&h.charCodeAt(v);return x}n("setimmediate"),o.newBlob=function(h,x){o.checkSupport("blob");try{return new Blob([h],{type:x})}catch{try{var v=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return v.append(h),v.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(h,x,v){var _=[],k=0,C=h.length;if(C<=v)return String.fromCharCode.apply(null,h);for(;k<C;)x==="array"||x==="nodebuffer"?_.push(String.fromCharCode.apply(null,h.slice(k,Math.min(k+v,C)))):_.push(String.fromCharCode.apply(null,h.subarray(k,Math.min(k+v,C)))),k+=v;return _.join("")},stringifyByChar:function(h){for(var x="",v=0;v<h.length;v++)x+=String.fromCharCode(h[v]);return x},applyCanBeUsed:{uint8array:(function(){try{return s.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return s.nodebuffer&&String.fromCharCode.apply(null,l.allocBuffer(1)).length===1}catch{return!1}})()}};function m(h){var x=65536,v=o.getTypeOf(h),_=!0;if(v==="uint8array"?_=f.applyCanBeUsed.uint8array:v==="nodebuffer"&&(_=f.applyCanBeUsed.nodebuffer),_)for(;1<x;)try{return f.stringifyByChunk(h,v,x)}catch{x=Math.floor(x/2)}return f.stringifyByChar(h)}function p(h,x){for(var v=0;v<h.length;v++)x[v]=h[v];return x}o.applyFromCharCode=m;var g={};g.string={string:u,array:function(h){return d(h,new Array(h.length))},arraybuffer:function(h){return g.string.uint8array(h).buffer},uint8array:function(h){return d(h,new Uint8Array(h.length))},nodebuffer:function(h){return d(h,l.allocBuffer(h.length))}},g.array={string:m,array:u,arraybuffer:function(h){return new Uint8Array(h).buffer},uint8array:function(h){return new Uint8Array(h)},nodebuffer:function(h){return l.newBufferFrom(h)}},g.arraybuffer={string:function(h){return m(new Uint8Array(h))},array:function(h){return p(new Uint8Array(h),new Array(h.byteLength))},arraybuffer:u,uint8array:function(h){return new Uint8Array(h)},nodebuffer:function(h){return l.newBufferFrom(new Uint8Array(h))}},g.uint8array={string:m,array:function(h){return p(h,new Array(h.length))},arraybuffer:function(h){return h.buffer},uint8array:u,nodebuffer:function(h){return l.newBufferFrom(h)}},g.nodebuffer={string:m,array:function(h){return p(h,new Array(h.length))},arraybuffer:function(h){return g.nodebuffer.uint8array(h).buffer},uint8array:function(h){return p(h,new Uint8Array(h.length))},nodebuffer:u},o.transformTo=function(h,x){if(x=x||"",!h)return x;o.checkSupport(h);var v=o.getTypeOf(x);return g[v][h](x)},o.resolve=function(h){for(var x=h.split("/"),v=[],_=0;_<x.length;_++){var k=x[_];k==="."||k===""&&_!==0&&_!==x.length-1||(k===".."?v.pop():v.push(k))}return v.join("/")},o.getTypeOf=function(h){return typeof h=="string"?"string":Object.prototype.toString.call(h)==="[object Array]"?"array":s.nodebuffer&&l.isBuffer(h)?"nodebuffer":s.uint8array&&h instanceof Uint8Array?"uint8array":s.arraybuffer&&h instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(h){if(!s[h.toLowerCase()])throw new Error(h+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(h){var x,v,_="";for(v=0;v<(h||"").length;v++)_+="\\x"+((x=h.charCodeAt(v))<16?"0":"")+x.toString(16).toUpperCase();return _},o.delay=function(h,x,v){setImmediate(function(){h.apply(v||null,x||[])})},o.inherits=function(h,x){function v(){}v.prototype=x.prototype,h.prototype=new v},o.extend=function(){var h,x,v={};for(h=0;h<arguments.length;h++)for(x in arguments[h])Object.prototype.hasOwnProperty.call(arguments[h],x)&&v[x]===void 0&&(v[x]=arguments[h][x]);return v},o.prepareContent=function(h,x,v,_,k){return c.Promise.resolve(x).then(function(C){return s.blob&&(C instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(C))!==-1)&&typeof FileReader<"u"?new c.Promise(function(j,z){var E=new FileReader;E.onload=function(A){j(A.target.result)},E.onerror=function(A){z(A.target.error)},E.readAsArrayBuffer(C)}):C}).then(function(C){var j=o.getTypeOf(C);return j?(j==="arraybuffer"?C=o.transformTo("uint8array",C):j==="string"&&(k?C=i.decode(C):v&&_!==!0&&(C=(function(z){return d(z,s.uint8array?new Uint8Array(z.length):new Array(z.length))})(C))),C):c.Promise.reject(new Error("Can't read the data of '"+h+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){var s=n("./reader/readerFor"),i=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 m=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(m)+", expected "+i.pretty(f)+")")}},isSignature:function(f,m){var p=this.reader.index;this.reader.setIndex(f);var g=this.reader.readString(4)===m;return this.reader.setIndex(p),g},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),m=u.uint8array?"uint8array":"array",p=i.transformTo(m,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,m,p,g=this.zip64EndOfCentralSize-44;0<g;)f=this.reader.readInt(2),m=this.reader.readInt(4),p=this.reader.readData(m),this.zip64ExtensibleData[f]={id:f,length:m,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,m;for(f=0;f<this.files.length;f++)m=this.files[f],this.reader.setIndex(m.localHeaderOffset),this.checkSignature(l.LOCAL_FILE_HEADER),m.readLocalPart(this.reader),m.handleUTF8(),m.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 m=f;if(this.checkSignature(l.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.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 g=m-p;if(0<g)this.isSignature(m,l.CENTRAL_FILE_HEADER)||(this.reader.zero=g);else if(g<0)throw new Error("Corrupted zip: missing "+Math.abs(g)+" bytes.")},prepareReader:function(f){this.reader=s(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){var s=n("./reader/readerFor"),i=n("./utils"),l=n("./compressedObject"),c=n("./crc32"),u=n("./utf8"),d=n("./compressions"),f=n("./support");function m(p,g){this.options=p,this.loadOptions=g}m.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(p){var g,h;if(p.skip(22),this.fileNameLength=p.readInt(2),h=p.readInt(2),this.fileName=p.readData(this.fileNameLength),p.skip(h),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((g=(function(x){for(var v in d)if(Object.prototype.hasOwnProperty.call(d,v)&&d[v].magic===x)return d[v];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new l(this.compressedSize,this.uncompressedSize,this.crc32,g,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 g=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(g),this.readExtraFields(p),this.parseZIP64ExtraField(p),this.fileComment=p.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var p=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),p==0&&(this.dosPermissions=63&this.externalFileAttributes),p==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var p=s(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(p){var g,h,x,v=p.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});p.index+4<v;)g=p.readInt(2),h=p.readInt(2),x=p.readData(h),this.extraFields[g]={id:g,length:h,value:x};p.setIndex(v)},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 g=this.findExtraFieldUnicodePath();if(g!==null)this.fileNameStr=g;else{var h=i.transformTo(p,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(h)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var v=i.transformTo(p,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(v)}}},findExtraFieldUnicodePath:function(){var p=this.extraFields[28789];if(p){var g=s(p.value);return g.readInt(1)!==1||c(this.fileName)!==g.readInt(4)?null:u.utf8decode(g.readData(p.length-5))}return null},findExtraFieldUnicodeComment:function(){var p=this.extraFields[25461];if(p){var g=s(p.value);return g.readInt(1)!==1||c(this.fileComment)!==g.readInt(4)?null:u.utf8decode(g.readData(p.length-5))}return null}},r.exports=m},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){function s(g,h,x){this.name=g,this.dir=x.dir,this.date=x.date,this.comment=x.comment,this.unixPermissions=x.unixPermissions,this.dosPermissions=x.dosPermissions,this._data=h,this._dataBinary=x.binary,this.options={compression:x.compression,compressionOptions:x.compressionOptions}}var i=n("./stream/StreamHelper"),l=n("./stream/DataWorker"),c=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");s.prototype={internalStream:function(g){var h=null,x="string";try{if(!g)throw new Error("No output type specified.");var v=(x=g.toLowerCase())==="string"||x==="text";x!=="binarystring"&&x!=="text"||(x="string"),h=this._decompressWorker();var _=!this._dataBinary;_&&!v&&(h=h.pipe(new c.Utf8EncodeWorker)),!_&&v&&(h=h.pipe(new c.Utf8DecodeWorker))}catch(k){(h=new d("error")).error(k)}return new i(h,x,"")},async:function(g,h){return this.internalStream(g).accumulate(h)},nodeStream:function(g,h){return this.internalStream(g||"nodebuffer").toNodejsStream(h)},_compressWorker:function(g,h){if(this._data instanceof u&&this._data.compression.magic===g.magic)return this._data.getCompressedWorker();var x=this._decompressWorker();return this._dataBinary||(x=x.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(x,g,h)},_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"],m=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},p=0;p<f.length;p++)s.prototype[f[p]]=m;r.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(s){var i,l,c=s.MutationObserver||s.WebKitMutationObserver;if(c){var u=0,d=new c(g),f=s.document.createTextNode("");d.observe(f,{characterData:!0}),i=function(){f.data=u=++u%2}}else if(s.setImmediate||s.MessageChannel===void 0)i="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var h=s.document.createElement("script");h.onreadystatechange=function(){g(),h.onreadystatechange=null,h.parentNode.removeChild(h),h=null},s.document.documentElement.appendChild(h)}:function(){setTimeout(g,0)};else{var m=new s.MessageChannel;m.port1.onmessage=g,i=function(){m.port2.postMessage(0)}}var p=[];function g(){var h,x;l=!0;for(var v=p.length;v;){for(x=p,p=[],h=-1;++h<v;)x[h]();v=p.length}l=!1}r.exports=function(h){p.push(h)!==1||l||i()}}).call(this,typeof Un<"u"?Un:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){var s=n("immediate");function i(){}var l={},c=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function f(v){if(typeof v!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,v!==i&&h(this,v)}function m(v,_,k){this.promise=v,typeof _=="function"&&(this.onFulfilled=_,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function p(v,_,k){s(function(){var C;try{C=_(k)}catch(j){return l.reject(v,j)}C===v?l.reject(v,new TypeError("Cannot resolve promise with itself")):l.resolve(v,C)})}function g(v){var _=v&&v.then;if(v&&(typeof v=="object"||typeof v=="function")&&typeof _=="function")return function(){_.apply(v,arguments)}}function h(v,_){var k=!1;function C(E){k||(k=!0,l.reject(v,E))}function j(E){k||(k=!0,l.resolve(v,E))}var z=x(function(){_(j,C)});z.status==="error"&&C(z.value)}function x(v,_){var k={};try{k.value=v(_),k.status="success"}catch(C){k.status="error",k.value=C}return k}(r.exports=f).prototype.finally=function(v){if(typeof v!="function")return this;var _=this.constructor;return this.then(function(k){return _.resolve(v()).then(function(){return k})},function(k){return _.resolve(v()).then(function(){throw k})})},f.prototype.catch=function(v){return this.then(null,v)},f.prototype.then=function(v,_){if(typeof v!="function"&&this.state===u||typeof _!="function"&&this.state===c)return this;var k=new this.constructor(i);return this.state!==d?p(k,this.state===u?v:_,this.outcome):this.queue.push(new m(k,v,_)),k},m.prototype.callFulfilled=function(v){l.resolve(this.promise,v)},m.prototype.otherCallFulfilled=function(v){p(this.promise,this.onFulfilled,v)},m.prototype.callRejected=function(v){l.reject(this.promise,v)},m.prototype.otherCallRejected=function(v){p(this.promise,this.onRejected,v)},l.resolve=function(v,_){var k=x(g,_);if(k.status==="error")return l.reject(v,k.value);var C=k.value;if(C)h(v,C);else{v.state=u,v.outcome=_;for(var j=-1,z=v.queue.length;++j<z;)v.queue[j].callFulfilled(_)}return v},l.reject=function(v,_){v.state=c,v.outcome=_;for(var k=-1,C=v.queue.length;++k<C;)v.queue[k].callRejected(_);return v},f.resolve=function(v){return v instanceof this?v:l.resolve(new this(i),v)},f.reject=function(v){var _=new this(i);return l.reject(_,v)},f.all=function(v){var _=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=v.length,C=!1;if(!k)return this.resolve([]);for(var j=new Array(k),z=0,E=-1,A=new this(i);++E<k;)O(v[E],E);return A;function O(R,q){_.resolve(R).then(function(S){j[q]=S,++z!==k||C||(C=!0,l.resolve(A,j))},function(S){C||(C=!0,l.reject(A,S))})}},f.race=function(v){var _=this;if(Object.prototype.toString.call(v)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=v.length,C=!1;if(!k)return this.resolve([]);for(var j=-1,z=new this(i);++j<k;)E=v[j],_.resolve(E).then(function(A){C||(C=!0,l.resolve(z,A))},function(A){C||(C=!0,l.reject(z,A))});var E;return z}},{immediate:36}],38:[function(n,r,o){var s={};(0,n("./lib/utils/common").assign)(s,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){var s=n("./zlib/deflate"),i=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/messages"),u=n("./zlib/zstream"),d=Object.prototype.toString,f=0,m=-1,p=0,g=8;function h(v){if(!(this instanceof h))return new h(v);this.options=i.assign({level:m,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:""},v||{});var _=this.options;_.raw&&0<_.windowBits?_.windowBits=-_.windowBits:_.gzip&&0<_.windowBits&&_.windowBits<16&&(_.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var k=s.deflateInit2(this.strm,_.level,_.method,_.windowBits,_.memLevel,_.strategy);if(k!==f)throw new Error(c[k]);if(_.header&&s.deflateSetHeader(this.strm,_.header),_.dictionary){var C;if(C=typeof _.dictionary=="string"?l.string2buf(_.dictionary):d.call(_.dictionary)==="[object ArrayBuffer]"?new Uint8Array(_.dictionary):_.dictionary,(k=s.deflateSetDictionary(this.strm,C))!==f)throw new Error(c[k]);this._dict_set=!0}}function x(v,_){var k=new h(_);if(k.push(v,!0),k.err)throw k.msg||c[k.err];return k.result}h.prototype.push=function(v,_){var k,C,j=this.strm,z=this.options.chunkSize;if(this.ended)return!1;C=_===~~_?_:_===!0?4:0,typeof v=="string"?j.input=l.string2buf(v):d.call(v)==="[object ArrayBuffer]"?j.input=new Uint8Array(v):j.input=v,j.next_in=0,j.avail_in=j.input.length;do{if(j.avail_out===0&&(j.output=new i.Buf8(z),j.next_out=0,j.avail_out=z),(k=s.deflate(j,C))!==1&&k!==f)return this.onEnd(k),!(this.ended=!0);j.avail_out!==0&&(j.avail_in!==0||C!==4&&C!==2)||(this.options.to==="string"?this.onData(l.buf2binstring(i.shrinkBuf(j.output,j.next_out))):this.onData(i.shrinkBuf(j.output,j.next_out)))}while((0<j.avail_in||j.avail_out===0)&&k!==1);return C===4?(k=s.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===f):C!==2||(this.onEnd(f),!(j.avail_out=0))},h.prototype.onData=function(v){this.chunks.push(v)},h.prototype.onEnd=function(v){v===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=v,this.msg=this.strm.msg},o.Deflate=h,o.deflate=x,o.deflateRaw=function(v,_){return(_=_||{}).raw=!0,x(v,_)},o.gzip=function(v,_){return(_=_||{}).gzip=!0,x(v,_)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){var s=n("./zlib/inflate"),i=n("./utils/common"),l=n("./utils/strings"),c=n("./zlib/constants"),u=n("./zlib/messages"),d=n("./zlib/zstream"),f=n("./zlib/gzheader"),m=Object.prototype.toString;function p(h){if(!(this instanceof p))return new p(h);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},h||{});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)||h&&h.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 v=s.inflateInit2(this.strm,x.windowBits);if(v!==c.Z_OK)throw new Error(u[v]);this.header=new f,s.inflateGetHeader(this.strm,this.header)}function g(h,x){var v=new p(x);if(v.push(h,!0),v.err)throw v.msg||u[v.err];return v.result}p.prototype.push=function(h,x){var v,_,k,C,j,z,E=this.strm,A=this.options.chunkSize,O=this.options.dictionary,R=!1;if(this.ended)return!1;_=x===~~x?x:x===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof h=="string"?E.input=l.binstring2buf(h):m.call(h)==="[object ArrayBuffer]"?E.input=new Uint8Array(h):E.input=h,E.next_in=0,E.avail_in=E.input.length;do{if(E.avail_out===0&&(E.output=new i.Buf8(A),E.next_out=0,E.avail_out=A),(v=s.inflate(E,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&O&&(z=typeof O=="string"?l.string2buf(O):m.call(O)==="[object ArrayBuffer]"?new Uint8Array(O):O,v=s.inflateSetDictionary(this.strm,z)),v===c.Z_BUF_ERROR&&R===!0&&(v=c.Z_OK,R=!1),v!==c.Z_STREAM_END&&v!==c.Z_OK)return this.onEnd(v),!(this.ended=!0);E.next_out&&(E.avail_out!==0&&v!==c.Z_STREAM_END&&(E.avail_in!==0||_!==c.Z_FINISH&&_!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=l.utf8border(E.output,E.next_out),C=E.next_out-k,j=l.buf2string(E.output,k),E.next_out=C,E.avail_out=A-C,C&&i.arraySet(E.output,E.output,k,C,0),this.onData(j)):this.onData(i.shrinkBuf(E.output,E.next_out)))),E.avail_in===0&&E.avail_out===0&&(R=!0)}while((0<E.avail_in||E.avail_out===0)&&v!==c.Z_STREAM_END);return v===c.Z_STREAM_END&&(_=c.Z_FINISH),_===c.Z_FINISH?(v=s.inflateEnd(this.strm),this.onEnd(v),this.ended=!0,v===c.Z_OK):_!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(E.avail_out=0))},p.prototype.onData=function(h){this.chunks.push(h)},p.prototype.onEnd=function(h){h===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=h,this.msg=this.strm.msg},o.Inflate=p,o.inflate=g,o.inflateRaw=function(h,x){return(x=x||{}).raw=!0,g(h,x)},o.ungzip=g},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(c){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var f in d)d.hasOwnProperty(f)&&(c[f]=d[f])}}return c},o.shrinkBuf=function(c,u){return c.length===u?c:c.subarray?c.subarray(0,u):(c.length=u,c)};var i={arraySet:function(c,u,d,f,m){if(u.subarray&&c.subarray)c.set(u.subarray(d,d+f),m);else for(var p=0;p<f;p++)c[m+p]=u[d+p]},flattenChunks:function(c){var u,d,f,m,p,g;for(u=f=0,d=c.length;u<d;u++)f+=c[u].length;for(g=new Uint8Array(f),u=m=0,d=c.length;u<d;u++)p=c[u],g.set(p,m),m+=p.length;return g}},l={arraySet:function(c,u,d,f,m){for(var p=0;p<f;p++)c[m+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,i)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,l))},o.setTyped(s)},{}],42:[function(n,r,o){var s=n("./common"),i=!0,l=!0;try{String.fromCharCode.apply(null,[0])}catch{i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{l=!1}for(var c=new s.Buf8(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(f,m){if(m<65537&&(f.subarray&&l||!f.subarray&&i))return String.fromCharCode.apply(null,s.shrinkBuf(f,m));for(var p="",g=0;g<m;g++)p+=String.fromCharCode(f[g]);return p}c[254]=c[254]=1,o.string2buf=function(f){var m,p,g,h,x,v=f.length,_=0;for(h=0;h<v;h++)(64512&(p=f.charCodeAt(h)))==55296&&h+1<v&&(64512&(g=f.charCodeAt(h+1)))==56320&&(p=65536+(p-55296<<10)+(g-56320),h++),_+=p<128?1:p<2048?2:p<65536?3:4;for(m=new s.Buf8(_),h=x=0;x<_;h++)(64512&(p=f.charCodeAt(h)))==55296&&h+1<v&&(64512&(g=f.charCodeAt(h+1)))==56320&&(p=65536+(p-55296<<10)+(g-56320),h++),p<128?m[x++]=p:(p<2048?m[x++]=192|p>>>6:(p<65536?m[x++]=224|p>>>12:(m[x++]=240|p>>>18,m[x++]=128|p>>>12&63),m[x++]=128|p>>>6&63),m[x++]=128|63&p);return m},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var m=new s.Buf8(f.length),p=0,g=m.length;p<g;p++)m[p]=f.charCodeAt(p);return m},o.buf2string=function(f,m){var p,g,h,x,v=m||f.length,_=new Array(2*v);for(p=g=0;p<v;)if((h=f[p++])<128)_[g++]=h;else if(4<(x=c[h]))_[g++]=65533,p+=x-1;else{for(h&=x===2?31:x===3?15:7;1<x&&p<v;)h=h<<6|63&f[p++],x--;1<x?_[g++]=65533:h<65536?_[g++]=h:(h-=65536,_[g++]=55296|h>>10&1023,_[g++]=56320|1023&h)}return d(_,g)},o.utf8border=function(f,m){var p;for((m=m||f.length)>f.length&&(m=f.length),p=m-1;0<=p&&(192&f[p])==128;)p--;return p<0||p===0?m:p+c[f[p]]>m?p:m}},{"./common":41}],43:[function(n,r,o){r.exports=function(s,i,l,c){for(var u=65535&s|0,d=s>>>16&65535|0,f=0;l!==0;){for(l-=f=2e3<l?2e3:l;d=d+(u=u+i[c++]|0)|0,--f;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(n,r,o){r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){var s=(function(){for(var i,l=[],c=0;c<256;c++){i=c;for(var u=0;u<8;u++)i=1&i?3988292384^i>>>1:i>>>1;l[c]=i}return l})();r.exports=function(i,l,c,u){var d=s,f=u+c;i^=-1;for(var m=u;m<f;m++)i=i>>>8^d[255&(i^l[m])];return-1^i}},{}],46:[function(n,r,o){var s,i=n("../utils/common"),l=n("./trees"),c=n("./adler32"),u=n("./crc32"),d=n("./messages"),f=0,m=4,p=0,g=-2,h=-1,x=4,v=2,_=8,k=9,C=286,j=30,z=19,E=2*C+1,A=15,O=3,R=258,q=R+O+1,S=42,I=113,b=1,P=2,H=3,L=4;function B(w,Y){return w.msg=d[Y],Y}function K(w){return(w<<1)-(4<w?9:0)}function se(w){for(var Y=w.length;0<=--Y;)w[Y]=0}function U(w){var Y=w.state,V=Y.pending;V>w.avail_out&&(V=w.avail_out),V!==0&&(i.arraySet(w.output,Y.pending_buf,Y.pending_out,V,w.next_out),w.next_out+=V,Y.pending_out+=V,w.total_out+=V,w.avail_out-=V,Y.pending-=V,Y.pending===0&&(Y.pending_out=0))}function $(w,Y){l._tr_flush_block(w,0<=w.block_start?w.block_start:-1,w.strstart-w.block_start,Y),w.block_start=w.strstart,U(w.strm)}function oe(w,Y){w.pending_buf[w.pending++]=Y}function ee(w,Y){w.pending_buf[w.pending++]=Y>>>8&255,w.pending_buf[w.pending++]=255&Y}function J(w,Y){var V,T,N=w.max_chain_length,D=w.strstart,F=w.prev_length,W=w.nice_match,M=w.strstart>w.w_size-q?w.strstart-(w.w_size-q):0,Q=w.window,re=w.w_mask,te=w.prev,pe=w.strstart+R,Ae=Q[D+F-1],ke=Q[D+F];w.prev_length>=w.good_match&&(N>>=2),W>w.lookahead&&(W=w.lookahead);do if(Q[(V=Y)+F]===ke&&Q[V+F-1]===Ae&&Q[V]===Q[D]&&Q[++V]===Q[D+1]){D+=2,V++;do;while(Q[++D]===Q[++V]&&Q[++D]===Q[++V]&&Q[++D]===Q[++V]&&Q[++D]===Q[++V]&&Q[++D]===Q[++V]&&Q[++D]===Q[++V]&&Q[++D]===Q[++V]&&Q[++D]===Q[++V]&&D<pe);if(T=R-(pe-D),D=pe-R,F<T){if(w.match_start=Y,W<=(F=T))break;Ae=Q[D+F-1],ke=Q[D+F]}}while((Y=te[Y&re])>M&&--N!=0);return F<=w.lookahead?F:w.lookahead}function ue(w){var Y,V,T,N,D,F,W,M,Q,re,te=w.w_size;do{if(N=w.window_size-w.lookahead-w.strstart,w.strstart>=te+(te-q)){for(i.arraySet(w.window,w.window,te,te,0),w.match_start-=te,w.strstart-=te,w.block_start-=te,Y=V=w.hash_size;T=w.head[--Y],w.head[Y]=te<=T?T-te:0,--V;);for(Y=V=te;T=w.prev[--Y],w.prev[Y]=te<=T?T-te:0,--V;);N+=te}if(w.strm.avail_in===0)break;if(F=w.strm,W=w.window,M=w.strstart+w.lookahead,Q=N,re=void 0,re=F.avail_in,Q<re&&(re=Q),V=re===0?0:(F.avail_in-=re,i.arraySet(W,F.input,F.next_in,re,M),F.state.wrap===1?F.adler=c(F.adler,W,re,M):F.state.wrap===2&&(F.adler=u(F.adler,W,re,M)),F.next_in+=re,F.total_in+=re,re),w.lookahead+=V,w.lookahead+w.insert>=O)for(D=w.strstart-w.insert,w.ins_h=w.window[D],w.ins_h=(w.ins_h<<w.hash_shift^w.window[D+1])&w.hash_mask;w.insert&&(w.ins_h=(w.ins_h<<w.hash_shift^w.window[D+O-1])&w.hash_mask,w.prev[D&w.w_mask]=w.head[w.ins_h],w.head[w.ins_h]=D,D++,w.insert--,!(w.lookahead+w.insert<O)););}while(w.lookahead<q&&w.strm.avail_in!==0)}function X(w,Y){for(var V,T;;){if(w.lookahead<q){if(ue(w),w.lookahead<q&&Y===f)return b;if(w.lookahead===0)break}if(V=0,w.lookahead>=O&&(w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+O-1])&w.hash_mask,V=w.prev[w.strstart&w.w_mask]=w.head[w.ins_h],w.head[w.ins_h]=w.strstart),V!==0&&w.strstart-V<=w.w_size-q&&(w.match_length=J(w,V)),w.match_length>=O)if(T=l._tr_tally(w,w.strstart-w.match_start,w.match_length-O),w.lookahead-=w.match_length,w.match_length<=w.max_lazy_match&&w.lookahead>=O){for(w.match_length--;w.strstart++,w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+O-1])&w.hash_mask,V=w.prev[w.strstart&w.w_mask]=w.head[w.ins_h],w.head[w.ins_h]=w.strstart,--w.match_length!=0;);w.strstart++}else w.strstart+=w.match_length,w.match_length=0,w.ins_h=w.window[w.strstart],w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+1])&w.hash_mask;else T=l._tr_tally(w,0,w.window[w.strstart]),w.lookahead--,w.strstart++;if(T&&($(w,!1),w.strm.avail_out===0))return b}return w.insert=w.strstart<O-1?w.strstart:O-1,Y===m?($(w,!0),w.strm.avail_out===0?H:L):w.last_lit&&($(w,!1),w.strm.avail_out===0)?b:P}function ie(w,Y){for(var V,T,N;;){if(w.lookahead<q){if(ue(w),w.lookahead<q&&Y===f)return b;if(w.lookahead===0)break}if(V=0,w.lookahead>=O&&(w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+O-1])&w.hash_mask,V=w.prev[w.strstart&w.w_mask]=w.head[w.ins_h],w.head[w.ins_h]=w.strstart),w.prev_length=w.match_length,w.prev_match=w.match_start,w.match_length=O-1,V!==0&&w.prev_length<w.max_lazy_match&&w.strstart-V<=w.w_size-q&&(w.match_length=J(w,V),w.match_length<=5&&(w.strategy===1||w.match_length===O&&4096<w.strstart-w.match_start)&&(w.match_length=O-1)),w.prev_length>=O&&w.match_length<=w.prev_length){for(N=w.strstart+w.lookahead-O,T=l._tr_tally(w,w.strstart-1-w.prev_match,w.prev_length-O),w.lookahead-=w.prev_length-1,w.prev_length-=2;++w.strstart<=N&&(w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+O-1])&w.hash_mask,V=w.prev[w.strstart&w.w_mask]=w.head[w.ins_h],w.head[w.ins_h]=w.strstart),--w.prev_length!=0;);if(w.match_available=0,w.match_length=O-1,w.strstart++,T&&($(w,!1),w.strm.avail_out===0))return b}else if(w.match_available){if((T=l._tr_tally(w,0,w.window[w.strstart-1]))&&$(w,!1),w.strstart++,w.lookahead--,w.strm.avail_out===0)return b}else w.match_available=1,w.strstart++,w.lookahead--}return w.match_available&&(T=l._tr_tally(w,0,w.window[w.strstart-1]),w.match_available=0),w.insert=w.strstart<O-1?w.strstart:O-1,Y===m?($(w,!0),w.strm.avail_out===0?H:L):w.last_lit&&($(w,!1),w.strm.avail_out===0)?b:P}function ae(w,Y,V,T,N){this.good_length=w,this.max_lazy=Y,this.nice_length=V,this.max_chain=T,this.func=N}function he(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=_,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 i.Buf16(2*E),this.dyn_dtree=new i.Buf16(2*(2*j+1)),this.bl_tree=new i.Buf16(2*(2*z+1)),se(this.dyn_ltree),se(this.dyn_dtree),se(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(A+1),this.heap=new i.Buf16(2*C+1),se(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*C+1),se(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(w){var Y;return w&&w.state?(w.total_in=w.total_out=0,w.data_type=v,(Y=w.state).pending=0,Y.pending_out=0,Y.wrap<0&&(Y.wrap=-Y.wrap),Y.status=Y.wrap?S:I,w.adler=Y.wrap===2?0:1,Y.last_flush=f,l._tr_init(Y),p):B(w,g)}function we(w){var Y=fe(w);return Y===p&&(function(V){V.window_size=2*V.w_size,se(V.head),V.max_lazy_match=s[V.level].max_lazy,V.good_match=s[V.level].good_length,V.nice_match=s[V.level].nice_length,V.max_chain_length=s[V.level].max_chain,V.strstart=0,V.block_start=0,V.lookahead=0,V.insert=0,V.match_length=V.prev_length=O-1,V.match_available=0,V.ins_h=0})(w.state),Y}function Te(w,Y,V,T,N,D){if(!w)return g;var F=1;if(Y===h&&(Y=6),T<0?(F=0,T=-T):15<T&&(F=2,T-=16),N<1||k<N||V!==_||T<8||15<T||Y<0||9<Y||D<0||x<D)return B(w,g);T===8&&(T=9);var W=new he;return(w.state=W).strm=w,W.wrap=F,W.gzhead=null,W.w_bits=T,W.w_size=1<<W.w_bits,W.w_mask=W.w_size-1,W.hash_bits=N+7,W.hash_size=1<<W.hash_bits,W.hash_mask=W.hash_size-1,W.hash_shift=~~((W.hash_bits+O-1)/O),W.window=new i.Buf8(2*W.w_size),W.head=new i.Buf16(W.hash_size),W.prev=new i.Buf16(W.w_size),W.lit_bufsize=1<<N+6,W.pending_buf_size=4*W.lit_bufsize,W.pending_buf=new i.Buf8(W.pending_buf_size),W.d_buf=1*W.lit_bufsize,W.l_buf=3*W.lit_bufsize,W.level=Y,W.strategy=D,W.method=V,we(w)}s=[new ae(0,0,0,0,function(w,Y){var V=65535;for(V>w.pending_buf_size-5&&(V=w.pending_buf_size-5);;){if(w.lookahead<=1){if(ue(w),w.lookahead===0&&Y===f)return b;if(w.lookahead===0)break}w.strstart+=w.lookahead,w.lookahead=0;var T=w.block_start+V;if((w.strstart===0||w.strstart>=T)&&(w.lookahead=w.strstart-T,w.strstart=T,$(w,!1),w.strm.avail_out===0)||w.strstart-w.block_start>=w.w_size-q&&($(w,!1),w.strm.avail_out===0))return b}return w.insert=0,Y===m?($(w,!0),w.strm.avail_out===0?H:L):(w.strstart>w.block_start&&($(w,!1),w.strm.avail_out),b)}),new ae(4,4,8,4,X),new ae(4,5,16,8,X),new ae(4,6,32,32,X),new ae(4,4,16,16,ie),new ae(8,16,32,32,ie),new ae(8,16,128,128,ie),new ae(8,32,128,256,ie),new ae(32,128,258,1024,ie),new ae(32,258,258,4096,ie)],o.deflateInit=function(w,Y){return Te(w,Y,_,15,8,0)},o.deflateInit2=Te,o.deflateReset=we,o.deflateResetKeep=fe,o.deflateSetHeader=function(w,Y){return w&&w.state?w.state.wrap!==2?g:(w.state.gzhead=Y,p):g},o.deflate=function(w,Y){var V,T,N,D;if(!w||!w.state||5<Y||Y<0)return w?B(w,g):g;if(T=w.state,!w.output||!w.input&&w.avail_in!==0||T.status===666&&Y!==m)return B(w,w.avail_out===0?-5:g);if(T.strm=w,V=T.last_flush,T.last_flush=Y,T.status===S)if(T.wrap===2)w.adler=0,oe(T,31),oe(T,139),oe(T,8),T.gzhead?(oe(T,(T.gzhead.text?1:0)+(T.gzhead.hcrc?2:0)+(T.gzhead.extra?4:0)+(T.gzhead.name?8:0)+(T.gzhead.comment?16:0)),oe(T,255&T.gzhead.time),oe(T,T.gzhead.time>>8&255),oe(T,T.gzhead.time>>16&255),oe(T,T.gzhead.time>>24&255),oe(T,T.level===9?2:2<=T.strategy||T.level<2?4:0),oe(T,255&T.gzhead.os),T.gzhead.extra&&T.gzhead.extra.length&&(oe(T,255&T.gzhead.extra.length),oe(T,T.gzhead.extra.length>>8&255)),T.gzhead.hcrc&&(w.adler=u(w.adler,T.pending_buf,T.pending,0)),T.gzindex=0,T.status=69):(oe(T,0),oe(T,0),oe(T,0),oe(T,0),oe(T,0),oe(T,T.level===9?2:2<=T.strategy||T.level<2?4:0),oe(T,3),T.status=I);else{var F=_+(T.w_bits-8<<4)<<8;F|=(2<=T.strategy||T.level<2?0:T.level<6?1:T.level===6?2:3)<<6,T.strstart!==0&&(F|=32),F+=31-F%31,T.status=I,ee(T,F),T.strstart!==0&&(ee(T,w.adler>>>16),ee(T,65535&w.adler)),w.adler=1}if(T.status===69)if(T.gzhead.extra){for(N=T.pending;T.gzindex<(65535&T.gzhead.extra.length)&&(T.pending!==T.pending_buf_size||(T.gzhead.hcrc&&T.pending>N&&(w.adler=u(w.adler,T.pending_buf,T.pending-N,N)),U(w),N=T.pending,T.pending!==T.pending_buf_size));)oe(T,255&T.gzhead.extra[T.gzindex]),T.gzindex++;T.gzhead.hcrc&&T.pending>N&&(w.adler=u(w.adler,T.pending_buf,T.pending-N,N)),T.gzindex===T.gzhead.extra.length&&(T.gzindex=0,T.status=73)}else T.status=73;if(T.status===73)if(T.gzhead.name){N=T.pending;do{if(T.pending===T.pending_buf_size&&(T.gzhead.hcrc&&T.pending>N&&(w.adler=u(w.adler,T.pending_buf,T.pending-N,N)),U(w),N=T.pending,T.pending===T.pending_buf_size)){D=1;break}D=T.gzindex<T.gzhead.name.length?255&T.gzhead.name.charCodeAt(T.gzindex++):0,oe(T,D)}while(D!==0);T.gzhead.hcrc&&T.pending>N&&(w.adler=u(w.adler,T.pending_buf,T.pending-N,N)),D===0&&(T.gzindex=0,T.status=91)}else T.status=91;if(T.status===91)if(T.gzhead.comment){N=T.pending;do{if(T.pending===T.pending_buf_size&&(T.gzhead.hcrc&&T.pending>N&&(w.adler=u(w.adler,T.pending_buf,T.pending-N,N)),U(w),N=T.pending,T.pending===T.pending_buf_size)){D=1;break}D=T.gzindex<T.gzhead.comment.length?255&T.gzhead.comment.charCodeAt(T.gzindex++):0,oe(T,D)}while(D!==0);T.gzhead.hcrc&&T.pending>N&&(w.adler=u(w.adler,T.pending_buf,T.pending-N,N)),D===0&&(T.status=103)}else T.status=103;if(T.status===103&&(T.gzhead.hcrc?(T.pending+2>T.pending_buf_size&&U(w),T.pending+2<=T.pending_buf_size&&(oe(T,255&w.adler),oe(T,w.adler>>8&255),w.adler=0,T.status=I)):T.status=I),T.pending!==0){if(U(w),w.avail_out===0)return T.last_flush=-1,p}else if(w.avail_in===0&&K(Y)<=K(V)&&Y!==m)return B(w,-5);if(T.status===666&&w.avail_in!==0)return B(w,-5);if(w.avail_in!==0||T.lookahead!==0||Y!==f&&T.status!==666){var W=T.strategy===2?(function(M,Q){for(var re;;){if(M.lookahead===0&&(ue(M),M.lookahead===0)){if(Q===f)return b;break}if(M.match_length=0,re=l._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++,re&&($(M,!1),M.strm.avail_out===0))return b}return M.insert=0,Q===m?($(M,!0),M.strm.avail_out===0?H:L):M.last_lit&&($(M,!1),M.strm.avail_out===0)?b:P})(T,Y):T.strategy===3?(function(M,Q){for(var re,te,pe,Ae,ke=M.window;;){if(M.lookahead<=R){if(ue(M),M.lookahead<=R&&Q===f)return b;if(M.lookahead===0)break}if(M.match_length=0,M.lookahead>=O&&0<M.strstart&&(te=ke[pe=M.strstart-1])===ke[++pe]&&te===ke[++pe]&&te===ke[++pe]){Ae=M.strstart+R;do;while(te===ke[++pe]&&te===ke[++pe]&&te===ke[++pe]&&te===ke[++pe]&&te===ke[++pe]&&te===ke[++pe]&&te===ke[++pe]&&te===ke[++pe]&&pe<Ae);M.match_length=R-(Ae-pe),M.match_length>M.lookahead&&(M.match_length=M.lookahead)}if(M.match_length>=O?(re=l._tr_tally(M,1,M.match_length-O),M.lookahead-=M.match_length,M.strstart+=M.match_length,M.match_length=0):(re=l._tr_tally(M,0,M.window[M.strstart]),M.lookahead--,M.strstart++),re&&($(M,!1),M.strm.avail_out===0))return b}return M.insert=0,Q===m?($(M,!0),M.strm.avail_out===0?H:L):M.last_lit&&($(M,!1),M.strm.avail_out===0)?b:P})(T,Y):s[T.level].func(T,Y);if(W!==H&&W!==L||(T.status=666),W===b||W===H)return w.avail_out===0&&(T.last_flush=-1),p;if(W===P&&(Y===1?l._tr_align(T):Y!==5&&(l._tr_stored_block(T,0,0,!1),Y===3&&(se(T.head),T.lookahead===0&&(T.strstart=0,T.block_start=0,T.insert=0))),U(w),w.avail_out===0))return T.last_flush=-1,p}return Y!==m?p:T.wrap<=0?1:(T.wrap===2?(oe(T,255&w.adler),oe(T,w.adler>>8&255),oe(T,w.adler>>16&255),oe(T,w.adler>>24&255),oe(T,255&w.total_in),oe(T,w.total_in>>8&255),oe(T,w.total_in>>16&255),oe(T,w.total_in>>24&255)):(ee(T,w.adler>>>16),ee(T,65535&w.adler)),U(w),0<T.wrap&&(T.wrap=-T.wrap),T.pending!==0?p:1)},o.deflateEnd=function(w){var Y;return w&&w.state?(Y=w.state.status)!==S&&Y!==69&&Y!==73&&Y!==91&&Y!==103&&Y!==I&&Y!==666?B(w,g):(w.state=null,Y===I?B(w,-3):p):g},o.deflateSetDictionary=function(w,Y){var V,T,N,D,F,W,M,Q,re=Y.length;if(!w||!w.state||(D=(V=w.state).wrap)===2||D===1&&V.status!==S||V.lookahead)return g;for(D===1&&(w.adler=c(w.adler,Y,re,0)),V.wrap=0,re>=V.w_size&&(D===0&&(se(V.head),V.strstart=0,V.block_start=0,V.insert=0),Q=new i.Buf8(V.w_size),i.arraySet(Q,Y,re-V.w_size,V.w_size,0),Y=Q,re=V.w_size),F=w.avail_in,W=w.next_in,M=w.input,w.avail_in=re,w.next_in=0,w.input=Y,ue(V);V.lookahead>=O;){for(T=V.strstart,N=V.lookahead-(O-1);V.ins_h=(V.ins_h<<V.hash_shift^V.window[T+O-1])&V.hash_mask,V.prev[T&V.w_mask]=V.head[V.ins_h],V.head[V.ins_h]=T,T++,--N;);V.strstart=T,V.lookahead=O-1,ue(V)}return V.strstart+=V.lookahead,V.block_start=V.strstart,V.insert=V.lookahead,V.lookahead=0,V.match_length=V.prev_length=O-1,V.match_available=0,w.next_in=W,w.input=M,w.avail_in=F,V.wrap=D,p},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){r.exports=function(s,i){var l,c,u,d,f,m,p,g,h,x,v,_,k,C,j,z,E,A,O,R,q,S,I,b,P;l=s.state,c=s.next_in,b=s.input,u=c+(s.avail_in-5),d=s.next_out,P=s.output,f=d-(i-s.avail_out),m=d+(s.avail_out-257),p=l.dmax,g=l.wsize,h=l.whave,x=l.wnext,v=l.window,_=l.hold,k=l.bits,C=l.lencode,j=l.distcode,z=(1<<l.lenbits)-1,E=(1<<l.distbits)-1;e:do{k<15&&(_+=b[c++]<<k,k+=8,_+=b[c++]<<k,k+=8),A=C[_&z];t:for(;;){if(_>>>=O=A>>>24,k-=O,(O=A>>>16&255)===0)P[d++]=65535&A;else{if(!(16&O)){if((64&O)==0){A=C[(65535&A)+(_&(1<<O)-1)];continue t}if(32&O){l.mode=12;break e}s.msg="invalid literal/length code",l.mode=30;break e}R=65535&A,(O&=15)&&(k<O&&(_+=b[c++]<<k,k+=8),R+=_&(1<<O)-1,_>>>=O,k-=O),k<15&&(_+=b[c++]<<k,k+=8,_+=b[c++]<<k,k+=8),A=j[_&E];n:for(;;){if(_>>>=O=A>>>24,k-=O,!(16&(O=A>>>16&255))){if((64&O)==0){A=j[(65535&A)+(_&(1<<O)-1)];continue n}s.msg="invalid distance code",l.mode=30;break e}if(q=65535&A,k<(O&=15)&&(_+=b[c++]<<k,(k+=8)<O&&(_+=b[c++]<<k,k+=8)),p<(q+=_&(1<<O)-1)){s.msg="invalid distance too far back",l.mode=30;break e}if(_>>>=O,k-=O,(O=d-f)<q){if(h<(O=q-O)&&l.sane){s.msg="invalid distance too far back",l.mode=30;break e}if(I=v,(S=0)===x){if(S+=g-O,O<R){for(R-=O;P[d++]=v[S++],--O;);S=d-q,I=P}}else if(x<O){if(S+=g+x-O,(O-=x)<R){for(R-=O;P[d++]=v[S++],--O;);if(S=0,x<R){for(R-=O=x;P[d++]=v[S++],--O;);S=d-q,I=P}}}else if(S+=x-O,O<R){for(R-=O;P[d++]=v[S++],--O;);S=d-q,I=P}for(;2<R;)P[d++]=I[S++],P[d++]=I[S++],P[d++]=I[S++],R-=3;R&&(P[d++]=I[S++],1<R&&(P[d++]=I[S++]))}else{for(S=d-q;P[d++]=P[S++],P[d++]=P[S++],P[d++]=P[S++],2<(R-=3););R&&(P[d++]=P[S++],1<R&&(P[d++]=P[S++]))}break}}break}}while(c<u&&d<m);c-=R=k>>3,_&=(1<<(k-=R<<3))-1,s.next_in=c,s.next_out=d,s.avail_in=c<u?u-c+5:5-(c-u),s.avail_out=d<m?m-d+257:257-(d-m),l.hold=_,l.bits=k}},{}],49:[function(n,r,o){var s=n("../utils/common"),i=n("./adler32"),l=n("./crc32"),c=n("./inffast"),u=n("./inftrees"),d=1,f=2,m=0,p=-2,g=1,h=852,x=592;function v(S){return(S>>>24&255)+(S>>>8&65280)+((65280&S)<<8)+((255&S)<<24)}function _(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function k(S){var I;return S&&S.state?(I=S.state,S.total_in=S.total_out=I.total=0,S.msg="",I.wrap&&(S.adler=1&I.wrap),I.mode=g,I.last=0,I.havedict=0,I.dmax=32768,I.head=null,I.hold=0,I.bits=0,I.lencode=I.lendyn=new s.Buf32(h),I.distcode=I.distdyn=new s.Buf32(x),I.sane=1,I.back=-1,m):p}function C(S){var I;return S&&S.state?((I=S.state).wsize=0,I.whave=0,I.wnext=0,k(S)):p}function j(S,I){var b,P;return S&&S.state?(P=S.state,I<0?(b=0,I=-I):(b=1+(I>>4),I<48&&(I&=15)),I&&(I<8||15<I)?p:(P.window!==null&&P.wbits!==I&&(P.window=null),P.wrap=b,P.wbits=I,C(S))):p}function z(S,I){var b,P;return S?(P=new _,(S.state=P).window=null,(b=j(S,I))!==m&&(S.state=null),b):p}var E,A,O=!0;function R(S){if(O){var I;for(E=new s.Buf32(512),A=new s.Buf32(32),I=0;I<144;)S.lens[I++]=8;for(;I<256;)S.lens[I++]=9;for(;I<280;)S.lens[I++]=7;for(;I<288;)S.lens[I++]=8;for(u(d,S.lens,0,288,E,0,S.work,{bits:9}),I=0;I<32;)S.lens[I++]=5;u(f,S.lens,0,32,A,0,S.work,{bits:5}),O=!1}S.lencode=E,S.lenbits=9,S.distcode=A,S.distbits=5}function q(S,I,b,P){var H,L=S.state;return L.window===null&&(L.wsize=1<<L.wbits,L.wnext=0,L.whave=0,L.window=new s.Buf8(L.wsize)),P>=L.wsize?(s.arraySet(L.window,I,b-L.wsize,L.wsize,0),L.wnext=0,L.whave=L.wsize):(P<(H=L.wsize-L.wnext)&&(H=P),s.arraySet(L.window,I,b-P,H,L.wnext),(P-=H)?(s.arraySet(L.window,I,b-P,P,0),L.wnext=P,L.whave=L.wsize):(L.wnext+=H,L.wnext===L.wsize&&(L.wnext=0),L.whave<L.wsize&&(L.whave+=H))),0}o.inflateReset=C,o.inflateReset2=j,o.inflateResetKeep=k,o.inflateInit=function(S){return z(S,15)},o.inflateInit2=z,o.inflate=function(S,I){var b,P,H,L,B,K,se,U,$,oe,ee,J,ue,X,ie,ae,he,fe,we,Te,w,Y,V,T,N=0,D=new s.Buf8(4),F=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!S||!S.state||!S.output||!S.input&&S.avail_in!==0)return p;(b=S.state).mode===12&&(b.mode=13),B=S.next_out,H=S.output,se=S.avail_out,L=S.next_in,P=S.input,K=S.avail_in,U=b.hold,$=b.bits,oe=K,ee=se,Y=m;e:for(;;)switch(b.mode){case g:if(b.wrap===0){b.mode=13;break}for(;$<16;){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}if(2&b.wrap&&U===35615){D[b.check=0]=255&U,D[1]=U>>>8&255,b.check=l(b.check,D,2,0),$=U=0,b.mode=2;break}if(b.flags=0,b.head&&(b.head.done=!1),!(1&b.wrap)||(((255&U)<<8)+(U>>8))%31){S.msg="incorrect header check",b.mode=30;break}if((15&U)!=8){S.msg="unknown compression method",b.mode=30;break}if($-=4,w=8+(15&(U>>>=4)),b.wbits===0)b.wbits=w;else if(w>b.wbits){S.msg="invalid window size",b.mode=30;break}b.dmax=1<<w,S.adler=b.check=1,b.mode=512&U?10:12,$=U=0;break;case 2:for(;$<16;){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}if(b.flags=U,(255&b.flags)!=8){S.msg="unknown compression method",b.mode=30;break}if(57344&b.flags){S.msg="unknown header flags set",b.mode=30;break}b.head&&(b.head.text=U>>8&1),512&b.flags&&(D[0]=255&U,D[1]=U>>>8&255,b.check=l(b.check,D,2,0)),$=U=0,b.mode=3;case 3:for(;$<32;){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}b.head&&(b.head.time=U),512&b.flags&&(D[0]=255&U,D[1]=U>>>8&255,D[2]=U>>>16&255,D[3]=U>>>24&255,b.check=l(b.check,D,4,0)),$=U=0,b.mode=4;case 4:for(;$<16;){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}b.head&&(b.head.xflags=255&U,b.head.os=U>>8),512&b.flags&&(D[0]=255&U,D[1]=U>>>8&255,b.check=l(b.check,D,2,0)),$=U=0,b.mode=5;case 5:if(1024&b.flags){for(;$<16;){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}b.length=U,b.head&&(b.head.extra_len=U),512&b.flags&&(D[0]=255&U,D[1]=U>>>8&255,b.check=l(b.check,D,2,0)),$=U=0}else b.head&&(b.head.extra=null);b.mode=6;case 6:if(1024&b.flags&&(K<(J=b.length)&&(J=K),J&&(b.head&&(w=b.head.extra_len-b.length,b.head.extra||(b.head.extra=new Array(b.head.extra_len)),s.arraySet(b.head.extra,P,L,J,w)),512&b.flags&&(b.check=l(b.check,P,J,L)),K-=J,L+=J,b.length-=J),b.length))break e;b.length=0,b.mode=7;case 7:if(2048&b.flags){if(K===0)break e;for(J=0;w=P[L+J++],b.head&&w&&b.length<65536&&(b.head.name+=String.fromCharCode(w)),w&&J<K;);if(512&b.flags&&(b.check=l(b.check,P,J,L)),K-=J,L+=J,w)break e}else b.head&&(b.head.name=null);b.length=0,b.mode=8;case 8:if(4096&b.flags){if(K===0)break e;for(J=0;w=P[L+J++],b.head&&w&&b.length<65536&&(b.head.comment+=String.fromCharCode(w)),w&&J<K;);if(512&b.flags&&(b.check=l(b.check,P,J,L)),K-=J,L+=J,w)break e}else b.head&&(b.head.comment=null);b.mode=9;case 9:if(512&b.flags){for(;$<16;){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}if(U!==(65535&b.check)){S.msg="header crc mismatch",b.mode=30;break}$=U=0}b.head&&(b.head.hcrc=b.flags>>9&1,b.head.done=!0),S.adler=b.check=0,b.mode=12;break;case 10:for(;$<32;){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}S.adler=b.check=v(U),$=U=0,b.mode=11;case 11:if(b.havedict===0)return S.next_out=B,S.avail_out=se,S.next_in=L,S.avail_in=K,b.hold=U,b.bits=$,2;S.adler=b.check=1,b.mode=12;case 12:if(I===5||I===6)break e;case 13:if(b.last){U>>>=7&$,$-=7&$,b.mode=27;break}for(;$<3;){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}switch(b.last=1&U,$-=1,3&(U>>>=1)){case 0:b.mode=14;break;case 1:if(R(b),b.mode=20,I!==6)break;U>>>=2,$-=2;break e;case 2:b.mode=17;break;case 3:S.msg="invalid block type",b.mode=30}U>>>=2,$-=2;break;case 14:for(U>>>=7&$,$-=7&$;$<32;){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}if((65535&U)!=(U>>>16^65535)){S.msg="invalid stored block lengths",b.mode=30;break}if(b.length=65535&U,$=U=0,b.mode=15,I===6)break e;case 15:b.mode=16;case 16:if(J=b.length){if(K<J&&(J=K),se<J&&(J=se),J===0)break e;s.arraySet(H,P,L,J,B),K-=J,L+=J,se-=J,B+=J,b.length-=J;break}b.mode=12;break;case 17:for(;$<14;){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}if(b.nlen=257+(31&U),U>>>=5,$-=5,b.ndist=1+(31&U),U>>>=5,$-=5,b.ncode=4+(15&U),U>>>=4,$-=4,286<b.nlen||30<b.ndist){S.msg="too many length or distance symbols",b.mode=30;break}b.have=0,b.mode=18;case 18:for(;b.have<b.ncode;){for(;$<3;){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}b.lens[F[b.have++]]=7&U,U>>>=3,$-=3}for(;b.have<19;)b.lens[F[b.have++]]=0;if(b.lencode=b.lendyn,b.lenbits=7,V={bits:b.lenbits},Y=u(0,b.lens,0,19,b.lencode,0,b.work,V),b.lenbits=V.bits,Y){S.msg="invalid code lengths set",b.mode=30;break}b.have=0,b.mode=19;case 19:for(;b.have<b.nlen+b.ndist;){for(;ae=(N=b.lencode[U&(1<<b.lenbits)-1])>>>16&255,he=65535&N,!((ie=N>>>24)<=$);){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}if(he<16)U>>>=ie,$-=ie,b.lens[b.have++]=he;else{if(he===16){for(T=ie+2;$<T;){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}if(U>>>=ie,$-=ie,b.have===0){S.msg="invalid bit length repeat",b.mode=30;break}w=b.lens[b.have-1],J=3+(3&U),U>>>=2,$-=2}else if(he===17){for(T=ie+3;$<T;){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}$-=ie,w=0,J=3+(7&(U>>>=ie)),U>>>=3,$-=3}else{for(T=ie+7;$<T;){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}$-=ie,w=0,J=11+(127&(U>>>=ie)),U>>>=7,$-=7}if(b.have+J>b.nlen+b.ndist){S.msg="invalid bit length repeat",b.mode=30;break}for(;J--;)b.lens[b.have++]=w}}if(b.mode===30)break;if(b.lens[256]===0){S.msg="invalid code -- missing end-of-block",b.mode=30;break}if(b.lenbits=9,V={bits:b.lenbits},Y=u(d,b.lens,0,b.nlen,b.lencode,0,b.work,V),b.lenbits=V.bits,Y){S.msg="invalid literal/lengths set",b.mode=30;break}if(b.distbits=6,b.distcode=b.distdyn,V={bits:b.distbits},Y=u(f,b.lens,b.nlen,b.ndist,b.distcode,0,b.work,V),b.distbits=V.bits,Y){S.msg="invalid distances set",b.mode=30;break}if(b.mode=20,I===6)break e;case 20:b.mode=21;case 21:if(6<=K&&258<=se){S.next_out=B,S.avail_out=se,S.next_in=L,S.avail_in=K,b.hold=U,b.bits=$,c(S,ee),B=S.next_out,H=S.output,se=S.avail_out,L=S.next_in,P=S.input,K=S.avail_in,U=b.hold,$=b.bits,b.mode===12&&(b.back=-1);break}for(b.back=0;ae=(N=b.lencode[U&(1<<b.lenbits)-1])>>>16&255,he=65535&N,!((ie=N>>>24)<=$);){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}if(ae&&(240&ae)==0){for(fe=ie,we=ae,Te=he;ae=(N=b.lencode[Te+((U&(1<<fe+we)-1)>>fe)])>>>16&255,he=65535&N,!(fe+(ie=N>>>24)<=$);){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}U>>>=fe,$-=fe,b.back+=fe}if(U>>>=ie,$-=ie,b.back+=ie,b.length=he,ae===0){b.mode=26;break}if(32&ae){b.back=-1,b.mode=12;break}if(64&ae){S.msg="invalid literal/length code",b.mode=30;break}b.extra=15&ae,b.mode=22;case 22:if(b.extra){for(T=b.extra;$<T;){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}b.length+=U&(1<<b.extra)-1,U>>>=b.extra,$-=b.extra,b.back+=b.extra}b.was=b.length,b.mode=23;case 23:for(;ae=(N=b.distcode[U&(1<<b.distbits)-1])>>>16&255,he=65535&N,!((ie=N>>>24)<=$);){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}if((240&ae)==0){for(fe=ie,we=ae,Te=he;ae=(N=b.distcode[Te+((U&(1<<fe+we)-1)>>fe)])>>>16&255,he=65535&N,!(fe+(ie=N>>>24)<=$);){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}U>>>=fe,$-=fe,b.back+=fe}if(U>>>=ie,$-=ie,b.back+=ie,64&ae){S.msg="invalid distance code",b.mode=30;break}b.offset=he,b.extra=15&ae,b.mode=24;case 24:if(b.extra){for(T=b.extra;$<T;){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}b.offset+=U&(1<<b.extra)-1,U>>>=b.extra,$-=b.extra,b.back+=b.extra}if(b.offset>b.dmax){S.msg="invalid distance too far back",b.mode=30;break}b.mode=25;case 25:if(se===0)break e;if(J=ee-se,b.offset>J){if((J=b.offset-J)>b.whave&&b.sane){S.msg="invalid distance too far back",b.mode=30;break}ue=J>b.wnext?(J-=b.wnext,b.wsize-J):b.wnext-J,J>b.length&&(J=b.length),X=b.window}else X=H,ue=B-b.offset,J=b.length;for(se<J&&(J=se),se-=J,b.length-=J;H[B++]=X[ue++],--J;);b.length===0&&(b.mode=21);break;case 26:if(se===0)break e;H[B++]=b.length,se--,b.mode=21;break;case 27:if(b.wrap){for(;$<32;){if(K===0)break e;K--,U|=P[L++]<<$,$+=8}if(ee-=se,S.total_out+=ee,b.total+=ee,ee&&(S.adler=b.check=b.flags?l(b.check,H,ee,B-ee):i(b.check,H,ee,B-ee)),ee=se,(b.flags?U:v(U))!==b.check){S.msg="incorrect data check",b.mode=30;break}$=U=0}b.mode=28;case 28:if(b.wrap&&b.flags){for(;$<32;){if(K===0)break e;K--,U+=P[L++]<<$,$+=8}if(U!==(4294967295&b.total)){S.msg="incorrect length check",b.mode=30;break}$=U=0}b.mode=29;case 29:Y=1;break e;case 30:Y=-3;break e;case 31:return-4;default:return p}return S.next_out=B,S.avail_out=se,S.next_in=L,S.avail_in=K,b.hold=U,b.bits=$,(b.wsize||ee!==S.avail_out&&b.mode<30&&(b.mode<27||I!==4))&&q(S,S.output,S.next_out,ee-S.avail_out)?(b.mode=31,-4):(oe-=S.avail_in,ee-=S.avail_out,S.total_in+=oe,S.total_out+=ee,b.total+=ee,b.wrap&&ee&&(S.adler=b.check=b.flags?l(b.check,H,ee,S.next_out-ee):i(b.check,H,ee,S.next_out-ee)),S.data_type=b.bits+(b.last?64:0)+(b.mode===12?128:0)+(b.mode===20||b.mode===15?256:0),(oe==0&&ee===0||I===4)&&Y===m&&(Y=-5),Y)},o.inflateEnd=function(S){if(!S||!S.state)return p;var I=S.state;return I.window&&(I.window=null),S.state=null,m},o.inflateGetHeader=function(S,I){var b;return S&&S.state?(2&(b=S.state).wrap)==0?p:((b.head=I).done=!1,m):p},o.inflateSetDictionary=function(S,I){var b,P=I.length;return S&&S.state?(b=S.state).wrap!==0&&b.mode!==11?p:b.mode===11&&i(1,I,P,0)!==b.check?-3:q(S,I,P,P)?(b.mode=31,-4):(b.havedict=1,m):p},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){var s=n("../utils/common"),i=[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,m,p,g,h,x,v){var _,k,C,j,z,E,A,O,R,q=v.bits,S=0,I=0,b=0,P=0,H=0,L=0,B=0,K=0,se=0,U=0,$=null,oe=0,ee=new s.Buf16(16),J=new s.Buf16(16),ue=null,X=0;for(S=0;S<=15;S++)ee[S]=0;for(I=0;I<p;I++)ee[f[m+I]]++;for(H=q,P=15;1<=P&&ee[P]===0;P--);if(P<H&&(H=P),P===0)return g[h++]=20971520,g[h++]=20971520,v.bits=1,0;for(b=1;b<P&&ee[b]===0;b++);for(H<b&&(H=b),S=K=1;S<=15;S++)if(K<<=1,(K-=ee[S])<0)return-1;if(0<K&&(d===0||P!==1))return-1;for(J[1]=0,S=1;S<15;S++)J[S+1]=J[S]+ee[S];for(I=0;I<p;I++)f[m+I]!==0&&(x[J[f[m+I]]++]=I);if(E=d===0?($=ue=x,19):d===1?($=i,oe-=257,ue=l,X-=257,256):($=c,ue=u,-1),S=b,z=h,B=I=U=0,C=-1,j=(se=1<<(L=H))-1,d===1&&852<se||d===2&&592<se)return 1;for(;;){for(A=S-B,R=x[I]<E?(O=0,x[I]):x[I]>E?(O=ue[X+x[I]],$[oe+x[I]]):(O=96,0),_=1<<S-B,b=k=1<<L;g[z+(U>>B)+(k-=_)]=A<<24|O<<16|R|0,k!==0;);for(_=1<<S-1;U&_;)_>>=1;if(_!==0?(U&=_-1,U+=_):U=0,I++,--ee[S]==0){if(S===P)break;S=f[m+x[I]]}if(H<S&&(U&j)!==C){for(B===0&&(B=H),z+=b,K=1<<(L=S-B);L+B<P&&!((K-=ee[L+B])<=0);)L++,K<<=1;if(se+=1<<L,d===1&&852<se||d===2&&592<se)return 1;g[C=U&j]=H<<24|L<<16|z-h|0}}return U!==0&&(g[z+U]=S-B<<24|64<<16|0),v.bits=H,0}},{"../utils/common":41}],51:[function(n,r,o){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){var s=n("../utils/common"),i=0,l=1;function c(N){for(var D=N.length;0<=--D;)N[D]=0}var u=0,d=29,f=256,m=f+1+d,p=30,g=19,h=2*m+1,x=15,v=16,_=7,k=256,C=16,j=17,z=18,E=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],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],O=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],R=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],q=new Array(2*(m+2));c(q);var S=new Array(2*p);c(S);var I=new Array(512);c(I);var b=new Array(256);c(b);var P=new Array(d);c(P);var H,L,B,K=new Array(p);function se(N,D,F,W,M){this.static_tree=N,this.extra_bits=D,this.extra_base=F,this.elems=W,this.max_length=M,this.has_stree=N&&N.length}function U(N,D){this.dyn_tree=N,this.max_code=0,this.stat_desc=D}function $(N){return N<256?I[N]:I[256+(N>>>7)]}function oe(N,D){N.pending_buf[N.pending++]=255&D,N.pending_buf[N.pending++]=D>>>8&255}function ee(N,D,F){N.bi_valid>v-F?(N.bi_buf|=D<<N.bi_valid&65535,oe(N,N.bi_buf),N.bi_buf=D>>v-N.bi_valid,N.bi_valid+=F-v):(N.bi_buf|=D<<N.bi_valid&65535,N.bi_valid+=F)}function J(N,D,F){ee(N,F[2*D],F[2*D+1])}function ue(N,D){for(var F=0;F|=1&N,N>>>=1,F<<=1,0<--D;);return F>>>1}function X(N,D,F){var W,M,Q=new Array(x+1),re=0;for(W=1;W<=x;W++)Q[W]=re=re+F[W-1]<<1;for(M=0;M<=D;M++){var te=N[2*M+1];te!==0&&(N[2*M]=ue(Q[te]++,te))}}function ie(N){var D;for(D=0;D<m;D++)N.dyn_ltree[2*D]=0;for(D=0;D<p;D++)N.dyn_dtree[2*D]=0;for(D=0;D<g;D++)N.bl_tree[2*D]=0;N.dyn_ltree[2*k]=1,N.opt_len=N.static_len=0,N.last_lit=N.matches=0}function ae(N){8<N.bi_valid?oe(N,N.bi_buf):0<N.bi_valid&&(N.pending_buf[N.pending++]=N.bi_buf),N.bi_buf=0,N.bi_valid=0}function he(N,D,F,W){var M=2*D,Q=2*F;return N[M]<N[Q]||N[M]===N[Q]&&W[D]<=W[F]}function fe(N,D,F){for(var W=N.heap[F],M=F<<1;M<=N.heap_len&&(M<N.heap_len&&he(D,N.heap[M+1],N.heap[M],N.depth)&&M++,!he(D,W,N.heap[M],N.depth));)N.heap[F]=N.heap[M],F=M,M<<=1;N.heap[F]=W}function we(N,D,F){var W,M,Q,re,te=0;if(N.last_lit!==0)for(;W=N.pending_buf[N.d_buf+2*te]<<8|N.pending_buf[N.d_buf+2*te+1],M=N.pending_buf[N.l_buf+te],te++,W===0?J(N,M,D):(J(N,(Q=b[M])+f+1,D),(re=E[Q])!==0&&ee(N,M-=P[Q],re),J(N,Q=$(--W),F),(re=A[Q])!==0&&ee(N,W-=K[Q],re)),te<N.last_lit;);J(N,k,D)}function Te(N,D){var F,W,M,Q=D.dyn_tree,re=D.stat_desc.static_tree,te=D.stat_desc.has_stree,pe=D.stat_desc.elems,Ae=-1;for(N.heap_len=0,N.heap_max=h,F=0;F<pe;F++)Q[2*F]!==0?(N.heap[++N.heap_len]=Ae=F,N.depth[F]=0):Q[2*F+1]=0;for(;N.heap_len<2;)Q[2*(M=N.heap[++N.heap_len]=Ae<2?++Ae:0)]=1,N.depth[M]=0,N.opt_len--,te&&(N.static_len-=re[2*M+1]);for(D.max_code=Ae,F=N.heap_len>>1;1<=F;F--)fe(N,Q,F);for(M=pe;F=N.heap[1],N.heap[1]=N.heap[N.heap_len--],fe(N,Q,1),W=N.heap[1],N.heap[--N.heap_max]=F,N.heap[--N.heap_max]=W,Q[2*M]=Q[2*F]+Q[2*W],N.depth[M]=(N.depth[F]>=N.depth[W]?N.depth[F]:N.depth[W])+1,Q[2*F+1]=Q[2*W+1]=M,N.heap[1]=M++,fe(N,Q,1),2<=N.heap_len;);N.heap[--N.heap_max]=N.heap[1],(function(ke,Ge){var yn,rt,bn,De,$n,Wr,ct=Ge.dyn_tree,Ts=Ge.max_code,Ku=Ge.stat_desc.static_tree,Gu=Ge.stat_desc.has_stree,Yu=Ge.stat_desc.extra_bits,As=Ge.stat_desc.extra_base,wn=Ge.stat_desc.max_length,Bn=0;for(De=0;De<=x;De++)ke.bl_count[De]=0;for(ct[2*ke.heap[ke.heap_max]+1]=0,yn=ke.heap_max+1;yn<h;yn++)wn<(De=ct[2*ct[2*(rt=ke.heap[yn])+1]+1]+1)&&(De=wn,Bn++),ct[2*rt+1]=De,Ts<rt||(ke.bl_count[De]++,$n=0,As<=rt&&($n=Yu[rt-As]),Wr=ct[2*rt],ke.opt_len+=Wr*(De+$n),Gu&&(ke.static_len+=Wr*(Ku[2*rt+1]+$n)));if(Bn!==0){do{for(De=wn-1;ke.bl_count[De]===0;)De--;ke.bl_count[De]--,ke.bl_count[De+1]+=2,ke.bl_count[wn]--,Bn-=2}while(0<Bn);for(De=wn;De!==0;De--)for(rt=ke.bl_count[De];rt!==0;)Ts<(bn=ke.heap[--yn])||(ct[2*bn+1]!==De&&(ke.opt_len+=(De-ct[2*bn+1])*ct[2*bn],ct[2*bn+1]=De),rt--)}})(N,D),X(Q,Ae,N.bl_count)}function w(N,D,F){var W,M,Q=-1,re=D[1],te=0,pe=7,Ae=4;for(re===0&&(pe=138,Ae=3),D[2*(F+1)+1]=65535,W=0;W<=F;W++)M=re,re=D[2*(W+1)+1],++te<pe&&M===re||(te<Ae?N.bl_tree[2*M]+=te:M!==0?(M!==Q&&N.bl_tree[2*M]++,N.bl_tree[2*C]++):te<=10?N.bl_tree[2*j]++:N.bl_tree[2*z]++,Q=M,Ae=(te=0)===re?(pe=138,3):M===re?(pe=6,3):(pe=7,4))}function Y(N,D,F){var W,M,Q=-1,re=D[1],te=0,pe=7,Ae=4;for(re===0&&(pe=138,Ae=3),W=0;W<=F;W++)if(M=re,re=D[2*(W+1)+1],!(++te<pe&&M===re)){if(te<Ae)for(;J(N,M,N.bl_tree),--te!=0;);else M!==0?(M!==Q&&(J(N,M,N.bl_tree),te--),J(N,C,N.bl_tree),ee(N,te-3,2)):te<=10?(J(N,j,N.bl_tree),ee(N,te-3,3)):(J(N,z,N.bl_tree),ee(N,te-11,7));Q=M,Ae=(te=0)===re?(pe=138,3):M===re?(pe=6,3):(pe=7,4)}}c(K);var V=!1;function T(N,D,F,W){ee(N,(u<<1)+(W?1:0),3),(function(M,Q,re,te){ae(M),oe(M,re),oe(M,~re),s.arraySet(M.pending_buf,M.window,Q,re,M.pending),M.pending+=re})(N,D,F)}o._tr_init=function(N){V||((function(){var D,F,W,M,Q,re=new Array(x+1);for(M=W=0;M<d-1;M++)for(P[M]=W,D=0;D<1<<E[M];D++)b[W++]=M;for(b[W-1]=M,M=Q=0;M<16;M++)for(K[M]=Q,D=0;D<1<<A[M];D++)I[Q++]=M;for(Q>>=7;M<p;M++)for(K[M]=Q<<7,D=0;D<1<<A[M]-7;D++)I[256+Q++]=M;for(F=0;F<=x;F++)re[F]=0;for(D=0;D<=143;)q[2*D+1]=8,D++,re[8]++;for(;D<=255;)q[2*D+1]=9,D++,re[9]++;for(;D<=279;)q[2*D+1]=7,D++,re[7]++;for(;D<=287;)q[2*D+1]=8,D++,re[8]++;for(X(q,m+1,re),D=0;D<p;D++)S[2*D+1]=5,S[2*D]=ue(D,5);H=new se(q,E,f+1,m,x),L=new se(S,A,0,p,x),B=new se(new Array(0),O,0,g,_)})(),V=!0),N.l_desc=new U(N.dyn_ltree,H),N.d_desc=new U(N.dyn_dtree,L),N.bl_desc=new U(N.bl_tree,B),N.bi_buf=0,N.bi_valid=0,ie(N)},o._tr_stored_block=T,o._tr_flush_block=function(N,D,F,W){var M,Q,re=0;0<N.level?(N.strm.data_type===2&&(N.strm.data_type=(function(te){var pe,Ae=4093624447;for(pe=0;pe<=31;pe++,Ae>>>=1)if(1&Ae&&te.dyn_ltree[2*pe]!==0)return i;if(te.dyn_ltree[18]!==0||te.dyn_ltree[20]!==0||te.dyn_ltree[26]!==0)return l;for(pe=32;pe<f;pe++)if(te.dyn_ltree[2*pe]!==0)return l;return i})(N)),Te(N,N.l_desc),Te(N,N.d_desc),re=(function(te){var pe;for(w(te,te.dyn_ltree,te.l_desc.max_code),w(te,te.dyn_dtree,te.d_desc.max_code),Te(te,te.bl_desc),pe=g-1;3<=pe&&te.bl_tree[2*R[pe]+1]===0;pe--);return te.opt_len+=3*(pe+1)+5+5+4,pe})(N),M=N.opt_len+3+7>>>3,(Q=N.static_len+3+7>>>3)<=M&&(M=Q)):M=Q=F+5,F+4<=M&&D!==-1?T(N,D,F,W):N.strategy===4||Q===M?(ee(N,2+(W?1:0),3),we(N,q,S)):(ee(N,4+(W?1:0),3),(function(te,pe,Ae,ke){var Ge;for(ee(te,pe-257,5),ee(te,Ae-1,5),ee(te,ke-4,4),Ge=0;Ge<ke;Ge++)ee(te,te.bl_tree[2*R[Ge]+1],3);Y(te,te.dyn_ltree,pe-1),Y(te,te.dyn_dtree,Ae-1)})(N,N.l_desc.max_code+1,N.d_desc.max_code+1,re+1),we(N,N.dyn_ltree,N.dyn_dtree)),ie(N),W&&ae(N)},o._tr_tally=function(N,D,F){return N.pending_buf[N.d_buf+2*N.last_lit]=D>>>8&255,N.pending_buf[N.d_buf+2*N.last_lit+1]=255&D,N.pending_buf[N.l_buf+N.last_lit]=255&F,N.last_lit++,D===0?N.dyn_ltree[2*F]++:(N.matches++,D--,N.dyn_ltree[2*(b[F]+f+1)]++,N.dyn_dtree[2*$(D)]++),N.last_lit===N.lit_bufsize-1},o._tr_align=function(N){ee(N,2,3),J(N,k,q),(function(D){D.bi_valid===16?(oe(D,D.bi_buf),D.bi_buf=0,D.bi_valid=0):8<=D.bi_valid&&(D.pending_buf[D.pending++]=255&D.bi_buf,D.bi_buf>>=8,D.bi_valid-=8)})(N)}},{"../utils/common":41}],53:[function(n,r,o){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(s){(function(i,l){if(!i.setImmediate){var c,u,d,f,m=1,p={},g=!1,h=i.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(i);x=x&&x.setTimeout?x:i,c={}.toString.call(i.process)==="[object process]"?function(C){process.nextTick(function(){_(C)})}:(function(){if(i.postMessage&&!i.importScripts){var C=!0,j=i.onmessage;return i.onmessage=function(){C=!1},i.postMessage("","*"),i.onmessage=j,C}})()?(f="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",k,!1):i.attachEvent("onmessage",k),function(C){i.postMessage(f+C,"*")}):i.MessageChannel?((d=new MessageChannel).port1.onmessage=function(C){_(C.data)},function(C){d.port2.postMessage(C)}):h&&"onreadystatechange"in h.createElement("script")?(u=h.documentElement,function(C){var j=h.createElement("script");j.onreadystatechange=function(){_(C),j.onreadystatechange=null,u.removeChild(j),j=null},u.appendChild(j)}):function(C){setTimeout(_,0,C)},x.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var j=new Array(arguments.length-1),z=0;z<j.length;z++)j[z]=arguments[z+1];var E={callback:C,args:j};return p[m]=E,c(m),m++},x.clearImmediate=v}function v(C){delete p[C]}function _(C){if(g)setTimeout(_,0,C);else{var j=p[C];if(j){g=!0;try{(function(z){var E=z.callback,A=z.args;switch(A.length){case 0:E();break;case 1:E(A[0]);break;case 2:E(A[0],A[1]);break;case 3:E(A[0],A[1],A[2]);break;default:E.apply(l,A)}})(j)}finally{v(C),g=!1}}}}function k(C){C.source===i&&typeof C.data=="string"&&C.data.indexOf(f)===0&&_(+C.data.slice(f.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof Un<"u"?Un:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(qr)),qr.exports}var K0=J0();const G0=Xu(K0);async function Y0(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}}async function X0(e){const t=new G0;for(const i of e)i.rawRequestBody!==null&&t.file(`#${i.id}.Request.json`,i.rawRequestBody),i.responseText!==null&&t.file(`#${i.id}.Response.json`,i.responseText);const n=e.filter(i=>i.streaming);await Promise.allSettled(n.map(async i=>{const l=await Y0(i.id);l!==null&&t.file(`#${i.id}.SSE.Response.json`,l)}));const r=await t.generateAsync({type:"blob"}),o=URL.createObjectURL(r),s=document.createElement("a");s.href=o,s.download=`llm-inspector-export-${new Date().toISOString().slice(0,10)}.zip`,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(o)}function ml(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=ml(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function gl(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=ml(e))&&(r&&(r+=" "),r+=t);return r}const Q0=(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},ex=(e,t)=>({classGroupId:e,validator:t}),xl=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),pr="-",si=[],tx="arbitrary..",nx=e=>{const t=ox(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return rx(i);const l=i.split(pr),c=l[0]===""&&l.length>1?1:0;return vl(l,c,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const c=r[i],u=n[i];return c?u?Q0(u,c):c:u||si}return n[i]||si}}},vl=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);if(s){const u=vl(e,t+1,s);if(u)return u}const i=n.validators;if(i===null)return;const l=t===0?e.join(pr):e.slice(t).join(pr),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(l))return d.classGroupId}},rx=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?tx+r:void 0})(),ox=e=>{const{theme:t,classGroups:n}=e;return sx(n,t)},sx=(e,t)=>{const n=xl();for(const r in e){const o=e[r];rs(o,n,r,t)}return n},rs=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const i=e[s];ix(i,t,n,r)}},ix=(e,t,n,r)=>{if(typeof e=="string"){ax(e,t,n);return}if(typeof e=="function"){lx(e,t,n,r);return}cx(e,t,n,r)},ax=(e,t,n)=>{const r=e===""?t:yl(t,e);r.classGroupId=n},lx=(e,t,n,r)=>{if(ux(e)){rs(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(ex(n,e))},cx=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let i=0;i<s;i++){const[l,c]=o[i];rs(c,yl(t,l),n,r)}},yl=(e,t)=>{let n=e;const r=t.split(pr),o=r.length;for(let s=0;s<o;s++){const i=r[s];let l=n.nextPart.get(i);l||(l=xl(),n.nextPart.set(i,l)),n=l}return n},ux=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,dx=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(s,i)=>{n[s]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let i=n[s];if(i!==void 0)return i;if((i=r[s])!==void 0)return o(s,i),i},set(s,i){s in n?n[s]=i:o(s,i)}}},_o="!",ii=":",fx=[],ai=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),hx=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let i=0,l=0,c=0,u;const d=o.length;for(let h=0;h<d;h++){const x=o[h];if(i===0&&l===0){if(x===ii){s.push(o.slice(c,h)),c=h+1;continue}if(x==="/"){u=h;continue}}x==="["?i++:x==="]"?i--:x==="("?l++:x===")"&&l--}const f=s.length===0?o:o.slice(c);let m=f,p=!1;f.endsWith(_o)?(m=f.slice(0,-1),p=!0):f.startsWith(_o)&&(m=f.slice(1),p=!0);const g=u&&u>c?u-c:void 0;return ai(s,p,m,g)};if(t){const o=t+ii,s=r;r=i=>i.startsWith(o)?s(i.slice(o.length)):ai(fx,!1,i,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},px=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let s=0;s<n.length;s++){const i=n[s],l=i[0]==="[",c=t.has(i);l||c?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(i)):o.push(i)}return o.length>0&&(o.sort(),r.push(...o)),r}},mx=e=>({cache:dx(e.cacheSize),parseClassName:hx(e),sortModifiers:px(e),...nx(e)}),gx=/\s+/,xx=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,i=[],l=e.trim().split(gx);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:f,modifiers:m,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:h}=n(d);if(f){c=d+(c.length>0?" "+c:c);continue}let x=!!h,v=r(x?g.substring(0,h):g);if(!v){if(!x){c=d+(c.length>0?" "+c:c);continue}if(v=r(g),!v){c=d+(c.length>0?" "+c:c);continue}x=!1}const _=m.length===0?"":m.length===1?m[0]:s(m).join(":"),k=p?_+_o:_,C=k+v;if(i.indexOf(C)>-1)continue;i.push(C);const j=o(v,x);for(let z=0;z<j.length;++z){const E=j[z];i.push(k+E)}c=d+(c.length>0?" "+c:c)}return c},vx=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=bl(n))&&(o&&(o+=" "),o+=r);return o},bl=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=bl(e[r]))&&(n&&(n+=" "),n+=t);return n},yx=(e,...t)=>{let n,r,o,s;const i=c=>{const u=t.reduce((d,f)=>f(d),e());return n=mx(u),r=n.cache.get,o=n.cache.set,s=l,l(c)},l=c=>{const u=r(c);if(u)return u;const d=xx(c,n);return o(c,d),d};return s=i,(...c)=>s(vx(...c))},bx=[],Fe=e=>{const t=n=>n[e]||bx;return t.isThemeGetter=!0,t},wl=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,_l=/^\((?:(\w[\w-]*):)?(.+)\)$/i,wx=/^\d+\/\d+$/,_x=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,kx=/\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$/,Cx=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Sx=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jx=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Zt=e=>wx.test(e),be=e=>!!e&&!Number.isNaN(Number(e)),vt=e=>!!e&&Number.isInteger(Number(e)),Jr=e=>e.endsWith("%")&&be(e.slice(0,-1)),ut=e=>_x.test(e),Ex=()=>!0,Nx=e=>kx.test(e)&&!Cx.test(e),kl=()=>!1,Tx=e=>Sx.test(e),Ax=e=>jx.test(e),zx=e=>!le(e)&&!ce(e),Ox=e=>hn(e,jl,kl),le=e=>wl.test(e),zt=e=>hn(e,El,Nx),Kr=e=>hn(e,Dx,be),li=e=>hn(e,Cl,kl),Ix=e=>hn(e,Sl,Ax),qn=e=>hn(e,Nl,Tx),ce=e=>_l.test(e),_n=e=>pn(e,El),Rx=e=>pn(e,Lx),ci=e=>pn(e,Cl),Px=e=>pn(e,jl),Mx=e=>pn(e,Sl),Jn=e=>pn(e,Nl,!0),hn=(e,t,n)=>{const r=wl.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},pn=(e,t,n=!1)=>{const r=_l.exec(e);return r?r[1]?t(r[1]):n:!1},Cl=e=>e==="position"||e==="percentage",Sl=e=>e==="image"||e==="url",jl=e=>e==="length"||e==="size"||e==="bg-size",El=e=>e==="length",Dx=e=>e==="number",Lx=e=>e==="family-name",Nl=e=>e==="shadow",Fx=()=>{const e=Fe("color"),t=Fe("font"),n=Fe("text"),r=Fe("font-weight"),o=Fe("tracking"),s=Fe("leading"),i=Fe("breakpoint"),l=Fe("container"),c=Fe("spacing"),u=Fe("radius"),d=Fe("shadow"),f=Fe("inset-shadow"),m=Fe("text-shadow"),p=Fe("drop-shadow"),g=Fe("blur"),h=Fe("perspective"),x=Fe("aspect"),v=Fe("ease"),_=Fe("animate"),k=()=>["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"],j=()=>[...C(),ce,le],z=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],A=()=>[ce,le,c],O=()=>[Zt,"full","auto",...A()],R=()=>[vt,"none","subgrid",ce,le],q=()=>["auto",{span:["full",vt,ce,le]},vt,ce,le],S=()=>[vt,"auto",ce,le],I=()=>["auto","min","max","fr",ce,le],b=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],P=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...A()],L=()=>[Zt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],B=()=>[e,ce,le],K=()=>[...C(),ci,li,{position:[ce,le]}],se=()=>["no-repeat",{repeat:["","x","y","space","round"]}],U=()=>["auto","cover","contain",Px,Ox,{size:[ce,le]}],$=()=>[Jr,_n,zt],oe=()=>["","none","full",u,ce,le],ee=()=>["",be,_n,zt],J=()=>["solid","dashed","dotted","double"],ue=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>[be,Jr,ci,li],ie=()=>["","none",g,ce,le],ae=()=>["none",be,ce,le],he=()=>["none",be,ce,le],fe=()=>[be,ce,le],we=()=>[Zt,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ut],breakpoint:[ut],color:[Ex],container:[ut],"drop-shadow":[ut],ease:["in","out","in-out"],font:[zx],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ut],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ut],shadow:[ut],spacing:["px",be],text:[ut],"text-shadow":[ut],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Zt,le,ce,x]}],container:["container"],columns:[{columns:[be,le,ce,l]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:j()}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:O()}],"inset-x":[{"inset-x":O()}],"inset-y":[{"inset-y":O()}],start:[{start:O()}],end:[{end:O()}],top:[{top:O()}],right:[{right:O()}],bottom:[{bottom:O()}],left:[{left:O()}],visibility:["visible","invisible","collapse"],z:[{z:[vt,"auto",ce,le]}],basis:[{basis:[Zt,"full","auto",l,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[be,Zt,"auto","initial","none",le]}],grow:[{grow:["",be,ce,le]}],shrink:[{shrink:["",be,ce,le]}],order:[{order:[vt,"first","last","none",ce,le]}],"grid-cols":[{"grid-cols":R()}],"col-start-end":[{col:q()}],"col-start":[{"col-start":S()}],"col-end":[{"col-end":S()}],"grid-rows":[{"grid-rows":R()}],"row-start-end":[{row:q()}],"row-start":[{"row-start":S()}],"row-end":[{"row-end":S()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":I()}],"auto-rows":[{"auto-rows":I()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...b(),"normal"]}],"justify-items":[{"justify-items":[...P(),"normal"]}],"justify-self":[{"justify-self":["auto",...P()]}],"align-content":[{content:["normal",...b()]}],"align-items":[{items:[...P(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...P(),{baseline:["","last"]}]}],"place-content":[{"place-content":b()}],"place-items":[{"place-items":[...P(),"baseline"]}],"place-self":[{"place-self":["auto",...P()]}],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:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:L()}],w:[{w:[l,"screen",...L()]}],"min-w":[{"min-w":[l,"screen","none",...L()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...L()]}],h:[{h:["screen","lh",...L()]}],"min-h":[{"min-h":["screen","lh","none",...L()]}],"max-h":[{"max-h":["screen","lh",...L()]}],"font-size":[{text:["base",n,_n,zt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,ce,Kr]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Jr,le]}],"font-family":[{font:[Rx,le,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,ce,le]}],"line-clamp":[{"line-clamp":[be,"none",ce,Kr]}],leading:[{leading:[s,...A()]}],"list-image":[{"list-image":["none",ce,le]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ce,le]}],"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:[...J(),"wavy"]}],"text-decoration-thickness":[{decoration:[be,"from-font","auto",ce,zt]}],"text-decoration-color":[{decoration:B()}],"underline-offset":[{"underline-offset":[be,"auto",ce,le]}],"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",ce,le]}],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",ce,le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:K()}],"bg-repeat":[{bg:se()}],"bg-size":[{bg:U()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},vt,ce,le],radial:["",ce,le],conic:[vt,ce,le]},Mx,Ix]}],"bg-color":[{bg:B()}],"gradient-from-pos":[{from:$()}],"gradient-via-pos":[{via:$()}],"gradient-to-pos":[{to:$()}],"gradient-from":[{from:B()}],"gradient-via":[{via:B()}],"gradient-to":[{to:B()}],rounded:[{rounded:oe()}],"rounded-s":[{"rounded-s":oe()}],"rounded-e":[{"rounded-e":oe()}],"rounded-t":[{"rounded-t":oe()}],"rounded-r":[{"rounded-r":oe()}],"rounded-b":[{"rounded-b":oe()}],"rounded-l":[{"rounded-l":oe()}],"rounded-ss":[{"rounded-ss":oe()}],"rounded-se":[{"rounded-se":oe()}],"rounded-ee":[{"rounded-ee":oe()}],"rounded-es":[{"rounded-es":oe()}],"rounded-tl":[{"rounded-tl":oe()}],"rounded-tr":[{"rounded-tr":oe()}],"rounded-br":[{"rounded-br":oe()}],"rounded-bl":[{"rounded-bl":oe()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...J(),"hidden","none"]}],"divide-style":[{divide:[...J(),"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:[...J(),"none","hidden"]}],"outline-offset":[{"outline-offset":[be,ce,le]}],"outline-w":[{outline:["",be,_n,zt]}],"outline-color":[{outline:B()}],shadow:[{shadow:["","none",d,Jn,qn]}],"shadow-color":[{shadow:B()}],"inset-shadow":[{"inset-shadow":["none",f,Jn,qn]}],"inset-shadow-color":[{"inset-shadow":B()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:B()}],"ring-offset-w":[{"ring-offset":[be,zt]}],"ring-offset-color":[{"ring-offset":B()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":B()}],"text-shadow":[{"text-shadow":["none",m,Jn,qn]}],"text-shadow-color":[{"text-shadow":B()}],opacity:[{opacity:[be,ce,le]}],"mix-blend":[{"mix-blend":[...ue(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ue()}],"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":[be]}],"mask-image-linear-from-pos":[{"mask-linear-from":X()}],"mask-image-linear-to-pos":[{"mask-linear-to":X()}],"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":X()}],"mask-image-t-to-pos":[{"mask-t-to":X()}],"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":X()}],"mask-image-r-to-pos":[{"mask-r-to":X()}],"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":X()}],"mask-image-b-to-pos":[{"mask-b-to":X()}],"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":X()}],"mask-image-l-to-pos":[{"mask-l-to":X()}],"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":X()}],"mask-image-x-to-pos":[{"mask-x-to":X()}],"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":X()}],"mask-image-y-to-pos":[{"mask-y-to":X()}],"mask-image-y-from-color":[{"mask-y-from":B()}],"mask-image-y-to-color":[{"mask-y-to":B()}],"mask-image-radial":[{"mask-radial":[ce,le]}],"mask-image-radial-from-pos":[{"mask-radial-from":X()}],"mask-image-radial-to-pos":[{"mask-radial-to":X()}],"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":[be]}],"mask-image-conic-from-pos":[{"mask-conic-from":X()}],"mask-image-conic-to-pos":[{"mask-conic-to":X()}],"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:K()}],"mask-repeat":[{mask:se()}],"mask-size":[{mask:U()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ce,le]}],filter:[{filter:["","none",ce,le]}],blur:[{blur:ie()}],brightness:[{brightness:[be,ce,le]}],contrast:[{contrast:[be,ce,le]}],"drop-shadow":[{"drop-shadow":["","none",p,Jn,qn]}],"drop-shadow-color":[{"drop-shadow":B()}],grayscale:[{grayscale:["",be,ce,le]}],"hue-rotate":[{"hue-rotate":[be,ce,le]}],invert:[{invert:["",be,ce,le]}],saturate:[{saturate:[be,ce,le]}],sepia:[{sepia:["",be,ce,le]}],"backdrop-filter":[{"backdrop-filter":["","none",ce,le]}],"backdrop-blur":[{"backdrop-blur":ie()}],"backdrop-brightness":[{"backdrop-brightness":[be,ce,le]}],"backdrop-contrast":[{"backdrop-contrast":[be,ce,le]}],"backdrop-grayscale":[{"backdrop-grayscale":["",be,ce,le]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[be,ce,le]}],"backdrop-invert":[{"backdrop-invert":["",be,ce,le]}],"backdrop-opacity":[{"backdrop-opacity":[be,ce,le]}],"backdrop-saturate":[{"backdrop-saturate":[be,ce,le]}],"backdrop-sepia":[{"backdrop-sepia":["",be,ce,le]}],"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",ce,le]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[be,"initial",ce,le]}],ease:[{ease:["linear","initial",v,ce,le]}],delay:[{delay:[be,ce,le]}],animate:[{animate:["none",_,ce,le]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[h,ce,le]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:ae()}],"rotate-x":[{"rotate-x":ae()}],"rotate-y":[{"rotate-y":ae()}],"rotate-z":[{"rotate-z":ae()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":["scale-3d"],skew:[{skew:fe()}],"skew-x":[{"skew-x":fe()}],"skew-y":[{"skew-y":fe()}],transform:[{transform:[ce,le,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:we()}],"translate-x":[{"translate-x":we()}],"translate-y":[{"translate-y":we()}],"translate-z":[{"translate-z":we()}],"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",ce,le]}],"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",ce,le]}],fill:[{fill:["none",...B()]}],"stroke-w":[{stroke:[be,_n,zt,Kr]}],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"]}},$x=yx(Fx);function xe(...e){return $x(gl(e))}function Je(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":(e/1e3).toFixed(1).replace(/\.0$/,"")+"K"}function Bx(e){return e===null?"pending":e>=200&&e<300?"success":e>=400&&e<500?"client_error":e>=500?"server_error":"pending"}const Ux="1.18.2",Zx={version:Ux},ui=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,di=gl,os=(e,t)=>n=>{var r;if(t?.variants==null)return di(e,n?.class,n?.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(u=>{const d=n?.[u],f=s?.[u];if(d===null)return null;const m=ui(d)||ui(f);return o[u][m]}),l=n&&Object.entries(n).reduce((u,d)=>{let[f,m]=d;return m===void 0||(u[f]=m),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:m,...p}=d;return Object.entries(p).every(g=>{let[h,x]=g;return Array.isArray(x)?x.includes({...s,...l}[h]):{...s,...l}[h]===x})?[...u,f,m]:u},[]);return di(e,i,c,n?.class,n?.className)};function fi(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Tl(...e){return t=>{let n=!1;const r=e.map(o=>{const s=fi(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():fi(e[o],null)}}}}function Ie(...e){return y.useCallback(Tl(...e),e)}function an(e){const t=Vx(e),n=y.forwardRef((r,o)=>{const{children:s,...i}=r,l=y.Children.toArray(s),c=l.find(qx);if(c){const u=c.props.children,d=l.map(f=>f===c?y.Children.count(u)>1?y.Children.only(null):y.isValidElement(u)?u.props.children:null:f);return a.jsx(t,{...i,ref:o,children:y.isValidElement(u)?y.cloneElement(u,void 0,d):null})}return a.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var Wx=an("Slot");function Vx(e){const t=y.forwardRef((n,r)=>{const{children:o,...s}=n;if(y.isValidElement(o)){const i=Kx(o),l=Jx(s,o.props);return o.type!==y.Fragment&&(l.ref=r?Tl(r,i):i),y.cloneElement(o,l)}return y.Children.count(o)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Al=Symbol("radix.slottable");function Hx(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Al,t}function qx(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Al}function Jx(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...l)=>{const c=s(...l);return o(...l),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Kx(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 Gx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ce=Gx.reduce((e,t)=>{const n=an(`Primitive.${t}`),r=y.forwardRef((o,s)=>{const{asChild:i,...l}=o,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Yx(e,t){e&&Rn.flushSync(()=>e.dispatchEvent(t))}var zl=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"}),Xx="VisuallyHidden",Ol=y.forwardRef((e,t)=>a.jsx(Ce.span,{...e,ref:t,style:{...zl,...e.style}}));Ol.displayName=Xx;var Qx=Ol;function e1(e,t){const n=y.createContext(t),r=s=>{const{children:i,...l}=s,c=y.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function o(s){const i=y.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function $t(e,t=[]){let n=[];function r(s,i){const l=y.createContext(i),c=n.length;n=[...n,i];const u=f=>{const{scope:m,children:p,...g}=f,h=m?.[e]?.[c]||l,x=y.useMemo(()=>g,Object.values(g));return a.jsx(h.Provider,{value:x,children:p})};u.displayName=s+"Provider";function d(f,m){const p=m?.[e]?.[c]||l,g=y.useContext(p);if(g)return g;if(i!==void 0)return i;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const o=()=>{const s=n.map(i=>y.createContext(i));return function(l){const c=l?.[e]||s;return y.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[r,t1(o,...t)]}function t1(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return y.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function Il(e){const t=e+"CollectionProvider",[n,r]=$t(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=h=>{const{scope:x,children:v}=h,_=We.useRef(null),k=We.useRef(new Map).current;return a.jsx(o,{scope:x,itemMap:k,collectionRef:_,children:v})};i.displayName=t;const l=e+"CollectionSlot",c=an(l),u=We.forwardRef((h,x)=>{const{scope:v,children:_}=h,k=s(l,v),C=Ie(x,k.collectionRef);return a.jsx(c,{ref:C,children:_})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",m=an(d),p=We.forwardRef((h,x)=>{const{scope:v,children:_,...k}=h,C=We.useRef(null),j=Ie(x,C),z=s(d,v);return We.useEffect(()=>(z.itemMap.set(C,{ref:C,...k}),()=>{z.itemMap.delete(C)})),a.jsx(m,{[f]:"",ref:j,children:_})});p.displayName=d;function g(h){const x=s(e+"CollectionConsumer",h);return We.useCallback(()=>{const _=x.collectionRef.current;if(!_)return[];const k=Array.from(_.querySelectorAll(`[${f}]`));return Array.from(x.itemMap.values()).sort((z,E)=>k.indexOf(z.ref.current)-k.indexOf(E.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:u,ItemSlot:p},g,r]}function ye(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}var Ue=globalThis?.document?y.useLayoutEffect:()=>{},n1=pa[" useInsertionEffect ".trim().toString()]||Ue;function ln({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=r1({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:o;{const d=y.useRef(e!==void 0);y.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=y.useCallback(d=>{if(l){const f=o1(d)?d(e):d;f!==e&&i.current?.(f)}else s(d)},[l,e,s,i]);return[c,u]}function r1({defaultProp:e,onChange:t}){const[n,r]=y.useState(e),o=y.useRef(n),s=y.useRef(t);return n1(()=>{s.current=t},[t]),y.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}function o1(e){return typeof e=="function"}function s1(e,t){return y.useReducer((n,r)=>t[n][r]??n,e)}var Bt=e=>{const{present:t,children:n}=e,r=i1(t),o=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),s=Ie(r.ref,a1(o));return typeof n=="function"||r.isPresent?y.cloneElement(o,{ref:s}):null};Bt.displayName="Presence";function i1(e){const[t,n]=y.useState(),r=y.useRef(null),o=y.useRef(e),s=y.useRef("none"),i=e?"mounted":"unmounted",[l,c]=s1(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const u=Kn(r.current);s.current=l==="mounted"?u:"none"},[l]),Ue(()=>{const u=r.current,d=o.current;if(d!==e){const m=s.current,p=Kn(u);e?c("MOUNT"):p==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&m!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),Ue(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const h=Kn(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&h&&(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)})}},m=p=>{p.target===t&&(s.current=Kn(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:y.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function Kn(e){return e?.animationName||"none"}function a1(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 l1=pa[" useId ".trim().toString()]||(()=>{}),c1=0;function ht(e){const[t,n]=y.useState(l1());return Ue(()=>{n(r=>r??String(c1++))},[e]),e||(t?`radix-${t}`:"")}var u1=y.createContext(void 0);function ss(e){const t=y.useContext(u1);return e||t||"ltr"}function _t(e){const t=y.useRef(e);return y.useEffect(()=>{t.current=e}),y.useMemo(()=>(...n)=>t.current?.(...n),[])}function d1(e,t=globalThis?.document){const n=_t(e);y.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 f1="DismissableLayer",ko="dismissableLayer.update",h1="dismissableLayer.pointerDownOutside",p1="dismissableLayer.focusOutside",hi,Rl=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Tr=y.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...c}=e,u=y.useContext(Rl),[d,f]=y.useState(null),m=d?.ownerDocument??globalThis?.document,[,p]=y.useState({}),g=Ie(t,E=>f(E)),h=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=h.indexOf(x),_=d?h.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,C=_>=v,j=x1(E=>{const A=E.target,O=[...u.branches].some(R=>R.contains(A));!C||O||(o?.(E),i?.(E),E.defaultPrevented||l?.())},m),z=v1(E=>{const A=E.target;[...u.branches].some(R=>R.contains(A))||(s?.(E),i?.(E),E.defaultPrevented||l?.())},m);return d1(E=>{_===u.layers.size-1&&(r?.(E),!E.defaultPrevented&&l&&(E.preventDefault(),l()))},m),y.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(hi=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),pi(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=hi)}},[d,m,n,u]),y.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),pi())},[d,u]),y.useEffect(()=>{const E=()=>p({});return document.addEventListener(ko,E),()=>document.removeEventListener(ko,E)},[]),a.jsx(Ce.div,{...c,ref:g,style:{pointerEvents:k?C?"auto":"none":void 0,...e.style},onFocusCapture:ye(e.onFocusCapture,z.onFocusCapture),onBlurCapture:ye(e.onBlurCapture,z.onBlurCapture),onPointerDownCapture:ye(e.onPointerDownCapture,j.onPointerDownCapture)})});Tr.displayName=f1;var m1="DismissableLayerBranch",g1=y.forwardRef((e,t)=>{const n=y.useContext(Rl),r=y.useRef(null),o=Ie(t,r);return y.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),a.jsx(Ce.div,{...e,ref:o})});g1.displayName=m1;function x1(e,t=globalThis?.document){const n=_t(e),r=y.useRef(!1),o=y.useRef(()=>{});return y.useEffect(()=>{const s=l=>{if(l.target&&!r.current){let c=function(){Pl(h1,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},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function v1(e,t=globalThis?.document){const n=_t(e),r=y.useRef(!1);return y.useEffect(()=>{const o=s=>{s.target&&!r.current&&Pl(p1,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function pi(){const e=new CustomEvent(ko);document.dispatchEvent(e)}function Pl(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Yx(o,s):o.dispatchEvent(s)}var Gr="focusScope.autoFocusOnMount",Yr="focusScope.autoFocusOnUnmount",mi={bubbles:!1,cancelable:!0},y1="FocusScope",is=y.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[l,c]=y.useState(null),u=_t(o),d=_t(s),f=y.useRef(null),m=Ie(t,h=>c(h)),p=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let h=function(k){if(p.paused||!l)return;const C=k.target;l.contains(C)?f.current=C:yt(f.current,{select:!0})},x=function(k){if(p.paused||!l)return;const C=k.relatedTarget;C!==null&&(l.contains(C)||yt(f.current,{select:!0}))},v=function(k){if(document.activeElement===document.body)for(const j of k)j.removedNodes.length>0&&yt(l)};document.addEventListener("focusin",h),document.addEventListener("focusout",x);const _=new MutationObserver(v);return l&&_.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",x),_.disconnect()}}},[r,l,p.paused]),y.useEffect(()=>{if(l){xi.add(p);const h=document.activeElement;if(!l.contains(h)){const v=new CustomEvent(Gr,mi);l.addEventListener(Gr,u),l.dispatchEvent(v),v.defaultPrevented||(b1(S1(Ml(l)),{select:!0}),document.activeElement===h&&yt(l))}return()=>{l.removeEventListener(Gr,u),setTimeout(()=>{const v=new CustomEvent(Yr,mi);l.addEventListener(Yr,d),l.dispatchEvent(v),v.defaultPrevented||yt(h??document.body,{select:!0}),l.removeEventListener(Yr,d),xi.remove(p)},0)}}},[l,u,d,p]);const g=y.useCallback(h=>{if(!n&&!r||p.paused)return;const x=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,v=document.activeElement;if(x&&v){const _=h.currentTarget,[k,C]=w1(_);k&&C?!h.shiftKey&&v===C?(h.preventDefault(),n&&yt(k,{select:!0})):h.shiftKey&&v===k&&(h.preventDefault(),n&&yt(C,{select:!0})):v===_&&h.preventDefault()}},[n,r,p.paused]);return a.jsx(Ce.div,{tabIndex:-1,...i,ref:m,onKeyDown:g})});is.displayName=y1;function b1(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(yt(r,{select:t}),document.activeElement!==n)return}function w1(e){const t=Ml(e),n=gi(t,e),r=gi(t.reverse(),e);return[n,r]}function Ml(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 gi(e,t){for(const n of e)if(!_1(n,{upTo:t}))return n}function _1(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 k1(e){return e instanceof HTMLInputElement&&"select"in e}function yt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&k1(e)&&t&&e.select()}}var xi=C1();function C1(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=vi(e,t),e.unshift(t)},remove(t){e=vi(e,t),e[0]?.resume()}}}function vi(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function S1(e){return e.filter(t=>t.tagName!=="A")}var j1="Portal",Ar=y.forwardRef((e,t)=>{const{container:n,...r}=e,[o,s]=y.useState(!1);Ue(()=>s(!0),[]);const i=n||o&&globalThis?.document?.body;return i?Qu.createPortal(a.jsx(Ce.div,{...r,ref:t}),i):null});Ar.displayName=j1;var Xr=0;function Dl(){y.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??yi()),document.body.insertAdjacentElement("beforeend",e[1]??yi()),Xr++,()=>{Xr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Xr--}},[])}function yi(){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 ot=function(){return ot=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},ot.apply(this,arguments)};function Ll(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 E1(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var sr="right-scroll-bar-position",ir="width-before-scroll-bar",N1="with-scroll-bars-hidden",T1="--removed-body-scroll-bar-size";function Qr(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function A1(e,t){var n=y.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 z1=typeof window<"u"?y.useLayoutEffect:y.useEffect,bi=new WeakMap;function O1(e,t){var n=A1(null,function(r){return e.forEach(function(o){return Qr(o,r)})});return z1(function(){var r=bi.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(l){s.has(l)||Qr(l,null)}),s.forEach(function(l){o.has(l)||Qr(l,i)})}bi.set(n,e)},[e]),n}function I1(e){return e}function R1(e,t){t===void 0&&(t=I1);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(l){return l!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(l){return s(l)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var l=n;n=[],l.forEach(s),i=n}var c=function(){var d=i;i=[],d.forEach(s)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){i.push(d),u()},filter:function(d){return i=i.filter(d),n}}}};return o}function P1(e){e===void 0&&(e={});var t=R1(null);return t.options=ot({async:!0,ssr:!1},e),t}var Fl=function(e){var t=e.sideCar,n=Ll(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 y.createElement(r,ot({},n))};Fl.isSideCarExport=!0;function M1(e,t){return e.useMedium(t),Fl}var $l=P1(),eo=function(){},zr=y.forwardRef(function(e,t){var n=y.useRef(null),r=y.useState({onScrollCapture:eo,onWheelCapture:eo,onTouchMoveCapture:eo}),o=r[0],s=r[1],i=e.forwardProps,l=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,m=e.sideCar,p=e.noRelative,g=e.noIsolation,h=e.inert,x=e.allowPinchZoom,v=e.as,_=v===void 0?"div":v,k=e.gapMode,C=Ll(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=m,z=O1([n,t]),E=ot(ot({},C),o);return y.createElement(y.Fragment,null,d&&y.createElement(j,{sideCar:$l,removeScrollBar:u,shards:f,noRelative:p,noIsolation:g,inert:h,setCallbacks:s,allowPinchZoom:!!x,lockRef:n,gapMode:k}),i?y.cloneElement(y.Children.only(l),ot(ot({},E),{ref:z})):y.createElement(_,ot({},E,{className:c,ref:z}),l))});zr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};zr.classNames={fullWidth:ir,zeroRight:sr};var D1=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function L1(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=D1();return t&&e.setAttribute("nonce",t),e}function F1(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function $1(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var B1=function(){var e=0,t=null;return{add:function(n){e==0&&(t=L1())&&(F1(t,n),$1(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},U1=function(){var e=B1();return function(t,n){y.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Bl=function(){var e=U1(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Z1={left:0,top:0,right:0,gap:0},to=function(e){return parseInt(e||"",10)||0},W1=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[to(n),to(r),to(o)]},V1=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Z1;var t=W1(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])}},H1=Bl(),Qt="data-scroll-locked",q1=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
42
|
+
.`.concat(N1,` {
|
|
43
|
+
overflow: hidden `).concat(r,`;
|
|
44
|
+
padding-right: `).concat(l,"px ").concat(r,`;
|
|
45
|
+
}
|
|
46
|
+
body[`).concat(Qt,`] {
|
|
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(s,`px;
|
|
52
|
+
padding-right: `).concat(i,`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(sr,` {
|
|
60
|
+
right: `).concat(l,"px ").concat(r,`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.`).concat(ir,` {
|
|
64
|
+
margin-right: `).concat(l,"px ").concat(r,`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.`).concat(sr," .").concat(sr,` {
|
|
68
|
+
right: 0 `).concat(r,`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.`).concat(ir," .").concat(ir,` {
|
|
72
|
+
margin-right: 0 `).concat(r,`;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
body[`).concat(Qt,`] {
|
|
76
|
+
`).concat(T1,": ").concat(l,`px;
|
|
77
|
+
}
|
|
78
|
+
`)},wi=function(){var e=parseInt(document.body.getAttribute(Qt)||"0",10);return isFinite(e)?e:0},J1=function(){y.useEffect(function(){return document.body.setAttribute(Qt,(wi()+1).toString()),function(){var e=wi()-1;e<=0?document.body.removeAttribute(Qt):document.body.setAttribute(Qt,e.toString())}},[])},K1=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;J1();var s=y.useMemo(function(){return V1(o)},[o]);return y.createElement(H1,{styles:q1(s,!t,o,n?"":"!important")})},Co=!1;if(typeof window<"u")try{var Gn=Object.defineProperty({},"passive",{get:function(){return Co=!0,!0}});window.addEventListener("test",Gn,Gn),window.removeEventListener("test",Gn,Gn)}catch{Co=!1}var Wt=Co?{passive:!1}:!1,G1=function(e){return e.tagName==="TEXTAREA"},Ul=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!G1(e)&&n[t]==="visible")},Y1=function(e){return Ul(e,"overflowY")},X1=function(e){return Ul(e,"overflowX")},_i=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Zl(e,r);if(o){var s=Wl(e,r),i=s[1],l=s[2];if(i>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Q1=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},ev=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Zl=function(e,t){return e==="v"?Y1(t):X1(t)},Wl=function(e,t){return e==="v"?Q1(t):ev(t)},tv=function(e,t){return e==="h"&&t==="rtl"?-1:1},nv=function(e,t,n,r,o){var s=tv(e,window.getComputedStyle(t).direction),i=s*r,l=n.target,c=t.contains(l),u=!1,d=i>0,f=0,m=0;do{if(!l)break;var p=Wl(e,l),g=p[0],h=p[1],x=p[2],v=h-x-s*g;(g||v)&&Zl(e,l)&&(f+=v,m+=g);var _=l.parentNode;l=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&Math.abs(f)<1||!d&&Math.abs(m)<1)&&(u=!0),u},Yn=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ki=function(e){return[e.deltaX,e.deltaY]},Ci=function(e){return e&&"current"in e?e.current:e},rv=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ov=function(e){return`
|
|
79
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
80
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
81
|
+
`)},sv=0,Vt=[];function iv(e){var t=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),o=y.useState(sv++)[0],s=y.useState(Bl)[0],i=y.useRef(e);y.useEffect(function(){i.current=e},[e]),y.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var h=E1([e.lockRef.current],(e.shards||[]).map(Ci),!0).filter(Boolean);return h.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),h.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=y.useCallback(function(h,x){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!i.current.allowPinchZoom;var v=Yn(h),_=n.current,k="deltaX"in h?h.deltaX:_[0]-v[0],C="deltaY"in h?h.deltaY:_[1]-v[1],j,z=h.target,E=Math.abs(k)>Math.abs(C)?"h":"v";if("touches"in h&&E==="h"&&z.type==="range")return!1;var A=window.getSelection(),O=A&&A.anchorNode,R=O?O===z||O.contains(z):!1;if(R)return!1;var q=_i(E,z);if(!q)return!0;if(q?j=E:(j=E==="v"?"h":"v",q=_i(E,z)),!q)return!1;if(!r.current&&"changedTouches"in h&&(k||C)&&(r.current=j),!j)return!0;var S=r.current||j;return nv(S,x,h,S==="h"?k:C)},[]),c=y.useCallback(function(h){var x=h;if(!(!Vt.length||Vt[Vt.length-1]!==s)){var v="deltaY"in x?ki(x):Yn(x),_=t.current.filter(function(j){return j.name===x.type&&(j.target===x.target||x.target===j.shadowParent)&&rv(j.delta,v)})[0];if(_&&_.should){x.cancelable&&x.preventDefault();return}if(!_){var k=(i.current.shards||[]).map(Ci).filter(Boolean).filter(function(j){return j.contains(x.target)}),C=k.length>0?l(x,k[0]):!i.current.noIsolation;C&&x.cancelable&&x.preventDefault()}}},[]),u=y.useCallback(function(h,x,v,_){var k={name:h,delta:x,target:v,should:_,shadowParent:av(v)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(C){return C!==k})},1)},[]),d=y.useCallback(function(h){n.current=Yn(h),r.current=void 0},[]),f=y.useCallback(function(h){u(h.type,ki(h),h.target,l(h,e.lockRef.current))},[]),m=y.useCallback(function(h){u(h.type,Yn(h),h.target,l(h,e.lockRef.current))},[]);y.useEffect(function(){return Vt.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Wt),document.addEventListener("touchmove",c,Wt),document.addEventListener("touchstart",d,Wt),function(){Vt=Vt.filter(function(h){return h!==s}),document.removeEventListener("wheel",c,Wt),document.removeEventListener("touchmove",c,Wt),document.removeEventListener("touchstart",d,Wt)}},[]);var p=e.removeScrollBar,g=e.inert;return y.createElement(y.Fragment,null,g?y.createElement(s,{styles:ov(o)}):null,p?y.createElement(K1,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function av(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const lv=M1($l,iv);var as=y.forwardRef(function(e,t){return y.createElement(zr,ot({},e,{ref:t,sideCar:lv}))});as.classNames=zr.classNames;var cv=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ht=new WeakMap,Xn=new WeakMap,Qn={},no=0,Vl=function(e){return e&&(e.host||Vl(e.parentNode))},uv=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Vl(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})},dv=function(e,t,n,r){var o=uv(t,Array.isArray(e)?e:[e]);Qn[n]||(Qn[n]=new WeakMap);var s=Qn[n],i=[],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(m){if(l.has(m))d(m);else try{var p=m.getAttribute(r),g=p!==null&&p!=="false",h=(Ht.get(m)||0)+1,x=(s.get(m)||0)+1;Ht.set(m,h),s.set(m,x),i.push(m),h===1&&g&&Xn.set(m,!0),x===1&&m.setAttribute(n,"true"),g||m.setAttribute(r,"true")}catch(v){console.error("aria-hidden: cannot operate on ",m,v)}})};return d(t),l.clear(),no++,function(){i.forEach(function(f){var m=Ht.get(f)-1,p=s.get(f)-1;Ht.set(f,m),s.set(f,p),m||(Xn.has(f)||f.removeAttribute(r),Xn.delete(f)),p||f.removeAttribute(n)}),no--,no||(Ht=new WeakMap,Ht=new WeakMap,Xn=new WeakMap,Qn={})}},Hl=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=cv(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),dv(r,o,n,"aria-hidden")):function(){return null}},Or="Dialog",[ql]=$t(Or),[fv,nt]=ql(Or),Jl=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!0}=e,l=y.useRef(null),c=y.useRef(null),[u,d]=ln({prop:r,defaultProp:o??!1,onChange:s,caller:Or});return a.jsx(fv,{scope:t,triggerRef:l,contentRef:c,contentId:ht(),titleId:ht(),descriptionId:ht(),open:u,onOpenChange:d,onOpenToggle:y.useCallback(()=>d(f=>!f),[d]),modal:i,children:n})};Jl.displayName=Or;var Kl="DialogTrigger",Gl=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=nt(Kl,n),s=Ie(t,o.triggerRef);return a.jsx(Ce.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":us(o.open),...r,ref:s,onClick:ye(e.onClick,o.onOpenToggle)})});Gl.displayName=Kl;var ls="DialogPortal",[hv,Yl]=ql(ls,{forceMount:void 0}),Xl=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=nt(ls,t);return a.jsx(hv,{scope:t,forceMount:n,children:y.Children.map(r,i=>a.jsx(Bt,{present:n||s.open,children:a.jsx(Ar,{asChild:!0,container:o,children:i})}))})};Xl.displayName=ls;var mr="DialogOverlay",Ql=y.forwardRef((e,t)=>{const n=Yl(mr,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=nt(mr,e.__scopeDialog);return s.modal?a.jsx(Bt,{present:r||s.open,children:a.jsx(mv,{...o,ref:t})}):null});Ql.displayName=mr;var pv=an("DialogOverlay.RemoveScroll"),mv=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=nt(mr,n);return a.jsx(as,{as:pv,allowPinchZoom:!0,shards:[o.contentRef],children:a.jsx(Ce.div,{"data-state":us(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),It="DialogContent",ec=y.forwardRef((e,t)=>{const n=Yl(It,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=nt(It,e.__scopeDialog);return a.jsx(Bt,{present:r||s.open,children:s.modal?a.jsx(gv,{...o,ref:t}):a.jsx(xv,{...o,ref:t})})});ec.displayName=It;var gv=y.forwardRef((e,t)=>{const n=nt(It,e.__scopeDialog),r=y.useRef(null),o=Ie(t,n.contentRef,r);return y.useEffect(()=>{const s=r.current;if(s)return Hl(s)},[]),a.jsx(tc,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ye(e.onCloseAutoFocus,s=>{s.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:ye(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&s.preventDefault()}),onFocusOutside:ye(e.onFocusOutside,s=>s.preventDefault())})}),xv=y.forwardRef((e,t)=>{const n=nt(It,e.__scopeDialog),r=y.useRef(!1),o=y.useRef(!1);return a.jsx(tc,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{e.onCloseAutoFocus?.(s),s.defaultPrevented||(r.current||n.triggerRef.current?.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{e.onInteractOutside?.(s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=s.target;n.triggerRef.current?.contains(i)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),tc=y.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...i}=e,l=nt(It,n),c=y.useRef(null),u=Ie(t,c);return Dl(),a.jsxs(a.Fragment,{children:[a.jsx(is,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:a.jsx(Tr,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":us(l.open),...i,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(yv,{titleId:l.titleId}),a.jsx(wv,{contentRef:c,descriptionId:l.descriptionId})]})]})}),cs="DialogTitle",nc=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=nt(cs,n);return a.jsx(Ce.h2,{id:o.titleId,...r,ref:t})});nc.displayName=cs;var rc="DialogDescription",vv=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=nt(rc,n);return a.jsx(Ce.p,{id:o.descriptionId,...r,ref:t})});vv.displayName=rc;var oc="DialogClose",sc=y.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=nt(oc,n);return a.jsx(Ce.button,{type:"button",...r,ref:t,onClick:ye(e.onClick,()=>o.onOpenChange(!1))})});sc.displayName=oc;function us(e){return e?"open":"closed"}var ic="DialogTitleWarning",[Bk,ac]=e1(ic,{contentName:It,titleName:cs,docsSlug:"dialog"}),yv=({titleId:e})=>{const t=ac(ic),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 y.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},bv="DialogDescriptionWarning",wv=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ac(bv).contentName}}.`;return y.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},_v=Jl,kv=Gl,Cv=Xl,Sv=Ql,jv=ec,Ev=nc,Nv=sc;function Tv(e){const t=y.useRef({value:e,previous:e});return y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function Av(e){const[t,n]=y.useState(void 0);return Ue(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,l;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;i=u.inlineSize,l=u.blockSize}else i=e.offsetWidth,l=e.offsetHeight;n({width:i,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const zv=["top","right","bottom","left"],kt=Math.min,qe=Math.max,gr=Math.round,er=Math.floor,it=e=>({x:e,y:e}),Ov={left:"right",right:"left",bottom:"top",top:"bottom"},Iv={start:"end",end:"start"};function So(e,t,n){return qe(e,kt(t,n))}function mt(e,t){return typeof e=="function"?e(t):e}function gt(e){return e.split("-")[0]}function mn(e){return e.split("-")[1]}function ds(e){return e==="x"?"y":"x"}function fs(e){return e==="y"?"height":"width"}const Rv=new Set(["top","bottom"]);function st(e){return Rv.has(gt(e))?"y":"x"}function hs(e){return ds(st(e))}function Pv(e,t,n){n===void 0&&(n=!1);const r=mn(e),o=hs(e),s=fs(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=xr(i)),[i,xr(i)]}function Mv(e){const t=xr(e);return[jo(e),t,jo(t)]}function jo(e){return e.replace(/start|end/g,t=>Iv[t])}const Si=["left","right"],ji=["right","left"],Dv=["top","bottom"],Lv=["bottom","top"];function Fv(e,t,n){switch(e){case"top":case"bottom":return n?t?ji:Si:t?Si:ji;case"left":case"right":return t?Dv:Lv;default:return[]}}function $v(e,t,n,r){const o=mn(e);let s=Fv(gt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(jo)))),s}function xr(e){return e.replace(/left|right|bottom|top/g,t=>Ov[t])}function Bv(e){return{top:0,right:0,bottom:0,left:0,...e}}function lc(e){return typeof e!="number"?Bv(e):{top:e,right:e,bottom:e,left:e}}function vr(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 Ei(e,t,n){let{reference:r,floating:o}=e;const s=st(t),i=hs(t),l=fs(i),c=gt(t),u=s==="y",d=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,m=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(mn(t)){case"start":p[i]-=m*(n&&u?-1:1);break;case"end":p[i]+=m*(n&&u?-1:1);break}return p}async function Uv(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:m=!1,padding:p=0}=mt(t,e),g=lc(p),x=l[m?f==="floating"?"reference":"floating":f],v=vr(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(x)))==null||n?x:x.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),_=f==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),C=await(s.isElement==null?void 0:s.isElement(k))?await(s.getScale==null?void 0:s.getScale(k))||{x:1,y:1}:{x:1,y:1},j=vr(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:_,offsetParent:k,strategy:c}):_);return{top:(v.top-j.top+g.top)/C.y,bottom:(j.bottom-v.bottom+g.bottom)/C.y,left:(v.left-j.left+g.left)/C.x,right:(j.right-v.right+g.right)/C.x}}const Zv=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,l=s.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:f}=Ei(u,r,c),m=r,p={},g=0;for(let x=0;x<l.length;x++){var h;const{name:v,fn:_}=l[x],{x:k,y:C,data:j,reset:z}=await _({x:d,y:f,initialPlacement:r,placement:m,strategy:o,middlewareData:p,rects:u,platform:{...i,detectOverflow:(h=i.detectOverflow)!=null?h:Uv},elements:{reference:e,floating:t}});d=k??d,f=C??f,p={...p,[v]:{...p[v],...j}},z&&g<=50&&(g++,typeof z=="object"&&(z.placement&&(m=z.placement),z.rects&&(u=z.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):z.rects),{x:d,y:f}=Ei(u,m,c)),x=-1)}return{x:d,y:f,placement:m,strategy:o,middlewareData:p}},Wv=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=mt(e,t)||{};if(u==null)return{};const f=lc(d),m={x:n,y:r},p=hs(o),g=fs(p),h=await i.getDimensions(u),x=p==="y",v=x?"top":"left",_=x?"bottom":"right",k=x?"clientHeight":"clientWidth",C=s.reference[g]+s.reference[p]-m[p]-s.floating[g],j=m[p]-s.reference[p],z=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let E=z?z[k]:0;(!E||!await(i.isElement==null?void 0:i.isElement(z)))&&(E=l.floating[k]||s.floating[g]);const A=C/2-j/2,O=E/2-h[g]/2-1,R=kt(f[v],O),q=kt(f[_],O),S=R,I=E-h[g]-q,b=E/2-h[g]/2+A,P=So(S,b,I),H=!c.arrow&&mn(o)!=null&&b!==P&&s.reference[g]/2-(b<S?R:q)-h[g]/2<0,L=H?b<S?b-S:b-I:0;return{[p]:m[p]+L,data:{[p]:P,centerOffset:b-P-L,...H&&{alignmentOffset:L}},reset:H}}}),Vv=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:h=!0,...x}=mt(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const v=gt(o),_=st(l),k=gt(l)===l,C=await(c.isRTL==null?void 0:c.isRTL(u.floating)),j=m||(k||!h?[xr(l)]:Mv(l)),z=g!=="none";!m&&z&&j.push(...$v(l,h,g,C));const E=[l,...j],A=await c.detectOverflow(t,x),O=[];let R=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&O.push(A[v]),f){const b=Pv(o,i,C);O.push(A[b[0]],A[b[1]])}if(R=[...R,{placement:o,overflows:O}],!O.every(b=>b<=0)){var q,S;const b=(((q=s.flip)==null?void 0:q.index)||0)+1,P=E[b];if(P&&(!(f==="alignment"?_!==st(P):!1)||R.every(B=>st(B.placement)===_?B.overflows[0]>0:!0)))return{data:{index:b,overflows:R},reset:{placement:P}};let H=(S=R.filter(L=>L.overflows[0]<=0).sort((L,B)=>L.overflows[1]-B.overflows[1])[0])==null?void 0:S.placement;if(!H)switch(p){case"bestFit":{var I;const L=(I=R.filter(B=>{if(z){const K=st(B.placement);return K===_||K==="y"}return!0}).map(B=>[B.placement,B.overflows.filter(K=>K>0).reduce((K,se)=>K+se,0)]).sort((B,K)=>B[1]-K[1])[0])==null?void 0:I[0];L&&(H=L);break}case"initialPlacement":H=l;break}if(o!==H)return{reset:{placement:H}}}return{}}}};function Ni(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ti(e){return zv.some(t=>e[t]>=0)}const Hv=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=mt(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),l=Ni(i,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Ti(l)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),l=Ni(i,n.floating);return{data:{escapedOffsets:l,escaped:Ti(l)}}}default:return{}}}}},cc=new Set(["left","top"]);async function qv(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=gt(n),l=mn(n),c=st(n)==="y",u=cc.has(i)?-1:1,d=s&&c?-1:1,f=mt(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof g=="number"&&(p=l==="end"?g*-1:g),c?{x:p*d,y:m*u}:{x:m*u,y:p*d}}const Jv=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:l}=t,c=await qv(t,e);return i===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:i}}}}},Kv=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:v=>{let{x:_,y:k}=v;return{x:_,y:k}}},...u}=mt(e,t),d={x:n,y:r},f=await s.detectOverflow(t,u),m=st(gt(o)),p=ds(m);let g=d[p],h=d[m];if(i){const v=p==="y"?"top":"left",_=p==="y"?"bottom":"right",k=g+f[v],C=g-f[_];g=So(k,g,C)}if(l){const v=m==="y"?"top":"left",_=m==="y"?"bottom":"right",k=h+f[v],C=h-f[_];h=So(k,h,C)}const x=c.fn({...t,[p]:g,[m]:h});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[p]:i,[m]:l}}}}}},Gv=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=mt(e,t),d={x:n,y:r},f=st(o),m=ds(f);let p=d[m],g=d[f];const h=mt(l,t),x=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const k=m==="y"?"height":"width",C=s.reference[m]-s.floating[k]+x.mainAxis,j=s.reference[m]+s.reference[k]-x.mainAxis;p<C?p=C:p>j&&(p=j)}if(u){var v,_;const k=m==="y"?"width":"height",C=cc.has(gt(o)),j=s.reference[f]-s.floating[k]+(C&&((v=i.offset)==null?void 0:v[f])||0)+(C?0:x.crossAxis),z=s.reference[f]+s.reference[k]+(C?0:((_=i.offset)==null?void 0:_[f])||0)-(C?x.crossAxis:0);g<j?g=j:g>z&&(g=z)}return{[m]:p,[f]:g}}}},Yv=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:l}=t,{apply:c=()=>{},...u}=mt(e,t),d=await i.detectOverflow(t,u),f=gt(o),m=mn(o),p=st(o)==="y",{width:g,height:h}=s.floating;let x,v;f==="top"||f==="bottom"?(x=f,v=m===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(v=f,x=m==="end"?"top":"bottom");const _=h-d.top-d.bottom,k=g-d.left-d.right,C=kt(h-d[x],_),j=kt(g-d[v],k),z=!t.middlewareData.shift;let E=C,A=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=_),z&&!m){const R=qe(d.left,0),q=qe(d.right,0),S=qe(d.top,0),I=qe(d.bottom,0);p?A=g-2*(R!==0||q!==0?R+q:qe(d.left,d.right)):E=h-2*(S!==0||I!==0?S+I:qe(d.top,d.bottom))}await c({...t,availableWidth:A,availableHeight:E});const O=await i.getDimensions(l.floating);return g!==O.width||h!==O.height?{reset:{rects:!0}}:{}}}};function Ir(){return typeof window<"u"}function gn(e){return uc(e)?(e.nodeName||"").toLowerCase():"#document"}function Ke(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function lt(e){var t;return(t=(uc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function uc(e){return Ir()?e instanceof Node||e instanceof Ke(e).Node:!1}function et(e){return Ir()?e instanceof Element||e instanceof Ke(e).Element:!1}function at(e){return Ir()?e instanceof HTMLElement||e instanceof Ke(e).HTMLElement:!1}function Ai(e){return!Ir()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ke(e).ShadowRoot}const Xv=new Set(["inline","contents"]);function Dn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=tt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Xv.has(o)}const Qv=new Set(["table","td","th"]);function ey(e){return Qv.has(gn(e))}const ty=[":popover-open",":modal"];function Rr(e){return ty.some(t=>{try{return e.matches(t)}catch{return!1}})}const ny=["transform","translate","scale","rotate","perspective"],ry=["transform","translate","scale","rotate","perspective","filter"],oy=["paint","layout","strict","content"];function ps(e){const t=ms(),n=et(e)?tt(e):e;return ny.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)||ry.some(r=>(n.willChange||"").includes(r))||oy.some(r=>(n.contain||"").includes(r))}function sy(e){let t=Ct(e);for(;at(t)&&!cn(t);){if(ps(t))return t;if(Rr(t))return null;t=Ct(t)}return null}function ms(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const iy=new Set(["html","body","#document"]);function cn(e){return iy.has(gn(e))}function tt(e){return Ke(e).getComputedStyle(e)}function Pr(e){return et(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ct(e){if(gn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ai(e)&&e.host||lt(e);return Ai(t)?t.host:t}function dc(e){const t=Ct(e);return cn(t)?e.ownerDocument?e.ownerDocument.body:e.body:at(t)&&Dn(t)?t:dc(t)}function zn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=dc(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Ke(o);if(s){const l=Eo(i);return t.concat(i,i.visualViewport||[],Dn(o)?o:[],l&&n?zn(l):[])}return t.concat(o,zn(o,[],n))}function Eo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function fc(e){const t=tt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=at(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=gr(n)!==s||gr(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function gs(e){return et(e)?e:e.contextElement}function en(e){const t=gs(e);if(!at(t))return it(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=fc(t);let i=(s?gr(n.width):n.width)/r,l=(s?gr(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const ay=it(0);function hc(e){const t=Ke(e);return!ms()||!t.visualViewport?ay:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ly(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ke(e)?!1:t}function Rt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=gs(e);let i=it(1);t&&(r?et(r)&&(i=en(r)):i=en(e));const l=ly(s,n,r)?hc(s):it(0);let c=(o.left+l.x)/i.x,u=(o.top+l.y)/i.y,d=o.width/i.x,f=o.height/i.y;if(s){const m=Ke(s),p=r&&et(r)?Ke(r):r;let g=m,h=Eo(g);for(;h&&r&&p!==g;){const x=en(h),v=h.getBoundingClientRect(),_=tt(h),k=v.left+(h.clientLeft+parseFloat(_.paddingLeft))*x.x,C=v.top+(h.clientTop+parseFloat(_.paddingTop))*x.y;c*=x.x,u*=x.y,d*=x.x,f*=x.y,c+=k,u+=C,g=Ke(h),h=Eo(g)}}return vr({width:d,height:f,x:c,y:u})}function Mr(e,t){const n=Pr(e).scrollLeft;return t?t.left+n:Rt(lt(e)).left+n}function pc(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Mr(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function cy(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=lt(r),l=t?Rr(t.floating):!1;if(r===i||l&&s)return n;let c={scrollLeft:0,scrollTop:0},u=it(1);const d=it(0),f=at(r);if((f||!f&&!s)&&((gn(r)!=="body"||Dn(i))&&(c=Pr(r)),at(r))){const p=Rt(r);u=en(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const m=i&&!f&&!s?pc(i,c):it(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+m.x,y:n.y*u.y-c.scrollTop*u.y+d.y+m.y}}function uy(e){return Array.from(e.getClientRects())}function dy(e){const t=lt(e),n=Pr(e),r=e.ownerDocument.body,o=qe(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=qe(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Mr(e);const l=-n.scrollTop;return tt(r).direction==="rtl"&&(i+=qe(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:l}}const zi=25;function fy(e,t){const n=Ke(e),r=lt(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,l=0,c=0;if(o){s=o.width,i=o.height;const d=ms();(!d||d&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}const u=Mr(r);if(u<=0){const d=r.ownerDocument,f=d.body,m=getComputedStyle(f),p=d.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,g=Math.abs(r.clientWidth-f.clientWidth-p);g<=zi&&(s-=g)}else u<=zi&&(s+=u);return{width:s,height:i,x:l,y:c}}const hy=new Set(["absolute","fixed"]);function py(e,t){const n=Rt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=at(e)?en(e):it(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,c=o*s.x,u=r*s.y;return{width:i,height:l,x:c,y:u}}function Oi(e,t,n){let r;if(t==="viewport")r=fy(e,n);else if(t==="document")r=dy(lt(e));else if(et(t))r=py(t,n);else{const o=hc(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return vr(r)}function mc(e,t){const n=Ct(e);return n===t||!et(n)||cn(n)?!1:tt(n).position==="fixed"||mc(n,t)}function my(e,t){const n=t.get(e);if(n)return n;let r=zn(e,[],!1).filter(l=>et(l)&&gn(l)!=="body"),o=null;const s=tt(e).position==="fixed";let i=s?Ct(e):e;for(;et(i)&&!cn(i);){const l=tt(i),c=ps(i);!c&&l.position==="fixed"&&(o=null),(s?!c&&!o:!c&&l.position==="static"&&!!o&&hy.has(o.position)||Dn(i)&&!c&&mc(e,i))?r=r.filter(d=>d!==i):o=l,i=Ct(i)}return t.set(e,r),r}function gy(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Rr(t)?[]:my(t,this._c):[].concat(n),r],l=i[0],c=i.reduce((u,d)=>{const f=Oi(t,d,o);return u.top=qe(f.top,u.top),u.right=kt(f.right,u.right),u.bottom=kt(f.bottom,u.bottom),u.left=qe(f.left,u.left),u},Oi(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function xy(e){const{width:t,height:n}=fc(e);return{width:t,height:n}}function vy(e,t,n){const r=at(t),o=lt(t),s=n==="fixed",i=Rt(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=it(0);function u(){c.x=Mr(o)}if(r||!r&&!s)if((gn(t)!=="body"||Dn(o))&&(l=Pr(t)),r){const p=Rt(t,!0,s,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else o&&u();s&&!r&&o&&u();const d=o&&!r&&!s?pc(o,l):it(0),f=i.left+l.scrollLeft-c.x-d.x,m=i.top+l.scrollTop-c.y-d.y;return{x:f,y:m,width:i.width,height:i.height}}function ro(e){return tt(e).position==="static"}function Ii(e,t){if(!at(e)||tt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return lt(e)===n&&(n=n.ownerDocument.body),n}function gc(e,t){const n=Ke(e);if(Rr(e))return n;if(!at(e)){let o=Ct(e);for(;o&&!cn(o);){if(et(o)&&!ro(o))return o;o=Ct(o)}return n}let r=Ii(e,t);for(;r&&ey(r)&&ro(r);)r=Ii(r,t);return r&&cn(r)&&ro(r)&&!ps(r)?n:r||sy(e)||n}const yy=async function(e){const t=this.getOffsetParent||gc,n=this.getDimensions,r=await n(e.floating);return{reference:vy(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function by(e){return tt(e).direction==="rtl"}const wy={convertOffsetParentRelativeRectToViewportRelativeRect:cy,getDocumentElement:lt,getClippingRect:gy,getOffsetParent:gc,getElementRects:yy,getClientRects:uy,getDimensions:xy,getScale:en,isElement:et,isRTL:by};function xc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function _y(e,t){let n=null,r;const o=lt(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const u=e.getBoundingClientRect(),{left:d,top:f,width:m,height:p}=u;if(l||t(),!m||!p)return;const g=er(f),h=er(o.clientWidth-(d+m)),x=er(o.clientHeight-(f+p)),v=er(d),k={rootMargin:-g+"px "+-h+"px "+-x+"px "+-v+"px",threshold:qe(0,kt(1,c))||1};let C=!0;function j(z){const E=z[0].intersectionRatio;if(E!==c){if(!C)return i();E?i(!1,E):r=setTimeout(()=>{i(!1,1e-7)},1e3)}E===1&&!xc(u,e.getBoundingClientRect())&&i(),C=!1}try{n=new IntersectionObserver(j,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(j,k)}n.observe(e)}return i(!0),s}function ky(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=gs(e),d=o||s?[...u?zn(u):[],...zn(t)]:[];d.forEach(v=>{o&&v.addEventListener("scroll",n,{passive:!0}),s&&v.addEventListener("resize",n)});const f=u&&l?_y(u,n):null;let m=-1,p=null;i&&(p=new ResizeObserver(v=>{let[_]=v;_&&_.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var k;(k=p)==null||k.observe(t)})),n()}),u&&!c&&p.observe(u),p.observe(t));let g,h=c?Rt(e):null;c&&x();function x(){const v=Rt(e);h&&!xc(h,v)&&n(),h=v,g=requestAnimationFrame(x)}return n(),()=>{var v;d.forEach(_=>{o&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),f?.(),(v=p)==null||v.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const Cy=Jv,Sy=Kv,jy=Vv,Ey=Yv,Ny=Hv,Ri=Wv,Ty=Gv,Ay=(e,t,n)=>{const r=new Map,o={platform:wy,...n},s={...o.platform,_c:r};return Zv(e,t,{...o,platform:s})};var zy=typeof document<"u",Oy=function(){},ar=zy?y.useLayoutEffect:Oy;function yr(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(!yr(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 s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!yr(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function vc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Pi(e,t){const n=vc(e);return Math.round(t*n)/n}function oo(e){const t=y.useRef(e);return ar(()=>{t.current=e}),t}function Iy(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,p]=y.useState(r);yr(m,r)||p(r);const[g,h]=y.useState(null),[x,v]=y.useState(null),_=y.useCallback(B=>{B!==z.current&&(z.current=B,h(B))},[]),k=y.useCallback(B=>{B!==E.current&&(E.current=B,v(B))},[]),C=s||g,j=i||x,z=y.useRef(null),E=y.useRef(null),A=y.useRef(d),O=c!=null,R=oo(c),q=oo(o),S=oo(u),I=y.useCallback(()=>{if(!z.current||!E.current)return;const B={placement:t,strategy:n,middleware:m};q.current&&(B.platform=q.current),Ay(z.current,E.current,B).then(K=>{const se={...K,isPositioned:S.current!==!1};b.current&&!yr(A.current,se)&&(A.current=se,Rn.flushSync(()=>{f(se)}))})},[m,t,n,q,S]);ar(()=>{u===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,f(B=>({...B,isPositioned:!1})))},[u]);const b=y.useRef(!1);ar(()=>(b.current=!0,()=>{b.current=!1}),[]),ar(()=>{if(C&&(z.current=C),j&&(E.current=j),C&&j){if(R.current)return R.current(C,j,I);I()}},[C,j,I,R,O]);const P=y.useMemo(()=>({reference:z,floating:E,setReference:_,setFloating:k}),[_,k]),H=y.useMemo(()=>({reference:C,floating:j}),[C,j]),L=y.useMemo(()=>{const B={position:n,left:0,top:0};if(!H.floating)return B;const K=Pi(H.floating,d.x),se=Pi(H.floating,d.y);return l?{...B,transform:"translate("+K+"px, "+se+"px)",...vc(H.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:K,top:se}},[n,l,H.floating,d.x,d.y]);return y.useMemo(()=>({...d,update:I,refs:P,elements:H,floatingStyles:L}),[d,I,P,H,L])}const Ry=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?Ri({element:r.current,padding:o}).fn(n):{}:r?Ri({element:r,padding:o}).fn(n):{}}}},Py=(e,t)=>({...Cy(e),options:[e,t]}),My=(e,t)=>({...Sy(e),options:[e,t]}),Dy=(e,t)=>({...Ty(e),options:[e,t]}),Ly=(e,t)=>({...jy(e),options:[e,t]}),Fy=(e,t)=>({...Ey(e),options:[e,t]}),$y=(e,t)=>({...Ny(e),options:[e,t]}),By=(e,t)=>({...Ry(e),options:[e,t]});var Uy="Arrow",yc=y.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return a.jsx(Ce.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});yc.displayName=Uy;var Zy=yc,xs="Popper",[bc,Dr]=$t(xs),[Wy,wc]=bc(xs),_c=e=>{const{__scopePopper:t,children:n}=e,[r,o]=y.useState(null);return a.jsx(Wy,{scope:t,anchor:r,onAnchorChange:o,children:n})};_c.displayName=xs;var kc="PopperAnchor",Cc=y.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=wc(kc,n),i=y.useRef(null),l=Ie(t,i),c=y.useRef(null);return y.useEffect(()=>{const u=c.current;c.current=r?.current||i.current,u!==c.current&&s.onAnchorChange(c.current)}),r?null:a.jsx(Ce.div,{...o,ref:l})});Cc.displayName=kc;var vs="PopperContent",[Vy,Hy]=bc(vs),Sc=y.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:m=!1,updatePositionStrategy:p="optimized",onPlaced:g,...h}=e,x=wc(vs,n),[v,_]=y.useState(null),k=Ie(t,X=>_(X)),[C,j]=y.useState(null),z=Av(C),E=z?.width??0,A=z?.height??0,O=r+(s!=="center"?"-"+s:""),R=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},q=Array.isArray(u)?u:[u],S=q.length>0,I={padding:R,boundary:q.filter(Jy),altBoundary:S},{refs:b,floatingStyles:P,placement:H,isPositioned:L,middlewareData:B}=Iy({strategy:"fixed",placement:O,whileElementsMounted:(...X)=>ky(...X,{animationFrame:p==="always"}),elements:{reference:x.anchor},middleware:[Py({mainAxis:o+A,alignmentAxis:i}),c&&My({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?Dy():void 0,...I}),c&&Ly({...I}),Fy({...I,apply:({elements:X,rects:ie,availableWidth:ae,availableHeight:he})=>{const{width:fe,height:we}=ie.reference,Te=X.floating.style;Te.setProperty("--radix-popper-available-width",`${ae}px`),Te.setProperty("--radix-popper-available-height",`${he}px`),Te.setProperty("--radix-popper-anchor-width",`${fe}px`),Te.setProperty("--radix-popper-anchor-height",`${we}px`)}}),C&&By({element:C,padding:l}),Ky({arrowWidth:E,arrowHeight:A}),m&&$y({strategy:"referenceHidden",...I})]}),[K,se]=Nc(H),U=_t(g);Ue(()=>{L&&U?.()},[L,U]);const $=B.arrow?.x,oe=B.arrow?.y,ee=B.arrow?.centerOffset!==0,[J,ue]=y.useState();return Ue(()=>{v&&ue(window.getComputedStyle(v).zIndex)},[v]),a.jsx("div",{ref:b.setFloating,"data-radix-popper-content-wrapper":"",style:{...P,transform:L?P.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:J,"--radix-popper-transform-origin":[B.transformOrigin?.x,B.transformOrigin?.y].join(" "),...B.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(Vy,{scope:n,placedSide:K,onArrowChange:j,arrowX:$,arrowY:oe,shouldHideArrow:ee,children:a.jsx(Ce.div,{"data-side":K,"data-align":se,...h,ref:k,style:{...h.style,animation:L?void 0:"none"}})})})});Sc.displayName=vs;var jc="PopperArrow",qy={top:"bottom",right:"left",bottom:"top",left:"right"},Ec=y.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=Hy(jc,r),i=qy[s.placedSide];return a.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:a.jsx(Zy,{...o,ref:n,style:{...o.style,display:"block"}})})});Ec.displayName=jc;function Jy(e){return e!==null}var Ky=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=o.arrow?.centerOffset!==0,l=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,d]=Nc(n),f={start:"0%",center:"50%",end:"100%"}[d],m=(o.arrow?.x??0)+l/2,p=(o.arrow?.y??0)+c/2;let g="",h="";return u==="bottom"?(g=i?f:`${m}px`,h=`${-c}px`):u==="top"?(g=i?f:`${m}px`,h=`${r.floating.height+c}px`):u==="right"?(g=`${-c}px`,h=i?f:`${p}px`):u==="left"&&(g=`${r.floating.width+c}px`,h=i?f:`${p}px`),{data:{x:g,y:h}}}});function Nc(e){const[t,n="center"]=e.split("-");return[t,n]}var Tc=_c,Ac=Cc,zc=Sc,Oc=Ec,so="rovingFocusGroup.onEntryFocus",Gy={bubbles:!1,cancelable:!0},Ln="RovingFocusGroup",[No,Ic,Yy]=Il(Ln),[Xy,Rc]=$t(Ln,[Yy]),[Qy,eb]=Xy(Ln),Pc=y.forwardRef((e,t)=>a.jsx(No.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(No.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(tb,{...e,ref:t})})}));Pc.displayName=Ln;var tb=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,m=y.useRef(null),p=Ie(t,m),g=ss(s),[h,x]=ln({prop:i,defaultProp:l??null,onChange:c,caller:Ln}),[v,_]=y.useState(!1),k=_t(u),C=Ic(n),j=y.useRef(!1),[z,E]=y.useState(0);return y.useEffect(()=>{const A=m.current;if(A)return A.addEventListener(so,k),()=>A.removeEventListener(so,k)},[k]),a.jsx(Qy,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:h,onItemFocus:y.useCallback(A=>x(A),[x]),onItemShiftTab:y.useCallback(()=>_(!0),[]),onFocusableItemAdd:y.useCallback(()=>E(A=>A+1),[]),onFocusableItemRemove:y.useCallback(()=>E(A=>A-1),[]),children:a.jsx(Ce.div,{tabIndex:v||z===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:ye(e.onMouseDown,()=>{j.current=!0}),onFocus:ye(e.onFocus,A=>{const O=!j.current;if(A.target===A.currentTarget&&O&&!v){const R=new CustomEvent(so,Gy);if(A.currentTarget.dispatchEvent(R),!R.defaultPrevented){const q=C().filter(H=>H.focusable),S=q.find(H=>H.active),I=q.find(H=>H.id===h),P=[S,I,...q].filter(Boolean).map(H=>H.ref.current);Lc(P,d)}}j.current=!1}),onBlur:ye(e.onBlur,()=>_(!1))})})}),Mc="RovingFocusGroupItem",Dc=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...l}=e,c=ht(),u=s||c,d=eb(Mc,n),f=d.currentTabStopId===u,m=Ic(n),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:h}=d;return y.useEffect(()=>{if(r)return p(),()=>g()},[r,p,g]),a.jsx(No.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:a.jsx(Ce.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:ye(e.onMouseDown,x=>{r?d.onItemFocus(u):x.preventDefault()}),onFocus:ye(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:ye(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){d.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const v=ob(x,d.orientation,d.dir);if(v!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let k=m().filter(C=>C.focusable).map(C=>C.ref.current);if(v==="last")k.reverse();else if(v==="prev"||v==="next"){v==="prev"&&k.reverse();const C=k.indexOf(x.currentTarget);k=d.loop?sb(k,C+1):k.slice(C+1)}setTimeout(()=>Lc(k))}}),children:typeof i=="function"?i({isCurrentTabStop:f,hasTabStop:h!=null}):i})})});Dc.displayName=Mc;var nb={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function rb(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function ob(e,t,n){const r=rb(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return nb[r]}function Lc(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function sb(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ib=Pc,ab=Dc;function Mi(e,[t,n]){return Math.min(n,Math.max(t,e))}var lb=[" ","Enter","ArrowUp","ArrowDown"],cb=[" ","Enter"],Pt="Select",[Lr,Fr,ub]=Il(Pt),[xn]=$t(Pt,[ub,Dr]),$r=Dr(),[db,Nt]=xn(Pt),[fb,hb]=xn(Pt),Fc=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:m,required:p,form:g}=e,h=$r(t),[x,v]=y.useState(null),[_,k]=y.useState(null),[C,j]=y.useState(!1),z=ss(u),[E,A]=ln({prop:r,defaultProp:o??!1,onChange:s,caller:Pt}),[O,R]=ln({prop:i,defaultProp:l,onChange:c,caller:Pt}),q=y.useRef(null),S=x?g||!!x.closest("form"):!0,[I,b]=y.useState(new Set),P=Array.from(I).map(H=>H.props.value).join(";");return a.jsx(Tc,{...h,children:a.jsxs(db,{required:p,scope:t,trigger:x,onTriggerChange:v,valueNode:_,onValueNodeChange:k,valueNodeHasChildren:C,onValueNodeHasChildrenChange:j,contentId:ht(),value:O,onValueChange:R,open:E,onOpenChange:A,dir:z,triggerPointerDownPosRef:q,disabled:m,children:[a.jsx(Lr.Provider,{scope:t,children:a.jsx(fb,{scope:e.__scopeSelect,onNativeOptionAdd:y.useCallback(H=>{b(L=>new Set(L).add(H))},[]),onNativeOptionRemove:y.useCallback(H=>{b(L=>{const B=new Set(L);return B.delete(H),B})},[]),children:n})}),S?a.jsxs(au,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:f,value:O,onChange:H=>R(H.target.value),disabled:m,form:g,children:[O===void 0?a.jsx("option",{value:""}):null,Array.from(I)]},P):null]})})};Fc.displayName=Pt;var $c="SelectTrigger",Bc=y.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=$r(n),i=Nt($c,n),l=i.disabled||r,c=Ie(t,i.onTriggerChange),u=Fr(n),d=y.useRef("touch"),[f,m,p]=cu(h=>{const x=u().filter(k=>!k.disabled),v=x.find(k=>k.value===i.value),_=uu(x,h,v);_!==void 0&&i.onValueChange(_.value)}),g=h=>{l||(i.onOpenChange(!0),p()),h&&(i.triggerPointerDownPosRef.current={x:Math.round(h.pageX),y:Math.round(h.pageY)})};return a.jsx(Ac,{asChild:!0,...s,children:a.jsx(Ce.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":lu(i.value)?"":void 0,...o,ref:c,onClick:ye(o.onClick,h=>{h.currentTarget.focus(),d.current!=="mouse"&&g(h)}),onPointerDown:ye(o.onPointerDown,h=>{d.current=h.pointerType;const x=h.target;x.hasPointerCapture(h.pointerId)&&x.releasePointerCapture(h.pointerId),h.button===0&&h.ctrlKey===!1&&h.pointerType==="mouse"&&(g(h),h.preventDefault())}),onKeyDown:ye(o.onKeyDown,h=>{const x=f.current!=="";!(h.ctrlKey||h.altKey||h.metaKey)&&h.key.length===1&&m(h.key),!(x&&h.key===" ")&&lb.includes(h.key)&&(g(),h.preventDefault())})})})});Bc.displayName=$c;var Uc="SelectValue",Zc=y.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...l}=e,c=Nt(Uc,n),{onValueNodeHasChildrenChange:u}=c,d=s!==void 0,f=Ie(t,c.onValueNodeChange);return Ue(()=>{u(d)},[u,d]),a.jsx(Ce.span,{...l,ref:f,style:{pointerEvents:"none"},children:lu(c.value)?a.jsx(a.Fragment,{children:i}):s})});Zc.displayName=Uc;var pb="SelectIcon",Wc=y.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return a.jsx(Ce.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});Wc.displayName=pb;var mb="SelectPortal",Vc=e=>a.jsx(Ar,{asChild:!0,...e});Vc.displayName=mb;var Mt="SelectContent",Hc=y.forwardRef((e,t)=>{const n=Nt(Mt,e.__scopeSelect),[r,o]=y.useState();if(Ue(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?Rn.createPortal(a.jsx(qc,{scope:e.__scopeSelect,children:a.jsx(Lr.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),s):null}return a.jsx(Jc,{...e,ref:t})});Hc.displayName=Mt;var Qe=10,[qc,Tt]=xn(Mt),gb="SelectContentImpl",xb=an("SelectContent.RemoveScroll"),Jc=y.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:p,sticky:g,hideWhenDetached:h,avoidCollisions:x,...v}=e,_=Nt(Mt,n),[k,C]=y.useState(null),[j,z]=y.useState(null),E=Ie(t,X=>C(X)),[A,O]=y.useState(null),[R,q]=y.useState(null),S=Fr(n),[I,b]=y.useState(!1),P=y.useRef(!1);y.useEffect(()=>{if(k)return Hl(k)},[k]),Dl();const H=y.useCallback(X=>{const[ie,...ae]=S().map(we=>we.ref.current),[he]=ae.slice(-1),fe=document.activeElement;for(const we of X)if(we===fe||(we?.scrollIntoView({block:"nearest"}),we===ie&&j&&(j.scrollTop=0),we===he&&j&&(j.scrollTop=j.scrollHeight),we?.focus(),document.activeElement!==fe))return},[S,j]),L=y.useCallback(()=>H([A,k]),[H,A,k]);y.useEffect(()=>{I&&L()},[I,L]);const{onOpenChange:B,triggerPointerDownPosRef:K}=_;y.useEffect(()=>{if(k){let X={x:0,y:0};const ie=he=>{X={x:Math.abs(Math.round(he.pageX)-(K.current?.x??0)),y:Math.abs(Math.round(he.pageY)-(K.current?.y??0))}},ae=he=>{X.x<=10&&X.y<=10?he.preventDefault():k.contains(he.target)||B(!1),document.removeEventListener("pointermove",ie),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",ie),document.addEventListener("pointerup",ae,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",ae,{capture:!0})}}},[k,B,K]),y.useEffect(()=>{const X=()=>B(!1);return window.addEventListener("blur",X),window.addEventListener("resize",X),()=>{window.removeEventListener("blur",X),window.removeEventListener("resize",X)}},[B]);const[se,U]=cu(X=>{const ie=S().filter(fe=>!fe.disabled),ae=ie.find(fe=>fe.ref.current===document.activeElement),he=uu(ie,X,ae);he&&setTimeout(()=>he.ref.current.focus())}),$=y.useCallback((X,ie,ae)=>{const he=!P.current&&!ae;(_.value!==void 0&&_.value===ie||he)&&(O(X),he&&(P.current=!0))},[_.value]),oe=y.useCallback(()=>k?.focus(),[k]),ee=y.useCallback((X,ie,ae)=>{const he=!P.current&&!ae;(_.value!==void 0&&_.value===ie||he)&&q(X)},[_.value]),J=r==="popper"?To:Kc,ue=J===To?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:p,sticky:g,hideWhenDetached:h,avoidCollisions:x}:{};return a.jsx(qc,{scope:n,content:k,viewport:j,onViewportChange:z,itemRefCallback:$,selectedItem:A,onItemLeave:oe,itemTextRefCallback:ee,focusSelectedItem:L,selectedItemText:R,position:r,isPositioned:I,searchRef:se,children:a.jsx(as,{as:xb,allowPinchZoom:!0,children:a.jsx(is,{asChild:!0,trapped:_.open,onMountAutoFocus:X=>{X.preventDefault()},onUnmountAutoFocus:ye(o,X=>{_.trigger?.focus({preventScroll:!0}),X.preventDefault()}),children:a.jsx(Tr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:X=>X.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:a.jsx(J,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:X=>X.preventDefault(),...v,...ue,onPlaced:()=>b(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:ye(v.onKeyDown,X=>{const ie=X.ctrlKey||X.altKey||X.metaKey;if(X.key==="Tab"&&X.preventDefault(),!ie&&X.key.length===1&&U(X.key),["ArrowUp","ArrowDown","Home","End"].includes(X.key)){let he=S().filter(fe=>!fe.disabled).map(fe=>fe.ref.current);if(["ArrowUp","End"].includes(X.key)&&(he=he.slice().reverse()),["ArrowUp","ArrowDown"].includes(X.key)){const fe=X.target,we=he.indexOf(fe);he=he.slice(we+1)}setTimeout(()=>H(he)),X.preventDefault()}})})})})})})});Jc.displayName=gb;var vb="SelectItemAlignedPosition",Kc=y.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=Nt(Mt,n),i=Tt(Mt,n),[l,c]=y.useState(null),[u,d]=y.useState(null),f=Ie(t,E=>d(E)),m=Fr(n),p=y.useRef(!1),g=y.useRef(!0),{viewport:h,selectedItem:x,selectedItemText:v,focusSelectedItem:_}=i,k=y.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&h&&x&&v){const E=s.trigger.getBoundingClientRect(),A=u.getBoundingClientRect(),O=s.valueNode.getBoundingClientRect(),R=v.getBoundingClientRect();if(s.dir!=="rtl"){const fe=R.left-A.left,we=O.left-fe,Te=E.left-we,w=E.width+Te,Y=Math.max(w,A.width),V=window.innerWidth-Qe,T=Mi(we,[Qe,Math.max(Qe,V-Y)]);l.style.minWidth=w+"px",l.style.left=T+"px"}else{const fe=A.right-R.right,we=window.innerWidth-O.right-fe,Te=window.innerWidth-E.right-we,w=E.width+Te,Y=Math.max(w,A.width),V=window.innerWidth-Qe,T=Mi(we,[Qe,Math.max(Qe,V-Y)]);l.style.minWidth=w+"px",l.style.right=T+"px"}const q=m(),S=window.innerHeight-Qe*2,I=h.scrollHeight,b=window.getComputedStyle(u),P=parseInt(b.borderTopWidth,10),H=parseInt(b.paddingTop,10),L=parseInt(b.borderBottomWidth,10),B=parseInt(b.paddingBottom,10),K=P+H+I+B+L,se=Math.min(x.offsetHeight*5,K),U=window.getComputedStyle(h),$=parseInt(U.paddingTop,10),oe=parseInt(U.paddingBottom,10),ee=E.top+E.height/2-Qe,J=S-ee,ue=x.offsetHeight/2,X=x.offsetTop+ue,ie=P+H+X,ae=K-ie;if(ie<=ee){const fe=q.length>0&&x===q[q.length-1].ref.current;l.style.bottom="0px";const we=u.clientHeight-h.offsetTop-h.offsetHeight,Te=Math.max(J,ue+(fe?oe:0)+we+L),w=ie+Te;l.style.height=w+"px"}else{const fe=q.length>0&&x===q[0].ref.current;l.style.top="0px";const Te=Math.max(ee,P+h.offsetTop+(fe?$:0)+ue)+ae;l.style.height=Te+"px",h.scrollTop=ie-ee+h.offsetTop}l.style.margin=`${Qe}px 0`,l.style.minHeight=se+"px",l.style.maxHeight=S+"px",r?.(),requestAnimationFrame(()=>p.current=!0)}},[m,s.trigger,s.valueNode,l,u,h,x,v,s.dir,r]);Ue(()=>k(),[k]);const[C,j]=y.useState();Ue(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const z=y.useCallback(E=>{E&&g.current===!0&&(k(),_?.(),g.current=!1)},[k,_]);return a.jsx(bb,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:z,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:a.jsx(Ce.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Kc.displayName=vb;var yb="SelectPopperPosition",To=y.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Qe,...s}=e,i=$r(n);return a.jsx(zc,{...i,...s,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...s.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)"}})});To.displayName=yb;var[bb,ys]=xn(Mt,{}),Ao="SelectViewport",Gc=y.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=Tt(Ao,n),i=ys(Ao,n),l=Ie(t,s.onViewportChange),c=y.useRef(0);return a.jsxs(a.Fragment,{children:[a.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}),a.jsx(Lr.Slot,{scope:n,children:a.jsx(Ce.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ye(o.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:m}=i;if(m?.current&&f){const p=Math.abs(c.current-d.scrollTop);if(p>0){const g=window.innerHeight-Qe*2,h=parseFloat(f.style.minHeight),x=parseFloat(f.style.height),v=Math.max(h,x);if(v<g){const _=v+p,k=Math.min(g,_),C=_-k;f.style.height=k+"px",f.style.bottom==="0px"&&(d.scrollTop=C>0?C:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});Gc.displayName=Ao;var Yc="SelectGroup",[wb,_b]=xn(Yc),kb=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=ht();return a.jsx(wb,{scope:n,id:o,children:a.jsx(Ce.div,{role:"group","aria-labelledby":o,...r,ref:t})})});kb.displayName=Yc;var Xc="SelectLabel",Cb=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=_b(Xc,n);return a.jsx(Ce.div,{id:o.id,...r,ref:t})});Cb.displayName=Xc;var br="SelectItem",[Sb,Qc]=xn(br),eu=y.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,l=Nt(br,n),c=Tt(br,n),u=l.value===r,[d,f]=y.useState(s??""),[m,p]=y.useState(!1),g=Ie(t,_=>c.itemRefCallback?.(_,r,o)),h=ht(),x=y.useRef("touch"),v=()=>{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 a.jsx(Sb,{scope:n,value:r,disabled:o,textId:h,isSelected:u,onItemTextChange:y.useCallback(_=>{f(k=>k||(_?.textContent??"").trim())},[]),children:a.jsx(Lr.ItemSlot,{scope:n,value:r,disabled:o,textValue:d,children:a.jsx(Ce.div,{role:"option","aria-labelledby":h,"data-highlighted":m?"":void 0,"aria-selected":u&&m,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:g,onFocus:ye(i.onFocus,()=>p(!0)),onBlur:ye(i.onBlur,()=>p(!1)),onClick:ye(i.onClick,()=>{x.current!=="mouse"&&v()}),onPointerUp:ye(i.onPointerUp,()=>{x.current==="mouse"&&v()}),onPointerDown:ye(i.onPointerDown,_=>{x.current=_.pointerType}),onPointerMove:ye(i.onPointerMove,_=>{x.current=_.pointerType,o?c.onItemLeave?.():x.current==="mouse"&&_.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ye(i.onPointerLeave,_=>{_.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:ye(i.onKeyDown,_=>{c.searchRef?.current!==""&&_.key===" "||(cb.includes(_.key)&&v(),_.key===" "&&_.preventDefault())})})})})});eu.displayName=br;var En="SelectItemText",tu=y.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=Nt(En,n),l=Tt(En,n),c=Qc(En,n),u=hb(En,n),[d,f]=y.useState(null),m=Ie(t,v=>f(v),c.onItemTextChange,v=>l.itemTextRefCallback?.(v,c.value,c.disabled)),p=d?.textContent,g=y.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:x}=u;return Ue(()=>(h(g),()=>x(g)),[h,x,g]),a.jsxs(a.Fragment,{children:[a.jsx(Ce.span,{id:c.textId,...s,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Rn.createPortal(s.children,i.valueNode):null]})});tu.displayName=En;var nu="SelectItemIndicator",ru=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Qc(nu,n).isSelected?a.jsx(Ce.span,{"aria-hidden":!0,...r,ref:t}):null});ru.displayName=nu;var zo="SelectScrollUpButton",ou=y.forwardRef((e,t)=>{const n=Tt(zo,e.__scopeSelect),r=ys(zo,e.__scopeSelect),[o,s]=y.useState(!1),i=Ie(t,r.onScrollButtonChange);return Ue(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;s(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?a.jsx(iu,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});ou.displayName=zo;var Oo="SelectScrollDownButton",su=y.forwardRef((e,t)=>{const n=Tt(Oo,e.__scopeSelect),r=ys(Oo,e.__scopeSelect),[o,s]=y.useState(!1),i=Ie(t,r.onScrollButtonChange);return Ue(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;s(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?a.jsx(iu,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});su.displayName=Oo;var iu=y.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=Tt("SelectScrollButton",n),i=y.useRef(null),l=Fr(n),c=y.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return y.useEffect(()=>()=>c(),[c]),Ue(()=>{l().find(d=>d.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),a.jsx(Ce.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:ye(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:ye(o.onPointerMove,()=>{s.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:ye(o.onPointerLeave,()=>{c()})})}),jb="SelectSeparator",Eb=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(Ce.div,{"aria-hidden":!0,...r,ref:t})});Eb.displayName=jb;var Io="SelectArrow",Nb=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=$r(n),s=Nt(Io,n),i=Tt(Io,n);return s.open&&i.position==="popper"?a.jsx(Oc,{...o,...r,ref:t}):null});Nb.displayName=Io;var Tb="SelectBubbleInput",au=y.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=y.useRef(null),s=Ie(r,o),i=Tv(t);return y.useEffect(()=>{const l=o.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const f=new Event("change",{bubbles:!0});d.call(l,t),l.dispatchEvent(f)}},[i,t]),a.jsx(Ce.select,{...n,style:{...zl,...n.style},ref:s,defaultValue:t})});au.displayName=Tb;function lu(e){return e===""||e===void 0}function cu(e){const t=_t(e),n=y.useRef(""),r=y.useRef(0),o=y.useCallback(i=>{const l=n.current+i;t(l),(function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(l)},[t]),s=y.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function uu(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=Ab(e,Math.max(s,0));o.length===1&&(i=i.filter(u=>u!==n));const c=i.find(u=>u.textValue.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function Ab(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var zb=Fc,Ob=Bc,Ib=Zc,Rb=Wc,Pb=Vc,Mb=Hc,Db=Gc,Lb=eu,Fb=tu,$b=ru,Bb=ou,Ub=su,Br="Tabs",[Zb]=$t(Br,[Rc]),du=Rc(),[Wb,bs]=Zb(Br),fu=y.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=ss(l),[f,m]=ln({prop:r,onChange:o,defaultProp:s??"",caller:Br});return a.jsx(Wb,{scope:n,baseId:ht(),value:f,onValueChange:m,orientation:i,dir:d,activationMode:c,children:a.jsx(Ce.div,{dir:d,"data-orientation":i,...u,ref:t})})});fu.displayName=Br;var hu="TabsList",pu=y.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=bs(hu,n),i=du(n);return a.jsx(ib,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:a.jsx(Ce.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});pu.displayName=hu;var mu="TabsTrigger",gu=y.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=bs(mu,n),l=du(n),c=yu(i.baseId,r),u=bu(i.baseId,r),d=r===i.value;return a.jsx(ab,{asChild:!0,...l,focusable:!o,active:d,children:a.jsx(Ce.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,...s,ref:t,onMouseDown:ye(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?i.onValueChange(r):f.preventDefault()}),onKeyDown:ye(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&i.onValueChange(r)}),onFocus:ye(e.onFocus,()=>{const f=i.activationMode!=="manual";!d&&!o&&f&&i.onValueChange(r)})})})});gu.displayName=mu;var xu="TabsContent",vu=y.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,l=bs(xu,n),c=yu(l.baseId,r),u=bu(l.baseId,r),d=r===l.value,f=y.useRef(d);return y.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),a.jsx(Bt,{present:o||d,children:({present:m})=>a.jsx(Ce.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&s})})});vu.displayName=xu;function yu(e,t){return`${e}-trigger-${t}`}function bu(e,t){return`${e}-content-${t}`}var Vb=fu,Hb=pu,qb=gu,Jb=vu,[Ur]=$t("Tooltip",[Dr]),Zr=Dr(),wu="TooltipProvider",Kb=700,Ro="tooltip.open",[Gb,ws]=Ur(wu),_u=e=>{const{__scopeTooltip:t,delayDuration:n=Kb,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=y.useRef(!0),l=y.useRef(!1),c=y.useRef(0);return y.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),a.jsx(Gb,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:y.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:y.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:y.useCallback(u=>{l.current=u},[]),disableHoverableContent:o,children:s})};_u.displayName=wu;var On="Tooltip",[Yb,Fn]=Ur(On),ku=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:i,delayDuration:l}=e,c=ws(On,e.__scopeTooltip),u=Zr(t),[d,f]=y.useState(null),m=ht(),p=y.useRef(0),g=i??c.disableHoverableContent,h=l??c.delayDuration,x=y.useRef(!1),[v,_]=ln({prop:r,defaultProp:o??!1,onChange:E=>{E?(c.onOpen(),document.dispatchEvent(new CustomEvent(Ro))):c.onClose(),s?.(E)},caller:On}),k=y.useMemo(()=>v?x.current?"delayed-open":"instant-open":"closed",[v]),C=y.useCallback(()=>{window.clearTimeout(p.current),p.current=0,x.current=!1,_(!0)},[_]),j=y.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_(!1)},[_]),z=y.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{x.current=!0,_(!0),p.current=0},h)},[h,_]);return y.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),a.jsx(Tc,{...u,children:a.jsx(Yb,{scope:t,contentId:m,open:v,stateAttribute:k,trigger:d,onTriggerChange:f,onTriggerEnter:y.useCallback(()=>{c.isOpenDelayedRef.current?z():C()},[c.isOpenDelayedRef,z,C]),onTriggerLeave:y.useCallback(()=>{g?j():(window.clearTimeout(p.current),p.current=0)},[j,g]),onOpen:C,onClose:j,disableHoverableContent:g,children:n})})};ku.displayName=On;var Po="TooltipTrigger",Cu=y.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Fn(Po,n),s=ws(Po,n),i=Zr(n),l=y.useRef(null),c=Ie(t,l,o.onTriggerChange),u=y.useRef(!1),d=y.useRef(!1),f=y.useCallback(()=>u.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),a.jsx(Ac,{asChild:!0,...i,children:a.jsx(Ce.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:c,onPointerMove:ye(e.onPointerMove,m=>{m.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:ye(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:ye(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:ye(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:ye(e.onBlur,o.onClose),onClick:ye(e.onClick,o.onClose)})})});Cu.displayName=Po;var _s="TooltipPortal",[Xb,Qb]=Ur(_s,{forceMount:void 0}),Su=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=Fn(_s,t);return a.jsx(Xb,{scope:t,forceMount:n,children:a.jsx(Bt,{present:n||s.open,children:a.jsx(Ar,{asChild:!0,container:o,children:r})})})};Su.displayName=_s;var un="TooltipContent",ju=y.forwardRef((e,t)=>{const n=Qb(un,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=Fn(un,e.__scopeTooltip);return a.jsx(Bt,{present:r||i.open,children:i.disableHoverableContent?a.jsx(Eu,{side:o,...s,ref:t}):a.jsx(e2,{side:o,...s,ref:t})})}),e2=y.forwardRef((e,t)=>{const n=Fn(un,e.__scopeTooltip),r=ws(un,e.__scopeTooltip),o=y.useRef(null),s=Ie(t,o),[i,l]=y.useState(null),{trigger:c,onClose:u}=n,d=o.current,{onPointerInTransitChange:f}=r,m=y.useCallback(()=>{l(null),f(!1)},[f]),p=y.useCallback((g,h)=>{const x=g.currentTarget,v={x:g.clientX,y:g.clientY},_=o2(v,x.getBoundingClientRect()),k=s2(v,_),C=i2(h.getBoundingClientRect()),j=l2([...k,...C]);l(j),f(!0)},[f]);return y.useEffect(()=>()=>m(),[m]),y.useEffect(()=>{if(c&&d){const g=x=>p(x,d),h=x=>p(x,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",h),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",h)}}},[c,d,p,m]),y.useEffect(()=>{if(i){const g=h=>{const x=h.target,v={x:h.clientX,y:h.clientY},_=c?.contains(x)||d?.contains(x),k=!a2(v,i);_?m():k&&(m(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,i,u,m]),a.jsx(Eu,{...e,ref:s})}),[t2,n2]=Ur(On,{isInside:!1}),r2=Hx("TooltipContent"),Eu=y.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...l}=e,c=Fn(un,n),u=Zr(n),{onClose:d}=c;return y.useEffect(()=>(document.addEventListener(Ro,d),()=>document.removeEventListener(Ro,d)),[d]),y.useEffect(()=>{if(c.trigger){const f=m=>{m.target?.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),a.jsx(Tr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:a.jsxs(zc,{"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:[a.jsx(r2,{children:r}),a.jsx(t2,{scope:n,isInside:!0,children:a.jsx(Qx,{id:c.contentId,role:"tooltip",children:o||r})})]})})});ju.displayName=un;var Nu="TooltipArrow",Tu=y.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Zr(n);return n2(Nu,n).isInside?null:a.jsx(Oc,{...o,...r,ref:t})});Tu.displayName=Nu;function o2(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function s2(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 i2(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 a2(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const l=t[s],c=t[i],u=l.x,d=l.y,f=c.x,m=c.y;d>r!=m>r&&n<(f-u)*(r-d)/(m-d)+u&&(o=!o)}return o}function l2(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),c2(t)}function c2(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 s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.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 s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.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 u2=_u,d2=ku,f2=Cu,h2=Su,p2=ju,m2=Tu;const g2=os("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 Au({className:e,variant:t="default",asChild:n=!1,...r}){const o=n?Wx:"span";return a.jsx(o,{"data-slot":"badge","data-variant":t,className:xe(g2({variant:t}),e),...r})}function ks({...e}){return a.jsx(_v,{"data-slot":"dialog",...e})}function x2({...e}){return a.jsx(kv,{"data-slot":"dialog-trigger",...e})}function v2({...e}){return a.jsx(Cv,{"data-slot":"dialog-portal",...e})}function y2({className:e,...t}){return a.jsx(Sv,{"data-slot":"dialog-overlay",className:xe("fixed inset-0 z-50 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 Cs({className:e,children:t,...n}){return a.jsxs(v2,{children:[a.jsx(y2,{}),a.jsxs(jv,{"data-slot":"dialog-content",className:xe("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,a.jsxs(Nv,{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:[a.jsx(pl,{className:"size-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Ss({className:e,...t}){return a.jsx("div",{"data-slot":"dialog-header",className:xe("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function js({className:e,...t}){return a.jsx(Ev,{"data-slot":"dialog-title",className:xe("text-lg font-semibold leading-none tracking-tight",e),...t})}const b2=os("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 Me({className:e,variant:t,size:n,...r}){return a.jsx("button",{"data-slot":"button",className:xe(b2({variant:t,size:n,className:e})),...r})}function zu({open:e,onOpenChange:t,title:n,description:r,confirmLabel:o="Confirm",variant:s="default",onConfirm:i}){return a.jsx(ks,{open:e,onOpenChange:t,children:a.jsxs(Cs,{children:[a.jsx(Ss,{children:a.jsx(js,{children:n})}),a.jsx("p",{className:"text-sm text-muted-foreground",children:r}),a.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[a.jsx(Me,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Cancel"}),a.jsx(Me,{variant:s,size:"sm",onClick:()=>{i(),t(!1)},children:o})]})]})})}const w2={anthropic:"Anthropic",openai:"OpenAI",unknown:"Unknown"};function Di(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function _2({conversationId:e,startTime:t,endTime:n,totalCalls:r,totalInputTokens:o,totalOutputTokens:s,apiFormat:i,expanded:l,onToggle:c,hideApiFormat:u=!1,isLoading:d=!1,userAgent:f,onClear:m}){const[p,g]=y.useState(!1),h=v=>{v.stopPropagation(),m!==void 0&&g(!0)},x=y.useCallback(v=>{v.stopPropagation(),window.open(ed(e),"_blank","noopener,noreferrer")},[e]);return a.jsxs("div",{role:"button",tabIndex:0,"data-nav-id":`conv-${e}`,"data-nav-action":l?"collapse":"expand",className:xe("flex items-center gap-3 px-3 py-2 cursor-pointer transition-colors","hover:bg-muted/50","select-none","border border-border rounded-lg mb-2 bg-background sticky top-0 z-10","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),onClick:c,onKeyDown:v=>{v.target===v.currentTarget&&(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),c())},children:[l?a.jsx(Mn,{className:"size-4 text-muted-foreground shrink-0"}):d?a.jsx(hr,{className:"size-4 animate-spin text-muted-foreground shrink-0"}):a.jsx(Xo,{className:"size-4 text-muted-foreground shrink-0"}),a.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!==""&&a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:f,children:[a.jsx(M0,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",children:f})]}),!u&&a.jsx(Au,{variant:"outline",className:xe("text-[10px] px-1.5 py-0 h-5 font-mono shrink-0",i==="openai"&&"border-blue-500/40 text-blue-400",i==="anthropic"&&"border-orange-500/40 text-orange-400",i==="unknown"&&"border-muted text-muted-foreground"),children:w2[i]}),a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(sn,{className:"size-3"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[Di(t)," - ",Di(n)]})]}),a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(dl,{className:"size-3"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[r," call",r!==1?"s":""]})]}),a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(ns,{className:"size-3 text-muted-foreground"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[a.jsx("span",{className:"text-blue-400",children:Je(o)})," / ",a.jsx("span",{className:"text-amber-400",children:Je(s)})]})]}),a.jsx("span",{className:"flex-1 min-w-0"}),a.jsx("button",{type:"button",onClick:x,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&x(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:a.jsx(cl,{className:"size-3.5"})}),m!==void 0&&a.jsx("button",{type:"button",onClick:h,"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:a.jsx(hl,{className:"size-3.5"})}),a.jsx(zu,{open:p,onOpenChange:g,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:()=>{m?.()}})]})}function k2(e){const t=e.find(n=>n.apiFormat!=="unknown");return t!==void 0?t.apiFormat:e[0]?.apiFormat??"unknown"}function C2(e){let t=!1,n=!1;for(const r of e)if(r.apiFormat==="anthropic"?t=!0:r.apiFormat==="openai"&&(n=!0),t&&n)return!0;return!1}function S2(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 j2(e){const t=new Map;for(const r of e){const o=S2(r),s=t.get(o);s!==void 0?s.push(r):t.set(o,[r])}const n=[];for(const[r,o]of t){const s=[...o].sort((i,l)=>i.timestamp.localeCompare(l.timestamp));n.push({id:r,conversationId:r,logs:s})}return n.sort((r,o)=>(r.logs[0]?.timestamp??"").localeCompare(o.logs[0]?.timestamp??"")),n}function Li(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function E2(e){if(e.responseText===null)return null;try{let t=JSON.parse(e.responseText);return typeof t=="string"&&(t=JSON.parse(t)),Li(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&&Li(t.choices[0])&&typeof t.choices[0].finish_reason=="string"&&t.choices[0].finish_reason==="stop"?"stop":null:null}catch{return null}}function Ou(e){return e==="end_turn"||e==="stop"}function Xe({className:e,style:t,d:n,eyeStalks:r,eyes:o,legs:s,extras:i}){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:t,className:xe("inline-block size-5",e),children:[a.jsx("path",{d:n}),r,o,s,i]})}const At=a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),a.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),a.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),a.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]}),Iu=a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"7",y1:"16",x2:"5.5",y2:"18.5"}),a.jsx("line",{x1:"9.5",y1:"17",x2:"8.5",y2:"19.5"}),a.jsx("line",{x1:"14.5",y1:"17",x2:"15.5",y2:"19.5"}),a.jsx("line",{x1:"17",y1:"16",x2:"18.5",y2:"18.5"})]});function Ru({className:e}){return a.jsx(Xe,{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:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"})]}),legs:At,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.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 N2({className:e}){return a.jsx(Xe,{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:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"9.5",y1:"6.5",x2:"9.5",y2:"4.5"}),a.jsx("line",{x1:"14.5",y1:"6.5",x2:"14.5",y2:"4.5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"})]}),legs:Iu,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C4 9.5 2.5 10 3 12 C3.5 13.5 4.5 13 5 12"}),a.jsx("path",{d:"M19 11 C20 9.5 21.5 10 21 12 C20.5 13.5 19.5 13 19 12"})]})})}function T2({className:e}){return a.jsx(Xe,{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:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"7",y1:"7",x2:"6.5",y2:"4.5"}),a.jsx("line",{x1:"17",y1:"7",x2:"17.5",y2:"4.5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"6.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"17.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:At,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M4 12 C2.5 10.5 1 11 1.5 13 C2 14.5 3.5 14 4.5 13"}),a.jsx("path",{d:"M20 12 C21.5 10.5 23 11 22.5 13 C22 14.5 20.5 14 19.5 13"})]})})}function A2({className:e}){return a.jsx(Xe,{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:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"6.5",x2:"10",y2:"3.5"}),a.jsx("line",{x1:"14",y1:"6.5",x2:"14",y2:"3.5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"10",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"7",y1:"17",x2:"5",y2:"20.5"}),a.jsx("line",{x1:"9.5",y1:"18.5",x2:"8.5",y2:"21.5"}),a.jsx("line",{x1:"14.5",y1:"18.5",x2:"15.5",y2:"21.5"}),a.jsx("line",{x1:"17",y1:"17",x2:"19",y2:"20.5"})]}),extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M6.5 11 C5 8.5 3 9 3.5 11.5 C4 13.5 5 13 6 12"}),a.jsx("path",{d:"M17.5 11 C19 8.5 21 9 20.5 11.5 C20 13.5 19 13 18 12"})]})})}function z2({className:e}){return a.jsx(Xe,{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:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:At,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.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 O2({className:e}){return a.jsx(Xe,{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:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),a.jsx("line",{x1:"13.5",y1:"4",x2:"15.5",y2:"5"})]}),legs:At,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.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 I2({className:e}){return a.jsx(Xe,{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:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"8",x2:"10",y2:"6"}),a.jsx("line",{x1:"14",y1:"8",x2:"14",y2:"6"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"9",y1:"6",x2:"11",y2:"6.5"}),a.jsx("line",{x1:"13",y1:"6",x2:"15",y2:"6.5"})]}),legs:Iu,extras:a.jsxs(a.Fragment,{children:[a.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"}),a.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 R2({className:e}){return a.jsx(Xe,{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:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:At,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),a.jsx("line",{x1:"8.5",y1:"4",x2:"10.5",y2:"4.5"}),a.jsx("line",{x1:"15.5",y1:"4",x2:"13.5",y2:"4.5"}),a.jsx("path",{d:"M9 15.5 C10 14.5 14 14.5 15 15.5"})]})})}function P2({className:e}){return a.jsx(Xe,{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:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"})]}),legs:At,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),a.jsx("ellipse",{cx:"12",cy:"15",rx:"2",ry:"1.5",fill:"currentColor",stroke:"none"})]})})}function M2({className:e}){return a.jsx(Xe,{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:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"9.5",y1:"7",x2:"9",y2:"5"}),a.jsx("line",{x1:"14.5",y1:"7",x2:"15",y2:"5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"9",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"15",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"})]}),legs:At,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9 2 9.5 2.5 12 C3 14 4 13 5 12"}),a.jsx("path",{d:"M19 11 C20.5 9 22 9.5 21.5 12 C21 14 20 13 19 12"}),a.jsx("path",{d:"M9 14.5 C10 16 14 16 15 14.5"}),a.jsx("circle",{cx:"7",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"}),a.jsx("circle",{cx:"17",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"})]})})}function D2({className:e}){return a.jsx(Xe,{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:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5.5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5.5"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"7.5",y1:"5.5",x2:"16.5",y2:"5.5"}),a.jsx("rect",{x:"7",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"}),a.jsx("rect",{x:"13",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"})]}),legs:At,extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),a.jsx("path",{d:"M9.5 15 C10.5 16 13.5 16 14.5 15"})]})})}function L2({className:e}){return a.jsx(Xe,{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:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"10.5",y1:"9.5",x2:"10.5",y2:"8"}),a.jsx("line",{x1:"13.5",y1:"9.5",x2:"13.5",y2:"8"})]}),eyes:a.jsxs(a.Fragment,{children:[a.jsx("circle",{cx:"10.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"13.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:a.jsxs(a.Fragment,{children:[a.jsx("line",{x1:"8",y1:"16",x2:"6.5",y2:"18"}),a.jsx("line",{x1:"10",y1:"17",x2:"9.5",y2:"19"}),a.jsx("line",{x1:"14",y1:"17",x2:"14.5",y2:"19"}),a.jsx("line",{x1:"16",y1:"16",x2:"17.5",y2:"18"})]}),extras:a.jsxs(a.Fragment,{children:[a.jsx("path",{d:"M7.5 12 C6.5 11 5.5 11.5 6 13 C6.5 14 7 13.5 7.5 13"}),a.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 In=[Ru,N2,T2,A2,z2,O2,I2,R2,P2,M2,D2,L2];function wr(e){return In[Math.abs(e)%In.length]??Ru}function F2(e){const t=In.length-2;return t<=0?0:1+((Number.isFinite(e)?Math.trunc(e):0)%t+t)%t}function $2(e){return wr(F2(e))}const B2="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",U2="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",Z2="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",W2="/assets/minimax-BPMzvuL-.jpeg",V2="/assets/alibaba-TTwafVwX.svg",H2="/assets/qwen-CONDcHqt.png",q2="/assets/zhipuai-BPNAnxo-.svg",J2={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen","glm-":"zhipuai"};function Pu(e){if(e===null)return"unknown";const t=e.toLowerCase();for(const[n,r]of Object.entries(J2))if(t.startsWith(n.toLowerCase()))return r;return"unknown"}const Ut={width:24,height:24,objectFit:"contain"},K2=We.memo(({className:e})=>a.jsx("img",{src:B2,alt:"Anthropic",className:e,style:Ut})),G2=We.memo(({className:e})=>a.jsx("img",{src:U2,alt:"OpenAI",className:e,style:{...Ut,background:"white",borderRadius:"4px"}})),Y2=We.memo(({className:e})=>a.jsx("img",{src:Z2,alt:"DeepSeek",className:e,style:Ut})),X2=We.memo(({className:e})=>a.jsx("img",{src:W2,alt:"MiniMax",className:e,style:Ut})),Q2=We.memo(({className:e})=>a.jsx("img",{src:V2,alt:"Alibaba",className:e,style:Ut})),ew=We.memo(({className:e})=>a.jsx("img",{src:H2,alt:"Qwen",className:e,style:Ut})),tw=We.memo(({className:e})=>a.jsx("img",{src:q2,alt:"ZhipuAI",className:e,style:Ut}));function Mu({provider:e,className:t}){switch(e){case"anthropic":return a.jsx(K2,{className:t});case"openai":return a.jsx(G2,{className:t});case"deepseek":return a.jsx(Y2,{className:t});case"minimax":return a.jsx(X2,{className:t});case"alibaba":return a.jsx(Q2,{className:t});case"qwen":return a.jsx(ew,{className:t});case"zhipuai":return a.jsx(tw,{className:t});case"unknown":return null}}function $e({delayDuration:e=0,...t}){return a.jsx(u2,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Se({...e}){return a.jsx(d2,{"data-slot":"tooltip",...e})}function je({...e}){return a.jsx(f2,{"data-slot":"tooltip-trigger",...e})}function Ee({className:e,sideOffset:t=0,children:n,...r}){return a.jsx(h2,{children:a.jsxs(p2,{"data-slot":"tooltip-content",sideOffset:t,className:xe("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,a.jsx(m2,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const nw="x-anthropic-billing-header:";function rw(e){return e.trimStart().toLowerCase().startsWith(nw)}function ow(e){return qa(e)?Object.prototype.hasOwnProperty.call(e,"system"):!1}function sw(e){if(!qa(e))return!1;const t=Qs(e,"type"),n=Qs(e,"text");return typeof t!="string"||t!=="text"||typeof n!="string"?!1:rw(n)}function iw(e){let t;try{t=JSON.parse(e)}catch{return{body:e,removed:0}}if(!ow(t))return{body:e,removed:0};const n=t.system;if(!Array.isArray(n)||n.length===0)return{body:e,removed:0};const r=[];let o=0;for(const s of n){if(sw(s)){o+=1;continue}r.push(s)}return o===0?{body:e,removed:0}:(r.length===0?delete t.system:t.system=r,{body:JSON.stringify(t),removed:o})}function aw({policy:e,isExpanded:t,isPending:n,onToggle:r}){if(e===null)return null;const o=n?"Updating...":t?"Collapse all":"Expand all",s=t?"Collapse all JSON nodes":"Expand all JSON nodes";return a.jsx($e,{children:a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsxs(Me,{variant:"outline",size:"sm",className:"h-8 text-xs",onClick:i=>{i.stopPropagation(),r()},disabled:n,"aria-pressed":t,children:[t?a.jsx(ll,{className:"size-3.5 mr-1"}):a.jsx(al,{className:"size-3.5 mr-1"}),o]})}),a.jsx(Ee,{children:s})]})})}function lw(e){return{depth:Number.POSITIVE_INFINITY}}function cw(e){try{const t=JSON.parse(e);return{kind:"json",data:Mo(t)}}catch{return{kind:"text"}}}function Fi(e){const t=y.useMemo(()=>e===null?null:cw(e),[e]),n=t?.kind==="json"?t.data:null,r=y.useMemo(()=>n===null?null:lw(),[n]),[o,s]=y.useState(!1),[i,l]=y.useState(0),[c,u]=y.useState(0),[d,f]=y.useTransition(),m=y.useCallback(()=>{const p=!o,g=p&&r!==null?r.depth:0;f(()=>{s(p),l(g),u(h=>h+1)})},[o,r]);return{parsedData:n,policy:r,isExpanded:o,toggle:m,isPending:d,bulkDepth:i,bulkRevision:c}}function Mo(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=>Mo(n));const t={};for(const n of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,n);t[n]=Mo(r?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function Du({className:e,orientation:t="horizontal",...n}){return a.jsx(Vb,{"data-slot":"tabs","data-orientation":t,orientation:t,className:xe("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",e),...n})}const uw=os("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 Lu({className:e,variant:t="default",...n}){return a.jsx(Hb,{"data-slot":"tabs-list","data-variant":t,className:xe(uw({variant:t}),e),...n})}function dt({className:e,...t}){return a.jsx(qb,{"data-slot":"tabs-trigger",className:xe("focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent","data-[state=active]:bg-background dark:data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 data-[state=active]:text-foreground","after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",e),...t})}function ft({className:e,...t}){return a.jsx(Jb,{"data-slot":"tabs-content",className:xe("flex-1 outline-none",e),...t})}const dw=y.lazy(()=>Dt(()=>import("./CompareDrawer-C-4ypEWs.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.CompareDrawer}))),fw=y.lazy(()=>Dt(()=>import("./ReplayDialog-CyBKOgba.js"),__vite__mapDeps([3,1,4,2])).then(e=>({default:e.ReplayDialog}))),hw=y.lazy(()=>Dt(()=>import("./RequestAnatomy-C0IrVQ3q.js"),__vite__mapDeps([5,1])).then(e=>({default:e.RequestAnatomy}))),pw=y.lazy(()=>Dt(()=>import("./ResponseView-MogToC4i.js"),__vite__mapDeps([4,1,2])).then(e=>({default:e.ResponseView}))),mw=y.lazy(()=>Dt(()=>import("./StreamingChunkSequence-ClhUhT-s.js"),__vite__mapDeps([6,1,2])).then(e=>({default:e.StreamingChunkSequence}))),$i=y.lazy(()=>Dt(()=>import("./json-viewer-BicGakI5.js").then(e=>e.j),__vite__mapDeps([2,1])).then(e=>({default:e.JsonViewer}))),gw=y.lazy(()=>Dt(()=>import("./json-viewer-BicGakI5.js").then(e=>e.j),__vite__mapDeps([2,1])).then(e=>({default:e.JsonViewerFromString}))),xw=1200,vw=12;function yw(e){const{containerRef:t,setExpandToPath:n,ensureTabActive:r,highlightMs:o}=e,s=y.useRef(null);return y.useCallback(i=>{r?.(),n(i.path);const l=f=>{f.scrollIntoView({behavior:"smooth",block:"center"}),f.classList.add("ring-2","ring-primary/60","ring-offset-1","ring-offset-background","rounded-sm","transition-shadow"),s.current!==null&&clearTimeout(s.current),s.current=setTimeout(()=>{f.classList.remove("ring-2","ring-primary/60","ring-offset-1","ring-offset-background","rounded-sm","transition-shadow"),n(null)},o??xw)},u=`[data-anatomy-path="${(f=>typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(f):f.replace(/(["'\\[\](){}])/g,"\\$1"))(i.path)}"]`,d=f=>{const m=t.current;if(m!==null){const p=m.querySelector(u);if(p!==null){l(p);return}}f>0?window.requestAnimationFrame(()=>d(f-1)):n(null)};window.requestAnimationFrame(()=>d(vw))},[t,r,o,n])}class Fu{diff(t,n,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);const s=this.castInput(t,r),i=this.castInput(n,r),l=this.removeEmpty(this.tokenize(s,r)),c=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(l,c,r,o)}diffWithOptionsObj(t,n,r,o){var s;const i=_=>{if(_=this.postProcess(_,r),o){setTimeout(function(){o(_)},0);return}else return _},l=n.length,c=t.length;let u=1,d=l+c;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));const f=(s=r.timeout)!==null&&s!==void 0?s:1/0,m=Date.now()+f,p=[{oldPos:-1,lastComponent:void 0}];let g=this.extractCommon(p[0],n,t,0,r);if(p[0].oldPos+1>=c&&g+1>=l)return i(this.buildValues(p[0].lastComponent,n,t));let h=-1/0,x=1/0;const v=()=>{for(let _=Math.max(h,-u);_<=Math.min(x,u);_+=2){let k;const C=p[_-1],j=p[_+1];C&&(p[_-1]=void 0);let z=!1;if(j){const A=j.oldPos-_;z=j&&0<=A&&A<l}const E=C&&C.oldPos+1<c;if(!z&&!E){p[_]=void 0;continue}if(!E||z&&C.oldPos<j.oldPos?k=this.addToPath(j,!0,!1,0,r):k=this.addToPath(C,!1,!0,1,r),g=this.extractCommon(k,n,t,_,r),k.oldPos+1>=c&&g+1>=l)return i(this.buildValues(k.lastComponent,n,t))||!0;p[_]=k,k.oldPos+1>=c&&(x=Math.min(x,_-1)),g+1>=l&&(h=Math.max(h,_+1))}u++};if(o)(function _(){setTimeout(function(){if(u>d||Date.now()>m)return o(void 0);v()||_()},0)})();else for(;u<=d&&Date.now()<=m;){const _=v();if(_)return _}}addToPath(t,n,r,o,s){const i=t.lastComponent;return i&&!s.oneChangePerToken&&i.added===n&&i.removed===r?{oldPos:t.oldPos+o,lastComponent:{count:i.count+1,added:n,removed:r,previousComponent:i.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:n,removed:r,previousComponent:i}}}extractCommon(t,n,r,o,s){const i=n.length,l=r.length;let c=t.oldPos,u=c-o,d=0;for(;u+1<i&&c+1<l&&this.equals(r[c+1],n[u+1],s);)u++,c++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const o=[];let s;for(;t;)o.push(t),s=t.previousComponent,delete t.previousComponent,t=s;o.reverse();const i=o.length;let l=0,c=0,u=0;for(;l<i;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(m,p){const g=r[u+p];return g.length>m.length?g:m}),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 bw extends Fu{constructor(){super(...arguments),this.tokenize=Bu}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
|
|
86
|
+
`))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
|
|
87
|
+
`))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
|
|
88
|
+
`)&&(t=t.slice(0,-1)),n.endsWith(`
|
|
89
|
+
`)&&(n=n.slice(0,-1))),super.equals(t,n,r)}}const ww=new bw;function $u(e,t,n){return ww.diff(e,t,n)}function Bu(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
90
|
+
`));const n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let o=0;o<r.length;o++){const s=r[o];o%2&&!t.newlineIsToken?n[n.length-1]+=s:n.push(s)}return n}class _w extends Fu{constructor(){super(...arguments),this.tokenize=Bu}get useLongestToken(){return!0}castInput(t,n){const{undefinedReplacement:r,stringifyReplacer:o=(s,i)=>typeof i>"u"?r:i}=n;return typeof t=="string"?t:JSON.stringify(Do(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 kw=new _w;function Cw(e,t,n){return kw.diff(e,t,n)}function Do(e,t,n,r,o){t=t||[],n=n||[],r&&(e=r(o===void 0?"":o,e));let s;for(s=0;s<t.length;s+=1)if(t[s]===e)return n[s];let i;if(Object.prototype.toString.call(e)==="[object Array]"){for(t.push(e),i=new Array(e.length),n.push(i),s=0;s<e.length;s+=1)i[s]=Do(e[s],t,n,r,String(s));return t.pop(),n.pop(),i}if(e&&e.toJSON&&(e=e.toJSON()),typeof e=="object"&&e!==null){t.push(e),i={},n.push(i);const l=[];let c;for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&l.push(c);for(l.sort(),s=0;s<l.length;s+=1)c=l[s],i[c]=Do(e[c],t,n,r,c);t.pop(),n.pop()}else i=e;return i}function Bi(e){return e===void 0?[]:Object.entries(e).map(t=>[t[0].toLowerCase(),t[1]]).sort(([t],[n])=>t.localeCompare(n))}function Ui([e,t]){return`${e}: ${t}`}function Lo(e){const t=[];let n=0,r=0;for(const o of e){const s=o.value.split(`
|
|
91
|
+
`);s.length>0&&s[s.length-1]===""&&s.pop();for(const i of s)o.added?(r+=1,t.push({kind:"added",text:i,oldLineNumber:null,newLineNumber:r})):o.removed?(n+=1,t.push({kind:"removed",text:i,oldLineNumber:n,newLineNumber:null})):(n+=1,r+=1,t.push({kind:"context",text:i,oldLineNumber:n,newLineNumber:r}))}return t}function Sw(e,t){const n=Bi(e).map(Ui).join(`
|
|
92
|
+
`),r=Bi(t).map(Ui).join(`
|
|
93
|
+
`);if(n===r)return{lines:[],isEmpty:!0};const o=$u(n,r);return{lines:Lo(o),isEmpty:!1}}function Zi(e){try{const t=JSON.parse(e);return t===null||typeof t=="string"||typeof t=="object"?t:null}catch{return null}}function jw(e,t){const n=e??"",r=t??"";if(n===r)return{lines:[],isEmpty:!0};const o=Zi(n),s=Zi(r);if(o!==null&&s!==null){const l=Cw(o,s)??[];if(l.length===1){const c=l[0];if(c!==void 0&&!c.added&&!c.removed)return{lines:[],isEmpty:!0}}return{lines:Lo(l),isEmpty:!1}}const i=$u(n,r);return{lines:Lo(i),isEmpty:!1}}function Ew(e,t,n){const r=new Array(e);return new Proxy(r,{get(o,s,i){if(typeof s=="string"){const l=s.charCodeAt(0);if(l>=48&&l<=57){const c=+s;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(s==="length")return e}return Reflect.get(o,s,i)}})}function qt(e,t,n){let r=n.initialDeps??[],o,s=!0;function i(){const l=e();return(l.length!==r.length||l.some((u,d)=>r[d]!==u))&&(r=l,o=t(...l),n?.onChange&&!(s&&n.skipInitialOnChange)&&n.onChange(o),s=!1),o}return i.updateDeps=l=>{r=l},i}function Wi(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const Vi=(e,t)=>Math.abs(e-t)<1.01,Nw=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}};let kn;const Hi=()=>{if(kn!==void 0)return kn;if(typeof navigator>"u")return kn=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return kn=!0;const e=navigator.maxTouchPoints;return kn=navigator.platform==="MacIntel"&&e!==void 0&&e>0},qi=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Tw=e=>e,Aw=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 s=0;s<r;s++)o[s]=t+s;return o},zw=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=i=>{const{width:l,height:c}=i;t({width:Math.round(l),height:Math.round(c)})};if(o(qi(n)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(i=>{const l=()=>{const c=i[0];if(c?.borderBoxSize){const u=c.borderBoxSize[0];if(u){o({width:u.inlineSize,height:u.blockSize});return}}o(qi(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},_r={passive:!0},Ow=typeof window>"u"?!0:"onscrollend"in window,Iw=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const o=e.targetWindow;if(!o)return;const s=e.options.useScrollendEvent&&Ow;let i=0;const l=s?null:Nw(o,()=>t(i,!1),e.options.isScrollingResetDelay),c=f=>()=>{i=n(r),l?.(),t(i,f)},u=c(!0),d=c(!1);return r.addEventListener("scroll",u,_r),s&&r.addEventListener("scrollend",d,_r),()=>{r.removeEventListener("scroll",u),s&&r.removeEventListener("scrollend",d)}},Rw=(e,t)=>Iw(e,t,n=>{const{horizontal:r,isRtl:o}=e.options;return r?n.scrollLeft*(o&&-1||1):n.scrollTop}),Pw=(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"]},Mw=(e,{adjustments:t=0,behavior:n},r)=>{var o,s;(s=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||s.call(o,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})},Dw=Mw;class Lw{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(s=>{const i=()=>{const l=s.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,s,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var o;(o=r())==null||o.disconnect(),n=null},observe:o=>{var s;return(s=r())==null?void 0:s.observe(o,{box:"border-box"})},unobserve:o=>{var s;return(s=r())==null?void 0:s.unobserve(o)}}})(),this.range=null,this.setOptions=n=>{var r,o;const s={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Tw,rangeExtractor:Aw,onChange:()=>{},measureElement:Pw,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&&(s[u]=d)}const i=this.options;let l=null,c=null;if(i!==void 0&&i.enabled&&s.enabled&&s.anchorTo==="end"&&this.scrollElement!==null){const u=i.count,d=s.count,f=this.getMeasurements(),m=u>0?((r=f[0])==null?void 0:r.key)??i.getItemKey(0):null,p=u>0?((o=f[u-1])==null?void 0:o.key)??i.getItemKey(u-1):null;if(d!==u||u>0&&d>0&&(s.getItemKey(0)!==m||s.getItemKey(d-1)!==p)){const x=u>0?this.getVirtualItemForOffset(this.getScrollOffset())??f[0]:null;x&&(l=[x.key,this.getScrollOffset()-x.start]);const v=s.followOnAppend===!0?"auto":s.followOnAppend||null;v&&d>u&&this.isAtEnd(i.scrollEndThreshold)&&(u===0||s.getItemKey(d-1)!==p)&&(c=v)}}this.options=s,(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=qt(()=>(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(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,i)=>{this._intendedScrollOffset!==null&&Math.abs(s-this._intendedScrollOffset)<1.5&&(s=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=i,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const s=this.scrollElement,i=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},l=()=>{this._iosTouching=!1,!(!Hi()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",i,_r),s.addEventListener("touchend",l,_r),this.unsubs.push(()=>{s.removeEventListener("touchstart",i),s.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[s,i,l]=o;if(s!==null){const{count:c,getItemKey:u}=this.options;let d=0;for(;d<c&&u(d)!==s;)d++;const f=d<c?this.getMeasurements()[d]:void 0;if(f){const m=f.start+i-this.getScrollOffset();Vi(m,0)||this.applyScrollAdjustment(m)}}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,s=new Map;for(let i=r-1;i>=0;i--){const l=n[i];if(o.has(l.lane))continue;const c=s.get(l.lane);if(c==null||l.end>c.end?s.set(l.lane,l):l.end<c.end&&o.set(l.lane,!0),o.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((i,l)=>i.end===l.end?i.index-l.index:i.end-l.end)[0]:void 0},this.getMeasurementOptions=qt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,r,o,s,i,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:s,enabled:i,lanes:l,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=qt(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:l,laneAssignmentMode:c},u)=>{const d=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const g of this.laneAssignments.keys())g>=n&&this.laneAssignments.delete(g);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(g=>{this.itemSizeCache.set(g.key,g.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 g=this.options.gap,h=n*2;let x=this._flatMeasurements;if(!x||x.length<h){const k=new Float64Array(h);x&&f>0&&k.set(x.subarray(0,f*2)),x=k,this._flatMeasurements=x}let v;if(f===0)v=r+o;else{const k=f-1;v=x[k*2]+x[k*2+1]+g}for(let k=f;k<n;k++){const C=s(k),j=d.get(C),z=typeof j=="number"?j:this.options.estimateSize(k);x[k*2]=v,x[k*2+1]=z,v+=z+g}const _=Ew(n,x,s);return this.measurementsCache=_,_}const m=this.measurementsCache.slice(0,f),p=new Array(l).fill(void 0);for(let g=0;g<f;g++){const h=m[g];h&&(p[h.lane]=g)}for(let g=f;g<n;g++){const h=s(g),x=this.laneAssignments.get(g);let v,_;const k=c==="estimate"||d.has(h);if(x!==void 0&&this.options.lanes>1){v=x;const E=p[v],A=E!==void 0?m[E]:void 0;_=A?A.end+this.options.gap:r+o}else{const E=this.options.lanes===1?m[g-1]:this.getFurthestMeasurement(m,g);_=E?E.end+this.options.gap:r+o,v=E?E.lane:g%this.options.lanes,this.options.lanes>1&&k&&this.laneAssignments.set(g,v)}const C=d.get(h),j=typeof C=="number"?C:this.options.estimateSize(g),z=_+j;m[g]={index:g,start:_,size:j,end:z,key:h,lane:v},p[v]=g}return this.measurementsCache=m,m},{key:!1,debug:()=>this.options.debug}),this.calculateRange=qt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,s)=>this.range=n.length>0&&r>0?Fw({measurements:n,outerSize:r,scrollOffset:o,lanes:s,flat:s===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=qt(()=>{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,s,i)=>s===null||i===null?[]:n({startIndex:s,endIndex:i,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 s=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),i=Math.max(0,o-s),l=Math.min(this.options.count-1,o+s);return n>=i&&n<=l}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((i,l)=>{i.isConnected||(this.observer.unobserve(i),this.elementsCache.delete(l))});return}const r=this.indexFromElement(n),o=this.options.getItemKey(r),s=this.elementsCache.get(o);s!==n&&(s&&this.observer.unobserve(s),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,s;if(n<0||n>=this.options.count)return;let i,l,c;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)c=this.options.getItemKey(n),l=u[n*2],i=u[n*2+1];else{const m=this.measurementsCache[n];if(!m)return;c=m.key,l=m.start,i=m.size}const d=this.itemSizeCache.get(c)??i,f=r-d;if(f!==0){const m=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,p=m?this.getTotalSize():0,g=((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:c,start:l,size:i,end:l+i,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++,m?this.applyScrollAdjustment(this.getTotalSize()-p):g&&this.applyScrollAdjustment(f),this.notify(!1)}},this.getVirtualItems=qt(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let s=0,i=n.length;s<i;s++){const l=n[s],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,s=this.options.lanes===1&&o!=null,i=Uu(0,r.length-1,s?l=>o[l*2]:l=>Wi(r[l]).start,n);return Wi(r[i])},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 s=this.getSize(),i=this.getScrollOffset();r==="auto"&&(r=n>=i+s?"end":"start"),r==="center"?n+=(o-s)/2:r==="end"&&(n-=s);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(),s=this.getScrollOffset(),i=this.measurementsCache[n];if(!i)return;if(r==="auto")if(i.end>=s+o-this.options.scrollPaddingEnd)r="end";else if(i.start<=s+this.options.scrollPaddingStart)r="start";else return[s,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const l=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,r,i.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:o="auto"}={})=>{const s=this.getOffsetForAlignment(n,r),i=this.now();this.scrollState={index:null,align:r,behavior:o,startedAt:i,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{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 s=this.getOffsetForIndex(n,r);if(!s)return;const[i,l]=s,c=this.now();this.scrollState={index:n,align:l,behavior:o,startedAt:c,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const o=this.getScrollOffset()+n,s=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:s,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 s=r.length-1,i=this._flatMeasurements;i!=null?o=i[s*2]+i[s*2+1]:o=((n=r[s])==null?void 0:n.end)??0}else{const s=Array(this.options.lanes).fill(null);let i=r.length-1;for(;i>=0&&s.some(l=>l===null);){const l=r[i];s[l.lane]===null&&(s[l.lane]=l.end),i--}o=Math.max(...s.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&&(Hi()&&(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,s=1,i=o!==this.scrollState.lastTargetOffset;if(!i&&Vi(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=s){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,i){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 Uu=(e,t,n,r)=>{for(;e<=t;){const o=(e+t)/2|0,s=n(o);if(s<r)e=o+1;else if(s>r)t=o-1;else return o}return e>0?e-1:0};function Fw({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:o}){const s=e.length-1,i=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:s};let c=Uu(0,s,i,n),u=c;if(r===1)for(;u<s&&l(u)<n+t;)u++;else if(r>1){const d=Array(r).fill(0);for(;u<s&&d.some(m=>m<n+t);){const m=e[u];d[m.lane]=m.end,u++}const f=Array(r).fill(n+t);for(;c>=0&&f.some(m=>m>=n);){const m=e[c];f[m.lane]=m.start,c--}c=Math.max(0,c-c%r),u=Math.min(s,u+(r-1-u%r))}return{startIndex:c,endIndex:u}}const Ji=typeof document<"u"?y.useLayoutEffect:y.useEffect;function $w({useFlushSync:e=!0,...t}){const n=y.useReducer(s=>s+1,0)[1],r={...t,onChange:(s,i)=>{var l;e&&i?Rn.flushSync(n):n(),(l=t.onChange)==null||l.call(t,s,i)}},[o]=y.useState(()=>new Lw(r));return o.setOptions(r),Ji(()=>o._didMount(),[]),Ji(()=>o._willUpdate()),o}function Bw(e){return $w({observeElementRect:zw,observeElementOffset:Rw,scrollToFn:Dw,...e})}const Uw=22,io=1e4;function Zw(e){return e==="added"?"+":e==="removed"?"-":" "}function Ww(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 Vw=function({result:t,emptyLabel:n}){const[r,o]=y.useState("unified"),s=y.useRef(null),i=Bw({count:t.lines.length,getScrollElement:()=>s.current,estimateSize:()=>Uw,overscan:10});if(t.isEmpty)return a.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>io,u=c?t.lines.slice(0,io):t.lines;return a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[a.jsxs("span",{children:[l.toLocaleString()," line",l===1?"":"s",c&&` (showing first ${io.toLocaleString()})`]}),a.jsxs("div",{className:"inline-flex rounded-md border border-border overflow-hidden",children:[a.jsxs("button",{type:"button",onClick:()=>o("unified"),"aria-pressed":r==="unified",className:xe("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:[a.jsx(C0,{className:"size-3"}),"Unified"]}),a.jsxs("button",{type:"button",onClick:()=>o("split"),"aria-pressed":r==="split",className:xe("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:[a.jsx(Jg,{className:"size-3"}),"Split"]})]})]}),a.jsx("div",{ref:s,className:"max-h-[60vh] overflow-auto rounded border border-border bg-background font-mono text-xs","data-testid":"diff-viewport",children:r==="unified"?a.jsx(Hw,{virtualizer:i,lines:u}):a.jsx(Kw,{lines:u})})]})};function Hw({virtualizer:e,lines:t}){return a.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:a.jsxs("div",{"data-index":n.index,ref:e.measureElement,className:xe("flex items-start gap-3 px-2",Ww(r.kind)),style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${n.start}px)`},children:[a.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:r.oldLineNumber??""}),a.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:r.newLineNumber??""}),a.jsx("span",{className:xe("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:Zw(r.kind)}),a.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:r.text})]},n.key)})})}function qw(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=[],s=[];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&&s.push(l),n+=1}const i=Math.max(o.length,s.length);for(let l=0;l<i;l+=1){const c=o[l],u=s[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 Jw(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 Kw({lines:e}){const t=qw(e);return a.jsx("div",{"data-testid":"diff-split",children:t.map((n,r)=>a.jsxs("div",{className:xe("grid grid-cols-2 font-mono text-xs",Jw(n.kind)),children:[a.jsxs("div",{className:"flex items-start gap-2 px-2 border-r border-border/50",children:[a.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.left?.lineNumber??""}),a.jsx("span",{className:xe("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?"-":" "}),a.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.left?.text??""})]}),a.jsxs("div",{className:"flex items-start gap-2 px-2",children:[a.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.right?.lineNumber??""}),a.jsx("span",{className:xe("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?"+":" "}),a.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.right?.text??""})]})]},r))})}const Zu=y.memo(Vw),Gw={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"};function ao(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}function Ki({trend:e}){if(e===null)return null;const t=e.direction==="up",n=t?Ig:Tg,r=t?"+":"-";return a.jsxs("span",{className:"flex items-center gap-0.5 text-muted-foreground tabular-nums",children:[a.jsx(n,{className:t?"size-3 text-emerald-400":"size-3 text-rose-400"}),a.jsxs("span",{className:"font-mono",children:[r,Je(e.delta)]})]})}const Yw=y.memo(function({log:e,messageCount:t=null,toolCount:n=null,expanded:r,onToggle:o,responseToolNames:s=null,cacheTrend:i=null,onReplay:l,onCopyRequest:c,requestCopied:u=!1,onToggleRequestExpansion:d,requestExpansionState:f=null,slowResponseThresholdSeconds:m=0}){const p=Bx(e.responseStatus),g=e.elapsedMs!==null&&m>0&&e.elapsedMs>m*1e3,h=e.inputTokens!==null||e.outputTokens!==null,x=y.useMemo(()=>s?.join(", ")??null,[s]);return a.jsx($e,{children:a.jsxs("div",{role:"button",tabIndex:0,"data-nav-id":`log-${e.id}`,"data-nav-action":r?"collapse":"expand",className:xe("flex items-center gap-2 px-3 py-1 cursor-pointer transition-colors","hover:bg-muted/50","select-none","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:outline-none"),onClick:o,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),o())},children:[a.jsxs("span",{className:"text-blue-400/80 font-mono text-xs font-semibold tabular-nums shrink-0",children:["#",e.id]}),a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(sn,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:e.timestamp})]}),e.model!==null&&a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsx("span",{className:"shrink-0",children:a.jsx(Mu,{provider:Pu(e.model),className:"size-4"})})}),a.jsx(Ee,{children:e.model})]}),p!=="success"&&a.jsxs(Au,{variant:"outline",className:xe("text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums gap-1",Gw[p]),children:[p==="server_error"?a.jsx(p0,{className:"size-3","aria-label":"Server error"}):p==="client_error"?a.jsx(bo,{className:"size-3","aria-label":"Client error"}):p==="pending"?a.jsx(hr,{className:"size-3 animate-spin","aria-label":"Pending"}):null,e.responseStatus]}),e.elapsedMs!==null&&a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsxs("span",{className:xe("flex items-center gap-1 text-xs shrink-0",g?"text-amber-400":"text-muted-foreground"),children:[a.jsx(sn,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:ao(e.elapsedMs)}),g&&a.jsx(bo,{className:"size-3","aria-label":"Slow response"})]})}),a.jsx(Ee,{children:g?`Slow response: ${ao(e.elapsedMs)} exceeds ${ao(m*1e3)}`:"Elapsed response time"})]}),h&&a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(ns,{className:"size-3 text-muted-foreground"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[a.jsxs("span",{className:e.inputTokens!==null?"text-blue-400":"text-muted-foreground",children:["IN ",e.inputTokens!==null?Je(e.inputTokens):"—"]})," / ",a.jsxs("span",{className:e.outputTokens!==null?"text-amber-400":"text-muted-foreground",children:["OUT ",e.outputTokens!==null?Je(e.outputTokens):"—"]})]})]}),e.cacheCreationInputTokens!==null&&e.cacheCreationInputTokens>0&&a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(Ki,{trend:i?.creation??null}),a.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",Je(e.cacheCreationInputTokens)]})]})}),a.jsx(Ee,{children:"Tokens cached for reuse, reducing future API cost"})]}),e.cacheReadInputTokens!==null&&e.cacheReadInputTokens>0&&a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(Ki,{trend:i?.read??null}),a.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",Je(e.cacheReadInputTokens)]})]})}),a.jsx(Ee,{children:"Tokens served from cache, reducing API cost"})]}),t!==null&&a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(dl,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:t})]}),n!==null&&a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(ri,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:n})]}),s!==null&&s.length>0&&a.jsxs("span",{className:"flex items-center gap-1 text-amber-400/80 text-xs shrink-0",children:[a.jsx(ri,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums truncate max-w-[160px]",children:x})]}),e.origin!==null&&a.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:`Origin: ${e.origin}`,children:[a.jsx(i0,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",title:e.origin,children:e.origin})]}),(e.clientPid!==null||e.clientProjectFolder!==null)&&a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-purple-400/80 text-xs shrink-0",children:[a.jsx(t0,{className:"size-3"}),e.clientProjectFolder!==null?a.jsx("span",{className:"font-mono tabular-nums",children:e.clientProjectFolder}):a.jsxs("span",{className:"font-mono tabular-nums",children:["PID ",e.clientPid]})]})}),a.jsx(Ee,{children:e.clientCwd!==null?`PID: ${e.clientPid??"?"} CWD: ${e.clientCwd}`:`Process ID: ${e.clientPid??"?"}`})]}),e.streaming&&a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsx(y0,{className:"size-3 text-muted-foreground/60 shrink-0"})}),a.jsx(Ee,{children:"Request used SSE streaming"})]}),a.jsx("span",{className:"flex-1 min-w-0"}),r&&a.jsxs("span",{className:"flex items-center gap-1.5 shrink-0",onClick:v=>v.stopPropagation(),onKeyDown:v=>v.stopPropagation(),children:[f!==null&&d!==void 0&&a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsx(Me,{variant:"outline",size:"icon",className:"size-8",onClick:d,disabled:f.isPending,"aria-pressed":f.isExpanded,"aria-label":f.isExpanded?"Collapse all JSON":"Expand all JSON",children:f.isExpanded?a.jsx(ll,{className:"size-3.5"}):a.jsx(al,{className:"size-3.5"})})}),a.jsx(Ee,{children:f.isExpanded?"Collapse all JSON nodes":"Expand all JSON nodes"})]}),c!==void 0&&a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsx(Me,{variant:"outline",size:"icon",className:"size-8",onClick:c,"aria-label":"Copy request body",children:u?a.jsx(Et,{className:"size-3.5 text-emerald-500"}):a.jsx(fn,{className:"size-3.5"})})}),a.jsx(Ee,{children:u?"Copied to clipboard":"Copy request body"})]}),l!==void 0&&a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsx(Me,{variant:"outline",size:"icon",className:"size-8",onClick:l,"aria-label":"Replay request",children:a.jsx(w0,{className:"size-3.5"})})}),a.jsx(Ee,{children:"Re-send this request to the provider"})]})]}),r?a.jsx(Mn,{className:"size-4 text-muted-foreground shrink-0"}):a.jsx(Xo,{className:"size-4 text-muted-foreground shrink-0"})]})})}),Xw="/v1/chat/completions",Qw="/chat/completions",e_="/v1/messages";class t_{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)}detectFormat(t){if(t===null)return"unknown";for(const n of this.handlers.values())if(n.detectFormat(t))return n.format;return"unknown"}}const vn=new t_;function n_(e){return vn.getByPath(e)??null}function r_(e){return n_(e)?.format??"unknown"}vn.registerPath(e_,"anthropic");vn.registerPath(Xw,"openai");vn.registerPath(Qw,"openai");function o_(e){if(e==="")return{};try{const t=JSON.parse(e);return t!==null&&typeof t=="object"&&!Array.isArray(t)?{...t}:{}}catch{return{}}}function s_(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:o_(e.inputJson)}}}function Wu(e,t,n,r){const o=new Map;let s="",i="",l=null,c=null,u=0,d=0;const f=1e3;let m=0,p=0;const g=[];for(const x of e.split(`
|
|
94
|
+
`)){const v=x.trim();if(v.startsWith("data: "))try{const _=JSON.parse(v.slice(6)),k=hg.safeParse(_);if(!k.success)continue;const C=k.data;switch(m===0&&(p=Date.now()),r===!0&&g.length<f&&g.push({index:m,timestamp:Date.now()-p,type:C.type,data:C}),m++,C.type){case"message_start":s=C.message.id,i=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=i);break;case"content_block_start":{const j=C.content_block;switch(j.type){case"text":o.set(C.index,{type:"text",text:j.text??""});break;case"thinking":o.set(C.index,{type:"thinking",thinking:j.thinking??"",signature:j.signature??""});break;case"think":o.set(C.index,{type:"think",thinking:j.thinking??"",signature:j.signature??""});break;case"tool_use":o.set(C.index,{type:"tool_use",id:j.id,name:j.name,inputJson:""});break}break}case"content_block_delta":{const j=o.get(C.index);if(j===void 0)break;const z=C.delta;z.type==="text_delta"&&j.type==="text"?j.text+=z.text:z.type==="thinking_delta"&&(j.type==="thinking"||j.type==="think")?j.thinking+=z.thinking:z.type==="signature_delta"&&(j.type==="thinking"||j.type==="think")?j.signature+=z.signature:z.type==="input_json_delta"&&j.type==="tool_use"&&(j.inputJson+=z.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:g,truncated:m>f});const h=[...o.entries()].sort(([x],[v])=>x-v).map(([,x])=>s_(x));return JSON.stringify({id:s,type:"message",model:i!==""?i:n??"",role:"assistant",content:h,stop_reason:l,stop_sequence:c,usage:{input_tokens:u,output_tokens:d}})}const i_={format:"anthropic",parseRequest(e,t){try{const n=JSON.parse(e),r=Ya.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=Xa.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 Wu(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}}};vn.register(i_);class a_{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 Es=new a_,l_="https://api.anthropic.com",c_={MiniMax:"https://api.minimaxi.com/anthropic"},u_={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(c_))if(t.startsWith(n.toLowerCase()))return!0;return!0},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:l_},extractStream(e,t,n,r){return Wu(e,t,n,r)}};Es.register(u_);function Ns(e,t,n,r=!0){let o="",s="",i="",l="",c=null,u=0,d=0,f=!1,m=!1;const p=new Map,g=1e3;let h=0,x=0;const v=[];for(const k of e.split(`
|
|
95
|
+
`)){const C=k.trim();if(!C.startsWith("data: "))continue;const j=C.slice(6);if(j==="[DONE]")break;try{const z=JSON.parse(j);if(typeof z=="object"&&z!==null&&!Array.isArray(z)){const O=Object.getOwnPropertyDescriptor(z,"error");if(O!==void 0&&typeof O.value=="object"&&O.value!==null){const R=Object.getOwnPropertyDescriptor(O.value,"message");R!==void 0&&typeof R.value=="string"&&(t.error=R.value);continue}}const E=yg.safeParse(z);if(!E.success)continue;const A=E.data;if(h===0&&(x=Date.now()),r===!0&&v.length<g&&v.push({index:h,timestamp:Date.now()-x,type:"chat.completion.chunk",data:A}),h++,m||(o=A.id,s=A.model,m=!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 z=="object"&&z!==null&&!Array.isArray(z)){const O=Object.getOwnPropertyDescriptor(z,"usage");if(O!==void 0&&typeof O.value=="object"&&O.value!==null){const R=Object.getOwnPropertyDescriptor(O.value,"prompt_tokens_details");if(R!==void 0&&typeof R.value=="object"&&R.value!==null){const q=Object.getOwnPropertyDescriptor(R.value,"cached_tokens");q!==void 0&&typeof q.value=="number"&&(t.cacheReadInputTokens=q.value)}}}f=!0}for(const O of A.choices){const R=O.delta;R.content!==void 0&&R.content!==null&&(i+=R.content),R.reasoning_content!==void 0&&R.reasoning_content!==null&&(l+=R.reasoning_content),R.thinking!==void 0&&R.thinking!==null&&(l+=R.thinking);const q=R.think;if(q!=null&&(l+=q),O.finish_reason!==void 0&&O.finish_reason!==null&&(c=O.finish_reason),R.tool_calls!==void 0&&R.tool_calls!==null)for(const S of R.tool_calls){let I=p.get(S.index);I===void 0&&(I={index:S.index,type:"function",function:{name:"",arguments:""}},p.set(S.index,I)),S.id!==void 0&&(I.id=S.id),S.function?.name!==void 0&&(I.function.name+=S.function.name),S.function?.arguments!==void 0&&(I.function.arguments+=S.function.arguments)}}}catch{}}r===!0&&(t.streamingChunks={chunks:v,truncated:h>g}),f||(d=Math.ceil(i.length/4)),t.outputTokens=d;const _={role:"assistant",content:i};return l&&(_.reasoning_content=l),p.size>0&&(_.tool_calls=[...p.values()]),JSON.stringify({id:o,object:"chat.completion",created:Math.floor(Date.now()/1e3),model:s!==""?s:n??"",choices:[{index:0,message:_,finish_reason:c}],usage:{prompt_tokens:u,completion_tokens:d,total_tokens:u+d}})}const d_={format:"openai",parseRequest(e,t){try{const n=JSON.parse(e),r=tl.safeParse(n);return r.success?{model:r.data.model,sessionId:t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){const t=rl(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 s=Object.getOwnPropertyDescriptor(o.value,"prompt_tokens_details");if(s!==void 0&&typeof s.value=="object"&&s.value!==null){const i=Object.getOwnPropertyDescriptor(s.value,"cached_tokens");i!==void 0&&typeof i.value=="number"&&(n=i.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 Ns(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}}};vn.register(d_);const f_="https://api.openai.com/v1",h_={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:f_},extractStream(e,t,n,r){return Ns(e,t,n,r)}};Es.register(h_);const p_="https://dashscope.aliyuncs.com/compatible-mode/v1",m_={name:"alibaba",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return!!(t.startsWith("glm-5")||t.startsWith("qwen"))},getUpstreamBase(e,t){return p_},extractStream(e,t,n){return Ns(e,t,n)}};Es.register(m_);function Vu(e,t){for(const n of Array.from(e))t(n)}const g_=/[\u3000-\u9FFF\uAC00-\uD7FF\uF900-\uFAFF\uFF00-\uFFEF\u{1F300}-\u{1FAFF}]/u;function Hu(e){if(e.length===0)return 0;let t=0,n=0;return Vu(e,r=>{g_.test(r)?t+=1:n+=1}),Math.ceil(t*1)+Math.ceil(n/4)}function qu(e){if(e.length===0)return 0;let t=0;return Vu(e,()=>{t+=1}),t}function Ot(e){return{parsed:null,comparisonValue:e,messageCount:null,toolCount:null}}const tn={parsed:null,toolNames:null};function x_(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 s=typeof r.name=="string"?r.name:"",i=r.input!==void 0?JSON.stringify(r.input):"";t.push(`${s} ${i}`.trim());break}case"tool_result":{const s=r.content;if(typeof s=="string")t.push(s);else if(Array.isArray(s)){for(const i of s)if(i!==null&&typeof i=="object"){const l=i.text;typeof l=="string"&&t.push(l)}}break}case"image":t.push("[image]");break}}return t.join(`
|
|
96
|
+
`)}function v_(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(`
|
|
97
|
+
`)}function y_(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(`
|
|
98
|
+
`)}function lo(e,t,n,r){return{role:e,label:t,text:n,size:Hu(n),characters:qu(n),path:r}}const b_={format:"anthropic",analyzeRequest(e){if(e===null)return Ot(e);try{const t=Ya.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}:Ot(e)}catch{return Ot(e)}},analyzeResponse(e){if(e===null)return tn;try{let t=JSON.parse(e);typeof t=="string"&&(t=JSON.parse(t));const n=Xa.safeParse(t);if(!n.success)return tn;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 tn}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(t.system!==void 0){const r=v_(t.system);r.length>0&&n.push(lo("system","system",r,"/system"))}if(Array.isArray(t.messages)&&t.messages.forEach((r,o)=>{if(r===null||typeof r!="object")return;const s=r,i=s.role==="user"||s.role==="assistant"?s.role:"user",l=x_(s.content);n.push(lo(i,`[${o}] ${i}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=y_(t.tools);n.push(lo("tools","tools",r,"/tools"))}return n.length>0?n:null}};function w_(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(`
|
|
99
|
+
`)}function __(e){const t=[],n=w_(e.content);n.length>0&&t.push(n);const r=typeof e.reasoning_content=="string"?e.reasoning_content:typeof e.thinking=="string"?e.thinking:typeof e.think=="string"?e.think:"";r.length>0&&t.push(r);const o=e.tool_calls;if(Array.isArray(o))for(const s of o){if(s===null||typeof s!="object")continue;const i=s.function;if(i===void 0)continue;const l=typeof i.name=="string"?i.name:"",c=typeof i.arguments=="string"?i.arguments:"";t.push(`${l} ${c}`.trim())}return t.join(`
|
|
100
|
+
`)}function k_(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(`
|
|
101
|
+
`)}function Gi(e,t,n,r){return{role:e,label:t,text:n,size:Hu(n),characters:qu(n),path:r}}const C_={format:"openai",analyzeRequest(e){if(e===null)return Ot(e);try{const t=tl.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}:Ot(e)}catch{return Ot(e)}},analyzeResponse(e){if(e===null)return tn;const t=rl(e);if(t===null)return tn;const n=t.choices[0]?.message?.tool_calls?.map(r=>r.function?.name??"").filter(r=>r!=="")??[];return{parsed:t,toolNames:n.length>0?n:null}},anatomySegments(e){if(e===null||typeof e!="object")return null;const t=e,n=[];if(Array.isArray(t.messages)&&t.messages.forEach((r,o)=>{if(r===null||typeof r!="object")return;const s=r,i=s.role==="user"||s.role==="assistant"||s.role==="system"||s.role==="tool"?s.role:"user",l=__(s);n.push(Gi(i,`[${o}] ${i}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=k_(t.tools);n.push(Gi("tools","tools",r,"/tools"))}return n.length>0?n:null}},S_={format:"unknown",analyzeRequest(e){return Ot(e)},analyzeResponse(){return tn},anatomySegments(){return null}},j_={anthropic:b_,openai:C_,unknown:S_};function E_(e){return j_[e]}function Fo(e){const t=r_(e.path);return t==="unknown"?e.apiFormat:t}function Yi(e,t,n){return e==="anthropic"&&t==="full"&&n}function N_(e,t){return e==="full"&&t}function Xi(e,t,n,r){return e==="anthropic"&&t==="full"&&n&&r}function Jt(){return a.jsx("div",{className:"h-1","aria-hidden":"true"})}function Qi({text:e,label:t,copied:n,onCopy:r}){return e===null?null:a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsxs(Me,{variant:"outline",size:"sm",className:"h-8 text-xs",onClick:r,"aria-label":t,children:[n?a.jsx(Et,{className:"size-3.5 mr-1 text-emerald-500"}):a.jsx(fn,{className:"size-3.5 mr-1"}),n?"Copied!":t]})}),a.jsx(Ee,{children:n?"Copied to clipboard":t})]})}function ea({active:e,onClick:t}){return a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsxs(Me,{variant:e?"default":"outline",size:"sm",className:"h-8 text-xs",onClick:t,"aria-pressed":e,children:[a.jsx(ul,{className:"size-3.5 mr-1"}),e?"Showing diff":"Diff with Raw"]})}),a.jsx(Ee,{children:e?"Hide diff view":"Compare proxy output against the original raw version"})]})}const T_=y.memo(function({rawBody:e,displayedBody:t,emptyLabel:n}){const r=y.useMemo(()=>jw(e,t),[e,t]);return a.jsx(Zu,{result:r,emptyLabel:n})}),A_=y.memo(function({rawHeaders:e,headers:t,emptyLabel:n}){const r=y.useMemo(()=>Sw(e,t),[e,t]);return a.jsx(Zu,{result:r,emptyLabel:n})});function co(e){const[t,n]=y.useState(!1),r=y.useRef(null);y.useEffect(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);const o=y.useCallback(s=>{s.stopPropagation(),e!==null&&window.navigator.clipboard.writeText(e).then(()=>{n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),2e3)})},[e]);return{copied:t,copy:o}}const z_=y.memo(function({log:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,cacheTrend:o=null,onCompareWithPrevious:s}){const[i,l]=y.useState(!1),[c,u]=y.useState(!1),[d,f]=y.useState(!1),[m,p]=y.useState(!1),[g,h]=y.useState("request"),[x,v]=y.useState(null),_=y.useRef(null),k=Fo(e),C=E_(k),j=y.useMemo(()=>C.analyzeRequest(e.rawRequestBody),[C,e.rawRequestBody]),z=y.useMemo(()=>C.analyzeResponse(e.responseText),[C,e.responseText]),A=y.useMemo(()=>!n||k!=="anthropic"||e.rawRequestBody===null?null:iw(e.rawRequestBody).body,[e.rawRequestBody,k,n])??e.rawRequestBody,O=co(A),R=co(e.rawRequestBody),q=co(e.responseText),S=Fi(A),I=Fi(e.rawRequestBody),b=y.useMemo(()=>S.parsedData!==null?C.anatomySegments(S.parsedData):null,[C,S.parsedData]),P=y.useMemo(()=>{if(b!==null)return new Set(b.map(L=>L.path))},[b]),H=yw({containerRef:_,setExpandToPath:v,ensureTabActive:()=>{g!=="request"&&h("request")}});return a.jsxs($e,{children:[a.jsxs("div",{className:"border border-border rounded-lg mb-1 overflow-hidden",children:[a.jsx(Yw,{log:e,messageCount:j.messageCount,toolCount:j.toolCount,expanded:i,onToggle:()=>l(!i),responseToolNames:z.toolNames,cacheTrend:o,slowResponseThresholdSeconds:r,onReplay:s===void 0?void 0:()=>{u(!0)},onCopyRequest:A===null?void 0:L=>{O.copy(L)},requestCopied:O.copied,onToggleRequestExpansion:S.toggle,requestExpansionState:S.policy===null?null:{isExpanded:S.isExpanded,isPending:S.isPending}}),i&&a.jsx("div",{onClick:L=>L.stopPropagation(),onKeyDown:L=>L.stopPropagation(),children:a.jsxs(Du,{value:g,onValueChange:h,children:[a.jsxs(Lu,{className:"mx-4 mt-2",children:[t==="full"&&a.jsx(dt,{value:"raw-headers",children:"Raw Headers"}),t==="full"&&a.jsx(dt,{value:"headers",children:"Headers"}),Yi(k,t,n)&&a.jsx(dt,{value:"raw-request",children:"Raw Request"}),a.jsx(dt,{value:"request",children:"Request"}),b!==null&&a.jsx(dt,{value:"anatomy",children:"Anatomy"}),t==="full"&&a.jsx(dt,{value:"raw",children:"Raw Response"}),a.jsx(dt,{value:"parsed",children:"Response"})]}),Yi(k,t,n)&&a.jsx(ft,{value:"raw-request",children:g==="raw-request"&&a.jsxs("div",{className:"px-4 pt-1 pb-3",children:[a.jsxs("div",{className:"flex justify-end gap-2 mb-2",children:[a.jsx(aw,{policy:I.policy,isExpanded:I.isExpanded,isPending:I.isPending,onToggle:I.toggle}),a.jsx(Qi,{text:e.rawRequestBody,label:"Copy",copied:R.copied,onCopy:R.copy})]}),e.rawRequestBody===null?a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"}):I.parsedData!==null?a.jsx(y.Suspense,{fallback:a.jsx(Jt,{}),children:a.jsx($i,{data:I.parsedData,bulkDepth:I.bulkDepth,bulkRevision:I.bulkRevision})}):a.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:e.rawRequestBody})]})}),a.jsx(ft,{value:"request",children:g==="request"&&a.jsxs("div",{className:"px-4 pt-1 pb-3",children:[(Xi(k,t,n,e.rawRequestBody!==null)||s!==void 0)&&a.jsxs("div",{className:"flex justify-end gap-2 mb-2",children:[Xi(k,t,n,e.rawRequestBody!==null)&&a.jsx(ea,{active:m,onClick:L=>{L.stopPropagation(),p(!m)}}),s!==void 0&&a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsxs(Me,{variant:"outline",size:"sm",className:"h-8 text-xs",onClick:L=>{L.stopPropagation(),s(e)},children:[a.jsx(ul,{className:"size-3 mr-1"}),"Diff with Previous"]})}),a.jsx(Ee,{children:"Compare this request with the immediately preceding one"})]})]}),m?a.jsx(T_,{rawBody:e.rawRequestBody,displayedBody:A,emptyLabel:"No transformation applied — raw and sent request bodies are identical."}):a.jsx("div",{ref:_,children:A===null?a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"}):S.parsedData!==null?a.jsx(y.Suspense,{fallback:a.jsx(Jt,{}),children:a.jsx($i,{data:S.parsedData,bulkDepth:S.bulkDepth,bulkRevision:S.bulkRevision,anatomyPaths:P,expandToPath:x})}):a.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:A})})]})}),b!==null&&a.jsx(ft,{value:"anatomy",children:g==="anatomy"&&a.jsx(y.Suspense,{fallback:a.jsx(Jt,{}),children:a.jsx(hw,{parsed:null,inputTokens:e.inputTokens??null,segments:b,onSegmentActivate:H})})}),t==="full"&&a.jsx(ft,{value:"headers",children:g==="headers"&&a.jsxs("div",{className:"px-4 pt-1 pb-3",children:[a.jsx("div",{className:"flex justify-end gap-2 mb-2",children:N_(t,e.rawHeaders!==void 0&&Object.keys(e.rawHeaders).length>0)&&a.jsx(ea,{active:d,onClick:L=>{L.stopPropagation(),f(!d)}})}),d?a.jsx(A_,{rawHeaders:e.rawHeaders,headers:e.headers,emptyLabel:"No transformation applied — raw and processed headers are identical."}):e.headers&&Object.keys(e.headers).length>0?a.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.headers).sort(([L],[B])=>L.localeCompare(B)).map(([L,B])=>a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[L,":"]}),a.jsx("span",{className:"text-muted-foreground truncate",title:B,children:B})]},L))}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No headers captured"})]})}),t==="full"&&a.jsx(ft,{value:"raw-headers",children:g==="raw-headers"&&a.jsx("div",{className:"px-4 pt-1 pb-3",children:e.rawHeaders&&Object.keys(e.rawHeaders).length>0?a.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.rawHeaders).sort(([L],[B])=>L.localeCompare(B)).map(([L,B])=>a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[L,":"]}),a.jsx("span",{className:"text-muted-foreground truncate",title:B,children:B})]},L))}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No raw headers captured"})})}),a.jsx(ft,{value:"raw",children:g==="raw"&&a.jsxs("div",{className:"px-4 pt-1 pb-3 space-y-3",children:[e.error!==void 0&&e.error!==null&&a.jsxs("div",{className:"rounded border border-destructive/50 bg-destructive/10 p-3 text-xs",children:[a.jsx("div",{className:"font-semibold text-destructive mb-1",children:"SSE Error"}),a.jsx("div",{className:"text-muted-foreground font-mono",children:e.error})]}),a.jsx("div",{className:"flex justify-end",children:a.jsx(Qi,{text:e.responseText,label:"Copy",copied:q.copied,onCopy:q.copy})}),e.responseText!==null?a.jsx(y.Suspense,{fallback:a.jsx(Jt,{}),children:a.jsx(gw,{text:e.responseText,defaultExpandDepth:0})}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No response"}),e.streaming===!0&&a.jsx(y.Suspense,{fallback:a.jsx(Jt,{}),children:a.jsx(mw,{logId:e.id,truncated:e.streamingChunksPath!==null})})]})}),a.jsx(ft,{value:"parsed",children:g==="parsed"&&a.jsx("div",{className:"px-4 pt-1 pb-3",children:a.jsx(y.Suspense,{fallback:a.jsx(Jt,{}),children:a.jsx(pw,{responseText:e.responseText,responseStatus:e.responseStatus,streaming:e.streaming,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens,cacheReadInputTokens:e.cacheReadInputTokens,apiFormat:k,error:e.error})})})})]})})]}),a.jsx(y.Suspense,{fallback:null,children:a.jsx(fw,{log:e,open:c,onOpenChange:u})})]})});function O_({stopReason:e,isPending:t,isFirst:n,isTurnStart:r,isOnlyEntry:o=!1,crabIndex:s=0,collapsible:i=!1,onToggle:l}){const c=e==="end_turn"||e==="stop",u=o&&r&&c,d=t&&!c,f=y.useMemo(()=>wr(s),[s]),m=y.useMemo(()=>$2(s),[s]),p=i&&l?{role:"button",tabIndex:0,className:"cursor-pointer",onClick:g=>{g.stopPropagation(),l()},onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&(g.preventDefault(),l())}}:{};return a.jsxs("div",{className:"flex flex-col items-center w-6 shrink-0 pt-0.5 pb-0.5",children:[a.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]",children:!n&&a.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),u?a.jsx("span",{title:"Start and end of turn",children:a.jsx(m,{className:xe("size-3.5 text-[#80FF00]","animate-crab-settle","drop-shadow-[0_0_4px_rgba(128,255,0,0.5)]")})}):c?a.jsx("span",{title:e==="end_turn"?"End of Turn (Anthropic)":"End of Turn (OpenAI)",...p,children:a.jsx(f,{className:xe("size-3.5 text-amber-400","animate-crab-settle","drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})}):r?a.jsx("span",{title:"Start of turn",...p,children:a.jsx(f,{className:xe("size-3.5 text-emerald-400","animate-crab-appear","drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}):d?a.jsx("span",{title:"Processing…",children:a.jsx(f,{className:xe("size-3.5 text-amber-300/80","animate-crab-crawl")})}):a.jsx("span",{children:a.jsx(f,{className:"size-3.5 text-muted-foreground/40"})}),a.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:!c&&a.jsx("div",{className:xe("w-0.5 h-full",t?"border-dashed bg-transparent border-l-2 border-muted-foreground/20":"bg-muted-foreground/30")})})]})}function I_(e,t){return e||t}function R_(e,t,n){return e>1&&t&&!n}function P_(e){const t=[];let n=[],r=0;for(const o of e){n.push({log:o,stopReason:E2(o)});const s=n[n.length-1];s!==void 0&&Ou(s.stopReason)&&(t.push({entries:n,turnIndex:r}),n=[],r+=1)}return n.length>0&&t.push({entries:n,turnIndex:r}),t}function M_(e){const t=new Map;for(const n of e)for(let r=1;r<n.logs.length;r+=1){const o=n.logs[r],s=n.logs[r-1];if(o===void 0||s===void 0)continue;const i=Fo(o),l=Fo(s);i==="unknown"||i!==l||t.set(o.id,s)}return t}function uo(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const D_=y.memo(function({entries:t,viewMode:n,strip:r,slowResponseThresholdSeconds:o,cacheTrends:s,onCompareWithPrevious:i,comparisonPredecessors:l,turnIndex:c=0}){const u=t.length-1,d=t[u]?.stopReason??null,f=d!==null?Ou(d):!1,m=t[u]?.log.responseStatus===null,p=t.length===1,g=R_(t.length,f,m),[h,x]=y.useState(!1),v=y.useRef(!1);y.useEffect(()=>{g?f&&!v.current&&x(!0):x(!1),v.current=f},[g,f]);const _=y.useCallback(()=>{g&&x(S=>!S)},[g]),k=y.useMemo(()=>{let S=0,I=0,b=null,P=!1;for(const H of t)H.log.inputTokens!==null&&(S+=H.log.inputTokens,P=!0),H.log.outputTokens!==null&&(I+=H.log.outputTokens,P=!0),H.log.elapsedMs!==null&&(b=b===null?H.log.elapsedMs:Math.max(b,H.log.elapsedMs));return{totalInput:S,totalOutput:I,hasTokens:P,maxElapsed:b}},[t,u]),C=y.useMemo(()=>{const S=new Set;for(const I of t){const b=Pu(I.log.model);b!=="unknown"&&S.add(b)}return[...S]},[t]),j=y.useMemo(()=>wr(t[0]?.log.id??0),[t]),z=y.useMemo(()=>wr(t[u]?.log.id??0),[t,u]),E=c%2===0?"bg-muted/10":"bg-muted/25",A=k.maxElapsed!==null&&o>0&&k.maxElapsed>o*1e3,[O,R]=y.useState(0),q=y.useRef(null);return y.useEffect(()=>{const S=q.current;if(!S)return;let I=0;const b=new ResizeObserver(()=>{window.cancelAnimationFrame(I),I=window.requestAnimationFrame(()=>R(P=>P+1))});return b.observe(S),()=>{b.disconnect(),window.cancelAnimationFrame(I)}},[]),a.jsx("div",{ref:q,className:xe("border rounded-lg",m?"border-amber-500/10":"border-transparent"),children:h?a.jsxs("div",{"data-nav-id":`turn-collapsed-${t[0]?.log.id??c}`,"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:_,onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),_())},children:[a.jsx("div",{className:"w-5 shrink-0 flex items-start pt-1.5",children:a.jsx("span",{className:"text-[10px] text-muted-foreground/50 font-mono tabular-nums leading-none select-none",children:c+1})}),a.jsxs("div",{className:"w-6 shrink-0 flex flex-col items-center pt-0.5 pb-0.5",children:[a.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]"}),a.jsx("span",{role:"button",tabIndex:0,title:"Start of turn — click to expand",className:"cursor-pointer",onClick:S=>{S.stopPropagation(),_()},onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),_())},children:a.jsx(j,{className:xe("size-3.5 text-emerald-400","animate-crab-appear drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}),a.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:a.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),a.jsx("span",{role:"button",tabIndex:0,title:"End of Turn — click to expand",className:"cursor-pointer",onClick:S=>{S.stopPropagation(),_()},onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),_())},children:a.jsx(z,{className:xe("size-3.5 text-amber-400","animate-crab-settle drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})})]}),t.length>1&&a.jsxs("div",{className:xe("flex-1 min-w-0 mb-0.5 rounded-lg border border-border py-1 px-3 flex items-center gap-3 text-xs",E),children:[a.jsxs("span",{className:"text-blue-400/80 font-mono font-semibold tabular-nums shrink-0",children:["#",t[0]?.log.id??"?"," ~ #",t[u]?.log.id??"?"]}),a.jsxs("span",{className:"text-muted-foreground shrink-0",children:[t.length," request",t.length>1?"s":""]}),C.length>0&&a.jsx("span",{className:"flex items-center gap-0.5 shrink-0",children:C.map(S=>a.jsx(Mu,{provider:S,className:"size-4"},S))}),k.maxElapsed!==null&&a.jsx($e,{children:a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsxs("span",{className:xe("flex items-center gap-1 shrink-0",A?"text-amber-400":"text-muted-foreground"),children:[a.jsx(sn,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums",children:uo(k.maxElapsed)}),A&&a.jsx(bo,{className:"size-3","aria-label":"Slow response"})]})}),a.jsx(Ee,{children:A?`Slow response: ${uo(k.maxElapsed)} exceeds ${uo(o*1e3)}`:"Slowest request in this turn"})]})}),k.hasTokens&&a.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[a.jsx(ns,{className:"size-3 text-muted-foreground"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[a.jsxs("span",{className:"text-blue-400",children:["IN ",Je(k.totalInput)]})," / ",a.jsxs("span",{className:"text-amber-400",children:["OUT ",Je(k.totalOutput)]})]})]}),a.jsx("span",{className:"flex-1 min-w-0"}),a.jsx(Xo,{className:"size-4 text-muted-foreground shrink-0"})]})]}):t.map((S,I)=>{const{log:b,stopReason:P}=S,H=I===0;return a.jsxs("div",{className:"flex items-stretch",children:[H?a.jsx("div",{className:"w-5 shrink-0 flex items-start pt-1.5",children:a.jsx("span",{className:"text-[10px] text-muted-foreground/50 font-mono tabular-nums leading-none select-none",children:c+1})}):a.jsx("div",{className:"w-5 shrink-0"}),a.jsx(O_,{stopReason:P,isPending:b.responseStatus===null,isFirst:I===0,isTurnStart:H,isOnlyEntry:p,crabIndex:b.id%12,collapsible:g&&H,onToggle:_}),a.jsx("div",{className:xe("flex-1 min-w-0 mb-0.5 rounded-lg",E),children:a.jsx(z_,{log:b,viewMode:n,strip:r,slowResponseThresholdSeconds:o,cacheTrend:s?.get(b.id)??null,onCompareWithPrevious:l.has(b.id)?i:void 0})})]},b.id)})})});function L_(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 F_=y.memo(function({group:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,cacheTrends:o,onCompareWithPrevious:s,comparisonPredecessors:i,onClearGroup:l,standalone:c=!1}){const[u,d]=y.useState(!1),f=y.useMemo(()=>L_(e.logs),[e.logs]),m=e.logs[0]?.timestamp??new Date().toISOString(),p=e.logs[e.logs.length-1]?.timestamp??new Date().toISOString(),g=C2(e.logs),h=e.logs.some(v=>v.responseStatus===null),x=y.useMemo(()=>P_(e.logs),[e.logs]);return a.jsxs("div",{className:"mb-2",children:[!c&&a.jsx(_2,{conversationId:e.conversationId,startTime:m,endTime:p,totalCalls:e.logs.length,totalInputTokens:f.totalInputTokens,totalOutputTokens:f.totalOutputTokens,apiFormat:k2(e.logs),expanded:u,onToggle:()=>d(!u),hideApiFormat:g,isLoading:h,userAgent:e.logs[0]?.userAgent??null,onClear:()=>l(e.logs.map(v=>v.id))}),I_(c,u)&&a.jsx("div",{children:x.map(v=>a.jsx(D_,{entries:v.entries,viewMode:t,strip:n,slowResponseThresholdSeconds:r,cacheTrends:o,onCompareWithPrevious:s,comparisonPredecessors:i,turnIndex:v.turnIndex},v.turnIndex))})]})});function $_({className:e}){return a.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:xe("inline-block size-5",e),children:[a.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"}),a.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),a.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),a.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),a.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"}),a.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),a.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),a.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),a.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),a.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),a.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]})}const B_="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 U_({className:e}){return a.jsx("img",{src:B_,alt:"Model Context Protocol","aria-hidden":"true",className:xe("inline-block size-8 object-contain invert",e)})}function ta({...e}){return a.jsx(zb,{"data-slot":"select",...e})}function na({...e}){return a.jsx(Ib,{"data-slot":"select-value",...e})}function ra({className:e,size:t="default",children:n,...r}){return a.jsxs(Ob,{"data-slot":"select-trigger","data-size":t,className:xe("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,a.jsx(Rb,{asChild:!0,children:a.jsx(Mn,{className:"size-4 opacity-50"})})]})}function oa({className:e,children:t,position:n="popper",align:r="center",...o}){return a.jsx(Pb,{children:a.jsxs(Mb,{"data-slot":"select-content",className:xe("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,align:r,...o,children:[a.jsx(Z_,{}),a.jsx(Db,{className:xe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),a.jsx(W_,{})]})})}function tr({className:e,children:t,...n}){return a.jsxs(Lb,{"data-slot":"select-item",className:xe("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[a.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:a.jsx($b,{children:a.jsx(Et,{className:"size-4"})})}),a.jsx(Fb,{children:t})]})}function Z_({className:e,...t}){return a.jsx(Bb,{"data-slot":"select-scroll-up-button",className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Lg,{className:"size-4"})})}function W_({className:e,...t}){return a.jsx(Ub,{"data-slot":"select-scroll-down-button",className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Mn,{className:"size-4"})})}function V_(){return a.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[a.jsx("title",{children:"Claude Code"}),a.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 H_(){return a.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[a.jsx("title",{children:"OpenCode"}),a.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})]})}function q_(){return a.jsxs("svg",{fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[a.jsx("title",{children:"MiMo Code"}),a.jsx("text",{x:"12",y:"18",textAnchor:"middle",fontSize:"16",fontWeight:"800",fontFamily:"system-ui, sans-serif",children:"M"})]})}const J_=ne({name:Z(),apiKey:Z(),format:Ve(["anthropic","openai"]),anthropicBaseUrl:Z(),openaiBaseUrl:Z(),models:Ne(Z()),sourceTool:Ve(["claude-code","opencode","mimo-code"]),alreadyExists:Be()}),K_=ne({providers:Ne(J_),warnings:Ne(Z()).optional()}),G_=ne({success:Be().optional(),imported:me().optional(),message:Z().optional(),errors:Ne(Z()).optional()}),Y_={"claude-code":V_,opencode:H_,"mimo-code":q_};function X_({open:e,onOpenChange:t,onImportComplete:n}){const[r,o]=y.useState(!1),[s,i]=y.useState(null),[l,c]=y.useState([]),[u,d]=y.useState([]),[f,m]=y.useState(new Set),[p,g]=y.useState(!1),[h,x]=y.useState(null),[v,_]=y.useState(null),k=y.useCallback(()=>{o(!0),i(null),d([]),c([]),m(new Set),x(null),_(null),fetch("/api/providers/scan").then(E=>E.ok?E.json().then(A=>{const O=K_.safeParse(A);if(!O.success){i(`Invalid response: ${O.error.message}`);return}c(O.data.providers),d(O.data.warnings??[]);const R=new Set;O.data.providers.forEach((q,S)=>{q.alreadyExists||R.add(S)}),m(R)}):E.text().then(A=>{i(`Scan failed (${E.status}): ${A}`)})).catch(E=>{i(E instanceof Error?E.message:String(E))}).finally(()=>{o(!1)})},[]);y.useEffect(()=>{e&&k()},[e,k]);const C=y.useCallback(E=>{m(A=>{const O=new Set(A);return O.has(E)?O.delete(E):O.add(E),O})},[]),j=y.useCallback(()=>{const E=l.filter((R,q)=>f.has(q));if(E.length===0)return;g(!0),_(null),x(null);const A=new Date().toISOString(),O=E.map(R=>({id:window.crypto.randomUUID(),name:R.name,apiKey:R.apiKey,format:R.format,anthropicBaseUrl:R.anthropicBaseUrl,openaiBaseUrl:R.openaiBaseUrl,models:R.models,createdAt:A,updatedAt:A}));fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providers:O})}).then(R=>R.json()).then(R=>{const q=G_.safeParse(R);if(!q.success){_(`Invalid response: ${q.error.message}`);return}const S=q.data;c(I=>I.map((b,P)=>f.has(P)?{...b,alreadyExists:!0}:b)),m(new Set),S.errors!==void 0&&S.errors.length>0&&S.message!==void 0?x(S.message):x(`Imported ${S.imported??E.length} provider(s)`),n()}).catch(R=>{_(R instanceof Error?R.message:String(R))}).finally(()=>{g(!1)})},[l,f,n]),z=l.some(E=>!E.alreadyExists);return a.jsx(ks,{open:e,onOpenChange:t,children:a.jsxs(Cs,{className:"max-w-xl max-h-[80vh] overflow-hidden flex flex-col",children:[a.jsxs(Ss,{children:[a.jsx(js,{children:"Import from External Tools"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Detect provider configurations from Claude Code, OpenCode, and MiMo Code."})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto space-y-3",children:[r&&a.jsxs("div",{className:"flex items-center justify-center py-8 gap-2 text-muted-foreground",children:[a.jsx(hr,{className:"size-4 animate-spin"}),a.jsx("span",{className:"text-sm",children:"Scanning for external providers..."})]}),s!==null&&a.jsxs("div",{className:"flex items-center gap-2 text-destructive text-sm py-4",children:[a.jsx(An,{className:"size-4"}),s]}),!r&&s===null&&l.length===0&&a.jsxs("p",{className:"text-sm text-muted-foreground py-8 text-center",children:["No external provider configurations found.",a.jsx("br",{}),a.jsx("span",{className:"text-xs",children:"Supported tools: Claude Code (~/.claude/settings.json), OpenCode (~/.config/opencode/opencode.json), MiMo Code (~/.config/mimocode/mimocode.jsonc)"})]}),!r&&l.map((E,A)=>a.jsxs("label",{className:`flex items-start gap-3 p-3 border rounded-md ${E.alreadyExists?"":"cursor-pointer hover:bg-muted/50"}`,children:[!E.alreadyExists&&a.jsx("input",{type:"checkbox",checked:f.has(A),disabled:p,onChange:()=>C(A),className:"mt-0.5 size-4"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[(()=>{const O=Y_[E.sourceTool];return O===void 0?null:a.jsx(O,{})})(),E.alreadyExists&&a.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Already added"})]}),a.jsxs("div",{className:"text-xs text-muted-foreground mt-1 truncate",children:[E.models.slice(0,4).join(", "),E.models.length>4?` +${E.models.length-4} more`:""]}),a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:E.format==="anthropic"?E.anthropicBaseUrl:E.openaiBaseUrl}),a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 font-mono",children:E.apiKey.length>8?`${E.apiKey.slice(0,4)}••••${E.apiKey.slice(-4)}`:"••••"})]})]},`${E.sourceTool}-${E.name}`)),u.length>0&&a.jsx("div",{className:"text-xs text-muted-foreground space-y-1 border-t pt-2",children:u.map((E,A)=>a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(An,{className:"size-3"}),E]},A))}),h!==null&&a.jsx("div",{className:"text-sm text-green-500 border-t pt-2",children:h}),v!==null&&a.jsx("div",{className:"text-sm text-destructive border-t pt-2",children:v})]}),a.jsxs("div",{className:"flex items-center justify-between pt-3 border-t",children:[a.jsxs(Me,{variant:"outline",size:"sm",onClick:k,disabled:r,children:[a.jsx(hr,{className:`size-3 mr-1 ${r?"animate-spin":""}`}),"Rescan"]}),a.jsxs(Me,{size:"sm",onClick:j,disabled:!z||f.size===0||p,children:[a.jsx(Qo,{className:"size-3 mr-1"}),p?"Importing...":`Import Selected (${f.size})`]})]})]})})}function Ju(e){return e.length<=8?"••••••••":e.slice(0,4)+"••••••••"+e.slice(-4)}const Q_={deepseek:"https://api-docs.deepseek.com/zh-cn/"};function ek(e){return Object.prototype.hasOwnProperty.call(e,"success")}function tk(e){return Object.prototype.hasOwnProperty.call(e,"notConfigured")}function nk(e){const t={className:"size-3",strokeWidth:2};switch(e){case"timeout":return a.jsx(sn,{...t});case"network_unreachable":return a.jsx(L0,{...t});case"connection_refused":return a.jsx($0,{...t});case"auth_failed":return a.jsx(c0,{...t});case"rate_limited":return a.jsx(r0,{...t});case"server_error":return a.jsx(N0,{...t});case"invalid_response":return a.jsx(Vg,{...t});case"unknown":return a.jsx(An,{...t});default:return a.jsx(An,{...t})}}function nr({result:e}){const[t,n]=y.useState(!1);if(!ek(e))return tk(e)?a.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[a.jsx(f0,{className:"size-3"}),a.jsx("span",{children:"Not configured"})]}):a.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[a.jsx(fl,{className:"size-3 animate-spin"}),a.jsx("span",{children:"Testing..."})]});if(e.success){const c=[];e.inputTokens!==void 0&&c.push(a.jsxs("span",{children:[e.inputTokens," in"]},"in")),e.outputTokens!==void 0&&c.push(a.jsxs("span",{children:[e.outputTokens," out"]},"out")),e.cacheCreationInputTokens!==void 0&&e.cacheCreationInputTokens>0&&c.push(a.jsx($e,{children:a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["+",e.cacheCreationInputTokens," cache"]})}),a.jsx(Ee,{children:"Tokens cached for reuse, reducing future API cost"})]})},"cache-create")),e.cacheReadInputTokens!==void 0&&e.cacheReadInputTokens>0&&c.push(a.jsx($e,{children:a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["~",e.cacheReadInputTokens," cached"]})}),a.jsx(Ee,{children:"Tokens served from cache, reducing API cost"})]})},"cache-read"));const u=[];for(let d=0;d<c.length;d++)d>0&&u.push(", "),u.push(c[d]);return a.jsx($e,{children:a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 shrink-0",children:[a.jsx(Zg,{className:"size-3"}),a.jsx("span",{children:"Connected"}),c.length>0&&a.jsxs("span",{className:"text-muted-foreground",children:["(",u,")"]})]})}),a.jsx(Ee,{children:"Connection test passed"})]})})}const r=e.error,o=r?.message??"Connection failed",s=r?.hint,i=r?.details,l=r?.type??"unknown";return a.jsxs("div",{className:"flex flex-col gap-1 shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-1 text-xs text-red-600 max-w-[200px]",children:[nk(l),a.jsx($e,{children:a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsx("span",{className:"truncate",children:o})}),a.jsx(Ee,{children:"Connection test failed"})]})}),i!==void 0&&a.jsx($e,{children:a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>n(!t),className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:t?a.jsx(es,{className:"size-3"}):a.jsx(ts,{className:"size-3"})})}),a.jsx(Ee,{children:t?"Hide error details":"Show detailed error information"})]})})]}),t&&i!==void 0&&a.jsxs("div",{className:"text-xs text-muted-foreground bg-muted/50 rounded p-2 max-w-[300px]",children:[s!==void 0&&a.jsx("div",{className:"mb-1",children:s}),a.jsx("div",{className:"font-mono whitespace-pre-wrap break-all text-red-400/80",children:i})]})]})}function rk(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n,o=Math.floor(r/1e3);if(o<60)return"just now";const s=Math.floor(o/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function ok({provider:e,testResults:t,isTesting:n,testingTimeLeft:r,isHighlighted:o,onEdit:s,onDelete:i,onTest:l}){const[c,u]=y.useState(!1),[d,f]=y.useState(!1),[m,p]=y.useState(!1),g=y.useRef(null),h=y.useRef(void 0);t?.testedAt!==void 0&&t.testedAt!==h.current&&(h.current=t.testedAt,g.current=null);const x=y.useCallback(()=>{p(k=>{const C=!k;return C&&g.current===null&&t?.models!==void 0&&(g.current=t.testedAt??"",fetch(`/api/providers/${e.id}/test/log`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})),C})},[e.id,t]);function v(){navigator.clipboard.writeText(e.apiKey).catch(()=>{}),f(!0),setTimeout(()=>f(!1),2e3)}const _=e.apiDocsUrl??Object.entries(Q_).find(([k])=>e.name.toLowerCase().includes(k))?.[1];return a.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:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("span",{className:"font-medium truncate",children:e.name}),e.source==="company"&&a.jsx($e,{children:a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.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:"公司"})}),a.jsx(Ee,{children:"Company-provided API key"})]})}),e.source==="personal"&&a.jsx($e,{children:a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.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:"个人"})}),a.jsx(Ee,{children:"Your personal API key"})]})})]}),_!==void 0&&a.jsxs("a",{href:_,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:[a.jsx(cl,{className:"size-3"}),a.jsx("span",{className:"sr-only",children:"Docs"})]})]}),e.models!==void 0&&e.models.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1",children:e.models.map(k=>a.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:k},k))}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("code",{className:"text-xs text-muted-foreground bg-muted px-2 py-1 rounded flex-1 truncate",children:c?e.apiKey:Ju(e.apiKey)}),a.jsx("button",{type:"button",onClick:()=>u(k=>!k),className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":c?"Hide API key":"Show API key",children:c?a.jsx(es,{className:"size-4"}):a.jsx(ts,{className:"size-4"})}),a.jsx("button",{type:"button",onClick:v,className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":"Copy API key",children:d?a.jsx(Et,{className:"size-4 text-green-500"}):a.jsx(fn,{className:"size-4"})})]}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"text-xs text-muted-foreground min-w-0 flex-1",children:[a.jsx("span",{className:"font-medium",children:"Anthropic:"})," ",a.jsx("span",{className:"truncate",children:e.anthropicBaseUrl})]}),t&&a.jsx(nr,{result:t.anthropic.nonStreaming})]}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"text-xs text-muted-foreground min-w-0 flex-1",children:[a.jsx("span",{className:"font-medium",children:"OpenAI:"})," ",a.jsx("span",{className:"truncate",children:e.openaiBaseUrl})]}),t&&a.jsx(nr,{result:t.openai.nonStreaming})]}),t?.testedAt!==void 0&&a.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a.jsx(sn,{className:"size-3"}),a.jsxs("span",{children:["Tested ",rk(t.testedAt)]})]}),t?.models!==void 0&&Object.keys(t.models).length>0&&a.jsxs("div",{className:"border-t pt-2",children:[a.jsxs("button",{type:"button",onClick:x,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",children:[a.jsx("span",{className:"font-mono",children:m?"▾":"▸"}),"Model Test Results (",Object.keys(t.models).length,")"]}),m&&a.jsx("div",{className:"mt-2 overflow-x-auto",children:a.jsxs("table",{className:"w-full text-xs border-collapse",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border",children:[a.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Model"}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&a.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Anthropic"}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&a.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"OpenAI"})]})}),a.jsx("tbody",{children:Object.entries(t.models).map(([k,C])=>a.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[a.jsx("td",{className:"py-1 px-2 font-medium",children:k}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&a.jsx("td",{className:"py-1 px-2",children:a.jsx(nr,{result:C.anthropic.nonStreaming})}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&a.jsx("td",{className:"py-1 px-2",children:a.jsx(nr,{result:C.openai.nonStreaming})})]},k))})]})})]}),a.jsxs("div",{className:"flex gap-2 pt-1 border-t",children:[l!==void 0&&a.jsxs(Me,{variant:"outline",size:"sm",onClick:()=>l(e.id),className:"text-xs h-7 gap-1",disabled:n??!1,children:[a.jsx(fl,{className:`size-3 ${n??!1?"animate-spin":""}`}),n??!1?r!==void 0?`Testing (${r}s)`:"Testing...":"Test"]}),a.jsxs(Me,{variant:"outline",size:"sm",onClick:()=>s(e),className:"text-xs h-7 gap-1",disabled:n??!1,children:[a.jsx(g0,{className:"size-3"}),"Edit"]}),a.jsxs(Me,{variant:"outline",size:"sm",onClick:()=>i(e.id),className:"text-xs h-7 gap-1 text-destructive hover:text-destructive",disabled:n??!1,children:[a.jsx(hl,{className:"size-3"}),"Delete"]})]})]})}const sk={deepseek:{format:"openai",baseUrl:"https://api.deepseek.com"},minimax:{format:"anthropic",baseUrl:"https://api.minimaxi.com/anthropic",apiDocsUrl:"https://platform.minimaxi.com/docs/api-reference/api-overview"},alibaba:{format:"openai",baseUrl:"https://dashscope.aliyuncs.com/compatible-mode"}},sa=["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"],ia=["glm-5","glm-5.1","qwen3.6-plus","qwen3.7-max"];function ik({provider:e,onSubmit:t,onCancel:n}){const[r,o]=y.useState(e?.name??""),[s,i]=y.useState(e?.apiKey??""),[l,c]=y.useState(!1),[u,d]=y.useState(!1),f=e?.models,[m,p]=y.useState(f!==void 0&&f.length>0?f:[""]),[g,h]=y.useState("anthropic"),[x,v]=y.useState(e?.anthropicBaseUrl??""),[_,k]=y.useState(e?.openaiBaseUrl??""),[C,j]=y.useState(e?.apiDocsUrl??""),[z,E]=y.useState(e?.source),[A,O]=y.useState({}),[R,q]=y.useState(!1),[S,I]=y.useState(null),b=y.useRef([]);y.useEffect(()=>{if(S===null)return;const J=S;function ue(X){if(!(X.target instanceof Node))return;const ie=b.current[J];ie!=null&&!ie.contains(X.target)&&I(null)}return document.addEventListener("mousedown",ue),()=>document.removeEventListener("mousedown",ue)},[S]);const[P,H]=y.useState(!1),[L,B]=y.useState(!1),K=r.toLowerCase().includes("minimax"),se=r.toLowerCase().includes("alibaba");function U(){navigator.clipboard.writeText(s).catch(()=>{}),d(!0),setTimeout(()=>d(!1),2e3)}y.useEffect(()=>{e&&(o(e.name),i(e.apiKey),p((e.models?.length??0)>0?e.models:[""]),v(e.anthropicBaseUrl??""),k(e.openaiBaseUrl??""),j(e.apiDocsUrl??""),E(e.source),H(!1),B(!1))},[e]),y.useEffect(()=>{const J=r.toLowerCase();for(const[ue,X]of Object.entries(sk))if(J.includes(ue)){X.format==="anthropic"&&!P?v(X.baseUrl):X.format==="openai"&&!L&&k(X.baseUrl),X.apiDocsUrl!==void 0&&!C&&j(X.apiDocsUrl),ue==="minimax"&&m.length===1&&m[0]===""&&p([sa[0]??""]),ue==="alibaba"&&m.length===1&&m[0]===""&&p([ia[0]??""]);break}},[r]);function $(){const J={};return r.trim()||(J.name="Name is required"),s.trim()||(J.apiKey="API key is required"),(m.length===0||m.every(ue=>!ue.trim()))&&(J.models="At least one model is required"),x.trim()&&!oe(x.trim())&&(J.anthropicBaseUrl="Invalid URL format"),_.trim()&&!oe(_.trim())&&(J.openaiBaseUrl="Invalid URL format"),!x.trim()&&!_.trim()&&(J.format="At least one format URL (Anthropic or OpenAI) is required"),O(J),Object.keys(J).length===0}function oe(J){try{return new URL(J),!0}catch{return!1}}function ee(J){if(J.preventDefault(),!!$()){q(!0);try{t({name:r.trim(),apiKey:s.trim(),models:m.map(ue=>ue.trim()).filter(ue=>ue!==""),anthropicBaseUrl:x.trim()||void 0,openaiBaseUrl:_.trim()||void 0,apiDocsUrl:C.trim()||void 0,source:z})}finally{q(!1)}}}return a.jsxs("form",{onSubmit:ee,className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{htmlFor:"provider-name",className:"text-sm font-medium",children:["Name ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx("input",{id:"provider-name",type:"text",value:r,onChange:J=>o(J.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"}),A.name!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:A.name})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-source",className:"text-sm font-medium",children:"Token Source"}),a.jsxs("select",{id:"provider-source",value:z??"",onChange:J=>E(J.target.value==="company"||J.target.value==="personal"?J.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:[a.jsx("option",{value:"",children:"—"}),a.jsx("option",{value:"personal",children:"个人 (Personal)"}),a.jsx("option",{value:"company",children:"公司 (Company)"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Label whether this API key is company-provided or personal."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{htmlFor:"provider-apikey",className:"text-sm font-medium",children:["API Key ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{id:"provider-apikey",type:"text",value:l||s.length===0?s:Ju(s),onChange:J=>i(J.target.value),onFocus:()=>{!l&&s.length>0&&c(!0)},placeholder:"sk-ant-...",readOnly:!l&&s.length>0,className:"flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx("button",{type:"button",onClick:()=>c(J=>!J),className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":l?"Hide API key":"Show API key",children:l?a.jsx(es,{className:"size-4"}):a.jsx(ts,{className:"size-4"})}),a.jsx("button",{type:"button",onClick:U,className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":"Copy API key",children:u?a.jsx(Et,{className:"size-4 text-green-500"}):a.jsx(fn,{className:"size-4"})})]}),A.apiKey!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:A.apiKey})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{className:"text-sm font-medium",children:["Models ",a.jsx("span",{className:"text-destructive",children:"*"})]}),m.map((J,ue)=>a.jsxs("div",{ref:X=>{b.current[ue]=X},className:"flex items-center gap-2",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx("input",{type:"text",value:J,onChange:X=>{p(ie=>{const ae=[...ie];return ae[ue]=X.target.value,ae})},placeholder:K||se?"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"}),(K||se)&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>I(S===ue?null:ue),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:a.jsx(Mn,{className:"size-4"})}),S===ue&&a.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:(K?sa:ia).map(X=>a.jsx("button",{type:"button",onClick:()=>{p(ie=>{const ae=[...ie];return ae[ue]=X,ae}),I(null)},className:"w-full text-left px-3 py-2 text-sm hover:bg-muted transition-colors",children:X},X))})]})]}),m.length>1&&a.jsx("button",{type:"button",onClick:()=>p(X=>X.filter((ie,ae)=>ae!==ue)),className:"text-muted-foreground hover:text-destructive transition-colors p-1 shrink-0","aria-label":"Remove model",children:a.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:[a.jsx("path",{d:"M3 6h18"}),a.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),a.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]})})]},ue)),a.jsx("button",{type:"button",onClick:()=>p(J=>[...J,""]),className:"text-xs text-primary hover:underline flex items-center gap-1",children:"+ Add Model"}),A.models!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:A.models})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex gap-1 border-b border-border",children:[a.jsx($e,{children:a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>h("anthropic"),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${g==="anthropic"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Anthropic Format"})}),a.jsx(Ee,{children:"Anthropic Messages API protocol"})]})}),a.jsx($e,{children:a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>h("openai"),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${g==="openai"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"OpenAI Format"})}),a.jsx(Ee,{children:"OpenAI Chat Completions API protocol"})]})})]}),A.format!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:A.format})]}),g==="anthropic"&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-anthropic-base-url",className:"text-sm font-medium",children:"Anthropic Base URL"}),a.jsx("input",{id:"provider-anthropic-base-url",type:"text",value:x,onChange:J=>{H(!0),v(J.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"}),A.anthropicBaseUrl!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:A.anthropicBaseUrl}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Anthropic-compatible endpoint URL. Leave empty if this provider does not support Anthropic format."})]}),g==="openai"&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-openai-base-url",className:"text-sm font-medium",children:"OpenAI Base URL"}),a.jsx("input",{id:"provider-openai-base-url",type:"text",value:_,onChange:J=>{B(!0),k(J.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"}),A.openaiBaseUrl!==void 0&&a.jsx("p",{className:"text-xs text-destructive",children:A.openaiBaseUrl}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"OpenAI-compatible endpoint URL. Leave empty if this provider does not support OpenAI format."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"provider-api-docs-url",className:"text-sm font-medium",children:"API Docs URL"}),a.jsx("input",{id:"provider-api-docs-url",type:"text",value:C,onChange:J=>j(J.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"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional API documentation URL. If not set, uses known provider docs."})]}),a.jsxs("div",{className:"sticky bottom-0 bg-card border-t flex gap-2 justify-end pt-2 pb-2",children:[a.jsx(Me,{type:"button",variant:"outline",onClick:n,disabled:R,children:"Cancel"}),a.jsx(Me,{type:"submit",disabled:R,children:R?"Saving...":e?"Update Provider":"Add Provider"})]})]})}const $o=ne({id:Z(),name:Z(),apiKey:Z(),model:Z().optional(),models:Ne(Z()).min(1),format:Ve(["anthropic","openai"]).optional(),baseUrl:Z().optional(),anthropicBaseUrl:Z().optional(),openaiBaseUrl:Z().optional(),authHeader:Ve(["bearer","x-api-key"]).optional().default("bearer"),apiDocsUrl:Z().optional(),source:Ve(["company","personal"]).optional(),createdAt:Z(),updatedAt:Z()}),ak=Ve(["timeout","network_unreachable","connection_refused","auth_failed","rate_limited","server_error","invalid_response","unknown"]),lk=ne({message:Z(),type:ak,details:Z().optional(),hint:Z().optional()}),ck=ne({type:Ve(["text","thinking"]),text:Z().optional(),thinking:Z().optional()}),uk=ne({success:Be(),error:lk.optional(),model:Z().optional(),inputTokens:me().optional(),outputTokens:me().optional(),cacheCreationInputTokens:me().optional(),cacheReadInputTokens:me().optional(),latencyMs:me().optional(),content:Ne(ck).optional(),rawResponse:Z().optional(),streaming:Be().optional(),streamingChunks:ne({chunks:Ne(ol),truncated:Be().default(!1)}).optional(),requestHeaders:pt(Z(),Z()).optional()}),aa=xt([uk,ne({notConfigured:ve(!0)}),ne({testing:ve(!0)})]),kr=ne({nonStreaming:aa,streaming:aa}),dk=ne({anthropic:kr,openai:kr}),fk=ne({anthropic:kr,openai:kr,models:pt(Z(),dk).optional(),testedAt:Z().optional()});function hk(){return{anthropic:{nonStreaming:{testing:!0},streaming:{testing:!0}},openai:{nonStreaming:{testing:!0},streaming:{testing:!0}}}}function la(e,t){const n=()=>({nonStreaming:{success:!1,error:{message:e,type:t}},streaming:{notConfigured:!0}});return{anthropic:n(),openai:n()}}const pk=ne({providerConfig:Z()}),mk=ne({success:Be().optional(),imported:me().optional(),message:Z().optional(),errors:Ne(Z()).optional()}),gk=30,fo="Network error: could not reach the server. Is the proxy running?";function ca(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,source:e.source}}function xk({externalProviders:e,isLoading:t=!1,externalTestResults:n,externalTestingProviders:r,externalTestingTimeLeft:o,onProvidersMutate:s,onTestResultsChange:i,onTestingProvidersChange:l,onTestingTimeLeftChange:c}){const[u,d]=y.useState(!1),[f,m]=y.useState(),[p,g]=y.useState(null),[h,x]=y.useState({}),[v,_]=y.useState(new Set),[k,C]=y.useState({}),[j,z]=y.useState(null),[E,A]=y.useState(!1),[O,R]=y.useState(null),[q,S]=y.useState(!1),[I,b]=y.useState(!1),[P,H]=y.useState(null),[L,B]=y.useState("all"),K=y.useRef(null),se=y.useRef(null),U=e??[],$=y.useMemo(()=>{const F=L==="all"?U:U.filter(W=>W.source===L);return L==="all"?[...F].sort((W,M)=>{const Q={personal:0,company:1};return(Q[W.source??""]??2)-(Q[M.source??""]??2)}):F},[U,L]),oe=n??h,ee=r??v,J=o??k,ue=c?(F,W)=>c(F,W):(F,W)=>{C(W===void 0?M=>{const Q={...M};return delete Q[F],Q}:M=>({...M,[F]:W}))};y.useEffect(()=>{(async()=>{try{const F=await fetch("/api/config/paths");if(F.ok){const W=await Kt(F,pk);z(W.providerConfig)}}catch{}})()},[]);const X=y.useCallback(F=>{se.current!==null&&clearTimeout(se.current),R(F),K.current?.scrollTo({top:K.current.scrollHeight,behavior:"smooth"}),se.current=setTimeout(()=>{R(null),se.current=null},2e3)},[]);y.useEffect(()=>()=>{se.current!==null&&clearTimeout(se.current)},[]);const ie=y.useCallback(()=>{s?.().catch(()=>{})},[s]),ae=y.useCallback((F,W)=>{i?i(F,W):x(M=>({...M,[F]:W}))},[i]),he=y.useCallback((F,W)=>{if(l){l(F,W);return}_(M=>{const Q=new Set(M);return W?Q.add(F):Q.delete(F),Q})},[l]),fe=y.useCallback(async F=>{ae(F,hk()),he(F,!0);const W=new AbortController;let M=gk;ue(F,M);const Q=setInterval(()=>{M--,ue(F,M),M<=0&&(clearInterval(Q),W.abort())},1e3);try{const re=await fetch(`/api/providers/${F}/test`,{method:"POST",signal:W.signal});if(re.ok){const te=await Kt(re,fk);ae(F,te)}else ae(F,la(`HTTP ${re.status}: ${re.statusText}`,"server_error"))}catch(re){re instanceof Error&&re.name==="AbortError"&&ae(F,la("Request timed out","timeout"))}finally{clearInterval(Q),ue(F,void 0),he(F,!1)}},[ue,ae,he]);function we(F){(async()=>{try{const W=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ca(F))});if(!W.ok){g(await rr(W,"Failed to add provider"));return}const M=await Kt(W,$o);d(!1),X(M.id),ie(),await fe(M.id)}catch{g(fo)}})()}function Te(F){f&&(async()=>{try{const W=await fetch(`/api/providers/${f.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(ca(F))});if(!W.ok){g(await rr(W,"Failed to update provider"));return}const M=await Kt(W,$o);m(void 0),X(M.id),ie(),((F.apiKey??"")!==(f.apiKey??"")||JSON.stringify(F.models)!==JSON.stringify(f.models)||(F.anthropicBaseUrl??"")!==(f.anthropicBaseUrl??"")||(F.openaiBaseUrl??"")!==(f.openaiBaseUrl??""))&&await fe(M.id)}catch{g(fo)}})()}function w(F){H(F),b(!0)}function Y(){const F=P;F!==null&&(async()=>{let W;try{W=await fetch(`/api/providers/${F}`,{method:"DELETE"})}catch{g(fo);return}if(!W.ok){g(await rr(W,"Failed to delete provider"));return}ie()})()}const V=y.useRef(null);function T(F){const W="/api/providers/export";(async()=>{try{const M=await fetch(W);if(!M.ok){g("Failed to export providers");return}const Q=await M.blob(),re=URL.createObjectURL(Q),te=document.createElement("a");te.href=re,te.download=M.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]??"providers.json",document.body.appendChild(te),te.click(),document.body.removeChild(te),URL.revokeObjectURL(re)}catch{g("Failed to export providers")}})()}function N(){V.current?.click()}function D(F){const W=F.target.files?.[0];W&&(async()=>{try{const M=await W.text(),Q=await fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(M)}),re=await Kt(Q,mk);Q.ok&&re.imported!==void 0&&re.imported>0?(ie(),g(null)):re.errors&&re.errors.length>0?g(re.errors.join("; ")):g(re.message??"Import failed")}catch{g("Failed to import providers")}F.target.value=""})()}return t?a.jsx("div",{className:"flex items-center justify-center py-8",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading providers..."})}):u||f?a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"flex items-center justify-between sticky top-0 bg-background z-10 pb-2",children:a.jsx("h3",{className:"text-lg font-medium",children:f?"Edit Provider":"Add New Provider"})}),a.jsx(ik,{provider:f,onSubmit:f?Te:we,onCancel:()=>{d(!1),m(void 0)}})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between sticky top-0 z-10 bg-background pb-2",children:[a.jsx("h3",{className:"text-lg font-medium",children:"Providers"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx($e,{children:a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsxs(Me,{variant:"outline",size:"sm",onClick:()=>T(),className:"gap-1 hover:bg-muted",children:[a.jsx(Qo,{className:"size-3"}),"Export"]})}),a.jsx(Ee,{children:"Download providers as JSON for backup or sharing"})]})}),a.jsx($e,{children:a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsxs(Me,{variant:"outline",size:"sm",onClick:N,className:"gap-1 hover:bg-muted",children:[a.jsx(R0,{className:"size-3"}),"Import"]})}),a.jsx(Ee,{children:"Import providers from an exported JSON file"})]})}),a.jsx("input",{type:"file",ref:V,accept:".json",onChange:D,style:{display:"none"}}),a.jsx($e,{children:a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsxs(Me,{variant:"outline",size:"sm",onClick:()=>S(!0),className:"gap-1",children:[a.jsx(j0,{className:"size-3"}),"Scan"]})}),a.jsx(Ee,{children:"Detect and import provider configs from Claude Code and OpenCode"})]})}),a.jsxs(Me,{onClick:()=>d(!0),size:"sm",className:"gap-1",children:[a.jsx(yo,{className:"size-4"}),"Add Provider"]})]})]}),j!==null&&a.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/30 rounded-md px-3 py-2",children:[a.jsx("span",{className:"shrink-0",children:"Config:"}),a.jsx("span",{className:"font-mono truncate",title:j,children:j}),a.jsx($e,{children:a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>{window.navigator.clipboard.writeText(j).then(()=>{A(!0),setTimeout(()=>A(!1),2e3)})},className:"shrink-0 ml-auto text-muted-foreground hover:text-foreground transition-colors",children:E?a.jsx(Et,{className:"size-3 text-green-500"}):a.jsx(fn,{className:"size-3"})})}),a.jsx(Ee,{children:"Copy config file path to clipboard"})]})})]}),p!==null&&a.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive bg-destructive/10 rounded-md px-3 py-2",children:[a.jsx(An,{className:"size-4 shrink-0"}),p]}),U.length===0?a.jsxs("div",{className:"text-center py-12 space-y-3",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"No providers configured yet."}),a.jsxs(Me,{onClick:()=>d(!0),variant:"outline",size:"sm",children:[a.jsx(yo,{className:"size-4"}),"Add Your First Provider"]})]}):a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"flex gap-1 border-b border-border",children:["all","personal","company"].map(F=>a.jsx($e,{children:a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>B(F),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${L===F?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:F==="all"?"All":F==="personal"?"Personal":"Company"})}),a.jsx(Ee,{children:F==="all"?"Show all providers":F==="personal"?"Providers you configured yourself":"Providers set by your organization"})]})},F))}),a.jsx("div",{ref:K,className:"space-y-3",children:$.map(F=>a.jsx(ok,{provider:F,testResults:oe[F.id],isTesting:ee.has(F.id),testingTimeLeft:J[F.id],isHighlighted:F.id===O,onEdit:W=>m(W),onDelete:w,onTest:W=>{fe(W)}},F.id))})]}),a.jsx(X_,{open:q,onOpenChange:S,onImportComplete:()=>{s!==void 0&&s()}}),a.jsx(zu,{open:I,onOpenChange:b,title:"Delete Provider",description:"Are you sure you want to delete this provider? This action cannot be undone.",confirmLabel:"Delete",variant:"destructive",onConfirm:Y})]})}async function vk(e){return Pn(e,$o.array(),void 0,t=>`Failed to fetch ${e}: ${t.status}`)}function yk(){const e=Uo("/api/providers",vk,{revalidateOnFocus:!1,revalidateIfStale:!1});return{providers:e.data??[],isLoading:e.isLoading,isError:e.error,mutate:e.mutate}}function bk(){const[e,t]=y.useState(!1),[n,r]=y.useState("providers"),{providers:o,isLoading:s,mutate:i}=yk(),[l,c]=y.useState({}),[u,d]=y.useState(new Set),[f,m]=y.useState({}),p=y.useCallback((x,v)=>{c(_=>({..._,[x]:v}))},[]),g=y.useCallback((x,v)=>{d(_=>{const k=new Set(_);return v?k.add(x):k.delete(x),k})},[]),h=y.useCallback((x,v)=>{m(_=>{if(v===void 0){const k={..._};return delete k[x],k}return{..._,[x]:v}})},[]);return a.jsxs(ks,{open:e,onOpenChange:t,children:[a.jsx(x2,{asChild:!0,children:a.jsxs(Me,{variant:"ghost",size:"icon",className:"size-8",children:[a.jsx(A0,{className:"size-4"}),a.jsx("span",{className:"sr-only",children:"Settings"})]})}),a.jsxs(Cs,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[a.jsx(Ss,{children:a.jsx(js,{children:"Settings"})}),a.jsxs(Du,{value:n,onValueChange:r,className:"flex-1 overflow-hidden",children:[a.jsxs(Lu,{children:[a.jsx(dt,{value:"providers",children:"Providers"}),a.jsx(dt,{value:"proxy",children:"Proxy"})]}),a.jsxs("div",{className:"mt-4 overflow-y-auto flex-1 pr-3",children:[a.jsx(ft,{value:"providers",children:a.jsx(xk,{externalProviders:o,isLoading:s,externalTestResults:l,externalTestingProviders:u,externalTestingTimeLeft:f,onProvidersMutate:()=>i(),onTestResultsChange:p,onTestingProvidersChange:g,onTestingTimeLeftChange:h})}),a.jsx(ft,{value:"proxy",children:a.jsx(wk,{})})]})]})]})]})}function wk(){const{strip:e,slowResponseThresholdSeconds:t,isLoading:n,setStrip:r,setSlowResponseThresholdSeconds:o}=sl(),[s,i]=y.useState(null),[l,c]=y.useState(!1),u=y.useCallback(async f=>{i(null),c(!0);try{await r(f)}catch(m){i(m instanceof Error?m.message:String(m))}finally{c(!1)}},[r]),d=y.useCallback(async f=>{i(null),c(!0);try{await o(f)}catch(m){i(m instanceof Error?m.message:String(m))}finally{c(!1)}},[o]);return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("h3",{className:"text-sm font-semibold",children:"Claude Code billing header"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["When enabled, the proxy strips the synthetic ",a.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 ",a.jsx("code",{children:"LLM_INSPECTOR_STRIP_CLAUDE_CODE_BILLING_HEADER"})," environment variable; your choice is persisted to ",a.jsx("code",{children:"config.json"})," and overrides the env var for subsequent requests."]})]}),a.jsxs("label",{className:"flex items-center gap-3",children:[a.jsx("input",{type:"checkbox",role:"switch",checked:e,disabled:n||l,onChange:f=>{u(f.currentTarget.checked)},className:"size-4 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx("span",{className:"text-sm",children:n?"Loading…":e?"Stripping enabled":"Stripping disabled"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("label",{htmlFor:"slow-response-threshold",className:"text-sm font-semibold",children:"Slow response threshold"}),a.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 ",a.jsx("code",{children:"0"})," to disable the indicator."]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{id:"slow-response-threshold",type:"number",min:0,max:vo,step:1,value:t,disabled:n||l,onChange:f=>{const m=Number(f.currentTarget.value);Number.isInteger(m)&&(m<0||m>vo||d(m))},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"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"seconds"})]})]}),s!==null&&a.jsxs("p",{className:"text-xs text-destructive",children:["Failed to save: ",s]})]})}function _k(e){const t=new Map;for(const n of e){const r=n.logs;for(let o=1;o<r.length;o++){const s=r[o-1],i=r[o];s===void 0||i===void 0||t.set(i.id,{creation:ua(s.cacheCreationInputTokens,i.cacheCreationInputTokens),read:ua(s.cacheReadInputTokens,i.cacheReadInputTokens)})}}return t}function ua(e,t){return t===null||e===null?null:t>e?{direction:"up",delta:t-e}:t<e?{direction:"down",delta:e-t}:null}const Bo="data-nav-id",kk="data-nav-action";function da(e){return Array.from(e.querySelectorAll(`[${Bo}]`))}function fa(e){return e instanceof HTMLElement}function Ck(e,t){let n=e;for(;n!==null&&n!==t;){if(n.hasAttribute(Bo))return n;n=n.parentElement}return e.hasAttribute(Bo)?e:null}function ho(e){const t=e.getAttribute(kk);return t==="toggle"||t==="expand"||t==="collapse"?t:null}function Cn(e){e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",behavior:"smooth"})}function Sn(e,t){return e[t]??null}function Sk(e){const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||e.isContentEditable)}function jk(e,t){const n=t??e,r=y.useCallback(o=>{const s=e.current;if(!s)return;const i=o.target;if(!fa(i)||i!==n.current||!s.contains(i))return;const l=da(s),c=Sn(l,0);c!==null&&Cn(c)},[e,n]);y.useEffect(()=>{const o=n.current,s=e.current;if(!o||!s)return;const i=l=>{const c=l.target;if(!fa(c)||!s.contains(c)||Sk(c))return;const u=da(s);if(u.length===0)return;const d=Ck(c,s),f=d!==null?u.indexOf(d):-1;let m=!1;switch(l.key){case"ArrowUp":case"W":{if(l.key==="W"&&!l.shiftKey)break;l.preventDefault();const p=f>0?f-1:f===-1?u.length-1:-1;if(p!==-1){const g=Sn(u,p);g!==null&&Cn(g)}m=!0;break}case"ArrowDown":case"S":{if(l.key==="S"&&!l.shiftKey)break;l.preventDefault();const p=f<u.length-1?f+1:f===-1?0:-1;if(p!==-1){const g=Sn(u,p);g!==null&&Cn(g)}m=!0;break}case"ArrowLeft":case"A":{if(l.key==="A"&&!l.shiftKey||d===null)break;if(l.preventDefault(),ho(d)==="collapse")d.click();else if(f>0){const g=Sn(u,f-1);g!==null&&Cn(g)}m=!0;break}case"ArrowRight":case"D":{if(l.key==="D"&&!l.shiftKey||d===null)break;if(l.preventDefault(),ho(d)==="expand")d.click();else if(f<u.length-1){const g=Sn(u,f+1);g!==null&&Cn(g)}m=!0;break}case" ":{if(d===null)break;l.preventDefault(),ho(d)!==null&&d.click(),m=!0;break}}m&&l.stopPropagation()};return document.addEventListener("keydown",i,{capture:!0}),()=>document.removeEventListener("keydown",i,{capture:!0})},[e,n]),y.useEffect(()=>{const o=n.current;if(o)return o.addEventListener("focus",r),()=>o.removeEventListener("focus",r)},[r,n])}function lr(e){return e.length<=30?e:e.slice(0,12)+"…"+e.slice(-12)}function Ek(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 Nk(e){const t=e[0],n=e[e.length-1];if(t===void 0||n===void 0)return null;const r=o=>new Date(o).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"});return`${r(t.timestamp)} - ${r(n.timestamp)}`}function Tk(e){for(const t of e)if(t.userAgent!==null&&t.userAgent!==void 0&&t.userAgent!=="")return t.userAgent;return null}function Ak({command:e}){const[t,n]=y.useState(!1),r=y.useCallback(()=>{window.navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},[e]);return a.jsxs("div",{className:"inline-flex items-center gap-2 bg-muted rounded-md px-3 py-2",children:[a.jsx("pre",{className:"text-blue-500 font-mono text-sm m-0",children:e}),a.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?a.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:a.jsx("path",{d:"M20 6 9 17l-5-5"})}):a.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[a.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),a.jsx("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]})})]})}function zk(){return a.jsx($e,{children:a.jsxs(Se,{children:[a.jsx(je,{asChild:!0,children:a.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:[a.jsx("span",{className:"size-1.5 rounded-full bg-emerald-300 shadow-[0_0_8px_rgba(110,231,183,0.8)]"}),"MCP Ready",a.jsx("span",{className:"hidden text-cyan-200/70 sm:inline",children:"/api/mcp"})]})}),a.jsx(Ee,{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."})]})})}function Ok({sessionId:e,logs:t,totalIn:n,totalOut:r}){const[o,s]=y.useState(!1),i=y.useMemo(()=>Nk(t),[t]),l=y.useMemo(()=>Tk(t),[t]),c=y.useCallback(()=>{window.navigator.clipboard.writeText(window.location.href).then(()=>{s(!0),setTimeout(()=>s(!1),2e3)})},[]);return a.jsxs("div",{className:"mb-4 flex items-center gap-3 border border-border rounded-md bg-muted/20 px-3 py-2 text-xs",children:[a.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:a.jsx(zg,{className:"size-3.5"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[a.jsx("span",{className:"font-mono font-semibold text-purple-400/90 truncate",title:e,children:lr(e)}),l!==null&&a.jsx("span",{className:"font-mono text-muted-foreground truncate max-w-[220px]",title:l,children:l})]}),a.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-muted-foreground",children:[a.jsxs("span",{children:[t.length," request",t.length!==1?"s":""]}),i!==null&&a.jsx("span",{children:i}),(n>0||r>0)&&a.jsxs("span",{className:"font-mono",children:[Je(n)," in / ",Je(r)," out"]})]})]}),a.jsx("button",{type:"button",onClick:c,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":o?"Copied session link":"Copy session link",title:o?"Copied session link":"Copy session link",children:o?a.jsx(Et,{className:"size-3.5"}):a.jsx(fn,{className:"size-3.5"})})]})}function Ik({logs:e,sessions:t,models:n,selectedSession:r,selectedModel:o,onSessionChange:s,onModelChange:i,onClearAll:l,onClearGroup:c,viewMode:u,onViewModeChange:d,strip:f,slowResponseThresholdSeconds:m,hideSessionFilter:p=!1,pinnedSessionId:g}){const{totalIn:h,totalOut:x}=y.useMemo(()=>Ek(e),[e]),[v,_]=y.useState(!1),[k,C]=y.useState(null),[j,z]=y.useState("hidden"),E=y.useRef(null),A=y.useRef(null);jk(E,A),y.useEffect(()=>{const L=50+In.length*400,B=setTimeout(()=>z("playing"),50),K=setTimeout(()=>z("done"),L);return()=>{clearTimeout(B),clearTimeout(K)}},[]),y.useEffect(()=>{if(g===void 0){document.title="LLM Inspector";return}const P=e.length===1?"1 req":`${e.length} req`;document.title=`${lr(g)} - ${P} - LLM Inspector`},[e.length,g]);const O=y.useCallback(async()=>{_(!0);try{await X0(e)}finally{_(!1)}},[e]);y.useEffect(()=>{C(null)},[r,o]);const R=y.useCallback(()=>{C(null)},[]),q=y.useMemo(()=>j2(e),[e]),S=y.useMemo(()=>_k(q),[q]),I=y.useMemo(()=>M_(q),[q]),b=y.useCallback(P=>{const H=I.get(P.id);H!==void 0&&C([H,P])},[I]);return a.jsxs("div",{className:"max-w-[1400px] xl:max-w-[1600px] 2xl:max-w-[1800px] mx-auto px-6 pb-6",children:[a.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] items-start gap-3 pt-6 pb-8",children:[a.jsx("div",{}),a.jsxs("h1",{className:"flex min-w-0 flex-col items-center gap-2 text-center",children:[a.jsxs("span",{className:"flex max-w-[calc(100vw-7rem)] items-end gap-2 whitespace-nowrap",children:[a.jsxs("span",{className:"flex shrink-0 items-end gap-1 group cursor-default","aria-hidden":"true",children:[a.jsx($_,{className:"size-10 text-amber-500 transition-all duration-300 group-hover:scale-125 group-hover:-translate-y-1.5"}),a.jsx("span",{className:"hidden items-end gap-0.5 sm:flex",children:In.map((P,H)=>{const L=["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"][H],B=j==="hidden"?"opacity-0 scale-0":j==="playing"?"animate-crab-piano-pop":"";return a.jsx(P,{className:`size-5 ${L} transition-all duration-300 ease-out group-hover:scale-125 group-hover:-translate-y-1 ${B}`,style:{transitionDelay:`${H*50}ms`,...j==="playing"?{animationDelay:`${H*400}ms`}:{}}},H)})})]}),a.jsxs("span",{className:"flex min-w-0 items-baseline gap-2 pl-1",children:[a.jsx("span",{className:"truncate text-lg font-bold",children:"LLM Inspector"}),a.jsxs("span",{className:"shrink-0 font-mono text-xs font-semibold text-muted-foreground",children:["v",Zx.version]})]}),a.jsx(yo,{className:"size-4 shrink-0 text-muted-foreground/70","aria-hidden":"true"}),a.jsx(U_,{className:"size-10 shrink-0"})]}),a.jsx(zk,{})]}),a.jsx("div",{className:"justify-self-end",children:a.jsx(bk,{})})]}),g!==void 0&&a.jsx(Ok,{sessionId:g,logs:e,totalIn:h,totalOut:x}),a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[!p&&a.jsxs(ta,{value:r,onValueChange:s,children:[a.jsx(ra,{className:"flex-1 max-w-[350px] text-xs",children:a.jsx(na,{placeholder:"All sessions"})}),a.jsxs(oa,{children:[a.jsx(tr,{value:"__all__",children:"All sessions"}),t.map(P=>a.jsx(tr,{value:P,children:lr(P)},P))]})]}),a.jsxs(ta,{value:o,onValueChange:i,children:[a.jsx(ra,{className:"flex-1 max-w-[250px] text-xs",children:a.jsx(na,{placeholder:"All models"})}),a.jsxs(oa,{children:[a.jsx(tr,{value:"__all__",children:"All models"}),n.map(P=>a.jsx(tr,{value:P,children:P},P))]})]}),a.jsxs("div",{className:"flex items-center border border-border rounded-md overflow-hidden",children:[a.jsx("button",{type:"button",onClick:()=>d("simple"),className:`h-8 px-3 cursor-pointer transition-colors text-xs ${u==="simple"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Simple"}),a.jsx("button",{type:"button",onClick:()=>d("full"),className:`h-8 px-3 cursor-pointer transition-colors text-xs ${u==="full"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Full"})]}),a.jsx("div",{className:"flex-1"}),a.jsxs("span",{className:"text-muted-foreground text-xs font-mono",children:[e.length," request",e.length!==1?"s":"",h>0||x>0?` · ${Je(h)} in / ${Je(x)} out`:""]}),e.length>0&&a.jsx("button",{type:"button",onClick:()=>{O()},disabled:v,className:"h-8 px-3 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center gap-1.5 rounded-md hover:bg-muted",title:"Export all logs as JSON ZIP",children:v?a.jsx("span",{children:"Exporting..."}):a.jsxs(a.Fragment,{children:[a.jsx(Qo,{className:"size-3.5"}),a.jsx("span",{children:"Export"})]})}),a.jsx("button",{type:"button",onClick:l,className:"h-8 px-3 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer rounded-md hover:bg-muted",title:"Clear all logs",children:"Clear"})]}),a.jsx("div",{children:e.length===0?r!=="__all__"?a.jsxs("div",{className:"text-center text-muted-foreground py-16 space-y-4",children:[a.jsx("p",{className:"text-sm font-medium",children:"Session not found"}),a.jsx("p",{className:"text-xs font-mono bg-muted px-3 py-1 rounded inline-block max-w-[500px] break-all",children:lr(r)}),a.jsxs("p",{className:"text-xs",children:["This session may have been cleared or never existed."," ",p?a.jsx("a",{href:"/",className:"underline hover:text-foreground transition-colors",children:"Back to all sessions"}):a.jsx("button",{type:"button",onClick:()=>s("__all__"),className:"underline hover:text-foreground transition-colors",children:"Show all sessions"})]})]}):a.jsxs("div",{className:"text-center text-muted-foreground py-16 space-y-4",children:[a.jsx("p",{className:"text-sm",children:"No requests captured yet."}),a.jsx("p",{className:"text-xs",children:"Route AI coding tools through the proxy:"}),a.jsx(Ak,{command:"LLM_BASE_URL=http://localhost:25947/proxy <your-tool>"})]}):a.jsx("div",{ref:A,tabIndex:0,className:"flex flex-col gap-2 focus:outline-none",children:a.jsx("div",{ref:E,children:q.map(P=>a.jsx(F_,{group:P,viewMode:u,strip:f,slowResponseThresholdSeconds:m,cacheTrends:S,onCompareWithPrevious:b,comparisonPredecessors:I,onClearGroup:c,standalone:q.length===1},P.id))})})}),k!==null&&a.jsx(y.Suspense,{fallback:null,children:a.jsx(dw,{left:k[0],right:k[1],onClose:R})})]})}const Rk=xt([ne({type:ve("init"),logs:Ne(ei)}),ne({type:ve("update"),log:ei})]);function Pk(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function Mk(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function Dk(e,t,n){return t==="__all__"&&n==="__all__"?e:e.filter(r=>!(t!=="__all__"&&r.sessionId!==t||n!=="__all__"&&r.model!==n))}const Lk=50;function Fk(e){return e===void 0?"/api/logs/stream":`/api/logs/stream?${new URLSearchParams({sessionId:e}).toString()}`}function Uk({initialSessionId:e}={}){const[t,n]=y.useState([]),[r,o]=y.useState(e??"__all__"),[s,i]=y.useState("__all__"),[l,c]=y.useState("simple"),[u,d]=y.useState(null),f=y.useRef(null),m=y.useRef(null),p=y.useRef(new Map),g=y.useRef([]),h=y.useRef(null),x=y.useMemo(()=>Dk(t,r,s),[t,r,s]),v=y.useMemo(()=>Pk(t),[t]),_=y.useMemo(()=>Mk(t),[t]),k=y.useCallback(()=>{h.current=null;const R=g.current;g.current=[],R.length!==0&&n(q=>{let S=q;for(const I of R){const b=p.current.get(I.id);b!==void 0?S=[...S.slice(0,b),I,...S.slice(b+1)]:(p.current.set(I.id,S.length),S=[...S,I])}return S})},[]),C=y.useCallback(R=>{g.current.push(R),h.current===null&&(h.current=setTimeout(k,Lk))},[k]),j=y.useCallback(()=>{f.current&&f.current.close();const R=new EventSource(Fk(e));f.current=R,R.onmessage=q=>{try{const S=String(q.data),I=JSON.parse(S),b=Rk.safeParse(I);if(!b.success){d("Failed to parse SSE data");return}const P=b.data;if(P.type==="init"){h.current!==null&&(clearTimeout(h.current),h.current=null),g.current=[];const H=new Map;for(let L=0;L<P.logs.length;L++){const B=P.logs[L];B!==void 0&&H.set(B.id,L)}p.current=H,n(P.logs),d(null)}else P.type==="update"&&C(P.log)}catch{d("Failed to parse SSE data")}},R.onerror=()=>{d("SSE connection lost, reconnecting..."),R.close(),m.current!==null&&clearTimeout(m.current),m.current=setTimeout(j,3e3)}},[e,C]);y.useEffect(()=>(j(),()=>{f.current&&(f.current.close(),f.current=null),m.current!==null&&(clearTimeout(m.current),m.current=null),h.current!==null&&(clearTimeout(h.current),h.current=null)}),[j]);const z=y.useCallback(()=>{e!==void 0&&t.length===0||(async()=>{try{const R=e===void 0?void 0:JSON.stringify({ids:t.map(S=>S.id)});if(!(await fetch("/api/logs",{method:"DELETE",...R===void 0?{}:{headers:{"Content-Type":"application/json"},body:R}})).ok){d("Failed to clear logs");return}p.current.clear(),n([]),d(null)}catch(R){d(R instanceof Error?R.message:"Unknown error clearing logs")}})()},[t,e]),E=y.useCallback(R=>{R.length!==0&&(async()=>{try{if(!(await fetch("/api/logs",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:R})})).ok){d("Failed to clear group");return}const S=new Set(R);n(I=>{const b=I.filter(H=>!S.has(H.id)),P=new Map;for(let H=0;H<b.length;H++){const L=b[H];L!==void 0&&P.set(L.id,H)}return p.current=P,b}),d(null)}catch(q){d(q instanceof Error?q.message:"Unknown error clearing group")}})()},[]),{strip:A,slowResponseThresholdSeconds:O}=sl();return a.jsxs(a.Fragment,{children:[u!==null&&a.jsx("div",{className:"fixed top-4 right-4 bg-destructive text-destructive-foreground px-4 py-2 rounded-md text-sm z-50",children:u}),a.jsx(q0,{}),a.jsx(Ik,{logs:x,sessions:v,models:_,selectedSession:r,selectedModel:s,onSessionChange:o,onModelChange:i,onClearAll:z,onClearGroup:E,viewMode:l,onViewModeChange:c,strip:A,slowResponseThresholdSeconds:O,hideSessionFilter:e!==void 0,pinnedSessionId:e})]})}export{al as $,Z as A,Au as B,Jg as C,ks as D,ln as E,Ce as F,ht as G,ye as H,Bt as I,Ie as J,Ue as K,$t as L,f0 as M,ss as N,_t as O,Uk as P,Mi as Q,C0 as R,Mn as S,Du as T,Mo as U,bo as V,Bx as W,pl as X,hr as Y,ns as Z,cw as _,S2 as a,xe as b,ge as c,yo as d,g0 as e,Je as f,E_ as g,Xo as h,Et as i,fn as j,Cs as k,Ss as l,js as m,w0 as n,Lu as o,dt as p,ft as q,Fo as r,$e as s,Se as t,je as u,Ee as v,Me as w,ne as x,Be as y,me as z};
|