@tonyclaw/llm-inspector 1.18.0 → 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-C-4ypEWs.js +1 -0
- package/.output/public/assets/ProxyViewerContainer-WRenRpeh.js +101 -0
- package/.output/public/assets/ReplayDialog-CyBKOgba.js +1 -0
- package/.output/public/assets/RequestAnatomy-C0IrVQ3q.js +1 -0
- package/.output/public/assets/ResponseView-MogToC4i.js +1 -0
- package/.output/public/assets/StreamingChunkSequence-ClhUhT-s.js +1 -0
- 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-D-z1r1Pp.js → json-viewer-BicGakI5.js} +1 -1
- package/.output/public/assets/{main-CZJ63sQh.js → main-Be2qqUUW.js} +8 -7
- package/.output/server/_libs/lucide-react.mjs +23 -17
- package/.output/server/_sessionId-DhKJIdQC.mjs +122 -0
- package/.output/server/_ssr/{CompareDrawer-BJr-913n.mjs → CompareDrawer-BGUgukJ8.mjs} +57 -57
- package/.output/server/_ssr/{index-C7I_Qgt0.mjs → ProxyViewerContainer--3K3o3Sm.mjs} +277 -191
- package/.output/server/_ssr/{ReplayDialog-BwmToGuR.mjs → ReplayDialog-Bo86xZI4.mjs} +57 -57
- package/.output/server/_ssr/{RequestAnatomy-BmMiPRPB.mjs → RequestAnatomy-jRU5qgwB.mjs} +4 -4
- package/.output/server/_ssr/{ResponseView-ZB9-8Raw.mjs → ResponseView-DdO_-79a.mjs} +5 -5
- package/.output/server/_ssr/{StreamingChunkSequence-DWm4CQWC.mjs → StreamingChunkSequence-BigLwhh4.mjs} +57 -57
- package/.output/server/_ssr/index-BHG6vOnr.mjs +117 -0
- package/.output/server/_ssr/index.mjs +2 -2
- package/.output/server/_ssr/{json-viewer-D9XETzwp.mjs → json-viewer-B4c_WjXD.mjs} +4 -4
- package/.output/server/_ssr/{router-711KpGkz.mjs → router-DVixpJO-.mjs} +79 -22
- package/.output/server/_tanstack-start-manifest_v-BbvWUF4v.mjs +4 -0
- package/.output/server/index.mjs +70 -56
- package/README.md +109 -59
- package/package.json +1 -1
- package/src/assets/logos/mcp.png +0 -0
- package/src/components/ProxyViewer.tsx +240 -64
- package/src/components/ProxyViewerContainer.tsx +42 -11
- package/src/components/proxy-viewer/ConversationGroup.tsx +1 -8
- package/src/components/proxy-viewer/ConversationHeader.tsx +35 -7
- package/src/components/ui/mcp-logo.tsx +20 -0
- package/src/lib/sessionUrl.ts +44 -0
- package/src/routes/session/$sessionId.tsx +23 -0
- package/.output/public/assets/CompareDrawer-BpwZCB6M.js +0 -1
- package/.output/public/assets/ReplayDialog-Clratkzl.js +0 -1
- package/.output/public/assets/RequestAnatomy-EtiX0r_G.js +0 -1
- package/.output/public/assets/ResponseView-CJqxo-EN.js +0 -1
- package/.output/public/assets/StreamingChunkSequence-BIbRqQiV.js +0 -1
- package/.output/public/assets/index-B-0F9n1w.js +0 -101
- package/.output/public/assets/index-DoGvsnbA.css +0 -1
- package/.output/server/_tanstack-start-manifest_v-noQw0Vmw.mjs +0 -4
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CompareDrawer-BpwZCB6M.js","assets/main-CZJ63sQh.js","assets/json-viewer-D-z1r1Pp.js","assets/ReplayDialog-Clratkzl.js","assets/ResponseView-CJqxo-EN.js","assets/RequestAnatomy-EtiX0r_G.js","assets/StreamingChunkSequence-BIbRqQiV.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{u as $o,a as fa,r as v,j as a,c as Un,g as Gu,b as In,R as We,d as ha,e as Yu,_ as Mt}from"./main-CZJ63sQh.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 pa extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const ma={};function bt(e){return ma}function ga(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 ho(e,t){return typeof t=="bigint"?t.toString():t}function kr(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Bo(e){return e==null}function Uo(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Xu(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 Ts=Symbol("evaluating");function _e(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ts)return r===void 0&&(r=Ts,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Dt(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ct(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function As(e){return JSON.stringify(e)}function Qu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const xa="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function En(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const ed=kr(()=>{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(En(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(En(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function va(e){return nn(e)?{...e}:Array.isArray(e)?[...e]:e}const td=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 nd(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const rd={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 od(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=Ct(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 Dt(this,"shape",i),i},checks:[]});return jt(e,s)}function sd(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=Ct(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 Dt(this,"shape",i),i},checks:[]});return jt(e,s)}function id(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=Ct(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return Dt(this,"shape",s),s}});return jt(e,o)}function ad(e,t){if(!nn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Ct(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return Dt(this,"shape",r),r}});return jt(e,n)}function ld(e,t){const n=Ct(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return Dt(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return jt(e,n)}function cd(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=Ct(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 Dt(this,"shape",c),c},checks:[]});return jt(t,i)}function ud(e,t,n){const r=Ct(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 Dt(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 Zo(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Nn(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const ya=(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,ho,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ba=G("$ZodError",ya),wa=G("$ZodError",ya,{Parent:Error});function dd(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 fd(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 Wo=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 xa(l,o?.callee),l}return i.value},Vo=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 xa(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??ba)(s.issues.map(i=>wt(i,o,bt())))}:{success:!0,data:s.value}},hd=Sr(wa),Cr=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}},pd=Cr(wa),md=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Wo(e)(t,n,o)},gd=e=>(t,n,r)=>Wo(e)(t,n,r),xd=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Vo(e)(t,n,o)},vd=e=>async(t,n,r)=>Vo(e)(t,n,r),yd=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Sr(e)(t,n,o)},bd=e=>(t,n,r)=>Sr(e)(t,n,r),wd=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Cr(e)(t,n,o)},_d=e=>async(t,n,r)=>Cr(e)(t,n,r),kd=/^[cC][^\s-]{8,}$/,Sd=/^[0-9a-z]+$/,Cd=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,jd=/^[0-9a-vA-V]{20}$/,Ed=/^[A-Za-z0-9]{27}$/,Nd=/^[a-zA-Z0-9_-]{21}$/,Td=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ad=/^([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})$/,zs=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)$/,zd=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Od="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Id(){return new RegExp(Od,"u")}const Rd=/^(?:(?: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])$/,Pd=/^(([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}|:))$/,Md=/^((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])$/,Dd=/^(([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])$/,Ld=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_a=/^[A-Za-z0-9_-]*$/,Fd=/^\+[1-9]\d{6,14}$/,ka="(?:(?:\\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])))",$d=new RegExp(`^${ka}$`);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 Bd(e){return new RegExp(`^${Sa(e)}$`)}function Ud(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(`^${ka}T(?:${r})$`)}const Zd=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Wd=/^-?\d+$/,Ca=/^-?\d+(?:\.\d+)?$/,Vd=/^(?:true|false)$/i,Hd=/^null$/i,qd=/^[^A-Z]*$/,Kd=/^[^a-z]*$/,He=G("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ja={number:"number",bigint:"bigint",object:"date"},Ea=G("$ZodCheckLessThan",(e,t)=>{He.init(e,t);const n=ja[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})}}),Na=G("$ZodCheckGreaterThan",(e,t)=>{He.init(e,t);const n=ja[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})}}),Jd=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):Xu(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})}}),Gd=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]=rd[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=Wd)}),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})}}),Yd=G("$ZodCheckMaxLength",(e,t)=>{var n;He.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Bo(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=Zo(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Xd=G("$ZodCheckMinLength",(e,t)=>{var n;He.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Bo(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=Zo(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Qd=G("$ZodCheckLengthEquals",(e,t)=>{var n;He.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Bo(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=Zo(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})}}),jr=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=()=>{})}),ef=G("$ZodCheckRegex",(e,t)=>{jr.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})}}),tf=G("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=qd),jr.init(e,t)}),nf=G("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Kd),jr.init(e,t)}),rf=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})}}),of=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})}}),sf=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})}}),af=G("$ZodCheckOverwrite",(e,t)=>{He.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class lf{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 cf={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=cf;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,h=f._zod.check(i);if(h instanceof Promise&&c?.async===!1)throw new Xt;if(d||h instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await h,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=hd(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return pd(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Ho=G("$ZodString",(e,t)=>{ze.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Zd(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)=>{jr.init(e,t),Ho.init(e,t)}),uf=G("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ad),Re.init(e,t)}),df=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=zs(r))}else t.pattern??(t.pattern=zs());Re.init(e,t)}),ff=G("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=zd),Re.init(e,t)}),hf=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})}}}),pf=G("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Id()),Re.init(e,t)}),mf=G("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Nd),Re.init(e,t)}),gf=G("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=kd),Re.init(e,t)}),xf=G("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Sd),Re.init(e,t)}),vf=G("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Cd),Re.init(e,t)}),yf=G("$ZodXID",(e,t)=>{t.pattern??(t.pattern=jd),Re.init(e,t)}),bf=G("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ed),Re.init(e,t)}),wf=G("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ud(t)),Re.init(e,t)}),_f=G("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=$d),Re.init(e,t)}),kf=G("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Bd(t)),Re.init(e,t)}),Sf=G("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Td),Re.init(e,t)}),Cf=G("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Rd),Re.init(e,t),e._zod.bag.format="ipv4"}),jf=G("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Pd),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})}}}),Ef=G("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Md),Re.init(e,t)}),Nf=G("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Dd),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 Ta(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Tf=G("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ld),Re.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Ta(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Af(e){if(!_a.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Ta(n)}const zf=G("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=_a),Re.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Af(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Of=G("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Fd),Re.init(e,t)});function If(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 Rf=G("$ZodJWT",(e,t)=>{Re.init(e,t),e._zod.check=n=>{If(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Aa=G("$ZodNumber",(e,t)=>{ze.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ca,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}}),Pf=G("$ZodNumberFormat",(e,t)=>{Gd.init(e,t),Aa.init(e,t)}),Mf=G("$ZodBoolean",(e,t)=>{ze.init(e,t),e._zod.pattern=Vd,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}}),Df=G("$ZodNull",(e,t)=>{ze.init(e,t),e._zod.pattern=Hd,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}}),Lf=G("$ZodUnknown",(e,t)=>{ze.init(e,t),e._zod.parse=n=>n}),Ff=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 Os(e,t,n){e.issues.length&&t.issues.push(...Yt(n,e.issues)),t.value[n]=e.value}const $f=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=>Os(u,n,i))):Os(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function lr(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 za(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=nd(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Oa(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(h=>lr(h,n,f,t,d))):lr(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 Bf=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=kr(()=>za(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=En,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 h=f[m],g=h._zod.optout==="optional",p=h._zod.run({value:u[m],issues:[]},c);p instanceof Promise?d.push(p.then(x=>lr(x,l,m,u,g))):lr(p,l,m,u,g)}return s?Oa(d,u,l,c,r.value,e):d.length?Promise.all(d).then(()=>l):l}}),Uf=G("$ZodObjectJIT",(e,t)=>{Bf.init(e,t);const n=e._zod.parse,r=kr(()=>za(t)),o=m=>{const h=new lf(["shape","payload","ctx"]),g=r.value,p=k=>{const S=As(k);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};h.write("const input = payload.value;");const x=Object.create(null);let y=0;for(const k of g.keys)x[k]=`key_${y++}`;h.write("const newResult = {};");for(const k of g.keys){const S=x[k],j=As(k),N=m[k]?._zod?.optout==="optional";h.write(`const ${S} = ${p(k)};`),N?h.write(`
|
|
5
|
-
if (${S}.issues.length) {
|
|
6
|
-
if (${j} in input) {
|
|
7
|
-
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
8
|
-
...iss,
|
|
9
|
-
path: iss.path ? [${j}, ...iss.path] : [${j}]
|
|
10
|
-
})));
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (${S}.value === undefined) {
|
|
15
|
-
if (${j} in input) {
|
|
16
|
-
newResult[${j}] = undefined;
|
|
17
|
-
}
|
|
18
|
-
} else {
|
|
19
|
-
newResult[${j}] = ${S}.value;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
`):h.write(`
|
|
23
|
-
if (${S}.issues.length) {
|
|
24
|
-
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
25
|
-
...iss,
|
|
26
|
-
path: iss.path ? [${j}, ...iss.path] : [${j}]
|
|
27
|
-
})));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (${S}.value === undefined) {
|
|
31
|
-
if (${j} in input) {
|
|
32
|
-
newResult[${j}] = undefined;
|
|
33
|
-
}
|
|
34
|
-
} else {
|
|
35
|
-
newResult[${j}] = ${S}.value;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
`)}h.write("payload.value = newResult;"),h.write("return payload;");const _=h.compile();return(k,S)=>_(m,k,S)};let s;const i=En,l=!ma.jitless,u=l&&ed.value,d=t.catchall;let f;e._zod.parse=(m,h)=>{f??(f=r.value);const g=m.value;return i(g)?l&&u&&h?.async===!1&&h.jitless!==!0?(s||(s=o(t.shape)),m=s(m,h),d?Oa([],g,m,h,f,e):m):n(m,h):(m.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),m)}});function Is(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 Ia=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=>Uo(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=>Is(c,o,e,s)):Is(l,o,e,s)}}),Zf=G("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ia.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=kr(()=>{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(!En(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)}}),Wf=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])=>Rs(n,c,u)):Rs(n,s,i)}});function po(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=po(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=po(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 Rs(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=po(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 Vf=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"&&Ca.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}}),Hf=G("$ZodEnum",(e,t)=>{ze.init(e,t);const n=ga(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>td.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}}),qf=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}}),Kf=G("$ZodTransform",(e,t)=>{ze.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new pa(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 Ps(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Ra=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(`^(${Uo(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=>Ps(s,n.value)):Ps(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Jf=G("$ZodExactOptional",(e,t)=>{Ra.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)}),Gf=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(`^(${Uo(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)}),Yf=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=>Ms(s,t)):Ms(o,t)}});function Ms(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Xf=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))}),Qf=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=>Ds(s,e)):Ds(o,e)}});function Ds(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 eh=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)}}),th=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 nh=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(Ls):Ls(o)}});function Ls(e){return e.value=Object.freeze(e.value),e}const rh=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)}),oh=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=>Fs(s,n,r,e));Fs(o,n,r,e)}});function Fs(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(Nn(o))}}var $s;class sh{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 ih(){return new sh}($s=globalThis).__zod_globalRegistry??($s.__zod_globalRegistry=ih());const Cn=globalThis.__zod_globalRegistry;function ah(e,t){return new e({type:"string",...de(t)})}function lh(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...de(t)})}function Bs(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...de(t)})}function ch(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...de(t)})}function uh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...de(t)})}function dh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...de(t)})}function fh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...de(t)})}function hh(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...de(t)})}function ph(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...de(t)})}function mh(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...de(t)})}function gh(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...de(t)})}function xh(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...de(t)})}function vh(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...de(t)})}function yh(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...de(t)})}function bh(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...de(t)})}function wh(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...de(t)})}function _h(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...de(t)})}function kh(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...de(t)})}function Sh(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...de(t)})}function Ch(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...de(t)})}function jh(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...de(t)})}function Eh(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...de(t)})}function Nh(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...de(t)})}function Th(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...de(t)})}function Ah(e,t){return new e({type:"string",format:"date",check:"string_format",...de(t)})}function zh(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...de(t)})}function Oh(e,t){return new e({type:"string",format:"duration",check:"string_format",...de(t)})}function Ih(e,t){return new e({type:"number",checks:[],...de(t)})}function Rh(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...de(t)})}function Ph(e,t){return new e({type:"boolean",...de(t)})}function Mh(e,t){return new e({type:"null",...de(t)})}function Dh(e){return new e({type:"unknown"})}function Lh(e,t){return new e({type:"never",...de(t)})}function Us(e,t){return new Ea({check:"less_than",...de(t),value:e,inclusive:!1})}function Wr(e,t){return new Ea({check:"less_than",...de(t),value:e,inclusive:!0})}function Zs(e,t){return new Na({check:"greater_than",...de(t),value:e,inclusive:!1})}function Vr(e,t){return new Na({check:"greater_than",...de(t),value:e,inclusive:!0})}function Ws(e,t){return new Jd({check:"multiple_of",...de(t),value:e})}function Pa(e,t){return new Yd({check:"max_length",...de(t),maximum:e})}function cr(e,t){return new Xd({check:"min_length",...de(t),minimum:e})}function Ma(e,t){return new Qd({check:"length_equals",...de(t),length:e})}function Fh(e,t){return new ef({check:"string_format",format:"regex",...de(t),pattern:e})}function $h(e){return new tf({check:"string_format",format:"lowercase",...de(e)})}function Bh(e){return new nf({check:"string_format",format:"uppercase",...de(e)})}function Uh(e,t){return new rf({check:"string_format",format:"includes",...de(t),includes:e})}function Zh(e,t){return new of({check:"string_format",format:"starts_with",...de(t),prefix:e})}function Wh(e,t){return new sf({check:"string_format",format:"ends_with",...de(t),suffix:e})}function dn(e){return new af({check:"overwrite",tx:e})}function Vh(e){return dn(t=>t.normalize(e))}function Hh(){return dn(e=>e.trim())}function qh(){return dn(e=>e.toLowerCase())}function Kh(){return dn(e=>e.toUpperCase())}function Jh(){return dn(e=>Qu(e))}function Gh(e,t,n){return new e({type:"array",element:t,...de(n)})}function Yh(e,t,n){return new e({type:"custom",check:"custom",fn:t,...de(n)})}function Xh(e){const t=Qh(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Nn(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(Nn(o))}},e(n.value,n)));return t}function Qh(e,t){const n=new He({check:"custom",...de(t)});return n._zod.check=e,n}function Da(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??Cn,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,h=t.processors[o.type];if(!h)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);h(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 La(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 h=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=h,{defId:h,ref:`${m("__shared")}#/${l}/${h}`}}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 Fa(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),h=m.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(h)):Object.assign(c,h),Object.assign(c,u),i._zod.parent===d)for(const p in c)p==="$ref"||p==="allOf"||p in u||delete c[p];if(h.$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]}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 h in c)h==="$ref"||h==="allOf"||h in m.def&&JSON.stringify(c[h])===JSON.stringify(m.def[h])&&delete c[h]}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:ur(t,"input",e.processors),output:ur(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 ep=(e,t={})=>n=>{const r=Da({...n,processors:t});return Le(e,r),La(r,e),Fa(r,e)},ur=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=Da({...o??{},target:s,io:t,processors:n});return Le(e,i),La(i,e),Fa(i,e)},tp={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},np=(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=tp[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}))])}},rp=(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)},op=(e,t,n,r)=>{n.type="boolean"},sp=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},ip=(e,t,n,r)=>{n.not={}},ap=(e,t,n,r)=>{},lp=(e,t,n,r)=>{const o=e._zod.def,s=ga(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},cp=(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},up=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},dp=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},fp=(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"]})},hp=(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)},pp=(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},mp=(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},gp=(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)}},xp=(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"}]},vp=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},yp=(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))},bp=(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)))},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;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},_p=(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},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,n.readOnly=!0},$a=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},Sp=(e,t,n,r)=>{const o=e._zod.innerType;Le(o,t,r);const s=t.seen.get(e);s.ref=o},Cp=G("ZodISODateTime",(e,t)=>{wf.init(e,t),Pe.init(e,t)});function jp(e){return Th(Cp,e)}const Ep=G("ZodISODate",(e,t)=>{_f.init(e,t),Pe.init(e,t)});function Np(e){return Ah(Ep,e)}const Tp=G("ZodISOTime",(e,t)=>{kf.init(e,t),Pe.init(e,t)});function Ap(e){return zh(Tp,e)}const zp=G("ZodISODuration",(e,t)=>{Sf.init(e,t),Pe.init(e,t)});function Op(e){return Oh(zp,e)}const Ip=(e,t)=>{ba.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>fd(e,n)},flatten:{value:n=>dd(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ho,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ho,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ge=G("ZodError",Ip,{Parent:Error}),Rp=Wo(Ge),Pp=Vo(Ge),Mp=Sr(Ge),Dp=Cr(Ge),Lp=md(Ge),Fp=gd(Ge),$p=xd(Ge),Bp=vd(Ge),Up=yd(Ge),Zp=bd(Ge),Wp=wd(Ge),Vp=_d(Ge),Oe=G("ZodType",(e,t)=>(ze.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ur(e,"input"),output:ur(e,"output")}}),e.toJSONSchema=ep(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Ct(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)=>Rp(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Mp(e,n,r),e.parseAsync=async(n,r)=>Pp(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>Dp(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Lp(e,n,r),e.decode=(n,r)=>Fp(e,n,r),e.encodeAsync=async(n,r)=>$p(e,n,r),e.decodeAsync=async(n,r)=>Bp(e,n,r),e.safeEncode=(n,r)=>Up(e,n,r),e.safeDecode=(n,r)=>Zp(e,n,r),e.safeEncodeAsync=async(n,r)=>Wp(e,n,r),e.safeDecodeAsync=async(n,r)=>Vp(e,n,r),e.refine=(n,r)=>e.check(Bm(n,r)),e.superRefine=n=>e.check(Um(n)),e.overwrite=n=>e.check(dn(n)),e.optional=()=>Ks(e),e.exactOptional=()=>jm(e),e.nullable=()=>Js(e),e.nullish=()=>Ks(Js(e)),e.nonoptional=n=>Om(e,n),e.array=()=>Ce(e),e.or=n=>xt([e,n]),e.and=n=>bm(e,n),e.transform=n=>Gs(e,Sm(n)),e.default=n=>Tm(e,n),e.prefault=n=>zm(e,n),e.catch=n=>Rm(e,n),e.pipe=n=>Gs(e,n),e.readonly=()=>Dm(e),e.describe=n=>{const r=e.clone();return Cn.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return Cn.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Cn.get(e);const r=e.clone();return Cn.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Ba=G("_ZodString",(e,t)=>{Ho.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>np(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(Fh(...r)),e.includes=(...r)=>e.check(Uh(...r)),e.startsWith=(...r)=>e.check(Zh(...r)),e.endsWith=(...r)=>e.check(Wh(...r)),e.min=(...r)=>e.check(cr(...r)),e.max=(...r)=>e.check(Pa(...r)),e.length=(...r)=>e.check(Ma(...r)),e.nonempty=(...r)=>e.check(cr(1,...r)),e.lowercase=r=>e.check($h(r)),e.uppercase=r=>e.check(Bh(r)),e.trim=()=>e.check(Hh()),e.normalize=(...r)=>e.check(Vh(...r)),e.toLowerCase=()=>e.check(qh()),e.toUpperCase=()=>e.check(Kh()),e.slugify=()=>e.check(Jh())}),Hp=G("ZodString",(e,t)=>{Ho.init(e,t),Ba.init(e,t),e.email=n=>e.check(lh(qp,n)),e.url=n=>e.check(hh(Kp,n)),e.jwt=n=>e.check(Nh(cm,n)),e.emoji=n=>e.check(ph(Jp,n)),e.guid=n=>e.check(Bs(Vs,n)),e.uuid=n=>e.check(ch(Vn,n)),e.uuidv4=n=>e.check(uh(Vn,n)),e.uuidv6=n=>e.check(dh(Vn,n)),e.uuidv7=n=>e.check(fh(Vn,n)),e.nanoid=n=>e.check(mh(Gp,n)),e.guid=n=>e.check(Bs(Vs,n)),e.cuid=n=>e.check(gh(Yp,n)),e.cuid2=n=>e.check(xh(Xp,n)),e.ulid=n=>e.check(vh(Qp,n)),e.base64=n=>e.check(Ch(im,n)),e.base64url=n=>e.check(jh(am,n)),e.xid=n=>e.check(yh(em,n)),e.ksuid=n=>e.check(bh(tm,n)),e.ipv4=n=>e.check(wh(nm,n)),e.ipv6=n=>e.check(_h(rm,n)),e.cidrv4=n=>e.check(kh(om,n)),e.cidrv6=n=>e.check(Sh(sm,n)),e.e164=n=>e.check(Eh(lm,n)),e.datetime=n=>e.check(jp(n)),e.date=n=>e.check(Np(n)),e.time=n=>e.check(Ap(n)),e.duration=n=>e.check(Op(n))});function Z(e){return ah(Hp,e)}const Pe=G("ZodStringFormat",(e,t)=>{Re.init(e,t),Ba.init(e,t)}),qp=G("ZodEmail",(e,t)=>{ff.init(e,t),Pe.init(e,t)}),Vs=G("ZodGUID",(e,t)=>{uf.init(e,t),Pe.init(e,t)}),Vn=G("ZodUUID",(e,t)=>{df.init(e,t),Pe.init(e,t)}),Kp=G("ZodURL",(e,t)=>{hf.init(e,t),Pe.init(e,t)}),Jp=G("ZodEmoji",(e,t)=>{pf.init(e,t),Pe.init(e,t)}),Gp=G("ZodNanoID",(e,t)=>{mf.init(e,t),Pe.init(e,t)}),Yp=G("ZodCUID",(e,t)=>{gf.init(e,t),Pe.init(e,t)}),Xp=G("ZodCUID2",(e,t)=>{xf.init(e,t),Pe.init(e,t)}),Qp=G("ZodULID",(e,t)=>{vf.init(e,t),Pe.init(e,t)}),em=G("ZodXID",(e,t)=>{yf.init(e,t),Pe.init(e,t)}),tm=G("ZodKSUID",(e,t)=>{bf.init(e,t),Pe.init(e,t)}),nm=G("ZodIPv4",(e,t)=>{Cf.init(e,t),Pe.init(e,t)}),rm=G("ZodIPv6",(e,t)=>{jf.init(e,t),Pe.init(e,t)}),om=G("ZodCIDRv4",(e,t)=>{Ef.init(e,t),Pe.init(e,t)}),sm=G("ZodCIDRv6",(e,t)=>{Nf.init(e,t),Pe.init(e,t)}),im=G("ZodBase64",(e,t)=>{Tf.init(e,t),Pe.init(e,t)}),am=G("ZodBase64URL",(e,t)=>{zf.init(e,t),Pe.init(e,t)}),lm=G("ZodE164",(e,t)=>{Of.init(e,t),Pe.init(e,t)}),cm=G("ZodJWT",(e,t)=>{Rf.init(e,t),Pe.init(e,t)}),Ua=G("ZodNumber",(e,t)=>{Aa.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>rp(e,r,o),e.gt=(r,o)=>e.check(Zs(r,o)),e.gte=(r,o)=>e.check(Vr(r,o)),e.min=(r,o)=>e.check(Vr(r,o)),e.lt=(r,o)=>e.check(Us(r,o)),e.lte=(r,o)=>e.check(Wr(r,o)),e.max=(r,o)=>e.check(Wr(r,o)),e.int=r=>e.check(Hs(r)),e.safe=r=>e.check(Hs(r)),e.positive=r=>e.check(Zs(0,r)),e.nonnegative=r=>e.check(Vr(0,r)),e.negative=r=>e.check(Us(0,r)),e.nonpositive=r=>e.check(Wr(0,r)),e.multipleOf=(r,o)=>e.check(Ws(r,o)),e.step=(r,o)=>e.check(Ws(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 Ih(Ua,e)}const um=G("ZodNumberFormat",(e,t)=>{Pf.init(e,t),Ua.init(e,t)});function Hs(e){return Rh(um,e)}const dm=G("ZodBoolean",(e,t)=>{Mf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>op(e,n,r)});function Be(e){return Ph(dm,e)}const fm=G("ZodNull",(e,t)=>{Df.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>sp(e,n,r)});function mo(e){return Mh(fm,e)}const hm=G("ZodUnknown",(e,t)=>{Lf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ap()});function qs(){return Dh(hm)}const pm=G("ZodNever",(e,t)=>{Ff.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ip(e,n,r)});function mm(e){return Lh(pm,e)}const gm=G("ZodArray",(e,t)=>{$f.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fp(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(cr(n,r)),e.nonempty=n=>e.check(cr(1,n)),e.max=(n,r)=>e.check(Pa(n,r)),e.length=(n,r)=>e.check(Ma(n,r)),e.unwrap=()=>e.element});function Ce(e,t){return Gh(gm,e,t)}const xm=G("ZodObject",(e,t)=>{Uf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>hp(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:qs()}),e.loose=()=>e.clone({...e._zod.def,catchall:qs()}),e.strict=()=>e.clone({...e._zod.def,catchall:mm()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>id(e,n),e.safeExtend=n=>ad(e,n),e.merge=n=>ld(e,n),e.pick=n=>od(e,n),e.omit=n=>sd(e,n),e.partial=(...n)=>cd(Wa,e,n[0]),e.required=(...n)=>ud(Va,e,n[0])});function ne(e,t){const n={type:"object",shape:e??{},...de(t)};return new xm(n)}const Za=G("ZodUnion",(e,t)=>{Ia.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>pp(e,n,r,o),e.options=t.options});function xt(e,t){return new Za({type:"union",options:e,...de(t)})}const vm=G("ZodDiscriminatedUnion",(e,t)=>{Za.init(e,t),Zf.init(e,t)});function Lt(e,t,n){return new vm({type:"union",options:t,discriminator:e,...de(n)})}const ym=G("ZodIntersection",(e,t)=>{Wf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mp(e,n,r,o)});function bm(e,t){return new ym({type:"intersection",left:e,right:t})}const wm=G("ZodRecord",(e,t)=>{Vf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gp(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function pt(e,t,n){return new wm({type:"record",keyType:e,valueType:t,...de(n)})}const go=G("ZodEnum",(e,t)=>{Hf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(r,o,s)=>lp(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 go({...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 go({...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 go({type:"enum",entries:n,...de(t)})}const _m=G("ZodLiteral",(e,t)=>{qf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cp(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 _m({type:"literal",values:Array.isArray(e)?e:[e],...de(t)})}const km=G("ZodTransform",(e,t)=>{Kf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>dp(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new pa(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Nn(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(Nn(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function Sm(e){return new km({type:"transform",transform:e})}const Wa=G("ZodOptional",(e,t)=>{Ra.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$a(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ks(e){return new Wa({type:"optional",innerType:e})}const Cm=G("ZodExactOptional",(e,t)=>{Jf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$a(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function jm(e){return new Cm({type:"optional",innerType:e})}const Em=G("ZodNullable",(e,t)=>{Gf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Js(e){return new Em({type:"nullable",innerType:e})}const Nm=G("ZodDefault",(e,t)=>{Yf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Tm(e,t){return new Nm({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():va(t)}})}const Am=G("ZodPrefault",(e,t)=>{Xf.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 zm(e,t){return new Am({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():va(t)}})}const Va=G("ZodNonOptional",(e,t)=>{Qf.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Om(e,t){return new Va({type:"nonoptional",innerType:e,...de(t)})}const Im=G("ZodCatch",(e,t)=>{eh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Rm(e,t){return new Im({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Pm=G("ZodPipe",(e,t)=>{th.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_p(e,n,r,o),e.in=t.in,e.out=t.out});function Gs(e,t){return new Pm({type:"pipe",in:e,out:t})}const Mm=G("ZodReadonly",(e,t)=>{nh.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 Dm(e){return new Mm({type:"readonly",innerType:e})}const Lm=G("ZodLazy",(e,t)=>{rh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sp(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function Fm(e){return new Lm({type:"lazy",getter:e})}const $m=G("ZodCustom",(e,t)=>{oh.init(e,t),Oe.init(e,t),e._zod.processJSONSchema=(n,r,o)=>up(e,n)});function Bm(e,t={}){return Yh($m,e,t)}function Um(e){return Xh(e)}const on=Fm(()=>xt([Z(),me(),Be(),mo(),Ce(on),pt(Z(),on)]));function Ha(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ys(e,t){return e===null||typeof e!="object"||Array.isArray(e)?void 0:Object.getOwnPropertyDescriptor(e,t)?.value}const qo=ne({type:Z(),ttl:Z().optional(),scope:Z().optional()}),Ko=ne({type:ve("text"),text:Z(),cache_control:qo.optional()}),qa=ne({type:ve("thinking"),thinking:Z(),signature:Z().optional()}),Zm=ne({type:ve("think"),thinking:Z(),signature:Z().optional()}),Wm=ne({type:ve("base64"),media_type:Z(),data:Z()}),Ka=ne({type:ve("image"),source:Wm}),Ja=ne({type:ve("tool_use"),id:Z(),name:Z(),input:pt(Z(),on)}),Vm=Lt("type",[Ko,Ka]),Hm=ne({type:ve("tool_result"),tool_use_id:Z().optional(),content:xt([Z(),Ce(Vm)]),is_error:Be().optional()}),qm=Lt("type",[Ko,qa,Ka,Ja,Hm]),Km=xt([Z(),Ce(qm)]),Jm=ne({role:Ve(["user","assistant"]),content:Km}),Gm=ne({type:ve("text"),text:Z(),cache_control:qo.optional()}),Ym=ne({type:Z(),properties:pt(Z(),pt(Z(),on)).optional(),required:Ce(Z()).optional(),additionalProperties:Be().optional(),$schema:Z().optional()}),Xm=ne({name:Z(),description:Z().optional(),input_schema:Ym.optional(),cache_control:qo.optional()}),Qm=Lt("type",[ne({type:ve("enabled"),budget_tokens:me()}),ne({type:ve("disabled")}),ne({type:ve("adaptive")})]),Ga=ne({model:Z(),messages:Ce(Jm),system:Ce(Gm).optional(),tools:Ce(Xm).optional(),max_tokens:me().optional(),temperature:me().optional(),stream:Be().optional(),thinking:Qm.optional(),metadata:ne({user_id:Z().optional()}).optional()}),Jo=Lt("type",[Ko,qa,Zm,Ja]),eg=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(),Ya=ne({id:Z(),type:ve("message"),model:Z(),role:ve("assistant"),content:Ce(Jo),stop_reason:Z().nullable(),stop_sequence:Z().nullable().optional(),usage:eg}).passthrough(),tg=ne({type:ve("message_start"),message:ne({id:Z(),type:ve("message"),model:Z(),role:ve("assistant"),content:Ce(Jo),stop_reason:mo(),stop_sequence:mo(),usage:ne({input_tokens:me(),cache_creation_input_tokens:me().optional(),cache_read_input_tokens:me().optional()}).passthrough()})}),ng=ne({type:ve("content_block_start"),index:me(),content_block:Jo}),rg=Lt("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()})]),og=ne({type:ve("content_block_delta"),index:me(),delta:rg}),sg=ne({type:ve("content_block_stop"),index:me()}),ig=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()}),ag=ne({type:ve("message_stop")}),lg=ne({type:ve("ping")}),cg=ne({type:ve("error"),error:ne({type:Z(),message:Z()})}),ug=Lt("type",[tg,ng,og,sg,ig,ag,lg,cg]),dg=xt([Z(),Ce(Lt("type",[ne({type:ve("text"),text:Z()}),ne({type:ve("image_url"),image_url:ne({url:Z(),detail:Z().optional()})})]))]),Xa=ne({role:Ve(["system","user","assistant","tool"]),content:dg,name:Z().optional(),reasoning_content:Z().optional(),thinking:Z().optional(),think:Z().optional()}),fg=ne({name:Z(),arguments:Z()}),Qa=ne({index:me().optional(),id:Z().optional(),type:ve("function").optional(),function:ne({name:Z().optional(),arguments:Z().optional()})});Xa.extend({content:xt([Z(),Ce(ne({type:ve("text"),text:Z()}))]).optional(),function_call:fg.optional(),tool_calls:Ce(Qa).optional()});const hg=ne({type:ve("function"),function:ne({name:Z(),description:Z().optional(),parameters:pt(Z(),on)})}),el=ne({model:Z(),messages:Ce(Xa),temperature:me().optional(),max_tokens:me().optional(),stream:Be().optional(),tools:Ce(hg).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()}),tl=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:Ce(ne({index:me(),id:Z().optional(),type:ve("function").optional(),function:ne({name:Z().optional(),arguments:Z().optional()})})).nullable().optional()}),pg=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:Ce(Qa).optional()}).optional(),delta:tl.optional(),finish_reason:Z().nullable()}),mg=ne({id:Z(),object:ve("chat.completion"),created:me(),model:Z(),choices:Ce(pg),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(),gg=ne({id:Z(),object:ve("chat.completion.chunk"),created:me(),model:Z(),choices:Ce(ne({index:me(),delta:tl,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 nl(e){try{const t=JSON.parse(e),n=mg.safeParse(t);return n.success?n.data:null}catch{return null}}const rl=ne({index:me(),timestamp:me(),type:Z(),data:on}),xg=ne({chunks:Ce(rl),truncated:Be().optional().default(!1)}),Xs=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:xg.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 vg=ne({error:Z()});async function Jt(e,t){const n=await e.json();return t.parse(n)}async function rr(e,t){try{const n=await e.json(),r=vg.safeParse(n);return r.success?r.data.error:t}catch{return t}}async function Rn(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 Jt(o,t)}const dr=10,xo=600,Er=ne({stripClaudeCodeBillingHeader:Be(),hasSeenOnboarding:Be().default(!1),slowResponseThresholdSeconds:me().int().min(0).max(xo).default(dr)}),or="/api/config";async function yg(e){return Rn(e,Er,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function Qs(e){return Rn(or,Er,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function ol(){const e=$o(or,yg,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=fa(),n=e.data?.stripClaudeCodeBillingHeader??!1,r=e.data?.slowResponseThresholdSeconds??dr,o=l=>({stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:e.data?.hasSeenOnboarding??!1,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??dr,...l}),s=async l=>{await t(or,Qs({stripClaudeCodeBillingHeader:l}),{optimisticData:o({stripClaudeCodeBillingHeader:l}),rollbackOnError:!0,revalidate:!1})},i=async l=>{await t(or,Qs({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 sl=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const bg=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const wg=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const ei=e=>{const t=wg(e);return t.charAt(0).toUpperCase()+t.slice(1)};var _g={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 kg=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const Sg=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...l},c)=>v.createElement("svg",{ref:c,..._g,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:sl("lucide",o),...!s&&!kg(l)&&{"aria-hidden":"true"},...l},[...i.map(([u,d])=>v.createElement(u,d)),...Array.isArray(s)?s:[s]]));const ge=(e,t)=>{const n=v.forwardRef(({className:r,...o},s)=>v.createElement(Sg,{ref:s,iconNode:t,className:sl(`lucide-${bg(ei(e))}`,`lucide-${e}`,r),...o}));return n.displayName=ei(e),n};const Cg=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],jg=ge("arrow-down",Cg);const Eg=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Ng=ge("arrow-up",Eg);const Tg=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ft=ge("check",Tg);const Ag=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Pn=ge("chevron-down",Ag);const zg=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Go=ge("chevron-right",zg);const Og=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Ig=ge("chevron-up",Og);const Rg=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],il=ge("chevrons-down",Rg);const Pg=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],al=ge("chevrons-up",Pg);const Mg=[["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"}]],Tn=ge("circle-alert",Mg);const Dg=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Lg=ge("circle-check-big",Dg);const Fg=[["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"}]],$g=ge("circle-question-mark",Fg);const Bg=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],sn=ge("clock",Bg);const Ug=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Zg=ge("columns-2",Ug);const Wg=[["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"}]],Mn=ge("copy",Wg);const Vg=[["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"}]],Yo=ge("download",Vg);const Hg=[["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"}]],qg=ge("external-link",Hg);const Kg=[["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"}]],Xo=ge("eye-off",Kg);const Jg=[["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"}]],Qo=ge("eye",Jg);const Gg=[["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"}]],Yg=ge("file-terminal",Gg);const Xg=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Qg=ge("gauge",Xg);const e0=[["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"}]],ll=ge("git-compare-arrows",e0);const t0=[["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"}]],n0=ge("globe",t0);const r0=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],fr=ge("loader-circle",r0);const o0=[["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"}]],s0=ge("lock",o0);const i0=[["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"}]],cl=ge("message-square",i0);const a0=[["path",{d:"M5 12h14",key:"1ays0h"}]],l0=ge("minus",a0);const c0=[["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"}]],u0=ge("octagon-alert",c0);const d0=[["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"}]],f0=ge("pencil",d0);const h0=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ti=ge("plus",h0);const p0=[["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"}]],m0=ge("radio",p0);const g0=[["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"}]],x0=ge("rotate-ccw",g0);const v0=[["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"}]],ul=ge("rotate-cw",v0);const y0=[["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"}]],b0=ge("rows-3",y0);const w0=[["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"}]],_0=ge("scan",w0);const k0=[["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"}]],S0=ge("server",k0);const C0=[["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"}]],j0=ge("settings",C0);const E0=[["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"}]],dl=ge("trash-2",E0);const N0=[["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"}]],vo=ge("triangle-alert",N0);const T0=[["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"}]],A0=ge("upload",T0);const z0=[["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"}]],O0=ge("user",z0);const I0=[["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"}]],R0=ge("wifi-off",I0);const P0=[["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"}]],M0=ge("wifi",P0);const D0=[["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"}]],ni=ge("wrench",D0);const L0=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],fl=ge("x",L0);const F0=[["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"}]],es=ge("zap",F0),yo="/api/config";async function $0(e){return Rn(e,Er,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function B0(e){return Rn(yo,Er,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function U0(){const e=$o(yo,$0,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=fa(),n=e.data?.hasSeenOnboarding??!1,r=async()=>{await t(yo,B0({hasSeenOnboarding:!0}),{optimisticData:{stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:!0,slowResponseThresholdSeconds:e.data?.slowResponseThresholdSeconds??dr},rollbackOnError:!0,revalidate:!1})};return{hasSeenOnboarding:n,isLoading:e.isLoading,markSeen:r}}function Z0(){const{hasSeenOnboarding:e,isLoading:t,markSeen:n}=U0();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(Ft,{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(fl,{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 Hr={exports:{}};var ri;function W0(){return ri||(ri=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 h=o[u]={exports:{}};r[u][0].call(h.exports,function(g){var p=r[u][1][g];return i(p||g)},h,h.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,h,g,p,x=[],y=0,_=c.length,k=_,S=s.getTypeOf(c)!=="string";y<c.length;)k=_-y,f=S?(u=c[y++],d=y<_?c[y++]:0,y<_?c[y++]:0):(u=c.charCodeAt(y++),d=y<_?c.charCodeAt(y++):0,y<_?c.charCodeAt(y++):0),m=u>>2,h=(3&u)<<4|d>>4,g=1<k?(15&d)<<2|f>>6:64,p=2<k?63&f:64,x.push(l.charAt(m)+l.charAt(h)+l.charAt(g)+l.charAt(p));return x.join("")},o.decode=function(c){var u,d,f,m,h,g,p=0,x=0,y="data:";if(c.substr(0,y.length)===y)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);p<c.length;)u=l.indexOf(c.charAt(p++))<<2|(m=l.indexOf(c.charAt(p++)))>>4,d=(15&m)<<4|(h=l.indexOf(c.charAt(p++)))>>2,f=(3&h)<<6|(g=l.indexOf(c.charAt(p++))),_[x++]=u,h!==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,h,g){this.compressedSize=d,this.uncompressedSize=f,this.crc32=m,this.compression=h,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 h=i,g=m+f;u^=-1;for(var p=m;p<g;p++)u=u>>>8^h[255&(u^d[p])];return-1^u})(0|c,l,l.length,0):(function(u,d,f,m){var h=i,g=m+f;u^=-1;for(var p=m;p<g;p++)u=u>>>8^h[255&(u^d.charCodeAt(p))];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(h,g){var p,x="";for(p=0;p<g;p++)x+=String.fromCharCode(255&h),h>>>=8;return x}function i(h,g,p,x,y,_){var k,S,j=h.file,O=h.compression,N=_!==u.utf8encode,A=l.transformTo("string",_(j.name)),z=l.transformTo("string",u.utf8encode(j.name)),R=j.comment,H=l.transformTo("string",_(R)),C=l.transformTo("string",u.utf8encode(R)),I=z.length!==j.name.length,b=C.length!==R.length,D="",K="",L="",U=j.dir,J=j.date,se={crc32:0,compressedSize:0,uncompressedSize:0};g&&!p||(se.crc32=h.crc32,se.compressedSize=h.compressedSize,se.uncompressedSize=h.uncompressedSize);var B=0;g&&(B|=8),N||!I&&!b||(B|=2048);var $=0,oe=0;U&&($|=16),y==="UNIX"?(oe=798,$|=(function(q,ue){var X=q;return q||(X=ue?16893:33204),(65535&X)<<16})(j.unixPermissions,U)):(oe=20,$|=(function(q){return 63&(q||0)})(j.dosPermissions)),k=J.getUTCHours(),k<<=6,k|=J.getUTCMinutes(),k<<=5,k|=J.getUTCSeconds()/2,S=J.getUTCFullYear()-1980,S<<=4,S|=J.getUTCMonth()+1,S<<=5,S|=J.getUTCDate(),I&&(K=s(1,1)+s(d(A),4)+z,D+="up"+s(K.length,2)+K),b&&(L=s(1,1)+s(d(H),4)+C,D+="uc"+s(L.length,2)+L);var ee="";return ee+=`
|
|
41
|
-
\0`,ee+=s(B,2),ee+=O.magic,ee+=s(k,2),ee+=s(S,2),ee+=s(se.crc32,4),ee+=s(se.compressedSize,4),ee+=s(se.uncompressedSize,4),ee+=s(A.length,2),ee+=s(D.length,2),{fileRecord:f.LOCAL_FILE_HEADER+ee+A+D,dirRecord:f.CENTRAL_FILE_HEADER+s(oe,2)+ee+s(H.length,2)+"\0\0\0\0"+s($,4)+s(x,4)+A+D+H}}var l=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function m(h,g,p,x){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=p,this.encodeFileName=x,this.streamFiles=h,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(h){var g=h.meta.percent||0,p=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(h):(this.bytesWritten+=h.data.length,c.prototype.push.call(this,{data:h.data,meta:{currentFile:this.currentFile,percent:p?(g+100*(p-x-1))/p:100}}))},m.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var g=this.streamFiles&&!h.file.dir;if(g){var p=i(h,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:p.fileRecord,meta:{percent:0}})}else this.accumulate=!0},m.prototype.closedSource=function(h){this.accumulate=!1;var g=this.streamFiles&&!h.file.dir,p=i(h,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(p.dirRecord),g)this.push({data:(function(x){return f.DATA_DESCRIPTOR+s(x.crc32,4)+s(x.compressedSize,4)+s(x.uncompressedSize,4)})(h),meta:{percent:100}});else for(this.push({data:p.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},m.prototype.flush=function(){for(var h=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var p=this.bytesWritten-h,x=(function(y,_,k,S,j){var O=l.transformTo("string",j(S));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(y,2)+s(y,2)+s(_,4)+s(k,4)+s(O.length,2)+O})(this.dirRecords.length,p,h,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(h){this._sources.push(h);var g=this;return h.on("data",function(p){g.processChunk(p)}),h.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),h.on("error",function(p){g.error(p)}),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(h){var g=this._sources;if(!c.prototype.error.call(this,h))return!1;for(var p=0;p<g.length;p++)try{g[p].error(h)}catch{}return!0},m.prototype.lock=function(){c.prototype.lock.call(this);for(var h=this._sources,g=0;g<h.length;g++)h[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,h){f++;var g=(function(_,k){var S=_||k,j=s[S];if(!j)throw new Error(S+" is not a valid compression method !");return j})(h.options.compression,c.compression),p=h.options.compressionOptions||c.compressionOptions||{},x=h.dir,y=h.date;h._compressWorker(g,p).withStreamInfo("file",{name:m,dir:x,date:y,comment:h.comment||"",unixPermissions:h.unixPermissions,dosPermissions:h.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(h,g){var p=m.decompressed.getContentWorker().pipe(new u);p.on("error",function(x){g(x)}).on("end",function(){p.streamInfo.crc32!==m.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):h()}).resume()})}r.exports=function(m,h){var g=this;return h=s.extend(h||{},{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,h.optimizedBinaryString,h.base64).then(function(p){var x=new c(h);return x.load(p),x}).then(function(p){var x=[i.Promise.resolve(p)],y=p.files;if(h.checkCRC32)for(var _=0;_<y.length;_++)x.push(f(y[_]));return i.Promise.all(x)}).then(function(p){for(var x=p.shift(),y=x.files,_=0;_<y.length;_++){var k=y[_],S=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:h.createFolders}),k.dir||(g.file(j).unsafeOriginalName=S)}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,O,N){var A,z=l.getTypeOf(O),R=l.extend(N||{},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=y(j)),R.createFolders&&(A=x(j))&&_.call(this,A,!0);var H=z==="string"&&R.binary===!1&&R.base64===!1;N&&N.binary!==void 0||(R.binary=!H),(O instanceof f&&O.uncompressedSize===0||R.dir||!O||O.length===0)&&(R.base64=!1,R.binary=!0,O="",R.compression="STORE",z="string");var C=null;C=O instanceof f||O instanceof c?O:g.isNode&&g.isStream(O)?new p(j,O):l.prepareContent(j,O,R.binary,R.optimizedBinaryString,R.base64);var I=new m(j,C,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"),h=n("./generate"),g=n("./nodejsUtils"),p=n("./nodejs/NodejsStreamInputAdapter"),x=function(j){j.slice(-1)==="/"&&(j=j.substring(0,j.length-1));var O=j.lastIndexOf("/");return 0<O?j.substring(0,O):""},y=function(j){return j.slice(-1)!=="/"&&(j+="/"),j},_=function(j,O){return O=O!==void 0?O:d.createFolders,j=y(j),this.files[j]||s.call(this,j,null,{dir:!0,createFolders:O}),this.files[j]};function k(j){return Object.prototype.toString.call(j)==="[object RegExp]"}var S={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(j){var O,N,A;for(O in this.files)A=this.files[O],(N=O.slice(this.root.length,O.length))&&O.slice(0,this.root.length)===this.root&&j(N,A)},filter:function(j){var O=[];return this.forEach(function(N,A){j(N,A)&&O.push(A)}),O},file:function(j,O,N){if(arguments.length!==1)return j=this.root+j,s.call(this,j,O,N),this;if(k(j)){var A=j;return this.filter(function(R,H){return!H.dir&&A.test(R)})}var z=this.files[this.root+j];return z&&!z.dir?z:null},folder:function(j){if(!j)return this;if(k(j))return this.filter(function(z,R){return R.dir&&j.test(z)});var O=this.root+j,N=_.call(this,O),A=this.clone();return A.root=N.name,A},remove:function(j){j=this.root+j;var O=this.files[j];if(O||(j.slice(-1)!=="/"&&(j+="/"),O=this.files[j]),O&&!O.dir)delete this.files[j];else for(var N=this.filter(function(z,R){return R.name.slice(0,j.length)===j}),A=0;A<N.length;A++)delete this.files[N[A].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(j){var O,N={};try{if((N=l.extend(j||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=N.type.toLowerCase(),N.compression=N.compression.toUpperCase(),N.type==="binarystring"&&(N.type="string"),!N.type)throw new Error("No output type specified.");l.checkSupport(N.type),N.platform!=="darwin"&&N.platform!=="freebsd"&&N.platform!=="linux"&&N.platform!=="sunos"||(N.platform="UNIX"),N.platform==="win32"&&(N.platform="DOS");var A=N.comment||this.comment||"";O=h.generateWorker(this,N,A)}catch(z){(O=new c("error")).error(z)}return new u(O,N.type||"string",N.mimeType)},generateAsync:function(j,O){return this.generateInternalStream(j).accumulate(O)},generateNodeStream:function(j,O){return(j=j||{}).type||(j.type="nodebuffer"),this.generateInternalStream(j).toNodejsStream(O)}};r.exports=S},{"./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,p){return new d.Promise(function(x,y){var _=[],k=g._internalType,S=g._outputType,j=g._mimeType;g.on("data",function(O,N){_.push(O),p&&p(N)}).on("error",function(O){_=[],y(O)}).on("end",function(){try{var O=(function(N,A,z){switch(N){case"blob":return s.newBlob(s.transformTo("arraybuffer",A),z);case"base64":return c.encode(A);default:return s.transformTo(N,A)}})(S,(function(N,A){var z,R=0,H=null,C=0;for(z=0;z<A.length;z++)C+=A[z].length;switch(N){case"string":return A.join("");case"array":return Array.prototype.concat.apply([],A);case"uint8array":for(H=new Uint8Array(C),z=0;z<A.length;z++)H.set(A[z],R),R+=A[z].length;return H;case"nodebuffer":return Buffer.concat(A);default:throw new Error("concat : unsupported type '"+N+"'")}})(k,_),j);x(O)}catch(N){y(N)}_=[]}).resume()})}function h(g,p,x){var y=p;switch(p){case"blob":case"arraybuffer":y="uint8array";break;case"base64":y="string"}try{this._internalType=y,this._outputType=p,this._mimeType=x,s.checkSupport(y),this._worker=g.pipe(new i(y)),g.lock()}catch(_){this._worker=new l("error"),this._worker.error(_)}}h.prototype={accumulate:function(g){return m(this,g)},on:function(g,p){var x=this;return g==="data"?this._worker.on(g,function(y){p.call(x,y.data,y.meta)}):this._worker.on(g,function(){s.delay(p,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=h},{"../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(h){return i.nodebuffer?l.newBufferFrom(h,"utf-8"):(function(g){var p,x,y,_,k,S=g.length,j=0;for(_=0;_<S;_++)(64512&(x=g.charCodeAt(_)))==55296&&_+1<S&&(64512&(y=g.charCodeAt(_+1)))==56320&&(x=65536+(x-55296<<10)+(y-56320),_++),j+=x<128?1:x<2048?2:x<65536?3:4;for(p=i.uint8array?new Uint8Array(j):new Array(j),_=k=0;k<j;_++)(64512&(x=g.charCodeAt(_)))==55296&&_+1<S&&(64512&(y=g.charCodeAt(_+1)))==56320&&(x=65536+(x-55296<<10)+(y-56320),_++),x<128?p[k++]=x:(x<2048?p[k++]=192|x>>>6:(x<65536?p[k++]=224|x>>>12:(p[k++]=240|x>>>18,p[k++]=128|x>>>12&63),p[k++]=128|x>>>6&63),p[k++]=128|63&x);return p})(h)},o.utf8decode=function(h){return i.nodebuffer?s.transformTo("nodebuffer",h).toString("utf-8"):(function(g){var p,x,y,_,k=g.length,S=new Array(2*k);for(p=x=0;p<k;)if((y=g[p++])<128)S[x++]=y;else if(4<(_=u[y]))S[x++]=65533,p+=_-1;else{for(y&=_===2?31:_===3?15:7;1<_&&p<k;)y=y<<6|63&g[p++],_--;1<_?S[x++]=65533:y<65536?S[x++]=y:(y-=65536,S[x++]=55296|y>>10&1023,S[x++]=56320|1023&y)}return S.length!==x&&(S.subarray?S=S.subarray(0,x):S.length=x),s.applyFromCharCode(S)})(h=s.transformTo(i.uint8array?"uint8array":"array",h))},s.inherits(f,c),f.prototype.processChunk=function(h){var g=s.transformTo(i.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var p=g;(g=new Uint8Array(p.length+this.leftOver.length)).set(this.leftOver,0),g.set(p,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var x=(function(_,k){var S;for((k=k||_.length)>_.length&&(k=_.length),S=k-1;0<=S&&(192&_[S])==128;)S--;return S<0||S===0?k:S+u[_[S]]>k?S:k})(g),y=g;x!==g.length&&(i.uint8array?(y=g.subarray(0,x),this.leftOver=g.subarray(x,g.length)):(y=g.slice(0,x),this.leftOver=g.slice(x,g.length))),this.push({data:o.utf8decode(y),meta:h.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(h){this.push({data:o.utf8encode(h.data),meta:h.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(p){return p}function d(p,x){for(var y=0;y<p.length;++y)x[y]=255&p.charCodeAt(y);return x}n("setimmediate"),o.newBlob=function(p,x){o.checkSupport("blob");try{return new Blob([p],{type:x})}catch{try{var y=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return y.append(p),y.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(p,x,y){var _=[],k=0,S=p.length;if(S<=y)return String.fromCharCode.apply(null,p);for(;k<S;)x==="array"||x==="nodebuffer"?_.push(String.fromCharCode.apply(null,p.slice(k,Math.min(k+y,S)))):_.push(String.fromCharCode.apply(null,p.subarray(k,Math.min(k+y,S)))),k+=y;return _.join("")},stringifyByChar:function(p){for(var x="",y=0;y<p.length;y++)x+=String.fromCharCode(p[y]);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(p){var x=65536,y=o.getTypeOf(p),_=!0;if(y==="uint8array"?_=f.applyCanBeUsed.uint8array:y==="nodebuffer"&&(_=f.applyCanBeUsed.nodebuffer),_)for(;1<x;)try{return f.stringifyByChunk(p,y,x)}catch{x=Math.floor(x/2)}return f.stringifyByChar(p)}function h(p,x){for(var y=0;y<p.length;y++)x[y]=p[y];return x}o.applyFromCharCode=m;var g={};g.string={string:u,array:function(p){return d(p,new Array(p.length))},arraybuffer:function(p){return g.string.uint8array(p).buffer},uint8array:function(p){return d(p,new Uint8Array(p.length))},nodebuffer:function(p){return d(p,l.allocBuffer(p.length))}},g.array={string:m,array:u,arraybuffer:function(p){return new Uint8Array(p).buffer},uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return l.newBufferFrom(p)}},g.arraybuffer={string:function(p){return m(new Uint8Array(p))},array:function(p){return h(new Uint8Array(p),new Array(p.byteLength))},arraybuffer:u,uint8array:function(p){return new Uint8Array(p)},nodebuffer:function(p){return l.newBufferFrom(new Uint8Array(p))}},g.uint8array={string:m,array:function(p){return h(p,new Array(p.length))},arraybuffer:function(p){return p.buffer},uint8array:u,nodebuffer:function(p){return l.newBufferFrom(p)}},g.nodebuffer={string:m,array:function(p){return h(p,new Array(p.length))},arraybuffer:function(p){return g.nodebuffer.uint8array(p).buffer},uint8array:function(p){return h(p,new Uint8Array(p.length))},nodebuffer:u},o.transformTo=function(p,x){if(x=x||"",!p)return x;o.checkSupport(p);var y=o.getTypeOf(x);return g[y][p](x)},o.resolve=function(p){for(var x=p.split("/"),y=[],_=0;_<x.length;_++){var k=x[_];k==="."||k===""&&_!==0&&_!==x.length-1||(k===".."?y.pop():y.push(k))}return y.join("/")},o.getTypeOf=function(p){return typeof p=="string"?"string":Object.prototype.toString.call(p)==="[object Array]"?"array":s.nodebuffer&&l.isBuffer(p)?"nodebuffer":s.uint8array&&p instanceof Uint8Array?"uint8array":s.arraybuffer&&p instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(p){if(!s[p.toLowerCase()])throw new Error(p+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(p){var x,y,_="";for(y=0;y<(p||"").length;y++)_+="\\x"+((x=p.charCodeAt(y))<16?"0":"")+x.toString(16).toUpperCase();return _},o.delay=function(p,x,y){setImmediate(function(){p.apply(y||null,x||[])})},o.inherits=function(p,x){function y(){}y.prototype=x.prototype,p.prototype=new y},o.extend=function(){var p,x,y={};for(p=0;p<arguments.length;p++)for(x in arguments[p])Object.prototype.hasOwnProperty.call(arguments[p],x)&&y[x]===void 0&&(y[x]=arguments[p][x]);return y},o.prepareContent=function(p,x,y,_,k){return c.Promise.resolve(x).then(function(S){return s.blob&&(S instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(S))!==-1)&&typeof FileReader<"u"?new c.Promise(function(j,O){var N=new FileReader;N.onload=function(A){j(A.target.result)},N.onerror=function(A){O(A.target.error)},N.readAsArrayBuffer(S)}):S}).then(function(S){var j=o.getTypeOf(S);return j?(j==="arraybuffer"?S=o.transformTo("uint8array",S):j==="string"&&(k?S=i.decode(S):y&&_!==!0&&(S=(function(O){return d(O,s.uint8array?new Uint8Array(O.length):new Array(O.length))})(S))),S):c.Promise.reject(new Error("Can't read the data of '"+p+"'. 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 h=this.reader.index;this.reader.setIndex(f);var g=this.reader.readString(4)===m;return this.reader.setIndex(h),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",h=i.transformTo(m,f);this.zipComment=this.loadOptions.decodeFileName(h)},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,h,g=this.zip64EndOfCentralSize-44;0<g;)f=this.reader.readInt(2),m=this.reader.readInt(4),h=this.reader.readData(m),this.zip64ExtensibleData[f]={id:f,length:m,value:h}},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 h=this.centralDirOffset+this.centralDirSize;this.zip64&&(h+=20,h+=12+this.zip64EndOfCentralSize);var g=m-h;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(h,g){this.options=h,this.loadOptions=g}m.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(h){var g,p;if(h.skip(22),this.fileNameLength=h.readInt(2),p=h.readInt(2),this.fileName=h.readData(this.fileNameLength),h.skip(p),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 y in d)if(Object.prototype.hasOwnProperty.call(d,y)&&d[y].magic===x)return d[y];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,h.readData(this.compressedSize))},readCentralPart:function(h){this.versionMadeBy=h.readInt(2),h.skip(2),this.bitFlag=h.readInt(2),this.compressionMethod=h.readString(2),this.date=h.readDate(),this.crc32=h.readInt(4),this.compressedSize=h.readInt(4),this.uncompressedSize=h.readInt(4);var g=h.readInt(2);if(this.extraFieldsLength=h.readInt(2),this.fileCommentLength=h.readInt(2),this.diskNumberStart=h.readInt(2),this.internalFileAttributes=h.readInt(2),this.externalFileAttributes=h.readInt(4),this.localHeaderOffset=h.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");h.skip(g),this.readExtraFields(h),this.parseZIP64ExtraField(h),this.fileComment=h.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var h=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),h==0&&(this.dosPermissions=63&this.externalFileAttributes),h==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var h=s(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=h.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=h.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=h.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=h.readInt(4))}},readExtraFields:function(h){var g,p,x,y=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4<y;)g=h.readInt(2),p=h.readInt(2),x=h.readData(p),this.extraFields[g]={id:g,length:p,value:x};h.setIndex(y)},handleUTF8:function(){var h=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 p=i.transformTo(h,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(p)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var y=i.transformTo(h,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(y)}}},findExtraFieldUnicodePath:function(){var h=this.extraFields[28789];if(h){var g=s(h.value);return g.readInt(1)!==1||c(this.fileName)!==g.readInt(4)?null:u.utf8decode(g.readData(h.length-5))}return null},findExtraFieldUnicodeComment:function(){var h=this.extraFields[25461];if(h){var g=s(h.value);return g.readInt(1)!==1||c(this.fileComment)!==g.readInt(4)?null:u.utf8decode(g.readData(h.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,p,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=p,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 p=null,x="string";try{if(!g)throw new Error("No output type specified.");var y=(x=g.toLowerCase())==="string"||x==="text";x!=="binarystring"&&x!=="text"||(x="string"),p=this._decompressWorker();var _=!this._dataBinary;_&&!y&&(p=p.pipe(new c.Utf8EncodeWorker)),!_&&y&&(p=p.pipe(new c.Utf8DecodeWorker))}catch(k){(p=new d("error")).error(k)}return new i(p,x,"")},async:function(g,p){return this.internalStream(g).accumulate(p)},nodeStream:function(g,p){return this.internalStream(g||"nodebuffer").toNodejsStream(p)},_compressWorker:function(g,p){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,p)},_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.")},h=0;h<f.length;h++)s.prototype[f[h]]=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 p=s.document.createElement("script");p.onreadystatechange=function(){g(),p.onreadystatechange=null,p.parentNode.removeChild(p),p=null},s.document.documentElement.appendChild(p)}:function(){setTimeout(g,0)};else{var m=new s.MessageChannel;m.port1.onmessage=g,i=function(){m.port2.postMessage(0)}}var h=[];function g(){var p,x;l=!0;for(var y=h.length;y;){for(x=h,h=[],p=-1;++p<y;)x[p]();y=h.length}l=!1}r.exports=function(p){h.push(p)!==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(y){if(typeof y!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,y!==i&&p(this,y)}function m(y,_,k){this.promise=y,typeof _=="function"&&(this.onFulfilled=_,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function h(y,_,k){s(function(){var S;try{S=_(k)}catch(j){return l.reject(y,j)}S===y?l.reject(y,new TypeError("Cannot resolve promise with itself")):l.resolve(y,S)})}function g(y){var _=y&&y.then;if(y&&(typeof y=="object"||typeof y=="function")&&typeof _=="function")return function(){_.apply(y,arguments)}}function p(y,_){var k=!1;function S(N){k||(k=!0,l.reject(y,N))}function j(N){k||(k=!0,l.resolve(y,N))}var O=x(function(){_(j,S)});O.status==="error"&&S(O.value)}function x(y,_){var k={};try{k.value=y(_),k.status="success"}catch(S){k.status="error",k.value=S}return k}(r.exports=f).prototype.finally=function(y){if(typeof y!="function")return this;var _=this.constructor;return this.then(function(k){return _.resolve(y()).then(function(){return k})},function(k){return _.resolve(y()).then(function(){throw k})})},f.prototype.catch=function(y){return this.then(null,y)},f.prototype.then=function(y,_){if(typeof y!="function"&&this.state===u||typeof _!="function"&&this.state===c)return this;var k=new this.constructor(i);return this.state!==d?h(k,this.state===u?y:_,this.outcome):this.queue.push(new m(k,y,_)),k},m.prototype.callFulfilled=function(y){l.resolve(this.promise,y)},m.prototype.otherCallFulfilled=function(y){h(this.promise,this.onFulfilled,y)},m.prototype.callRejected=function(y){l.reject(this.promise,y)},m.prototype.otherCallRejected=function(y){h(this.promise,this.onRejected,y)},l.resolve=function(y,_){var k=x(g,_);if(k.status==="error")return l.reject(y,k.value);var S=k.value;if(S)p(y,S);else{y.state=u,y.outcome=_;for(var j=-1,O=y.queue.length;++j<O;)y.queue[j].callFulfilled(_)}return y},l.reject=function(y,_){y.state=c,y.outcome=_;for(var k=-1,S=y.queue.length;++k<S;)y.queue[k].callRejected(_);return y},f.resolve=function(y){return y instanceof this?y:l.resolve(new this(i),y)},f.reject=function(y){var _=new this(i);return l.reject(_,y)},f.all=function(y){var _=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=y.length,S=!1;if(!k)return this.resolve([]);for(var j=new Array(k),O=0,N=-1,A=new this(i);++N<k;)z(y[N],N);return A;function z(R,H){_.resolve(R).then(function(C){j[H]=C,++O!==k||S||(S=!0,l.resolve(A,j))},function(C){S||(S=!0,l.reject(A,C))})}},f.race=function(y){var _=this;if(Object.prototype.toString.call(y)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=y.length,S=!1;if(!k)return this.resolve([]);for(var j=-1,O=new this(i);++j<k;)N=y[j],_.resolve(N).then(function(A){S||(S=!0,l.resolve(O,A))},function(A){S||(S=!0,l.reject(O,A))});var N;return O}},{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,h=0,g=8;function p(y){if(!(this instanceof p))return new p(y);this.options=i.assign({level:m,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:h,to:""},y||{});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 S;if(S=typeof _.dictionary=="string"?l.string2buf(_.dictionary):d.call(_.dictionary)==="[object ArrayBuffer]"?new Uint8Array(_.dictionary):_.dictionary,(k=s.deflateSetDictionary(this.strm,S))!==f)throw new Error(c[k]);this._dict_set=!0}}function x(y,_){var k=new p(_);if(k.push(y,!0),k.err)throw k.msg||c[k.err];return k.result}p.prototype.push=function(y,_){var k,S,j=this.strm,O=this.options.chunkSize;if(this.ended)return!1;S=_===~~_?_:_===!0?4:0,typeof y=="string"?j.input=l.string2buf(y):d.call(y)==="[object ArrayBuffer]"?j.input=new Uint8Array(y):j.input=y,j.next_in=0,j.avail_in=j.input.length;do{if(j.avail_out===0&&(j.output=new i.Buf8(O),j.next_out=0,j.avail_out=O),(k=s.deflate(j,S))!==1&&k!==f)return this.onEnd(k),!(this.ended=!0);j.avail_out!==0&&(j.avail_in!==0||S!==4&&S!==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 S===4?(k=s.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===f):S!==2||(this.onEnd(f),!(j.avail_out=0))},p.prototype.onData=function(y){this.chunks.push(y)},p.prototype.onEnd=function(y){y===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=y,this.msg=this.strm.msg},o.Deflate=p,o.deflate=x,o.deflateRaw=function(y,_){return(_=_||{}).raw=!0,x(y,_)},o.gzip=function(y,_){return(_=_||{}).gzip=!0,x(y,_)}},{"./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 h(p){if(!(this instanceof h))return new h(p);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},p||{});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)||p&&p.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 y=s.inflateInit2(this.strm,x.windowBits);if(y!==c.Z_OK)throw new Error(u[y]);this.header=new f,s.inflateGetHeader(this.strm,this.header)}function g(p,x){var y=new h(x);if(y.push(p,!0),y.err)throw y.msg||u[y.err];return y.result}h.prototype.push=function(p,x){var y,_,k,S,j,O,N=this.strm,A=this.options.chunkSize,z=this.options.dictionary,R=!1;if(this.ended)return!1;_=x===~~x?x:x===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof p=="string"?N.input=l.binstring2buf(p):m.call(p)==="[object ArrayBuffer]"?N.input=new Uint8Array(p):N.input=p,N.next_in=0,N.avail_in=N.input.length;do{if(N.avail_out===0&&(N.output=new i.Buf8(A),N.next_out=0,N.avail_out=A),(y=s.inflate(N,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&z&&(O=typeof z=="string"?l.string2buf(z):m.call(z)==="[object ArrayBuffer]"?new Uint8Array(z):z,y=s.inflateSetDictionary(this.strm,O)),y===c.Z_BUF_ERROR&&R===!0&&(y=c.Z_OK,R=!1),y!==c.Z_STREAM_END&&y!==c.Z_OK)return this.onEnd(y),!(this.ended=!0);N.next_out&&(N.avail_out!==0&&y!==c.Z_STREAM_END&&(N.avail_in!==0||_!==c.Z_FINISH&&_!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=l.utf8border(N.output,N.next_out),S=N.next_out-k,j=l.buf2string(N.output,k),N.next_out=S,N.avail_out=A-S,S&&i.arraySet(N.output,N.output,k,S,0),this.onData(j)):this.onData(i.shrinkBuf(N.output,N.next_out)))),N.avail_in===0&&N.avail_out===0&&(R=!0)}while((0<N.avail_in||N.avail_out===0)&&y!==c.Z_STREAM_END);return y===c.Z_STREAM_END&&(_=c.Z_FINISH),_===c.Z_FINISH?(y=s.inflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===c.Z_OK):_!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(N.avail_out=0))},h.prototype.onData=function(p){this.chunks.push(p)},h.prototype.onEnd=function(p){p===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=p,this.msg=this.strm.msg},o.Inflate=h,o.inflate=g,o.inflateRaw=function(p,x){return(x=x||{}).raw=!0,g(p,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 h=0;h<f;h++)c[m+h]=u[d+h]},flattenChunks:function(c){var u,d,f,m,h,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++)h=c[u],g.set(h,m),m+=h.length;return g}},l={arraySet:function(c,u,d,f,m){for(var h=0;h<f;h++)c[m+h]=u[d+h]},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 h="",g=0;g<m;g++)h+=String.fromCharCode(f[g]);return h}c[254]=c[254]=1,o.string2buf=function(f){var m,h,g,p,x,y=f.length,_=0;for(p=0;p<y;p++)(64512&(h=f.charCodeAt(p)))==55296&&p+1<y&&(64512&(g=f.charCodeAt(p+1)))==56320&&(h=65536+(h-55296<<10)+(g-56320),p++),_+=h<128?1:h<2048?2:h<65536?3:4;for(m=new s.Buf8(_),p=x=0;x<_;p++)(64512&(h=f.charCodeAt(p)))==55296&&p+1<y&&(64512&(g=f.charCodeAt(p+1)))==56320&&(h=65536+(h-55296<<10)+(g-56320),p++),h<128?m[x++]=h:(h<2048?m[x++]=192|h>>>6:(h<65536?m[x++]=224|h>>>12:(m[x++]=240|h>>>18,m[x++]=128|h>>>12&63),m[x++]=128|h>>>6&63),m[x++]=128|63&h);return m},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var m=new s.Buf8(f.length),h=0,g=m.length;h<g;h++)m[h]=f.charCodeAt(h);return m},o.buf2string=function(f,m){var h,g,p,x,y=m||f.length,_=new Array(2*y);for(h=g=0;h<y;)if((p=f[h++])<128)_[g++]=p;else if(4<(x=c[p]))_[g++]=65533,h+=x-1;else{for(p&=x===2?31:x===3?15:7;1<x&&h<y;)p=p<<6|63&f[h++],x--;1<x?_[g++]=65533:p<65536?_[g++]=p:(p-=65536,_[g++]=55296|p>>10&1023,_[g++]=56320|1023&p)}return d(_,g)},o.utf8border=function(f,m){var h;for((m=m||f.length)>f.length&&(m=f.length),h=m-1;0<=h&&(192&f[h])==128;)h--;return h<0||h===0?m:h+c[f[h]]>m?h: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,h=0,g=-2,p=-1,x=4,y=2,_=8,k=9,S=286,j=30,O=19,N=2*S+1,A=15,z=3,R=258,H=R+z+1,C=42,I=113,b=1,D=2,K=3,L=4;function U(w,Y){return w.msg=d[Y],Y}function J(w){return(w<<1)-(4<w?9:0)}function se(w){for(var Y=w.length;0<=--Y;)w[Y]=0}function B(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,B(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 q(w,Y){var V,T,E=w.max_chain_length,M=w.strstart,F=w.prev_length,W=w.nice_match,P=w.strstart>w.w_size-H?w.strstart-(w.w_size-H):0,Q=w.window,re=w.w_mask,te=w.prev,pe=w.strstart+R,Ae=Q[M+F-1],ke=Q[M+F];w.prev_length>=w.good_match&&(E>>=2),W>w.lookahead&&(W=w.lookahead);do if(Q[(V=Y)+F]===ke&&Q[V+F-1]===Ae&&Q[V]===Q[M]&&Q[++V]===Q[M+1]){M+=2,V++;do;while(Q[++M]===Q[++V]&&Q[++M]===Q[++V]&&Q[++M]===Q[++V]&&Q[++M]===Q[++V]&&Q[++M]===Q[++V]&&Q[++M]===Q[++V]&&Q[++M]===Q[++V]&&Q[++M]===Q[++V]&&M<pe);if(T=R-(pe-M),M=pe-R,F<T){if(w.match_start=Y,W<=(F=T))break;Ae=Q[M+F-1],ke=Q[M+F]}}while((Y=te[Y&re])>P&&--E!=0);return F<=w.lookahead?F:w.lookahead}function ue(w){var Y,V,T,E,M,F,W,P,Q,re,te=w.w_size;do{if(E=w.window_size-w.lookahead-w.strstart,w.strstart>=te+(te-H)){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;);E+=te}if(w.strm.avail_in===0)break;if(F=w.strm,W=w.window,P=w.strstart+w.lookahead,Q=E,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,P),F.state.wrap===1?F.adler=c(F.adler,W,re,P):F.state.wrap===2&&(F.adler=u(F.adler,W,re,P)),F.next_in+=re,F.total_in+=re,re),w.lookahead+=V,w.lookahead+w.insert>=z)for(M=w.strstart-w.insert,w.ins_h=w.window[M],w.ins_h=(w.ins_h<<w.hash_shift^w.window[M+1])&w.hash_mask;w.insert&&(w.ins_h=(w.ins_h<<w.hash_shift^w.window[M+z-1])&w.hash_mask,w.prev[M&w.w_mask]=w.head[w.ins_h],w.head[w.ins_h]=M,M++,w.insert--,!(w.lookahead+w.insert<z)););}while(w.lookahead<H&&w.strm.avail_in!==0)}function X(w,Y){for(var V,T;;){if(w.lookahead<H){if(ue(w),w.lookahead<H&&Y===f)return b;if(w.lookahead===0)break}if(V=0,w.lookahead>=z&&(w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+z-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-H&&(w.match_length=q(w,V)),w.match_length>=z)if(T=l._tr_tally(w,w.strstart-w.match_start,w.match_length-z),w.lookahead-=w.match_length,w.match_length<=w.max_lazy_match&&w.lookahead>=z){for(w.match_length--;w.strstart++,w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+z-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<z-1?w.strstart:z-1,Y===m?($(w,!0),w.strm.avail_out===0?K:L):w.last_lit&&($(w,!1),w.strm.avail_out===0)?b:D}function ie(w,Y){for(var V,T,E;;){if(w.lookahead<H){if(ue(w),w.lookahead<H&&Y===f)return b;if(w.lookahead===0)break}if(V=0,w.lookahead>=z&&(w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+z-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=z-1,V!==0&&w.prev_length<w.max_lazy_match&&w.strstart-V<=w.w_size-H&&(w.match_length=q(w,V),w.match_length<=5&&(w.strategy===1||w.match_length===z&&4096<w.strstart-w.match_start)&&(w.match_length=z-1)),w.prev_length>=z&&w.match_length<=w.prev_length){for(E=w.strstart+w.lookahead-z,T=l._tr_tally(w,w.strstart-1-w.prev_match,w.prev_length-z),w.lookahead-=w.prev_length-1,w.prev_length-=2;++w.strstart<=E&&(w.ins_h=(w.ins_h<<w.hash_shift^w.window[w.strstart+z-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=z-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<z-1?w.strstart:z-1,Y===m?($(w,!0),w.strm.avail_out===0?K:L):w.last_lit&&($(w,!1),w.strm.avail_out===0)?b:D}function ae(w,Y,V,T,E){this.good_length=w,this.max_lazy=Y,this.nice_length=V,this.max_chain=T,this.func=E}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*N),this.dyn_dtree=new i.Buf16(2*(2*j+1)),this.bl_tree=new i.Buf16(2*(2*O+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*S+1),se(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*S+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=y,(Y=w.state).pending=0,Y.pending_out=0,Y.wrap<0&&(Y.wrap=-Y.wrap),Y.status=Y.wrap?C:I,w.adler=Y.wrap===2?0:1,Y.last_flush=f,l._tr_init(Y),h):U(w,g)}function we(w){var Y=fe(w);return Y===h&&(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=z-1,V.match_available=0,V.ins_h=0})(w.state),Y}function Te(w,Y,V,T,E,M){if(!w)return g;var F=1;if(Y===p&&(Y=6),T<0?(F=0,T=-T):15<T&&(F=2,T-=16),E<1||k<E||V!==_||T<8||15<T||Y<0||9<Y||M<0||x<M)return U(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=E+7,W.hash_size=1<<W.hash_bits,W.hash_mask=W.hash_size-1,W.hash_shift=~~((W.hash_bits+z-1)/z),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<<E+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=M,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-H&&($(w,!1),w.strm.avail_out===0))return b}return w.insert=0,Y===m?($(w,!0),w.strm.avail_out===0?K: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,h):g},o.deflate=function(w,Y){var V,T,E,M;if(!w||!w.state||5<Y||Y<0)return w?U(w,g):g;if(T=w.state,!w.output||!w.input&&w.avail_in!==0||T.status===666&&Y!==m)return U(w,w.avail_out===0?-5:g);if(T.strm=w,V=T.last_flush,T.last_flush=Y,T.status===C)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(E=T.pending;T.gzindex<(65535&T.gzhead.extra.length)&&(T.pending!==T.pending_buf_size||(T.gzhead.hcrc&&T.pending>E&&(w.adler=u(w.adler,T.pending_buf,T.pending-E,E)),B(w),E=T.pending,T.pending!==T.pending_buf_size));)oe(T,255&T.gzhead.extra[T.gzindex]),T.gzindex++;T.gzhead.hcrc&&T.pending>E&&(w.adler=u(w.adler,T.pending_buf,T.pending-E,E)),T.gzindex===T.gzhead.extra.length&&(T.gzindex=0,T.status=73)}else T.status=73;if(T.status===73)if(T.gzhead.name){E=T.pending;do{if(T.pending===T.pending_buf_size&&(T.gzhead.hcrc&&T.pending>E&&(w.adler=u(w.adler,T.pending_buf,T.pending-E,E)),B(w),E=T.pending,T.pending===T.pending_buf_size)){M=1;break}M=T.gzindex<T.gzhead.name.length?255&T.gzhead.name.charCodeAt(T.gzindex++):0,oe(T,M)}while(M!==0);T.gzhead.hcrc&&T.pending>E&&(w.adler=u(w.adler,T.pending_buf,T.pending-E,E)),M===0&&(T.gzindex=0,T.status=91)}else T.status=91;if(T.status===91)if(T.gzhead.comment){E=T.pending;do{if(T.pending===T.pending_buf_size&&(T.gzhead.hcrc&&T.pending>E&&(w.adler=u(w.adler,T.pending_buf,T.pending-E,E)),B(w),E=T.pending,T.pending===T.pending_buf_size)){M=1;break}M=T.gzindex<T.gzhead.comment.length?255&T.gzhead.comment.charCodeAt(T.gzindex++):0,oe(T,M)}while(M!==0);T.gzhead.hcrc&&T.pending>E&&(w.adler=u(w.adler,T.pending_buf,T.pending-E,E)),M===0&&(T.status=103)}else T.status=103;if(T.status===103&&(T.gzhead.hcrc?(T.pending+2>T.pending_buf_size&&B(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(B(w),w.avail_out===0)return T.last_flush=-1,h}else if(w.avail_in===0&&J(Y)<=J(V)&&Y!==m)return U(w,-5);if(T.status===666&&w.avail_in!==0)return U(w,-5);if(w.avail_in!==0||T.lookahead!==0||Y!==f&&T.status!==666){var W=T.strategy===2?(function(P,Q){for(var re;;){if(P.lookahead===0&&(ue(P),P.lookahead===0)){if(Q===f)return b;break}if(P.match_length=0,re=l._tr_tally(P,0,P.window[P.strstart]),P.lookahead--,P.strstart++,re&&($(P,!1),P.strm.avail_out===0))return b}return P.insert=0,Q===m?($(P,!0),P.strm.avail_out===0?K:L):P.last_lit&&($(P,!1),P.strm.avail_out===0)?b:D})(T,Y):T.strategy===3?(function(P,Q){for(var re,te,pe,Ae,ke=P.window;;){if(P.lookahead<=R){if(ue(P),P.lookahead<=R&&Q===f)return b;if(P.lookahead===0)break}if(P.match_length=0,P.lookahead>=z&&0<P.strstart&&(te=ke[pe=P.strstart-1])===ke[++pe]&&te===ke[++pe]&&te===ke[++pe]){Ae=P.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);P.match_length=R-(Ae-pe),P.match_length>P.lookahead&&(P.match_length=P.lookahead)}if(P.match_length>=z?(re=l._tr_tally(P,1,P.match_length-z),P.lookahead-=P.match_length,P.strstart+=P.match_length,P.match_length=0):(re=l._tr_tally(P,0,P.window[P.strstart]),P.lookahead--,P.strstart++),re&&($(P,!1),P.strm.avail_out===0))return b}return P.insert=0,Q===m?($(P,!0),P.strm.avail_out===0?K:L):P.last_lit&&($(P,!1),P.strm.avail_out===0)?b:D})(T,Y):s[T.level].func(T,Y);if(W!==K&&W!==L||(T.status=666),W===b||W===K)return w.avail_out===0&&(T.last_flush=-1),h;if(W===D&&(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))),B(w),w.avail_out===0))return T.last_flush=-1,h}return Y!==m?h: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)),B(w),0<T.wrap&&(T.wrap=-T.wrap),T.pending!==0?h:1)},o.deflateEnd=function(w){var Y;return w&&w.state?(Y=w.state.status)!==C&&Y!==69&&Y!==73&&Y!==91&&Y!==103&&Y!==I&&Y!==666?U(w,g):(w.state=null,Y===I?U(w,-3):h):g},o.deflateSetDictionary=function(w,Y){var V,T,E,M,F,W,P,Q,re=Y.length;if(!w||!w.state||(M=(V=w.state).wrap)===2||M===1&&V.status!==C||V.lookahead)return g;for(M===1&&(w.adler=c(w.adler,Y,re,0)),V.wrap=0,re>=V.w_size&&(M===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,P=w.input,w.avail_in=re,w.next_in=0,w.input=Y,ue(V);V.lookahead>=z;){for(T=V.strstart,E=V.lookahead-(z-1);V.ins_h=(V.ins_h<<V.hash_shift^V.window[T+z-1])&V.hash_mask,V.prev[T&V.w_mask]=V.head[V.ins_h],V.head[V.ins_h]=T,T++,--E;);V.strstart=T,V.lookahead=z-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=z-1,V.match_available=0,w.next_in=W,w.input=P,w.avail_in=F,V.wrap=M,h},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,h,g,p,x,y,_,k,S,j,O,N,A,z,R,H,C,I,b,D;l=s.state,c=s.next_in,b=s.input,u=c+(s.avail_in-5),d=s.next_out,D=s.output,f=d-(i-s.avail_out),m=d+(s.avail_out-257),h=l.dmax,g=l.wsize,p=l.whave,x=l.wnext,y=l.window,_=l.hold,k=l.bits,S=l.lencode,j=l.distcode,O=(1<<l.lenbits)-1,N=(1<<l.distbits)-1;e:do{k<15&&(_+=b[c++]<<k,k+=8,_+=b[c++]<<k,k+=8),A=S[_&O];t:for(;;){if(_>>>=z=A>>>24,k-=z,(z=A>>>16&255)===0)D[d++]=65535&A;else{if(!(16&z)){if((64&z)==0){A=S[(65535&A)+(_&(1<<z)-1)];continue t}if(32&z){l.mode=12;break e}s.msg="invalid literal/length code",l.mode=30;break e}R=65535&A,(z&=15)&&(k<z&&(_+=b[c++]<<k,k+=8),R+=_&(1<<z)-1,_>>>=z,k-=z),k<15&&(_+=b[c++]<<k,k+=8,_+=b[c++]<<k,k+=8),A=j[_&N];n:for(;;){if(_>>>=z=A>>>24,k-=z,!(16&(z=A>>>16&255))){if((64&z)==0){A=j[(65535&A)+(_&(1<<z)-1)];continue n}s.msg="invalid distance code",l.mode=30;break e}if(H=65535&A,k<(z&=15)&&(_+=b[c++]<<k,(k+=8)<z&&(_+=b[c++]<<k,k+=8)),h<(H+=_&(1<<z)-1)){s.msg="invalid distance too far back",l.mode=30;break e}if(_>>>=z,k-=z,(z=d-f)<H){if(p<(z=H-z)&&l.sane){s.msg="invalid distance too far back",l.mode=30;break e}if(I=y,(C=0)===x){if(C+=g-z,z<R){for(R-=z;D[d++]=y[C++],--z;);C=d-H,I=D}}else if(x<z){if(C+=g+x-z,(z-=x)<R){for(R-=z;D[d++]=y[C++],--z;);if(C=0,x<R){for(R-=z=x;D[d++]=y[C++],--z;);C=d-H,I=D}}}else if(C+=x-z,z<R){for(R-=z;D[d++]=y[C++],--z;);C=d-H,I=D}for(;2<R;)D[d++]=I[C++],D[d++]=I[C++],D[d++]=I[C++],R-=3;R&&(D[d++]=I[C++],1<R&&(D[d++]=I[C++]))}else{for(C=d-H;D[d++]=D[C++],D[d++]=D[C++],D[d++]=D[C++],2<(R-=3););R&&(D[d++]=D[C++],1<R&&(D[d++]=D[C++]))}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,h=-2,g=1,p=852,x=592;function y(C){return(C>>>24&255)+(C>>>8&65280)+((65280&C)<<8)+((255&C)<<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(C){var I;return C&&C.state?(I=C.state,C.total_in=C.total_out=I.total=0,C.msg="",I.wrap&&(C.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(p),I.distcode=I.distdyn=new s.Buf32(x),I.sane=1,I.back=-1,m):h}function S(C){var I;return C&&C.state?((I=C.state).wsize=0,I.whave=0,I.wnext=0,k(C)):h}function j(C,I){var b,D;return C&&C.state?(D=C.state,I<0?(b=0,I=-I):(b=1+(I>>4),I<48&&(I&=15)),I&&(I<8||15<I)?h:(D.window!==null&&D.wbits!==I&&(D.window=null),D.wrap=b,D.wbits=I,S(C))):h}function O(C,I){var b,D;return C?(D=new _,(C.state=D).window=null,(b=j(C,I))!==m&&(C.state=null),b):h}var N,A,z=!0;function R(C){if(z){var I;for(N=new s.Buf32(512),A=new s.Buf32(32),I=0;I<144;)C.lens[I++]=8;for(;I<256;)C.lens[I++]=9;for(;I<280;)C.lens[I++]=7;for(;I<288;)C.lens[I++]=8;for(u(d,C.lens,0,288,N,0,C.work,{bits:9}),I=0;I<32;)C.lens[I++]=5;u(f,C.lens,0,32,A,0,C.work,{bits:5}),z=!1}C.lencode=N,C.lenbits=9,C.distcode=A,C.distbits=5}function H(C,I,b,D){var K,L=C.state;return L.window===null&&(L.wsize=1<<L.wbits,L.wnext=0,L.whave=0,L.window=new s.Buf8(L.wsize)),D>=L.wsize?(s.arraySet(L.window,I,b-L.wsize,L.wsize,0),L.wnext=0,L.whave=L.wsize):(D<(K=L.wsize-L.wnext)&&(K=D),s.arraySet(L.window,I,b-D,K,L.wnext),(D-=K)?(s.arraySet(L.window,I,b-D,D,0),L.wnext=D,L.whave=L.wsize):(L.wnext+=K,L.wnext===L.wsize&&(L.wnext=0),L.whave<L.wsize&&(L.whave+=K))),0}o.inflateReset=S,o.inflateReset2=j,o.inflateResetKeep=k,o.inflateInit=function(C){return O(C,15)},o.inflateInit2=O,o.inflate=function(C,I){var b,D,K,L,U,J,se,B,$,oe,ee,q,ue,X,ie,ae,he,fe,we,Te,w,Y,V,T,E=0,M=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(!C||!C.state||!C.output||!C.input&&C.avail_in!==0)return h;(b=C.state).mode===12&&(b.mode=13),U=C.next_out,K=C.output,se=C.avail_out,L=C.next_in,D=C.input,J=C.avail_in,B=b.hold,$=b.bits,oe=J,ee=se,Y=m;e:for(;;)switch(b.mode){case g:if(b.wrap===0){b.mode=13;break}for(;$<16;){if(J===0)break e;J--,B+=D[L++]<<$,$+=8}if(2&b.wrap&&B===35615){M[b.check=0]=255&B,M[1]=B>>>8&255,b.check=l(b.check,M,2,0),$=B=0,b.mode=2;break}if(b.flags=0,b.head&&(b.head.done=!1),!(1&b.wrap)||(((255&B)<<8)+(B>>8))%31){C.msg="incorrect header check",b.mode=30;break}if((15&B)!=8){C.msg="unknown compression method",b.mode=30;break}if($-=4,w=8+(15&(B>>>=4)),b.wbits===0)b.wbits=w;else if(w>b.wbits){C.msg="invalid window size",b.mode=30;break}b.dmax=1<<w,C.adler=b.check=1,b.mode=512&B?10:12,$=B=0;break;case 2:for(;$<16;){if(J===0)break e;J--,B+=D[L++]<<$,$+=8}if(b.flags=B,(255&b.flags)!=8){C.msg="unknown compression method",b.mode=30;break}if(57344&b.flags){C.msg="unknown header flags set",b.mode=30;break}b.head&&(b.head.text=B>>8&1),512&b.flags&&(M[0]=255&B,M[1]=B>>>8&255,b.check=l(b.check,M,2,0)),$=B=0,b.mode=3;case 3:for(;$<32;){if(J===0)break e;J--,B+=D[L++]<<$,$+=8}b.head&&(b.head.time=B),512&b.flags&&(M[0]=255&B,M[1]=B>>>8&255,M[2]=B>>>16&255,M[3]=B>>>24&255,b.check=l(b.check,M,4,0)),$=B=0,b.mode=4;case 4:for(;$<16;){if(J===0)break e;J--,B+=D[L++]<<$,$+=8}b.head&&(b.head.xflags=255&B,b.head.os=B>>8),512&b.flags&&(M[0]=255&B,M[1]=B>>>8&255,b.check=l(b.check,M,2,0)),$=B=0,b.mode=5;case 5:if(1024&b.flags){for(;$<16;){if(J===0)break e;J--,B+=D[L++]<<$,$+=8}b.length=B,b.head&&(b.head.extra_len=B),512&b.flags&&(M[0]=255&B,M[1]=B>>>8&255,b.check=l(b.check,M,2,0)),$=B=0}else b.head&&(b.head.extra=null);b.mode=6;case 6:if(1024&b.flags&&(J<(q=b.length)&&(q=J),q&&(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,D,L,q,w)),512&b.flags&&(b.check=l(b.check,D,q,L)),J-=q,L+=q,b.length-=q),b.length))break e;b.length=0,b.mode=7;case 7:if(2048&b.flags){if(J===0)break e;for(q=0;w=D[L+q++],b.head&&w&&b.length<65536&&(b.head.name+=String.fromCharCode(w)),w&&q<J;);if(512&b.flags&&(b.check=l(b.check,D,q,L)),J-=q,L+=q,w)break e}else b.head&&(b.head.name=null);b.length=0,b.mode=8;case 8:if(4096&b.flags){if(J===0)break e;for(q=0;w=D[L+q++],b.head&&w&&b.length<65536&&(b.head.comment+=String.fromCharCode(w)),w&&q<J;);if(512&b.flags&&(b.check=l(b.check,D,q,L)),J-=q,L+=q,w)break e}else b.head&&(b.head.comment=null);b.mode=9;case 9:if(512&b.flags){for(;$<16;){if(J===0)break e;J--,B+=D[L++]<<$,$+=8}if(B!==(65535&b.check)){C.msg="header crc mismatch",b.mode=30;break}$=B=0}b.head&&(b.head.hcrc=b.flags>>9&1,b.head.done=!0),C.adler=b.check=0,b.mode=12;break;case 10:for(;$<32;){if(J===0)break e;J--,B+=D[L++]<<$,$+=8}C.adler=b.check=y(B),$=B=0,b.mode=11;case 11:if(b.havedict===0)return C.next_out=U,C.avail_out=se,C.next_in=L,C.avail_in=J,b.hold=B,b.bits=$,2;C.adler=b.check=1,b.mode=12;case 12:if(I===5||I===6)break e;case 13:if(b.last){B>>>=7&$,$-=7&$,b.mode=27;break}for(;$<3;){if(J===0)break e;J--,B+=D[L++]<<$,$+=8}switch(b.last=1&B,$-=1,3&(B>>>=1)){case 0:b.mode=14;break;case 1:if(R(b),b.mode=20,I!==6)break;B>>>=2,$-=2;break e;case 2:b.mode=17;break;case 3:C.msg="invalid block type",b.mode=30}B>>>=2,$-=2;break;case 14:for(B>>>=7&$,$-=7&$;$<32;){if(J===0)break e;J--,B+=D[L++]<<$,$+=8}if((65535&B)!=(B>>>16^65535)){C.msg="invalid stored block lengths",b.mode=30;break}if(b.length=65535&B,$=B=0,b.mode=15,I===6)break e;case 15:b.mode=16;case 16:if(q=b.length){if(J<q&&(q=J),se<q&&(q=se),q===0)break e;s.arraySet(K,D,L,q,U),J-=q,L+=q,se-=q,U+=q,b.length-=q;break}b.mode=12;break;case 17:for(;$<14;){if(J===0)break e;J--,B+=D[L++]<<$,$+=8}if(b.nlen=257+(31&B),B>>>=5,$-=5,b.ndist=1+(31&B),B>>>=5,$-=5,b.ncode=4+(15&B),B>>>=4,$-=4,286<b.nlen||30<b.ndist){C.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(J===0)break e;J--,B+=D[L++]<<$,$+=8}b.lens[F[b.have++]]=7&B,B>>>=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){C.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=(E=b.lencode[B&(1<<b.lenbits)-1])>>>16&255,he=65535&E,!((ie=E>>>24)<=$);){if(J===0)break e;J--,B+=D[L++]<<$,$+=8}if(he<16)B>>>=ie,$-=ie,b.lens[b.have++]=he;else{if(he===16){for(T=ie+2;$<T;){if(J===0)break e;J--,B+=D[L++]<<$,$+=8}if(B>>>=ie,$-=ie,b.have===0){C.msg="invalid bit length repeat",b.mode=30;break}w=b.lens[b.have-1],q=3+(3&B),B>>>=2,$-=2}else if(he===17){for(T=ie+3;$<T;){if(J===0)break e;J--,B+=D[L++]<<$,$+=8}$-=ie,w=0,q=3+(7&(B>>>=ie)),B>>>=3,$-=3}else{for(T=ie+7;$<T;){if(J===0)break e;J--,B+=D[L++]<<$,$+=8}$-=ie,w=0,q=11+(127&(B>>>=ie)),B>>>=7,$-=7}if(b.have+q>b.nlen+b.ndist){C.msg="invalid bit length repeat",b.mode=30;break}for(;q--;)b.lens[b.have++]=w}}if(b.mode===30)break;if(b.lens[256]===0){C.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){C.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){C.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<=J&&258<=se){C.next_out=U,C.avail_out=se,C.next_in=L,C.avail_in=J,b.hold=B,b.bits=$,c(C,ee),U=C.next_out,K=C.output,se=C.avail_out,L=C.next_in,D=C.input,J=C.avail_in,B=b.hold,$=b.bits,b.mode===12&&(b.back=-1);break}for(b.back=0;ae=(E=b.lencode[B&(1<<b.lenbits)-1])>>>16&255,he=65535&E,!((ie=E>>>24)<=$);){if(J===0)break e;J--,B+=D[L++]<<$,$+=8}if(ae&&(240&ae)==0){for(fe=ie,we=ae,Te=he;ae=(E=b.lencode[Te+((B&(1<<fe+we)-1)>>fe)])>>>16&255,he=65535&E,!(fe+(ie=E>>>24)<=$);){if(J===0)break e;J--,B+=D[L++]<<$,$+=8}B>>>=fe,$-=fe,b.back+=fe}if(B>>>=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){C.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(J===0)break e;J--,B+=D[L++]<<$,$+=8}b.length+=B&(1<<b.extra)-1,B>>>=b.extra,$-=b.extra,b.back+=b.extra}b.was=b.length,b.mode=23;case 23:for(;ae=(E=b.distcode[B&(1<<b.distbits)-1])>>>16&255,he=65535&E,!((ie=E>>>24)<=$);){if(J===0)break e;J--,B+=D[L++]<<$,$+=8}if((240&ae)==0){for(fe=ie,we=ae,Te=he;ae=(E=b.distcode[Te+((B&(1<<fe+we)-1)>>fe)])>>>16&255,he=65535&E,!(fe+(ie=E>>>24)<=$);){if(J===0)break e;J--,B+=D[L++]<<$,$+=8}B>>>=fe,$-=fe,b.back+=fe}if(B>>>=ie,$-=ie,b.back+=ie,64&ae){C.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(J===0)break e;J--,B+=D[L++]<<$,$+=8}b.offset+=B&(1<<b.extra)-1,B>>>=b.extra,$-=b.extra,b.back+=b.extra}if(b.offset>b.dmax){C.msg="invalid distance too far back",b.mode=30;break}b.mode=25;case 25:if(se===0)break e;if(q=ee-se,b.offset>q){if((q=b.offset-q)>b.whave&&b.sane){C.msg="invalid distance too far back",b.mode=30;break}ue=q>b.wnext?(q-=b.wnext,b.wsize-q):b.wnext-q,q>b.length&&(q=b.length),X=b.window}else X=K,ue=U-b.offset,q=b.length;for(se<q&&(q=se),se-=q,b.length-=q;K[U++]=X[ue++],--q;);b.length===0&&(b.mode=21);break;case 26:if(se===0)break e;K[U++]=b.length,se--,b.mode=21;break;case 27:if(b.wrap){for(;$<32;){if(J===0)break e;J--,B|=D[L++]<<$,$+=8}if(ee-=se,C.total_out+=ee,b.total+=ee,ee&&(C.adler=b.check=b.flags?l(b.check,K,ee,U-ee):i(b.check,K,ee,U-ee)),ee=se,(b.flags?B:y(B))!==b.check){C.msg="incorrect data check",b.mode=30;break}$=B=0}b.mode=28;case 28:if(b.wrap&&b.flags){for(;$<32;){if(J===0)break e;J--,B+=D[L++]<<$,$+=8}if(B!==(4294967295&b.total)){C.msg="incorrect length check",b.mode=30;break}$=B=0}b.mode=29;case 29:Y=1;break e;case 30:Y=-3;break e;case 31:return-4;default:return h}return C.next_out=U,C.avail_out=se,C.next_in=L,C.avail_in=J,b.hold=B,b.bits=$,(b.wsize||ee!==C.avail_out&&b.mode<30&&(b.mode<27||I!==4))&&H(C,C.output,C.next_out,ee-C.avail_out)?(b.mode=31,-4):(oe-=C.avail_in,ee-=C.avail_out,C.total_in+=oe,C.total_out+=ee,b.total+=ee,b.wrap&&ee&&(C.adler=b.check=b.flags?l(b.check,K,ee,C.next_out-ee):i(b.check,K,ee,C.next_out-ee)),C.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(C){if(!C||!C.state)return h;var I=C.state;return I.window&&(I.window=null),C.state=null,m},o.inflateGetHeader=function(C,I){var b;return C&&C.state?(2&(b=C.state).wrap)==0?h:((b.head=I).done=!1,m):h},o.inflateSetDictionary=function(C,I){var b,D=I.length;return C&&C.state?(b=C.state).wrap!==0&&b.mode!==11?h:b.mode===11&&i(1,I,D,0)!==b.check?-3:H(C,I,D,D)?(b.mode=31,-4):(b.havedict=1,m):h},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,h,g,p,x,y){var _,k,S,j,O,N,A,z,R,H=y.bits,C=0,I=0,b=0,D=0,K=0,L=0,U=0,J=0,se=0,B=0,$=null,oe=0,ee=new s.Buf16(16),q=new s.Buf16(16),ue=null,X=0;for(C=0;C<=15;C++)ee[C]=0;for(I=0;I<h;I++)ee[f[m+I]]++;for(K=H,D=15;1<=D&&ee[D]===0;D--);if(D<K&&(K=D),D===0)return g[p++]=20971520,g[p++]=20971520,y.bits=1,0;for(b=1;b<D&&ee[b]===0;b++);for(K<b&&(K=b),C=J=1;C<=15;C++)if(J<<=1,(J-=ee[C])<0)return-1;if(0<J&&(d===0||D!==1))return-1;for(q[1]=0,C=1;C<15;C++)q[C+1]=q[C]+ee[C];for(I=0;I<h;I++)f[m+I]!==0&&(x[q[f[m+I]]++]=I);if(N=d===0?($=ue=x,19):d===1?($=i,oe-=257,ue=l,X-=257,256):($=c,ue=u,-1),C=b,O=p,U=I=B=0,S=-1,j=(se=1<<(L=K))-1,d===1&&852<se||d===2&&592<se)return 1;for(;;){for(A=C-U,R=x[I]<N?(z=0,x[I]):x[I]>N?(z=ue[X+x[I]],$[oe+x[I]]):(z=96,0),_=1<<C-U,b=k=1<<L;g[O+(B>>U)+(k-=_)]=A<<24|z<<16|R|0,k!==0;);for(_=1<<C-1;B&_;)_>>=1;if(_!==0?(B&=_-1,B+=_):B=0,I++,--ee[C]==0){if(C===D)break;C=f[m+x[I]]}if(K<C&&(B&j)!==S){for(U===0&&(U=K),O+=b,J=1<<(L=C-U);L+U<D&&!((J-=ee[L+U])<=0);)L++,J<<=1;if(se+=1<<L,d===1&&852<se||d===2&&592<se)return 1;g[S=B&j]=K<<24|L<<16|O-p|0}}return B!==0&&(g[O+B]=C-U<<24|64<<16|0),y.bits=K,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(E){for(var M=E.length;0<=--M;)E[M]=0}var u=0,d=29,f=256,m=f+1+d,h=30,g=19,p=2*m+1,x=15,y=16,_=7,k=256,S=16,j=17,O=18,N=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],A=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],z=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],R=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],H=new Array(2*(m+2));c(H);var C=new Array(2*h);c(C);var I=new Array(512);c(I);var b=new Array(256);c(b);var D=new Array(d);c(D);var K,L,U,J=new Array(h);function se(E,M,F,W,P){this.static_tree=E,this.extra_bits=M,this.extra_base=F,this.elems=W,this.max_length=P,this.has_stree=E&&E.length}function B(E,M){this.dyn_tree=E,this.max_code=0,this.stat_desc=M}function $(E){return E<256?I[E]:I[256+(E>>>7)]}function oe(E,M){E.pending_buf[E.pending++]=255&M,E.pending_buf[E.pending++]=M>>>8&255}function ee(E,M,F){E.bi_valid>y-F?(E.bi_buf|=M<<E.bi_valid&65535,oe(E,E.bi_buf),E.bi_buf=M>>y-E.bi_valid,E.bi_valid+=F-y):(E.bi_buf|=M<<E.bi_valid&65535,E.bi_valid+=F)}function q(E,M,F){ee(E,F[2*M],F[2*M+1])}function ue(E,M){for(var F=0;F|=1&E,E>>>=1,F<<=1,0<--M;);return F>>>1}function X(E,M,F){var W,P,Q=new Array(x+1),re=0;for(W=1;W<=x;W++)Q[W]=re=re+F[W-1]<<1;for(P=0;P<=M;P++){var te=E[2*P+1];te!==0&&(E[2*P]=ue(Q[te]++,te))}}function ie(E){var M;for(M=0;M<m;M++)E.dyn_ltree[2*M]=0;for(M=0;M<h;M++)E.dyn_dtree[2*M]=0;for(M=0;M<g;M++)E.bl_tree[2*M]=0;E.dyn_ltree[2*k]=1,E.opt_len=E.static_len=0,E.last_lit=E.matches=0}function ae(E){8<E.bi_valid?oe(E,E.bi_buf):0<E.bi_valid&&(E.pending_buf[E.pending++]=E.bi_buf),E.bi_buf=0,E.bi_valid=0}function he(E,M,F,W){var P=2*M,Q=2*F;return E[P]<E[Q]||E[P]===E[Q]&&W[M]<=W[F]}function fe(E,M,F){for(var W=E.heap[F],P=F<<1;P<=E.heap_len&&(P<E.heap_len&&he(M,E.heap[P+1],E.heap[P],E.depth)&&P++,!he(M,W,E.heap[P],E.depth));)E.heap[F]=E.heap[P],F=P,P<<=1;E.heap[F]=W}function we(E,M,F){var W,P,Q,re,te=0;if(E.last_lit!==0)for(;W=E.pending_buf[E.d_buf+2*te]<<8|E.pending_buf[E.d_buf+2*te+1],P=E.pending_buf[E.l_buf+te],te++,W===0?q(E,P,M):(q(E,(Q=b[P])+f+1,M),(re=N[Q])!==0&&ee(E,P-=D[Q],re),q(E,Q=$(--W),F),(re=A[Q])!==0&&ee(E,W-=J[Q],re)),te<E.last_lit;);q(E,k,M)}function Te(E,M){var F,W,P,Q=M.dyn_tree,re=M.stat_desc.static_tree,te=M.stat_desc.has_stree,pe=M.stat_desc.elems,Ae=-1;for(E.heap_len=0,E.heap_max=p,F=0;F<pe;F++)Q[2*F]!==0?(E.heap[++E.heap_len]=Ae=F,E.depth[F]=0):Q[2*F+1]=0;for(;E.heap_len<2;)Q[2*(P=E.heap[++E.heap_len]=Ae<2?++Ae:0)]=1,E.depth[P]=0,E.opt_len--,te&&(E.static_len-=re[2*P+1]);for(M.max_code=Ae,F=E.heap_len>>1;1<=F;F--)fe(E,Q,F);for(P=pe;F=E.heap[1],E.heap[1]=E.heap[E.heap_len--],fe(E,Q,1),W=E.heap[1],E.heap[--E.heap_max]=F,E.heap[--E.heap_max]=W,Q[2*P]=Q[2*F]+Q[2*W],E.depth[P]=(E.depth[F]>=E.depth[W]?E.depth[F]:E.depth[W])+1,Q[2*F+1]=Q[2*W+1]=P,E.heap[1]=P++,fe(E,Q,1),2<=E.heap_len;);E.heap[--E.heap_max]=E.heap[1],(function(ke,Je){var vn,rt,yn,De,$n,Zr,ct=Je.dyn_tree,Es=Je.max_code,qu=Je.stat_desc.static_tree,Ku=Je.stat_desc.has_stree,Ju=Je.stat_desc.extra_bits,Ns=Je.stat_desc.extra_base,bn=Je.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,vn=ke.heap_max+1;vn<p;vn++)bn<(De=ct[2*ct[2*(rt=ke.heap[vn])+1]+1]+1)&&(De=bn,Bn++),ct[2*rt+1]=De,Es<rt||(ke.bl_count[De]++,$n=0,Ns<=rt&&($n=Ju[rt-Ns]),Zr=ct[2*rt],ke.opt_len+=Zr*(De+$n),Ku&&(ke.static_len+=Zr*(qu[2*rt+1]+$n)));if(Bn!==0){do{for(De=bn-1;ke.bl_count[De]===0;)De--;ke.bl_count[De]--,ke.bl_count[De+1]+=2,ke.bl_count[bn]--,Bn-=2}while(0<Bn);for(De=bn;De!==0;De--)for(rt=ke.bl_count[De];rt!==0;)Es<(yn=ke.heap[--vn])||(ct[2*yn+1]!==De&&(ke.opt_len+=(De-ct[2*yn+1])*ct[2*yn],ct[2*yn+1]=De),rt--)}})(E,M),X(Q,Ae,E.bl_count)}function w(E,M,F){var W,P,Q=-1,re=M[1],te=0,pe=7,Ae=4;for(re===0&&(pe=138,Ae=3),M[2*(F+1)+1]=65535,W=0;W<=F;W++)P=re,re=M[2*(W+1)+1],++te<pe&&P===re||(te<Ae?E.bl_tree[2*P]+=te:P!==0?(P!==Q&&E.bl_tree[2*P]++,E.bl_tree[2*S]++):te<=10?E.bl_tree[2*j]++:E.bl_tree[2*O]++,Q=P,Ae=(te=0)===re?(pe=138,3):P===re?(pe=6,3):(pe=7,4))}function Y(E,M,F){var W,P,Q=-1,re=M[1],te=0,pe=7,Ae=4;for(re===0&&(pe=138,Ae=3),W=0;W<=F;W++)if(P=re,re=M[2*(W+1)+1],!(++te<pe&&P===re)){if(te<Ae)for(;q(E,P,E.bl_tree),--te!=0;);else P!==0?(P!==Q&&(q(E,P,E.bl_tree),te--),q(E,S,E.bl_tree),ee(E,te-3,2)):te<=10?(q(E,j,E.bl_tree),ee(E,te-3,3)):(q(E,O,E.bl_tree),ee(E,te-11,7));Q=P,Ae=(te=0)===re?(pe=138,3):P===re?(pe=6,3):(pe=7,4)}}c(J);var V=!1;function T(E,M,F,W){ee(E,(u<<1)+(W?1:0),3),(function(P,Q,re,te){ae(P),oe(P,re),oe(P,~re),s.arraySet(P.pending_buf,P.window,Q,re,P.pending),P.pending+=re})(E,M,F)}o._tr_init=function(E){V||((function(){var M,F,W,P,Q,re=new Array(x+1);for(P=W=0;P<d-1;P++)for(D[P]=W,M=0;M<1<<N[P];M++)b[W++]=P;for(b[W-1]=P,P=Q=0;P<16;P++)for(J[P]=Q,M=0;M<1<<A[P];M++)I[Q++]=P;for(Q>>=7;P<h;P++)for(J[P]=Q<<7,M=0;M<1<<A[P]-7;M++)I[256+Q++]=P;for(F=0;F<=x;F++)re[F]=0;for(M=0;M<=143;)H[2*M+1]=8,M++,re[8]++;for(;M<=255;)H[2*M+1]=9,M++,re[9]++;for(;M<=279;)H[2*M+1]=7,M++,re[7]++;for(;M<=287;)H[2*M+1]=8,M++,re[8]++;for(X(H,m+1,re),M=0;M<h;M++)C[2*M+1]=5,C[2*M]=ue(M,5);K=new se(H,N,f+1,m,x),L=new se(C,A,0,h,x),U=new se(new Array(0),z,0,g,_)})(),V=!0),E.l_desc=new B(E.dyn_ltree,K),E.d_desc=new B(E.dyn_dtree,L),E.bl_desc=new B(E.bl_tree,U),E.bi_buf=0,E.bi_valid=0,ie(E)},o._tr_stored_block=T,o._tr_flush_block=function(E,M,F,W){var P,Q,re=0;0<E.level?(E.strm.data_type===2&&(E.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})(E)),Te(E,E.l_desc),Te(E,E.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})(E),P=E.opt_len+3+7>>>3,(Q=E.static_len+3+7>>>3)<=P&&(P=Q)):P=Q=F+5,F+4<=P&&M!==-1?T(E,M,F,W):E.strategy===4||Q===P?(ee(E,2+(W?1:0),3),we(E,H,C)):(ee(E,4+(W?1:0),3),(function(te,pe,Ae,ke){var Je;for(ee(te,pe-257,5),ee(te,Ae-1,5),ee(te,ke-4,4),Je=0;Je<ke;Je++)ee(te,te.bl_tree[2*R[Je]+1],3);Y(te,te.dyn_ltree,pe-1),Y(te,te.dyn_dtree,Ae-1)})(E,E.l_desc.max_code+1,E.d_desc.max_code+1,re+1),we(E,E.dyn_ltree,E.dyn_dtree)),ie(E),W&&ae(E)},o._tr_tally=function(E,M,F){return E.pending_buf[E.d_buf+2*E.last_lit]=M>>>8&255,E.pending_buf[E.d_buf+2*E.last_lit+1]=255&M,E.pending_buf[E.l_buf+E.last_lit]=255&F,E.last_lit++,M===0?E.dyn_ltree[2*F]++:(E.matches++,M--,E.dyn_ltree[2*(b[F]+f+1)]++,E.dyn_dtree[2*$(M)]++),E.last_lit===E.lit_bufsize-1},o._tr_align=function(E){ee(E,2,3),q(E,k,H),(function(M){M.bi_valid===16?(oe(M,M.bi_buf),M.bi_buf=0,M.bi_valid=0):8<=M.bi_valid&&(M.pending_buf[M.pending++]=255&M.bi_buf,M.bi_buf>>=8,M.bi_valid-=8)})(E)}},{"../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,h={},g=!1,p=i.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(i);x=x&&x.setTimeout?x:i,c={}.toString.call(i.process)==="[object process]"?function(S){process.nextTick(function(){_(S)})}:(function(){if(i.postMessage&&!i.importScripts){var S=!0,j=i.onmessage;return i.onmessage=function(){S=!1},i.postMessage("","*"),i.onmessage=j,S}})()?(f="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",k,!1):i.attachEvent("onmessage",k),function(S){i.postMessage(f+S,"*")}):i.MessageChannel?((d=new MessageChannel).port1.onmessage=function(S){_(S.data)},function(S){d.port2.postMessage(S)}):p&&"onreadystatechange"in p.createElement("script")?(u=p.documentElement,function(S){var j=p.createElement("script");j.onreadystatechange=function(){_(S),j.onreadystatechange=null,u.removeChild(j),j=null},u.appendChild(j)}):function(S){setTimeout(_,0,S)},x.setImmediate=function(S){typeof S!="function"&&(S=new Function(""+S));for(var j=new Array(arguments.length-1),O=0;O<j.length;O++)j[O]=arguments[O+1];var N={callback:S,args:j};return h[m]=N,c(m),m++},x.clearImmediate=y}function y(S){delete h[S]}function _(S){if(g)setTimeout(_,0,S);else{var j=h[S];if(j){g=!0;try{(function(O){var N=O.callback,A=O.args;switch(A.length){case 0:N();break;case 1:N(A[0]);break;case 2:N(A[0],A[1]);break;case 3:N(A[0],A[1],A[2]);break;default:N.apply(l,A)}})(j)}finally{y(S),g=!1}}}}function k(S){S.source===i&&typeof S.data=="string"&&S.data.indexOf(f)===0&&_(+S.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)})})(Hr)),Hr.exports}var V0=W0();const H0=Gu(V0);async function q0(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 K0(e){const t=new H0;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 q0(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 hl(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=hl(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function pl(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=hl(e))&&(r&&(r+=" "),r+=t);return r}const J0=(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},G0=(e,t)=>({classGroupId:e,validator:t}),ml=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),hr="-",oi=[],Y0="arbitrary..",X0=e=>{const t=e1(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return Q0(i);const l=i.split(hr),c=l[0]===""&&l.length>1?1:0;return gl(l,c,t)},getConflictingClassGroupIds:(i,l)=>{if(l){const c=r[i],u=n[i];return c?u?J0(u,c):c:u||oi}return n[i]||oi}}},gl=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);if(s){const u=gl(e,t+1,s);if(u)return u}const i=n.validators;if(i===null)return;const l=t===0?e.join(hr):e.slice(t).join(hr),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(l))return d.classGroupId}},Q0=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?Y0+r:void 0})(),e1=e=>{const{theme:t,classGroups:n}=e;return t1(n,t)},t1=(e,t)=>{const n=ml();for(const r in e){const o=e[r];ts(o,n,r,t)}return n},ts=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const i=e[s];n1(i,t,n,r)}},n1=(e,t,n,r)=>{if(typeof e=="string"){r1(e,t,n);return}if(typeof e=="function"){o1(e,t,n,r);return}s1(e,t,n,r)},r1=(e,t,n)=>{const r=e===""?t:xl(t,e);r.classGroupId=n},o1=(e,t,n,r)=>{if(i1(e)){ts(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(G0(n,e))},s1=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let i=0;i<s;i++){const[l,c]=o[i];ts(c,xl(t,l),n,r)}},xl=(e,t)=>{let n=e;const r=t.split(hr),o=r.length;for(let s=0;s<o;s++){const i=r[s];let l=n.nextPart.get(i);l||(l=ml(),n.nextPart.set(i,l)),n=l}return n},i1=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,a1=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)}}},bo="!",si=":",l1=[],ii=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),c1=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 p=0;p<d;p++){const x=o[p];if(i===0&&l===0){if(x===si){s.push(o.slice(c,p)),c=p+1;continue}if(x==="/"){u=p;continue}}x==="["?i++:x==="]"?i--:x==="("?l++:x===")"&&l--}const f=s.length===0?o:o.slice(c);let m=f,h=!1;f.endsWith(bo)?(m=f.slice(0,-1),h=!0):f.startsWith(bo)&&(m=f.slice(1),h=!0);const g=u&&u>c?u-c:void 0;return ii(s,h,m,g)};if(t){const o=t+si,s=r;r=i=>i.startsWith(o)?s(i.slice(o.length)):ii(l1,!1,i,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},u1=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}},d1=e=>({cache:a1(e.cacheSize),parseClassName:c1(e),sortModifiers:u1(e),...X0(e)}),f1=/\s+/,h1=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,i=[],l=e.trim().split(f1);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:f,modifiers:m,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:p}=n(d);if(f){c=d+(c.length>0?" "+c:c);continue}let x=!!p,y=r(x?g.substring(0,p):g);if(!y){if(!x){c=d+(c.length>0?" "+c:c);continue}if(y=r(g),!y){c=d+(c.length>0?" "+c:c);continue}x=!1}const _=m.length===0?"":m.length===1?m[0]:s(m).join(":"),k=h?_+bo:_,S=k+y;if(i.indexOf(S)>-1)continue;i.push(S);const j=o(y,x);for(let O=0;O<j.length;++O){const N=j[O];i.push(k+N)}c=d+(c.length>0?" "+c:c)}return c},p1=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=vl(n))&&(o&&(o+=" "),o+=r);return o},vl=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=vl(e[r]))&&(n&&(n+=" "),n+=t);return n},m1=(e,...t)=>{let n,r,o,s;const i=c=>{const u=t.reduce((d,f)=>f(d),e());return n=d1(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=h1(c,n);return o(c,d),d};return s=i,(...c)=>s(p1(...c))},g1=[],Fe=e=>{const t=n=>n[e]||g1;return t.isThemeGetter=!0,t},yl=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,bl=/^\((?:(\w[\w-]*):)?(.+)\)$/i,x1=/^\d+\/\d+$/,v1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,y1=/\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$/,b1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,w1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Zt=e=>x1.test(e),be=e=>!!e&&!Number.isNaN(Number(e)),vt=e=>!!e&&Number.isInteger(Number(e)),qr=e=>e.endsWith("%")&&be(e.slice(0,-1)),ut=e=>v1.test(e),k1=()=>!0,S1=e=>y1.test(e)&&!b1.test(e),wl=()=>!1,C1=e=>w1.test(e),j1=e=>_1.test(e),E1=e=>!le(e)&&!ce(e),N1=e=>fn(e,Sl,wl),le=e=>yl.test(e),At=e=>fn(e,Cl,S1),Kr=e=>fn(e,I1,be),ai=e=>fn(e,_l,wl),T1=e=>fn(e,kl,j1),qn=e=>fn(e,jl,C1),ce=e=>bl.test(e),wn=e=>hn(e,Cl),A1=e=>hn(e,R1),li=e=>hn(e,_l),z1=e=>hn(e,Sl),O1=e=>hn(e,kl),Kn=e=>hn(e,jl,!0),fn=(e,t,n)=>{const r=yl.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},hn=(e,t,n=!1)=>{const r=bl.exec(e);return r?r[1]?t(r[1]):n:!1},_l=e=>e==="position"||e==="percentage",kl=e=>e==="image"||e==="url",Sl=e=>e==="length"||e==="size"||e==="bg-size",Cl=e=>e==="length",I1=e=>e==="number",R1=e=>e==="family-name",jl=e=>e==="shadow",P1=()=>{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"),h=Fe("drop-shadow"),g=Fe("blur"),p=Fe("perspective"),x=Fe("aspect"),y=Fe("ease"),_=Fe("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],j=()=>[...S(),ce,le],O=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],A=()=>[ce,le,c],z=()=>[Zt,"full","auto",...A()],R=()=>[vt,"none","subgrid",ce,le],H=()=>["auto",{span:["full",vt,ce,le]},vt,ce,le],C=()=>[vt,"auto",ce,le],I=()=>["auto","min","max","fr",ce,le],b=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],D=()=>["start","end","center","stretch","center-safe","end-safe"],K=()=>["auto",...A()],L=()=>[Zt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],U=()=>[e,ce,le],J=()=>[...S(),li,ai,{position:[ce,le]}],se=()=>["no-repeat",{repeat:["","x","y","space","round"]}],B=()=>["auto","cover","contain",z1,N1,{size:[ce,le]}],$=()=>[qr,wn,At],oe=()=>["","none","full",u,ce,le],ee=()=>["",be,wn,At],q=()=>["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,qr,li,ai],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:[k1],container:[ut],"drop-shadow":[ut],ease:["in","out","in-out"],font:[E1],"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:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{start:z()}],end:[{end:z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[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:H()}],"col-start":[{"col-start":C()}],"col-end":[{"col-end":C()}],"grid-rows":[{"grid-rows":R()}],"row-start-end":[{row:H()}],"row-start":[{"row-start":C()}],"row-end":[{"row-end":C()}],"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":[...D(),"normal"]}],"justify-self":[{"justify-self":["auto",...D()]}],"align-content":[{content:["normal",...b()]}],"align-items":[{items:[...D(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...D(),{baseline:["","last"]}]}],"place-content":[{"place-content":b()}],"place-items":[{"place-items":[...D(),"baseline"]}],"place-self":[{"place-self":["auto",...D()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:K()}],mx:[{mx:K()}],my:[{my:K()}],ms:[{ms:K()}],me:[{me:K()}],mt:[{mt:K()}],mr:[{mr:K()}],mb:[{mb:K()}],ml:[{ml:K()}],"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,wn,At]}],"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",qr,le]}],"font-family":[{font:[A1,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:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:[be,"from-font","auto",ce,At]}],"text-decoration-color":[{decoration:U()}],"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:J()}],"bg-repeat":[{bg:se()}],"bg-size":[{bg:B()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},vt,ce,le],radial:["",ce,le],conic:[vt,ce,le]},O1,T1]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:$()}],"gradient-via-pos":[{via:$()}],"gradient-to-pos":[{to:$()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],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:[...q(),"hidden","none"]}],"divide-style":[{divide:[...q(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...q(),"none","hidden"]}],"outline-offset":[{"outline-offset":[be,ce,le]}],"outline-w":[{outline:["",be,wn,At]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",d,Kn,qn]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",f,Kn,qn]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[be,At]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",m,Kn,qn]}],"text-shadow-color":[{"text-shadow":U()}],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":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"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":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"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":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"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":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"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":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"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":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"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":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"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":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"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":S()}],"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":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:J()}],"mask-repeat":[{mask:se()}],"mask-size":[{mask:B()}],"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",h,Kn,qn]}],"drop-shadow-color":[{"drop-shadow":U()}],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",y,ce,le]}],delay:[{delay:[be,ce,le]}],animate:[{animate:["none",_,ce,le]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,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:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"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",...U()]}],"stroke-w":[{stroke:[be,wn,At,Kr]}],stroke:[{stroke:["none",...U()]}],"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"]}},M1=m1(P1);function xe(...e){return M1(pl(e))}function Qe(e){return e>=1e6?(e/1e6).toFixed(1).replace(/\.0$/,"")+"M":(e/1e3).toFixed(1).replace(/\.0$/,"")+"K"}function D1(e){return e===null?"pending":e>=200&&e<300?"success":e>=400&&e<500?"client_error":e>=500?"server_error":"pending"}const L1="1.18.0",F1={version:L1},ci=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ui=pl,ns=(e,t)=>n=>{var r;if(t?.variants==null)return ui(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=ci(d)||ci(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,...h}=d;return Object.entries(h).every(g=>{let[p,x]=g;return Array.isArray(x)?x.includes({...s,...l}[p]):{...s,...l}[p]===x})?[...u,f,m]:u},[]);return ui(e,i,c,n?.class,n?.className)};function di(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function El(...e){return t=>{let n=!1;const r=e.map(o=>{const s=di(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():di(e[o],null)}}}}function Ie(...e){return v.useCallback(El(...e),e)}function an(e){const t=B1(e),n=v.forwardRef((r,o)=>{const{children:s,...i}=r,l=v.Children.toArray(s),c=l.find(Z1);if(c){const u=c.props.children,d=l.map(f=>f===c?v.Children.count(u)>1?v.Children.only(null):v.isValidElement(u)?u.props.children:null:f);return a.jsx(t,{...i,ref:o,children:v.isValidElement(u)?v.cloneElement(u,void 0,d):null})}return a.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var $1=an("Slot");function B1(e){const t=v.forwardRef((n,r)=>{const{children:o,...s}=n;if(v.isValidElement(o)){const i=V1(o),l=W1(s,o.props);return o.type!==v.Fragment&&(l.ref=r?El(r,i):i),v.cloneElement(o,l)}return v.Children.count(o)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Nl=Symbol("radix.slottable");function U1(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Nl,t}function Z1(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Nl}function W1(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 V1(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 H1=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Se=H1.reduce((e,t)=>{const n=an(`Primitive.${t}`),r=v.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 q1(e,t){e&&In.flushSync(()=>e.dispatchEvent(t))}var Tl=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"}),K1="VisuallyHidden",Al=v.forwardRef((e,t)=>a.jsx(Se.span,{...e,ref:t,style:{...Tl,...e.style}}));Al.displayName=K1;var J1=Al;function G1(e,t){const n=v.createContext(t),r=s=>{const{children:i,...l}=s,c=v.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function o(s){const i=v.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=v.createContext(i),c=n.length;n=[...n,i];const u=f=>{const{scope:m,children:h,...g}=f,p=m?.[e]?.[c]||l,x=v.useMemo(()=>g,Object.values(g));return a.jsx(p.Provider,{value:x,children:h})};u.displayName=s+"Provider";function d(f,m){const h=m?.[e]?.[c]||l,g=v.useContext(h);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=>v.createContext(i));return function(l){const c=l?.[e]||s;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[r,Y1(o,...t)]}function Y1(...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 v.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function zl(e){const t=e+"CollectionProvider",[n,r]=$t(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=p=>{const{scope:x,children:y}=p,_=We.useRef(null),k=We.useRef(new Map).current;return a.jsx(o,{scope:x,itemMap:k,collectionRef:_,children:y})};i.displayName=t;const l=e+"CollectionSlot",c=an(l),u=We.forwardRef((p,x)=>{const{scope:y,children:_}=p,k=s(l,y),S=Ie(x,k.collectionRef);return a.jsx(c,{ref:S,children:_})});u.displayName=l;const d=e+"CollectionItemSlot",f="data-radix-collection-item",m=an(d),h=We.forwardRef((p,x)=>{const{scope:y,children:_,...k}=p,S=We.useRef(null),j=Ie(x,S),O=s(d,y);return We.useEffect(()=>(O.itemMap.set(S,{ref:S,...k}),()=>{O.itemMap.delete(S)})),a.jsx(m,{[f]:"",ref:j,children:_})});h.displayName=d;function g(p){const x=s(e+"CollectionConsumer",p);return We.useCallback(()=>{const _=x.collectionRef.current;if(!_)return[];const k=Array.from(_.querySelectorAll(`[${f}]`));return Array.from(x.itemMap.values()).sort((O,N)=>k.indexOf(O.ref.current)-k.indexOf(N.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:u,ItemSlot:h},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?v.useLayoutEffect:()=>{},X1=ha[" useInsertionEffect ".trim().toString()]||Ue;function ln({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=Q1({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:o;{const d=v.useRef(e!==void 0);v.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=v.useCallback(d=>{if(l){const f=ex(d)?d(e):d;f!==e&&i.current?.(f)}else s(d)},[l,e,s,i]);return[c,u]}function Q1({defaultProp:e,onChange:t}){const[n,r]=v.useState(e),o=v.useRef(n),s=v.useRef(t);return X1(()=>{s.current=t},[t]),v.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}function ex(e){return typeof e=="function"}function tx(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var Bt=e=>{const{present:t,children:n}=e,r=nx(t),o=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),s=Ie(r.ref,rx(o));return typeof n=="function"||r.isPresent?v.cloneElement(o,{ref:s}):null};Bt.displayName="Presence";function nx(e){const[t,n]=v.useState(),r=v.useRef(null),o=v.useRef(e),s=v.useRef("none"),i=e?"mounted":"unmounted",[l,c]=tx(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=Jn(r.current);s.current=l==="mounted"?u:"none"},[l]),Ue(()=>{const u=r.current,d=o.current;if(d!==e){const m=s.current,h=Jn(u);e?c("MOUNT"):h==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&m!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),Ue(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=h=>{const p=Jn(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&p&&(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=h=>{h.target===t&&(s.current=Jn(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:v.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function Jn(e){return e?.animationName||"none"}function rx(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 ox=ha[" useId ".trim().toString()]||(()=>{}),sx=0;function ht(e){const[t,n]=v.useState(ox());return Ue(()=>{n(r=>r??String(sx++))},[e]),e||(t?`radix-${t}`:"")}var ix=v.createContext(void 0);function rs(e){const t=v.useContext(ix);return e||t||"ltr"}function _t(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>t.current?.(...n),[])}function ax(e,t=globalThis?.document){const n=_t(e);v.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 lx="DismissableLayer",wo="dismissableLayer.update",cx="dismissableLayer.pointerDownOutside",ux="dismissableLayer.focusOutside",fi,Ol=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Nr=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...c}=e,u=v.useContext(Ol),[d,f]=v.useState(null),m=d?.ownerDocument??globalThis?.document,[,h]=v.useState({}),g=Ie(t,N=>f(N)),p=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=p.indexOf(x),_=d?p.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,S=_>=y,j=hx(N=>{const A=N.target,z=[...u.branches].some(R=>R.contains(A));!S||z||(o?.(N),i?.(N),N.defaultPrevented||l?.())},m),O=px(N=>{const A=N.target;[...u.branches].some(R=>R.contains(A))||(s?.(N),i?.(N),N.defaultPrevented||l?.())},m);return ax(N=>{_===u.layers.size-1&&(r?.(N),!N.defaultPrevented&&l&&(N.preventDefault(),l()))},m),v.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(fi=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),hi(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=fi)}},[d,m,n,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),hi())},[d,u]),v.useEffect(()=>{const N=()=>h({});return document.addEventListener(wo,N),()=>document.removeEventListener(wo,N)},[]),a.jsx(Se.div,{...c,ref:g,style:{pointerEvents:k?S?"auto":"none":void 0,...e.style},onFocusCapture:ye(e.onFocusCapture,O.onFocusCapture),onBlurCapture:ye(e.onBlurCapture,O.onBlurCapture),onPointerDownCapture:ye(e.onPointerDownCapture,j.onPointerDownCapture)})});Nr.displayName=lx;var dx="DismissableLayerBranch",fx=v.forwardRef((e,t)=>{const n=v.useContext(Ol),r=v.useRef(null),o=Ie(t,r);return v.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),a.jsx(Se.div,{...e,ref:o})});fx.displayName=dx;function hx(e,t=globalThis?.document){const n=_t(e),r=v.useRef(!1),o=v.useRef(()=>{});return v.useEffect(()=>{const s=l=>{if(l.target&&!r.current){let c=function(){Il(cx,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 px(e,t=globalThis?.document){const n=_t(e),r=v.useRef(!1);return v.useEffect(()=>{const o=s=>{s.target&&!r.current&&Il(ux,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 hi(){const e=new CustomEvent(wo);document.dispatchEvent(e)}function Il(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?q1(o,s):o.dispatchEvent(s)}var Jr="focusScope.autoFocusOnMount",Gr="focusScope.autoFocusOnUnmount",pi={bubbles:!1,cancelable:!0},mx="FocusScope",os=v.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[l,c]=v.useState(null),u=_t(o),d=_t(s),f=v.useRef(null),m=Ie(t,p=>c(p)),h=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let p=function(k){if(h.paused||!l)return;const S=k.target;l.contains(S)?f.current=S:yt(f.current,{select:!0})},x=function(k){if(h.paused||!l)return;const S=k.relatedTarget;S!==null&&(l.contains(S)||yt(f.current,{select:!0}))},y=function(k){if(document.activeElement===document.body)for(const j of k)j.removedNodes.length>0&&yt(l)};document.addEventListener("focusin",p),document.addEventListener("focusout",x);const _=new MutationObserver(y);return l&&_.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",x),_.disconnect()}}},[r,l,h.paused]),v.useEffect(()=>{if(l){gi.add(h);const p=document.activeElement;if(!l.contains(p)){const y=new CustomEvent(Jr,pi);l.addEventListener(Jr,u),l.dispatchEvent(y),y.defaultPrevented||(gx(wx(Rl(l)),{select:!0}),document.activeElement===p&&yt(l))}return()=>{l.removeEventListener(Jr,u),setTimeout(()=>{const y=new CustomEvent(Gr,pi);l.addEventListener(Gr,d),l.dispatchEvent(y),y.defaultPrevented||yt(p??document.body,{select:!0}),l.removeEventListener(Gr,d),gi.remove(h)},0)}}},[l,u,d,h]);const g=v.useCallback(p=>{if(!n&&!r||h.paused)return;const x=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,y=document.activeElement;if(x&&y){const _=p.currentTarget,[k,S]=xx(_);k&&S?!p.shiftKey&&y===S?(p.preventDefault(),n&&yt(k,{select:!0})):p.shiftKey&&y===k&&(p.preventDefault(),n&&yt(S,{select:!0})):y===_&&p.preventDefault()}},[n,r,h.paused]);return a.jsx(Se.div,{tabIndex:-1,...i,ref:m,onKeyDown:g})});os.displayName=mx;function gx(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(yt(r,{select:t}),document.activeElement!==n)return}function xx(e){const t=Rl(e),n=mi(t,e),r=mi(t.reverse(),e);return[n,r]}function Rl(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 mi(e,t){for(const n of e)if(!vx(n,{upTo:t}))return n}function vx(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 yx(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&&yx(e)&&t&&e.select()}}var gi=bx();function bx(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=xi(e,t),e.unshift(t)},remove(t){e=xi(e,t),e[0]?.resume()}}}function xi(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function wx(e){return e.filter(t=>t.tagName!=="A")}var _x="Portal",Tr=v.forwardRef((e,t)=>{const{container:n,...r}=e,[o,s]=v.useState(!1);Ue(()=>s(!0),[]);const i=n||o&&globalThis?.document?.body;return i?Yu.createPortal(a.jsx(Se.div,{...r,ref:t}),i):null});Tr.displayName=_x;var Yr=0;function Pl(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??vi()),document.body.insertAdjacentElement("beforeend",e[1]??vi()),Yr++,()=>{Yr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Yr--}},[])}function vi(){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 Ml(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 kx(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",Sx="with-scroll-bars-hidden",Cx="--removed-body-scroll-bar-size";function Xr(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function jx(e,t){var n=v.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 Ex=typeof window<"u"?v.useLayoutEffect:v.useEffect,yi=new WeakMap;function Nx(e,t){var n=jx(null,function(r){return e.forEach(function(o){return Xr(o,r)})});return Ex(function(){var r=yi.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(l){s.has(l)||Xr(l,null)}),s.forEach(function(l){o.has(l)||Xr(l,i)})}yi.set(n,e)},[e]),n}function Tx(e){return e}function Ax(e,t){t===void 0&&(t=Tx);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 zx(e){e===void 0&&(e={});var t=Ax(null);return t.options=ot({async:!0,ssr:!1},e),t}var Dl=function(e){var t=e.sideCar,n=Ml(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 v.createElement(r,ot({},n))};Dl.isSideCarExport=!0;function Ox(e,t){return e.useMedium(t),Dl}var Ll=zx(),Qr=function(){},Ar=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:Qr,onWheelCapture:Qr,onTouchMoveCapture:Qr}),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,h=e.noRelative,g=e.noIsolation,p=e.inert,x=e.allowPinchZoom,y=e.as,_=y===void 0?"div":y,k=e.gapMode,S=Ml(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=m,O=Nx([n,t]),N=ot(ot({},S),o);return v.createElement(v.Fragment,null,d&&v.createElement(j,{sideCar:Ll,removeScrollBar:u,shards:f,noRelative:h,noIsolation:g,inert:p,setCallbacks:s,allowPinchZoom:!!x,lockRef:n,gapMode:k}),i?v.cloneElement(v.Children.only(l),ot(ot({},N),{ref:O})):v.createElement(_,ot({},N,{className:c,ref:O}),l))});Ar.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ar.classNames={fullWidth:ir,zeroRight:sr};var Ix=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Rx(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Ix();return t&&e.setAttribute("nonce",t),e}function Px(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Mx(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Dx=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Rx())&&(Px(t,n),Mx(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Lx=function(){var e=Dx();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Fl=function(){var e=Lx(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Fx={left:0,top:0,right:0,gap:0},eo=function(e){return parseInt(e||"",10)||0},$x=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[eo(n),eo(r),eo(o)]},Bx=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Fx;var t=$x(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])}},Ux=Fl(),Qt="data-scroll-locked",Zx=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(Sx,` {
|
|
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(Cx,": ").concat(l,`px;
|
|
77
|
-
}
|
|
78
|
-
`)},bi=function(){var e=parseInt(document.body.getAttribute(Qt)||"0",10);return isFinite(e)?e:0},Wx=function(){v.useEffect(function(){return document.body.setAttribute(Qt,(bi()+1).toString()),function(){var e=bi()-1;e<=0?document.body.removeAttribute(Qt):document.body.setAttribute(Qt,e.toString())}},[])},Vx=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Wx();var s=v.useMemo(function(){return Bx(o)},[o]);return v.createElement(Ux,{styles:Zx(s,!t,o,n?"":"!important")})},_o=!1;if(typeof window<"u")try{var Gn=Object.defineProperty({},"passive",{get:function(){return _o=!0,!0}});window.addEventListener("test",Gn,Gn),window.removeEventListener("test",Gn,Gn)}catch{_o=!1}var Wt=_o?{passive:!1}:!1,Hx=function(e){return e.tagName==="TEXTAREA"},$l=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Hx(e)&&n[t]==="visible")},qx=function(e){return $l(e,"overflowY")},Kx=function(e){return $l(e,"overflowX")},wi=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Bl(e,r);if(o){var s=Ul(e,r),i=s[1],l=s[2];if(i>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Jx=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Gx=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Bl=function(e,t){return e==="v"?qx(t):Kx(t)},Ul=function(e,t){return e==="v"?Jx(t):Gx(t)},Yx=function(e,t){return e==="h"&&t==="rtl"?-1:1},Xx=function(e,t,n,r,o){var s=Yx(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 h=Ul(e,l),g=h[0],p=h[1],x=h[2],y=p-x-s*g;(g||y)&&Bl(e,l)&&(f+=y,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]},_i=function(e){return[e.deltaX,e.deltaY]},ki=function(e){return e&&"current"in e?e.current:e},Qx=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ev=function(e){return`
|
|
79
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
80
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
81
|
-
`)},tv=0,Vt=[];function nv(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),o=v.useState(tv++)[0],s=v.useState(Fl)[0],i=v.useRef(e);v.useEffect(function(){i.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var p=kx([e.lockRef.current],(e.shards||[]).map(ki),!0).filter(Boolean);return p.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),p.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=v.useCallback(function(p,x){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!i.current.allowPinchZoom;var y=Yn(p),_=n.current,k="deltaX"in p?p.deltaX:_[0]-y[0],S="deltaY"in p?p.deltaY:_[1]-y[1],j,O=p.target,N=Math.abs(k)>Math.abs(S)?"h":"v";if("touches"in p&&N==="h"&&O.type==="range")return!1;var A=window.getSelection(),z=A&&A.anchorNode,R=z?z===O||z.contains(O):!1;if(R)return!1;var H=wi(N,O);if(!H)return!0;if(H?j=N:(j=N==="v"?"h":"v",H=wi(N,O)),!H)return!1;if(!r.current&&"changedTouches"in p&&(k||S)&&(r.current=j),!j)return!0;var C=r.current||j;return Xx(C,x,p,C==="h"?k:S)},[]),c=v.useCallback(function(p){var x=p;if(!(!Vt.length||Vt[Vt.length-1]!==s)){var y="deltaY"in x?_i(x):Yn(x),_=t.current.filter(function(j){return j.name===x.type&&(j.target===x.target||x.target===j.shadowParent)&&Qx(j.delta,y)})[0];if(_&&_.should){x.cancelable&&x.preventDefault();return}if(!_){var k=(i.current.shards||[]).map(ki).filter(Boolean).filter(function(j){return j.contains(x.target)}),S=k.length>0?l(x,k[0]):!i.current.noIsolation;S&&x.cancelable&&x.preventDefault()}}},[]),u=v.useCallback(function(p,x,y,_){var k={name:p,delta:x,target:y,should:_,shadowParent:rv(y)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(S){return S!==k})},1)},[]),d=v.useCallback(function(p){n.current=Yn(p),r.current=void 0},[]),f=v.useCallback(function(p){u(p.type,_i(p),p.target,l(p,e.lockRef.current))},[]),m=v.useCallback(function(p){u(p.type,Yn(p),p.target,l(p,e.lockRef.current))},[]);v.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(p){return p!==s}),document.removeEventListener("wheel",c,Wt),document.removeEventListener("touchmove",c,Wt),document.removeEventListener("touchstart",d,Wt)}},[]);var h=e.removeScrollBar,g=e.inert;return v.createElement(v.Fragment,null,g?v.createElement(s,{styles:ev(o)}):null,h?v.createElement(Vx,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function rv(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const ov=Ox(Ll,nv);var ss=v.forwardRef(function(e,t){return v.createElement(Ar,ot({},e,{ref:t,sideCar:ov}))});ss.classNames=Ar.classNames;var sv=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={},to=0,Zl=function(e){return e&&(e.host||Zl(e.parentNode))},iv=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Zl(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})},av=function(e,t,n,r){var o=iv(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 h=m.getAttribute(r),g=h!==null&&h!=="false",p=(Ht.get(m)||0)+1,x=(s.get(m)||0)+1;Ht.set(m,p),s.set(m,x),i.push(m),p===1&&g&&Xn.set(m,!0),x===1&&m.setAttribute(n,"true"),g||m.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",m,y)}})};return d(t),l.clear(),to++,function(){i.forEach(function(f){var m=Ht.get(f)-1,h=s.get(f)-1;Ht.set(f,m),s.set(f,h),m||(Xn.has(f)||f.removeAttribute(r),Xn.delete(f)),h||f.removeAttribute(n)}),to--,to||(Ht=new WeakMap,Ht=new WeakMap,Xn=new WeakMap,Qn={})}},Wl=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=sv(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),av(r,o,n,"aria-hidden")):function(){return null}},zr="Dialog",[Vl]=$t(zr),[lv,nt]=Vl(zr),Hl=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!0}=e,l=v.useRef(null),c=v.useRef(null),[u,d]=ln({prop:r,defaultProp:o??!1,onChange:s,caller:zr});return a.jsx(lv,{scope:t,triggerRef:l,contentRef:c,contentId:ht(),titleId:ht(),descriptionId:ht(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(f=>!f),[d]),modal:i,children:n})};Hl.displayName=zr;var ql="DialogTrigger",Kl=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=nt(ql,n),s=Ie(t,o.triggerRef);return a.jsx(Se.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":ls(o.open),...r,ref:s,onClick:ye(e.onClick,o.onOpenToggle)})});Kl.displayName=ql;var is="DialogPortal",[cv,Jl]=Vl(is,{forceMount:void 0}),Gl=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=nt(is,t);return a.jsx(cv,{scope:t,forceMount:n,children:v.Children.map(r,i=>a.jsx(Bt,{present:n||s.open,children:a.jsx(Tr,{asChild:!0,container:o,children:i})}))})};Gl.displayName=is;var pr="DialogOverlay",Yl=v.forwardRef((e,t)=>{const n=Jl(pr,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=nt(pr,e.__scopeDialog);return s.modal?a.jsx(Bt,{present:r||s.open,children:a.jsx(dv,{...o,ref:t})}):null});Yl.displayName=pr;var uv=an("DialogOverlay.RemoveScroll"),dv=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=nt(pr,n);return a.jsx(ss,{as:uv,allowPinchZoom:!0,shards:[o.contentRef],children:a.jsx(Se.div,{"data-state":ls(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Ot="DialogContent",Xl=v.forwardRef((e,t)=>{const n=Jl(Ot,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=nt(Ot,e.__scopeDialog);return a.jsx(Bt,{present:r||s.open,children:s.modal?a.jsx(fv,{...o,ref:t}):a.jsx(hv,{...o,ref:t})})});Xl.displayName=Ot;var fv=v.forwardRef((e,t)=>{const n=nt(Ot,e.__scopeDialog),r=v.useRef(null),o=Ie(t,n.contentRef,r);return v.useEffect(()=>{const s=r.current;if(s)return Wl(s)},[]),a.jsx(Ql,{...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())})}),hv=v.forwardRef((e,t)=>{const n=nt(Ot,e.__scopeDialog),r=v.useRef(!1),o=v.useRef(!1);return a.jsx(Ql,{...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()}})}),Ql=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...i}=e,l=nt(Ot,n),c=v.useRef(null),u=Ie(t,c);return Pl(),a.jsxs(a.Fragment,{children:[a.jsx(os,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:a.jsx(Nr,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":ls(l.open),...i,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(mv,{titleId:l.titleId}),a.jsx(xv,{contentRef:c,descriptionId:l.descriptionId})]})]})}),as="DialogTitle",ec=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=nt(as,n);return a.jsx(Se.h2,{id:o.titleId,...r,ref:t})});ec.displayName=as;var tc="DialogDescription",pv=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=nt(tc,n);return a.jsx(Se.p,{id:o.descriptionId,...r,ref:t})});pv.displayName=tc;var nc="DialogClose",rc=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=nt(nc,n);return a.jsx(Se.button,{type:"button",...r,ref:t,onClick:ye(e.onClick,()=>o.onOpenChange(!1))})});rc.displayName=nc;function ls(e){return e?"open":"closed"}var oc="DialogTitleWarning",[Ik,sc]=G1(oc,{contentName:Ot,titleName:as,docsSlug:"dialog"}),mv=({titleId:e})=>{const t=sc(oc),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 v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},gv="DialogDescriptionWarning",xv=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${sc(gv).contentName}}.`;return v.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},vv=Hl,yv=Kl,bv=Gl,wv=Yl,_v=Xl,kv=ec,Sv=rc;function Cv(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function jv(e){const[t,n]=v.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 Ev=["top","right","bottom","left"],kt=Math.min,qe=Math.max,mr=Math.round,er=Math.floor,it=e=>({x:e,y:e}),Nv={left:"right",right:"left",bottom:"top",top:"bottom"},Tv={start:"end",end:"start"};function ko(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 pn(e){return e.split("-")[1]}function cs(e){return e==="x"?"y":"x"}function us(e){return e==="y"?"height":"width"}const Av=new Set(["top","bottom"]);function st(e){return Av.has(gt(e))?"y":"x"}function ds(e){return cs(st(e))}function zv(e,t,n){n===void 0&&(n=!1);const r=pn(e),o=ds(e),s=us(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=gr(i)),[i,gr(i)]}function Ov(e){const t=gr(e);return[So(e),t,So(t)]}function So(e){return e.replace(/start|end/g,t=>Tv[t])}const Si=["left","right"],Ci=["right","left"],Iv=["top","bottom"],Rv=["bottom","top"];function Pv(e,t,n){switch(e){case"top":case"bottom":return n?t?Ci:Si:t?Si:Ci;case"left":case"right":return t?Iv:Rv;default:return[]}}function Mv(e,t,n,r){const o=pn(e);let s=Pv(gt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(So)))),s}function gr(e){return e.replace(/left|right|bottom|top/g,t=>Nv[t])}function Dv(e){return{top:0,right:0,bottom:0,left:0,...e}}function ic(e){return typeof e!="number"?Dv(e):{top:e,right:e,bottom:e,left:e}}function xr(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 ji(e,t,n){let{reference:r,floating:o}=e;const s=st(t),i=ds(t),l=us(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 h;switch(c){case"top":h={x:d,y:r.y-o.height};break;case"bottom":h={x:d,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-o.width,y:f};break;default:h={x:r.x,y:r.y}}switch(pn(t)){case"start":h[i]-=m*(n&&u?-1:1);break;case"end":h[i]+=m*(n&&u?-1:1);break}return h}async function Lv(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:h=0}=mt(t,e),g=ic(h),x=l[m?f==="floating"?"reference":"floating":f],y=xr(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)),S=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=xr(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:_,offsetParent:k,strategy:c}):_);return{top:(y.top-j.top+g.top)/S.y,bottom:(j.bottom-y.bottom+g.bottom)/S.y,left:(y.left-j.left+g.left)/S.x,right:(j.right-y.right+g.right)/S.x}}const Fv=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}=ji(u,r,c),m=r,h={},g=0;for(let x=0;x<l.length;x++){var p;const{name:y,fn:_}=l[x],{x:k,y:S,data:j,reset:O}=await _({x:d,y:f,initialPlacement:r,placement:m,strategy:o,middlewareData:h,rects:u,platform:{...i,detectOverflow:(p=i.detectOverflow)!=null?p:Lv},elements:{reference:e,floating:t}});d=k??d,f=S??f,h={...h,[y]:{...h[y],...j}},O&&g<=50&&(g++,typeof O=="object"&&(O.placement&&(m=O.placement),O.rects&&(u=O.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):O.rects),{x:d,y:f}=ji(u,m,c)),x=-1)}return{x:d,y:f,placement:m,strategy:o,middlewareData:h}},$v=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=ic(d),m={x:n,y:r},h=ds(o),g=us(h),p=await i.getDimensions(u),x=h==="y",y=x?"top":"left",_=x?"bottom":"right",k=x?"clientHeight":"clientWidth",S=s.reference[g]+s.reference[h]-m[h]-s.floating[g],j=m[h]-s.reference[h],O=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let N=O?O[k]:0;(!N||!await(i.isElement==null?void 0:i.isElement(O)))&&(N=l.floating[k]||s.floating[g]);const A=S/2-j/2,z=N/2-p[g]/2-1,R=kt(f[y],z),H=kt(f[_],z),C=R,I=N-p[g]-H,b=N/2-p[g]/2+A,D=ko(C,b,I),K=!c.arrow&&pn(o)!=null&&b!==D&&s.reference[g]/2-(b<C?R:H)-p[g]/2<0,L=K?b<C?b-C:b-I:0;return{[h]:m[h]+L,data:{[h]:D,centerOffset:b-D-L,...K&&{alignmentOffset:L}},reset:K}}}),Bv=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:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:p=!0,...x}=mt(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=gt(o),_=st(l),k=gt(l)===l,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),j=m||(k||!p?[gr(l)]:Ov(l)),O=g!=="none";!m&&O&&j.push(...Mv(l,p,g,S));const N=[l,...j],A=await c.detectOverflow(t,x),z=[];let R=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&z.push(A[y]),f){const b=zv(o,i,S);z.push(A[b[0]],A[b[1]])}if(R=[...R,{placement:o,overflows:z}],!z.every(b=>b<=0)){var H,C;const b=(((H=s.flip)==null?void 0:H.index)||0)+1,D=N[b];if(D&&(!(f==="alignment"?_!==st(D):!1)||R.every(U=>st(U.placement)===_?U.overflows[0]>0:!0)))return{data:{index:b,overflows:R},reset:{placement:D}};let K=(C=R.filter(L=>L.overflows[0]<=0).sort((L,U)=>L.overflows[1]-U.overflows[1])[0])==null?void 0:C.placement;if(!K)switch(h){case"bestFit":{var I;const L=(I=R.filter(U=>{if(O){const J=st(U.placement);return J===_||J==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(J=>J>0).reduce((J,se)=>J+se,0)]).sort((U,J)=>U[1]-J[1])[0])==null?void 0:I[0];L&&(K=L);break}case"initialPlacement":K=l;break}if(o!==K)return{reset:{placement:K}}}return{}}}};function Ei(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ni(e){return Ev.some(t=>e[t]>=0)}const Uv=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=Ei(i,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Ni(l)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),l=Ei(i,n.floating);return{data:{escapedOffsets:l,escaped:Ni(l)}}}default:return{}}}}},ac=new Set(["left","top"]);async function Zv(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=pn(n),c=st(n)==="y",u=ac.has(i)?-1:1,d=s&&c?-1:1,f=mt(t,e);let{mainAxis:m,crossAxis:h,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"&&(h=l==="end"?g*-1:g),c?{x:h*d,y:m*u}:{x:m*u,y:h*d}}const Wv=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 Zv(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}}}}},Vv=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:y=>{let{x:_,y:k}=y;return{x:_,y:k}}},...u}=mt(e,t),d={x:n,y:r},f=await s.detectOverflow(t,u),m=st(gt(o)),h=cs(m);let g=d[h],p=d[m];if(i){const y=h==="y"?"top":"left",_=h==="y"?"bottom":"right",k=g+f[y],S=g-f[_];g=ko(k,g,S)}if(l){const y=m==="y"?"top":"left",_=m==="y"?"bottom":"right",k=p+f[y],S=p-f[_];p=ko(k,p,S)}const x=c.fn({...t,[h]:g,[m]:p});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[h]:i,[m]:l}}}}}},Hv=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=cs(f);let h=d[m],g=d[f];const p=mt(l,t),x=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(c){const k=m==="y"?"height":"width",S=s.reference[m]-s.floating[k]+x.mainAxis,j=s.reference[m]+s.reference[k]-x.mainAxis;h<S?h=S:h>j&&(h=j)}if(u){var y,_;const k=m==="y"?"width":"height",S=ac.has(gt(o)),j=s.reference[f]-s.floating[k]+(S&&((y=i.offset)==null?void 0:y[f])||0)+(S?0:x.crossAxis),O=s.reference[f]+s.reference[k]+(S?0:((_=i.offset)==null?void 0:_[f])||0)-(S?x.crossAxis:0);g<j?g=j:g>O&&(g=O)}return{[m]:h,[f]:g}}}},qv=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=pn(o),h=st(o)==="y",{width:g,height:p}=s.floating;let x,y;f==="top"||f==="bottom"?(x=f,y=m===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(y=f,x=m==="end"?"top":"bottom");const _=p-d.top-d.bottom,k=g-d.left-d.right,S=kt(p-d[x],_),j=kt(g-d[y],k),O=!t.middlewareData.shift;let N=S,A=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(N=_),O&&!m){const R=qe(d.left,0),H=qe(d.right,0),C=qe(d.top,0),I=qe(d.bottom,0);h?A=g-2*(R!==0||H!==0?R+H:qe(d.left,d.right)):N=p-2*(C!==0||I!==0?C+I:qe(d.top,d.bottom))}await c({...t,availableWidth:A,availableHeight:N});const z=await i.getDimensions(l.floating);return g!==z.width||p!==z.height?{reset:{rects:!0}}:{}}}};function Or(){return typeof window<"u"}function mn(e){return lc(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=(lc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function lc(e){return Or()?e instanceof Node||e instanceof Ke(e).Node:!1}function et(e){return Or()?e instanceof Element||e instanceof Ke(e).Element:!1}function at(e){return Or()?e instanceof HTMLElement||e instanceof Ke(e).HTMLElement:!1}function Ti(e){return!Or()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ke(e).ShadowRoot}const Kv=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)&&!Kv.has(o)}const Jv=new Set(["table","td","th"]);function Gv(e){return Jv.has(mn(e))}const Yv=[":popover-open",":modal"];function Ir(e){return Yv.some(t=>{try{return e.matches(t)}catch{return!1}})}const Xv=["transform","translate","scale","rotate","perspective"],Qv=["transform","translate","scale","rotate","perspective","filter"],ey=["paint","layout","strict","content"];function fs(e){const t=hs(),n=et(e)?tt(e):e;return Xv.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)||Qv.some(r=>(n.willChange||"").includes(r))||ey.some(r=>(n.contain||"").includes(r))}function ty(e){let t=St(e);for(;at(t)&&!cn(t);){if(fs(t))return t;if(Ir(t))return null;t=St(t)}return null}function hs(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const ny=new Set(["html","body","#document"]);function cn(e){return ny.has(mn(e))}function tt(e){return Ke(e).getComputedStyle(e)}function Rr(e){return et(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function St(e){if(mn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ti(e)&&e.host||lt(e);return Ti(t)?t.host:t}function cc(e){const t=St(e);return cn(t)?e.ownerDocument?e.ownerDocument.body:e.body:at(t)&&Dn(t)?t:cc(t)}function An(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=cc(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Ke(o);if(s){const l=Co(i);return t.concat(i,i.visualViewport||[],Dn(o)?o:[],l&&n?An(l):[])}return t.concat(o,An(o,[],n))}function Co(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function uc(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=mr(n)!==s||mr(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function ps(e){return et(e)?e:e.contextElement}function en(e){const t=ps(e);if(!at(t))return it(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=uc(t);let i=(s?mr(n.width):n.width)/r,l=(s?mr(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const ry=it(0);function dc(e){const t=Ke(e);return!hs()||!t.visualViewport?ry:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function oy(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ke(e)?!1:t}function It(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=ps(e);let i=it(1);t&&(r?et(r)&&(i=en(r)):i=en(e));const l=oy(s,n,r)?dc(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),h=r&&et(r)?Ke(r):r;let g=m,p=Co(g);for(;p&&r&&h!==g;){const x=en(p),y=p.getBoundingClientRect(),_=tt(p),k=y.left+(p.clientLeft+parseFloat(_.paddingLeft))*x.x,S=y.top+(p.clientTop+parseFloat(_.paddingTop))*x.y;c*=x.x,u*=x.y,d*=x.x,f*=x.y,c+=k,u+=S,g=Ke(p),p=Co(g)}}return xr({width:d,height:f,x:c,y:u})}function Pr(e,t){const n=Rr(e).scrollLeft;return t?t.left+n:It(lt(e)).left+n}function fc(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Pr(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function sy(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=lt(r),l=t?Ir(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)&&((mn(r)!=="body"||Dn(i))&&(c=Rr(r)),at(r))){const h=It(r);u=en(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}const m=i&&!f&&!s?fc(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 iy(e){return Array.from(e.getClientRects())}function ay(e){const t=lt(e),n=Rr(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+Pr(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 Ai=25;function ly(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=hs();(!d||d&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}const u=Pr(r);if(u<=0){const d=r.ownerDocument,f=d.body,m=getComputedStyle(f),h=d.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,g=Math.abs(r.clientWidth-f.clientWidth-h);g<=Ai&&(s-=g)}else u<=Ai&&(s+=u);return{width:s,height:i,x:l,y:c}}const cy=new Set(["absolute","fixed"]);function uy(e,t){const n=It(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 zi(e,t,n){let r;if(t==="viewport")r=ly(e,n);else if(t==="document")r=ay(lt(e));else if(et(t))r=uy(t,n);else{const o=dc(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return xr(r)}function hc(e,t){const n=St(e);return n===t||!et(n)||cn(n)?!1:tt(n).position==="fixed"||hc(n,t)}function dy(e,t){const n=t.get(e);if(n)return n;let r=An(e,[],!1).filter(l=>et(l)&&mn(l)!=="body"),o=null;const s=tt(e).position==="fixed";let i=s?St(e):e;for(;et(i)&&!cn(i);){const l=tt(i),c=fs(i);!c&&l.position==="fixed"&&(o=null),(s?!c&&!o:!c&&l.position==="static"&&!!o&&cy.has(o.position)||Dn(i)&&!c&&hc(e,i))?r=r.filter(d=>d!==i):o=l,i=St(i)}return t.set(e,r),r}function fy(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Ir(t)?[]:dy(t,this._c):[].concat(n),r],l=i[0],c=i.reduce((u,d)=>{const f=zi(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},zi(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function hy(e){const{width:t,height:n}=uc(e);return{width:t,height:n}}function py(e,t,n){const r=at(t),o=lt(t),s=n==="fixed",i=It(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=it(0);function u(){c.x=Pr(o)}if(r||!r&&!s)if((mn(t)!=="body"||Dn(o))&&(l=Rr(t)),r){const h=It(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else o&&u();s&&!r&&o&&u();const d=o&&!r&&!s?fc(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 no(e){return tt(e).position==="static"}function Oi(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 pc(e,t){const n=Ke(e);if(Ir(e))return n;if(!at(e)){let o=St(e);for(;o&&!cn(o);){if(et(o)&&!no(o))return o;o=St(o)}return n}let r=Oi(e,t);for(;r&&Gv(r)&&no(r);)r=Oi(r,t);return r&&cn(r)&&no(r)&&!fs(r)?n:r||ty(e)||n}const my=async function(e){const t=this.getOffsetParent||pc,n=this.getDimensions,r=await n(e.floating);return{reference:py(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function gy(e){return tt(e).direction==="rtl"}const xy={convertOffsetParentRelativeRectToViewportRelativeRect:sy,getDocumentElement:lt,getClippingRect:fy,getOffsetParent:pc,getElementRects:my,getClientRects:iy,getDimensions:hy,getScale:en,isElement:et,isRTL:gy};function mc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function vy(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:h}=u;if(l||t(),!m||!h)return;const g=er(f),p=er(o.clientWidth-(d+m)),x=er(o.clientHeight-(f+h)),y=er(d),k={rootMargin:-g+"px "+-p+"px "+-x+"px "+-y+"px",threshold:qe(0,kt(1,c))||1};let S=!0;function j(O){const N=O[0].intersectionRatio;if(N!==c){if(!S)return i();N?i(!1,N):r=setTimeout(()=>{i(!1,1e-7)},1e3)}N===1&&!mc(u,e.getBoundingClientRect())&&i(),S=!1}try{n=new IntersectionObserver(j,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(j,k)}n.observe(e)}return i(!0),s}function yy(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=ps(e),d=o||s?[...u?An(u):[],...An(t)]:[];d.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const f=u&&l?vy(u,n):null;let m=-1,h=null;i&&(h=new ResizeObserver(y=>{let[_]=y;_&&_.target===u&&h&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var k;(k=h)==null||k.observe(t)})),n()}),u&&!c&&h.observe(u),h.observe(t));let g,p=c?It(e):null;c&&x();function x(){const y=It(e);p&&!mc(p,y)&&n(),p=y,g=requestAnimationFrame(x)}return n(),()=>{var y;d.forEach(_=>{o&&_.removeEventListener("scroll",n),s&&_.removeEventListener("resize",n)}),f?.(),(y=h)==null||y.disconnect(),h=null,c&&cancelAnimationFrame(g)}}const by=Wv,wy=Vv,_y=Bv,ky=qv,Sy=Uv,Ii=$v,Cy=Hv,jy=(e,t,n)=>{const r=new Map,o={platform:xy,...n},s={...o.platform,_c:r};return Fv(e,t,{...o,platform:s})};var Ey=typeof document<"u",Ny=function(){},ar=Ey?v.useLayoutEffect:Ny;function vr(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(!vr(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)&&!vr(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function gc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ri(e,t){const n=gc(e);return Math.round(t*n)/n}function ro(e){const t=v.useRef(e);return ar(()=>{t.current=e}),t}function Ty(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]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=v.useState(r);vr(m,r)||h(r);const[g,p]=v.useState(null),[x,y]=v.useState(null),_=v.useCallback(U=>{U!==O.current&&(O.current=U,p(U))},[]),k=v.useCallback(U=>{U!==N.current&&(N.current=U,y(U))},[]),S=s||g,j=i||x,O=v.useRef(null),N=v.useRef(null),A=v.useRef(d),z=c!=null,R=ro(c),H=ro(o),C=ro(u),I=v.useCallback(()=>{if(!O.current||!N.current)return;const U={placement:t,strategy:n,middleware:m};H.current&&(U.platform=H.current),jy(O.current,N.current,U).then(J=>{const se={...J,isPositioned:C.current!==!1};b.current&&!vr(A.current,se)&&(A.current=se,In.flushSync(()=>{f(se)}))})},[m,t,n,H,C]);ar(()=>{u===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,f(U=>({...U,isPositioned:!1})))},[u]);const b=v.useRef(!1);ar(()=>(b.current=!0,()=>{b.current=!1}),[]),ar(()=>{if(S&&(O.current=S),j&&(N.current=j),S&&j){if(R.current)return R.current(S,j,I);I()}},[S,j,I,R,z]);const D=v.useMemo(()=>({reference:O,floating:N,setReference:_,setFloating:k}),[_,k]),K=v.useMemo(()=>({reference:S,floating:j}),[S,j]),L=v.useMemo(()=>{const U={position:n,left:0,top:0};if(!K.floating)return U;const J=Ri(K.floating,d.x),se=Ri(K.floating,d.y);return l?{...U,transform:"translate("+J+"px, "+se+"px)",...gc(K.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:J,top:se}},[n,l,K.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:I,refs:D,elements:K,floatingStyles:L}),[d,I,D,K,L])}const Ay=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?Ii({element:r.current,padding:o}).fn(n):{}:r?Ii({element:r,padding:o}).fn(n):{}}}},zy=(e,t)=>({...by(e),options:[e,t]}),Oy=(e,t)=>({...wy(e),options:[e,t]}),Iy=(e,t)=>({...Cy(e),options:[e,t]}),Ry=(e,t)=>({..._y(e),options:[e,t]}),Py=(e,t)=>({...ky(e),options:[e,t]}),My=(e,t)=>({...Sy(e),options:[e,t]}),Dy=(e,t)=>({...Ay(e),options:[e,t]});var Ly="Arrow",xc=v.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return a.jsx(Se.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"})})});xc.displayName=Ly;var Fy=xc,ms="Popper",[vc,Mr]=$t(ms),[$y,yc]=vc(ms),bc=e=>{const{__scopePopper:t,children:n}=e,[r,o]=v.useState(null);return a.jsx($y,{scope:t,anchor:r,onAnchorChange:o,children:n})};bc.displayName=ms;var wc="PopperAnchor",_c=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=yc(wc,n),i=v.useRef(null),l=Ie(t,i),c=v.useRef(null);return v.useEffect(()=>{const u=c.current;c.current=r?.current||i.current,u!==c.current&&s.onAnchorChange(c.current)}),r?null:a.jsx(Se.div,{...o,ref:l})});_c.displayName=wc;var gs="PopperContent",[By,Uy]=vc(gs),kc=v.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:h="optimized",onPlaced:g,...p}=e,x=yc(gs,n),[y,_]=v.useState(null),k=Ie(t,X=>_(X)),[S,j]=v.useState(null),O=jv(S),N=O?.width??0,A=O?.height??0,z=r+(s!=="center"?"-"+s:""),R=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},H=Array.isArray(u)?u:[u],C=H.length>0,I={padding:R,boundary:H.filter(Wy),altBoundary:C},{refs:b,floatingStyles:D,placement:K,isPositioned:L,middlewareData:U}=Ty({strategy:"fixed",placement:z,whileElementsMounted:(...X)=>yy(...X,{animationFrame:h==="always"}),elements:{reference:x.anchor},middleware:[zy({mainAxis:o+A,alignmentAxis:i}),c&&Oy({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?Iy():void 0,...I}),c&&Ry({...I}),Py({...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`)}}),S&&Dy({element:S,padding:l}),Vy({arrowWidth:N,arrowHeight:A}),m&&My({strategy:"referenceHidden",...I})]}),[J,se]=jc(K),B=_t(g);Ue(()=>{L&&B?.()},[L,B]);const $=U.arrow?.x,oe=U.arrow?.y,ee=U.arrow?.centerOffset!==0,[q,ue]=v.useState();return Ue(()=>{y&&ue(window.getComputedStyle(y).zIndex)},[y]),a.jsx("div",{ref:b.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:L?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:q,"--radix-popper-transform-origin":[U.transformOrigin?.x,U.transformOrigin?.y].join(" "),...U.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(By,{scope:n,placedSide:J,onArrowChange:j,arrowX:$,arrowY:oe,shouldHideArrow:ee,children:a.jsx(Se.div,{"data-side":J,"data-align":se,...p,ref:k,style:{...p.style,animation:L?void 0:"none"}})})})});kc.displayName=gs;var Sc="PopperArrow",Zy={top:"bottom",right:"left",bottom:"top",left:"right"},Cc=v.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=Uy(Sc,r),i=Zy[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(Fy,{...o,ref:n,style:{...o.style,display:"block"}})})});Cc.displayName=Sc;function Wy(e){return e!==null}var Vy=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]=jc(n),f={start:"0%",center:"50%",end:"100%"}[d],m=(o.arrow?.x??0)+l/2,h=(o.arrow?.y??0)+c/2;let g="",p="";return u==="bottom"?(g=i?f:`${m}px`,p=`${-c}px`):u==="top"?(g=i?f:`${m}px`,p=`${r.floating.height+c}px`):u==="right"?(g=`${-c}px`,p=i?f:`${h}px`):u==="left"&&(g=`${r.floating.width+c}px`,p=i?f:`${h}px`),{data:{x:g,y:p}}}});function jc(e){const[t,n="center"]=e.split("-");return[t,n]}var Ec=bc,Nc=_c,Tc=kc,Ac=Cc,oo="rovingFocusGroup.onEntryFocus",Hy={bubbles:!1,cancelable:!0},Ln="RovingFocusGroup",[jo,zc,qy]=zl(Ln),[Ky,Oc]=$t(Ln,[qy]),[Jy,Gy]=Ky(Ln),Ic=v.forwardRef((e,t)=>a.jsx(jo.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(jo.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Yy,{...e,ref:t})})}));Ic.displayName=Ln;var Yy=v.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=v.useRef(null),h=Ie(t,m),g=rs(s),[p,x]=ln({prop:i,defaultProp:l??null,onChange:c,caller:Ln}),[y,_]=v.useState(!1),k=_t(u),S=zc(n),j=v.useRef(!1),[O,N]=v.useState(0);return v.useEffect(()=>{const A=m.current;if(A)return A.addEventListener(oo,k),()=>A.removeEventListener(oo,k)},[k]),a.jsx(Jy,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:p,onItemFocus:v.useCallback(A=>x(A),[x]),onItemShiftTab:v.useCallback(()=>_(!0),[]),onFocusableItemAdd:v.useCallback(()=>N(A=>A+1),[]),onFocusableItemRemove:v.useCallback(()=>N(A=>A-1),[]),children:a.jsx(Se.div,{tabIndex:y||O===0?-1:0,"data-orientation":r,...f,ref:h,style:{outline:"none",...e.style},onMouseDown:ye(e.onMouseDown,()=>{j.current=!0}),onFocus:ye(e.onFocus,A=>{const z=!j.current;if(A.target===A.currentTarget&&z&&!y){const R=new CustomEvent(oo,Hy);if(A.currentTarget.dispatchEvent(R),!R.defaultPrevented){const H=S().filter(K=>K.focusable),C=H.find(K=>K.active),I=H.find(K=>K.id===p),D=[C,I,...H].filter(Boolean).map(K=>K.ref.current);Mc(D,d)}}j.current=!1}),onBlur:ye(e.onBlur,()=>_(!1))})})}),Rc="RovingFocusGroupItem",Pc=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...l}=e,c=ht(),u=s||c,d=Gy(Rc,n),f=d.currentTabStopId===u,m=zc(n),{onFocusableItemAdd:h,onFocusableItemRemove:g,currentTabStopId:p}=d;return v.useEffect(()=>{if(r)return h(),()=>g()},[r,h,g]),a.jsx(jo.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:a.jsx(Se.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 y=e2(x,d.orientation,d.dir);if(y!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let k=m().filter(S=>S.focusable).map(S=>S.ref.current);if(y==="last")k.reverse();else if(y==="prev"||y==="next"){y==="prev"&&k.reverse();const S=k.indexOf(x.currentTarget);k=d.loop?t2(k,S+1):k.slice(S+1)}setTimeout(()=>Mc(k))}}),children:typeof i=="function"?i({isCurrentTabStop:f,hasTabStop:p!=null}):i})})});Pc.displayName=Rc;var Xy={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Qy(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function e2(e,t,n){const r=Qy(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Xy[r]}function Mc(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function t2(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var n2=Ic,r2=Pc;function Pi(e,[t,n]){return Math.min(n,Math.max(t,e))}var o2=[" ","Enter","ArrowUp","ArrowDown"],s2=[" ","Enter"],Rt="Select",[Dr,Lr,i2]=zl(Rt),[gn]=$t(Rt,[i2,Mr]),Fr=Mr(),[a2,Et]=gn(Rt),[l2,c2]=gn(Rt),Dc=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:h,form:g}=e,p=Fr(t),[x,y]=v.useState(null),[_,k]=v.useState(null),[S,j]=v.useState(!1),O=rs(u),[N,A]=ln({prop:r,defaultProp:o??!1,onChange:s,caller:Rt}),[z,R]=ln({prop:i,defaultProp:l,onChange:c,caller:Rt}),H=v.useRef(null),C=x?g||!!x.closest("form"):!0,[I,b]=v.useState(new Set),D=Array.from(I).map(K=>K.props.value).join(";");return a.jsx(Ec,{...p,children:a.jsxs(a2,{required:h,scope:t,trigger:x,onTriggerChange:y,valueNode:_,onValueNodeChange:k,valueNodeHasChildren:S,onValueNodeHasChildrenChange:j,contentId:ht(),value:z,onValueChange:R,open:N,onOpenChange:A,dir:O,triggerPointerDownPosRef:H,disabled:m,children:[a.jsx(Dr.Provider,{scope:t,children:a.jsx(l2,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(K=>{b(L=>new Set(L).add(K))},[]),onNativeOptionRemove:v.useCallback(K=>{b(L=>{const U=new Set(L);return U.delete(K),U})},[]),children:n})}),C?a.jsxs(su,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:f,value:z,onChange:K=>R(K.target.value),disabled:m,form:g,children:[z===void 0?a.jsx("option",{value:""}):null,Array.from(I)]},D):null]})})};Dc.displayName=Rt;var Lc="SelectTrigger",Fc=v.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=Fr(n),i=Et(Lc,n),l=i.disabled||r,c=Ie(t,i.onTriggerChange),u=Lr(n),d=v.useRef("touch"),[f,m,h]=au(p=>{const x=u().filter(k=>!k.disabled),y=x.find(k=>k.value===i.value),_=lu(x,p,y);_!==void 0&&i.onValueChange(_.value)}),g=p=>{l||(i.onOpenChange(!0),h()),p&&(i.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return a.jsx(Nc,{asChild:!0,...s,children:a.jsx(Se.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":iu(i.value)?"":void 0,...o,ref:c,onClick:ye(o.onClick,p=>{p.currentTarget.focus(),d.current!=="mouse"&&g(p)}),onPointerDown:ye(o.onPointerDown,p=>{d.current=p.pointerType;const x=p.target;x.hasPointerCapture(p.pointerId)&&x.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(g(p),p.preventDefault())}),onKeyDown:ye(o.onKeyDown,p=>{const x=f.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&m(p.key),!(x&&p.key===" ")&&o2.includes(p.key)&&(g(),p.preventDefault())})})})});Fc.displayName=Lc;var $c="SelectValue",Bc=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...l}=e,c=Et($c,n),{onValueNodeHasChildrenChange:u}=c,d=s!==void 0,f=Ie(t,c.onValueNodeChange);return Ue(()=>{u(d)},[u,d]),a.jsx(Se.span,{...l,ref:f,style:{pointerEvents:"none"},children:iu(c.value)?a.jsx(a.Fragment,{children:i}):s})});Bc.displayName=$c;var u2="SelectIcon",Uc=v.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return a.jsx(Se.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});Uc.displayName=u2;var d2="SelectPortal",Zc=e=>a.jsx(Tr,{asChild:!0,...e});Zc.displayName=d2;var Pt="SelectContent",Wc=v.forwardRef((e,t)=>{const n=Et(Pt,e.__scopeSelect),[r,o]=v.useState();if(Ue(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?In.createPortal(a.jsx(Vc,{scope:e.__scopeSelect,children:a.jsx(Dr.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),s):null}return a.jsx(Hc,{...e,ref:t})});Wc.displayName=Pt;var Xe=10,[Vc,Nt]=gn(Pt),f2="SelectContentImpl",h2=an("SelectContent.RemoveScroll"),Hc=v.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:h,sticky:g,hideWhenDetached:p,avoidCollisions:x,...y}=e,_=Et(Pt,n),[k,S]=v.useState(null),[j,O]=v.useState(null),N=Ie(t,X=>S(X)),[A,z]=v.useState(null),[R,H]=v.useState(null),C=Lr(n),[I,b]=v.useState(!1),D=v.useRef(!1);v.useEffect(()=>{if(k)return Wl(k)},[k]),Pl();const K=v.useCallback(X=>{const[ie,...ae]=C().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},[C,j]),L=v.useCallback(()=>K([A,k]),[K,A,k]);v.useEffect(()=>{I&&L()},[I,L]);const{onOpenChange:U,triggerPointerDownPosRef:J}=_;v.useEffect(()=>{if(k){let X={x:0,y:0};const ie=he=>{X={x:Math.abs(Math.round(he.pageX)-(J.current?.x??0)),y:Math.abs(Math.round(he.pageY)-(J.current?.y??0))}},ae=he=>{X.x<=10&&X.y<=10?he.preventDefault():k.contains(he.target)||U(!1),document.removeEventListener("pointermove",ie),J.current=null};return J.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,U,J]),v.useEffect(()=>{const X=()=>U(!1);return window.addEventListener("blur",X),window.addEventListener("resize",X),()=>{window.removeEventListener("blur",X),window.removeEventListener("resize",X)}},[U]);const[se,B]=au(X=>{const ie=C().filter(fe=>!fe.disabled),ae=ie.find(fe=>fe.ref.current===document.activeElement),he=lu(ie,X,ae);he&&setTimeout(()=>he.ref.current.focus())}),$=v.useCallback((X,ie,ae)=>{const he=!D.current&&!ae;(_.value!==void 0&&_.value===ie||he)&&(z(X),he&&(D.current=!0))},[_.value]),oe=v.useCallback(()=>k?.focus(),[k]),ee=v.useCallback((X,ie,ae)=>{const he=!D.current&&!ae;(_.value!==void 0&&_.value===ie||he)&&H(X)},[_.value]),q=r==="popper"?Eo:qc,ue=q===Eo?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:p,avoidCollisions:x}:{};return a.jsx(Vc,{scope:n,content:k,viewport:j,onViewportChange:O,itemRefCallback:$,selectedItem:A,onItemLeave:oe,itemTextRefCallback:ee,focusSelectedItem:L,selectedItemText:R,position:r,isPositioned:I,searchRef:se,children:a.jsx(ss,{as:h2,allowPinchZoom:!0,children:a.jsx(os,{asChild:!0,trapped:_.open,onMountAutoFocus:X=>{X.preventDefault()},onUnmountAutoFocus:ye(o,X=>{_.trigger?.focus({preventScroll:!0}),X.preventDefault()}),children:a.jsx(Nr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:X=>X.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:a.jsx(q,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:X=>X.preventDefault(),...y,...ue,onPlaced:()=>b(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:ye(y.onKeyDown,X=>{const ie=X.ctrlKey||X.altKey||X.metaKey;if(X.key==="Tab"&&X.preventDefault(),!ie&&X.key.length===1&&B(X.key),["ArrowUp","ArrowDown","Home","End"].includes(X.key)){let he=C().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(()=>K(he)),X.preventDefault()}})})})})})})});Hc.displayName=f2;var p2="SelectItemAlignedPosition",qc=v.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=Et(Pt,n),i=Nt(Pt,n),[l,c]=v.useState(null),[u,d]=v.useState(null),f=Ie(t,N=>d(N)),m=Lr(n),h=v.useRef(!1),g=v.useRef(!0),{viewport:p,selectedItem:x,selectedItemText:y,focusSelectedItem:_}=i,k=v.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&p&&x&&y){const N=s.trigger.getBoundingClientRect(),A=u.getBoundingClientRect(),z=s.valueNode.getBoundingClientRect(),R=y.getBoundingClientRect();if(s.dir!=="rtl"){const fe=R.left-A.left,we=z.left-fe,Te=N.left-we,w=N.width+Te,Y=Math.max(w,A.width),V=window.innerWidth-Xe,T=Pi(we,[Xe,Math.max(Xe,V-Y)]);l.style.minWidth=w+"px",l.style.left=T+"px"}else{const fe=A.right-R.right,we=window.innerWidth-z.right-fe,Te=window.innerWidth-N.right-we,w=N.width+Te,Y=Math.max(w,A.width),V=window.innerWidth-Xe,T=Pi(we,[Xe,Math.max(Xe,V-Y)]);l.style.minWidth=w+"px",l.style.right=T+"px"}const H=m(),C=window.innerHeight-Xe*2,I=p.scrollHeight,b=window.getComputedStyle(u),D=parseInt(b.borderTopWidth,10),K=parseInt(b.paddingTop,10),L=parseInt(b.borderBottomWidth,10),U=parseInt(b.paddingBottom,10),J=D+K+I+U+L,se=Math.min(x.offsetHeight*5,J),B=window.getComputedStyle(p),$=parseInt(B.paddingTop,10),oe=parseInt(B.paddingBottom,10),ee=N.top+N.height/2-Xe,q=C-ee,ue=x.offsetHeight/2,X=x.offsetTop+ue,ie=D+K+X,ae=J-ie;if(ie<=ee){const fe=H.length>0&&x===H[H.length-1].ref.current;l.style.bottom="0px";const we=u.clientHeight-p.offsetTop-p.offsetHeight,Te=Math.max(q,ue+(fe?oe:0)+we+L),w=ie+Te;l.style.height=w+"px"}else{const fe=H.length>0&&x===H[0].ref.current;l.style.top="0px";const Te=Math.max(ee,D+p.offsetTop+(fe?$:0)+ue)+ae;l.style.height=Te+"px",p.scrollTop=ie-ee+p.offsetTop}l.style.margin=`${Xe}px 0`,l.style.minHeight=se+"px",l.style.maxHeight=C+"px",r?.(),requestAnimationFrame(()=>h.current=!0)}},[m,s.trigger,s.valueNode,l,u,p,x,y,s.dir,r]);Ue(()=>k(),[k]);const[S,j]=v.useState();Ue(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const O=v.useCallback(N=>{N&&g.current===!0&&(k(),_?.(),g.current=!1)},[k,_]);return a.jsx(g2,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:O,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:a.jsx(Se.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});qc.displayName=p2;var m2="SelectPopperPosition",Eo=v.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Xe,...s}=e,i=Fr(n);return a.jsx(Tc,{...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)"}})});Eo.displayName=m2;var[g2,xs]=gn(Pt,{}),No="SelectViewport",Kc=v.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=Nt(No,n),i=xs(No,n),l=Ie(t,s.onViewportChange),c=v.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(Dr.Slot,{scope:n,children:a.jsx(Se.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 h=Math.abs(c.current-d.scrollTop);if(h>0){const g=window.innerHeight-Xe*2,p=parseFloat(f.style.minHeight),x=parseFloat(f.style.height),y=Math.max(p,x);if(y<g){const _=y+h,k=Math.min(g,_),S=_-k;f.style.height=k+"px",f.style.bottom==="0px"&&(d.scrollTop=S>0?S:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});Kc.displayName=No;var Jc="SelectGroup",[x2,v2]=gn(Jc),y2=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=ht();return a.jsx(x2,{scope:n,id:o,children:a.jsx(Se.div,{role:"group","aria-labelledby":o,...r,ref:t})})});y2.displayName=Jc;var Gc="SelectLabel",b2=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=v2(Gc,n);return a.jsx(Se.div,{id:o.id,...r,ref:t})});b2.displayName=Gc;var yr="SelectItem",[w2,Yc]=gn(yr),Xc=v.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,l=Et(yr,n),c=Nt(yr,n),u=l.value===r,[d,f]=v.useState(s??""),[m,h]=v.useState(!1),g=Ie(t,_=>c.itemRefCallback?.(_,r,o)),p=ht(),x=v.useRef("touch"),y=()=>{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(w2,{scope:n,value:r,disabled:o,textId:p,isSelected:u,onItemTextChange:v.useCallback(_=>{f(k=>k||(_?.textContent??"").trim())},[]),children:a.jsx(Dr.ItemSlot,{scope:n,value:r,disabled:o,textValue:d,children:a.jsx(Se.div,{role:"option","aria-labelledby":p,"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,()=>h(!0)),onBlur:ye(i.onBlur,()=>h(!1)),onClick:ye(i.onClick,()=>{x.current!=="mouse"&&y()}),onPointerUp:ye(i.onPointerUp,()=>{x.current==="mouse"&&y()}),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===" "||(s2.includes(_.key)&&y(),_.key===" "&&_.preventDefault())})})})})});Xc.displayName=yr;var jn="SelectItemText",Qc=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=Et(jn,n),l=Nt(jn,n),c=Yc(jn,n),u=c2(jn,n),[d,f]=v.useState(null),m=Ie(t,y=>f(y),c.onItemTextChange,y=>l.itemTextRefCallback?.(y,c.value,c.disabled)),h=d?.textContent,g=v.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:p,onNativeOptionRemove:x}=u;return Ue(()=>(p(g),()=>x(g)),[p,x,g]),a.jsxs(a.Fragment,{children:[a.jsx(Se.span,{id:c.textId,...s,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?In.createPortal(s.children,i.valueNode):null]})});Qc.displayName=jn;var eu="SelectItemIndicator",tu=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Yc(eu,n).isSelected?a.jsx(Se.span,{"aria-hidden":!0,...r,ref:t}):null});tu.displayName=eu;var To="SelectScrollUpButton",nu=v.forwardRef((e,t)=>{const n=Nt(To,e.__scopeSelect),r=xs(To,e.__scopeSelect),[o,s]=v.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(ou,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});nu.displayName=To;var Ao="SelectScrollDownButton",ru=v.forwardRef((e,t)=>{const n=Nt(Ao,e.__scopeSelect),r=xs(Ao,e.__scopeSelect),[o,s]=v.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(ou,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});ru.displayName=Ao;var ou=v.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=Nt("SelectScrollButton",n),i=v.useRef(null),l=Lr(n),c=v.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),Ue(()=>{l().find(d=>d.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[l]),a.jsx(Se.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()})})}),_2="SelectSeparator",k2=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(Se.div,{"aria-hidden":!0,...r,ref:t})});k2.displayName=_2;var zo="SelectArrow",S2=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Fr(n),s=Et(zo,n),i=Nt(zo,n);return s.open&&i.position==="popper"?a.jsx(Ac,{...o,...r,ref:t}):null});S2.displayName=zo;var C2="SelectBubbleInput",su=v.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=v.useRef(null),s=Ie(r,o),i=Cv(t);return v.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(Se.select,{...n,style:{...Tl,...n.style},ref:s,defaultValue:t})});su.displayName=C2;function iu(e){return e===""||e===void 0}function au(e){const t=_t(e),n=v.useRef(""),r=v.useRef(0),o=v.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=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function lu(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=j2(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 j2(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var E2=Dc,N2=Fc,T2=Bc,A2=Uc,z2=Zc,O2=Wc,I2=Kc,R2=Xc,P2=Qc,M2=tu,D2=nu,L2=ru,$r="Tabs",[F2]=$t($r,[Oc]),cu=Oc(),[$2,vs]=F2($r),uu=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=rs(l),[f,m]=ln({prop:r,onChange:o,defaultProp:s??"",caller:$r});return a.jsx($2,{scope:n,baseId:ht(),value:f,onValueChange:m,orientation:i,dir:d,activationMode:c,children:a.jsx(Se.div,{dir:d,"data-orientation":i,...u,ref:t})})});uu.displayName=$r;var du="TabsList",fu=v.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=vs(du,n),i=cu(n);return a.jsx(n2,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:a.jsx(Se.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});fu.displayName=du;var hu="TabsTrigger",pu=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=vs(hu,n),l=cu(n),c=xu(i.baseId,r),u=vu(i.baseId,r),d=r===i.value;return a.jsx(r2,{asChild:!0,...l,focusable:!o,active:d,children:a.jsx(Se.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)})})})});pu.displayName=hu;var mu="TabsContent",gu=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,l=vs(mu,n),c=xu(l.baseId,r),u=vu(l.baseId,r),d=r===l.value,f=v.useRef(d);return v.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),a.jsx(Bt,{present:o||d,children:({present:m})=>a.jsx(Se.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})})});gu.displayName=mu;function xu(e,t){return`${e}-trigger-${t}`}function vu(e,t){return`${e}-content-${t}`}var B2=uu,U2=fu,Z2=pu,W2=gu,[Br]=$t("Tooltip",[Mr]),Ur=Mr(),yu="TooltipProvider",V2=700,Oo="tooltip.open",[H2,ys]=Br(yu),bu=e=>{const{__scopeTooltip:t,delayDuration:n=V2,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=v.useRef(!0),l=v.useRef(!1),c=v.useRef(0);return v.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),a.jsx(H2,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:v.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:v.useCallback(u=>{l.current=u},[]),disableHoverableContent:o,children:s})};bu.displayName=yu;var zn="Tooltip",[q2,Fn]=Br(zn),wu=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:i,delayDuration:l}=e,c=ys(zn,e.__scopeTooltip),u=Ur(t),[d,f]=v.useState(null),m=ht(),h=v.useRef(0),g=i??c.disableHoverableContent,p=l??c.delayDuration,x=v.useRef(!1),[y,_]=ln({prop:r,defaultProp:o??!1,onChange:N=>{N?(c.onOpen(),document.dispatchEvent(new CustomEvent(Oo))):c.onClose(),s?.(N)},caller:zn}),k=v.useMemo(()=>y?x.current?"delayed-open":"instant-open":"closed",[y]),S=v.useCallback(()=>{window.clearTimeout(h.current),h.current=0,x.current=!1,_(!0)},[_]),j=v.useCallback(()=>{window.clearTimeout(h.current),h.current=0,_(!1)},[_]),O=v.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{x.current=!0,_(!0),h.current=0},p)},[p,_]);return v.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),a.jsx(Ec,{...u,children:a.jsx(q2,{scope:t,contentId:m,open:y,stateAttribute:k,trigger:d,onTriggerChange:f,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayedRef.current?O():S()},[c.isOpenDelayedRef,O,S]),onTriggerLeave:v.useCallback(()=>{g?j():(window.clearTimeout(h.current),h.current=0)},[j,g]),onOpen:S,onClose:j,disableHoverableContent:g,children:n})})};wu.displayName=zn;var Io="TooltipTrigger",_u=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Fn(Io,n),s=ys(Io,n),i=Ur(n),l=v.useRef(null),c=Ie(t,l,o.onTriggerChange),u=v.useRef(!1),d=v.useRef(!1),f=v.useCallback(()=>u.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),a.jsx(Nc,{asChild:!0,...i,children:a.jsx(Se.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)})})});_u.displayName=Io;var bs="TooltipPortal",[K2,J2]=Br(bs,{forceMount:void 0}),ku=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=Fn(bs,t);return a.jsx(K2,{scope:t,forceMount:n,children:a.jsx(Bt,{present:n||s.open,children:a.jsx(Tr,{asChild:!0,container:o,children:r})})})};ku.displayName=bs;var un="TooltipContent",Su=v.forwardRef((e,t)=>{const n=J2(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(Cu,{side:o,...s,ref:t}):a.jsx(G2,{side:o,...s,ref:t})})}),G2=v.forwardRef((e,t)=>{const n=Fn(un,e.__scopeTooltip),r=ys(un,e.__scopeTooltip),o=v.useRef(null),s=Ie(t,o),[i,l]=v.useState(null),{trigger:c,onClose:u}=n,d=o.current,{onPointerInTransitChange:f}=r,m=v.useCallback(()=>{l(null),f(!1)},[f]),h=v.useCallback((g,p)=>{const x=g.currentTarget,y={x:g.clientX,y:g.clientY},_=eb(y,x.getBoundingClientRect()),k=tb(y,_),S=nb(p.getBoundingClientRect()),j=ob([...k,...S]);l(j),f(!0)},[f]);return v.useEffect(()=>()=>m(),[m]),v.useEffect(()=>{if(c&&d){const g=x=>h(x,d),p=x=>h(x,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",p),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",p)}}},[c,d,h,m]),v.useEffect(()=>{if(i){const g=p=>{const x=p.target,y={x:p.clientX,y:p.clientY},_=c?.contains(x)||d?.contains(x),k=!rb(y,i);_?m():k&&(m(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,i,u,m]),a.jsx(Cu,{...e,ref:s})}),[Y2,X2]=Br(zn,{isInside:!1}),Q2=U1("TooltipContent"),Cu=v.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...l}=e,c=Fn(un,n),u=Ur(n),{onClose:d}=c;return v.useEffect(()=>(document.addEventListener(Oo,d),()=>document.removeEventListener(Oo,d)),[d]),v.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(Nr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:a.jsxs(Tc,{"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(Q2,{children:r}),a.jsx(Y2,{scope:n,isInside:!0,children:a.jsx(J1,{id:c.contentId,role:"tooltip",children:o||r})})]})})});Su.displayName=un;var ju="TooltipArrow",Eu=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Ur(n);return X2(ju,n).isInside?null:a.jsx(Ac,{...o,...r,ref:t})});Eu.displayName=ju;function eb(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 tb(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 nb(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 rb(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 ob(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),sb(t)}function sb(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 ib=bu,ab=wu,lb=_u,cb=ku,ub=Su,db=Eu;const fb=ns("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 Nu({className:e,variant:t="default",asChild:n=!1,...r}){const o=n?$1:"span";return a.jsx(o,{"data-slot":"badge","data-variant":t,className:xe(fb({variant:t}),e),...r})}function ws({...e}){return a.jsx(vv,{"data-slot":"dialog",...e})}function hb({...e}){return a.jsx(yv,{"data-slot":"dialog-trigger",...e})}function pb({...e}){return a.jsx(bv,{"data-slot":"dialog-portal",...e})}function mb({className:e,...t}){return a.jsx(wv,{"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 _s({className:e,children:t,...n}){return a.jsxs(pb,{children:[a.jsx(mb,{}),a.jsxs(_v,{"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(Sv,{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(fl,{className:"size-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function ks({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 Ss({className:e,...t}){return a.jsx(kv,{"data-slot":"dialog-title",className:xe("text-lg font-semibold leading-none tracking-tight",e),...t})}const gb=ns("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(gb({variant:t,size:n,className:e})),...r})}function Tu({open:e,onOpenChange:t,title:n,description:r,confirmLabel:o="Confirm",variant:s="default",onConfirm:i}){return a.jsx(ws,{open:e,onOpenChange:t,children:a.jsxs(_s,{children:[a.jsx(ks,{children:a.jsx(Ss,{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 xb={anthropic:"Anthropic",openai:"OpenAI",unknown:"Unknown"};function Mi(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function vb({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[h,g]=v.useState(!1),p=x=>{x.stopPropagation(),m!==void 0&&g(!0)};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:x=>{x.target===x.currentTarget&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),c())},children:[l?a.jsx(Pn,{className:"size-4 text-muted-foreground shrink-0"}):d?a.jsx(fr,{className:"size-4 animate-spin text-muted-foreground shrink-0"}):a.jsx(Go,{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.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(O0,{className:"size-3"}),a.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",children:f})]}),!u&&a.jsx(Nu,{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:xb[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:[Mi(t)," - ",Mi(n)]})]}),a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[a.jsx(cl,{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(es,{className:"size-3 text-muted-foreground"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[a.jsx("span",{className:"text-blue-400",children:Qe(o)})," / ",a.jsx("span",{className:"text-amber-400",children:Qe(s)})]})]}),a.jsx("span",{className:"flex-1 min-w-0"}),m!==void 0&&a.jsx("button",{type:"button",onClick:p,"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(dl,{className:"size-3.5"})}),a.jsx(Tu,{open:h,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 yb(e){const t=e.find(n=>n.apiFormat!=="unknown");return t!==void 0?t.apiFormat:e[0]?.apiFormat??"unknown"}function bb(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 wb(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 _b(e){const t=new Map;for(const r of e){const o=wb(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 Di(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function kb(e){if(e.responseText===null)return null;try{let t=JSON.parse(e.responseText);return typeof t=="string"&&(t=JSON.parse(t)),Di(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&&Di(t.choices[0])&&typeof t.choices[0].finish_reason=="string"&&t.choices[0].finish_reason==="stop"?"stop":null:null}catch{return null}}function Au(e){return e==="end_turn"||e==="stop"}function Ye({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 Tt=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"})]}),zu=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 Ou({className:e}){return a.jsx(Ye,{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:Tt,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 Sb({className:e}){return a.jsx(Ye,{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:zu,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 Cb({className:e}){return a.jsx(Ye,{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:Tt,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 jb({className:e}){return a.jsx(Ye,{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 Eb({className:e}){return a.jsx(Ye,{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:Tt,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 Nb({className:e}){return a.jsx(Ye,{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:Tt,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 Tb({className:e}){return a.jsx(Ye,{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:zu,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 Ab({className:e}){return a.jsx(Ye,{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:Tt,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 zb({className:e}){return a.jsx(Ye,{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:Tt,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 Ob({className:e}){return a.jsx(Ye,{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:Tt,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 Ib({className:e}){return a.jsx(Ye,{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:Tt,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 Rb({className:e}){return a.jsx(Ye,{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 On=[Ou,Sb,Cb,jb,Eb,Nb,Tb,Ab,zb,Ob,Ib,Rb];function br(e){return On[Math.abs(e)%On.length]??Ou}function Pb(e){const t=On.length-2;return t<=0?0:1+((Number.isFinite(e)?Math.trunc(e):0)%t+t)%t}function Mb(e){return br(Pb(e))}const Db="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",Lb="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",Fb="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",$b="/assets/minimax-BPMzvuL-.jpeg",Bb="/assets/alibaba-TTwafVwX.svg",Ub="/assets/qwen-CONDcHqt.png",Zb="/assets/zhipuai-BPNAnxo-.svg",Wb={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen","glm-":"zhipuai"};function Iu(e){if(e===null)return"unknown";const t=e.toLowerCase();for(const[n,r]of Object.entries(Wb))if(t.startsWith(n.toLowerCase()))return r;return"unknown"}const Ut={width:24,height:24,objectFit:"contain"},Vb=We.memo(({className:e})=>a.jsx("img",{src:Db,alt:"Anthropic",className:e,style:Ut})),Hb=We.memo(({className:e})=>a.jsx("img",{src:Lb,alt:"OpenAI",className:e,style:{...Ut,background:"white",borderRadius:"4px"}})),qb=We.memo(({className:e})=>a.jsx("img",{src:Fb,alt:"DeepSeek",className:e,style:Ut})),Kb=We.memo(({className:e})=>a.jsx("img",{src:$b,alt:"MiniMax",className:e,style:Ut})),Jb=We.memo(({className:e})=>a.jsx("img",{src:Bb,alt:"Alibaba",className:e,style:Ut})),Gb=We.memo(({className:e})=>a.jsx("img",{src:Ub,alt:"Qwen",className:e,style:Ut})),Yb=We.memo(({className:e})=>a.jsx("img",{src:Zb,alt:"ZhipuAI",className:e,style:Ut}));function Ru({provider:e,className:t}){switch(e){case"anthropic":return a.jsx(Vb,{className:t});case"openai":return a.jsx(Hb,{className:t});case"deepseek":return a.jsx(qb,{className:t});case"minimax":return a.jsx(Kb,{className:t});case"alibaba":return a.jsx(Jb,{className:t});case"qwen":return a.jsx(Gb,{className:t});case"zhipuai":return a.jsx(Yb,{className:t});case"unknown":return null}}function $e({delayDuration:e=0,...t}){return a.jsx(ib,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function je({...e}){return a.jsx(ab,{"data-slot":"tooltip",...e})}function Ee({...e}){return a.jsx(lb,{"data-slot":"tooltip-trigger",...e})}function Ne({className:e,sideOffset:t=0,children:n,...r}){return a.jsx(cb,{children:a.jsxs(ub,{"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(db,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const Xb="x-anthropic-billing-header:";function Qb(e){return e.trimStart().toLowerCase().startsWith(Xb)}function ew(e){return Ha(e)?Object.prototype.hasOwnProperty.call(e,"system"):!1}function tw(e){if(!Ha(e))return!1;const t=Ys(e,"type"),n=Ys(e,"text");return typeof t!="string"||t!=="text"||typeof n!="string"?!1:Qb(n)}function nw(e){let t;try{t=JSON.parse(e)}catch{return{body:e,removed:0}}if(!ew(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(tw(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 rw({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(je,{children:[a.jsx(Ee,{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(al,{className:"size-3.5 mr-1"}):a.jsx(il,{className:"size-3.5 mr-1"}),o]})}),a.jsx(Ne,{children:s})]})})}function ow(e){return{depth:Number.POSITIVE_INFINITY}}function sw(e){try{const t=JSON.parse(e);return{kind:"json",data:Ro(t)}}catch{return{kind:"text"}}}function Li(e){const t=v.useMemo(()=>e===null?null:sw(e),[e]),n=t?.kind==="json"?t.data:null,r=v.useMemo(()=>n===null?null:ow(),[n]),[o,s]=v.useState(!1),[i,l]=v.useState(0),[c,u]=v.useState(0),[d,f]=v.useTransition(),m=v.useCallback(()=>{const h=!o,g=h&&r!==null?r.depth:0;f(()=>{s(h),l(g),u(p=>p+1)})},[o,r]);return{parsedData:n,policy:r,isExpanded:o,toggle:m,isPending:d,bulkDepth:i,bulkRevision:c}}function Ro(e){if(e==null)return null;switch(typeof e){case"string":return e;case"number":return e;case"boolean":return e;case"object":{if(Array.isArray(e))return e.map(n=>Ro(n));const t={};for(const n of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,n);t[n]=Ro(r?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function Pu({className:e,orientation:t="horizontal",...n}){return a.jsx(B2,{"data-slot":"tabs","data-orientation":t,orientation:t,className:xe("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",e),...n})}const iw=ns("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 Mu({className:e,variant:t="default",...n}){return a.jsx(U2,{"data-slot":"tabs-list","data-variant":t,className:xe(iw({variant:t}),e),...n})}function dt({className:e,...t}){return a.jsx(Z2,{"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(W2,{"data-slot":"tabs-content",className:xe("flex-1 outline-none",e),...t})}const aw=v.lazy(()=>Mt(()=>import("./CompareDrawer-BpwZCB6M.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.CompareDrawer}))),lw=v.lazy(()=>Mt(()=>import("./ReplayDialog-Clratkzl.js"),__vite__mapDeps([3,1,4,2])).then(e=>({default:e.ReplayDialog}))),cw=v.lazy(()=>Mt(()=>import("./RequestAnatomy-EtiX0r_G.js"),__vite__mapDeps([5,1])).then(e=>({default:e.RequestAnatomy}))),uw=v.lazy(()=>Mt(()=>import("./ResponseView-CJqxo-EN.js"),__vite__mapDeps([4,1,2])).then(e=>({default:e.ResponseView}))),dw=v.lazy(()=>Mt(()=>import("./StreamingChunkSequence-BIbRqQiV.js"),__vite__mapDeps([6,1,2])).then(e=>({default:e.StreamingChunkSequence}))),Fi=v.lazy(()=>Mt(()=>import("./json-viewer-D-z1r1Pp.js").then(e=>e.j),__vite__mapDeps([2,1])).then(e=>({default:e.JsonViewer}))),fw=v.lazy(()=>Mt(()=>import("./json-viewer-D-z1r1Pp.js").then(e=>e.j),__vite__mapDeps([2,1])).then(e=>({default:e.JsonViewerFromString}))),hw=1200,pw=12;function mw(e){const{containerRef:t,setExpandToPath:n,ensureTabActive:r,highlightMs:o}=e,s=v.useRef(null);return v.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??hw)},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 h=m.querySelector(u);if(h!==null){l(h);return}}f>0?window.requestAnimationFrame(()=>d(f-1)):n(null)};window.requestAnimationFrame(()=>d(pw))},[t,r,o,n])}class Du{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,h=[{oldPos:-1,lastComponent:void 0}];let g=this.extractCommon(h[0],n,t,0,r);if(h[0].oldPos+1>=c&&g+1>=l)return i(this.buildValues(h[0].lastComponent,n,t));let p=-1/0,x=1/0;const y=()=>{for(let _=Math.max(p,-u);_<=Math.min(x,u);_+=2){let k;const S=h[_-1],j=h[_+1];S&&(h[_-1]=void 0);let O=!1;if(j){const A=j.oldPos-_;O=j&&0<=A&&A<l}const N=S&&S.oldPos+1<c;if(!O&&!N){h[_]=void 0;continue}if(!N||O&&S.oldPos<j.oldPos?k=this.addToPath(j,!0,!1,0,r):k=this.addToPath(S,!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;h[_]=k,k.oldPos+1>=c&&(x=Math.min(x,_-1)),g+1>=l&&(p=Math.max(p,_+1))}u++};if(o)(function _(){setTimeout(function(){if(u>d||Date.now()>m)return o(void 0);y()||_()},0)})();else for(;u<=d&&Date.now()<=m;){const _=y();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,h){const g=r[u+h];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 gw extends Du{constructor(){super(...arguments),this.tokenize=Fu}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 xw=new gw;function Lu(e,t,n){return xw.diff(e,t,n)}function Fu(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 vw extends Du{constructor(){super(...arguments),this.tokenize=Fu}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(Po(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 yw=new vw;function bw(e,t,n){return yw.diff(e,t,n)}function Po(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]=Po(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]=Po(e[c],t,n,r,c);t.pop(),n.pop()}else i=e;return i}function $i(e){return e===void 0?[]:Object.entries(e).map(t=>[t[0].toLowerCase(),t[1]]).sort(([t],[n])=>t.localeCompare(n))}function Bi([e,t]){return`${e}: ${t}`}function Mo(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 ww(e,t){const n=$i(e).map(Bi).join(`
|
|
92
|
-
`),r=$i(t).map(Bi).join(`
|
|
93
|
-
`);if(n===r)return{lines:[],isEmpty:!0};const o=Lu(n,r);return{lines:Mo(o),isEmpty:!1}}function Ui(e){try{const t=JSON.parse(e);return t===null||typeof t=="string"||typeof t=="object"?t:null}catch{return null}}function _w(e,t){const n=e??"",r=t??"";if(n===r)return{lines:[],isEmpty:!0};const o=Ui(n),s=Ui(r);if(o!==null&&s!==null){const l=bw(o,s)??[];if(l.length===1){const c=l[0];if(c!==void 0&&!c.added&&!c.removed)return{lines:[],isEmpty:!0}}return{lines:Mo(l),isEmpty:!1}}const i=Lu(n,r);return{lines:Mo(i),isEmpty:!1}}function kw(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 Zi(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const Wi=(e,t)=>Math.abs(e-t)<1.01,Sw=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}};let _n;const Vi=()=>{if(_n!==void 0)return _n;if(typeof navigator>"u")return _n=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return _n=!0;const e=navigator.maxTouchPoints;return _n=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Hi=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Cw=e=>e,jw=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},Ew=(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(Hi(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(Hi(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},wr={passive:!0},Nw=typeof window>"u"?!0:"onscrollend"in window,Tw=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const o=e.targetWindow;if(!o)return;const s=e.options.useScrollendEvent&&Nw;let i=0;const l=s?null:Sw(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,wr),s&&r.addEventListener("scrollend",d,wr),()=>{r.removeEventListener("scroll",u),s&&r.removeEventListener("scrollend",d)}},Aw=(e,t)=>Tw(e,t,n=>{const{horizontal:r,isRtl:o}=e.options;return r?n.scrollLeft*(o&&-1||1):n.scrollTop}),zw=(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"]},Ow=(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})},Iw=Ow;class Rw{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:Cw,rangeExtractor:jw,onChange:()=>{},measureElement:zw,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,h=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)!==h)){const x=u>0?this.getVirtualItemForOffset(this.getScrollOffset())??f[0]:null;x&&(l=[x.key,this.getScrollOffset()-x.start]);const y=s.followOnAppend===!0?"auto":s.followOnAppend||null;y&&d>u&&this.isAtEnd(i.scrollEndThreshold)&&(u===0||s.getItemKey(d-1)!==h)&&(c=y)}}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,!(!Vi()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",i,wr),s.addEventListener("touchend",l,wr),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();Wi(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,p=n*2;let x=this._flatMeasurements;if(!x||x.length<p){const k=new Float64Array(p);x&&f>0&&k.set(x.subarray(0,f*2)),x=k,this._flatMeasurements=x}let y;if(f===0)y=r+o;else{const k=f-1;y=x[k*2]+x[k*2+1]+g}for(let k=f;k<n;k++){const S=s(k),j=d.get(S),O=typeof j=="number"?j:this.options.estimateSize(k);x[k*2]=y,x[k*2+1]=O,y+=O+g}const _=kw(n,x,s);return this.measurementsCache=_,_}const m=this.measurementsCache.slice(0,f),h=new Array(l).fill(void 0);for(let g=0;g<f;g++){const p=m[g];p&&(h[p.lane]=g)}for(let g=f;g<n;g++){const p=s(g),x=this.laneAssignments.get(g);let y,_;const k=c==="estimate"||d.has(p);if(x!==void 0&&this.options.lanes>1){y=x;const N=h[y],A=N!==void 0?m[N]:void 0;_=A?A.end+this.options.gap:r+o}else{const N=this.options.lanes===1?m[g-1]:this.getFurthestMeasurement(m,g);_=N?N.end+this.options.gap:r+o,y=N?N.lane:g%this.options.lanes,this.options.lanes>1&&k&&this.laneAssignments.set(g,y)}const S=d.get(p),j=typeof S=="number"?S:this.options.estimateSize(g),O=_+j;m[g]={index:g,start:_,size:j,end:O,key:p,lane:y},h[y]=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?Pw({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,h=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()-h):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=$u(0,r.length-1,s?l=>o[l*2]:l=>Zi(r[l]).start,n);return Zi(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&&(Vi()&&(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&&Wi(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 $u=(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 Pw({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=$u(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 qi=typeof document<"u"?v.useLayoutEffect:v.useEffect;function Mw({useFlushSync:e=!0,...t}){const n=v.useReducer(s=>s+1,0)[1],r={...t,onChange:(s,i)=>{var l;e&&i?In.flushSync(n):n(),(l=t.onChange)==null||l.call(t,s,i)}},[o]=v.useState(()=>new Rw(r));return o.setOptions(r),qi(()=>o._didMount(),[]),qi(()=>o._willUpdate()),o}function Dw(e){return Mw({observeElementRect:Ew,observeElementOffset:Aw,scrollToFn:Iw,...e})}const Lw=22,so=1e4;function Fw(e){return e==="added"?"+":e==="removed"?"-":" "}function $w(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 Bw=function({result:t,emptyLabel:n}){const[r,o]=v.useState("unified"),s=v.useRef(null),i=Dw({count:t.lines.length,getScrollElement:()=>s.current,estimateSize:()=>Lw,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>so,u=c?t.lines.slice(0,so):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 ${so.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(b0,{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(Zg,{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(Uw,{virtualizer:i,lines:u}):a.jsx(Vw,{lines:u})})]})};function Uw({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",$w(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:Fw(r.kind)}),a.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:r.text})]},n.key)})})}function Zw(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 Ww(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 Vw({lines:e}){const t=Zw(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",Ww(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 Bu=v.memo(Bw),Hw={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 io(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?Ng:jg,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,Qe(e.delta)]})]})}const qw=v.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 h=D1(e.responseStatus),g=e.elapsedMs!==null&&m>0&&e.elapsedMs>m*1e3,p=e.inputTokens!==null||e.outputTokens!==null,x=v.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:y=>{(y.key==="Enter"||y.key===" ")&&(y.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(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("span",{className:"shrink-0",children:a.jsx(Ru,{provider:Iu(e.model),className:"size-4"})})}),a.jsx(Ne,{children:e.model})]}),h!=="success"&&a.jsxs(Nu,{variant:"outline",className:xe("text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums gap-1",Hw[h]),children:[h==="server_error"?a.jsx(u0,{className:"size-3","aria-label":"Server error"}):h==="client_error"?a.jsx(vo,{className:"size-3","aria-label":"Client error"}):h==="pending"?a.jsx(fr,{className:"size-3 animate-spin","aria-label":"Pending"}):null,e.responseStatus]}),e.elapsedMs!==null&&a.jsxs(je,{children:[a.jsx(Ee,{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:io(e.elapsedMs)}),g&&a.jsx(vo,{className:"size-3","aria-label":"Slow response"})]})}),a.jsx(Ne,{children:g?`Slow response: ${io(e.elapsedMs)} exceeds ${io(m*1e3)}`:"Elapsed response time"})]}),p&&a.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[a.jsx(es,{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?Qe(e.inputTokens):"—"]})," / ",a.jsxs("span",{className:e.outputTokens!==null?"text-amber-400":"text-muted-foreground",children:["OUT ",e.outputTokens!==null?Qe(e.outputTokens):"—"]})]})]}),e.cacheCreationInputTokens!==null&&e.cacheCreationInputTokens>0&&a.jsxs(je,{children:[a.jsx(Ee,{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 +",Qe(e.cacheCreationInputTokens)]})]})}),a.jsx(Ne,{children:"Tokens cached for reuse, reducing future API cost"})]}),e.cacheReadInputTokens!==null&&e.cacheReadInputTokens>0&&a.jsxs(je,{children:[a.jsx(Ee,{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 ~",Qe(e.cacheReadInputTokens)]})]})}),a.jsx(Ne,{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(cl,{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(ni,{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(ni,{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(n0,{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(je,{children:[a.jsx(Ee,{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(Yg,{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(Ne,{children:e.clientCwd!==null?`PID: ${e.clientPid??"?"} CWD: ${e.clientCwd}`:`Process ID: ${e.clientPid??"?"}`})]}),e.streaming&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx(m0,{className:"size-3 text-muted-foreground/60 shrink-0"})}),a.jsx(Ne,{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:y=>y.stopPropagation(),onKeyDown:y=>y.stopPropagation(),children:[f!==null&&d!==void 0&&a.jsxs(je,{children:[a.jsx(Ee,{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(al,{className:"size-3.5"}):a.jsx(il,{className:"size-3.5"})})}),a.jsx(Ne,{children:f.isExpanded?"Collapse all JSON nodes":"Expand all JSON nodes"})]}),c!==void 0&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx(Me,{variant:"outline",size:"icon",className:"size-8",onClick:c,"aria-label":"Copy request body",children:u?a.jsx(Ft,{className:"size-3.5 text-emerald-500"}):a.jsx(Mn,{className:"size-3.5"})})}),a.jsx(Ne,{children:u?"Copied to clipboard":"Copy request body"})]}),l!==void 0&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx(Me,{variant:"outline",size:"icon",className:"size-8",onClick:l,"aria-label":"Replay request",children:a.jsx(x0,{className:"size-3.5"})})}),a.jsx(Ne,{children:"Re-send this request to the provider"})]})]}),r?a.jsx(Pn,{className:"size-4 text-muted-foreground shrink-0"}):a.jsx(Go,{className:"size-4 text-muted-foreground shrink-0"})]})})}),Kw="/v1/chat/completions",Jw="/chat/completions",Gw="/v1/messages";class Yw{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 xn=new Yw;function Xw(e){return xn.getByPath(e)??null}function Qw(e){return Xw(e)?.format??"unknown"}xn.registerPath(Gw,"anthropic");xn.registerPath(Kw,"openai");xn.registerPath(Jw,"openai");function e_(e){if(e==="")return{};try{const t=JSON.parse(e);return t!==null&&typeof t=="object"&&!Array.isArray(t)?{...t}:{}}catch{return{}}}function t_(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:e_(e.inputJson)}}}function Uu(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,h=0;const g=[];for(const x of e.split(`
|
|
94
|
-
`)){const y=x.trim();if(y.startsWith("data: "))try{const _=JSON.parse(y.slice(6)),k=ug.safeParse(_);if(!k.success)continue;const S=k.data;switch(m===0&&(h=Date.now()),r===!0&&g.length<f&&g.push({index:m,timestamp:Date.now()-h,type:S.type,data:S}),m++,S.type){case"message_start":s=S.message.id,i=S.message.model,u=S.message.usage.input_tokens,t.inputTokens=u,t.cacheCreationInputTokens=S.message.usage.cache_creation_input_tokens??null,t.cacheReadInputTokens=S.message.usage.cache_read_input_tokens??null,t.model===null&&(t.model=i);break;case"content_block_start":{const j=S.content_block;switch(j.type){case"text":o.set(S.index,{type:"text",text:j.text??""});break;case"thinking":o.set(S.index,{type:"thinking",thinking:j.thinking??"",signature:j.signature??""});break;case"think":o.set(S.index,{type:"think",thinking:j.thinking??"",signature:j.signature??""});break;case"tool_use":o.set(S.index,{type:"tool_use",id:j.id,name:j.name,inputJson:""});break}break}case"content_block_delta":{const j=o.get(S.index);if(j===void 0)break;const O=S.delta;O.type==="text_delta"&&j.type==="text"?j.text+=O.text:O.type==="thinking_delta"&&(j.type==="thinking"||j.type==="think")?j.thinking+=O.thinking:O.type==="signature_delta"&&(j.type==="thinking"||j.type==="think")?j.signature+=O.signature:O.type==="input_json_delta"&&j.type==="tool_use"&&(j.inputJson+=O.partial_json);break}case"message_delta":l=S.delta.stop_reason,c=S.delta.stop_sequence??null,d=S.usage.output_tokens,t.outputTokens=d,S.usage.cache_creation_input_tokens!==void 0&&(t.cacheCreationInputTokens=S.usage.cache_creation_input_tokens),S.usage.cache_read_input_tokens!==void 0&&(t.cacheReadInputTokens=S.usage.cache_read_input_tokens);break;case"error":t.error=S.error.message;break;case"content_block_stop":case"message_stop":case"ping":break}}catch{}}r===!0&&(t.streamingChunks={chunks:g,truncated:m>f});const p=[...o.entries()].sort(([x],[y])=>x-y).map(([,x])=>t_(x));return JSON.stringify({id:s,type:"message",model:i!==""?i:n??"",role:"assistant",content:p,stop_reason:l,stop_sequence:c,usage:{input_tokens:u,output_tokens:d}})}const n_={format:"anthropic",parseRequest(e,t){try{const n=JSON.parse(e),r=Ga.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=Ya.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 Uu(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}}};xn.register(n_);class r_{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 Cs=new r_,o_="https://api.anthropic.com",s_={MiniMax:"https://api.minimaxi.com/anthropic"},i_={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(s_))if(t.startsWith(n.toLowerCase()))return!0;return!0},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:o_},extractStream(e,t,n,r){return Uu(e,t,n,r)}};Cs.register(i_);function js(e,t,n,r=!0){let o="",s="",i="",l="",c=null,u=0,d=0,f=!1,m=!1;const h=new Map,g=1e3;let p=0,x=0;const y=[];for(const k of e.split(`
|
|
95
|
-
`)){const S=k.trim();if(!S.startsWith("data: "))continue;const j=S.slice(6);if(j==="[DONE]")break;try{const O=JSON.parse(j);if(typeof O=="object"&&O!==null&&!Array.isArray(O)){const z=Object.getOwnPropertyDescriptor(O,"error");if(z!==void 0&&typeof z.value=="object"&&z.value!==null){const R=Object.getOwnPropertyDescriptor(z.value,"message");R!==void 0&&typeof R.value=="string"&&(t.error=R.value);continue}}const N=gg.safeParse(O);if(!N.success)continue;const A=N.data;if(p===0&&(x=Date.now()),r===!0&&y.length<g&&y.push({index:p,timestamp:Date.now()-x,type:"chat.completion.chunk",data:A}),p++,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 O=="object"&&O!==null&&!Array.isArray(O)){const z=Object.getOwnPropertyDescriptor(O,"usage");if(z!==void 0&&typeof z.value=="object"&&z.value!==null){const R=Object.getOwnPropertyDescriptor(z.value,"prompt_tokens_details");if(R!==void 0&&typeof R.value=="object"&&R.value!==null){const H=Object.getOwnPropertyDescriptor(R.value,"cached_tokens");H!==void 0&&typeof H.value=="number"&&(t.cacheReadInputTokens=H.value)}}}f=!0}for(const z of A.choices){const R=z.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 H=R.think;if(H!=null&&(l+=H),z.finish_reason!==void 0&&z.finish_reason!==null&&(c=z.finish_reason),R.tool_calls!==void 0&&R.tool_calls!==null)for(const C of R.tool_calls){let I=h.get(C.index);I===void 0&&(I={index:C.index,type:"function",function:{name:"",arguments:""}},h.set(C.index,I)),C.id!==void 0&&(I.id=C.id),C.function?.name!==void 0&&(I.function.name+=C.function.name),C.function?.arguments!==void 0&&(I.function.arguments+=C.function.arguments)}}}catch{}}r===!0&&(t.streamingChunks={chunks:y,truncated:p>g}),f||(d=Math.ceil(i.length/4)),t.outputTokens=d;const _={role:"assistant",content:i};return l&&(_.reasoning_content=l),h.size>0&&(_.tool_calls=[...h.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 a_={format:"openai",parseRequest(e,t){try{const n=JSON.parse(e),r=el.safeParse(n);return r.success?{model:r.data.model,sessionId:t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){const t=nl(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 js(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}}};xn.register(a_);const l_="https://api.openai.com/v1",c_={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:l_},extractStream(e,t,n,r){return js(e,t,n,r)}};Cs.register(c_);const u_="https://dashscope.aliyuncs.com/compatible-mode/v1",d_={name:"alibaba",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return!!(t.startsWith("glm-5")||t.startsWith("qwen"))},getUpstreamBase(e,t){return u_},extractStream(e,t,n){return js(e,t,n)}};Cs.register(d_);function Zu(e,t){for(const n of Array.from(e))t(n)}const f_=/[\u3000-\u9FFF\uAC00-\uD7FF\uF900-\uFAFF\uFF00-\uFFEF\u{1F300}-\u{1FAFF}]/u;function Wu(e){if(e.length===0)return 0;let t=0,n=0;return Zu(e,r=>{f_.test(r)?t+=1:n+=1}),Math.ceil(t*1)+Math.ceil(n/4)}function Vu(e){if(e.length===0)return 0;let t=0;return Zu(e,()=>{t+=1}),t}function zt(e){return{parsed:null,comparisonValue:e,messageCount:null,toolCount:null}}const tn={parsed:null,toolNames:null};function h_(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 p_(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 m_(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 ao(e,t,n,r){return{role:e,label:t,text:n,size:Wu(n),characters:Vu(n),path:r}}const g_={format:"anthropic",analyzeRequest(e){if(e===null)return zt(e);try{const t=Ga.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}:zt(e)}catch{return zt(e)}},analyzeResponse(e){if(e===null)return tn;try{let t=JSON.parse(e);typeof t=="string"&&(t=JSON.parse(t));const n=Ya.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=p_(t.system);r.length>0&&n.push(ao("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=h_(s.content);n.push(ao(i,`[${o}] ${i}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=m_(t.tools);n.push(ao("tools","tools",r,"/tools"))}return n.length>0?n: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,o=r.type;o==="text"&&typeof r.text=="string"?t.push(r.text):o==="image_url"&&t.push("[image]")}return t.join(`
|
|
99
|
-
`)}function v_(e){const t=[],n=x_(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 y_(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 Ji(e,t,n,r){return{role:e,label:t,text:n,size:Wu(n),characters:Vu(n),path:r}}const b_={format:"openai",analyzeRequest(e){if(e===null)return zt(e);try{const t=el.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}:zt(e)}catch{return zt(e)}},analyzeResponse(e){if(e===null)return tn;const t=nl(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=v_(s);n.push(Ji(i,`[${o}] ${i}`,l,`/messages/${o}`))}),Array.isArray(t.tools)&&t.tools.length>0){const r=y_(t.tools);n.push(Ji("tools","tools",r,"/tools"))}return n.length>0?n:null}},w_={format:"unknown",analyzeRequest(e){return zt(e)},analyzeResponse(){return tn},anatomySegments(){return null}},__={anthropic:g_,openai:b_,unknown:w_};function k_(e){return __[e]}function Do(e){const t=Qw(e.path);return t==="unknown"?e.apiFormat:t}function Gi(e,t,n){return e==="anthropic"&&t==="full"&&n}function S_(e,t){return e==="full"&&t}function Yi(e,t,n,r){return e==="anthropic"&&t==="full"&&n&&r}function Kt(){return a.jsx("div",{className:"h-1","aria-hidden":"true"})}function Xi({text:e,label:t,copied:n,onCopy:r}){return e===null?null:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs(Me,{variant:"outline",size:"sm",className:"h-8 text-xs",onClick:r,"aria-label":t,children:[n?a.jsx(Ft,{className:"size-3.5 mr-1 text-emerald-500"}):a.jsx(Mn,{className:"size-3.5 mr-1"}),n?"Copied!":t]})}),a.jsx(Ne,{children:n?"Copied to clipboard":t})]})}function Qi({active:e,onClick:t}){return a.jsxs(je,{children:[a.jsx(Ee,{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(ll,{className:"size-3.5 mr-1"}),e?"Showing diff":"Diff with Raw"]})}),a.jsx(Ne,{children:e?"Hide diff view":"Compare proxy output against the original raw version"})]})}const C_=v.memo(function({rawBody:e,displayedBody:t,emptyLabel:n}){const r=v.useMemo(()=>_w(e,t),[e,t]);return a.jsx(Bu,{result:r,emptyLabel:n})}),j_=v.memo(function({rawHeaders:e,headers:t,emptyLabel:n}){const r=v.useMemo(()=>ww(e,t),[e,t]);return a.jsx(Bu,{result:r,emptyLabel:n})});function lo(e){const[t,n]=v.useState(!1),r=v.useRef(null);v.useEffect(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);const o=v.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 E_=v.memo(function({log:e,viewMode:t="simple",strip:n,slowResponseThresholdSeconds:r,cacheTrend:o=null,onCompareWithPrevious:s}){const[i,l]=v.useState(!1),[c,u]=v.useState(!1),[d,f]=v.useState(!1),[m,h]=v.useState(!1),[g,p]=v.useState("request"),[x,y]=v.useState(null),_=v.useRef(null),k=Do(e),S=k_(k),j=v.useMemo(()=>S.analyzeRequest(e.rawRequestBody),[S,e.rawRequestBody]),O=v.useMemo(()=>S.analyzeResponse(e.responseText),[S,e.responseText]),A=v.useMemo(()=>!n||k!=="anthropic"||e.rawRequestBody===null?null:nw(e.rawRequestBody).body,[e.rawRequestBody,k,n])??e.rawRequestBody,z=lo(A),R=lo(e.rawRequestBody),H=lo(e.responseText),C=Li(A),I=Li(e.rawRequestBody),b=v.useMemo(()=>C.parsedData!==null?S.anatomySegments(C.parsedData):null,[S,C.parsedData]),D=v.useMemo(()=>{if(b!==null)return new Set(b.map(L=>L.path))},[b]),K=mw({containerRef:_,setExpandToPath:y,ensureTabActive:()=>{g!=="request"&&p("request")}});return a.jsxs($e,{children:[a.jsxs("div",{className:"border border-border rounded-lg mb-1 overflow-hidden",children:[a.jsx(qw,{log:e,messageCount:j.messageCount,toolCount:j.toolCount,expanded:i,onToggle:()=>l(!i),responseToolNames:O.toolNames,cacheTrend:o,slowResponseThresholdSeconds:r,onReplay:s===void 0?void 0:()=>{u(!0)},onCopyRequest:A===null?void 0:L=>{z.copy(L)},requestCopied:z.copied,onToggleRequestExpansion:C.toggle,requestExpansionState:C.policy===null?null:{isExpanded:C.isExpanded,isPending:C.isPending}}),i&&a.jsx("div",{onClick:L=>L.stopPropagation(),onKeyDown:L=>L.stopPropagation(),children:a.jsxs(Pu,{value:g,onValueChange:p,children:[a.jsxs(Mu,{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"}),Gi(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"})]}),Gi(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(rw,{policy:I.policy,isExpanded:I.isExpanded,isPending:I.isPending,onToggle:I.toggle}),a.jsx(Xi,{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(v.Suspense,{fallback:a.jsx(Kt,{}),children:a.jsx(Fi,{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:[(Yi(k,t,n,e.rawRequestBody!==null)||s!==void 0)&&a.jsxs("div",{className:"flex justify-end gap-2 mb-2",children:[Yi(k,t,n,e.rawRequestBody!==null)&&a.jsx(Qi,{active:m,onClick:L=>{L.stopPropagation(),h(!m)}}),s!==void 0&&a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs(Me,{variant:"outline",size:"sm",className:"h-8 text-xs",onClick:L=>{L.stopPropagation(),s(e)},children:[a.jsx(ll,{className:"size-3 mr-1"}),"Diff with Previous"]})}),a.jsx(Ne,{children:"Compare this request with the immediately preceding one"})]})]}),m?a.jsx(C_,{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"}):C.parsedData!==null?a.jsx(v.Suspense,{fallback:a.jsx(Kt,{}),children:a.jsx(Fi,{data:C.parsedData,bulkDepth:C.bulkDepth,bulkRevision:C.bulkRevision,anatomyPaths:D,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(v.Suspense,{fallback:a.jsx(Kt,{}),children:a.jsx(cw,{parsed:null,inputTokens:e.inputTokens??null,segments:b,onSegmentActivate:K})})}),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:S_(t,e.rawHeaders!==void 0&&Object.keys(e.rawHeaders).length>0)&&a.jsx(Qi,{active:d,onClick:L=>{L.stopPropagation(),f(!d)}})}),d?a.jsx(j_,{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],[U])=>L.localeCompare(U)).map(([L,U])=>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:U,children:U})]},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],[U])=>L.localeCompare(U)).map(([L,U])=>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:U,children:U})]},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(Xi,{text:e.responseText,label:"Copy",copied:H.copied,onCopy:H.copy})}),e.responseText!==null?a.jsx(v.Suspense,{fallback:a.jsx(Kt,{}),children:a.jsx(fw,{text:e.responseText,defaultExpandDepth:0})}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No response"}),e.streaming===!0&&a.jsx(v.Suspense,{fallback:a.jsx(Kt,{}),children:a.jsx(dw,{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(v.Suspense,{fallback:a.jsx(Kt,{}),children:a.jsx(uw,{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(v.Suspense,{fallback:null,children:a.jsx(lw,{log:e,open:c,onOpenChange:u})})]})});function N_({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=v.useMemo(()=>br(s),[s]),m=v.useMemo(()=>Mb(s),[s]),h=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)",...h,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",...h,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 T_(e,t){return e||t}function A_(e,t,n){return e>1&&t&&!n}function z_(e){const t=[];let n=[],r=0;for(const o of e){n.push({log:o,stopReason:kb(o)});const s=n[n.length-1];s!==void 0&&Au(s.stopReason)&&(t.push({entries:n,turnIndex:r}),n=[],r+=1)}return n.length>0&&t.push({entries:n,turnIndex:r}),t}function O_(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=Do(o),l=Do(s);i==="unknown"||i!==l||t.set(o.id,s)}return t}function co(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const I_=v.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?Au(d):!1,m=t[u]?.log.responseStatus===null,h=t.length===1,g=A_(t.length,f,m),[p,x]=v.useState(!1),y=v.useRef(!1);v.useEffect(()=>{g?f&&!y.current&&x(!0):x(!1),y.current=f},[g,f]);const _=v.useCallback(()=>{g&&x(C=>!C)},[g]),k=v.useMemo(()=>{let C=0,I=0,b=null,D=!1;for(const K of t)K.log.inputTokens!==null&&(C+=K.log.inputTokens,D=!0),K.log.outputTokens!==null&&(I+=K.log.outputTokens,D=!0),K.log.elapsedMs!==null&&(b=b===null?K.log.elapsedMs:Math.max(b,K.log.elapsedMs));return{totalInput:C,totalOutput:I,hasTokens:D,maxElapsed:b}},[t,u]),S=v.useMemo(()=>{const C=new Set;for(const I of t){const b=Iu(I.log.model);b!=="unknown"&&C.add(b)}return[...C]},[t]),j=v.useMemo(()=>br(t[0]?.log.id??0),[t]),O=v.useMemo(()=>br(t[u]?.log.id??0),[t,u]),N=c%2===0?"bg-muted/10":"bg-muted/25",A=k.maxElapsed!==null&&o>0&&k.maxElapsed>o*1e3,[z,R]=v.useState(0),H=v.useRef(null);return v.useEffect(()=>{const C=H.current;if(!C)return;let I=0;const b=new ResizeObserver(()=>{window.cancelAnimationFrame(I),I=window.requestAnimationFrame(()=>R(D=>D+1))});return b.observe(C),()=>{b.disconnect(),window.cancelAnimationFrame(I)}},[]),a.jsx("div",{ref:H,className:xe("border rounded-lg",m?"border-amber-500/10":"border-transparent"),children:p?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:C=>{(C.key==="Enter"||C.key===" ")&&(C.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:C=>{C.stopPropagation(),_()},onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.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:C=>{C.stopPropagation(),_()},onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),_())},children:a.jsx(O,{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",N),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":""]}),S.length>0&&a.jsx("span",{className:"flex items-center gap-0.5 shrink-0",children:S.map(C=>a.jsx(Ru,{provider:C,className:"size-4"},C))}),k.maxElapsed!==null&&a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{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:co(k.maxElapsed)}),A&&a.jsx(vo,{className:"size-3","aria-label":"Slow response"})]})}),a.jsx(Ne,{children:A?`Slow response: ${co(k.maxElapsed)} exceeds ${co(o*1e3)}`:"Slowest request in this turn"})]})}),k.hasTokens&&a.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[a.jsx(es,{className:"size-3 text-muted-foreground"}),a.jsxs("span",{className:"font-mono tabular-nums",children:[a.jsxs("span",{className:"text-blue-400",children:["IN ",Qe(k.totalInput)]})," / ",a.jsxs("span",{className:"text-amber-400",children:["OUT ",Qe(k.totalOutput)]})]})]}),a.jsx("span",{className:"flex-1 min-w-0"}),a.jsx(Go,{className:"size-4 text-muted-foreground shrink-0"})]})]}):t.map((C,I)=>{const{log:b,stopReason:D}=C,K=I===0;return a.jsxs("div",{className:"flex items-stretch",children:[K?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(N_,{stopReason:D,isPending:b.responseStatus===null,isFirst:I===0,isTurnStart:K,isOnlyEntry:h,crabIndex:b.id%12,collapsible:g&&K,onToggle:_}),a.jsx("div",{className:xe("flex-1 min-w-0 mb-0.5 rounded-lg",N),children:a.jsx(E_,{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 R_(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 P_=v.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]=v.useState(!1),f=v.useMemo(()=>R_(e.logs),[e.logs]),m=e.logs[0]?.timestamp??new Date().toISOString(),h=e.logs[e.logs.length-1]?.timestamp??new Date().toISOString(),g=bb(e.logs),p=e.logs.some(_=>_.responseStatus===null),x=v.useMemo(()=>z_(e.logs),[e.logs]),y=e.conversationId.startsWith("PID:")||e.conversationId.includes("|")?e.conversationId:e.conversationId.length>24?e.conversationId.slice(0,12)+"…"+e.conversationId.slice(-12):e.conversationId;return a.jsxs("div",{className:"mb-2",children:[!c&&a.jsx(vb,{conversationId:y,startTime:m,endTime:h,totalCalls:e.logs.length,totalInputTokens:f.totalInputTokens,totalOutputTokens:f.totalOutputTokens,apiFormat:yb(e.logs),expanded:u,onToggle:()=>d(!u),hideApiFormat:g,isLoading:p,userAgent:e.logs[0]?.userAgent??null,onClear:()=>l(e.logs.map(_=>_.id))}),T_(c,u)&&a.jsx("div",{children:x.map(_=>a.jsx(I_,{entries:_.entries,viewMode:t,strip:n,slowResponseThresholdSeconds:r,cacheTrends:o,onCompareWithPrevious:s,comparisonPredecessors:i,turnIndex:_.turnIndex},_.turnIndex))})]})});function M_({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"})]})}function ea({...e}){return a.jsx(E2,{"data-slot":"select",...e})}function ta({...e}){return a.jsx(T2,{"data-slot":"select-value",...e})}function na({className:e,size:t="default",children:n,...r}){return a.jsxs(N2,{"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(A2,{asChild:!0,children:a.jsx(Pn,{className:"size-4 opacity-50"})})]})}function ra({className:e,children:t,position:n="popper",align:r="center",...o}){return a.jsx(z2,{children:a.jsxs(O2,{"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(D_,{}),a.jsx(I2,{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(L_,{})]})})}function tr({className:e,children:t,...n}){return a.jsxs(R2,{"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(M2,{children:a.jsx(Ft,{className:"size-4"})})}),a.jsx(P2,{children:t})]})}function D_({className:e,...t}){return a.jsx(D2,{"data-slot":"select-scroll-up-button",className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Ig,{className:"size-4"})})}function L_({className:e,...t}){return a.jsx(L2,{"data-slot":"select-scroll-down-button",className:xe("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Pn,{className:"size-4"})})}function F_(){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 $_(){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 B_(){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 U_=ne({name:Z(),apiKey:Z(),format:Ve(["anthropic","openai"]),anthropicBaseUrl:Z(),openaiBaseUrl:Z(),models:Ce(Z()),sourceTool:Ve(["claude-code","opencode","mimo-code"]),alreadyExists:Be()}),Z_=ne({providers:Ce(U_),warnings:Ce(Z()).optional()}),W_=ne({success:Be().optional(),imported:me().optional(),message:Z().optional(),errors:Ce(Z()).optional()}),V_={"claude-code":F_,opencode:$_,"mimo-code":B_};function H_({open:e,onOpenChange:t,onImportComplete:n}){const[r,o]=v.useState(!1),[s,i]=v.useState(null),[l,c]=v.useState([]),[u,d]=v.useState([]),[f,m]=v.useState(new Set),[h,g]=v.useState(!1),[p,x]=v.useState(null),[y,_]=v.useState(null),k=v.useCallback(()=>{o(!0),i(null),d([]),c([]),m(new Set),x(null),_(null),fetch("/api/providers/scan").then(N=>N.ok?N.json().then(A=>{const z=Z_.safeParse(A);if(!z.success){i(`Invalid response: ${z.error.message}`);return}c(z.data.providers),d(z.data.warnings??[]);const R=new Set;z.data.providers.forEach((H,C)=>{H.alreadyExists||R.add(C)}),m(R)}):N.text().then(A=>{i(`Scan failed (${N.status}): ${A}`)})).catch(N=>{i(N instanceof Error?N.message:String(N))}).finally(()=>{o(!1)})},[]);v.useEffect(()=>{e&&k()},[e,k]);const S=v.useCallback(N=>{m(A=>{const z=new Set(A);return z.has(N)?z.delete(N):z.add(N),z})},[]),j=v.useCallback(()=>{const N=l.filter((R,H)=>f.has(H));if(N.length===0)return;g(!0),_(null),x(null);const A=new Date().toISOString(),z=N.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:z})}).then(R=>R.json()).then(R=>{const H=W_.safeParse(R);if(!H.success){_(`Invalid response: ${H.error.message}`);return}const C=H.data;c(I=>I.map((b,D)=>f.has(D)?{...b,alreadyExists:!0}:b)),m(new Set),C.errors!==void 0&&C.errors.length>0&&C.message!==void 0?x(C.message):x(`Imported ${C.imported??N.length} provider(s)`),n()}).catch(R=>{_(R instanceof Error?R.message:String(R))}).finally(()=>{g(!1)})},[l,f,n]),O=l.some(N=>!N.alreadyExists);return a.jsx(ws,{open:e,onOpenChange:t,children:a.jsxs(_s,{className:"max-w-xl max-h-[80vh] overflow-hidden flex flex-col",children:[a.jsxs(ks,{children:[a.jsx(Ss,{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(fr,{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(Tn,{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((N,A)=>a.jsxs("label",{className:`flex items-start gap-3 p-3 border rounded-md ${N.alreadyExists?"":"cursor-pointer hover:bg-muted/50"}`,children:[!N.alreadyExists&&a.jsx("input",{type:"checkbox",checked:f.has(A),disabled:h,onChange:()=>S(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 z=V_[N.sourceTool];return z===void 0?null:a.jsx(z,{})})(),N.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:[N.models.slice(0,4).join(", "),N.models.length>4?` +${N.models.length-4} more`:""]}),a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:N.format==="anthropic"?N.anthropicBaseUrl:N.openaiBaseUrl}),a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 font-mono",children:N.apiKey.length>8?`${N.apiKey.slice(0,4)}••••${N.apiKey.slice(-4)}`:"••••"})]})]},`${N.sourceTool}-${N.name}`)),u.length>0&&a.jsx("div",{className:"text-xs text-muted-foreground space-y-1 border-t pt-2",children:u.map((N,A)=>a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(Tn,{className:"size-3"}),N]},A))}),p!==null&&a.jsx("div",{className:"text-sm text-green-500 border-t pt-2",children:p}),y!==null&&a.jsx("div",{className:"text-sm text-destructive border-t pt-2",children:y})]}),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(fr,{className:`size-3 mr-1 ${r?"animate-spin":""}`}),"Rescan"]}),a.jsxs(Me,{size:"sm",onClick:j,disabled:!O||f.size===0||h,children:[a.jsx(Yo,{className:"size-3 mr-1"}),h?"Importing...":`Import Selected (${f.size})`]})]})]})})}function Hu(e){return e.length<=8?"••••••••":e.slice(0,4)+"••••••••"+e.slice(-4)}const q_={deepseek:"https://api-docs.deepseek.com/zh-cn/"};function K_(e){return Object.prototype.hasOwnProperty.call(e,"success")}function J_(e){return Object.prototype.hasOwnProperty.call(e,"notConfigured")}function G_(e){const t={className:"size-3",strokeWidth:2};switch(e){case"timeout":return a.jsx(sn,{...t});case"network_unreachable":return a.jsx(R0,{...t});case"connection_refused":return a.jsx(M0,{...t});case"auth_failed":return a.jsx(s0,{...t});case"rate_limited":return a.jsx(Qg,{...t});case"server_error":return a.jsx(S0,{...t});case"invalid_response":return a.jsx($g,{...t});case"unknown":return a.jsx(Tn,{...t});default:return a.jsx(Tn,{...t})}}function nr({result:e}){const[t,n]=v.useState(!1);if(!K_(e))return J_(e)?a.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[a.jsx(l0,{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(ul,{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(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["+",e.cacheCreationInputTokens," cache"]})}),a.jsx(Ne,{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(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["~",e.cacheReadInputTokens," cached"]})}),a.jsx(Ne,{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(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 shrink-0",children:[a.jsx(Lg,{className:"size-3"}),a.jsx("span",{children:"Connected"}),c.length>0&&a.jsxs("span",{className:"text-muted-foreground",children:["(",u,")"]})]})}),a.jsx(Ne,{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:[G_(l),a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("span",{className:"truncate",children:o})}),a.jsx(Ne,{children:"Connection test failed"})]})}),i!==void 0&&a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{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(Xo,{className:"size-3"}):a.jsx(Qo,{className:"size-3"})})}),a.jsx(Ne,{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 Y_(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 X_({provider:e,testResults:t,isTesting:n,testingTimeLeft:r,isHighlighted:o,onEdit:s,onDelete:i,onTest:l}){const[c,u]=v.useState(!1),[d,f]=v.useState(!1),[m,h]=v.useState(!1),g=v.useRef(null),p=v.useRef(void 0);t?.testedAt!==void 0&&t.testedAt!==p.current&&(p.current=t.testedAt,g.current=null);const x=v.useCallback(()=>{h(k=>{const S=!k;return S&&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)})),S})},[e.id,t]);function y(){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(je,{children:[a.jsx(Ee,{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(Ne,{children:"Company-provided API key"})]})}),e.source==="personal"&&a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{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(Ne,{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(qg,{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:Hu(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(Xo,{className:"size-4"}):a.jsx(Qo,{className:"size-4"})}),a.jsx("button",{type:"button",onClick:y,className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":"Copy API key",children:d?a.jsx(Ft,{className:"size-4 text-green-500"}):a.jsx(Mn,{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 ",Y_(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,S])=>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:S.anthropic.nonStreaming})}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&a.jsx("td",{className:"py-1 px-2",children:a.jsx(nr,{result:S.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(ul,{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(f0,{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(dl,{className:"size-3"}),"Delete"]})]})]})}const Q_={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"}},oa=["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"],sa=["glm-5","glm-5.1","qwen3.6-plus","qwen3.7-max"];function ek({provider:e,onSubmit:t,onCancel:n}){const[r,o]=v.useState(e?.name??""),[s,i]=v.useState(e?.apiKey??""),[l,c]=v.useState(!1),[u,d]=v.useState(!1),f=e?.models,[m,h]=v.useState(f!==void 0&&f.length>0?f:[""]),[g,p]=v.useState("anthropic"),[x,y]=v.useState(e?.anthropicBaseUrl??""),[_,k]=v.useState(e?.openaiBaseUrl??""),[S,j]=v.useState(e?.apiDocsUrl??""),[O,N]=v.useState(e?.source),[A,z]=v.useState({}),[R,H]=v.useState(!1),[C,I]=v.useState(null),b=v.useRef([]);v.useEffect(()=>{if(C===null)return;const q=C;function ue(X){if(!(X.target instanceof Node))return;const ie=b.current[q];ie!=null&&!ie.contains(X.target)&&I(null)}return document.addEventListener("mousedown",ue),()=>document.removeEventListener("mousedown",ue)},[C]);const[D,K]=v.useState(!1),[L,U]=v.useState(!1),J=r.toLowerCase().includes("minimax"),se=r.toLowerCase().includes("alibaba");function B(){navigator.clipboard.writeText(s).catch(()=>{}),d(!0),setTimeout(()=>d(!1),2e3)}v.useEffect(()=>{e&&(o(e.name),i(e.apiKey),h((e.models?.length??0)>0?e.models:[""]),y(e.anthropicBaseUrl??""),k(e.openaiBaseUrl??""),j(e.apiDocsUrl??""),N(e.source),K(!1),U(!1))},[e]),v.useEffect(()=>{const q=r.toLowerCase();for(const[ue,X]of Object.entries(Q_))if(q.includes(ue)){X.format==="anthropic"&&!D?y(X.baseUrl):X.format==="openai"&&!L&&k(X.baseUrl),X.apiDocsUrl!==void 0&&!S&&j(X.apiDocsUrl),ue==="minimax"&&m.length===1&&m[0]===""&&h([oa[0]??""]),ue==="alibaba"&&m.length===1&&m[0]===""&&h([sa[0]??""]);break}},[r]);function $(){const q={};return r.trim()||(q.name="Name is required"),s.trim()||(q.apiKey="API key is required"),(m.length===0||m.every(ue=>!ue.trim()))&&(q.models="At least one model is required"),x.trim()&&!oe(x.trim())&&(q.anthropicBaseUrl="Invalid URL format"),_.trim()&&!oe(_.trim())&&(q.openaiBaseUrl="Invalid URL format"),!x.trim()&&!_.trim()&&(q.format="At least one format URL (Anthropic or OpenAI) is required"),z(q),Object.keys(q).length===0}function oe(q){try{return new URL(q),!0}catch{return!1}}function ee(q){if(q.preventDefault(),!!$()){H(!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:S.trim()||void 0,source:O})}finally{H(!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:q=>o(q.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:O??"",onChange:q=>N(q.target.value==="company"||q.target.value==="personal"?q.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:Hu(s),onChange:q=>i(q.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(q=>!q),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(Xo,{className:"size-4"}):a.jsx(Qo,{className:"size-4"})}),a.jsx("button",{type:"button",onClick:B,className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":"Copy API key",children:u?a.jsx(Ft,{className:"size-4 text-green-500"}):a.jsx(Mn,{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((q,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:q,onChange:X=>{h(ie=>{const ae=[...ie];return ae[ue]=X.target.value,ae})},placeholder:J||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"}),(J||se)&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>I(C===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(Pn,{className:"size-4"})}),C===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:(J?oa:sa).map(X=>a.jsx("button",{type:"button",onClick:()=>{h(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:()=>h(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:()=>h(q=>[...q,""]),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(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>p("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(Ne,{children:"Anthropic Messages API protocol"})]})}),a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>p("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(Ne,{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:q=>{K(!0),y(q.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:q=>{U(!0),k(q.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:S,onChange:q=>j(q.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 Lo=ne({id:Z(),name:Z(),apiKey:Z(),model:Z().optional(),models:Ce(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()}),tk=Ve(["timeout","network_unreachable","connection_refused","auth_failed","rate_limited","server_error","invalid_response","unknown"]),nk=ne({message:Z(),type:tk,details:Z().optional(),hint:Z().optional()}),rk=ne({type:Ve(["text","thinking"]),text:Z().optional(),thinking:Z().optional()}),ok=ne({success:Be(),error:nk.optional(),model:Z().optional(),inputTokens:me().optional(),outputTokens:me().optional(),cacheCreationInputTokens:me().optional(),cacheReadInputTokens:me().optional(),latencyMs:me().optional(),content:Ce(rk).optional(),rawResponse:Z().optional(),streaming:Be().optional(),streamingChunks:ne({chunks:Ce(rl),truncated:Be().default(!1)}).optional(),requestHeaders:pt(Z(),Z()).optional()}),ia=xt([ok,ne({notConfigured:ve(!0)}),ne({testing:ve(!0)})]),_r=ne({nonStreaming:ia,streaming:ia}),sk=ne({anthropic:_r,openai:_r}),ik=ne({anthropic:_r,openai:_r,models:pt(Z(),sk).optional(),testedAt:Z().optional()});function ak(){return{anthropic:{nonStreaming:{testing:!0},streaming:{testing:!0}},openai:{nonStreaming:{testing:!0},streaming:{testing:!0}}}}function aa(e,t){const n=()=>({nonStreaming:{success:!1,error:{message:e,type:t}},streaming:{notConfigured:!0}});return{anthropic:n(),openai:n()}}const lk=ne({providerConfig:Z()}),ck=ne({success:Be().optional(),imported:me().optional(),message:Z().optional(),errors:Ce(Z()).optional()}),uk=30,uo="Network error: could not reach the server. Is the proxy running?";function la(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 dk({externalProviders:e,isLoading:t=!1,externalTestResults:n,externalTestingProviders:r,externalTestingTimeLeft:o,onProvidersMutate:s,onTestResultsChange:i,onTestingProvidersChange:l,onTestingTimeLeftChange:c}){const[u,d]=v.useState(!1),[f,m]=v.useState(),[h,g]=v.useState(null),[p,x]=v.useState({}),[y,_]=v.useState(new Set),[k,S]=v.useState({}),[j,O]=v.useState(null),[N,A]=v.useState(!1),[z,R]=v.useState(null),[H,C]=v.useState(!1),[I,b]=v.useState(!1),[D,K]=v.useState(null),[L,U]=v.useState("all"),J=v.useRef(null),se=v.useRef(null),B=e??[],$=v.useMemo(()=>{const F=L==="all"?B:B.filter(W=>W.source===L);return L==="all"?[...F].sort((W,P)=>{const Q={personal:0,company:1};return(Q[W.source??""]??2)-(Q[P.source??""]??2)}):F},[B,L]),oe=n??p,ee=r??y,q=o??k,ue=c?(F,W)=>c(F,W):(F,W)=>{S(W===void 0?P=>{const Q={...P};return delete Q[F],Q}:P=>({...P,[F]:W}))};v.useEffect(()=>{(async()=>{try{const F=await fetch("/api/config/paths");if(F.ok){const W=await Jt(F,lk);O(W.providerConfig)}}catch{}})()},[]);const X=v.useCallback(F=>{se.current!==null&&clearTimeout(se.current),R(F),J.current?.scrollTo({top:J.current.scrollHeight,behavior:"smooth"}),se.current=setTimeout(()=>{R(null),se.current=null},2e3)},[]);v.useEffect(()=>()=>{se.current!==null&&clearTimeout(se.current)},[]);const ie=v.useCallback(()=>{s?.().catch(()=>{})},[s]),ae=v.useCallback((F,W)=>{i?i(F,W):x(P=>({...P,[F]:W}))},[i]),he=v.useCallback((F,W)=>{if(l){l(F,W);return}_(P=>{const Q=new Set(P);return W?Q.add(F):Q.delete(F),Q})},[l]),fe=v.useCallback(async F=>{ae(F,ak()),he(F,!0);const W=new AbortController;let P=uk;ue(F,P);const Q=setInterval(()=>{P--,ue(F,P),P<=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 Jt(re,ik);ae(F,te)}else ae(F,aa(`HTTP ${re.status}: ${re.statusText}`,"server_error"))}catch(re){re instanceof Error&&re.name==="AbortError"&&ae(F,aa("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(la(F))});if(!W.ok){g(await rr(W,"Failed to add provider"));return}const P=await Jt(W,Lo);d(!1),X(P.id),ie(),await fe(P.id)}catch{g(uo)}})()}function Te(F){f&&(async()=>{try{const W=await fetch(`/api/providers/${f.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(la(F))});if(!W.ok){g(await rr(W,"Failed to update provider"));return}const P=await Jt(W,Lo);m(void 0),X(P.id),ie(),((F.apiKey??"")!==(f.apiKey??"")||JSON.stringify(F.models)!==JSON.stringify(f.models)||(F.anthropicBaseUrl??"")!==(f.anthropicBaseUrl??"")||(F.openaiBaseUrl??"")!==(f.openaiBaseUrl??""))&&await fe(P.id)}catch{g(uo)}})()}function w(F){K(F),b(!0)}function Y(){const F=D;F!==null&&(async()=>{let W;try{W=await fetch(`/api/providers/${F}`,{method:"DELETE"})}catch{g(uo);return}if(!W.ok){g(await rr(W,"Failed to delete provider"));return}ie()})()}const V=v.useRef(null);function T(F){const W="/api/providers/export";(async()=>{try{const P=await fetch(W);if(!P.ok){g("Failed to export providers");return}const Q=await P.blob(),re=URL.createObjectURL(Q),te=document.createElement("a");te.href=re,te.download=P.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 E(){V.current?.click()}function M(F){const W=F.target.files?.[0];W&&(async()=>{try{const P=await W.text(),Q=await fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)}),re=await Jt(Q,ck);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(ek,{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(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs(Me,{variant:"outline",size:"sm",onClick:()=>T(),className:"gap-1 hover:bg-muted",children:[a.jsx(Yo,{className:"size-3"}),"Export"]})}),a.jsx(Ne,{children:"Download providers as JSON for backup or sharing"})]})}),a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs(Me,{variant:"outline",size:"sm",onClick:E,className:"gap-1 hover:bg-muted",children:[a.jsx(A0,{className:"size-3"}),"Import"]})}),a.jsx(Ne,{children:"Import providers from an exported JSON file"})]})}),a.jsx("input",{type:"file",ref:V,accept:".json",onChange:M,style:{display:"none"}}),a.jsx($e,{children:a.jsxs(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsxs(Me,{variant:"outline",size:"sm",onClick:()=>C(!0),className:"gap-1",children:[a.jsx(_0,{className:"size-3"}),"Scan"]})}),a.jsx(Ne,{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(ti,{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(je,{children:[a.jsx(Ee,{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:N?a.jsx(Ft,{className:"size-3 text-green-500"}):a.jsx(Mn,{className:"size-3"})})}),a.jsx(Ne,{children:"Copy config file path to clipboard"})]})})]}),h!==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(Tn,{className:"size-4 shrink-0"}),h]}),B.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(ti,{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(je,{children:[a.jsx(Ee,{asChild:!0,children:a.jsx("button",{type:"button",onClick:()=>U(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(Ne,{children:F==="all"?"Show all providers":F==="personal"?"Providers you configured yourself":"Providers set by your organization"})]})},F))}),a.jsx("div",{ref:J,className:"space-y-3",children:$.map(F=>a.jsx(X_,{provider:F,testResults:oe[F.id],isTesting:ee.has(F.id),testingTimeLeft:q[F.id],isHighlighted:F.id===z,onEdit:W=>m(W),onDelete:w,onTest:W=>{fe(W)}},F.id))})]}),a.jsx(H_,{open:H,onOpenChange:C,onImportComplete:()=>{s!==void 0&&s()}}),a.jsx(Tu,{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 fk(e){return Rn(e,Lo.array(),void 0,t=>`Failed to fetch ${e}: ${t.status}`)}function hk(){const e=$o("/api/providers",fk,{revalidateOnFocus:!1,revalidateIfStale:!1});return{providers:e.data??[],isLoading:e.isLoading,isError:e.error,mutate:e.mutate}}function pk(){const[e,t]=v.useState(!1),[n,r]=v.useState("providers"),{providers:o,isLoading:s,mutate:i}=hk(),[l,c]=v.useState({}),[u,d]=v.useState(new Set),[f,m]=v.useState({}),h=v.useCallback((x,y)=>{c(_=>({..._,[x]:y}))},[]),g=v.useCallback((x,y)=>{d(_=>{const k=new Set(_);return y?k.add(x):k.delete(x),k})},[]),p=v.useCallback((x,y)=>{m(_=>{if(y===void 0){const k={..._};return delete k[x],k}return{..._,[x]:y}})},[]);return a.jsxs(ws,{open:e,onOpenChange:t,children:[a.jsx(hb,{asChild:!0,children:a.jsxs(Me,{variant:"ghost",size:"icon",className:"size-8",children:[a.jsx(j0,{className:"size-4"}),a.jsx("span",{className:"sr-only",children:"Settings"})]})}),a.jsxs(_s,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[a.jsx(ks,{children:a.jsx(Ss,{children:"Settings"})}),a.jsxs(Pu,{value:n,onValueChange:r,className:"flex-1 overflow-hidden",children:[a.jsxs(Mu,{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(dk,{externalProviders:o,isLoading:s,externalTestResults:l,externalTestingProviders:u,externalTestingTimeLeft:f,onProvidersMutate:()=>i(),onTestResultsChange:h,onTestingProvidersChange:g,onTestingTimeLeftChange:p})}),a.jsx(ft,{value:"proxy",children:a.jsx(mk,{})})]})]})]})]})}function mk(){const{strip:e,slowResponseThresholdSeconds:t,isLoading:n,setStrip:r,setSlowResponseThresholdSeconds:o}=ol(),[s,i]=v.useState(null),[l,c]=v.useState(!1),u=v.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=v.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:xo,step:1,value:t,disabled:n||l,onChange:f=>{const m=Number(f.currentTarget.value);Number.isInteger(m)&&(m<0||m>xo||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 gk(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:ca(s.cacheCreationInputTokens,i.cacheCreationInputTokens),read:ca(s.cacheReadInputTokens,i.cacheReadInputTokens)})}}return t}function ca(e,t){return t===null||e===null?null:t>e?{direction:"up",delta:t-e}:t<e?{direction:"down",delta:e-t}:null}const Fo="data-nav-id",xk="data-nav-action";function ua(e){return Array.from(e.querySelectorAll(`[${Fo}]`))}function da(e){return e instanceof HTMLElement}function vk(e,t){let n=e;for(;n!==null&&n!==t;){if(n.hasAttribute(Fo))return n;n=n.parentElement}return e.hasAttribute(Fo)?e:null}function fo(e){const t=e.getAttribute(xk);return t==="toggle"||t==="expand"||t==="collapse"?t:null}function kn(e){e.focus({preventScroll:!0}),e.scrollIntoView({block:"nearest",behavior:"smooth"})}function Sn(e,t){return e[t]??null}function yk(e){const t=e.tagName;return!!(t==="INPUT"||t==="TEXTAREA"||e.isContentEditable)}function bk(e,t){const n=t??e,r=v.useCallback(o=>{const s=e.current;if(!s)return;const i=o.target;if(!da(i)||i!==n.current||!s.contains(i))return;const l=ua(s),c=Sn(l,0);c!==null&&kn(c)},[e,n]);v.useEffect(()=>{const o=n.current,s=e.current;if(!o||!s)return;const i=l=>{const c=l.target;if(!da(c)||!s.contains(c)||yk(c))return;const u=ua(s);if(u.length===0)return;const d=vk(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 h=f>0?f-1:f===-1?u.length-1:-1;if(h!==-1){const g=Sn(u,h);g!==null&&kn(g)}m=!0;break}case"ArrowDown":case"S":{if(l.key==="S"&&!l.shiftKey)break;l.preventDefault();const h=f<u.length-1?f+1:f===-1?0:-1;if(h!==-1){const g=Sn(u,h);g!==null&&kn(g)}m=!0;break}case"ArrowLeft":case"A":{if(l.key==="A"&&!l.shiftKey||d===null)break;if(l.preventDefault(),fo(d)==="collapse")d.click();else if(f>0){const g=Sn(u,f-1);g!==null&&kn(g)}m=!0;break}case"ArrowRight":case"D":{if(l.key==="D"&&!l.shiftKey||d===null)break;if(l.preventDefault(),fo(d)==="expand")d.click();else if(f<u.length-1){const g=Sn(u,f+1);g!==null&&kn(g)}m=!0;break}case" ":{if(d===null)break;l.preventDefault(),fo(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]),v.useEffect(()=>{const o=n.current;if(o)return o.addEventListener("focus",r),()=>o.removeEventListener("focus",r)},[r,n])}function wk(e){return e.length<=30?e:e.slice(0,12)+"…"+e.slice(-12)}function _k(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 kk({command:e}){const[t,n]=v.useState(!1),r=v.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 Sk({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}){const{totalIn:h,totalOut:g}=v.useMemo(()=>_k(e),[e]),[p,x]=v.useState(!1),[y,_]=v.useState(null),[k,S]=v.useState("hidden"),j=v.useRef(null),O=v.useRef(null);bk(j,O),v.useEffect(()=>{const D=50+On.length*400,K=setTimeout(()=>S("playing"),50),L=setTimeout(()=>S("done"),D);return()=>{clearTimeout(K),clearTimeout(L)}},[]);const N=v.useCallback(async()=>{x(!0);try{await K0(e)}finally{x(!1)}},[e]);v.useEffect(()=>{_(null)},[r,o]);const A=v.useCallback(()=>{_(null)},[]),z=v.useMemo(()=>_b(e),[e]),R=v.useMemo(()=>gk(z),[z]),H=v.useMemo(()=>O_(z),[z]),C=v.useCallback(I=>{const b=H.get(I.id);b!==void 0&&_([b,I])},[H]);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:"flex items-end pt-6 pb-8 relative",children:[a.jsxs("h1",{className:"text-lg font-bold flex items-end gap-2 absolute left-1/2 -translate-x-1/2 whitespace-nowrap",children:[a.jsxs("span",{className:"flex items-end gap-1 group cursor-default","aria-hidden":"true",children:[a.jsx(M_,{className:"size-10 text-amber-500 transition-all duration-300 group-hover:scale-125 group-hover:-translate-y-1.5"}),a.jsx("span",{className:"flex items-end gap-0.5",children:On.map((I,b)=>{const D=["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"][b],K=k==="hidden"?"opacity-0 scale-0":k==="playing"?"animate-crab-piano-pop":"";return a.jsx(I,{className:`size-5 ${D} transition-all duration-300 ease-out group-hover:scale-125 group-hover:-translate-y-1 ${K}`,style:{transitionDelay:`${b*50}ms`,...k==="playing"?{animationDelay:`${b*400}ms`}:{}}},b)})})]}),a.jsxs("span",{className:"flex items-baseline gap-2",children:["LLM Inspector",a.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["v",F1.version]})]})]}),a.jsx("div",{className:"ml-auto",children:a.jsx(pk,{})})]}),a.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[a.jsxs(ea,{value:r,onValueChange:s,children:[a.jsx(na,{className:"flex-1 max-w-[350px] text-xs",children:a.jsx(ta,{placeholder:"All sessions"})}),a.jsxs(ra,{children:[a.jsx(tr,{value:"__all__",children:"All sessions"}),t.map(I=>a.jsx(tr,{value:I,children:wk(I)},I))]})]}),a.jsxs(ea,{value:o,onValueChange:i,children:[a.jsx(na,{className:"flex-1 max-w-[250px] text-xs",children:a.jsx(ta,{placeholder:"All models"})}),a.jsxs(ra,{children:[a.jsx(tr,{value:"__all__",children:"All models"}),n.map(I=>a.jsx(tr,{value:I,children:I},I))]})]}),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||g>0?` · ${Qe(h)} in / ${Qe(g)} out`:""]}),e.length>0&&a.jsx("button",{type:"button",onClick:()=>{N()},disabled:p,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:p?a.jsx("span",{children:"Exporting..."}):a.jsxs(a.Fragment,{children:[a.jsx(Yo,{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?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(kk,{command:"LLM_BASE_URL=http://localhost:25947/proxy <your-tool>"})]}):a.jsx("div",{ref:O,tabIndex:0,className:"flex flex-col gap-2 focus:outline-none",children:a.jsx("div",{ref:j,children:z.map(I=>a.jsx(P_,{group:I,viewMode:u,strip:f,slowResponseThresholdSeconds:m,cacheTrends:R,onCompareWithPrevious:C,comparisonPredecessors:H,onClearGroup:c,standalone:z.length===1},I.id))})})}),y!==null&&a.jsx(v.Suspense,{fallback:null,children:a.jsx(aw,{left:y[0],right:y[1],onClose:A})})]})}const Ck=xt([ne({type:ve("init"),logs:Ce(Xs)}),ne({type:ve("update"),log:Xs})]);function jk(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function Ek(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function Nk(e,t,n){return t==="__all__"&&n==="__all__"?e:e.filter(r=>!(t!=="__all__"&&r.sessionId!==t||n!=="__all__"&&r.model!==n))}const Tk=50;function Ak(){const[e,t]=v.useState([]),[n,r]=v.useState("__all__"),[o,s]=v.useState("__all__"),[i,l]=v.useState("simple"),[c,u]=v.useState(null),d=v.useRef(null),f=v.useRef(null),m=v.useRef(new Map),h=v.useRef([]),g=v.useRef(null),p=v.useMemo(()=>Nk(e,n,o),[e,n,o]),x=v.useMemo(()=>jk(e),[e]),y=v.useMemo(()=>Ek(e),[e]),_=v.useCallback(()=>{g.current=null;const z=h.current;h.current=[],z.length!==0&&t(R=>{let H=R;for(const C of z){const I=m.current.get(C.id);I!==void 0?H=[...H.slice(0,I),C,...H.slice(I+1)]:(m.current.set(C.id,H.length),H=[...H,C])}return H})},[]),k=v.useCallback(z=>{h.current.push(z),g.current===null&&(g.current=setTimeout(_,Tk))},[_]),S=v.useCallback(()=>{d.current&&d.current.close();const z=new EventSource("/api/logs/stream");d.current=z,z.onmessage=R=>{try{const H=String(R.data),C=JSON.parse(H),I=Ck.safeParse(C);if(!I.success){u("Failed to parse SSE data");return}const b=I.data;if(b.type==="init"){g.current!==null&&(clearTimeout(g.current),g.current=null),h.current=[];const D=new Map;for(let K=0;K<b.logs.length;K++){const L=b.logs[K];L!==void 0&&D.set(L.id,K)}m.current=D,t(b.logs),u(null)}else b.type==="update"&&k(b.log)}catch{u("Failed to parse SSE data")}},z.onerror=()=>{u("SSE connection lost, reconnecting..."),z.close(),f.current!==null&&clearTimeout(f.current),f.current=setTimeout(S,3e3)}},[k]);v.useEffect(()=>(S(),()=>{d.current&&(d.current.close(),d.current=null),f.current!==null&&(clearTimeout(f.current),f.current=null),g.current!==null&&(clearTimeout(g.current),g.current=null)}),[S]);const j=v.useCallback(()=>{(async()=>{try{if(!(await fetch("/api/logs",{method:"DELETE"})).ok){u("Failed to clear logs");return}m.current.clear(),t([]),u(null)}catch(z){u(z instanceof Error?z.message:"Unknown error clearing logs")}})()},[]),O=v.useCallback(z=>{z.length!==0&&(async()=>{try{if(!(await fetch("/api/logs",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:z})})).ok){u("Failed to clear group");return}const H=new Set(z);t(C=>{const I=C.filter(D=>!H.has(D.id)),b=new Map;for(let D=0;D<I.length;D++){const K=I[D];K!==void 0&&b.set(K.id,D)}return m.current=b,I}),u(null)}catch(R){u(R instanceof Error?R.message:"Unknown error clearing group")}})()},[]),{strip:N,slowResponseThresholdSeconds:A}=ol();return a.jsxs(a.Fragment,{children:[c!==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:c}),a.jsx(Z0,{}),a.jsx(Sk,{logs:p,sessions:x,models:y,selectedSession:n,selectedModel:o,onSessionChange:r,onModelChange:s,onClearAll:j,onClearGroup:O,viewMode:i,onViewModeChange:l,strip:N,slowResponseThresholdSeconds:A})]})}const zk=Ak,Rk=Object.freeze(Object.defineProperty({__proto__:null,component:zk},Symbol.toStringTag,{value:"Module"}));export{Rk as $,ln as A,Nu as B,Zg as C,ws as D,Se as E,ht as F,ye as G,Bt as H,Ie as I,Ue as J,$t as K,rs as L,l0 as M,_t as N,Pi as O,ti as P,Pn as Q,b0 as R,Ro as S,Pu as T,vo as U,D1 as V,fr as W,fl as X,sw as Y,es as Z,il as _,wb as a,xe as b,ge as c,f0 as d,Go as e,Qe as f,k_ as g,Ft as h,Mn as i,_s as j,ks as k,Ss as l,x0 as m,Mu as n,dt as o,ft as p,$e as q,Do as r,je as s,Ee as t,Ne as u,Me as v,ne as w,Be as x,me as y,Z as z};
|