@tonyclaw/llm-inspector 1.16.3 → 1.16.4

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.
@@ -1,48 +1,48 @@
1
- import{u as zi,a as lu,r as v,j as l,c as Lr,g as Ri,b as Tr,R as at,d as cu,e as Kp}from"./main-Cpts3Ifr.js";function Q(e,t,n){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);const u=i.prototype,d=Object.keys(u);for(let h=0;h<d.length;h++){const p=d[h];p in a||(a[p]=u[p].bind(a))}}const o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const u=n?.Parent?new s:this;r(u,a),(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:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Dn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class uu extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const du={};function en(e){return du}function fu(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 Ks(e,t){return typeof t=="bigint"?t.toString():t}function Ro(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Pi(e){return e==null}function Oi(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Gp(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(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}const Fa=Symbol("evaluating");function Te(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Fa)return r===void 0&&(r=Fa,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function vn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function on(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function $a(e){return JSON.stringify(e)}function Jp(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const hu="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function wr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Yp=Ro(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Un(e){if(wr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(wr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function pu(e){return Un(e)?{...e}:Array.isArray(e)?[...e]:e}const Xp=new Set(["string","number","symbol"]);function Zn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function sn(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function ye(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 Qp(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const em={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 tm(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=on(e._zod.def,{get shape(){const i={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=n.shape[a])}return vn(this,"shape",i),i},checks:[]});return sn(e,s)}function nm(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=on(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return vn(this,"shape",i),i},checks:[]});return sn(e,s)}function rm(e,t){if(!Un(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=on(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return vn(this,"shape",s),s}});return sn(e,o)}function om(e,t){if(!Un(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=on(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return vn(this,"shape",r),r}});return sn(e,n)}function sm(e,t){const n=on(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return vn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return sn(e,n)}function im(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=on(t._zod.def,{get shape(){const a=t._zod.def.shape,c={...a};if(n)for(const u in n){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return vn(this,"shape",c),c},checks:[]});return sn(t,i)}function am(e,t,n){const r=on(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 vn(this,"shape",s),s}});return sn(t,r)}function zn(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 Rn(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Fr(e){return typeof e=="string"?e:e?.message}function tn(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=Fr(e.inst?._zod.def?.error?.(e))??Fr(t?.error?.(e))??Fr(n.customError?.(e))??Fr(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Di(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function kr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const mu=(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,Ks,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},gu=Q("$ZodError",mu),xu=Q("$ZodError",mu,{Parent:Error});function lm(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 cm(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,a=0;for(;a<s.path.length;){const c=s.path[a];a===s.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s))):i[c]=i[c]||{_errors:[]},i=i[c],a++}}};return r(e),n}const Mi=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 Dn;if(i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>tn(c,s,en())));throw hu(a,o?.callee),a}return i.value},Li=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 a=new(o?.Err??e)(i.issues.map(c=>tn(c,s,en())));throw hu(a,o?.callee),a}return i.value},Po=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 Dn;return s.issues.length?{success:!1,error:new(e??gu)(s.issues.map(i=>tn(i,o,en())))}:{success:!0,data:s.value}},um=Po(xu),Oo=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=>tn(i,o,en())))}:{success:!0,data:s.value}},dm=Oo(xu),fm=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Mi(e)(t,n,o)},hm=e=>(t,n,r)=>Mi(e)(t,n,r),pm=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Li(e)(t,n,o)},mm=e=>async(t,n,r)=>Li(e)(t,n,r),gm=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Po(e)(t,n,o)},xm=e=>(t,n,r)=>Po(e)(t,n,r),ym=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Oo(e)(t,n,o)},vm=e=>async(t,n,r)=>Oo(e)(t,n,r),bm=/^[cC][^\s-]{8,}$/,wm=/^[0-9a-z]+$/,km=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,_m=/^[0-9a-vA-V]{20}$/,Sm=/^[A-Za-z0-9]{27}$/,Cm=/^[a-zA-Z0-9_-]{21}$/,jm=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Em=/^([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})$/,Ba=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)$/,Nm=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Tm="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Am(){return new RegExp(Tm,"u")}const Im=/^(?:(?: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])$/,zm=/^(([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}|:))$/,Rm=/^((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])$/,Pm=/^(([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])$/,Om=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,yu=/^[A-Za-z0-9_-]*$/,Dm=/^\+[1-9]\d{6,14}$/,vu="(?:(?:\\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])))",Mm=new RegExp(`^${vu}$`);function bu(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 Lm(e){return new RegExp(`^${bu(e)}$`)}function Fm(e){const t=bu({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(`^${vu}T(?:${r})$`)}const $m=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Bm=/^-?\d+$/,wu=/^-?\d+(?:\.\d+)?$/,Um=/^(?:true|false)$/i,Zm=/^null$/i,Vm=/^[^A-Z]*$/,Wm=/^[^a-z]*$/,ut=Q("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ku={number:"number",bigint:"bigint",object:"date"},_u=Q("$ZodCheckLessThan",(e,t)=>{ut.init(e,t);const n=ku[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})}}),Su=Q("$ZodCheckGreaterThan",(e,t)=>{ut.init(e,t);const n=ku[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})}}),Hm=Q("$ZodCheckMultipleOf",(e,t)=>{ut.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):Gp(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})}}),qm=Q("$ZodCheckNumberFormat",(e,t)=>{ut.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,s]=em[t.format];e._zod.onattach.push(i=>{const a=i._zod.bag;a.format=t.format,a.minimum=o,a.maximum=s,n&&(a.pattern=Bm)}),e._zod.check=i=>{const a=i.value;if(n){if(!Number.isInteger(a)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,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:a,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}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Km=Q("$ZodCheckMaxLength",(e,t)=>{var n;ut.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Pi(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=Di(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Gm=Q("$ZodCheckMinLength",(e,t)=>{var n;ut.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Pi(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=Di(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Jm=Q("$ZodCheckLengthEquals",(e,t)=>{var n;ut.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Pi(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=Di(o),a=s>t.length;r.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Do=Q("$ZodCheckStringFormat",(e,t)=>{var n,r;ut.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=()=>{})}),Ym=Q("$ZodCheckRegex",(e,t)=>{Do.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})}}),Xm=Q("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Vm),Do.init(e,t)}),Qm=Q("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Wm),Do.init(e,t)}),eg=Q("$ZodCheckIncludes",(e,t)=>{ut.init(e,t);const n=Zn(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})}}),tg=Q("$ZodCheckStartsWith",(e,t)=>{ut.init(e,t);const n=new RegExp(`^${Zn(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})}}),ng=Q("$ZodCheckEndsWith",(e,t)=>{ut.init(e,t);const n=new RegExp(`.*${Zn(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})}}),rg=Q("$ZodCheckOverwrite",(e,t)=>{ut.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class og{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
1
+ import{u as Pi,a as uu,r as v,j as l,c as Fr,g as Ri,b as Ar,R as at,d as du,e as Xp}from"./main-DbWwVQFh.js";function Q(e,t,n){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);const u=i.prototype,d=Object.keys(u);for(let h=0;h<d.length;h++){const p=d[h];p in a||(a[p]=u[p].bind(a))}}const o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const u=n?.Parent?new s:this;r(u,a),(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:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class On extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class fu extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const hu={};function en(e){return hu}function pu(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 Ks(e,t){return typeof t=="bigint"?t.toString():t}function Ro(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Oi(e){return e==null}function Di(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Qp(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(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}const $a=Symbol("evaluating");function Te(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==$a)return r===void 0&&(r=$a,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function yn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function on(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Ba(e){return JSON.stringify(e)}function em(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const mu="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function wr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const tm=Ro(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Bn(e){if(wr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(wr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function gu(e){return Bn(e)?{...e}:Array.isArray(e)?[...e]:e}const nm=new Set(["string","number","symbol"]);function Un(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function sn(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function ye(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 rm(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const om={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 sm(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=on(e._zod.def,{get shape(){const i={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=n.shape[a])}return yn(this,"shape",i),i},checks:[]});return sn(e,s)}function im(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=on(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return yn(this,"shape",i),i},checks:[]});return sn(e,s)}function am(e,t){if(!Bn(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=on(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return yn(this,"shape",s),s}});return sn(e,o)}function lm(e,t){if(!Bn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=on(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return yn(this,"shape",r),r}});return sn(e,n)}function cm(e,t){const n=on(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return yn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return sn(e,n)}function um(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=on(t._zod.def,{get shape(){const a=t._zod.def.shape,c={...a};if(n)for(const u in n){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return yn(this,"shape",c),c},checks:[]});return sn(t,i)}function dm(e,t,n){const r=on(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 yn(this,"shape",s),s}});return sn(t,r)}function In(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 zn(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function $r(e){return typeof e=="string"?e:e?.message}function tn(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=$r(e.inst?._zod.def?.error?.(e))??$r(t?.error?.(e))??$r(n.customError?.(e))??$r(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Mi(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function kr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const xu=(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,Ks,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},yu=Q("$ZodError",xu),vu=Q("$ZodError",xu,{Parent:Error});function fm(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 hm(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,a=0;for(;a<s.path.length;){const c=s.path[a];a===s.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s))):i[c]=i[c]||{_errors:[]},i=i[c],a++}}};return r(e),n}const Li=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 On;if(i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>tn(c,s,en())));throw mu(a,o?.callee),a}return i.value},Fi=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 a=new(o?.Err??e)(i.issues.map(c=>tn(c,s,en())));throw mu(a,o?.callee),a}return i.value},Oo=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 On;return s.issues.length?{success:!1,error:new(e??yu)(s.issues.map(i=>tn(i,o,en())))}:{success:!0,data:s.value}},pm=Oo(vu),Do=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=>tn(i,o,en())))}:{success:!0,data:s.value}},mm=Do(vu),gm=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Li(e)(t,n,o)},xm=e=>(t,n,r)=>Li(e)(t,n,r),ym=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Fi(e)(t,n,o)},vm=e=>async(t,n,r)=>Fi(e)(t,n,r),bm=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Oo(e)(t,n,o)},wm=e=>(t,n,r)=>Oo(e)(t,n,r),km=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Do(e)(t,n,o)},_m=e=>async(t,n,r)=>Do(e)(t,n,r),Sm=/^[cC][^\s-]{8,}$/,Cm=/^[0-9a-z]+$/,jm=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Em=/^[0-9a-vA-V]{20}$/,Nm=/^[A-Za-z0-9]{27}$/,Tm=/^[a-zA-Z0-9_-]{21}$/,Am=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Im=/^([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})$/,Ua=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)$/,zm=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Pm="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Rm(){return new RegExp(Pm,"u")}const Om=/^(?:(?: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])$/,Dm=/^(([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}|:))$/,Mm=/^((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])$/,Lm=/^(([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])$/,Fm=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,bu=/^[A-Za-z0-9_-]*$/,$m=/^\+[1-9]\d{6,14}$/,wu="(?:(?:\\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])))",Bm=new RegExp(`^${wu}$`);function ku(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 Um(e){return new RegExp(`^${ku(e)}$`)}function Zm(e){const t=ku({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(`^${wu}T(?:${r})$`)}const Vm=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Hm=/^-?\d+$/,_u=/^-?\d+(?:\.\d+)?$/,Wm=/^(?:true|false)$/i,qm=/^null$/i,Km=/^[^A-Z]*$/,Jm=/^[^a-z]*$/,ut=Q("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Su={number:"number",bigint:"bigint",object:"date"},Cu=Q("$ZodCheckLessThan",(e,t)=>{ut.init(e,t);const n=Su[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})}}),ju=Q("$ZodCheckGreaterThan",(e,t)=>{ut.init(e,t);const n=Su[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})}}),Gm=Q("$ZodCheckMultipleOf",(e,t)=>{ut.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):Qp(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})}}),Ym=Q("$ZodCheckNumberFormat",(e,t)=>{ut.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,s]=om[t.format];e._zod.onattach.push(i=>{const a=i._zod.bag;a.format=t.format,a.minimum=o,a.maximum=s,n&&(a.pattern=Hm)}),e._zod.check=i=>{const a=i.value;if(n){if(!Number.isInteger(a)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,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:a,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}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Xm=Q("$ZodCheckMaxLength",(e,t)=>{var n;ut.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Oi(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=Mi(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Qm=Q("$ZodCheckMinLength",(e,t)=>{var n;ut.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Oi(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=Mi(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),eg=Q("$ZodCheckLengthEquals",(e,t)=>{var n;ut.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Oi(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=Mi(o),a=s>t.length;r.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Mo=Q("$ZodCheckStringFormat",(e,t)=>{var n,r;ut.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=()=>{})}),tg=Q("$ZodCheckRegex",(e,t)=>{Mo.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})}}),ng=Q("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Km),Mo.init(e,t)}),rg=Q("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Jm),Mo.init(e,t)}),og=Q("$ZodCheckIncludes",(e,t)=>{ut.init(e,t);const n=Un(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})}}),sg=Q("$ZodCheckStartsWith",(e,t)=>{ut.init(e,t);const n=new RegExp(`^${Un(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})}}),ig=Q("$ZodCheckEndsWith",(e,t)=>{ut.init(e,t);const n=new RegExp(`.*${Un(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})}}),ag=Q("$ZodCheckOverwrite",(e,t)=>{ut.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class lg{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(`
2
2
  `).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(`
3
- `))}}const sg={major:4,minor:3,patch:6},Be=Q("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=sg;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,a,c)=>{let u=zn(i),d;for(const h of a){if(h._zod.def.when){if(!h._zod.def.when(i))continue}else if(u)continue;const p=i.issues.length,f=h._zod.check(i);if(f instanceof Promise&&c?.async===!1)throw new Dn;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await f,i.issues.length!==p&&(u||(u=zn(i,p)))});else{if(i.issues.length===p)continue;u||(u=zn(i,p))}}return d?d.then(()=>i):i},s=(i,a,c)=>{if(zn(i))return i.aborted=!0,i;const u=o(a,r,c);if(u instanceof Promise){if(c.async===!1)throw new Dn;return u.then(d=>e._zod.parse(d,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){const u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(d=>s(d,i,a)):s(u,i,a)}const c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Dn;return c.then(u=>o(u,r,a))}return o(c,r,a)}}Te(e,"~standard",()=>({validate:o=>{try{const s=um(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return dm(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Fi=Q("$ZodString",(e,t)=>{Be.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??$m(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}}),Ze=Q("$ZodStringFormat",(e,t)=>{Do.init(e,t),Fi.init(e,t)}),ig=Q("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Em),Ze.init(e,t)}),ag=Q("$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=Ba(r))}else t.pattern??(t.pattern=Ba());Ze.init(e,t)}),lg=Q("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Nm),Ze.init(e,t)}),cg=Q("$ZodURL",(e,t)=>{Ze.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})}}}),ug=Q("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Am()),Ze.init(e,t)}),dg=Q("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Cm),Ze.init(e,t)}),fg=Q("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=bm),Ze.init(e,t)}),hg=Q("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=wm),Ze.init(e,t)}),pg=Q("$ZodULID",(e,t)=>{t.pattern??(t.pattern=km),Ze.init(e,t)}),mg=Q("$ZodXID",(e,t)=>{t.pattern??(t.pattern=_m),Ze.init(e,t)}),gg=Q("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Sm),Ze.init(e,t)}),xg=Q("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Fm(t)),Ze.init(e,t)}),yg=Q("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Mm),Ze.init(e,t)}),vg=Q("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Lm(t)),Ze.init(e,t)}),bg=Q("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=jm),Ze.init(e,t)}),wg=Q("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Im),Ze.init(e,t),e._zod.bag.format="ipv4"}),kg=Q("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=zm),Ze.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})}}}),_g=Q("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Rm),Ze.init(e,t)}),Sg=Q("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Pm),Ze.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 Cu(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Cg=Q("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Om),Ze.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Cu(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function jg(e){if(!yu.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Cu(n)}const Eg=Q("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=yu),Ze.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{jg(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Ng=Q("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Dm),Ze.init(e,t)});function Tg(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 Ag=Q("$ZodJWT",(e,t)=>{Ze.init(e,t),e._zod.check=n=>{Tg(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),ju=Q("$ZodNumber",(e,t)=>{Be.init(e,t),e._zod.pattern=e._zod.bag.pattern??wu,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}}),Ig=Q("$ZodNumberFormat",(e,t)=>{qm.init(e,t),ju.init(e,t)}),zg=Q("$ZodBoolean",(e,t)=>{Be.init(e,t),e._zod.pattern=Um,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}}),Rg=Q("$ZodNull",(e,t)=>{Be.init(e,t),e._zod.pattern=Zm,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}}),Pg=Q("$ZodUnknown",(e,t)=>{Be.init(e,t),e._zod.parse=n=>n}),Og=Q("$ZodNever",(e,t)=>{Be.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Ua(e,t,n){e.issues.length&&t.issues.push(...Rn(n,e.issues)),t.value[n]=e.value}const Dg=Q("$ZodArray",(e,t)=>{Be.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 a=o[i],c=t.element._zod.run({value:a,issues:[]},r);c instanceof Promise?s.push(c.then(u=>Ua(u,n,i))):Ua(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function co(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Rn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Eu(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=Qp(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Nu(e,t,n,r,o,s){const i=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,d=c.optout==="optional";for(const h in t){if(a.has(h))continue;if(u==="never"){i.push(h);continue}const p=c.run({value:t[h],issues:[]},r);p instanceof Promise?e.push(p.then(f=>co(f,n,h,t,d))):co(p,n,h,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 Mg=Q("$ZodObject",(e,t)=>{if(Be.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}const r=Ro(()=>Eu(t));Te(e._zod,"propValues",()=>{const a=t.shape,c={};for(const u in a){const d=a[u]._zod;if(d.values){c[u]??(c[u]=new Set);for(const h of d.values)c[u].add(h)}}return c});const o=wr,s=t.catchall;let i;e._zod.parse=(a,c)=>{i??(i=r.value);const u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};const d=[],h=i.shape;for(const p of i.keys){const f=h[p],g=f._zod.optout==="optional",m=f._zod.run({value:u[p],issues:[]},c);m instanceof Promise?d.push(m.then(x=>co(x,a,p,u,g))):co(m,a,p,u,g)}return s?Nu(d,u,a,c,r.value,e):d.length?Promise.all(d).then(()=>a):a}}),Lg=Q("$ZodObjectJIT",(e,t)=>{Mg.init(e,t);const n=e._zod.parse,r=Ro(()=>Eu(t)),o=p=>{const f=new og(["shape","payload","ctx"]),g=r.value,m=k=>{const S=$a(k);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};f.write("const input = payload.value;");const x=Object.create(null);let y=0;for(const k of g.keys)x[k]=`key_${y++}`;f.write("const newResult = {};");for(const k of g.keys){const S=x[k],C=$a(k),N=p[k]?._zod?.optout==="optional";f.write(`const ${S} = ${m(k)};`),N?f.write(`
3
+ `))}}const cg={major:4,minor:3,patch:6},Be=Q("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=cg;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,a,c)=>{let u=In(i),d;for(const h of a){if(h._zod.def.when){if(!h._zod.def.when(i))continue}else if(u)continue;const p=i.issues.length,f=h._zod.check(i);if(f instanceof Promise&&c?.async===!1)throw new On;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await f,i.issues.length!==p&&(u||(u=In(i,p)))});else{if(i.issues.length===p)continue;u||(u=In(i,p))}}return d?d.then(()=>i):i},s=(i,a,c)=>{if(In(i))return i.aborted=!0,i;const u=o(a,r,c);if(u instanceof Promise){if(c.async===!1)throw new On;return u.then(d=>e._zod.parse(d,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){const u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(d=>s(d,i,a)):s(u,i,a)}const c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new On;return c.then(u=>o(u,r,a))}return o(c,r,a)}}Te(e,"~standard",()=>({validate:o=>{try{const s=pm(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return mm(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),$i=Q("$ZodString",(e,t)=>{Be.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Vm(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}}),Ze=Q("$ZodStringFormat",(e,t)=>{Mo.init(e,t),$i.init(e,t)}),ug=Q("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Im),Ze.init(e,t)}),dg=Q("$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=Ua(r))}else t.pattern??(t.pattern=Ua());Ze.init(e,t)}),fg=Q("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=zm),Ze.init(e,t)}),hg=Q("$ZodURL",(e,t)=>{Ze.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})}}}),pg=Q("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Rm()),Ze.init(e,t)}),mg=Q("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Tm),Ze.init(e,t)}),gg=Q("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Sm),Ze.init(e,t)}),xg=Q("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Cm),Ze.init(e,t)}),yg=Q("$ZodULID",(e,t)=>{t.pattern??(t.pattern=jm),Ze.init(e,t)}),vg=Q("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Em),Ze.init(e,t)}),bg=Q("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Nm),Ze.init(e,t)}),wg=Q("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Zm(t)),Ze.init(e,t)}),kg=Q("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Bm),Ze.init(e,t)}),_g=Q("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Um(t)),Ze.init(e,t)}),Sg=Q("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Am),Ze.init(e,t)}),Cg=Q("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Om),Ze.init(e,t),e._zod.bag.format="ipv4"}),jg=Q("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Dm),Ze.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})}}}),Eg=Q("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Mm),Ze.init(e,t)}),Ng=Q("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Lm),Ze.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 Eu(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Tg=Q("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Fm),Ze.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Eu(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Ag(e){if(!bu.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Eu(n)}const Ig=Q("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=bu),Ze.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Ag(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),zg=Q("$ZodE164",(e,t)=>{t.pattern??(t.pattern=$m),Ze.init(e,t)});function Pg(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 Rg=Q("$ZodJWT",(e,t)=>{Ze.init(e,t),e._zod.check=n=>{Pg(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Nu=Q("$ZodNumber",(e,t)=>{Be.init(e,t),e._zod.pattern=e._zod.bag.pattern??_u,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}}),Og=Q("$ZodNumberFormat",(e,t)=>{Ym.init(e,t),Nu.init(e,t)}),Dg=Q("$ZodBoolean",(e,t)=>{Be.init(e,t),e._zod.pattern=Wm,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}}),Mg=Q("$ZodNull",(e,t)=>{Be.init(e,t),e._zod.pattern=qm,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}}),Lg=Q("$ZodUnknown",(e,t)=>{Be.init(e,t),e._zod.parse=n=>n}),Fg=Q("$ZodNever",(e,t)=>{Be.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Za(e,t,n){e.issues.length&&t.issues.push(...zn(n,e.issues)),t.value[n]=e.value}const $g=Q("$ZodArray",(e,t)=>{Be.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 a=o[i],c=t.element._zod.run({value:a,issues:[]},r);c instanceof Promise?s.push(c.then(u=>Za(u,n,i))):Za(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function uo(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...zn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function Tu(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=rm(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Au(e,t,n,r,o,s){const i=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,d=c.optout==="optional";for(const h in t){if(a.has(h))continue;if(u==="never"){i.push(h);continue}const p=c.run({value:t[h],issues:[]},r);p instanceof Promise?e.push(p.then(f=>uo(f,n,h,t,d))):uo(p,n,h,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 Bg=Q("$ZodObject",(e,t)=>{if(Be.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const a=t.shape;Object.defineProperty(t,"shape",{get:()=>{const c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}const r=Ro(()=>Tu(t));Te(e._zod,"propValues",()=>{const a=t.shape,c={};for(const u in a){const d=a[u]._zod;if(d.values){c[u]??(c[u]=new Set);for(const h of d.values)c[u].add(h)}}return c});const o=wr,s=t.catchall;let i;e._zod.parse=(a,c)=>{i??(i=r.value);const u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};const d=[],h=i.shape;for(const p of i.keys){const f=h[p],g=f._zod.optout==="optional",m=f._zod.run({value:u[p],issues:[]},c);m instanceof Promise?d.push(m.then(x=>uo(x,a,p,u,g))):uo(m,a,p,u,g)}return s?Au(d,u,a,c,r.value,e):d.length?Promise.all(d).then(()=>a):a}}),Ug=Q("$ZodObjectJIT",(e,t)=>{Bg.init(e,t);const n=e._zod.parse,r=Ro(()=>Tu(t)),o=p=>{const f=new lg(["shape","payload","ctx"]),g=r.value,m=k=>{const S=Ba(k);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};f.write("const input = payload.value;");const x=Object.create(null);let y=0;for(const k of g.keys)x[k]=`key_${y++}`;f.write("const newResult = {};");for(const k of g.keys){const S=x[k],j=Ba(k),N=p[k]?._zod?.optout==="optional";f.write(`const ${S} = ${m(k)};`),N?f.write(`
4
4
  if (${S}.issues.length) {
5
- if (${C} in input) {
5
+ if (${j} in input) {
6
6
  payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
7
7
  ...iss,
8
- path: iss.path ? [${C}, ...iss.path] : [${C}]
8
+ path: iss.path ? [${j}, ...iss.path] : [${j}]
9
9
  })));
10
10
  }
11
11
  }
12
12
 
13
13
  if (${S}.value === undefined) {
14
- if (${C} in input) {
15
- newResult[${C}] = undefined;
14
+ if (${j} in input) {
15
+ newResult[${j}] = undefined;
16
16
  }
17
17
  } else {
18
- newResult[${C}] = ${S}.value;
18
+ newResult[${j}] = ${S}.value;
19
19
  }
20
20
 
21
21
  `):f.write(`
22
22
  if (${S}.issues.length) {
23
23
  payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
24
24
  ...iss,
25
- path: iss.path ? [${C}, ...iss.path] : [${C}]
25
+ path: iss.path ? [${j}, ...iss.path] : [${j}]
26
26
  })));
27
27
  }
28
28
 
29
29
  if (${S}.value === undefined) {
30
- if (${C} in input) {
31
- newResult[${C}] = undefined;
30
+ if (${j} in input) {
31
+ newResult[${j}] = undefined;
32
32
  }
33
33
  } else {
34
- newResult[${C}] = ${S}.value;
34
+ newResult[${j}] = ${S}.value;
35
35
  }
36
36
 
37
- `)}f.write("payload.value = newResult;"),f.write("return payload;");const b=f.compile();return(k,S)=>b(p,k,S)};let s;const i=wr,a=!du.jitless,u=a&&Yp.value,d=t.catchall;let h;e._zod.parse=(p,f)=>{h??(h=r.value);const g=p.value;return i(g)?a&&u&&f?.async===!1&&f.jitless!==!0?(s||(s=o(t.shape)),p=s(p,f),d?Nu([],g,p,f,h,e):p):n(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),p)}});function Za(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=>!zn(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=>tn(i,r,en())))}),t)}const Tu=Q("$ZodUnion",(e,t)=>{Be.init(e,t),Te(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Te(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Te(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Te(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=>Oi(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 a=[];for(const c of t.options){const u=c._zod.run({value:o.value,issues:[]},s);if(u instanceof Promise)a.push(u),i=!0;else{if(u.issues.length===0)return u;a.push(u)}}return i?Promise.all(a).then(c=>Za(c,o,e,s)):Za(a,o,e,s)}}),Fg=Q("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Tu.init(e,t);const n=e._zod.parse;Te(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[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(const u of c)o[a].add(u)}}return o});const r=Ro(()=>{const o=t.options,s=new Map;for(const i of o){const a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const c of a){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(!wr(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;const a=r.value.get(i?.[t.discriminator]);return a?a._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)}}),$g=Q("$ZodIntersection",(e,t)=>{Be.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])=>Va(n,c,u)):Va(n,s,i)}});function Gs(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(Un(e)&&Un(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=Gs(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=Gs(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 Va(e,t,n){const r=new Map;let o;for(const a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(a);const s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&o&&e.issues.push({...o,keys:s}),zn(e))return e;const i=Gs(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 Bg=Q("$ZodRecord",(e,t)=>{Be.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Un(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 a=new Set;for(const u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.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(h=>{h.issues.length&&n.issues.push(...Rn(u,h.issues)),n.value[u]=h.value})):(d.issues.length&&n.issues.push(...Rn(u,d.issues)),n.value[u]=d.value)}let c;for(const u in o)a.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 a of Reflect.ownKeys(o)){if(a==="__proto__")continue;let c=t.keyType._zod.run({value:a,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&wu.test(a)&&c.issues.length){const h=t.keyType._zod.run({value:Number(a),issues:[]},r);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(c=h)}if(c.issues.length){t.mode==="loose"?n.value[a]=o[a]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(h=>tn(h,r,en())),input:a,path:[a],inst:e});continue}const d=t.valueType._zod.run({value:o[a],issues:[]},r);d instanceof Promise?s.push(d.then(h=>{h.issues.length&&n.issues.push(...Rn(a,h.issues)),n.value[c.value]=h.value})):(d.issues.length&&n.issues.push(...Rn(a,d.issues)),n.value[c.value]=d.value)}}return s.length?Promise.all(s).then(()=>n):n}}),Ug=Q("$ZodEnum",(e,t)=>{Be.init(e,t);const n=fu(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Xp.has(typeof o)).map(o=>typeof o=="string"?Zn(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}}),Zg=Q("$ZodLiteral",(e,t)=>{if(Be.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"?Zn(r):r?Zn(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}}),Vg=Q("$ZodTransform",(e,t)=>{Be.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new uu(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 Dn;return n.value=o,n}});function Wa(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Au=Q("$ZodOptional",(e,t)=>{Be.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Te(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Te(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Oi(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=>Wa(s,n.value)):Wa(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Wg=Q("$ZodExactOptional",(e,t)=>{Au.init(e,t),Te(e._zod,"values",()=>t.innerType._zod.values),Te(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Hg=Q("$ZodNullable",(e,t)=>{Be.init(e,t),Te(e._zod,"optin",()=>t.innerType._zod.optin),Te(e._zod,"optout",()=>t.innerType._zod.optout),Te(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Oi(n.source)}|null)$`):void 0}),Te(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)}),qg=Q("$ZodDefault",(e,t)=>{Be.init(e,t),e._zod.optin="optional",Te(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=>Ha(s,t)):Ha(o,t)}});function Ha(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Kg=Q("$ZodPrefault",(e,t)=>{Be.init(e,t),e._zod.optin="optional",Te(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))}),Gg=Q("$ZodNonOptional",(e,t)=>{Be.init(e,t),Te(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=>qa(s,e)):qa(o,e)}});function qa(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 Jg=Q("$ZodCatch",(e,t)=>{Be.init(e,t),Te(e._zod,"optin",()=>t.innerType._zod.optin),Te(e._zod,"optout",()=>t.innerType._zod.optout),Te(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=>tn(i,r,en()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>tn(s,r,en()))},input:n.value}),n.issues=[]),n)}}),Yg=Q("$ZodPipe",(e,t)=>{Be.init(e,t),Te(e._zod,"values",()=>t.in._zod.values),Te(e._zod,"optin",()=>t.in._zod.optin),Te(e._zod,"optout",()=>t.out._zod.optout),Te(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=>$r(i,t.in,r)):$r(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>$r(s,t.out,r)):$r(o,t.out,r)}});function $r(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Xg=Q("$ZodReadonly",(e,t)=>{Be.init(e,t),Te(e._zod,"propValues",()=>t.innerType._zod.propValues),Te(e._zod,"values",()=>t.innerType._zod.values),Te(e._zod,"optin",()=>t.innerType?._zod?.optin),Te(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(Ka):Ka(o)}});function Ka(e){return e.value=Object.freeze(e.value),e}const Qg=Q("$ZodLazy",(e,t)=>{Be.init(e,t),Te(e._zod,"innerType",()=>t.getter()),Te(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Te(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Te(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Te(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),ex=Q("$ZodCustom",(e,t)=>{ut.init(e,t),Be.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=>Ga(s,n,r,e));Ga(o,n,r,e)}});function Ga(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(kr(o))}}var Ja;class tx{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 nx(){return new tx}(Ja=globalThis).__zod_globalRegistry??(Ja.__zod_globalRegistry=nx());const gr=globalThis.__zod_globalRegistry;function rx(e,t){return new e({type:"string",...ye(t)})}function ox(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ye(t)})}function Ya(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ye(t)})}function sx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ye(t)})}function ix(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ye(t)})}function ax(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ye(t)})}function lx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ye(t)})}function cx(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ye(t)})}function ux(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ye(t)})}function dx(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ye(t)})}function fx(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ye(t)})}function hx(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ye(t)})}function px(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ye(t)})}function mx(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ye(t)})}function gx(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ye(t)})}function xx(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ye(t)})}function yx(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ye(t)})}function vx(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ye(t)})}function bx(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ye(t)})}function wx(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ye(t)})}function kx(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ye(t)})}function _x(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ye(t)})}function Sx(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ye(t)})}function Cx(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ye(t)})}function jx(e,t){return new e({type:"string",format:"date",check:"string_format",...ye(t)})}function Ex(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ye(t)})}function Nx(e,t){return new e({type:"string",format:"duration",check:"string_format",...ye(t)})}function Tx(e,t){return new e({type:"number",checks:[],...ye(t)})}function Ax(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ye(t)})}function Ix(e,t){return new e({type:"boolean",...ye(t)})}function zx(e,t){return new e({type:"null",...ye(t)})}function Rx(e){return new e({type:"unknown"})}function Px(e,t){return new e({type:"never",...ye(t)})}function Xa(e,t){return new _u({check:"less_than",...ye(t),value:e,inclusive:!1})}function ps(e,t){return new _u({check:"less_than",...ye(t),value:e,inclusive:!0})}function Qa(e,t){return new Su({check:"greater_than",...ye(t),value:e,inclusive:!1})}function ms(e,t){return new Su({check:"greater_than",...ye(t),value:e,inclusive:!0})}function el(e,t){return new Hm({check:"multiple_of",...ye(t),value:e})}function Iu(e,t){return new Km({check:"max_length",...ye(t),maximum:e})}function uo(e,t){return new Gm({check:"min_length",...ye(t),minimum:e})}function zu(e,t){return new Jm({check:"length_equals",...ye(t),length:e})}function Ox(e,t){return new Ym({check:"string_format",format:"regex",...ye(t),pattern:e})}function Dx(e){return new Xm({check:"string_format",format:"lowercase",...ye(e)})}function Mx(e){return new Qm({check:"string_format",format:"uppercase",...ye(e)})}function Lx(e,t){return new eg({check:"string_format",format:"includes",...ye(t),includes:e})}function Fx(e,t){return new tg({check:"string_format",format:"starts_with",...ye(t),prefix:e})}function $x(e,t){return new ng({check:"string_format",format:"ends_with",...ye(t),suffix:e})}function Yn(e){return new rg({check:"overwrite",tx:e})}function Bx(e){return Yn(t=>t.normalize(e))}function Ux(){return Yn(e=>e.trim())}function Zx(){return Yn(e=>e.toLowerCase())}function Vx(){return Yn(e=>e.toUpperCase())}function Wx(){return Yn(e=>Jp(e))}function Hx(e,t,n){return new e({type:"array",element:t,...ye(n)})}function qx(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ye(n)})}function Kx(e){const t=Gx(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(kr(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(kr(o))}},e(n.value,n)));return t}function Gx(e,t){const n=new ut({check:"custom",...ye(t)});return n._zod.check=e,n}function Ru(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??gr,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 Ke(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 a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{const d={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,d);else{const p=i.schema,f=t.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,p,d)}const h=e._zod.parent;h&&(i.ref||(i.ref=h),Ke(h,t,d),t.seen.get(h).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&ot(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 Pu(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 a=e.metadataRegistry.get(i[0])?.id;if(a){const c=r.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,i[0])}}const o=i=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const h=e.external.registry.get(i[0])?.id,p=e.external.uri??(g=>g);if(h)return{ref:p(h)};const f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${p("__shared")}#/${a}/${f}`}}if(i[1]===n)return{ref:"#"};const u=`#/${a}/`,d=i[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},s=i=>{if(i[1].schema.$ref)return;const a=i[1],{ref:c,defId:u}=o(i);a.def={...a.schema},u&&(a.defId=u);const d=a.schema;for(const h in d)delete d[h];d.$ref=c};if(e.cycles==="throw")for(const i of e.seen.entries()){const a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
37
+ `)}f.write("payload.value = newResult;"),f.write("return payload;");const b=f.compile();return(k,S)=>b(p,k,S)};let s;const i=wr,a=!hu.jitless,u=a&&tm.value,d=t.catchall;let h;e._zod.parse=(p,f)=>{h??(h=r.value);const g=p.value;return i(g)?a&&u&&f?.async===!1&&f.jitless!==!0?(s||(s=o(t.shape)),p=s(p,f),d?Au([],g,p,f,h,e):p):n(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),p)}});function Va(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=>!In(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=>tn(i,r,en())))}),t)}const Iu=Q("$ZodUnion",(e,t)=>{Be.init(e,t),Te(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Te(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Te(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Te(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=>Di(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 a=[];for(const c of t.options){const u=c._zod.run({value:o.value,issues:[]},s);if(u instanceof Promise)a.push(u),i=!0;else{if(u.issues.length===0)return u;a.push(u)}}return i?Promise.all(a).then(c=>Va(c,o,e,s)):Va(a,o,e,s)}}),Zg=Q("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Iu.init(e,t);const n=e._zod.parse;Te(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[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(const u of c)o[a].add(u)}}return o});const r=Ro(()=>{const o=t.options,s=new Map;for(const i of o){const a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const c of a){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(!wr(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;const a=r.value.get(i?.[t.discriminator]);return a?a._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)}}),Vg=Q("$ZodIntersection",(e,t)=>{Be.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])=>Ha(n,c,u)):Ha(n,s,i)}});function Js(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(Bn(e)&&Bn(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=Js(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=Js(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 Ha(e,t,n){const r=new Map;let o;for(const a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(a);const s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&o&&e.issues.push({...o,keys:s}),In(e))return e;const i=Js(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 Hg=Q("$ZodRecord",(e,t)=>{Be.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Bn(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 a=new Set;for(const u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.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(h=>{h.issues.length&&n.issues.push(...zn(u,h.issues)),n.value[u]=h.value})):(d.issues.length&&n.issues.push(...zn(u,d.issues)),n.value[u]=d.value)}let c;for(const u in o)a.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 a of Reflect.ownKeys(o)){if(a==="__proto__")continue;let c=t.keyType._zod.run({value:a,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&_u.test(a)&&c.issues.length){const h=t.keyType._zod.run({value:Number(a),issues:[]},r);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(c=h)}if(c.issues.length){t.mode==="loose"?n.value[a]=o[a]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(h=>tn(h,r,en())),input:a,path:[a],inst:e});continue}const d=t.valueType._zod.run({value:o[a],issues:[]},r);d instanceof Promise?s.push(d.then(h=>{h.issues.length&&n.issues.push(...zn(a,h.issues)),n.value[c.value]=h.value})):(d.issues.length&&n.issues.push(...zn(a,d.issues)),n.value[c.value]=d.value)}}return s.length?Promise.all(s).then(()=>n):n}}),Wg=Q("$ZodEnum",(e,t)=>{Be.init(e,t);const n=pu(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>nm.has(typeof o)).map(o=>typeof o=="string"?Un(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}}),qg=Q("$ZodLiteral",(e,t)=>{if(Be.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"?Un(r):r?Un(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}}),Kg=Q("$ZodTransform",(e,t)=>{Be.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new fu(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 On;return n.value=o,n}});function Wa(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const zu=Q("$ZodOptional",(e,t)=>{Be.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Te(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Te(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Di(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=>Wa(s,n.value)):Wa(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Jg=Q("$ZodExactOptional",(e,t)=>{zu.init(e,t),Te(e._zod,"values",()=>t.innerType._zod.values),Te(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Gg=Q("$ZodNullable",(e,t)=>{Be.init(e,t),Te(e._zod,"optin",()=>t.innerType._zod.optin),Te(e._zod,"optout",()=>t.innerType._zod.optout),Te(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Di(n.source)}|null)$`):void 0}),Te(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)}),Yg=Q("$ZodDefault",(e,t)=>{Be.init(e,t),e._zod.optin="optional",Te(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=>qa(s,t)):qa(o,t)}});function qa(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Xg=Q("$ZodPrefault",(e,t)=>{Be.init(e,t),e._zod.optin="optional",Te(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))}),Qg=Q("$ZodNonOptional",(e,t)=>{Be.init(e,t),Te(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=>Ka(s,e)):Ka(o,e)}});function Ka(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 ex=Q("$ZodCatch",(e,t)=>{Be.init(e,t),Te(e._zod,"optin",()=>t.innerType._zod.optin),Te(e._zod,"optout",()=>t.innerType._zod.optout),Te(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=>tn(i,r,en()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>tn(s,r,en()))},input:n.value}),n.issues=[]),n)}}),tx=Q("$ZodPipe",(e,t)=>{Be.init(e,t),Te(e._zod,"values",()=>t.in._zod.values),Te(e._zod,"optin",()=>t.in._zod.optin),Te(e._zod,"optout",()=>t.out._zod.optout),Te(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=>Br(i,t.in,r)):Br(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>Br(s,t.out,r)):Br(o,t.out,r)}});function Br(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const nx=Q("$ZodReadonly",(e,t)=>{Be.init(e,t),Te(e._zod,"propValues",()=>t.innerType._zod.propValues),Te(e._zod,"values",()=>t.innerType._zod.values),Te(e._zod,"optin",()=>t.innerType?._zod?.optin),Te(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(Ja):Ja(o)}});function Ja(e){return e.value=Object.freeze(e.value),e}const rx=Q("$ZodLazy",(e,t)=>{Be.init(e,t),Te(e._zod,"innerType",()=>t.getter()),Te(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Te(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Te(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Te(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),ox=Q("$ZodCustom",(e,t)=>{ut.init(e,t),Be.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=>Ga(s,n,r,e));Ga(o,n,r,e)}});function Ga(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(kr(o))}}var Ya;class sx{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 ix(){return new sx}(Ya=globalThis).__zod_globalRegistry??(Ya.__zod_globalRegistry=ix());const mr=globalThis.__zod_globalRegistry;function ax(e,t){return new e({type:"string",...ye(t)})}function lx(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ye(t)})}function Xa(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ye(t)})}function cx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ye(t)})}function ux(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ye(t)})}function dx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ye(t)})}function fx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ye(t)})}function hx(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ye(t)})}function px(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ye(t)})}function mx(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ye(t)})}function gx(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ye(t)})}function xx(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ye(t)})}function yx(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ye(t)})}function vx(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ye(t)})}function bx(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ye(t)})}function wx(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ye(t)})}function kx(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ye(t)})}function _x(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ye(t)})}function Sx(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ye(t)})}function Cx(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ye(t)})}function jx(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ye(t)})}function Ex(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ye(t)})}function Nx(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ye(t)})}function Tx(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ye(t)})}function Ax(e,t){return new e({type:"string",format:"date",check:"string_format",...ye(t)})}function Ix(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ye(t)})}function zx(e,t){return new e({type:"string",format:"duration",check:"string_format",...ye(t)})}function Px(e,t){return new e({type:"number",checks:[],...ye(t)})}function Rx(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ye(t)})}function Ox(e,t){return new e({type:"boolean",...ye(t)})}function Dx(e,t){return new e({type:"null",...ye(t)})}function Mx(e){return new e({type:"unknown"})}function Lx(e,t){return new e({type:"never",...ye(t)})}function Qa(e,t){return new Cu({check:"less_than",...ye(t),value:e,inclusive:!1})}function ps(e,t){return new Cu({check:"less_than",...ye(t),value:e,inclusive:!0})}function el(e,t){return new ju({check:"greater_than",...ye(t),value:e,inclusive:!1})}function ms(e,t){return new ju({check:"greater_than",...ye(t),value:e,inclusive:!0})}function tl(e,t){return new Gm({check:"multiple_of",...ye(t),value:e})}function Pu(e,t){return new Xm({check:"max_length",...ye(t),maximum:e})}function fo(e,t){return new Qm({check:"min_length",...ye(t),minimum:e})}function Ru(e,t){return new eg({check:"length_equals",...ye(t),length:e})}function Fx(e,t){return new tg({check:"string_format",format:"regex",...ye(t),pattern:e})}function $x(e){return new ng({check:"string_format",format:"lowercase",...ye(e)})}function Bx(e){return new rg({check:"string_format",format:"uppercase",...ye(e)})}function Ux(e,t){return new og({check:"string_format",format:"includes",...ye(t),includes:e})}function Zx(e,t){return new sg({check:"string_format",format:"starts_with",...ye(t),prefix:e})}function Vx(e,t){return new ig({check:"string_format",format:"ends_with",...ye(t),suffix:e})}function Gn(e){return new ag({check:"overwrite",tx:e})}function Hx(e){return Gn(t=>t.normalize(e))}function Wx(){return Gn(e=>e.trim())}function qx(){return Gn(e=>e.toLowerCase())}function Kx(){return Gn(e=>e.toUpperCase())}function Jx(){return Gn(e=>em(e))}function Gx(e,t,n){return new e({type:"array",element:t,...ye(n)})}function Yx(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ye(n)})}function Xx(e){const t=Qx(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(kr(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(kr(o))}},e(n.value,n)));return t}function Qx(e,t){const n=new ut({check:"custom",...ye(t)});return n._zod.check=e,n}function Ou(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??mr,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 Ke(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 a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{const d={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,d);else{const p=i.schema,f=t.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,p,d)}const h=e._zod.parent;h&&(i.ref||(i.ref=h),Ke(h,t,d),t.seen.get(h).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&ot(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 Du(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 a=e.metadataRegistry.get(i[0])?.id;if(a){const c=r.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,i[0])}}const o=i=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const h=e.external.registry.get(i[0])?.id,p=e.external.uri??(g=>g);if(h)return{ref:p(h)};const f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${p("__shared")}#/${a}/${f}`}}if(i[1]===n)return{ref:"#"};const u=`#/${a}/`,d=i[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},s=i=>{if(i[1].schema.$ref)return;const a=i[1],{ref:c,defId:u}=o(i);a.def={...a.schema},u&&(a.defId=u);const d=a.schema;for(const h in d)delete d[h];d.$ref=c};if(e.cycles==="throw")for(const i of e.seen.entries()){const a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
38
38
 
39
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const a=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(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function Ou(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 a=e.seen.get(i);if(a.ref===null)return;const c=a.def??a.schema,u={...c},d=a.ref;if(a.ref=null,d){r(d);const p=e.seen.get(d),f=p.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(f)):Object.assign(c,f),Object.assign(c,u),i._zod.parent===d)for(const m in c)m==="$ref"||m==="allOf"||m in u||delete c[m];if(f.$ref&&p.def)for(const m in c)m==="$ref"||m==="allOf"||m in p.def&&JSON.stringify(c[m])===JSON.stringify(p.def[m])&&delete c[m]}const h=i._zod.parent;if(h&&h!==d){r(h);const p=e.seen.get(h);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(const f in c)f==="$ref"||f==="allOf"||f in p.def&&JSON.stringify(c[f])===JSON.stringify(p.def[f])&&delete c[f]}e.override({zodSchema:i,jsonSchema:c,path:a.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 a=i[1];a.def&&a.defId&&(s[a.defId]=a.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:fo(t,"input",e.processors),output:fo(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function ot(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 ot(r.element,n);if(r.type==="set")return ot(r.valueType,n);if(r.type==="lazy")return ot(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 ot(r.innerType,n);if(r.type==="intersection")return ot(r.left,n)||ot(r.right,n);if(r.type==="record"||r.type==="map")return ot(r.keyType,n)||ot(r.valueType,n);if(r.type==="pipe")return ot(r.in,n)||ot(r.out,n);if(r.type==="object"){for(const o in r.shape)if(ot(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(ot(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(ot(o,n))return!0;return!!(r.rest&&ot(r.rest,n))}return!1}const Jx=(e,t={})=>n=>{const r=Ru({...n,processors:t});return Ke(e,r),Pu(r,e),Ou(r,e)},fo=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=Ru({...o??{},target:s,io:t,processors:n});return Ke(e,i),Pu(i,e),Ou(i,e)},Yx={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Xx=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=Yx[a]??a,o.format===""&&delete o.format,a==="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(h=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},Qx=(e,t,n,r)=>{const o=n,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;typeof a=="string"&&a.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)},e0=(e,t,n,r)=>{n.type="boolean"},t0=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},n0=(e,t,n,r)=>{n.not={}},r0=(e,t,n,r)=>{},o0=(e,t,n,r)=>{const o=e._zod.def,s=fu(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},s0=(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},i0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},a0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},l0=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=Ke(s.element,t,{...r,path:[...r.path,"items"]})},c0=(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]=Ke(i[u],t,{...r,path:[...r.path,"properties",u]});const a=new Set(Object.keys(i)),c=new Set([...a].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=Ke(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},u0=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>Ke(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},d0=(e,t,n,r)=>{const o=e._zod.def,s=Ke(o.left,t,{...r,path:[...r.path,"allOf",0]}),i=Ke(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];n.allOf=c},f0=(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=Ke(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const h of c)o.patternProperties[h.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Ke(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Ke(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=i._zod.values;if(u){const d=[...u].filter(h=>typeof h=="string"||typeof h=="number");d.length>0&&(o.required=d)}},h0=(e,t,n,r)=>{const o=e._zod.def,s=Ke(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"}]},p0=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},m0=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},g0=(e,t,n,r)=>{const o=e._zod.def;Ke(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)))},x0=(e,t,n,r)=>{const o=e._zod.def;Ke(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},y0=(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;Ke(s,t,r);const i=t.seen.get(e);i.ref=s},v0=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},Du=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},b0=(e,t,n,r)=>{const o=e._zod.innerType;Ke(o,t,r);const s=t.seen.get(e);s.ref=o},w0=Q("ZodISODateTime",(e,t)=>{xg.init(e,t),We.init(e,t)});function k0(e){return Cx(w0,e)}const _0=Q("ZodISODate",(e,t)=>{yg.init(e,t),We.init(e,t)});function S0(e){return jx(_0,e)}const C0=Q("ZodISOTime",(e,t)=>{vg.init(e,t),We.init(e,t)});function j0(e){return Ex(C0,e)}const E0=Q("ZodISODuration",(e,t)=>{bg.init(e,t),We.init(e,t)});function N0(e){return Nx(E0,e)}const T0=(e,t)=>{gu.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>cm(e,n)},flatten:{value:n=>lm(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Ks,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Ks,2)}},isEmpty:{get(){return e.issues.length===0}}})},wt=Q("ZodError",T0,{Parent:Error}),A0=Mi(wt),I0=Li(wt),z0=Po(wt),R0=Oo(wt),P0=fm(wt),O0=hm(wt),D0=pm(wt),M0=mm(wt),L0=gm(wt),F0=xm(wt),$0=ym(wt),B0=vm(wt),Ue=Q("ZodType",(e,t)=>(Be.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:fo(e,"input"),output:fo(e,"output")}}),e.toJSONSchema=Jx(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(on(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)=>sn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>A0(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>z0(e,n,r),e.parseAsync=async(n,r)=>I0(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>R0(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>P0(e,n,r),e.decode=(n,r)=>O0(e,n,r),e.encodeAsync=async(n,r)=>D0(e,n,r),e.decodeAsync=async(n,r)=>M0(e,n,r),e.safeEncode=(n,r)=>L0(e,n,r),e.safeDecode=(n,r)=>F0(e,n,r),e.safeEncodeAsync=async(n,r)=>$0(e,n,r),e.safeDecodeAsync=async(n,r)=>B0(e,n,r),e.refine=(n,r)=>e.check(M1(n,r)),e.superRefine=n=>e.check(L1(n)),e.overwrite=n=>e.check(Yn(n)),e.optional=()=>ol(e),e.exactOptional=()=>k1(e),e.nullable=()=>sl(e),e.nullish=()=>ol(sl(e)),e.nonoptional=n=>N1(e,n),e.array=()=>Pe(e),e.or=n=>Kt([e,n]),e.and=n=>g1(e,n),e.transform=n=>il(e,b1(n)),e.default=n=>C1(e,n),e.prefault=n=>E1(e,n),e.catch=n=>A1(e,n),e.pipe=n=>il(e,n),e.readonly=()=>R1(e),e.describe=n=>{const r=e.clone();return gr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return gr.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return gr.get(e);const r=e.clone();return gr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Mu=Q("_ZodString",(e,t)=>{Fi.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Xx(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(Ox(...r)),e.includes=(...r)=>e.check(Lx(...r)),e.startsWith=(...r)=>e.check(Fx(...r)),e.endsWith=(...r)=>e.check($x(...r)),e.min=(...r)=>e.check(uo(...r)),e.max=(...r)=>e.check(Iu(...r)),e.length=(...r)=>e.check(zu(...r)),e.nonempty=(...r)=>e.check(uo(1,...r)),e.lowercase=r=>e.check(Dx(r)),e.uppercase=r=>e.check(Mx(r)),e.trim=()=>e.check(Ux()),e.normalize=(...r)=>e.check(Bx(...r)),e.toLowerCase=()=>e.check(Zx()),e.toUpperCase=()=>e.check(Vx()),e.slugify=()=>e.check(Wx())}),U0=Q("ZodString",(e,t)=>{Fi.init(e,t),Mu.init(e,t),e.email=n=>e.check(ox(Z0,n)),e.url=n=>e.check(cx(V0,n)),e.jwt=n=>e.check(Sx(s1,n)),e.emoji=n=>e.check(ux(W0,n)),e.guid=n=>e.check(Ya(tl,n)),e.uuid=n=>e.check(sx(Br,n)),e.uuidv4=n=>e.check(ix(Br,n)),e.uuidv6=n=>e.check(ax(Br,n)),e.uuidv7=n=>e.check(lx(Br,n)),e.nanoid=n=>e.check(dx(H0,n)),e.guid=n=>e.check(Ya(tl,n)),e.cuid=n=>e.check(fx(q0,n)),e.cuid2=n=>e.check(hx(K0,n)),e.ulid=n=>e.check(px(G0,n)),e.base64=n=>e.check(wx(n1,n)),e.base64url=n=>e.check(kx(r1,n)),e.xid=n=>e.check(mx(J0,n)),e.ksuid=n=>e.check(gx(Y0,n)),e.ipv4=n=>e.check(xx(X0,n)),e.ipv6=n=>e.check(yx(Q0,n)),e.cidrv4=n=>e.check(vx(e1,n)),e.cidrv6=n=>e.check(bx(t1,n)),e.e164=n=>e.check(_x(o1,n)),e.datetime=n=>e.check(k0(n)),e.date=n=>e.check(S0(n)),e.time=n=>e.check(j0(n)),e.duration=n=>e.check(N0(n))});function K(e){return rx(U0,e)}const We=Q("ZodStringFormat",(e,t)=>{Ze.init(e,t),Mu.init(e,t)}),Z0=Q("ZodEmail",(e,t)=>{lg.init(e,t),We.init(e,t)}),tl=Q("ZodGUID",(e,t)=>{ig.init(e,t),We.init(e,t)}),Br=Q("ZodUUID",(e,t)=>{ag.init(e,t),We.init(e,t)}),V0=Q("ZodURL",(e,t)=>{cg.init(e,t),We.init(e,t)}),W0=Q("ZodEmoji",(e,t)=>{ug.init(e,t),We.init(e,t)}),H0=Q("ZodNanoID",(e,t)=>{dg.init(e,t),We.init(e,t)}),q0=Q("ZodCUID",(e,t)=>{fg.init(e,t),We.init(e,t)}),K0=Q("ZodCUID2",(e,t)=>{hg.init(e,t),We.init(e,t)}),G0=Q("ZodULID",(e,t)=>{pg.init(e,t),We.init(e,t)}),J0=Q("ZodXID",(e,t)=>{mg.init(e,t),We.init(e,t)}),Y0=Q("ZodKSUID",(e,t)=>{gg.init(e,t),We.init(e,t)}),X0=Q("ZodIPv4",(e,t)=>{wg.init(e,t),We.init(e,t)}),Q0=Q("ZodIPv6",(e,t)=>{kg.init(e,t),We.init(e,t)}),e1=Q("ZodCIDRv4",(e,t)=>{_g.init(e,t),We.init(e,t)}),t1=Q("ZodCIDRv6",(e,t)=>{Sg.init(e,t),We.init(e,t)}),n1=Q("ZodBase64",(e,t)=>{Cg.init(e,t),We.init(e,t)}),r1=Q("ZodBase64URL",(e,t)=>{Eg.init(e,t),We.init(e,t)}),o1=Q("ZodE164",(e,t)=>{Ng.init(e,t),We.init(e,t)}),s1=Q("ZodJWT",(e,t)=>{Ag.init(e,t),We.init(e,t)}),Lu=Q("ZodNumber",(e,t)=>{ju.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Qx(e,r,o),e.gt=(r,o)=>e.check(Qa(r,o)),e.gte=(r,o)=>e.check(ms(r,o)),e.min=(r,o)=>e.check(ms(r,o)),e.lt=(r,o)=>e.check(Xa(r,o)),e.lte=(r,o)=>e.check(ps(r,o)),e.max=(r,o)=>e.check(ps(r,o)),e.int=r=>e.check(nl(r)),e.safe=r=>e.check(nl(r)),e.positive=r=>e.check(Qa(0,r)),e.nonnegative=r=>e.check(ms(0,r)),e.negative=r=>e.check(Xa(0,r)),e.nonpositive=r=>e.check(ps(0,r)),e.multipleOf=(r,o)=>e.check(el(r,o)),e.step=(r,o)=>e.check(el(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 ve(e){return Tx(Lu,e)}const i1=Q("ZodNumberFormat",(e,t)=>{Ig.init(e,t),Lu.init(e,t)});function nl(e){return Ax(i1,e)}const a1=Q("ZodBoolean",(e,t)=>{zg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>e0(e,n,r)});function Qe(e){return Ix(a1,e)}const l1=Q("ZodNull",(e,t)=>{Rg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>t0(e,n,r)});function Js(e){return zx(l1,e)}const c1=Q("ZodUnknown",(e,t)=>{Pg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>r0()});function rl(){return Rx(c1)}const u1=Q("ZodNever",(e,t)=>{Og.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>n0(e,n,r)});function d1(e){return Px(u1,e)}const f1=Q("ZodArray",(e,t)=>{Dg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>l0(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(uo(n,r)),e.nonempty=n=>e.check(uo(1,n)),e.max=(n,r)=>e.check(Iu(n,r)),e.length=(n,r)=>e.check(zu(n,r)),e.unwrap=()=>e.element});function Pe(e,t){return Hx(f1,e,t)}const h1=Q("ZodObject",(e,t)=>{Lg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>c0(e,n,r,o),Te(e,"shape",()=>t.shape),e.keyof=()=>lt(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:rl()}),e.loose=()=>e.clone({...e._zod.def,catchall:rl()}),e.strict=()=>e.clone({...e._zod.def,catchall:d1()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>rm(e,n),e.safeExtend=n=>om(e,n),e.merge=n=>sm(e,n),e.pick=n=>tm(e,n),e.omit=n=>nm(e,n),e.partial=(...n)=>im($u,e,n[0]),e.required=(...n)=>am(Bu,e,n[0])});function ae(e,t){const n={type:"object",shape:e??{},...ye(t)};return new h1(n)}const Fu=Q("ZodUnion",(e,t)=>{Tu.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>u0(e,n,r,o),e.options=t.options});function Kt(e,t){return new Fu({type:"union",options:e,...ye(t)})}const p1=Q("ZodDiscriminatedUnion",(e,t)=>{Fu.init(e,t),Fg.init(e,t)});function bn(e,t,n){return new p1({type:"union",options:t,discriminator:e,...ye(n)})}const m1=Q("ZodIntersection",(e,t)=>{$g.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>d0(e,n,r,o)});function g1(e,t){return new m1({type:"intersection",left:e,right:t})}const x1=Q("ZodRecord",(e,t)=>{Bg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>f0(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Wt(e,t,n){return new x1({type:"record",keyType:e,valueType:t,...ye(n)})}const Ys=Q("ZodEnum",(e,t)=>{Ug.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>o0(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 Ys({...t,checks:[],...ye(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 Ys({...t,checks:[],...ye(o),entries:s})}});function lt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Ys({type:"enum",entries:n,...ye(t)})}const y1=Q("ZodLiteral",(e,t)=>{Zg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>s0(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 Se(e,t){return new y1({type:"literal",values:Array.isArray(e)?e:[e],...ye(t)})}const v1=Q("ZodTransform",(e,t)=>{Vg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>a0(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new uu(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(kr(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(kr(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function b1(e){return new v1({type:"transform",transform:e})}const $u=Q("ZodOptional",(e,t)=>{Au.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Du(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ol(e){return new $u({type:"optional",innerType:e})}const w1=Q("ZodExactOptional",(e,t)=>{Wg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Du(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function k1(e){return new w1({type:"optional",innerType:e})}const _1=Q("ZodNullable",(e,t)=>{Hg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>h0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function sl(e){return new _1({type:"nullable",innerType:e})}const S1=Q("ZodDefault",(e,t)=>{qg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>m0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function C1(e,t){return new S1({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():pu(t)}})}const j1=Q("ZodPrefault",(e,t)=>{Kg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>g0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function E1(e,t){return new j1({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():pu(t)}})}const Bu=Q("ZodNonOptional",(e,t)=>{Gg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>p0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function N1(e,t){return new Bu({type:"nonoptional",innerType:e,...ye(t)})}const T1=Q("ZodCatch",(e,t)=>{Jg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>x0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function A1(e,t){return new T1({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const I1=Q("ZodPipe",(e,t)=>{Yg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>y0(e,n,r,o),e.in=t.in,e.out=t.out});function il(e,t){return new I1({type:"pipe",in:e,out:t})}const z1=Q("ZodReadonly",(e,t)=>{Xg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>v0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function R1(e){return new z1({type:"readonly",innerType:e})}const P1=Q("ZodLazy",(e,t)=>{Qg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>b0(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function O1(e){return new P1({type:"lazy",getter:e})}const D1=Q("ZodCustom",(e,t)=>{ex.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>i0(e,n)});function M1(e,t={}){return qx(D1,e,t)}function L1(e){return Kx(e)}const Vn=O1(()=>Kt([K(),ve(),Qe(),Js(),Pe(Vn),Wt(K(),Vn)]));function Uu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function al(e,t){return e===null||typeof e!="object"||Array.isArray(e)?void 0:Object.getOwnPropertyDescriptor(e,t)?.value}const $i=ae({type:K(),ttl:K().optional(),scope:K().optional()}),Bi=ae({type:Se("text"),text:K(),cache_control:$i.optional()}),Zu=ae({type:Se("thinking"),thinking:K(),signature:K().optional()}),F1=ae({type:Se("think"),thinking:K(),signature:K().optional()}),$1=ae({type:Se("base64"),media_type:K(),data:K()}),Vu=ae({type:Se("image"),source:$1}),Wu=ae({type:Se("tool_use"),id:K(),name:K(),input:Wt(K(),Vn)}),B1=bn("type",[Bi,Vu]),U1=ae({type:Se("tool_result"),tool_use_id:K().optional(),content:Kt([K(),Pe(B1)]),is_error:Qe().optional()}),Z1=bn("type",[Bi,Zu,Vu,Wu,U1]),V1=Kt([K(),Pe(Z1)]),W1=ae({role:lt(["user","assistant"]),content:V1}),H1=ae({type:Se("text"),text:K(),cache_control:$i.optional()}),q1=ae({type:K(),properties:Wt(K(),Wt(K(),Vn)).optional(),required:Pe(K()).optional(),additionalProperties:Qe().optional(),$schema:K().optional()}),K1=ae({name:K(),description:K().optional(),input_schema:q1.optional(),cache_control:$i.optional()}),G1=bn("type",[ae({type:Se("enabled"),budget_tokens:ve()}),ae({type:Se("disabled")}),ae({type:Se("adaptive")})]),Hu=ae({model:K(),messages:Pe(W1),system:Pe(H1).optional(),tools:Pe(K1).optional(),max_tokens:ve().optional(),temperature:ve().optional(),stream:Qe().optional(),thinking:G1.optional(),metadata:ae({user_id:K().optional()}).optional()}),Ui=bn("type",[Bi,Zu,F1,Wu]),J1=ae({input_tokens:ve().nullable().optional(),output_tokens:ve().nullable().optional(),cache_creation_input_tokens:ve().nullable().optional(),cache_read_input_tokens:ve().nullable().optional()}).passthrough(),qu=ae({id:K(),type:Se("message"),model:K(),role:Se("assistant"),content:Pe(Ui),stop_reason:K().nullable(),stop_sequence:K().nullable().optional(),usage:J1}).passthrough(),Y1=ae({type:Se("message_start"),message:ae({id:K(),type:Se("message"),model:K(),role:Se("assistant"),content:Pe(Ui),stop_reason:Js(),stop_sequence:Js(),usage:ae({input_tokens:ve(),cache_creation_input_tokens:ve().optional(),cache_read_input_tokens:ve().optional()}).passthrough()})}),X1=ae({type:Se("content_block_start"),index:ve(),content_block:Ui}),Q1=bn("type",[ae({type:Se("text_delta"),text:K()}),ae({type:Se("input_json_delta"),partial_json:K()}),ae({type:Se("thinking_delta"),thinking:K()}),ae({type:Se("signature_delta"),signature:K()})]),ey=ae({type:Se("content_block_delta"),index:ve(),delta:Q1}),ty=ae({type:Se("content_block_stop"),index:ve()}),ny=ae({type:Se("message_delta"),delta:ae({stop_reason:K().nullable(),stop_sequence:K().nullable().optional()}),usage:ae({output_tokens:ve(),input_tokens:ve().optional(),cache_creation_input_tokens:ve().optional(),cache_read_input_tokens:ve().optional()}).passthrough()}),ry=ae({type:Se("message_stop")}),oy=ae({type:Se("ping")}),sy=ae({type:Se("error"),error:ae({type:K(),message:K()})}),iy=bn("type",[Y1,X1,ey,ty,ny,ry,oy,sy]),ay=Kt([K(),Pe(bn("type",[ae({type:Se("text"),text:K()}),ae({type:Se("image_url"),image_url:ae({url:K(),detail:K().optional()})})]))]),Ku=ae({role:lt(["system","user","assistant","tool"]),content:ay,name:K().optional(),reasoning_content:K().optional(),thinking:K().optional(),think:K().optional()}),ly=ae({name:K(),arguments:K()}),Gu=ae({index:ve().optional(),id:K().optional(),type:Se("function").optional(),function:ae({name:K().optional(),arguments:K().optional()})});Ku.extend({content:Kt([K(),Pe(ae({type:Se("text"),text:K()}))]).optional(),function_call:ly.optional(),tool_calls:Pe(Gu).optional()});const cy=ae({type:Se("function"),function:ae({name:K(),description:K().optional(),parameters:Wt(K(),Vn)})}),Ju=ae({model:K(),messages:Pe(Ku),temperature:ve().optional(),max_tokens:ve().optional(),stream:Qe().optional(),tools:Pe(cy).optional(),tool_choice:Kt([lt(["auto","none","required"]),ae({type:Se("auto")}),ae({type:Se("none")}),ae({type:Se("function"),function:ae({name:K()})})]).optional(),user:K().optional()}),Yu=ae({role:lt(["assistant"]).optional(),content:K().nullable().optional(),reasoning_content:K().nullable().optional(),thinking:K().nullable().optional(),think:K().nullable().optional(),function_call:ae({name:K().optional(),arguments:K().optional()}).nullable().optional(),tool_calls:Pe(ae({index:ve(),id:K().optional(),type:Se("function").optional(),function:ae({name:K().optional(),arguments:K().optional()})})).nullable().optional()}),uy=ae({index:ve(),message:ae({role:lt(["assistant"]),content:K().nullable(),reasoning_content:K().optional(),thinking:K().optional(),think:K().optional(),function_call:ae({name:K(),arguments:K()}).nullable().optional(),tool_calls:Pe(Gu).optional()}).optional(),delta:Yu.optional(),finish_reason:K().nullable()}),dy=ae({id:K(),object:Se("chat.completion"),created:ve(),model:K(),choices:Pe(uy),usage:ae({prompt_tokens:ve().nullable().optional(),completion_tokens:ve().nullable().optional(),total_tokens:ve().nullable().optional()}).passthrough(),service_tier:K().nullable().optional(),system_fingerprint:K().nullable().optional()}).passthrough(),fy=ae({id:K(),object:Se("chat.completion.chunk"),created:ve(),model:K(),choices:Pe(ae({index:ve(),delta:Yu,finish_reason:K().nullable().optional()})),usage:ae({prompt_tokens:ve().nullable().optional(),completion_tokens:ve().nullable().optional(),total_tokens:ve().nullable().optional()}).passthrough().nullable().optional()}).passthrough();function Xu(e){try{const t=JSON.parse(e),n=dy.safeParse(t);return n.success?n.data:null}catch{return null}}const Qu=ae({index:ve(),timestamp:ve(),type:K(),data:Vn}),hy=ae({chunks:Pe(Qu),truncated:Qe().optional().default(!1)}),ll=ae({id:ve(),timestamp:K(),method:K(),path:K(),model:K().nullable(),sessionId:K().nullable(),rawRequestBody:K().nullable(),responseStatus:ve().nullable(),responseText:K().nullable(),inputTokens:ve().nullable(),outputTokens:ve().nullable(),cacheCreationInputTokens:ve().nullable(),cacheReadInputTokens:ve().nullable(),elapsedMs:ve().nullable(),streaming:Qe(),userAgent:K().nullable(),origin:K().nullable(),rawHeaders:Wt(K(),K()).optional(),headers:Wt(K(),K()).optional(),apiFormat:lt(["anthropic","openai","unknown"]).default("unknown"),isTest:Qe().optional().default(!1),providerName:K().nullable().optional(),clientPort:ve().nullable().optional(),clientPid:ve().nullable().optional(),clientCwd:K().nullable().optional(),clientProjectFolder:K().nullable().optional(),streamingChunks:hy.optional(),streamingChunksPath:K().nullable().optional(),error:K().nullable().optional()});ae({model:K()});ae({model:K().optional(),metadata:ae({user_id:K().optional()}).passthrough().optional()});const py=ae({error:K()});async function In(e,t){const n=await e.json();return t.parse(n)}async function no(e,t){try{const n=await e.json(),r=py.safeParse(n);return r.success?r.data.error:t}catch{return t}}async function Ar(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 no(o,s))}return In(o,t)}const Mo=ae({stripClaudeCodeBillingHeader:Qe(),hasSeenOnboarding:Qe().default(!1)}),Xs="/api/config";async function my(e){return Ar(e,Mo,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function gy(e){return Ar(Xs,Mo,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function ed(){const e=zi(Xs,my,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=lu(),n=e.data?.stripClaudeCodeBillingHeader??!1,r=async o=>{await t(Xs,gy({stripClaudeCodeBillingHeader:o}),{optimisticData:{stripClaudeCodeBillingHeader:o},rollbackOnError:!0,revalidate:!1})};return{strip:n,isLoading:e.isLoading,isError:e.error!==void 0,setStrip:r}}const td=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const xy=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const yy=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const cl=e=>{const t=yy(e);return t.charAt(0).toUpperCase()+t.slice(1)};var vy={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 by=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const wy=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...a},c)=>v.createElement("svg",{ref:c,...vy,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:td("lucide",o),...!s&&!by(a)&&{"aria-hidden":"true"},...a},[...i.map(([u,d])=>v.createElement(u,d)),...Array.isArray(s)?s:[s]]));const ke=(e,t)=>{const n=v.forwardRef(({className:r,...o},s)=>v.createElement(wy,{ref:s,iconNode:t,className:td(`lucide-${xy(cl(e))}`,`lucide-${e}`,r),...o}));return n.displayName=cl(e),n};const ky=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],_y=ke("arrow-down",ky);const Sy=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Cy=ke("arrow-up",Sy);const jy=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],Ey=ke("brain",jy);const Ny=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Gt=ke("check",Ny);const Ty=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],vt=ke("chevron-down",Ty);const Ay=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],bt=ke("chevron-right",Ay);const Iy=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],zy=ke("chevron-up",Iy);const Ry=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],Py=ke("chevrons-down",Ry);const Oy=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],Dy=ke("chevrons-up",Oy);const My=[["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"}]],_r=ke("circle-alert",My);const Ly=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Fy=ke("circle-check-big",Ly);const $y=[["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"}]],By=ke("circle-question-mark",$y);const Uy=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],nd=ke("circle-stop",Uy);const Zy=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ir=ke("clock",Zy);const Vy=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],rd=ke("columns-2",Vy);const Wy=[["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"}]],wn=ke("copy",Wy);const Hy=[["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"}]],Zi=ke("download",Hy);const qy=[["line",{x1:"5",x2:"19",y1:"9",y2:"9",key:"1nwqeh"}],["line",{x1:"5",x2:"19",y1:"15",y2:"15",key:"g8yjpy"}]],Ky=ke("equal",qy);const Gy=[["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"}]],Jy=ke("external-link",Gy);const Yy=[["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"}]],Vi=ke("eye-off",Yy);const Xy=[["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"}]],Wi=ke("eye",Xy);const Qy=[["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"}]],ev=ke("file-terminal",Qy);const tv=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],nv=ke("gauge",tv);const rv=[["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"}]],od=ke("git-compare-arrows",rv);const ov=[["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"}]],sv=ke("globe",ov);const iv=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Sr=ke("loader-circle",iv);const av=[["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"}]],lv=ke("lock",av);const cv=[["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"}]],sd=ke("message-square",cv);const uv=[["path",{d:"M5 12h14",key:"1ays0h"}]],Hi=ke("minus",uv);const dv=[["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"}]],qi=ke("pencil",dv);const fv=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ho=ke("plus",fv);const hv=[["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"}]],pv=ke("radio",hv);const mv=[["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"}]],id=ke("rotate-ccw",mv);const gv=[["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"}]],ad=ke("rotate-cw",gv);const xv=[["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"}]],ld=ke("rows-3",xv);const yv=[["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"}]],vv=ke("scan",yv);const bv=[["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"}]],wv=ke("server",bv);const kv=[["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"}]],_v=ke("settings",kv);const Sv=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],cd=ke("terminal",Sv);const Cv=[["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"}]],ud=ke("trash-2",Cv);const jv=[["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"}]],Ev=ke("triangle-alert",jv);const Nv=[["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"}]],Tv=ke("upload",Nv);const Av=[["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"}]],Iv=ke("user",Av);const zv=[["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"}]],Rv=ke("wifi-off",zv);const Pv=[["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"}]],Ov=ke("wifi",Pv);const Dv=[["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"}]],ul=ke("wrench",Dv);const Mv=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ki=ke("x",Mv);const Lv=[["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"}]],Xn=ke("zap",Lv),Qs="/api/config";async function Fv(e){return Ar(e,Mo,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function $v(e){return Ar(Qs,Mo,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function Bv(){const e=zi(Qs,Fv,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=lu(),n=e.data?.hasSeenOnboarding??!1,r=async()=>{await t(Qs,$v({hasSeenOnboarding:!0}),{optimisticData:{stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:!0},rollbackOnError:!0,revalidate:!1})};return{hasSeenOnboarding:n,isLoading:e.isLoading,markSeen:r}}function Uv(){const{hasSeenOnboarding:e,isLoading:t,markSeen:n}=Bv();return t||e?null:l.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:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"font-medium text-amber-600 dark:text-amber-400 mb-1",children:"Quick tour of the log tabs"}),l.jsxs("ul",{className:"space-y-0.5 text-muted-foreground text-xs leading-relaxed",children:[l.jsxs("li",{children:[l.jsx("strong",{children:"Request"})," / ",l.jsx("strong",{children:"Response"})," — structured views of what the proxy sent and received."]}),l.jsxs("li",{children:[l.jsx("strong",{children:"Headers"})," — request and response headers after proxy processing."]}),l.jsxs("li",{children:[l.jsx("strong",{children:"Raw Headers"})," / ",l.jsx("strong",{children:"Raw Request"})," /"," ",l.jsx("strong",{children:"Raw Response"})," — exact bytes from the upstream provider (visible in Full mode)."]})]})]}),l.jsxs("button",{type:"button",onClick:()=>{n()},className:"inline-flex items-center gap-1.5 text-xs px-2.5 py-1.5 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:[l.jsx(Gt,{className:"size-3"}),"Got it"]}),l.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:l.jsx(Ki,{className:"size-3.5"})})]})}function Ur(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 gs={exports:{}};var dl;function Zv(){return dl||(dl=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 h=typeof Ur=="function"&&Ur;if(!d&&h)return h(u,!0);if(a)return a(u,!0);var p=new Error("Cannot find module '"+u+"'");throw p.code="MODULE_NOT_FOUND",p}var f=o[u]={exports:{}};r[u][0].call(f.exports,function(g){var m=r[u][1][g];return i(m||g)},f,f.exports,n,r,o,s)}return o[u].exports}for(var a=typeof Ur=="function"&&Ur,c=0;c<s.length;c++)i(s[c]);return i})({1:[function(n,r,o){var s=n("./utils"),i=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(c){for(var u,d,h,p,f,g,m,x=[],y=0,b=c.length,k=b,S=s.getTypeOf(c)!=="string";y<c.length;)k=b-y,h=S?(u=c[y++],d=y<b?c[y++]:0,y<b?c[y++]:0):(u=c.charCodeAt(y++),d=y<b?c.charCodeAt(y++):0,y<b?c.charCodeAt(y++):0),p=u>>2,f=(3&u)<<4|d>>4,g=1<k?(15&d)<<2|h>>6:64,m=2<k?63&h:64,x.push(a.charAt(p)+a.charAt(f)+a.charAt(g)+a.charAt(m));return x.join("")},o.decode=function(c){var u,d,h,p,f,g,m=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 b,k=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===a.charAt(64)&&k--,c.charAt(c.length-2)===a.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(b=i.uint8array?new Uint8Array(0|k):new Array(0|k);m<c.length;)u=a.indexOf(c.charAt(m++))<<2|(p=a.indexOf(c.charAt(m++)))>>4,d=(15&p)<<4|(f=a.indexOf(c.charAt(m++)))>>2,h=(3&f)<<6|(g=a.indexOf(c.charAt(m++))),b[x++]=u,f!==64&&(b[x++]=d),g!==64&&(b[x++]=h);return b}},{"./support":30,"./utils":32}],2:[function(n,r,o){var s=n("./external"),i=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function u(d,h,p,f,g){this.compressedSize=d,this.uncompressedSize=h,this.crc32=p,this.compression=f,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")),h=this;return d.on("end",function(){if(this.streamInfo.data_length!==h.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,h,p){return d.pipe(new a).pipe(new c("uncompressedSize")).pipe(h.compressWorker(p)).pipe(new c("compressedSize")).withStreamInfo("compression",h)},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 a,c=[],u=0;u<256;u++){a=u;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;c[u]=a}return c})();r.exports=function(a,c){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?(function(u,d,h,p){var f=i,g=p+h;u^=-1;for(var m=p;m<g;m++)u=u>>>8^f[255&(u^d[m])];return-1^u})(0|c,a,a.length,0):(function(u,d,h,p){var f=i,g=p+h;u^=-1;for(var m=p;m<g;m++)u=u>>>8^f[255&(u^d.charCodeAt(m))];return-1^u})(0|c,a,a.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"),a=n("./utils"),c=n("./stream/GenericWorker"),u=s?"uint8array":"array";function d(h,p){c.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=p,this.meta={}}o.magic="\b\0",a.inherits(d,c),d.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,h.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 h=this;this._pako.onData=function(p){h.push({data:p,meta:h.meta})}},o.compressWorker=function(h){return new d("Deflate",h)},o.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){function s(f,g){var m,x="";for(m=0;m<g;m++)x+=String.fromCharCode(255&f),f>>>=8;return x}function i(f,g,m,x,y,b){var k,S,C=f.file,j=f.compression,N=b!==u.utf8encode,T=a.transformTo("string",b(C.name)),A=a.transformTo("string",u.utf8encode(C.name)),O=C.comment,L=a.transformTo("string",b(O)),E=a.transformTo("string",u.utf8encode(O)),M=A.length!==C.name.length,w=E.length!==O.length,D="",H="",B="",q=C.dir,Y=C.date,I={crc32:0,compressedSize:0,uncompressedSize:0};g&&!m||(I.crc32=f.crc32,I.compressedSize=f.compressedSize,I.uncompressedSize=f.uncompressedSize);var W=0;g&&(W|=8),N||!M&&!w||(W|=2048);var V=0,z=0;q&&(V|=16),y==="UNIX"?(z=798,V|=(function(X,de){var te=X;return X||(te=de?16893:33204),(65535&te)<<16})(C.unixPermissions,q)):(z=20,V|=(function(X){return 63&(X||0)})(C.dosPermissions)),k=Y.getUTCHours(),k<<=6,k|=Y.getUTCMinutes(),k<<=5,k|=Y.getUTCSeconds()/2,S=Y.getUTCFullYear()-1980,S<<=4,S|=Y.getUTCMonth()+1,S<<=5,S|=Y.getUTCDate(),M&&(H=s(1,1)+s(d(T),4)+A,D+="up"+s(H.length,2)+H),w&&(B=s(1,1)+s(d(L),4)+E,D+="uc"+s(B.length,2)+B);var oe="";return oe+=`
40
- \0`,oe+=s(W,2),oe+=j.magic,oe+=s(k,2),oe+=s(S,2),oe+=s(I.crc32,4),oe+=s(I.compressedSize,4),oe+=s(I.uncompressedSize,4),oe+=s(T.length,2),oe+=s(D.length,2),{fileRecord:h.LOCAL_FILE_HEADER+oe+T+D,dirRecord:h.CENTRAL_FILE_HEADER+s(z,2)+oe+s(L.length,2)+"\0\0\0\0"+s(V,4)+s(x,4)+T+D+L}}var a=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),h=n("../signature");function p(f,g,m,x){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=m,this.encodeFileName=x,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,c),p.prototype.push=function(f){var g=f.meta.percent||0,m=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,c.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:m?(g+100*(m-x-1))/m:100}}))},p.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var g=this.streamFiles&&!f.file.dir;if(g){var m=i(f,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(f){this.accumulate=!1;var g=this.streamFiles&&!f.file.dir,m=i(f,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),g)this.push({data:(function(x){return h.DATA_DESCRIPTOR+s(x.crc32,4)+s(x.compressedSize,4)+s(x.uncompressedSize,4)})(f),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var f=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var m=this.bytesWritten-f,x=(function(y,b,k,S,C){var j=a.transformTo("string",C(S));return h.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(y,2)+s(y,2)+s(b,4)+s(k,4)+s(j.length,2)+j})(this.dirRecords.length,m,f,this.zipComment,this.encodeFileName);this.push({data:x,meta:{percent:100}})},p.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},p.prototype.registerPrevious=function(f){this._sources.push(f);var g=this;return f.on("data",function(m){g.processChunk(m)}),f.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),f.on("error",function(m){g.error(m)}),this},p.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))},p.prototype.error=function(f){var g=this._sources;if(!c.prototype.error.call(this,f))return!1;for(var m=0;m<g.length;m++)try{g[m].error(f)}catch{}return!0},p.prototype.lock=function(){c.prototype.lock.call(this);for(var f=this._sources,g=0;g<f.length;g++)f[g].lock()},r.exports=p},{"../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(a,c,u){var d=new i(c.streamFiles,u,c.platform,c.encodeFileName),h=0;try{a.forEach(function(p,f){h++;var g=(function(b,k){var S=b||k,C=s[S];if(!C)throw new Error(S+" is not a valid compression method !");return C})(f.options.compression,c.compression),m=f.options.compressionOptions||c.compressionOptions||{},x=f.dir,y=f.date;f._compressWorker(g,m).withStreamInfo("file",{name:p,dir:x,date:y,comment:f.comment||"",unixPermissions:f.unixPermissions,dosPermissions:f.dosPermissions}).pipe(d)}),d.entriesCount=h}catch(p){d.error(p)}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 a in this)typeof this[a]!="function"&&(i[a]=this[a]);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,a){return new s().loadAsync(i,a)},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"),a=n("./utf8"),c=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function h(p){return new i.Promise(function(f,g){var m=p.decompressed.getContentWorker().pipe(new u);m.on("error",function(x){g(x)}).on("end",function(){m.streamInfo.crc32!==p.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):f()}).resume()})}r.exports=function(p,f){var g=this;return f=s.extend(f||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),d.isNode&&d.isStream(p)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",p,!0,f.optimizedBinaryString,f.base64).then(function(m){var x=new c(f);return x.load(m),x}).then(function(m){var x=[i.Promise.resolve(m)],y=m.files;if(f.checkCRC32)for(var b=0;b<y.length;b++)x.push(h(y[b]));return i.Promise.all(x)}).then(function(m){for(var x=m.shift(),y=x.files,b=0;b<y.length;b++){var k=y[b],S=k.fileNameStr,C=s.resolve(k.fileNameStr);g.file(C,k.decompressed,{binary:!0,optimizedBinaryString:!0,date:k.date,dir:k.dir,comment:k.fileCommentStr.length?k.fileCommentStr:null,unixPermissions:k.unixPermissions,dosPermissions:k.dosPermissions,createFolders:f.createFolders}),k.dir||(g.file(C).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 a(c,u){i.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}s.inherits(a,i),a.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()})},a.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){var s=n("readable-stream").Readable;function i(a,c,u){s.call(this,c),this._helper=a;var d=this;a.on("data",function(h,p){d.push(h)||d._helper.pause(),u&&u(p)}).on("error",function(h){d.emit("error",h)}).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(C,j,N){var T,A=a.getTypeOf(j),O=a.extend(N||{},d);O.date=O.date||new Date,O.compression!==null&&(O.compression=O.compression.toUpperCase()),typeof O.unixPermissions=="string"&&(O.unixPermissions=parseInt(O.unixPermissions,8)),O.unixPermissions&&16384&O.unixPermissions&&(O.dir=!0),O.dosPermissions&&16&O.dosPermissions&&(O.dir=!0),O.dir&&(C=y(C)),O.createFolders&&(T=x(C))&&b.call(this,T,!0);var L=A==="string"&&O.binary===!1&&O.base64===!1;N&&N.binary!==void 0||(O.binary=!L),(j instanceof h&&j.uncompressedSize===0||O.dir||!j||j.length===0)&&(O.base64=!1,O.binary=!0,j="",O.compression="STORE",A="string");var E=null;E=j instanceof h||j instanceof c?j:g.isNode&&g.isStream(j)?new m(C,j):a.prepareContent(C,j,O.binary,O.optimizedBinaryString,O.base64);var M=new p(C,E,O);this.files[C]=M}var i=n("./utf8"),a=n("./utils"),c=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),h=n("./compressedObject"),p=n("./zipObject"),f=n("./generate"),g=n("./nodejsUtils"),m=n("./nodejs/NodejsStreamInputAdapter"),x=function(C){C.slice(-1)==="/"&&(C=C.substring(0,C.length-1));var j=C.lastIndexOf("/");return 0<j?C.substring(0,j):""},y=function(C){return C.slice(-1)!=="/"&&(C+="/"),C},b=function(C,j){return j=j!==void 0?j:d.createFolders,C=y(C),this.files[C]||s.call(this,C,null,{dir:!0,createFolders:j}),this.files[C]};function k(C){return Object.prototype.toString.call(C)==="[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(C){var j,N,T;for(j in this.files)T=this.files[j],(N=j.slice(this.root.length,j.length))&&j.slice(0,this.root.length)===this.root&&C(N,T)},filter:function(C){var j=[];return this.forEach(function(N,T){C(N,T)&&j.push(T)}),j},file:function(C,j,N){if(arguments.length!==1)return C=this.root+C,s.call(this,C,j,N),this;if(k(C)){var T=C;return this.filter(function(O,L){return!L.dir&&T.test(O)})}var A=this.files[this.root+C];return A&&!A.dir?A:null},folder:function(C){if(!C)return this;if(k(C))return this.filter(function(A,O){return O.dir&&C.test(A)});var j=this.root+C,N=b.call(this,j),T=this.clone();return T.root=N.name,T},remove:function(C){C=this.root+C;var j=this.files[C];if(j||(C.slice(-1)!=="/"&&(C+="/"),j=this.files[C]),j&&!j.dir)delete this.files[C];else for(var N=this.filter(function(A,O){return O.name.slice(0,C.length)===C}),T=0;T<N.length;T++)delete this.files[N[T].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(C){var j,N={};try{if((N=a.extend(C||{},{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.");a.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 T=N.comment||this.comment||"";j=f.generateWorker(this,N,T)}catch(A){(j=new c("error")).error(A)}return new u(j,N.type||"string",N.mimeType)},generateAsync:function(C,j){return this.generateInternalStream(C).accumulate(j)},generateNodeStream:function(C,j){return(C=C||{}).type||(C.type="nodebuffer"),this.generateInternalStream(C).toNodejsStream(j)}};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(a){s.call(this,a);for(var c=0;c<this.data.length;c++)a[c]=255&a[c]}n("../utils").inherits(i,s),i.prototype.byteAt=function(a){return this.data[this.zero+a]},i.prototype.lastIndexOfSignature=function(a){for(var c=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),h=a.charCodeAt(3),p=this.length-4;0<=p;--p)if(this.data[p]===c&&this.data[p+1]===u&&this.data[p+2]===d&&this.data[p+3]===h)return p-this.zero;return-1},i.prototype.readAndCheckSignature=function(a){var c=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),h=a.charCodeAt(3),p=this.readData(4);return c===p[0]&&u===p[1]&&d===p[2]&&h===p[3]},i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){var s=n("../utils");function i(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var c,u=0;for(this.checkOffset(a),c=this.index+a-1;c>=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=a,u},readString:function(a){return s.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=i},{"../utils":32}],19:[function(n,r,o){var s=n("./Uint8ArrayReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){var s=n("./DataReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},i.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},i.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){var s=n("./ArrayReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){var s=n("../utils"),i=n("../support"),a=n("./ArrayReader"),c=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(h){var p=s.getTypeOf(h);return s.checkSupport(p),p!=="string"||i.uint8array?p==="nodebuffer"?new u(h):i.uint8array?new d(s.transformTo("uint8array",h)):new a(s.transformTo("array",h)):new c(h)}},{"../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 a(c){s.call(this,"ConvertWorker to "+c),this.destType=c}i.inherits(a,s),a.prototype.processChunk=function(c){this.push({data:i.transformTo(this.destType,c.data),meta:c.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){var s=n("./GenericWorker"),i=n("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,s),a.prototype.processChunk=function(c){this.streamInfo.crc32=i(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function a(c){i.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}s.inherits(a,i),a.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=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function a(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(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.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=a},{"../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,a){return this._listeners[i].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,a){if(this._listeners[i])for(var c=0;c<this._listeners[i].length;c++)this._listeners[i][c].call(this,a)},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 a=this;return i.on("data",function(c){a.processChunk(c)}),i.on("end",function(){a.end()}),i.on("error",function(c){a.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,a){return this.extraStreamInfo[i]=a,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"),a=n("./GenericWorker"),c=n("../base64"),u=n("../support"),d=n("../external"),h=null;if(u.nodestream)try{h=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(g,m){return new d.Promise(function(x,y){var b=[],k=g._internalType,S=g._outputType,C=g._mimeType;g.on("data",function(j,N){b.push(j),m&&m(N)}).on("error",function(j){b=[],y(j)}).on("end",function(){try{var j=(function(N,T,A){switch(N){case"blob":return s.newBlob(s.transformTo("arraybuffer",T),A);case"base64":return c.encode(T);default:return s.transformTo(N,T)}})(S,(function(N,T){var A,O=0,L=null,E=0;for(A=0;A<T.length;A++)E+=T[A].length;switch(N){case"string":return T.join("");case"array":return Array.prototype.concat.apply([],T);case"uint8array":for(L=new Uint8Array(E),A=0;A<T.length;A++)L.set(T[A],O),O+=T[A].length;return L;case"nodebuffer":return Buffer.concat(T);default:throw new Error("concat : unsupported type '"+N+"'")}})(k,b),C);x(j)}catch(N){y(N)}b=[]}).resume()})}function f(g,m,x){var y=m;switch(m){case"blob":case"arraybuffer":y="uint8array";break;case"base64":y="string"}try{this._internalType=y,this._outputType=m,this._mimeType=x,s.checkSupport(y),this._worker=g.pipe(new i(y)),g.lock()}catch(b){this._worker=new a("error"),this._worker.error(b)}}f.prototype={accumulate:function(g){return p(this,g)},on:function(g,m){var x=this;return g==="data"?this._worker.on(g,function(y){m.call(x,y.data,y.meta)}):this._worker.on(g,function(){s.delay(m,arguments,x)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(g){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new h(this,{objectMode:this._outputType!=="nodebuffer"},g)}},r.exports=f},{"../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"),a=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 h(){c.call(this,"utf-8 decode"),this.leftOver=null}function p(){c.call(this,"utf-8 encode")}o.utf8encode=function(f){return i.nodebuffer?a.newBufferFrom(f,"utf-8"):(function(g){var m,x,y,b,k,S=g.length,C=0;for(b=0;b<S;b++)(64512&(x=g.charCodeAt(b)))==55296&&b+1<S&&(64512&(y=g.charCodeAt(b+1)))==56320&&(x=65536+(x-55296<<10)+(y-56320),b++),C+=x<128?1:x<2048?2:x<65536?3:4;for(m=i.uint8array?new Uint8Array(C):new Array(C),b=k=0;k<C;b++)(64512&(x=g.charCodeAt(b)))==55296&&b+1<S&&(64512&(y=g.charCodeAt(b+1)))==56320&&(x=65536+(x-55296<<10)+(y-56320),b++),x<128?m[k++]=x:(x<2048?m[k++]=192|x>>>6:(x<65536?m[k++]=224|x>>>12:(m[k++]=240|x>>>18,m[k++]=128|x>>>12&63),m[k++]=128|x>>>6&63),m[k++]=128|63&x);return m})(f)},o.utf8decode=function(f){return i.nodebuffer?s.transformTo("nodebuffer",f).toString("utf-8"):(function(g){var m,x,y,b,k=g.length,S=new Array(2*k);for(m=x=0;m<k;)if((y=g[m++])<128)S[x++]=y;else if(4<(b=u[y]))S[x++]=65533,m+=b-1;else{for(y&=b===2?31:b===3?15:7;1<b&&m<k;)y=y<<6|63&g[m++],b--;1<b?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)})(f=s.transformTo(i.uint8array?"uint8array":"array",f))},s.inherits(h,c),h.prototype.processChunk=function(f){var g=s.transformTo(i.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var m=g;(g=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),g.set(m,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var x=(function(b,k){var S;for((k=k||b.length)>b.length&&(k=b.length),S=k-1;0<=S&&(192&b[S])==128;)S--;return S<0||S===0?k:S+u[b[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:f.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=h,s.inherits(p,c),p.prototype.processChunk=function(f){this.push({data:o.utf8encode(f.data),meta:f.meta})},o.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){var s=n("./support"),i=n("./base64"),a=n("./nodejsUtils"),c=n("./external");function u(m){return m}function d(m,x){for(var y=0;y<m.length;++y)x[y]=255&m.charCodeAt(y);return x}n("setimmediate"),o.newBlob=function(m,x){o.checkSupport("blob");try{return new Blob([m],{type:x})}catch{try{var y=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return y.append(m),y.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var h={stringifyByChunk:function(m,x,y){var b=[],k=0,S=m.length;if(S<=y)return String.fromCharCode.apply(null,m);for(;k<S;)x==="array"||x==="nodebuffer"?b.push(String.fromCharCode.apply(null,m.slice(k,Math.min(k+y,S)))):b.push(String.fromCharCode.apply(null,m.subarray(k,Math.min(k+y,S)))),k+=y;return b.join("")},stringifyByChar:function(m){for(var x="",y=0;y<m.length;y++)x+=String.fromCharCode(m[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,a.allocBuffer(1)).length===1}catch{return!1}})()}};function p(m){var x=65536,y=o.getTypeOf(m),b=!0;if(y==="uint8array"?b=h.applyCanBeUsed.uint8array:y==="nodebuffer"&&(b=h.applyCanBeUsed.nodebuffer),b)for(;1<x;)try{return h.stringifyByChunk(m,y,x)}catch{x=Math.floor(x/2)}return h.stringifyByChar(m)}function f(m,x){for(var y=0;y<m.length;y++)x[y]=m[y];return x}o.applyFromCharCode=p;var g={};g.string={string:u,array:function(m){return d(m,new Array(m.length))},arraybuffer:function(m){return g.string.uint8array(m).buffer},uint8array:function(m){return d(m,new Uint8Array(m.length))},nodebuffer:function(m){return d(m,a.allocBuffer(m.length))}},g.array={string:p,array:u,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(m)}},g.arraybuffer={string:function(m){return p(new Uint8Array(m))},array:function(m){return f(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:u,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(new Uint8Array(m))}},g.uint8array={string:p,array:function(m){return f(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:u,nodebuffer:function(m){return a.newBufferFrom(m)}},g.nodebuffer={string:p,array:function(m){return f(m,new Array(m.length))},arraybuffer:function(m){return g.nodebuffer.uint8array(m).buffer},uint8array:function(m){return f(m,new Uint8Array(m.length))},nodebuffer:u},o.transformTo=function(m,x){if(x=x||"",!m)return x;o.checkSupport(m);var y=o.getTypeOf(x);return g[y][m](x)},o.resolve=function(m){for(var x=m.split("/"),y=[],b=0;b<x.length;b++){var k=x[b];k==="."||k===""&&b!==0&&b!==x.length-1||(k===".."?y.pop():y.push(k))}return y.join("/")},o.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":s.nodebuffer&&a.isBuffer(m)?"nodebuffer":s.uint8array&&m instanceof Uint8Array?"uint8array":s.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(m){if(!s[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(m){var x,y,b="";for(y=0;y<(m||"").length;y++)b+="\\x"+((x=m.charCodeAt(y))<16?"0":"")+x.toString(16).toUpperCase();return b},o.delay=function(m,x,y){setImmediate(function(){m.apply(y||null,x||[])})},o.inherits=function(m,x){function y(){}y.prototype=x.prototype,m.prototype=new y},o.extend=function(){var m,x,y={};for(m=0;m<arguments.length;m++)for(x in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],x)&&y[x]===void 0&&(y[x]=arguments[m][x]);return y},o.prepareContent=function(m,x,y,b,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(C,j){var N=new FileReader;N.onload=function(T){C(T.target.result)},N.onerror=function(T){j(T.target.error)},N.readAsArrayBuffer(S)}):S}).then(function(S){var C=o.getTypeOf(S);return C?(C==="arraybuffer"?S=o.transformTo("uint8array",S):C==="string"&&(k?S=i.decode(S):y&&b!==!0&&(S=(function(j){return d(j,s.uint8array?new Uint8Array(j.length):new Array(j.length))})(S))),S):c.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){var s=n("./reader/readerFor"),i=n("./utils"),a=n("./signature"),c=n("./zipEntry"),u=n("./support");function d(h){this.files=[],this.loadOptions=h}d.prototype={checkSignature:function(h){if(!this.reader.readAndCheckSignature(h)){this.reader.index-=4;var p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(p)+", expected "+i.pretty(h)+")")}},isSignature:function(h,p){var f=this.reader.index;this.reader.setIndex(h);var g=this.reader.readString(4)===p;return this.reader.setIndex(f),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 h=this.reader.readData(this.zipCommentLength),p=u.uint8array?"uint8array":"array",f=i.transformTo(p,h);this.zipComment=this.loadOptions.decodeFileName(f)},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 h,p,f,g=this.zip64EndOfCentralSize-44;0<g;)h=this.reader.readInt(2),p=this.reader.readInt(4),f=this.reader.readData(p),this.zip64ExtensibleData[h]={id:h,length:p,value:f}},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 h,p;for(h=0;h<this.files.length;h++)p=this.files[h],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var h;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(h=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(h);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 h=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(h<0)throw this.isSignature(0,a.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(h);var p=h;if(this.checkSignature(a.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,(h=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(h),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.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(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var f=this.centralDirOffset+this.centralDirSize;this.zip64&&(f+=20,f+=12+this.zip64EndOfCentralSize);var g=p-f;if(0<g)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=g);else if(g<0)throw new Error("Corrupted zip: missing "+Math.abs(g)+" bytes.")},prepareReader:function(h){this.reader=s(h)},load:function(h){this.prepareReader(h),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"),a=n("./compressedObject"),c=n("./crc32"),u=n("./utf8"),d=n("./compressions"),h=n("./support");function p(f,g){this.options=f,this.loadOptions=g}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(f){var g,m;if(f.skip(22),this.fileNameLength=f.readInt(2),m=f.readInt(2),this.fileName=f.readData(this.fileNameLength),f.skip(m),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((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 a(this.compressedSize,this.uncompressedSize,this.crc32,g,f.readData(this.compressedSize))},readCentralPart:function(f){this.versionMadeBy=f.readInt(2),f.skip(2),this.bitFlag=f.readInt(2),this.compressionMethod=f.readString(2),this.date=f.readDate(),this.crc32=f.readInt(4),this.compressedSize=f.readInt(4),this.uncompressedSize=f.readInt(4);var g=f.readInt(2);if(this.extraFieldsLength=f.readInt(2),this.fileCommentLength=f.readInt(2),this.diskNumberStart=f.readInt(2),this.internalFileAttributes=f.readInt(2),this.externalFileAttributes=f.readInt(4),this.localHeaderOffset=f.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");f.skip(g),this.readExtraFields(f),this.parseZIP64ExtraField(f),this.fileComment=f.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var f=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=s(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var g,m,x,y=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4<y;)g=f.readInt(2),m=f.readInt(2),x=f.readData(m),this.extraFields[g]={id:g,length:m,value:x};f.setIndex(y)},handleUTF8:function(){var f=h.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 m=i.transformTo(f,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var y=i.transformTo(f,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(y)}}},findExtraFieldUnicodePath:function(){var f=this.extraFields[28789];if(f){var g=s(f.value);return g.readInt(1)!==1||c(this.fileName)!==g.readInt(4)?null:u.utf8decode(g.readData(f.length-5))}return null},findExtraFieldUnicodeComment:function(){var f=this.extraFields[25461];if(f){var g=s(f.value);return g.readInt(1)!==1||c(this.fileComment)!==g.readInt(4)?null:u.utf8decode(g.readData(f.length-5))}return null}},r.exports=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){function s(g,m,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=m,this._dataBinary=x.binary,this.options={compression:x.compression,compressionOptions:x.compressionOptions}}var i=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),c=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");s.prototype={internalStream:function(g){var m=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"),m=this._decompressWorker();var b=!this._dataBinary;b&&!y&&(m=m.pipe(new c.Utf8EncodeWorker)),!b&&y&&(m=m.pipe(new c.Utf8DecodeWorker))}catch(k){(m=new d("error")).error(k)}return new i(m,x,"")},async:function(g,m){return this.internalStream(g).accumulate(m)},nodeStream:function(g,m){return this.internalStream(g||"nodebuffer").toNodejsStream(m)},_compressWorker:function(g,m){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,m)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new a(this._data)}};for(var h=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},f=0;f<h.length;f++)s.prototype[h[f]]=p;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,a,c=s.MutationObserver||s.WebKitMutationObserver;if(c){var u=0,d=new c(g),h=s.document.createTextNode("");d.observe(h,{characterData:!0}),i=function(){h.data=u=++u%2}}else if(s.setImmediate||s.MessageChannel===void 0)i="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var m=s.document.createElement("script");m.onreadystatechange=function(){g(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},s.document.documentElement.appendChild(m)}:function(){setTimeout(g,0)};else{var p=new s.MessageChannel;p.port1.onmessage=g,i=function(){p.port2.postMessage(0)}}var f=[];function g(){var m,x;a=!0;for(var y=f.length;y;){for(x=f,f=[],m=-1;++m<y;)x[m]();y=f.length}a=!1}r.exports=function(m){f.push(m)!==1||a||i()}}).call(this,typeof Lr<"u"?Lr:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){var s=n("immediate");function i(){}var a={},c=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function h(y){if(typeof y!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,y!==i&&m(this,y)}function p(y,b,k){this.promise=y,typeof b=="function"&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function f(y,b,k){s(function(){var S;try{S=b(k)}catch(C){return a.reject(y,C)}S===y?a.reject(y,new TypeError("Cannot resolve promise with itself")):a.resolve(y,S)})}function g(y){var b=y&&y.then;if(y&&(typeof y=="object"||typeof y=="function")&&typeof b=="function")return function(){b.apply(y,arguments)}}function m(y,b){var k=!1;function S(N){k||(k=!0,a.reject(y,N))}function C(N){k||(k=!0,a.resolve(y,N))}var j=x(function(){b(C,S)});j.status==="error"&&S(j.value)}function x(y,b){var k={};try{k.value=y(b),k.status="success"}catch(S){k.status="error",k.value=S}return k}(r.exports=h).prototype.finally=function(y){if(typeof y!="function")return this;var b=this.constructor;return this.then(function(k){return b.resolve(y()).then(function(){return k})},function(k){return b.resolve(y()).then(function(){throw k})})},h.prototype.catch=function(y){return this.then(null,y)},h.prototype.then=function(y,b){if(typeof y!="function"&&this.state===u||typeof b!="function"&&this.state===c)return this;var k=new this.constructor(i);return this.state!==d?f(k,this.state===u?y:b,this.outcome):this.queue.push(new p(k,y,b)),k},p.prototype.callFulfilled=function(y){a.resolve(this.promise,y)},p.prototype.otherCallFulfilled=function(y){f(this.promise,this.onFulfilled,y)},p.prototype.callRejected=function(y){a.reject(this.promise,y)},p.prototype.otherCallRejected=function(y){f(this.promise,this.onRejected,y)},a.resolve=function(y,b){var k=x(g,b);if(k.status==="error")return a.reject(y,k.value);var S=k.value;if(S)m(y,S);else{y.state=u,y.outcome=b;for(var C=-1,j=y.queue.length;++C<j;)y.queue[C].callFulfilled(b)}return y},a.reject=function(y,b){y.state=c,y.outcome=b;for(var k=-1,S=y.queue.length;++k<S;)y.queue[k].callRejected(b);return y},h.resolve=function(y){return y instanceof this?y:a.resolve(new this(i),y)},h.reject=function(y){var b=new this(i);return a.reject(b,y)},h.all=function(y){var b=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 C=new Array(k),j=0,N=-1,T=new this(i);++N<k;)A(y[N],N);return T;function A(O,L){b.resolve(O).then(function(E){C[L]=E,++j!==k||S||(S=!0,a.resolve(T,C))},function(E){S||(S=!0,a.reject(T,E))})}},h.race=function(y){var b=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 C=-1,j=new this(i);++C<k;)N=y[C],b.resolve(N).then(function(T){S||(S=!0,a.resolve(j,T))},function(T){S||(S=!0,a.reject(j,T))});var N;return j}},{immediate:36}],38:[function(n,r,o){var s={};(0,n("./lib/utils/common").assign)(s,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){var s=n("./zlib/deflate"),i=n("./utils/common"),a=n("./utils/strings"),c=n("./zlib/messages"),u=n("./zlib/zstream"),d=Object.prototype.toString,h=0,p=-1,f=0,g=8;function m(y){if(!(this instanceof m))return new m(y);this.options=i.assign({level:p,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:f,to:""},y||{});var b=this.options;b.raw&&0<b.windowBits?b.windowBits=-b.windowBits:b.gzip&&0<b.windowBits&&b.windowBits<16&&(b.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,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(k!==h)throw new Error(c[k]);if(b.header&&s.deflateSetHeader(this.strm,b.header),b.dictionary){var S;if(S=typeof b.dictionary=="string"?a.string2buf(b.dictionary):d.call(b.dictionary)==="[object ArrayBuffer]"?new Uint8Array(b.dictionary):b.dictionary,(k=s.deflateSetDictionary(this.strm,S))!==h)throw new Error(c[k]);this._dict_set=!0}}function x(y,b){var k=new m(b);if(k.push(y,!0),k.err)throw k.msg||c[k.err];return k.result}m.prototype.push=function(y,b){var k,S,C=this.strm,j=this.options.chunkSize;if(this.ended)return!1;S=b===~~b?b:b===!0?4:0,typeof y=="string"?C.input=a.string2buf(y):d.call(y)==="[object ArrayBuffer]"?C.input=new Uint8Array(y):C.input=y,C.next_in=0,C.avail_in=C.input.length;do{if(C.avail_out===0&&(C.output=new i.Buf8(j),C.next_out=0,C.avail_out=j),(k=s.deflate(C,S))!==1&&k!==h)return this.onEnd(k),!(this.ended=!0);C.avail_out!==0&&(C.avail_in!==0||S!==4&&S!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(i.shrinkBuf(C.output,C.next_out))):this.onData(i.shrinkBuf(C.output,C.next_out)))}while((0<C.avail_in||C.avail_out===0)&&k!==1);return S===4?(k=s.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===h):S!==2||(this.onEnd(h),!(C.avail_out=0))},m.prototype.onData=function(y){this.chunks.push(y)},m.prototype.onEnd=function(y){y===h&&(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=m,o.deflate=x,o.deflateRaw=function(y,b){return(b=b||{}).raw=!0,x(y,b)},o.gzip=function(y,b){return(b=b||{}).gzip=!0,x(y,b)}},{"./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"),a=n("./utils/strings"),c=n("./zlib/constants"),u=n("./zlib/messages"),d=n("./zlib/zstream"),h=n("./zlib/gzheader"),p=Object.prototype.toString;function f(m){if(!(this instanceof f))return new f(m);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},m||{});var x=this.options;x.raw&&0<=x.windowBits&&x.windowBits<16&&(x.windowBits=-x.windowBits,x.windowBits===0&&(x.windowBits=-15)),!(0<=x.windowBits&&x.windowBits<16)||m&&m.windowBits||(x.windowBits+=32),15<x.windowBits&&x.windowBits<48&&(15&x.windowBits)==0&&(x.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var y=s.inflateInit2(this.strm,x.windowBits);if(y!==c.Z_OK)throw new Error(u[y]);this.header=new h,s.inflateGetHeader(this.strm,this.header)}function g(m,x){var y=new f(x);if(y.push(m,!0),y.err)throw y.msg||u[y.err];return y.result}f.prototype.push=function(m,x){var y,b,k,S,C,j,N=this.strm,T=this.options.chunkSize,A=this.options.dictionary,O=!1;if(this.ended)return!1;b=x===~~x?x:x===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof m=="string"?N.input=a.binstring2buf(m):p.call(m)==="[object ArrayBuffer]"?N.input=new Uint8Array(m):N.input=m,N.next_in=0,N.avail_in=N.input.length;do{if(N.avail_out===0&&(N.output=new i.Buf8(T),N.next_out=0,N.avail_out=T),(y=s.inflate(N,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&A&&(j=typeof A=="string"?a.string2buf(A):p.call(A)==="[object ArrayBuffer]"?new Uint8Array(A):A,y=s.inflateSetDictionary(this.strm,j)),y===c.Z_BUF_ERROR&&O===!0&&(y=c.Z_OK,O=!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||b!==c.Z_FINISH&&b!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=a.utf8border(N.output,N.next_out),S=N.next_out-k,C=a.buf2string(N.output,k),N.next_out=S,N.avail_out=T-S,S&&i.arraySet(N.output,N.output,k,S,0),this.onData(C)):this.onData(i.shrinkBuf(N.output,N.next_out)))),N.avail_in===0&&N.avail_out===0&&(O=!0)}while((0<N.avail_in||N.avail_out===0)&&y!==c.Z_STREAM_END);return y===c.Z_STREAM_END&&(b=c.Z_FINISH),b===c.Z_FINISH?(y=s.inflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===c.Z_OK):b!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(N.avail_out=0))},f.prototype.onData=function(m){this.chunks.push(m)},f.prototype.onEnd=function(m){m===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},o.Inflate=f,o.inflate=g,o.inflateRaw=function(m,x){return(x=x||{}).raw=!0,g(m,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 h in d)d.hasOwnProperty(h)&&(c[h]=d[h])}}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,h,p){if(u.subarray&&c.subarray)c.set(u.subarray(d,d+h),p);else for(var f=0;f<h;f++)c[p+f]=u[d+f]},flattenChunks:function(c){var u,d,h,p,f,g;for(u=h=0,d=c.length;u<d;u++)h+=c[u].length;for(g=new Uint8Array(h),u=p=0,d=c.length;u<d;u++)f=c[u],g.set(f,p),p+=f.length;return g}},a={arraySet:function(c,u,d,h,p){for(var f=0;f<h;f++)c[p+f]=u[d+f]},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,a))},o.setTyped(s)},{}],42:[function(n,r,o){var s=n("./common"),i=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!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(h,p){if(p<65537&&(h.subarray&&a||!h.subarray&&i))return String.fromCharCode.apply(null,s.shrinkBuf(h,p));for(var f="",g=0;g<p;g++)f+=String.fromCharCode(h[g]);return f}c[254]=c[254]=1,o.string2buf=function(h){var p,f,g,m,x,y=h.length,b=0;for(m=0;m<y;m++)(64512&(f=h.charCodeAt(m)))==55296&&m+1<y&&(64512&(g=h.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(g-56320),m++),b+=f<128?1:f<2048?2:f<65536?3:4;for(p=new s.Buf8(b),m=x=0;x<b;m++)(64512&(f=h.charCodeAt(m)))==55296&&m+1<y&&(64512&(g=h.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(g-56320),m++),f<128?p[x++]=f:(f<2048?p[x++]=192|f>>>6:(f<65536?p[x++]=224|f>>>12:(p[x++]=240|f>>>18,p[x++]=128|f>>>12&63),p[x++]=128|f>>>6&63),p[x++]=128|63&f);return p},o.buf2binstring=function(h){return d(h,h.length)},o.binstring2buf=function(h){for(var p=new s.Buf8(h.length),f=0,g=p.length;f<g;f++)p[f]=h.charCodeAt(f);return p},o.buf2string=function(h,p){var f,g,m,x,y=p||h.length,b=new Array(2*y);for(f=g=0;f<y;)if((m=h[f++])<128)b[g++]=m;else if(4<(x=c[m]))b[g++]=65533,f+=x-1;else{for(m&=x===2?31:x===3?15:7;1<x&&f<y;)m=m<<6|63&h[f++],x--;1<x?b[g++]=65533:m<65536?b[g++]=m:(m-=65536,b[g++]=55296|m>>10&1023,b[g++]=56320|1023&m)}return d(b,g)},o.utf8border=function(h,p){var f;for((p=p||h.length)>h.length&&(p=h.length),f=p-1;0<=f&&(192&h[f])==128;)f--;return f<0||f===0?p:f+c[h[f]]>p?f:p}},{"./common":41}],43:[function(n,r,o){r.exports=function(s,i,a,c){for(var u=65535&s|0,d=s>>>16&65535|0,h=0;a!==0;){for(a-=h=2e3<a?2e3:a;d=d+(u=u+i[c++]|0)|0,--h;);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,a=[],c=0;c<256;c++){i=c;for(var u=0;u<8;u++)i=1&i?3988292384^i>>>1:i>>>1;a[c]=i}return a})();r.exports=function(i,a,c,u){var d=s,h=u+c;i^=-1;for(var p=u;p<h;p++)i=i>>>8^d[255&(i^a[p])];return-1^i}},{}],46:[function(n,r,o){var s,i=n("../utils/common"),a=n("./trees"),c=n("./adler32"),u=n("./crc32"),d=n("./messages"),h=0,p=4,f=0,g=-2,m=-1,x=4,y=2,b=8,k=9,S=286,C=30,j=19,N=2*S+1,T=15,A=3,O=258,L=O+A+1,E=42,M=113,w=1,D=2,H=3,B=4;function q(_,ee){return _.msg=d[ee],ee}function Y(_){return(_<<1)-(4<_?9:0)}function I(_){for(var ee=_.length;0<=--ee;)_[ee]=0}function W(_){var ee=_.state,G=ee.pending;G>_.avail_out&&(G=_.avail_out),G!==0&&(i.arraySet(_.output,ee.pending_buf,ee.pending_out,G,_.next_out),_.next_out+=G,ee.pending_out+=G,_.total_out+=G,_.avail_out-=G,ee.pending-=G,ee.pending===0&&(ee.pending_out=0))}function V(_,ee){a._tr_flush_block(_,0<=_.block_start?_.block_start:-1,_.strstart-_.block_start,ee),_.block_start=_.strstart,W(_.strm)}function z(_,ee){_.pending_buf[_.pending++]=ee}function oe(_,ee){_.pending_buf[_.pending++]=ee>>>8&255,_.pending_buf[_.pending++]=255&ee}function X(_,ee){var G,P,R=_.max_chain_length,F=_.strstart,U=_.prev_length,J=_.nice_match,$=_.strstart>_.w_size-L?_.strstart-(_.w_size-L):0,ne=_.window,le=_.w_mask,se=_.prev,Z=_.strstart+O,re=ne[F+U-1],ue=ne[F+U];_.prev_length>=_.good_match&&(R>>=2),J>_.lookahead&&(J=_.lookahead);do if(ne[(G=ee)+U]===ue&&ne[G+U-1]===re&&ne[G]===ne[F]&&ne[++G]===ne[F+1]){F+=2,G++;do;while(ne[++F]===ne[++G]&&ne[++F]===ne[++G]&&ne[++F]===ne[++G]&&ne[++F]===ne[++G]&&ne[++F]===ne[++G]&&ne[++F]===ne[++G]&&ne[++F]===ne[++G]&&ne[++F]===ne[++G]&&F<Z);if(P=O-(Z-F),F=Z-O,U<P){if(_.match_start=ee,J<=(U=P))break;re=ne[F+U-1],ue=ne[F+U]}}while((ee=se[ee&le])>$&&--R!=0);return U<=_.lookahead?U:_.lookahead}function de(_){var ee,G,P,R,F,U,J,$,ne,le,se=_.w_size;do{if(R=_.window_size-_.lookahead-_.strstart,_.strstart>=se+(se-L)){for(i.arraySet(_.window,_.window,se,se,0),_.match_start-=se,_.strstart-=se,_.block_start-=se,ee=G=_.hash_size;P=_.head[--ee],_.head[ee]=se<=P?P-se:0,--G;);for(ee=G=se;P=_.prev[--ee],_.prev[ee]=se<=P?P-se:0,--G;);R+=se}if(_.strm.avail_in===0)break;if(U=_.strm,J=_.window,$=_.strstart+_.lookahead,ne=R,le=void 0,le=U.avail_in,ne<le&&(le=ne),G=le===0?0:(U.avail_in-=le,i.arraySet(J,U.input,U.next_in,le,$),U.state.wrap===1?U.adler=c(U.adler,J,le,$):U.state.wrap===2&&(U.adler=u(U.adler,J,le,$)),U.next_in+=le,U.total_in+=le,le),_.lookahead+=G,_.lookahead+_.insert>=A)for(F=_.strstart-_.insert,_.ins_h=_.window[F],_.ins_h=(_.ins_h<<_.hash_shift^_.window[F+1])&_.hash_mask;_.insert&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[F+A-1])&_.hash_mask,_.prev[F&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=F,F++,_.insert--,!(_.lookahead+_.insert<A)););}while(_.lookahead<L&&_.strm.avail_in!==0)}function te(_,ee){for(var G,P;;){if(_.lookahead<L){if(de(_),_.lookahead<L&&ee===h)return w;if(_.lookahead===0)break}if(G=0,_.lookahead>=A&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+A-1])&_.hash_mask,G=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),G!==0&&_.strstart-G<=_.w_size-L&&(_.match_length=X(_,G)),_.match_length>=A)if(P=a._tr_tally(_,_.strstart-_.match_start,_.match_length-A),_.lookahead-=_.match_length,_.match_length<=_.max_lazy_match&&_.lookahead>=A){for(_.match_length--;_.strstart++,_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+A-1])&_.hash_mask,G=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart,--_.match_length!=0;);_.strstart++}else _.strstart+=_.match_length,_.match_length=0,_.ins_h=_.window[_.strstart],_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+1])&_.hash_mask;else P=a._tr_tally(_,0,_.window[_.strstart]),_.lookahead--,_.strstart++;if(P&&(V(_,!1),_.strm.avail_out===0))return w}return _.insert=_.strstart<A-1?_.strstart:A-1,ee===p?(V(_,!0),_.strm.avail_out===0?H:B):_.last_lit&&(V(_,!1),_.strm.avail_out===0)?w:D}function ce(_,ee){for(var G,P,R;;){if(_.lookahead<L){if(de(_),_.lookahead<L&&ee===h)return w;if(_.lookahead===0)break}if(G=0,_.lookahead>=A&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+A-1])&_.hash_mask,G=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),_.prev_length=_.match_length,_.prev_match=_.match_start,_.match_length=A-1,G!==0&&_.prev_length<_.max_lazy_match&&_.strstart-G<=_.w_size-L&&(_.match_length=X(_,G),_.match_length<=5&&(_.strategy===1||_.match_length===A&&4096<_.strstart-_.match_start)&&(_.match_length=A-1)),_.prev_length>=A&&_.match_length<=_.prev_length){for(R=_.strstart+_.lookahead-A,P=a._tr_tally(_,_.strstart-1-_.prev_match,_.prev_length-A),_.lookahead-=_.prev_length-1,_.prev_length-=2;++_.strstart<=R&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+A-1])&_.hash_mask,G=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),--_.prev_length!=0;);if(_.match_available=0,_.match_length=A-1,_.strstart++,P&&(V(_,!1),_.strm.avail_out===0))return w}else if(_.match_available){if((P=a._tr_tally(_,0,_.window[_.strstart-1]))&&V(_,!1),_.strstart++,_.lookahead--,_.strm.avail_out===0)return w}else _.match_available=1,_.strstart++,_.lookahead--}return _.match_available&&(P=a._tr_tally(_,0,_.window[_.strstart-1]),_.match_available=0),_.insert=_.strstart<A-1?_.strstart:A-1,ee===p?(V(_,!0),_.strm.avail_out===0?H:B):_.last_lit&&(V(_,!1),_.strm.avail_out===0)?w:D}function fe(_,ee,G,P,R){this.good_length=_,this.max_lazy=ee,this.nice_length=G,this.max_chain=P,this.func=R}function ge(){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=b,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*C+1)),this.bl_tree=new i.Buf16(2*(2*j+1)),I(this.dyn_ltree),I(this.dyn_dtree),I(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(T+1),this.heap=new i.Buf16(2*S+1),I(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*S+1),I(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function xe(_){var ee;return _&&_.state?(_.total_in=_.total_out=0,_.data_type=y,(ee=_.state).pending=0,ee.pending_out=0,ee.wrap<0&&(ee.wrap=-ee.wrap),ee.status=ee.wrap?E:M,_.adler=ee.wrap===2?0:1,ee.last_flush=h,a._tr_init(ee),f):q(_,g)}function Ee(_){var ee=xe(_);return ee===f&&(function(G){G.window_size=2*G.w_size,I(G.head),G.max_lazy_match=s[G.level].max_lazy,G.good_match=s[G.level].good_length,G.nice_match=s[G.level].nice_length,G.max_chain_length=s[G.level].max_chain,G.strstart=0,G.block_start=0,G.lookahead=0,G.insert=0,G.match_length=G.prev_length=A-1,G.match_available=0,G.ins_h=0})(_.state),ee}function Oe(_,ee,G,P,R,F){if(!_)return g;var U=1;if(ee===m&&(ee=6),P<0?(U=0,P=-P):15<P&&(U=2,P-=16),R<1||k<R||G!==b||P<8||15<P||ee<0||9<ee||F<0||x<F)return q(_,g);P===8&&(P=9);var J=new ge;return(_.state=J).strm=_,J.wrap=U,J.gzhead=null,J.w_bits=P,J.w_size=1<<J.w_bits,J.w_mask=J.w_size-1,J.hash_bits=R+7,J.hash_size=1<<J.hash_bits,J.hash_mask=J.hash_size-1,J.hash_shift=~~((J.hash_bits+A-1)/A),J.window=new i.Buf8(2*J.w_size),J.head=new i.Buf16(J.hash_size),J.prev=new i.Buf16(J.w_size),J.lit_bufsize=1<<R+6,J.pending_buf_size=4*J.lit_bufsize,J.pending_buf=new i.Buf8(J.pending_buf_size),J.d_buf=1*J.lit_bufsize,J.l_buf=3*J.lit_bufsize,J.level=ee,J.strategy=F,J.method=G,Ee(_)}s=[new fe(0,0,0,0,function(_,ee){var G=65535;for(G>_.pending_buf_size-5&&(G=_.pending_buf_size-5);;){if(_.lookahead<=1){if(de(_),_.lookahead===0&&ee===h)return w;if(_.lookahead===0)break}_.strstart+=_.lookahead,_.lookahead=0;var P=_.block_start+G;if((_.strstart===0||_.strstart>=P)&&(_.lookahead=_.strstart-P,_.strstart=P,V(_,!1),_.strm.avail_out===0)||_.strstart-_.block_start>=_.w_size-L&&(V(_,!1),_.strm.avail_out===0))return w}return _.insert=0,ee===p?(V(_,!0),_.strm.avail_out===0?H:B):(_.strstart>_.block_start&&(V(_,!1),_.strm.avail_out),w)}),new fe(4,4,8,4,te),new fe(4,5,16,8,te),new fe(4,6,32,32,te),new fe(4,4,16,16,ce),new fe(8,16,32,32,ce),new fe(8,16,128,128,ce),new fe(8,32,128,256,ce),new fe(32,128,258,1024,ce),new fe(32,258,258,4096,ce)],o.deflateInit=function(_,ee){return Oe(_,ee,b,15,8,0)},o.deflateInit2=Oe,o.deflateReset=Ee,o.deflateResetKeep=xe,o.deflateSetHeader=function(_,ee){return _&&_.state?_.state.wrap!==2?g:(_.state.gzhead=ee,f):g},o.deflate=function(_,ee){var G,P,R,F;if(!_||!_.state||5<ee||ee<0)return _?q(_,g):g;if(P=_.state,!_.output||!_.input&&_.avail_in!==0||P.status===666&&ee!==p)return q(_,_.avail_out===0?-5:g);if(P.strm=_,G=P.last_flush,P.last_flush=ee,P.status===E)if(P.wrap===2)_.adler=0,z(P,31),z(P,139),z(P,8),P.gzhead?(z(P,(P.gzhead.text?1:0)+(P.gzhead.hcrc?2:0)+(P.gzhead.extra?4:0)+(P.gzhead.name?8:0)+(P.gzhead.comment?16:0)),z(P,255&P.gzhead.time),z(P,P.gzhead.time>>8&255),z(P,P.gzhead.time>>16&255),z(P,P.gzhead.time>>24&255),z(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),z(P,255&P.gzhead.os),P.gzhead.extra&&P.gzhead.extra.length&&(z(P,255&P.gzhead.extra.length),z(P,P.gzhead.extra.length>>8&255)),P.gzhead.hcrc&&(_.adler=u(_.adler,P.pending_buf,P.pending,0)),P.gzindex=0,P.status=69):(z(P,0),z(P,0),z(P,0),z(P,0),z(P,0),z(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),z(P,3),P.status=M);else{var U=b+(P.w_bits-8<<4)<<8;U|=(2<=P.strategy||P.level<2?0:P.level<6?1:P.level===6?2:3)<<6,P.strstart!==0&&(U|=32),U+=31-U%31,P.status=M,oe(P,U),P.strstart!==0&&(oe(P,_.adler>>>16),oe(P,65535&_.adler)),_.adler=1}if(P.status===69)if(P.gzhead.extra){for(R=P.pending;P.gzindex<(65535&P.gzhead.extra.length)&&(P.pending!==P.pending_buf_size||(P.gzhead.hcrc&&P.pending>R&&(_.adler=u(_.adler,P.pending_buf,P.pending-R,R)),W(_),R=P.pending,P.pending!==P.pending_buf_size));)z(P,255&P.gzhead.extra[P.gzindex]),P.gzindex++;P.gzhead.hcrc&&P.pending>R&&(_.adler=u(_.adler,P.pending_buf,P.pending-R,R)),P.gzindex===P.gzhead.extra.length&&(P.gzindex=0,P.status=73)}else P.status=73;if(P.status===73)if(P.gzhead.name){R=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>R&&(_.adler=u(_.adler,P.pending_buf,P.pending-R,R)),W(_),R=P.pending,P.pending===P.pending_buf_size)){F=1;break}F=P.gzindex<P.gzhead.name.length?255&P.gzhead.name.charCodeAt(P.gzindex++):0,z(P,F)}while(F!==0);P.gzhead.hcrc&&P.pending>R&&(_.adler=u(_.adler,P.pending_buf,P.pending-R,R)),F===0&&(P.gzindex=0,P.status=91)}else P.status=91;if(P.status===91)if(P.gzhead.comment){R=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>R&&(_.adler=u(_.adler,P.pending_buf,P.pending-R,R)),W(_),R=P.pending,P.pending===P.pending_buf_size)){F=1;break}F=P.gzindex<P.gzhead.comment.length?255&P.gzhead.comment.charCodeAt(P.gzindex++):0,z(P,F)}while(F!==0);P.gzhead.hcrc&&P.pending>R&&(_.adler=u(_.adler,P.pending_buf,P.pending-R,R)),F===0&&(P.status=103)}else P.status=103;if(P.status===103&&(P.gzhead.hcrc?(P.pending+2>P.pending_buf_size&&W(_),P.pending+2<=P.pending_buf_size&&(z(P,255&_.adler),z(P,_.adler>>8&255),_.adler=0,P.status=M)):P.status=M),P.pending!==0){if(W(_),_.avail_out===0)return P.last_flush=-1,f}else if(_.avail_in===0&&Y(ee)<=Y(G)&&ee!==p)return q(_,-5);if(P.status===666&&_.avail_in!==0)return q(_,-5);if(_.avail_in!==0||P.lookahead!==0||ee!==h&&P.status!==666){var J=P.strategy===2?(function($,ne){for(var le;;){if($.lookahead===0&&(de($),$.lookahead===0)){if(ne===h)return w;break}if($.match_length=0,le=a._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,le&&(V($,!1),$.strm.avail_out===0))return w}return $.insert=0,ne===p?(V($,!0),$.strm.avail_out===0?H:B):$.last_lit&&(V($,!1),$.strm.avail_out===0)?w:D})(P,ee):P.strategy===3?(function($,ne){for(var le,se,Z,re,ue=$.window;;){if($.lookahead<=O){if(de($),$.lookahead<=O&&ne===h)return w;if($.lookahead===0)break}if($.match_length=0,$.lookahead>=A&&0<$.strstart&&(se=ue[Z=$.strstart-1])===ue[++Z]&&se===ue[++Z]&&se===ue[++Z]){re=$.strstart+O;do;while(se===ue[++Z]&&se===ue[++Z]&&se===ue[++Z]&&se===ue[++Z]&&se===ue[++Z]&&se===ue[++Z]&&se===ue[++Z]&&se===ue[++Z]&&Z<re);$.match_length=O-(re-Z),$.match_length>$.lookahead&&($.match_length=$.lookahead)}if($.match_length>=A?(le=a._tr_tally($,1,$.match_length-A),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0):(le=a._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++),le&&(V($,!1),$.strm.avail_out===0))return w}return $.insert=0,ne===p?(V($,!0),$.strm.avail_out===0?H:B):$.last_lit&&(V($,!1),$.strm.avail_out===0)?w:D})(P,ee):s[P.level].func(P,ee);if(J!==H&&J!==B||(P.status=666),J===w||J===H)return _.avail_out===0&&(P.last_flush=-1),f;if(J===D&&(ee===1?a._tr_align(P):ee!==5&&(a._tr_stored_block(P,0,0,!1),ee===3&&(I(P.head),P.lookahead===0&&(P.strstart=0,P.block_start=0,P.insert=0))),W(_),_.avail_out===0))return P.last_flush=-1,f}return ee!==p?f:P.wrap<=0?1:(P.wrap===2?(z(P,255&_.adler),z(P,_.adler>>8&255),z(P,_.adler>>16&255),z(P,_.adler>>24&255),z(P,255&_.total_in),z(P,_.total_in>>8&255),z(P,_.total_in>>16&255),z(P,_.total_in>>24&255)):(oe(P,_.adler>>>16),oe(P,65535&_.adler)),W(_),0<P.wrap&&(P.wrap=-P.wrap),P.pending!==0?f:1)},o.deflateEnd=function(_){var ee;return _&&_.state?(ee=_.state.status)!==E&&ee!==69&&ee!==73&&ee!==91&&ee!==103&&ee!==M&&ee!==666?q(_,g):(_.state=null,ee===M?q(_,-3):f):g},o.deflateSetDictionary=function(_,ee){var G,P,R,F,U,J,$,ne,le=ee.length;if(!_||!_.state||(F=(G=_.state).wrap)===2||F===1&&G.status!==E||G.lookahead)return g;for(F===1&&(_.adler=c(_.adler,ee,le,0)),G.wrap=0,le>=G.w_size&&(F===0&&(I(G.head),G.strstart=0,G.block_start=0,G.insert=0),ne=new i.Buf8(G.w_size),i.arraySet(ne,ee,le-G.w_size,G.w_size,0),ee=ne,le=G.w_size),U=_.avail_in,J=_.next_in,$=_.input,_.avail_in=le,_.next_in=0,_.input=ee,de(G);G.lookahead>=A;){for(P=G.strstart,R=G.lookahead-(A-1);G.ins_h=(G.ins_h<<G.hash_shift^G.window[P+A-1])&G.hash_mask,G.prev[P&G.w_mask]=G.head[G.ins_h],G.head[G.ins_h]=P,P++,--R;);G.strstart=P,G.lookahead=A-1,de(G)}return G.strstart+=G.lookahead,G.block_start=G.strstart,G.insert=G.lookahead,G.lookahead=0,G.match_length=G.prev_length=A-1,G.match_available=0,_.next_in=J,_.input=$,_.avail_in=U,G.wrap=F,f},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 a,c,u,d,h,p,f,g,m,x,y,b,k,S,C,j,N,T,A,O,L,E,M,w,D;a=s.state,c=s.next_in,w=s.input,u=c+(s.avail_in-5),d=s.next_out,D=s.output,h=d-(i-s.avail_out),p=d+(s.avail_out-257),f=a.dmax,g=a.wsize,m=a.whave,x=a.wnext,y=a.window,b=a.hold,k=a.bits,S=a.lencode,C=a.distcode,j=(1<<a.lenbits)-1,N=(1<<a.distbits)-1;e:do{k<15&&(b+=w[c++]<<k,k+=8,b+=w[c++]<<k,k+=8),T=S[b&j];t:for(;;){if(b>>>=A=T>>>24,k-=A,(A=T>>>16&255)===0)D[d++]=65535&T;else{if(!(16&A)){if((64&A)==0){T=S[(65535&T)+(b&(1<<A)-1)];continue t}if(32&A){a.mode=12;break e}s.msg="invalid literal/length code",a.mode=30;break e}O=65535&T,(A&=15)&&(k<A&&(b+=w[c++]<<k,k+=8),O+=b&(1<<A)-1,b>>>=A,k-=A),k<15&&(b+=w[c++]<<k,k+=8,b+=w[c++]<<k,k+=8),T=C[b&N];n:for(;;){if(b>>>=A=T>>>24,k-=A,!(16&(A=T>>>16&255))){if((64&A)==0){T=C[(65535&T)+(b&(1<<A)-1)];continue n}s.msg="invalid distance code",a.mode=30;break e}if(L=65535&T,k<(A&=15)&&(b+=w[c++]<<k,(k+=8)<A&&(b+=w[c++]<<k,k+=8)),f<(L+=b&(1<<A)-1)){s.msg="invalid distance too far back",a.mode=30;break e}if(b>>>=A,k-=A,(A=d-h)<L){if(m<(A=L-A)&&a.sane){s.msg="invalid distance too far back",a.mode=30;break e}if(M=y,(E=0)===x){if(E+=g-A,A<O){for(O-=A;D[d++]=y[E++],--A;);E=d-L,M=D}}else if(x<A){if(E+=g+x-A,(A-=x)<O){for(O-=A;D[d++]=y[E++],--A;);if(E=0,x<O){for(O-=A=x;D[d++]=y[E++],--A;);E=d-L,M=D}}}else if(E+=x-A,A<O){for(O-=A;D[d++]=y[E++],--A;);E=d-L,M=D}for(;2<O;)D[d++]=M[E++],D[d++]=M[E++],D[d++]=M[E++],O-=3;O&&(D[d++]=M[E++],1<O&&(D[d++]=M[E++]))}else{for(E=d-L;D[d++]=D[E++],D[d++]=D[E++],D[d++]=D[E++],2<(O-=3););O&&(D[d++]=D[E++],1<O&&(D[d++]=D[E++]))}break}}break}}while(c<u&&d<p);c-=O=k>>3,b&=(1<<(k-=O<<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<p?p-d+257:257-(d-p),a.hold=b,a.bits=k}},{}],49:[function(n,r,o){var s=n("../utils/common"),i=n("./adler32"),a=n("./crc32"),c=n("./inffast"),u=n("./inftrees"),d=1,h=2,p=0,f=-2,g=1,m=852,x=592;function y(E){return(E>>>24&255)+(E>>>8&65280)+((65280&E)<<8)+((255&E)<<24)}function b(){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(E){var M;return E&&E.state?(M=E.state,E.total_in=E.total_out=M.total=0,E.msg="",M.wrap&&(E.adler=1&M.wrap),M.mode=g,M.last=0,M.havedict=0,M.dmax=32768,M.head=null,M.hold=0,M.bits=0,M.lencode=M.lendyn=new s.Buf32(m),M.distcode=M.distdyn=new s.Buf32(x),M.sane=1,M.back=-1,p):f}function S(E){var M;return E&&E.state?((M=E.state).wsize=0,M.whave=0,M.wnext=0,k(E)):f}function C(E,M){var w,D;return E&&E.state?(D=E.state,M<0?(w=0,M=-M):(w=1+(M>>4),M<48&&(M&=15)),M&&(M<8||15<M)?f:(D.window!==null&&D.wbits!==M&&(D.window=null),D.wrap=w,D.wbits=M,S(E))):f}function j(E,M){var w,D;return E?(D=new b,(E.state=D).window=null,(w=C(E,M))!==p&&(E.state=null),w):f}var N,T,A=!0;function O(E){if(A){var M;for(N=new s.Buf32(512),T=new s.Buf32(32),M=0;M<144;)E.lens[M++]=8;for(;M<256;)E.lens[M++]=9;for(;M<280;)E.lens[M++]=7;for(;M<288;)E.lens[M++]=8;for(u(d,E.lens,0,288,N,0,E.work,{bits:9}),M=0;M<32;)E.lens[M++]=5;u(h,E.lens,0,32,T,0,E.work,{bits:5}),A=!1}E.lencode=N,E.lenbits=9,E.distcode=T,E.distbits=5}function L(E,M,w,D){var H,B=E.state;return B.window===null&&(B.wsize=1<<B.wbits,B.wnext=0,B.whave=0,B.window=new s.Buf8(B.wsize)),D>=B.wsize?(s.arraySet(B.window,M,w-B.wsize,B.wsize,0),B.wnext=0,B.whave=B.wsize):(D<(H=B.wsize-B.wnext)&&(H=D),s.arraySet(B.window,M,w-D,H,B.wnext),(D-=H)?(s.arraySet(B.window,M,w-D,D,0),B.wnext=D,B.whave=B.wsize):(B.wnext+=H,B.wnext===B.wsize&&(B.wnext=0),B.whave<B.wsize&&(B.whave+=H))),0}o.inflateReset=S,o.inflateReset2=C,o.inflateResetKeep=k,o.inflateInit=function(E){return j(E,15)},o.inflateInit2=j,o.inflate=function(E,M){var w,D,H,B,q,Y,I,W,V,z,oe,X,de,te,ce,fe,ge,xe,Ee,Oe,_,ee,G,P,R=0,F=new s.Buf8(4),U=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!E||!E.state||!E.output||!E.input&&E.avail_in!==0)return f;(w=E.state).mode===12&&(w.mode=13),q=E.next_out,H=E.output,I=E.avail_out,B=E.next_in,D=E.input,Y=E.avail_in,W=w.hold,V=w.bits,z=Y,oe=I,ee=p;e:for(;;)switch(w.mode){case g:if(w.wrap===0){w.mode=13;break}for(;V<16;){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}if(2&w.wrap&&W===35615){F[w.check=0]=255&W,F[1]=W>>>8&255,w.check=a(w.check,F,2,0),V=W=0,w.mode=2;break}if(w.flags=0,w.head&&(w.head.done=!1),!(1&w.wrap)||(((255&W)<<8)+(W>>8))%31){E.msg="incorrect header check",w.mode=30;break}if((15&W)!=8){E.msg="unknown compression method",w.mode=30;break}if(V-=4,_=8+(15&(W>>>=4)),w.wbits===0)w.wbits=_;else if(_>w.wbits){E.msg="invalid window size",w.mode=30;break}w.dmax=1<<_,E.adler=w.check=1,w.mode=512&W?10:12,V=W=0;break;case 2:for(;V<16;){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}if(w.flags=W,(255&w.flags)!=8){E.msg="unknown compression method",w.mode=30;break}if(57344&w.flags){E.msg="unknown header flags set",w.mode=30;break}w.head&&(w.head.text=W>>8&1),512&w.flags&&(F[0]=255&W,F[1]=W>>>8&255,w.check=a(w.check,F,2,0)),V=W=0,w.mode=3;case 3:for(;V<32;){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}w.head&&(w.head.time=W),512&w.flags&&(F[0]=255&W,F[1]=W>>>8&255,F[2]=W>>>16&255,F[3]=W>>>24&255,w.check=a(w.check,F,4,0)),V=W=0,w.mode=4;case 4:for(;V<16;){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}w.head&&(w.head.xflags=255&W,w.head.os=W>>8),512&w.flags&&(F[0]=255&W,F[1]=W>>>8&255,w.check=a(w.check,F,2,0)),V=W=0,w.mode=5;case 5:if(1024&w.flags){for(;V<16;){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}w.length=W,w.head&&(w.head.extra_len=W),512&w.flags&&(F[0]=255&W,F[1]=W>>>8&255,w.check=a(w.check,F,2,0)),V=W=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&(Y<(X=w.length)&&(X=Y),X&&(w.head&&(_=w.head.extra_len-w.length,w.head.extra||(w.head.extra=new Array(w.head.extra_len)),s.arraySet(w.head.extra,D,B,X,_)),512&w.flags&&(w.check=a(w.check,D,X,B)),Y-=X,B+=X,w.length-=X),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if(Y===0)break e;for(X=0;_=D[B+X++],w.head&&_&&w.length<65536&&(w.head.name+=String.fromCharCode(_)),_&&X<Y;);if(512&w.flags&&(w.check=a(w.check,D,X,B)),Y-=X,B+=X,_)break e}else w.head&&(w.head.name=null);w.length=0,w.mode=8;case 8:if(4096&w.flags){if(Y===0)break e;for(X=0;_=D[B+X++],w.head&&_&&w.length<65536&&(w.head.comment+=String.fromCharCode(_)),_&&X<Y;);if(512&w.flags&&(w.check=a(w.check,D,X,B)),Y-=X,B+=X,_)break e}else w.head&&(w.head.comment=null);w.mode=9;case 9:if(512&w.flags){for(;V<16;){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}if(W!==(65535&w.check)){E.msg="header crc mismatch",w.mode=30;break}V=W=0}w.head&&(w.head.hcrc=w.flags>>9&1,w.head.done=!0),E.adler=w.check=0,w.mode=12;break;case 10:for(;V<32;){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}E.adler=w.check=y(W),V=W=0,w.mode=11;case 11:if(w.havedict===0)return E.next_out=q,E.avail_out=I,E.next_in=B,E.avail_in=Y,w.hold=W,w.bits=V,2;E.adler=w.check=1,w.mode=12;case 12:if(M===5||M===6)break e;case 13:if(w.last){W>>>=7&V,V-=7&V,w.mode=27;break}for(;V<3;){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}switch(w.last=1&W,V-=1,3&(W>>>=1)){case 0:w.mode=14;break;case 1:if(O(w),w.mode=20,M!==6)break;W>>>=2,V-=2;break e;case 2:w.mode=17;break;case 3:E.msg="invalid block type",w.mode=30}W>>>=2,V-=2;break;case 14:for(W>>>=7&V,V-=7&V;V<32;){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}if((65535&W)!=(W>>>16^65535)){E.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&W,V=W=0,w.mode=15,M===6)break e;case 15:w.mode=16;case 16:if(X=w.length){if(Y<X&&(X=Y),I<X&&(X=I),X===0)break e;s.arraySet(H,D,B,X,q),Y-=X,B+=X,I-=X,q+=X,w.length-=X;break}w.mode=12;break;case 17:for(;V<14;){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}if(w.nlen=257+(31&W),W>>>=5,V-=5,w.ndist=1+(31&W),W>>>=5,V-=5,w.ncode=4+(15&W),W>>>=4,V-=4,286<w.nlen||30<w.ndist){E.msg="too many length or distance symbols",w.mode=30;break}w.have=0,w.mode=18;case 18:for(;w.have<w.ncode;){for(;V<3;){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}w.lens[U[w.have++]]=7&W,W>>>=3,V-=3}for(;w.have<19;)w.lens[U[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,G={bits:w.lenbits},ee=u(0,w.lens,0,19,w.lencode,0,w.work,G),w.lenbits=G.bits,ee){E.msg="invalid code lengths set",w.mode=30;break}w.have=0,w.mode=19;case 19:for(;w.have<w.nlen+w.ndist;){for(;fe=(R=w.lencode[W&(1<<w.lenbits)-1])>>>16&255,ge=65535&R,!((ce=R>>>24)<=V);){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}if(ge<16)W>>>=ce,V-=ce,w.lens[w.have++]=ge;else{if(ge===16){for(P=ce+2;V<P;){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}if(W>>>=ce,V-=ce,w.have===0){E.msg="invalid bit length repeat",w.mode=30;break}_=w.lens[w.have-1],X=3+(3&W),W>>>=2,V-=2}else if(ge===17){for(P=ce+3;V<P;){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}V-=ce,_=0,X=3+(7&(W>>>=ce)),W>>>=3,V-=3}else{for(P=ce+7;V<P;){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}V-=ce,_=0,X=11+(127&(W>>>=ce)),W>>>=7,V-=7}if(w.have+X>w.nlen+w.ndist){E.msg="invalid bit length repeat",w.mode=30;break}for(;X--;)w.lens[w.have++]=_}}if(w.mode===30)break;if(w.lens[256]===0){E.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,G={bits:w.lenbits},ee=u(d,w.lens,0,w.nlen,w.lencode,0,w.work,G),w.lenbits=G.bits,ee){E.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,G={bits:w.distbits},ee=u(h,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,G),w.distbits=G.bits,ee){E.msg="invalid distances set",w.mode=30;break}if(w.mode=20,M===6)break e;case 20:w.mode=21;case 21:if(6<=Y&&258<=I){E.next_out=q,E.avail_out=I,E.next_in=B,E.avail_in=Y,w.hold=W,w.bits=V,c(E,oe),q=E.next_out,H=E.output,I=E.avail_out,B=E.next_in,D=E.input,Y=E.avail_in,W=w.hold,V=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;fe=(R=w.lencode[W&(1<<w.lenbits)-1])>>>16&255,ge=65535&R,!((ce=R>>>24)<=V);){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}if(fe&&(240&fe)==0){for(xe=ce,Ee=fe,Oe=ge;fe=(R=w.lencode[Oe+((W&(1<<xe+Ee)-1)>>xe)])>>>16&255,ge=65535&R,!(xe+(ce=R>>>24)<=V);){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}W>>>=xe,V-=xe,w.back+=xe}if(W>>>=ce,V-=ce,w.back+=ce,w.length=ge,fe===0){w.mode=26;break}if(32&fe){w.back=-1,w.mode=12;break}if(64&fe){E.msg="invalid literal/length code",w.mode=30;break}w.extra=15&fe,w.mode=22;case 22:if(w.extra){for(P=w.extra;V<P;){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}w.length+=W&(1<<w.extra)-1,W>>>=w.extra,V-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;fe=(R=w.distcode[W&(1<<w.distbits)-1])>>>16&255,ge=65535&R,!((ce=R>>>24)<=V);){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}if((240&fe)==0){for(xe=ce,Ee=fe,Oe=ge;fe=(R=w.distcode[Oe+((W&(1<<xe+Ee)-1)>>xe)])>>>16&255,ge=65535&R,!(xe+(ce=R>>>24)<=V);){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}W>>>=xe,V-=xe,w.back+=xe}if(W>>>=ce,V-=ce,w.back+=ce,64&fe){E.msg="invalid distance code",w.mode=30;break}w.offset=ge,w.extra=15&fe,w.mode=24;case 24:if(w.extra){for(P=w.extra;V<P;){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}w.offset+=W&(1<<w.extra)-1,W>>>=w.extra,V-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){E.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(I===0)break e;if(X=oe-I,w.offset>X){if((X=w.offset-X)>w.whave&&w.sane){E.msg="invalid distance too far back",w.mode=30;break}de=X>w.wnext?(X-=w.wnext,w.wsize-X):w.wnext-X,X>w.length&&(X=w.length),te=w.window}else te=H,de=q-w.offset,X=w.length;for(I<X&&(X=I),I-=X,w.length-=X;H[q++]=te[de++],--X;);w.length===0&&(w.mode=21);break;case 26:if(I===0)break e;H[q++]=w.length,I--,w.mode=21;break;case 27:if(w.wrap){for(;V<32;){if(Y===0)break e;Y--,W|=D[B++]<<V,V+=8}if(oe-=I,E.total_out+=oe,w.total+=oe,oe&&(E.adler=w.check=w.flags?a(w.check,H,oe,q-oe):i(w.check,H,oe,q-oe)),oe=I,(w.flags?W:y(W))!==w.check){E.msg="incorrect data check",w.mode=30;break}V=W=0}w.mode=28;case 28:if(w.wrap&&w.flags){for(;V<32;){if(Y===0)break e;Y--,W+=D[B++]<<V,V+=8}if(W!==(4294967295&w.total)){E.msg="incorrect length check",w.mode=30;break}V=W=0}w.mode=29;case 29:ee=1;break e;case 30:ee=-3;break e;case 31:return-4;default:return f}return E.next_out=q,E.avail_out=I,E.next_in=B,E.avail_in=Y,w.hold=W,w.bits=V,(w.wsize||oe!==E.avail_out&&w.mode<30&&(w.mode<27||M!==4))&&L(E,E.output,E.next_out,oe-E.avail_out)?(w.mode=31,-4):(z-=E.avail_in,oe-=E.avail_out,E.total_in+=z,E.total_out+=oe,w.total+=oe,w.wrap&&oe&&(E.adler=w.check=w.flags?a(w.check,H,oe,E.next_out-oe):i(w.check,H,oe,E.next_out-oe)),E.data_type=w.bits+(w.last?64:0)+(w.mode===12?128:0)+(w.mode===20||w.mode===15?256:0),(z==0&&oe===0||M===4)&&ee===p&&(ee=-5),ee)},o.inflateEnd=function(E){if(!E||!E.state)return f;var M=E.state;return M.window&&(M.window=null),E.state=null,p},o.inflateGetHeader=function(E,M){var w;return E&&E.state?(2&(w=E.state).wrap)==0?f:((w.head=M).done=!1,p):f},o.inflateSetDictionary=function(E,M){var w,D=M.length;return E&&E.state?(w=E.state).wrap!==0&&w.mode!==11?f:w.mode===11&&i(1,M,D,0)!==w.check?-3:L(E,M,D,D)?(w.mode=31,-4):(w.havedict=1,p):f},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],a=[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,h,p,f,g,m,x,y){var b,k,S,C,j,N,T,A,O,L=y.bits,E=0,M=0,w=0,D=0,H=0,B=0,q=0,Y=0,I=0,W=0,V=null,z=0,oe=new s.Buf16(16),X=new s.Buf16(16),de=null,te=0;for(E=0;E<=15;E++)oe[E]=0;for(M=0;M<f;M++)oe[h[p+M]]++;for(H=L,D=15;1<=D&&oe[D]===0;D--);if(D<H&&(H=D),D===0)return g[m++]=20971520,g[m++]=20971520,y.bits=1,0;for(w=1;w<D&&oe[w]===0;w++);for(H<w&&(H=w),E=Y=1;E<=15;E++)if(Y<<=1,(Y-=oe[E])<0)return-1;if(0<Y&&(d===0||D!==1))return-1;for(X[1]=0,E=1;E<15;E++)X[E+1]=X[E]+oe[E];for(M=0;M<f;M++)h[p+M]!==0&&(x[X[h[p+M]]++]=M);if(N=d===0?(V=de=x,19):d===1?(V=i,z-=257,de=a,te-=257,256):(V=c,de=u,-1),E=w,j=m,q=M=W=0,S=-1,C=(I=1<<(B=H))-1,d===1&&852<I||d===2&&592<I)return 1;for(;;){for(T=E-q,O=x[M]<N?(A=0,x[M]):x[M]>N?(A=de[te+x[M]],V[z+x[M]]):(A=96,0),b=1<<E-q,w=k=1<<B;g[j+(W>>q)+(k-=b)]=T<<24|A<<16|O|0,k!==0;);for(b=1<<E-1;W&b;)b>>=1;if(b!==0?(W&=b-1,W+=b):W=0,M++,--oe[E]==0){if(E===D)break;E=h[p+x[M]]}if(H<E&&(W&C)!==S){for(q===0&&(q=H),j+=w,Y=1<<(B=E-q);B+q<D&&!((Y-=oe[B+q])<=0);)B++,Y<<=1;if(I+=1<<B,d===1&&852<I||d===2&&592<I)return 1;g[S=W&C]=H<<24|B<<16|j-m|0}}return W!==0&&(g[j+W]=E-q<<24|64<<16|0),y.bits=H,0}},{"../utils/common":41}],51:[function(n,r,o){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){var s=n("../utils/common"),i=0,a=1;function c(R){for(var F=R.length;0<=--F;)R[F]=0}var u=0,d=29,h=256,p=h+1+d,f=30,g=19,m=2*p+1,x=15,y=16,b=7,k=256,S=16,C=17,j=18,N=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],T=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],L=new Array(2*(p+2));c(L);var E=new Array(2*f);c(E);var M=new Array(512);c(M);var w=new Array(256);c(w);var D=new Array(d);c(D);var H,B,q,Y=new Array(f);function I(R,F,U,J,$){this.static_tree=R,this.extra_bits=F,this.extra_base=U,this.elems=J,this.max_length=$,this.has_stree=R&&R.length}function W(R,F){this.dyn_tree=R,this.max_code=0,this.stat_desc=F}function V(R){return R<256?M[R]:M[256+(R>>>7)]}function z(R,F){R.pending_buf[R.pending++]=255&F,R.pending_buf[R.pending++]=F>>>8&255}function oe(R,F,U){R.bi_valid>y-U?(R.bi_buf|=F<<R.bi_valid&65535,z(R,R.bi_buf),R.bi_buf=F>>y-R.bi_valid,R.bi_valid+=U-y):(R.bi_buf|=F<<R.bi_valid&65535,R.bi_valid+=U)}function X(R,F,U){oe(R,U[2*F],U[2*F+1])}function de(R,F){for(var U=0;U|=1&R,R>>>=1,U<<=1,0<--F;);return U>>>1}function te(R,F,U){var J,$,ne=new Array(x+1),le=0;for(J=1;J<=x;J++)ne[J]=le=le+U[J-1]<<1;for($=0;$<=F;$++){var se=R[2*$+1];se!==0&&(R[2*$]=de(ne[se]++,se))}}function ce(R){var F;for(F=0;F<p;F++)R.dyn_ltree[2*F]=0;for(F=0;F<f;F++)R.dyn_dtree[2*F]=0;for(F=0;F<g;F++)R.bl_tree[2*F]=0;R.dyn_ltree[2*k]=1,R.opt_len=R.static_len=0,R.last_lit=R.matches=0}function fe(R){8<R.bi_valid?z(R,R.bi_buf):0<R.bi_valid&&(R.pending_buf[R.pending++]=R.bi_buf),R.bi_buf=0,R.bi_valid=0}function ge(R,F,U,J){var $=2*F,ne=2*U;return R[$]<R[ne]||R[$]===R[ne]&&J[F]<=J[U]}function xe(R,F,U){for(var J=R.heap[U],$=U<<1;$<=R.heap_len&&($<R.heap_len&&ge(F,R.heap[$+1],R.heap[$],R.depth)&&$++,!ge(F,J,R.heap[$],R.depth));)R.heap[U]=R.heap[$],U=$,$<<=1;R.heap[U]=J}function Ee(R,F,U){var J,$,ne,le,se=0;if(R.last_lit!==0)for(;J=R.pending_buf[R.d_buf+2*se]<<8|R.pending_buf[R.d_buf+2*se+1],$=R.pending_buf[R.l_buf+se],se++,J===0?X(R,$,F):(X(R,(ne=w[$])+h+1,F),(le=N[ne])!==0&&oe(R,$-=D[ne],le),X(R,ne=V(--J),U),(le=T[ne])!==0&&oe(R,J-=Y[ne],le)),se<R.last_lit;);X(R,k,F)}function Oe(R,F){var U,J,$,ne=F.dyn_tree,le=F.stat_desc.static_tree,se=F.stat_desc.has_stree,Z=F.stat_desc.elems,re=-1;for(R.heap_len=0,R.heap_max=m,U=0;U<Z;U++)ne[2*U]!==0?(R.heap[++R.heap_len]=re=U,R.depth[U]=0):ne[2*U+1]=0;for(;R.heap_len<2;)ne[2*($=R.heap[++R.heap_len]=re<2?++re:0)]=1,R.depth[$]=0,R.opt_len--,se&&(R.static_len-=le[2*$+1]);for(F.max_code=re,U=R.heap_len>>1;1<=U;U--)xe(R,ne,U);for($=Z;U=R.heap[1],R.heap[1]=R.heap[R.heap_len--],xe(R,ne,1),J=R.heap[1],R.heap[--R.heap_max]=U,R.heap[--R.heap_max]=J,ne[2*$]=ne[2*U]+ne[2*J],R.depth[$]=(R.depth[U]>=R.depth[J]?R.depth[U]:R.depth[J])+1,ne[2*U+1]=ne[2*J+1]=$,R.heap[1]=$++,xe(R,ne,1),2<=R.heap_len;);R.heap[--R.heap_max]=R.heap[1],(function(ue,be){var Ae,He,ft,Ie,It,Ut,Ve=be.dyn_tree,Zt=be.max_code,Ct=be.stat_desc.static_tree,Hp=be.stat_desc.has_stree,qp=be.stat_desc.extra_bits,La=be.stat_desc.extra_base,ar=be.stat_desc.max_length,Mr=0;for(Ie=0;Ie<=x;Ie++)ue.bl_count[Ie]=0;for(Ve[2*ue.heap[ue.heap_max]+1]=0,Ae=ue.heap_max+1;Ae<m;Ae++)ar<(Ie=Ve[2*Ve[2*(He=ue.heap[Ae])+1]+1]+1)&&(Ie=ar,Mr++),Ve[2*He+1]=Ie,Zt<He||(ue.bl_count[Ie]++,It=0,La<=He&&(It=qp[He-La]),Ut=Ve[2*He],ue.opt_len+=Ut*(Ie+It),Hp&&(ue.static_len+=Ut*(Ct[2*He+1]+It)));if(Mr!==0){do{for(Ie=ar-1;ue.bl_count[Ie]===0;)Ie--;ue.bl_count[Ie]--,ue.bl_count[Ie+1]+=2,ue.bl_count[ar]--,Mr-=2}while(0<Mr);for(Ie=ar;Ie!==0;Ie--)for(He=ue.bl_count[Ie];He!==0;)Zt<(ft=ue.heap[--Ae])||(Ve[2*ft+1]!==Ie&&(ue.opt_len+=(Ie-Ve[2*ft+1])*Ve[2*ft],Ve[2*ft+1]=Ie),He--)}})(R,F),te(ne,re,R.bl_count)}function _(R,F,U){var J,$,ne=-1,le=F[1],se=0,Z=7,re=4;for(le===0&&(Z=138,re=3),F[2*(U+1)+1]=65535,J=0;J<=U;J++)$=le,le=F[2*(J+1)+1],++se<Z&&$===le||(se<re?R.bl_tree[2*$]+=se:$!==0?($!==ne&&R.bl_tree[2*$]++,R.bl_tree[2*S]++):se<=10?R.bl_tree[2*C]++:R.bl_tree[2*j]++,ne=$,re=(se=0)===le?(Z=138,3):$===le?(Z=6,3):(Z=7,4))}function ee(R,F,U){var J,$,ne=-1,le=F[1],se=0,Z=7,re=4;for(le===0&&(Z=138,re=3),J=0;J<=U;J++)if($=le,le=F[2*(J+1)+1],!(++se<Z&&$===le)){if(se<re)for(;X(R,$,R.bl_tree),--se!=0;);else $!==0?($!==ne&&(X(R,$,R.bl_tree),se--),X(R,S,R.bl_tree),oe(R,se-3,2)):se<=10?(X(R,C,R.bl_tree),oe(R,se-3,3)):(X(R,j,R.bl_tree),oe(R,se-11,7));ne=$,re=(se=0)===le?(Z=138,3):$===le?(Z=6,3):(Z=7,4)}}c(Y);var G=!1;function P(R,F,U,J){oe(R,(u<<1)+(J?1:0),3),(function($,ne,le,se){fe($),z($,le),z($,~le),s.arraySet($.pending_buf,$.window,ne,le,$.pending),$.pending+=le})(R,F,U)}o._tr_init=function(R){G||((function(){var F,U,J,$,ne,le=new Array(x+1);for($=J=0;$<d-1;$++)for(D[$]=J,F=0;F<1<<N[$];F++)w[J++]=$;for(w[J-1]=$,$=ne=0;$<16;$++)for(Y[$]=ne,F=0;F<1<<T[$];F++)M[ne++]=$;for(ne>>=7;$<f;$++)for(Y[$]=ne<<7,F=0;F<1<<T[$]-7;F++)M[256+ne++]=$;for(U=0;U<=x;U++)le[U]=0;for(F=0;F<=143;)L[2*F+1]=8,F++,le[8]++;for(;F<=255;)L[2*F+1]=9,F++,le[9]++;for(;F<=279;)L[2*F+1]=7,F++,le[7]++;for(;F<=287;)L[2*F+1]=8,F++,le[8]++;for(te(L,p+1,le),F=0;F<f;F++)E[2*F+1]=5,E[2*F]=de(F,5);H=new I(L,N,h+1,p,x),B=new I(E,T,0,f,x),q=new I(new Array(0),A,0,g,b)})(),G=!0),R.l_desc=new W(R.dyn_ltree,H),R.d_desc=new W(R.dyn_dtree,B),R.bl_desc=new W(R.bl_tree,q),R.bi_buf=0,R.bi_valid=0,ce(R)},o._tr_stored_block=P,o._tr_flush_block=function(R,F,U,J){var $,ne,le=0;0<R.level?(R.strm.data_type===2&&(R.strm.data_type=(function(se){var Z,re=4093624447;for(Z=0;Z<=31;Z++,re>>>=1)if(1&re&&se.dyn_ltree[2*Z]!==0)return i;if(se.dyn_ltree[18]!==0||se.dyn_ltree[20]!==0||se.dyn_ltree[26]!==0)return a;for(Z=32;Z<h;Z++)if(se.dyn_ltree[2*Z]!==0)return a;return i})(R)),Oe(R,R.l_desc),Oe(R,R.d_desc),le=(function(se){var Z;for(_(se,se.dyn_ltree,se.l_desc.max_code),_(se,se.dyn_dtree,se.d_desc.max_code),Oe(se,se.bl_desc),Z=g-1;3<=Z&&se.bl_tree[2*O[Z]+1]===0;Z--);return se.opt_len+=3*(Z+1)+5+5+4,Z})(R),$=R.opt_len+3+7>>>3,(ne=R.static_len+3+7>>>3)<=$&&($=ne)):$=ne=U+5,U+4<=$&&F!==-1?P(R,F,U,J):R.strategy===4||ne===$?(oe(R,2+(J?1:0),3),Ee(R,L,E)):(oe(R,4+(J?1:0),3),(function(se,Z,re,ue){var be;for(oe(se,Z-257,5),oe(se,re-1,5),oe(se,ue-4,4),be=0;be<ue;be++)oe(se,se.bl_tree[2*O[be]+1],3);ee(se,se.dyn_ltree,Z-1),ee(se,se.dyn_dtree,re-1)})(R,R.l_desc.max_code+1,R.d_desc.max_code+1,le+1),Ee(R,R.dyn_ltree,R.dyn_dtree)),ce(R),J&&fe(R)},o._tr_tally=function(R,F,U){return R.pending_buf[R.d_buf+2*R.last_lit]=F>>>8&255,R.pending_buf[R.d_buf+2*R.last_lit+1]=255&F,R.pending_buf[R.l_buf+R.last_lit]=255&U,R.last_lit++,F===0?R.dyn_ltree[2*U]++:(R.matches++,F--,R.dyn_ltree[2*(w[U]+h+1)]++,R.dyn_dtree[2*V(F)]++),R.last_lit===R.lit_bufsize-1},o._tr_align=function(R){oe(R,2,3),X(R,k,L),(function(F){F.bi_valid===16?(z(F,F.bi_buf),F.bi_buf=0,F.bi_valid=0):8<=F.bi_valid&&(F.pending_buf[F.pending++]=255&F.bi_buf,F.bi_buf>>=8,F.bi_valid-=8)})(R)}},{"../utils/common":41}],53:[function(n,r,o){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(s){(function(i,a){if(!i.setImmediate){var c,u,d,h,p=1,f={},g=!1,m=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(){b(S)})}:(function(){if(i.postMessage&&!i.importScripts){var S=!0,C=i.onmessage;return i.onmessage=function(){S=!1},i.postMessage("","*"),i.onmessage=C,S}})()?(h="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",k,!1):i.attachEvent("onmessage",k),function(S){i.postMessage(h+S,"*")}):i.MessageChannel?((d=new MessageChannel).port1.onmessage=function(S){b(S.data)},function(S){d.port2.postMessage(S)}):m&&"onreadystatechange"in m.createElement("script")?(u=m.documentElement,function(S){var C=m.createElement("script");C.onreadystatechange=function(){b(S),C.onreadystatechange=null,u.removeChild(C),C=null},u.appendChild(C)}):function(S){setTimeout(b,0,S)},x.setImmediate=function(S){typeof S!="function"&&(S=new Function(""+S));for(var C=new Array(arguments.length-1),j=0;j<C.length;j++)C[j]=arguments[j+1];var N={callback:S,args:C};return f[p]=N,c(p),p++},x.clearImmediate=y}function y(S){delete f[S]}function b(S){if(g)setTimeout(b,0,S);else{var C=f[S];if(C){g=!0;try{(function(j){var N=j.callback,T=j.args;switch(T.length){case 0:N();break;case 1:N(T[0]);break;case 2:N(T[0],T[1]);break;case 3:N(T[0],T[1],T[2]);break;default:N.apply(a,T)}})(C)}finally{y(S),g=!1}}}}function k(S){S.source===i&&typeof S.data=="string"&&S.data.indexOf(h)===0&&b(+S.data.slice(h.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof Lr<"u"?Lr:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(gs)),gs.exports}var Vv=Zv();const Wv=Ri(Vv);async function Hv(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 qv(e){const t=new Wv;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 a=await Hv(i.id);a!==null&&t.file(`#${i.id}.SSE.Response.json`,a)}));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)}const Kv="1.16.3",Gv={version:Kv};function dd(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=dd(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function fd(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=dd(e))&&(r&&(r+=" "),r+=t);return r}const Jv=(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},Yv=(e,t)=>({classGroupId:e,validator:t}),hd=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),po="-",fl=[],Xv="arbitrary..",Qv=e=>{const t=tb(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return eb(i);const a=i.split(po),c=a[0]===""&&a.length>1?1:0;return pd(a,c,t)},getConflictingClassGroupIds:(i,a)=>{if(a){const c=r[i],u=n[i];return c?u?Jv(u,c):c:u||fl}return n[i]||fl}}},pd=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);if(s){const u=pd(e,t+1,s);if(u)return u}const i=n.validators;if(i===null)return;const a=t===0?e.join(po):e.slice(t).join(po),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(a))return d.classGroupId}},eb=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?Xv+r:void 0})(),tb=e=>{const{theme:t,classGroups:n}=e;return nb(n,t)},nb=(e,t)=>{const n=hd();for(const r in e){const o=e[r];Gi(o,n,r,t)}return n},Gi=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const i=e[s];rb(i,t,n,r)}},rb=(e,t,n,r)=>{if(typeof e=="string"){ob(e,t,n);return}if(typeof e=="function"){sb(e,t,n,r);return}ib(e,t,n,r)},ob=(e,t,n)=>{const r=e===""?t:md(t,e);r.classGroupId=n},sb=(e,t,n,r)=>{if(ab(e)){Gi(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Yv(n,e))},ib=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let i=0;i<s;i++){const[a,c]=o[i];Gi(c,md(t,a),n,r)}},md=(e,t)=>{let n=e;const r=t.split(po),o=r.length;for(let s=0;s<o;s++){const i=r[s];let a=n.nextPart.get(i);a||(a=hd(),n.nextPart.set(i,a)),n=a}return n},ab=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,lb=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)}}},ei="!",hl=":",cb=[],pl=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),ub=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let i=0,a=0,c=0,u;const d=o.length;for(let m=0;m<d;m++){const x=o[m];if(i===0&&a===0){if(x===hl){s.push(o.slice(c,m)),c=m+1;continue}if(x==="/"){u=m;continue}}x==="["?i++:x==="]"?i--:x==="("?a++:x===")"&&a--}const h=s.length===0?o:o.slice(c);let p=h,f=!1;h.endsWith(ei)?(p=h.slice(0,-1),f=!0):h.startsWith(ei)&&(p=h.slice(1),f=!0);const g=u&&u>c?u-c:void 0;return pl(s,f,p,g)};if(t){const o=t+hl,s=r;r=i=>i.startsWith(o)?s(i.slice(o.length)):pl(cb,!1,i,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},db=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],a=i[0]==="[",c=t.has(i);a||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}},fb=e=>({cache:lb(e.cacheSize),parseClassName:ub(e),sortModifiers:db(e),...Qv(e)}),hb=/\s+/,pb=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,i=[],a=e.trim().split(hb);let c="";for(let u=a.length-1;u>=0;u-=1){const d=a[u],{isExternal:h,modifiers:p,hasImportantModifier:f,baseClassName:g,maybePostfixModifierPosition:m}=n(d);if(h){c=d+(c.length>0?" "+c:c);continue}let x=!!m,y=r(x?g.substring(0,m):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 b=p.length===0?"":p.length===1?p[0]:s(p).join(":"),k=f?b+ei:b,S=k+y;if(i.indexOf(S)>-1)continue;i.push(S);const C=o(y,x);for(let j=0;j<C.length;++j){const N=C[j];i.push(k+N)}c=d+(c.length>0?" "+c:c)}return c},mb=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=gd(n))&&(o&&(o+=" "),o+=r);return o},gd=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=gd(e[r]))&&(n&&(n+=" "),n+=t);return n},gb=(e,...t)=>{let n,r,o,s;const i=c=>{const u=t.reduce((d,h)=>h(d),e());return n=fb(u),r=n.cache.get,o=n.cache.set,s=a,a(c)},a=c=>{const u=r(c);if(u)return u;const d=pb(c,n);return o(c,d),d};return s=i,(...c)=>s(mb(...c))},xb=[],Ye=e=>{const t=n=>n[e]||xb;return t.isThemeGetter=!0,t},xd=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,yd=/^\((?:(\w[\w-]*):)?(.+)\)$/i,yb=/^\d+\/\d+$/,vb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,bb=/\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$/,wb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,kb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_b=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Sn=e=>yb.test(e),Ne=e=>!!e&&!Number.isNaN(Number(e)),Yt=e=>!!e&&Number.isInteger(Number(e)),xs=e=>e.endsWith("%")&&Ne(e.slice(0,-1)),Vt=e=>vb.test(e),Sb=()=>!0,Cb=e=>bb.test(e)&&!wb.test(e),vd=()=>!1,jb=e=>kb.test(e),Eb=e=>_b.test(e),Nb=e=>!pe(e)&&!me(e),Tb=e=>Qn(e,kd,vd),pe=e=>xd.test(e),dn=e=>Qn(e,_d,Cb),ys=e=>Qn(e,Pb,Ne),ml=e=>Qn(e,bd,vd),Ab=e=>Qn(e,wd,Eb),Zr=e=>Qn(e,Sd,jb),me=e=>yd.test(e),lr=e=>er(e,_d),Ib=e=>er(e,Ob),gl=e=>er(e,bd),zb=e=>er(e,kd),Rb=e=>er(e,wd),Vr=e=>er(e,Sd,!0),Qn=(e,t,n)=>{const r=xd.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},er=(e,t,n=!1)=>{const r=yd.exec(e);return r?r[1]?t(r[1]):n:!1},bd=e=>e==="position"||e==="percentage",wd=e=>e==="image"||e==="url",kd=e=>e==="length"||e==="size"||e==="bg-size",_d=e=>e==="length",Pb=e=>e==="number",Ob=e=>e==="family-name",Sd=e=>e==="shadow",Db=()=>{const e=Ye("color"),t=Ye("font"),n=Ye("text"),r=Ye("font-weight"),o=Ye("tracking"),s=Ye("leading"),i=Ye("breakpoint"),a=Ye("container"),c=Ye("spacing"),u=Ye("radius"),d=Ye("shadow"),h=Ye("inset-shadow"),p=Ye("text-shadow"),f=Ye("drop-shadow"),g=Ye("blur"),m=Ye("perspective"),x=Ye("aspect"),y=Ye("ease"),b=Ye("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"],C=()=>[...S(),me,pe],j=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],T=()=>[me,pe,c],A=()=>[Sn,"full","auto",...T()],O=()=>[Yt,"none","subgrid",me,pe],L=()=>["auto",{span:["full",Yt,me,pe]},Yt,me,pe],E=()=>[Yt,"auto",me,pe],M=()=>["auto","min","max","fr",me,pe],w=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],D=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...T()],B=()=>[Sn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],q=()=>[e,me,pe],Y=()=>[...S(),gl,ml,{position:[me,pe]}],I=()=>["no-repeat",{repeat:["","x","y","space","round"]}],W=()=>["auto","cover","contain",zb,Tb,{size:[me,pe]}],V=()=>[xs,lr,dn],z=()=>["","none","full",u,me,pe],oe=()=>["",Ne,lr,dn],X=()=>["solid","dashed","dotted","double"],de=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],te=()=>[Ne,xs,gl,ml],ce=()=>["","none",g,me,pe],fe=()=>["none",Ne,me,pe],ge=()=>["none",Ne,me,pe],xe=()=>[Ne,me,pe],Ee=()=>[Sn,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Vt],breakpoint:[Vt],color:[Sb],container:[Vt],"drop-shadow":[Vt],ease:["in","out","in-out"],font:[Nb],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Vt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Vt],shadow:[Vt],spacing:["px",Ne],text:[Vt],"text-shadow":[Vt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Sn,pe,me,x]}],container:["container"],columns:[{columns:[Ne,pe,me,a]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{start:A()}],end:[{end:A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[Yt,"auto",me,pe]}],basis:[{basis:[Sn,"full","auto",a,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ne,Sn,"auto","initial","none",pe]}],grow:[{grow:["",Ne,me,pe]}],shrink:[{shrink:["",Ne,me,pe]}],order:[{order:[Yt,"first","last","none",me,pe]}],"grid-cols":[{"grid-cols":O()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":M()}],"auto-rows":[{"auto-rows":M()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...w(),"normal"]}],"justify-items":[{"justify-items":[...D(),"normal"]}],"justify-self":[{"justify-self":["auto",...D()]}],"align-content":[{content:["normal",...w()]}],"align-items":[{items:[...D(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...D(),{baseline:["","last"]}]}],"place-content":[{"place-content":w()}],"place-items":[{"place-items":[...D(),"baseline"]}],"place-self":[{"place-self":["auto",...D()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:B()}],w:[{w:[a,"screen",...B()]}],"min-w":[{"min-w":[a,"screen","none",...B()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[i]},...B()]}],h:[{h:["screen","lh",...B()]}],"min-h":[{"min-h":["screen","lh","none",...B()]}],"max-h":[{"max-h":["screen","lh",...B()]}],"font-size":[{text:["base",n,lr,dn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,me,ys]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",xs,pe]}],"font-family":[{font:[Ib,pe,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,me,pe]}],"line-clamp":[{"line-clamp":[Ne,"none",me,ys]}],leading:[{leading:[s,...T()]}],"list-image":[{"list-image":["none",me,pe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",me,pe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:q()}],"text-color":[{text:q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...X(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ne,"from-font","auto",me,dn]}],"text-decoration-color":[{decoration:q()}],"underline-offset":[{"underline-offset":[Ne,"auto",me,pe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",me,pe]}],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",me,pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Y()}],"bg-repeat":[{bg:I()}],"bg-size":[{bg:W()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Yt,me,pe],radial:["",me,pe],conic:[Yt,me,pe]},Rb,Ab]}],"bg-color":[{bg:q()}],"gradient-from-pos":[{from:V()}],"gradient-via-pos":[{via:V()}],"gradient-to-pos":[{to:V()}],"gradient-from":[{from:q()}],"gradient-via":[{via:q()}],"gradient-to":[{to:q()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...X(),"hidden","none"]}],"divide-style":[{divide:[...X(),"hidden","none"]}],"border-color":[{border:q()}],"border-color-x":[{"border-x":q()}],"border-color-y":[{"border-y":q()}],"border-color-s":[{"border-s":q()}],"border-color-e":[{"border-e":q()}],"border-color-t":[{"border-t":q()}],"border-color-r":[{"border-r":q()}],"border-color-b":[{"border-b":q()}],"border-color-l":[{"border-l":q()}],"divide-color":[{divide:q()}],"outline-style":[{outline:[...X(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ne,me,pe]}],"outline-w":[{outline:["",Ne,lr,dn]}],"outline-color":[{outline:q()}],shadow:[{shadow:["","none",d,Vr,Zr]}],"shadow-color":[{shadow:q()}],"inset-shadow":[{"inset-shadow":["none",h,Vr,Zr]}],"inset-shadow-color":[{"inset-shadow":q()}],"ring-w":[{ring:oe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:q()}],"ring-offset-w":[{"ring-offset":[Ne,dn]}],"ring-offset-color":[{"ring-offset":q()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":q()}],"text-shadow":[{"text-shadow":["none",p,Vr,Zr]}],"text-shadow-color":[{"text-shadow":q()}],opacity:[{opacity:[Ne,me,pe]}],"mix-blend":[{"mix-blend":[...de(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":de()}],"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":[Ne]}],"mask-image-linear-from-pos":[{"mask-linear-from":te()}],"mask-image-linear-to-pos":[{"mask-linear-to":te()}],"mask-image-linear-from-color":[{"mask-linear-from":q()}],"mask-image-linear-to-color":[{"mask-linear-to":q()}],"mask-image-t-from-pos":[{"mask-t-from":te()}],"mask-image-t-to-pos":[{"mask-t-to":te()}],"mask-image-t-from-color":[{"mask-t-from":q()}],"mask-image-t-to-color":[{"mask-t-to":q()}],"mask-image-r-from-pos":[{"mask-r-from":te()}],"mask-image-r-to-pos":[{"mask-r-to":te()}],"mask-image-r-from-color":[{"mask-r-from":q()}],"mask-image-r-to-color":[{"mask-r-to":q()}],"mask-image-b-from-pos":[{"mask-b-from":te()}],"mask-image-b-to-pos":[{"mask-b-to":te()}],"mask-image-b-from-color":[{"mask-b-from":q()}],"mask-image-b-to-color":[{"mask-b-to":q()}],"mask-image-l-from-pos":[{"mask-l-from":te()}],"mask-image-l-to-pos":[{"mask-l-to":te()}],"mask-image-l-from-color":[{"mask-l-from":q()}],"mask-image-l-to-color":[{"mask-l-to":q()}],"mask-image-x-from-pos":[{"mask-x-from":te()}],"mask-image-x-to-pos":[{"mask-x-to":te()}],"mask-image-x-from-color":[{"mask-x-from":q()}],"mask-image-x-to-color":[{"mask-x-to":q()}],"mask-image-y-from-pos":[{"mask-y-from":te()}],"mask-image-y-to-pos":[{"mask-y-to":te()}],"mask-image-y-from-color":[{"mask-y-from":q()}],"mask-image-y-to-color":[{"mask-y-to":q()}],"mask-image-radial":[{"mask-radial":[me,pe]}],"mask-image-radial-from-pos":[{"mask-radial-from":te()}],"mask-image-radial-to-pos":[{"mask-radial-to":te()}],"mask-image-radial-from-color":[{"mask-radial-from":q()}],"mask-image-radial-to-color":[{"mask-radial-to":q()}],"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":[Ne]}],"mask-image-conic-from-pos":[{"mask-conic-from":te()}],"mask-image-conic-to-pos":[{"mask-conic-to":te()}],"mask-image-conic-from-color":[{"mask-conic-from":q()}],"mask-image-conic-to-color":[{"mask-conic-to":q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Y()}],"mask-repeat":[{mask:I()}],"mask-size":[{mask:W()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",me,pe]}],filter:[{filter:["","none",me,pe]}],blur:[{blur:ce()}],brightness:[{brightness:[Ne,me,pe]}],contrast:[{contrast:[Ne,me,pe]}],"drop-shadow":[{"drop-shadow":["","none",f,Vr,Zr]}],"drop-shadow-color":[{"drop-shadow":q()}],grayscale:[{grayscale:["",Ne,me,pe]}],"hue-rotate":[{"hue-rotate":[Ne,me,pe]}],invert:[{invert:["",Ne,me,pe]}],saturate:[{saturate:[Ne,me,pe]}],sepia:[{sepia:["",Ne,me,pe]}],"backdrop-filter":[{"backdrop-filter":["","none",me,pe]}],"backdrop-blur":[{"backdrop-blur":ce()}],"backdrop-brightness":[{"backdrop-brightness":[Ne,me,pe]}],"backdrop-contrast":[{"backdrop-contrast":[Ne,me,pe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ne,me,pe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ne,me,pe]}],"backdrop-invert":[{"backdrop-invert":["",Ne,me,pe]}],"backdrop-opacity":[{"backdrop-opacity":[Ne,me,pe]}],"backdrop-saturate":[{"backdrop-saturate":[Ne,me,pe]}],"backdrop-sepia":[{"backdrop-sepia":["",Ne,me,pe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",me,pe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ne,"initial",me,pe]}],ease:[{ease:["linear","initial",y,me,pe]}],delay:[{delay:[Ne,me,pe]}],animate:[{animate:["none",b,me,pe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,me,pe]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:fe()}],"rotate-x":[{"rotate-x":fe()}],"rotate-y":[{"rotate-y":fe()}],"rotate-z":[{"rotate-z":fe()}],scale:[{scale:ge()}],"scale-x":[{"scale-x":ge()}],"scale-y":[{"scale-y":ge()}],"scale-z":[{"scale-z":ge()}],"scale-3d":["scale-3d"],skew:[{skew:xe()}],"skew-x":[{"skew-x":xe()}],"skew-y":[{"skew-y":xe()}],transform:[{transform:[me,pe,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ee()}],"translate-x":[{"translate-x":Ee()}],"translate-y":[{"translate-y":Ee()}],"translate-z":[{"translate-z":Ee()}],"translate-none":["translate-none"],accent:[{accent:q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:q()}],"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",me,pe]}],"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":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"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",me,pe]}],fill:[{fill:["none",...q()]}],"stroke-w":[{stroke:[Ne,lr,dn,ys]}],stroke:[{stroke:["none",...q()]}],"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"]}},Mb=gb(Db);function he(...e){return Mb(fd(e))}function qe(e){return e>=1048576?(e/1048576).toFixed(1).replace(/\.0$/,"")+"M":e>=1024?(e/1024).toFixed(1).replace(/\.0$/,"")+"K":e.toString()}function Cd(e){return e===null?"pending":e>=200&&e<300?"success":e>=400&&e<500?"client_error":e>=500?"server_error":"pending"}const xl=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,yl=fd,Ji=(e,t)=>n=>{var r;if(t?.variants==null)return yl(e,n?.class,n?.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(u=>{const d=n?.[u],h=s?.[u];if(d===null)return null;const p=xl(d)||xl(h);return o[u][p]}),a=n&&Object.entries(n).reduce((u,d)=>{let[h,p]=d;return p===void 0||(u[h]=p),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:h,className:p,...f}=d;return Object.entries(f).every(g=>{let[m,x]=g;return Array.isArray(x)?x.includes({...s,...a}[m]):{...s,...a}[m]===x})?[...u,h,p]:u},[]);return yl(e,i,c,n?.class,n?.className)};function vl(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function jd(...e){return t=>{let n=!1;const r=e.map(o=>{const s=vl(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():vl(e[o],null)}}}}function Re(...e){return v.useCallback(jd(...e),e)}function Wn(e){const t=Fb(e),n=v.forwardRef((r,o)=>{const{children:s,...i}=r,a=v.Children.toArray(s),c=a.find(Bb);if(c){const u=c.props.children,d=a.map(h=>h===c?v.Children.count(u)>1?v.Children.only(null):v.isValidElement(u)?u.props.children:null:h);return l.jsx(t,{...i,ref:o,children:v.isValidElement(u)?v.cloneElement(u,void 0,d):null})}return l.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var Lb=Wn("Slot");function Fb(e){const t=v.forwardRef((n,r)=>{const{children:o,...s}=n;if(v.isValidElement(o)){const i=Zb(o),a=Ub(s,o.props);return o.type!==v.Fragment&&(a.ref=r?jd(r,i):i),v.cloneElement(o,a)}return v.Children.count(o)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ed=Symbol("radix.slottable");function $b(e){const t=({children:n})=>l.jsx(l.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Ed,t}function Bb(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ed}function Ub(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]=(...a)=>{const c=s(...a);return o(...a),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Zb(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 Vb=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ce=Vb.reduce((e,t)=>{const n=Wn(`Primitive.${t}`),r=v.forwardRef((o,s)=>{const{asChild:i,...a}=o,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Wb(e,t){e&&Tr.flushSync(()=>e.dispatchEvent(t))}var Nd=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"}),Hb="VisuallyHidden",Td=v.forwardRef((e,t)=>l.jsx(Ce.span,{...e,ref:t,style:{...Nd,...e.style}}));Td.displayName=Hb;var qb=Td;function Kb(e,t){const n=v.createContext(t),r=s=>{const{children:i,...a}=s,c=v.useMemo(()=>a,Object.values(a));return l.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 Jt(e,t=[]){let n=[];function r(s,i){const a=v.createContext(i),c=n.length;n=[...n,i];const u=h=>{const{scope:p,children:f,...g}=h,m=p?.[e]?.[c]||a,x=v.useMemo(()=>g,Object.values(g));return l.jsx(m.Provider,{value:x,children:f})};u.displayName=s+"Provider";function d(h,p){const f=p?.[e]?.[c]||a,g=v.useContext(f);if(g)return g;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${s}\``)}return[u,d]}const o=()=>{const s=n.map(i=>v.createContext(i));return function(a){const c=a?.[e]||s;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,Gb(o,...t)]}function Gb(...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((a,{useScope:c,scopeName:u})=>{const h=c(s)[`__scope${u}`];return{...a,...h}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function Ad(e){const t=e+"CollectionProvider",[n,r]=Jt(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=m=>{const{scope:x,children:y}=m,b=at.useRef(null),k=at.useRef(new Map).current;return l.jsx(o,{scope:x,itemMap:k,collectionRef:b,children:y})};i.displayName=t;const a=e+"CollectionSlot",c=Wn(a),u=at.forwardRef((m,x)=>{const{scope:y,children:b}=m,k=s(a,y),S=Re(x,k.collectionRef);return l.jsx(c,{ref:S,children:b})});u.displayName=a;const d=e+"CollectionItemSlot",h="data-radix-collection-item",p=Wn(d),f=at.forwardRef((m,x)=>{const{scope:y,children:b,...k}=m,S=at.useRef(null),C=Re(x,S),j=s(d,y);return at.useEffect(()=>(j.itemMap.set(S,{ref:S,...k}),()=>{j.itemMap.delete(S)})),l.jsx(p,{[h]:"",ref:C,children:b})});f.displayName=d;function g(m){const x=s(e+"CollectionConsumer",m);return at.useCallback(()=>{const b=x.collectionRef.current;if(!b)return[];const k=Array.from(b.querySelectorAll(`[${h}]`));return Array.from(x.itemMap.values()).sort((j,N)=>k.indexOf(j.ref.current)-k.indexOf(N.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:u,ItemSlot:f},g,r]}function we(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}var et=globalThis?.document?v.useLayoutEffect:()=>{},Jb=cu[" useInsertionEffect ".trim().toString()]||et;function pn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=Yb({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:o;{const d=v.useRef(e!==void 0);v.useEffect(()=>{const h=d.current;h!==a&&console.warn(`${r} is changing from ${h?"controlled":"uncontrolled"} to ${a?"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=a},[a,r])}const u=v.useCallback(d=>{if(a){const h=Xb(d)?d(e):d;h!==e&&i.current?.(h)}else s(d)},[a,e,s,i]);return[c,u]}function Yb({defaultProp:e,onChange:t}){const[n,r]=v.useState(e),o=v.useRef(n),s=v.useRef(t);return Jb(()=>{s.current=t},[t]),v.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}function Xb(e){return typeof e=="function"}function Qb(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var kt=e=>{const{present:t,children:n}=e,r=e2(t),o=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),s=Re(r.ref,t2(o));return typeof n=="function"||r.isPresent?v.cloneElement(o,{ref:s}):null};kt.displayName="Presence";function e2(e){const[t,n]=v.useState(),r=v.useRef(null),o=v.useRef(e),s=v.useRef("none"),i=e?"mounted":"unmounted",[a,c]=Qb(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=Wr(r.current);s.current=a==="mounted"?u:"none"},[a]),et(()=>{const u=r.current,d=o.current;if(d!==e){const p=s.current,f=Wr(u);e?c("MOUNT"):f==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&p!==f?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),et(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,h=f=>{const m=Wr(r.current).includes(CSS.escape(f.animationName));if(f.target===t&&m&&(c("ANIMATION_END"),!o.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},p=f=>{f.target===t&&(s.current=Wr(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:v.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function Wr(e){return e?.animationName||"none"}function t2(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 n2=cu[" useId ".trim().toString()]||(()=>{}),r2=0;function Dt(e){const[t,n]=v.useState(n2());return et(()=>{n(r=>r??String(r2++))},[e]),e||(t?`radix-${t}`:"")}var Lo="Collapsible",[o2]=Jt(Lo),[s2,Yi]=o2(Lo),Id=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:i,...a}=e,[c,u]=pn({prop:r,defaultProp:o??!1,onChange:i,caller:Lo});return l.jsx(s2,{scope:n,disabled:s,contentId:Dt(),open:c,onOpenToggle:v.useCallback(()=>u(d=>!d),[u]),children:l.jsx(Ce.div,{"data-state":Qi(c),"data-disabled":s?"":void 0,...a,ref:t})})});Id.displayName=Lo;var zd="CollapsibleTrigger",Rd=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=Yi(zd,n);return l.jsx(Ce.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":Qi(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:we(e.onClick,o.onOpenToggle)})});Rd.displayName=zd;var Xi="CollapsibleContent",Pd=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Yi(Xi,e.__scopeCollapsible);return l.jsx(kt,{present:n||o.open,children:({present:s})=>l.jsx(i2,{...r,ref:t,present:s})})});Pd.displayName=Xi;var i2=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=e,i=Yi(Xi,n),[a,c]=v.useState(r),u=v.useRef(null),d=Re(t,u),h=v.useRef(0),p=h.current,f=v.useRef(0),g=f.current,m=i.open||a,x=v.useRef(m),y=v.useRef(void 0);return v.useEffect(()=>{const b=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(b)},[]),et(()=>{const b=u.current;if(b){y.current=y.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const k=b.getBoundingClientRect();h.current=k.height,f.current=k.width,x.current||(b.style.transitionDuration=y.current.transitionDuration,b.style.animationName=y.current.animationName),c(r)}},[i.open,r]),l.jsx(Ce.div,{"data-state":Qi(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!m,...s,ref:d,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:m&&o})});function Qi(e){return e?"open":"closed"}var a2=Id,l2=v.createContext(void 0);function Fo(e){const t=v.useContext(l2);return e||t||"ltr"}function st(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>t.current?.(...n),[])}function c2(e,t=globalThis?.document){const n=st(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 u2="DismissableLayer",ti="dismissableLayer.update",d2="dismissableLayer.pointerDownOutside",f2="dismissableLayer.focusOutside",bl,Od=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),$o=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...c}=e,u=v.useContext(Od),[d,h]=v.useState(null),p=d?.ownerDocument??globalThis?.document,[,f]=v.useState({}),g=Re(t,N=>h(N)),m=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(x),b=d?m.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,S=b>=y,C=m2(N=>{const T=N.target,A=[...u.branches].some(O=>O.contains(T));!S||A||(o?.(N),i?.(N),N.defaultPrevented||a?.())},p),j=g2(N=>{const T=N.target;[...u.branches].some(O=>O.contains(T))||(s?.(N),i?.(N),N.defaultPrevented||a?.())},p);return c2(N=>{b===u.layers.size-1&&(r?.(N),!N.defaultPrevented&&a&&(N.preventDefault(),a()))},p),v.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(bl=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),wl(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=bl)}},[d,p,n,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),wl())},[d,u]),v.useEffect(()=>{const N=()=>f({});return document.addEventListener(ti,N),()=>document.removeEventListener(ti,N)},[]),l.jsx(Ce.div,{...c,ref:g,style:{pointerEvents:k?S?"auto":"none":void 0,...e.style},onFocusCapture:we(e.onFocusCapture,j.onFocusCapture),onBlurCapture:we(e.onBlurCapture,j.onBlurCapture),onPointerDownCapture:we(e.onPointerDownCapture,C.onPointerDownCapture)})});$o.displayName=u2;var h2="DismissableLayerBranch",p2=v.forwardRef((e,t)=>{const n=v.useContext(Od),r=v.useRef(null),o=Re(t,r);return v.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),l.jsx(Ce.div,{...e,ref:o})});p2.displayName=h2;function m2(e,t=globalThis?.document){const n=st(e),r=v.useRef(!1),o=v.useRef(()=>{});return v.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let c=function(){Dd(d2,n,u,{discrete:!0})};const u={originalEvent:a};a.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 g2(e,t=globalThis?.document){const n=st(e),r=v.useRef(!1);return v.useEffect(()=>{const o=s=>{s.target&&!r.current&&Dd(f2,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 wl(){const e=new CustomEvent(ti);document.dispatchEvent(e)}function Dd(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?Wb(o,s):o.dispatchEvent(s)}var vs="focusScope.autoFocusOnMount",bs="focusScope.autoFocusOnUnmount",kl={bubbles:!1,cancelable:!0},x2="FocusScope",ea=v.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[a,c]=v.useState(null),u=st(o),d=st(s),h=v.useRef(null),p=Re(t,m=>c(m)),f=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let m=function(k){if(f.paused||!a)return;const S=k.target;a.contains(S)?h.current=S:Qt(h.current,{select:!0})},x=function(k){if(f.paused||!a)return;const S=k.relatedTarget;S!==null&&(a.contains(S)||Qt(h.current,{select:!0}))},y=function(k){if(document.activeElement===document.body)for(const C of k)C.removedNodes.length>0&&Qt(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",x);const b=new MutationObserver(y);return a&&b.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",x),b.disconnect()}}},[r,a,f.paused]),v.useEffect(()=>{if(a){Sl.add(f);const m=document.activeElement;if(!a.contains(m)){const y=new CustomEvent(vs,kl);a.addEventListener(vs,u),a.dispatchEvent(y),y.defaultPrevented||(y2(_2(Md(a)),{select:!0}),document.activeElement===m&&Qt(a))}return()=>{a.removeEventListener(vs,u),setTimeout(()=>{const y=new CustomEvent(bs,kl);a.addEventListener(bs,d),a.dispatchEvent(y),y.defaultPrevented||Qt(m??document.body,{select:!0}),a.removeEventListener(bs,d),Sl.remove(f)},0)}}},[a,u,d,f]);const g=v.useCallback(m=>{if(!n&&!r||f.paused)return;const x=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(x&&y){const b=m.currentTarget,[k,S]=v2(b);k&&S?!m.shiftKey&&y===S?(m.preventDefault(),n&&Qt(k,{select:!0})):m.shiftKey&&y===k&&(m.preventDefault(),n&&Qt(S,{select:!0})):y===b&&m.preventDefault()}},[n,r,f.paused]);return l.jsx(Ce.div,{tabIndex:-1,...i,ref:p,onKeyDown:g})});ea.displayName=x2;function y2(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Qt(r,{select:t}),document.activeElement!==n)return}function v2(e){const t=Md(e),n=_l(t,e),r=_l(t.reverse(),e);return[n,r]}function Md(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 _l(e,t){for(const n of e)if(!b2(n,{upTo:t}))return n}function b2(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 w2(e){return e instanceof HTMLInputElement&&"select"in e}function Qt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&w2(e)&&t&&e.select()}}var Sl=k2();function k2(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Cl(e,t),e.unshift(t)},remove(t){e=Cl(e,t),e[0]?.resume()}}}function Cl(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function _2(e){return e.filter(t=>t.tagName!=="A")}var S2="Portal",Bo=v.forwardRef((e,t)=>{const{container:n,...r}=e,[o,s]=v.useState(!1);et(()=>s(!0),[]);const i=n||o&&globalThis?.document?.body;return i?Kp.createPortal(l.jsx(Ce.div,{...r,ref:t}),i):null});Bo.displayName=S2;var ws=0;function Ld(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??jl()),document.body.insertAdjacentElement("beforeend",e[1]??jl()),ws++,()=>{ws===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),ws--}},[])}function jl(){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 Rt=function(){return Rt=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},Rt.apply(this,arguments)};function Fd(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 C2(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 ro="right-scroll-bar-position",oo="width-before-scroll-bar",j2="with-scroll-bars-hidden",E2="--removed-body-scroll-bar-size";function ks(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function N2(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 T2=typeof window<"u"?v.useLayoutEffect:v.useEffect,El=new WeakMap;function A2(e,t){var n=N2(null,function(r){return e.forEach(function(o){return ks(o,r)})});return T2(function(){var r=El.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(a){s.has(a)||ks(a,null)}),s.forEach(function(a){o.has(a)||ks(a,i)})}El.set(n,e)},[e]),n}function I2(e){return e}function z2(e,t){t===void 0&&(t=I2);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(a){return a!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var a=n;n=[],a.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 R2(e){e===void 0&&(e={});var t=z2(null);return t.options=Rt({async:!0,ssr:!1},e),t}var $d=function(e){var t=e.sideCar,n=Fd(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,Rt({},n))};$d.isSideCarExport=!0;function P2(e,t){return e.useMedium(t),$d}var Bd=R2(),_s=function(){},Uo=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:_s,onWheelCapture:_s,onTouchMoveCapture:_s}),o=r[0],s=r[1],i=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,h=e.shards,p=e.sideCar,f=e.noRelative,g=e.noIsolation,m=e.inert,x=e.allowPinchZoom,y=e.as,b=y===void 0?"div":y,k=e.gapMode,S=Fd(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=p,j=A2([n,t]),N=Rt(Rt({},S),o);return v.createElement(v.Fragment,null,d&&v.createElement(C,{sideCar:Bd,removeScrollBar:u,shards:h,noRelative:f,noIsolation:g,inert:m,setCallbacks:s,allowPinchZoom:!!x,lockRef:n,gapMode:k}),i?v.cloneElement(v.Children.only(a),Rt(Rt({},N),{ref:j})):v.createElement(b,Rt({},N,{className:c,ref:j}),a))});Uo.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Uo.classNames={fullWidth:oo,zeroRight:ro};var O2=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function D2(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=O2();return t&&e.setAttribute("nonce",t),e}function M2(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function L2(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var F2=function(){var e=0,t=null;return{add:function(n){e==0&&(t=D2())&&(M2(t,n),L2(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},$2=function(){var e=F2();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ud=function(){var e=$2(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},B2={left:0,top:0,right:0,gap:0},Ss=function(e){return parseInt(e||"",10)||0},U2=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[Ss(n),Ss(r),Ss(o)]},Z2=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return B2;var t=U2(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])}},V2=Ud(),Mn="data-scroll-locked",W2=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),`
41
- .`.concat(j2,` {
39
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const a=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(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function Mu(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 a=e.seen.get(i);if(a.ref===null)return;const c=a.def??a.schema,u={...c},d=a.ref;if(a.ref=null,d){r(d);const p=e.seen.get(d),f=p.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(f)):Object.assign(c,f),Object.assign(c,u),i._zod.parent===d)for(const m in c)m==="$ref"||m==="allOf"||m in u||delete c[m];if(f.$ref&&p.def)for(const m in c)m==="$ref"||m==="allOf"||m in p.def&&JSON.stringify(c[m])===JSON.stringify(p.def[m])&&delete c[m]}const h=i._zod.parent;if(h&&h!==d){r(h);const p=e.seen.get(h);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(const f in c)f==="$ref"||f==="allOf"||f in p.def&&JSON.stringify(c[f])===JSON.stringify(p.def[f])&&delete c[f]}e.override({zodSchema:i,jsonSchema:c,path:a.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 a=i[1];a.def&&a.defId&&(s[a.defId]=a.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:ho(t,"input",e.processors),output:ho(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function ot(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 ot(r.element,n);if(r.type==="set")return ot(r.valueType,n);if(r.type==="lazy")return ot(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 ot(r.innerType,n);if(r.type==="intersection")return ot(r.left,n)||ot(r.right,n);if(r.type==="record"||r.type==="map")return ot(r.keyType,n)||ot(r.valueType,n);if(r.type==="pipe")return ot(r.in,n)||ot(r.out,n);if(r.type==="object"){for(const o in r.shape)if(ot(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(ot(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(ot(o,n))return!0;return!!(r.rest&&ot(r.rest,n))}return!1}const e0=(e,t={})=>n=>{const r=Ou({...n,processors:t});return Ke(e,r),Du(r,e),Mu(r,e)},ho=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=Ou({...o??{},target:s,io:t,processors:n});return Ke(e,i),Du(i,e),Mu(i,e)},t0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},n0=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=t0[a]??a,o.format===""&&delete o.format,a==="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(h=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},r0=(e,t,n,r)=>{const o=n,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;typeof a=="string"&&a.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)},o0=(e,t,n,r)=>{n.type="boolean"},s0=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},i0=(e,t,n,r)=>{n.not={}},a0=(e,t,n,r)=>{},l0=(e,t,n,r)=>{const o=e._zod.def,s=pu(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},c0=(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},u0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},d0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},f0=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=Ke(s.element,t,{...r,path:[...r.path,"items"]})},h0=(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]=Ke(i[u],t,{...r,path:[...r.path,"properties",u]});const a=new Set(Object.keys(i)),c=new Set([...a].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=Ke(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},p0=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>Ke(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},m0=(e,t,n,r)=>{const o=e._zod.def,s=Ke(o.left,t,{...r,path:[...r.path,"allOf",0]}),i=Ke(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];n.allOf=c},g0=(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=Ke(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const h of c)o.patternProperties[h.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Ke(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Ke(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=i._zod.values;if(u){const d=[...u].filter(h=>typeof h=="string"||typeof h=="number");d.length>0&&(o.required=d)}},x0=(e,t,n,r)=>{const o=e._zod.def,s=Ke(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"}]},y0=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},v0=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},b0=(e,t,n,r)=>{const o=e._zod.def;Ke(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)))},w0=(e,t,n,r)=>{const o=e._zod.def;Ke(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},k0=(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;Ke(s,t,r);const i=t.seen.get(e);i.ref=s},_0=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},Lu=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},S0=(e,t,n,r)=>{const o=e._zod.innerType;Ke(o,t,r);const s=t.seen.get(e);s.ref=o},C0=Q("ZodISODateTime",(e,t)=>{wg.init(e,t),He.init(e,t)});function j0(e){return Tx(C0,e)}const E0=Q("ZodISODate",(e,t)=>{kg.init(e,t),He.init(e,t)});function N0(e){return Ax(E0,e)}const T0=Q("ZodISOTime",(e,t)=>{_g.init(e,t),He.init(e,t)});function A0(e){return Ix(T0,e)}const I0=Q("ZodISODuration",(e,t)=>{Sg.init(e,t),He.init(e,t)});function z0(e){return zx(I0,e)}const P0=(e,t)=>{yu.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>hm(e,n)},flatten:{value:n=>fm(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Ks,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Ks,2)}},isEmpty:{get(){return e.issues.length===0}}})},wt=Q("ZodError",P0,{Parent:Error}),R0=Li(wt),O0=Fi(wt),D0=Oo(wt),M0=Do(wt),L0=gm(wt),F0=xm(wt),$0=ym(wt),B0=vm(wt),U0=bm(wt),Z0=wm(wt),V0=km(wt),H0=_m(wt),Ue=Q("ZodType",(e,t)=>(Be.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ho(e,"input"),output:ho(e,"output")}}),e.toJSONSchema=e0(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(on(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)=>sn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>R0(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>D0(e,n,r),e.parseAsync=async(n,r)=>O0(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>M0(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>L0(e,n,r),e.decode=(n,r)=>F0(e,n,r),e.encodeAsync=async(n,r)=>$0(e,n,r),e.decodeAsync=async(n,r)=>B0(e,n,r),e.safeEncode=(n,r)=>U0(e,n,r),e.safeDecode=(n,r)=>Z0(e,n,r),e.safeEncodeAsync=async(n,r)=>V0(e,n,r),e.safeDecodeAsync=async(n,r)=>H0(e,n,r),e.refine=(n,r)=>e.check(B1(n,r)),e.superRefine=n=>e.check(U1(n)),e.overwrite=n=>e.check(Gn(n)),e.optional=()=>sl(e),e.exactOptional=()=>j1(e),e.nullable=()=>il(e),e.nullish=()=>sl(il(e)),e.nonoptional=n=>z1(e,n),e.array=()=>Re(e),e.or=n=>Kt([e,n]),e.and=n=>b1(e,n),e.transform=n=>al(e,S1(n)),e.default=n=>T1(e,n),e.prefault=n=>I1(e,n),e.catch=n=>R1(e,n),e.pipe=n=>al(e,n),e.readonly=()=>M1(e),e.describe=n=>{const r=e.clone();return mr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return mr.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return mr.get(e);const r=e.clone();return mr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Fu=Q("_ZodString",(e,t)=>{$i.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>n0(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(Fx(...r)),e.includes=(...r)=>e.check(Ux(...r)),e.startsWith=(...r)=>e.check(Zx(...r)),e.endsWith=(...r)=>e.check(Vx(...r)),e.min=(...r)=>e.check(fo(...r)),e.max=(...r)=>e.check(Pu(...r)),e.length=(...r)=>e.check(Ru(...r)),e.nonempty=(...r)=>e.check(fo(1,...r)),e.lowercase=r=>e.check($x(r)),e.uppercase=r=>e.check(Bx(r)),e.trim=()=>e.check(Wx()),e.normalize=(...r)=>e.check(Hx(...r)),e.toLowerCase=()=>e.check(qx()),e.toUpperCase=()=>e.check(Kx()),e.slugify=()=>e.check(Jx())}),W0=Q("ZodString",(e,t)=>{$i.init(e,t),Fu.init(e,t),e.email=n=>e.check(lx(q0,n)),e.url=n=>e.check(hx(K0,n)),e.jwt=n=>e.check(Nx(c1,n)),e.emoji=n=>e.check(px(J0,n)),e.guid=n=>e.check(Xa(nl,n)),e.uuid=n=>e.check(cx(Ur,n)),e.uuidv4=n=>e.check(ux(Ur,n)),e.uuidv6=n=>e.check(dx(Ur,n)),e.uuidv7=n=>e.check(fx(Ur,n)),e.nanoid=n=>e.check(mx(G0,n)),e.guid=n=>e.check(Xa(nl,n)),e.cuid=n=>e.check(gx(Y0,n)),e.cuid2=n=>e.check(xx(X0,n)),e.ulid=n=>e.check(yx(Q0,n)),e.base64=n=>e.check(Cx(i1,n)),e.base64url=n=>e.check(jx(a1,n)),e.xid=n=>e.check(vx(e1,n)),e.ksuid=n=>e.check(bx(t1,n)),e.ipv4=n=>e.check(wx(n1,n)),e.ipv6=n=>e.check(kx(r1,n)),e.cidrv4=n=>e.check(_x(o1,n)),e.cidrv6=n=>e.check(Sx(s1,n)),e.e164=n=>e.check(Ex(l1,n)),e.datetime=n=>e.check(j0(n)),e.date=n=>e.check(N0(n)),e.time=n=>e.check(A0(n)),e.duration=n=>e.check(z0(n))});function K(e){return ax(W0,e)}const He=Q("ZodStringFormat",(e,t)=>{Ze.init(e,t),Fu.init(e,t)}),q0=Q("ZodEmail",(e,t)=>{fg.init(e,t),He.init(e,t)}),nl=Q("ZodGUID",(e,t)=>{ug.init(e,t),He.init(e,t)}),Ur=Q("ZodUUID",(e,t)=>{dg.init(e,t),He.init(e,t)}),K0=Q("ZodURL",(e,t)=>{hg.init(e,t),He.init(e,t)}),J0=Q("ZodEmoji",(e,t)=>{pg.init(e,t),He.init(e,t)}),G0=Q("ZodNanoID",(e,t)=>{mg.init(e,t),He.init(e,t)}),Y0=Q("ZodCUID",(e,t)=>{gg.init(e,t),He.init(e,t)}),X0=Q("ZodCUID2",(e,t)=>{xg.init(e,t),He.init(e,t)}),Q0=Q("ZodULID",(e,t)=>{yg.init(e,t),He.init(e,t)}),e1=Q("ZodXID",(e,t)=>{vg.init(e,t),He.init(e,t)}),t1=Q("ZodKSUID",(e,t)=>{bg.init(e,t),He.init(e,t)}),n1=Q("ZodIPv4",(e,t)=>{Cg.init(e,t),He.init(e,t)}),r1=Q("ZodIPv6",(e,t)=>{jg.init(e,t),He.init(e,t)}),o1=Q("ZodCIDRv4",(e,t)=>{Eg.init(e,t),He.init(e,t)}),s1=Q("ZodCIDRv6",(e,t)=>{Ng.init(e,t),He.init(e,t)}),i1=Q("ZodBase64",(e,t)=>{Tg.init(e,t),He.init(e,t)}),a1=Q("ZodBase64URL",(e,t)=>{Ig.init(e,t),He.init(e,t)}),l1=Q("ZodE164",(e,t)=>{zg.init(e,t),He.init(e,t)}),c1=Q("ZodJWT",(e,t)=>{Rg.init(e,t),He.init(e,t)}),$u=Q("ZodNumber",(e,t)=>{Nu.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>r0(e,r,o),e.gt=(r,o)=>e.check(el(r,o)),e.gte=(r,o)=>e.check(ms(r,o)),e.min=(r,o)=>e.check(ms(r,o)),e.lt=(r,o)=>e.check(Qa(r,o)),e.lte=(r,o)=>e.check(ps(r,o)),e.max=(r,o)=>e.check(ps(r,o)),e.int=r=>e.check(rl(r)),e.safe=r=>e.check(rl(r)),e.positive=r=>e.check(el(0,r)),e.nonnegative=r=>e.check(ms(0,r)),e.negative=r=>e.check(Qa(0,r)),e.nonpositive=r=>e.check(ps(0,r)),e.multipleOf=(r,o)=>e.check(tl(r,o)),e.step=(r,o)=>e.check(tl(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 ve(e){return Px($u,e)}const u1=Q("ZodNumberFormat",(e,t)=>{Og.init(e,t),$u.init(e,t)});function rl(e){return Rx(u1,e)}const d1=Q("ZodBoolean",(e,t)=>{Dg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>o0(e,n,r)});function Qe(e){return Ox(d1,e)}const f1=Q("ZodNull",(e,t)=>{Mg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>s0(e,n,r)});function Gs(e){return Dx(f1,e)}const h1=Q("ZodUnknown",(e,t)=>{Lg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>a0()});function ol(){return Mx(h1)}const p1=Q("ZodNever",(e,t)=>{Fg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>i0(e,n,r)});function m1(e){return Lx(p1,e)}const g1=Q("ZodArray",(e,t)=>{$g.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>f0(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(fo(n,r)),e.nonempty=n=>e.check(fo(1,n)),e.max=(n,r)=>e.check(Pu(n,r)),e.length=(n,r)=>e.check(Ru(n,r)),e.unwrap=()=>e.element});function Re(e,t){return Gx(g1,e,t)}const x1=Q("ZodObject",(e,t)=>{Ug.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>h0(e,n,r,o),Te(e,"shape",()=>t.shape),e.keyof=()=>lt(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ol()}),e.loose=()=>e.clone({...e._zod.def,catchall:ol()}),e.strict=()=>e.clone({...e._zod.def,catchall:m1()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>am(e,n),e.safeExtend=n=>lm(e,n),e.merge=n=>cm(e,n),e.pick=n=>sm(e,n),e.omit=n=>im(e,n),e.partial=(...n)=>um(Uu,e,n[0]),e.required=(...n)=>dm(Zu,e,n[0])});function ae(e,t){const n={type:"object",shape:e??{},...ye(t)};return new x1(n)}const Bu=Q("ZodUnion",(e,t)=>{Iu.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>p0(e,n,r,o),e.options=t.options});function Kt(e,t){return new Bu({type:"union",options:e,...ye(t)})}const y1=Q("ZodDiscriminatedUnion",(e,t)=>{Bu.init(e,t),Zg.init(e,t)});function vn(e,t,n){return new y1({type:"union",options:t,discriminator:e,...ye(n)})}const v1=Q("ZodIntersection",(e,t)=>{Vg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>m0(e,n,r,o)});function b1(e,t){return new v1({type:"intersection",left:e,right:t})}const w1=Q("ZodRecord",(e,t)=>{Hg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>g0(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Ht(e,t,n){return new w1({type:"record",keyType:e,valueType:t,...ye(n)})}const Ys=Q("ZodEnum",(e,t)=>{Wg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(r,o,s)=>l0(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 Ys({...t,checks:[],...ye(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 Ys({...t,checks:[],...ye(o),entries:s})}});function lt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Ys({type:"enum",entries:n,...ye(t)})}const k1=Q("ZodLiteral",(e,t)=>{qg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>c0(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 Se(e,t){return new k1({type:"literal",values:Array.isArray(e)?e:[e],...ye(t)})}const _1=Q("ZodTransform",(e,t)=>{Kg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>d0(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new fu(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(kr(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(kr(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function S1(e){return new _1({type:"transform",transform:e})}const Uu=Q("ZodOptional",(e,t)=>{zu.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lu(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function sl(e){return new Uu({type:"optional",innerType:e})}const C1=Q("ZodExactOptional",(e,t)=>{Jg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lu(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function j1(e){return new C1({type:"optional",innerType:e})}const E1=Q("ZodNullable",(e,t)=>{Gg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>x0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function il(e){return new E1({type:"nullable",innerType:e})}const N1=Q("ZodDefault",(e,t)=>{Yg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>v0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function T1(e,t){return new N1({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():gu(t)}})}const A1=Q("ZodPrefault",(e,t)=>{Xg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>b0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function I1(e,t){return new A1({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():gu(t)}})}const Zu=Q("ZodNonOptional",(e,t)=>{Qg.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>y0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function z1(e,t){return new Zu({type:"nonoptional",innerType:e,...ye(t)})}const P1=Q("ZodCatch",(e,t)=>{ex.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>w0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function R1(e,t){return new P1({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const O1=Q("ZodPipe",(e,t)=>{tx.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>k0(e,n,r,o),e.in=t.in,e.out=t.out});function al(e,t){return new O1({type:"pipe",in:e,out:t})}const D1=Q("ZodReadonly",(e,t)=>{nx.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function M1(e){return new D1({type:"readonly",innerType:e})}const L1=Q("ZodLazy",(e,t)=>{rx.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>S0(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function F1(e){return new L1({type:"lazy",getter:e})}const $1=Q("ZodCustom",(e,t)=>{ox.init(e,t),Ue.init(e,t),e._zod.processJSONSchema=(n,r,o)=>u0(e,n)});function B1(e,t={}){return Yx($1,e,t)}function U1(e){return Xx(e)}const Zn=F1(()=>Kt([K(),ve(),Qe(),Gs(),Re(Zn),Ht(K(),Zn)]));function Vu(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ll(e,t){return e===null||typeof e!="object"||Array.isArray(e)?void 0:Object.getOwnPropertyDescriptor(e,t)?.value}const Bi=ae({type:K(),ttl:K().optional(),scope:K().optional()}),Ui=ae({type:Se("text"),text:K(),cache_control:Bi.optional()}),Hu=ae({type:Se("thinking"),thinking:K(),signature:K().optional()}),Z1=ae({type:Se("think"),thinking:K(),signature:K().optional()}),V1=ae({type:Se("base64"),media_type:K(),data:K()}),Wu=ae({type:Se("image"),source:V1}),qu=ae({type:Se("tool_use"),id:K(),name:K(),input:Ht(K(),Zn)}),H1=vn("type",[Ui,Wu]),W1=ae({type:Se("tool_result"),tool_use_id:K().optional(),content:Kt([K(),Re(H1)]),is_error:Qe().optional()}),q1=vn("type",[Ui,Hu,Wu,qu,W1]),K1=Kt([K(),Re(q1)]),J1=ae({role:lt(["user","assistant"]),content:K1}),G1=ae({type:Se("text"),text:K(),cache_control:Bi.optional()}),Y1=ae({type:K(),properties:Ht(K(),Ht(K(),Zn)).optional(),required:Re(K()).optional(),additionalProperties:Qe().optional(),$schema:K().optional()}),X1=ae({name:K(),description:K().optional(),input_schema:Y1.optional(),cache_control:Bi.optional()}),Q1=vn("type",[ae({type:Se("enabled"),budget_tokens:ve()}),ae({type:Se("disabled")}),ae({type:Se("adaptive")})]),Ku=ae({model:K(),messages:Re(J1),system:Re(G1).optional(),tools:Re(X1).optional(),max_tokens:ve().optional(),temperature:ve().optional(),stream:Qe().optional(),thinking:Q1.optional(),metadata:ae({user_id:K().optional()}).optional()}),Zi=vn("type",[Ui,Hu,Z1,qu]),ey=ae({input_tokens:ve().nullable().optional(),output_tokens:ve().nullable().optional(),cache_creation_input_tokens:ve().nullable().optional(),cache_read_input_tokens:ve().nullable().optional()}).passthrough(),Ju=ae({id:K(),type:Se("message"),model:K(),role:Se("assistant"),content:Re(Zi),stop_reason:K().nullable(),stop_sequence:K().nullable().optional(),usage:ey}).passthrough(),ty=ae({type:Se("message_start"),message:ae({id:K(),type:Se("message"),model:K(),role:Se("assistant"),content:Re(Zi),stop_reason:Gs(),stop_sequence:Gs(),usage:ae({input_tokens:ve(),cache_creation_input_tokens:ve().optional(),cache_read_input_tokens:ve().optional()}).passthrough()})}),ny=ae({type:Se("content_block_start"),index:ve(),content_block:Zi}),ry=vn("type",[ae({type:Se("text_delta"),text:K()}),ae({type:Se("input_json_delta"),partial_json:K()}),ae({type:Se("thinking_delta"),thinking:K()}),ae({type:Se("signature_delta"),signature:K()})]),oy=ae({type:Se("content_block_delta"),index:ve(),delta:ry}),sy=ae({type:Se("content_block_stop"),index:ve()}),iy=ae({type:Se("message_delta"),delta:ae({stop_reason:K().nullable(),stop_sequence:K().nullable().optional()}),usage:ae({output_tokens:ve(),input_tokens:ve().optional(),cache_creation_input_tokens:ve().optional(),cache_read_input_tokens:ve().optional()}).passthrough()}),ay=ae({type:Se("message_stop")}),ly=ae({type:Se("ping")}),cy=ae({type:Se("error"),error:ae({type:K(),message:K()})}),uy=vn("type",[ty,ny,oy,sy,iy,ay,ly,cy]),dy=Kt([K(),Re(vn("type",[ae({type:Se("text"),text:K()}),ae({type:Se("image_url"),image_url:ae({url:K(),detail:K().optional()})})]))]),Gu=ae({role:lt(["system","user","assistant","tool"]),content:dy,name:K().optional(),reasoning_content:K().optional(),thinking:K().optional(),think:K().optional()}),fy=ae({name:K(),arguments:K()}),Yu=ae({index:ve().optional(),id:K().optional(),type:Se("function").optional(),function:ae({name:K().optional(),arguments:K().optional()})});Gu.extend({content:Kt([K(),Re(ae({type:Se("text"),text:K()}))]).optional(),function_call:fy.optional(),tool_calls:Re(Yu).optional()});const hy=ae({type:Se("function"),function:ae({name:K(),description:K().optional(),parameters:Ht(K(),Zn)})}),Xu=ae({model:K(),messages:Re(Gu),temperature:ve().optional(),max_tokens:ve().optional(),stream:Qe().optional(),tools:Re(hy).optional(),tool_choice:Kt([lt(["auto","none","required"]),ae({type:Se("auto")}),ae({type:Se("none")}),ae({type:Se("function"),function:ae({name:K()})})]).optional(),user:K().optional()}),Qu=ae({role:lt(["assistant"]).optional(),content:K().nullable().optional(),reasoning_content:K().nullable().optional(),thinking:K().nullable().optional(),think:K().nullable().optional(),function_call:ae({name:K().optional(),arguments:K().optional()}).nullable().optional(),tool_calls:Re(ae({index:ve(),id:K().optional(),type:Se("function").optional(),function:ae({name:K().optional(),arguments:K().optional()})})).nullable().optional()}),py=ae({index:ve(),message:ae({role:lt(["assistant"]),content:K().nullable(),reasoning_content:K().optional(),thinking:K().optional(),think:K().optional(),function_call:ae({name:K(),arguments:K()}).nullable().optional(),tool_calls:Re(Yu).optional()}).optional(),delta:Qu.optional(),finish_reason:K().nullable()}),my=ae({id:K(),object:Se("chat.completion"),created:ve(),model:K(),choices:Re(py),usage:ae({prompt_tokens:ve().nullable().optional(),completion_tokens:ve().nullable().optional(),total_tokens:ve().nullable().optional()}).passthrough(),service_tier:K().nullable().optional(),system_fingerprint:K().nullable().optional()}).passthrough(),gy=ae({id:K(),object:Se("chat.completion.chunk"),created:ve(),model:K(),choices:Re(ae({index:ve(),delta:Qu,finish_reason:K().nullable().optional()})),usage:ae({prompt_tokens:ve().nullable().optional(),completion_tokens:ve().nullable().optional(),total_tokens:ve().nullable().optional()}).passthrough().nullable().optional()}).passthrough();function ed(e){try{const t=JSON.parse(e),n=my.safeParse(t);return n.success?n.data:null}catch{return null}}const td=ae({index:ve(),timestamp:ve(),type:K(),data:Zn}),xy=ae({chunks:Re(td),truncated:Qe().optional().default(!1)}),cl=ae({id:ve(),timestamp:K(),method:K(),path:K(),model:K().nullable(),sessionId:K().nullable(),rawRequestBody:K().nullable(),responseStatus:ve().nullable(),responseText:K().nullable(),inputTokens:ve().nullable(),outputTokens:ve().nullable(),cacheCreationInputTokens:ve().nullable(),cacheReadInputTokens:ve().nullable(),elapsedMs:ve().nullable(),streaming:Qe(),userAgent:K().nullable(),origin:K().nullable(),rawHeaders:Ht(K(),K()).optional(),headers:Ht(K(),K()).optional(),apiFormat:lt(["anthropic","openai","unknown"]).default("unknown"),isTest:Qe().optional().default(!1),providerName:K().nullable().optional(),clientPort:ve().nullable().optional(),clientPid:ve().nullable().optional(),clientCwd:K().nullable().optional(),clientProjectFolder:K().nullable().optional(),streamingChunks:xy.optional(),streamingChunksPath:K().nullable().optional(),error:K().nullable().optional()});ae({model:K()});ae({model:K().optional(),metadata:ae({user_id:K().optional()}).passthrough().optional()});const yy=ae({error:K()});async function An(e,t){const n=await e.json();return t.parse(n)}async function ro(e,t){try{const n=await e.json(),r=yy.safeParse(n);return r.success?r.data.error:t}catch{return t}}async function Ir(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 ro(o,s))}return An(o,t)}const Lo=ae({stripClaudeCodeBillingHeader:Qe(),hasSeenOnboarding:Qe().default(!1)}),Xs="/api/config";async function vy(e){return Ir(e,Lo,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function by(e){return Ir(Xs,Lo,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function nd(){const e=Pi(Xs,vy,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=uu(),n=e.data?.stripClaudeCodeBillingHeader??!1,r=async o=>{await t(Xs,by({stripClaudeCodeBillingHeader:o}),{optimisticData:{stripClaudeCodeBillingHeader:o},rollbackOnError:!0,revalidate:!1})};return{strip:n,isLoading:e.isLoading,isError:e.error!==void 0,setStrip:r}}const rd=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const wy=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const ky=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const ul=e=>{const t=ky(e);return t.charAt(0).toUpperCase()+t.slice(1)};var _y={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 Sy=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const Cy=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...a},c)=>v.createElement("svg",{ref:c,..._y,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:rd("lucide",o),...!s&&!Sy(a)&&{"aria-hidden":"true"},...a},[...i.map(([u,d])=>v.createElement(u,d)),...Array.isArray(s)?s:[s]]));const ke=(e,t)=>{const n=v.forwardRef(({className:r,...o},s)=>v.createElement(Cy,{ref:s,iconNode:t,className:rd(`lucide-${wy(ul(e))}`,`lucide-${e}`,r),...o}));return n.displayName=ul(e),n};const jy=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Ey=ke("arrow-down",jy);const Ny=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Ty=ke("arrow-up",Ny);const Ay=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],Iy=ke("brain",Ay);const zy=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Jt=ke("check",zy);const Py=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],vt=ke("chevron-down",Py);const Ry=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],bt=ke("chevron-right",Ry);const Oy=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Dy=ke("chevron-up",Oy);const My=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],od=ke("chevrons-down",My);const Ly=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],Fy=ke("chevrons-up",Ly);const $y=[["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"}]],_r=ke("circle-alert",$y);const By=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Uy=ke("circle-check-big",By);const Zy=[["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"}]],Vy=ke("circle-question-mark",Zy);const Hy=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],sd=ke("circle-stop",Hy);const Wy=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],zr=ke("clock",Wy);const qy=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],id=ke("columns-2",qy);const Ky=[["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"}]],bn=ke("copy",Ky);const Jy=[["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"}]],Vi=ke("download",Jy);const Gy=[["line",{x1:"5",x2:"19",y1:"9",y2:"9",key:"1nwqeh"}],["line",{x1:"5",x2:"19",y1:"15",y2:"15",key:"g8yjpy"}]],Yy=ke("equal",Gy);const Xy=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Qy=ke("external-link",Xy);const ev=[["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"}]],Hi=ke("eye-off",ev);const tv=[["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"}]],Wi=ke("eye",tv);const nv=[["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"}]],rv=ke("file-terminal",nv);const ov=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],sv=ke("gauge",ov);const iv=[["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"}]],ad=ke("git-compare-arrows",iv);const av=[["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"}]],lv=ke("globe",av);const cv=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Sr=ke("loader-circle",cv);const uv=[["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"}]],dv=ke("lock",uv);const fv=[["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"}]],ld=ke("message-square",fv);const hv=[["path",{d:"M5 12h14",key:"1ays0h"}]],qi=ke("minus",hv);const pv=[["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"}]],Ki=ke("pencil",pv);const mv=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],po=ke("plus",mv);const gv=[["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"}]],xv=ke("radio",gv);const yv=[["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"}]],cd=ke("rotate-ccw",yv);const vv=[["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"}]],ud=ke("rotate-cw",vv);const bv=[["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"}]],dd=ke("rows-3",bv);const wv=[["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"}]],kv=ke("scan",wv);const _v=[["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"}]],Sv=ke("server",_v);const Cv=[["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"}]],jv=ke("settings",Cv);const Ev=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],fd=ke("terminal",Ev);const Nv=[["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"}]],hd=ke("trash-2",Nv);const Tv=[["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"}]],Av=ke("triangle-alert",Tv);const Iv=[["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"}]],zv=ke("upload",Iv);const Pv=[["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"}]],Rv=ke("user",Pv);const Ov=[["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"}]],Dv=ke("wifi-off",Ov);const Mv=[["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"}]],Lv=ke("wifi",Mv);const Fv=[["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"}]],dl=ke("wrench",Fv);const $v=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ji=ke("x",$v);const Bv=[["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"}]],Yn=ke("zap",Bv),Qs="/api/config";async function Uv(e){return Ir(e,Lo,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function Zv(e){return Ir(Qs,Lo,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function Vv(){const e=Pi(Qs,Uv,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=uu(),n=e.data?.hasSeenOnboarding??!1,r=async()=>{await t(Qs,Zv({hasSeenOnboarding:!0}),{optimisticData:{stripClaudeCodeBillingHeader:e.data?.stripClaudeCodeBillingHeader??!1,hasSeenOnboarding:!0},rollbackOnError:!0,revalidate:!1})};return{hasSeenOnboarding:n,isLoading:e.isLoading,markSeen:r}}function Hv(){const{hasSeenOnboarding:e,isLoading:t,markSeen:n}=Vv();return t||e?null:l.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:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"font-medium text-amber-600 dark:text-amber-400 mb-1",children:"Quick tour of the log tabs"}),l.jsxs("ul",{className:"space-y-0.5 text-muted-foreground text-xs leading-relaxed",children:[l.jsxs("li",{children:[l.jsx("strong",{children:"Request"})," / ",l.jsx("strong",{children:"Response"})," — structured views of what the proxy sent and received."]}),l.jsxs("li",{children:[l.jsx("strong",{children:"Headers"})," — request and response headers after proxy processing."]}),l.jsxs("li",{children:[l.jsx("strong",{children:"Raw Headers"})," / ",l.jsx("strong",{children:"Raw Request"})," /"," ",l.jsx("strong",{children:"Raw Response"})," — exact bytes from the upstream provider (visible in Full mode)."]})]})]}),l.jsxs("button",{type:"button",onClick:()=>{n()},className:"inline-flex items-center gap-1.5 text-xs px-2.5 py-1.5 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:[l.jsx(Jt,{className:"size-3"}),"Got it"]}),l.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:l.jsx(Ji,{className:"size-3.5"})})]})}function Zr(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 gs={exports:{}};var fl;function Wv(){return fl||(fl=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 h=typeof Zr=="function"&&Zr;if(!d&&h)return h(u,!0);if(a)return a(u,!0);var p=new Error("Cannot find module '"+u+"'");throw p.code="MODULE_NOT_FOUND",p}var f=o[u]={exports:{}};r[u][0].call(f.exports,function(g){var m=r[u][1][g];return i(m||g)},f,f.exports,n,r,o,s)}return o[u].exports}for(var a=typeof Zr=="function"&&Zr,c=0;c<s.length;c++)i(s[c]);return i})({1:[function(n,r,o){var s=n("./utils"),i=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(c){for(var u,d,h,p,f,g,m,x=[],y=0,b=c.length,k=b,S=s.getTypeOf(c)!=="string";y<c.length;)k=b-y,h=S?(u=c[y++],d=y<b?c[y++]:0,y<b?c[y++]:0):(u=c.charCodeAt(y++),d=y<b?c.charCodeAt(y++):0,y<b?c.charCodeAt(y++):0),p=u>>2,f=(3&u)<<4|d>>4,g=1<k?(15&d)<<2|h>>6:64,m=2<k?63&h:64,x.push(a.charAt(p)+a.charAt(f)+a.charAt(g)+a.charAt(m));return x.join("")},o.decode=function(c){var u,d,h,p,f,g,m=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 b,k=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===a.charAt(64)&&k--,c.charAt(c.length-2)===a.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(b=i.uint8array?new Uint8Array(0|k):new Array(0|k);m<c.length;)u=a.indexOf(c.charAt(m++))<<2|(p=a.indexOf(c.charAt(m++)))>>4,d=(15&p)<<4|(f=a.indexOf(c.charAt(m++)))>>2,h=(3&f)<<6|(g=a.indexOf(c.charAt(m++))),b[x++]=u,f!==64&&(b[x++]=d),g!==64&&(b[x++]=h);return b}},{"./support":30,"./utils":32}],2:[function(n,r,o){var s=n("./external"),i=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function u(d,h,p,f,g){this.compressedSize=d,this.uncompressedSize=h,this.crc32=p,this.compression=f,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")),h=this;return d.on("end",function(){if(this.streamInfo.data_length!==h.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,h,p){return d.pipe(new a).pipe(new c("uncompressedSize")).pipe(h.compressWorker(p)).pipe(new c("compressedSize")).withStreamInfo("compression",h)},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 a,c=[],u=0;u<256;u++){a=u;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;c[u]=a}return c})();r.exports=function(a,c){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?(function(u,d,h,p){var f=i,g=p+h;u^=-1;for(var m=p;m<g;m++)u=u>>>8^f[255&(u^d[m])];return-1^u})(0|c,a,a.length,0):(function(u,d,h,p){var f=i,g=p+h;u^=-1;for(var m=p;m<g;m++)u=u>>>8^f[255&(u^d.charCodeAt(m))];return-1^u})(0|c,a,a.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"),a=n("./utils"),c=n("./stream/GenericWorker"),u=s?"uint8array":"array";function d(h,p){c.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=p,this.meta={}}o.magic="\b\0",a.inherits(d,c),d.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,h.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 h=this;this._pako.onData=function(p){h.push({data:p,meta:h.meta})}},o.compressWorker=function(h){return new d("Deflate",h)},o.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){function s(f,g){var m,x="";for(m=0;m<g;m++)x+=String.fromCharCode(255&f),f>>>=8;return x}function i(f,g,m,x,y,b){var k,S,j=f.file,C=f.compression,N=b!==u.utf8encode,T=a.transformTo("string",b(j.name)),A=a.transformTo("string",u.utf8encode(j.name)),R=j.comment,M=a.transformTo("string",b(R)),E=a.transformTo("string",u.utf8encode(R)),L=A.length!==j.name.length,w=E.length!==R.length,D="",W="",B="",q=j.dir,Y=j.date,I={crc32:0,compressedSize:0,uncompressedSize:0};g&&!m||(I.crc32=f.crc32,I.compressedSize=f.compressedSize,I.uncompressedSize=f.uncompressedSize);var H=0;g&&(H|=8),N||!L&&!w||(H|=2048);var V=0,z=0;q&&(V|=16),y==="UNIX"?(z=798,V|=(function(X,de){var te=X;return X||(te=de?16893:33204),(65535&te)<<16})(j.unixPermissions,q)):(z=20,V|=(function(X){return 63&(X||0)})(j.dosPermissions)),k=Y.getUTCHours(),k<<=6,k|=Y.getUTCMinutes(),k<<=5,k|=Y.getUTCSeconds()/2,S=Y.getUTCFullYear()-1980,S<<=4,S|=Y.getUTCMonth()+1,S<<=5,S|=Y.getUTCDate(),L&&(W=s(1,1)+s(d(T),4)+A,D+="up"+s(W.length,2)+W),w&&(B=s(1,1)+s(d(M),4)+E,D+="uc"+s(B.length,2)+B);var oe="";return oe+=`
40
+ \0`,oe+=s(H,2),oe+=C.magic,oe+=s(k,2),oe+=s(S,2),oe+=s(I.crc32,4),oe+=s(I.compressedSize,4),oe+=s(I.uncompressedSize,4),oe+=s(T.length,2),oe+=s(D.length,2),{fileRecord:h.LOCAL_FILE_HEADER+oe+T+D,dirRecord:h.CENTRAL_FILE_HEADER+s(z,2)+oe+s(M.length,2)+"\0\0\0\0"+s(V,4)+s(x,4)+T+D+M}}var a=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),h=n("../signature");function p(f,g,m,x){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=m,this.encodeFileName=x,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,c),p.prototype.push=function(f){var g=f.meta.percent||0,m=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,c.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:m?(g+100*(m-x-1))/m:100}}))},p.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var g=this.streamFiles&&!f.file.dir;if(g){var m=i(f,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(f){this.accumulate=!1;var g=this.streamFiles&&!f.file.dir,m=i(f,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),g)this.push({data:(function(x){return h.DATA_DESCRIPTOR+s(x.crc32,4)+s(x.compressedSize,4)+s(x.uncompressedSize,4)})(f),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var f=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var m=this.bytesWritten-f,x=(function(y,b,k,S,j){var C=a.transformTo("string",j(S));return h.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(y,2)+s(y,2)+s(b,4)+s(k,4)+s(C.length,2)+C})(this.dirRecords.length,m,f,this.zipComment,this.encodeFileName);this.push({data:x,meta:{percent:100}})},p.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},p.prototype.registerPrevious=function(f){this._sources.push(f);var g=this;return f.on("data",function(m){g.processChunk(m)}),f.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),f.on("error",function(m){g.error(m)}),this},p.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))},p.prototype.error=function(f){var g=this._sources;if(!c.prototype.error.call(this,f))return!1;for(var m=0;m<g.length;m++)try{g[m].error(f)}catch{}return!0},p.prototype.lock=function(){c.prototype.lock.call(this);for(var f=this._sources,g=0;g<f.length;g++)f[g].lock()},r.exports=p},{"../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(a,c,u){var d=new i(c.streamFiles,u,c.platform,c.encodeFileName),h=0;try{a.forEach(function(p,f){h++;var g=(function(b,k){var S=b||k,j=s[S];if(!j)throw new Error(S+" is not a valid compression method !");return j})(f.options.compression,c.compression),m=f.options.compressionOptions||c.compressionOptions||{},x=f.dir,y=f.date;f._compressWorker(g,m).withStreamInfo("file",{name:p,dir:x,date:y,comment:f.comment||"",unixPermissions:f.unixPermissions,dosPermissions:f.dosPermissions}).pipe(d)}),d.entriesCount=h}catch(p){d.error(p)}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 a in this)typeof this[a]!="function"&&(i[a]=this[a]);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,a){return new s().loadAsync(i,a)},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"),a=n("./utf8"),c=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function h(p){return new i.Promise(function(f,g){var m=p.decompressed.getContentWorker().pipe(new u);m.on("error",function(x){g(x)}).on("end",function(){m.streamInfo.crc32!==p.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):f()}).resume()})}r.exports=function(p,f){var g=this;return f=s.extend(f||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),d.isNode&&d.isStream(p)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",p,!0,f.optimizedBinaryString,f.base64).then(function(m){var x=new c(f);return x.load(m),x}).then(function(m){var x=[i.Promise.resolve(m)],y=m.files;if(f.checkCRC32)for(var b=0;b<y.length;b++)x.push(h(y[b]));return i.Promise.all(x)}).then(function(m){for(var x=m.shift(),y=x.files,b=0;b<y.length;b++){var k=y[b],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:f.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 a(c,u){i.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}s.inherits(a,i),a.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()})},a.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){var s=n("readable-stream").Readable;function i(a,c,u){s.call(this,c),this._helper=a;var d=this;a.on("data",function(h,p){d.push(h)||d._helper.pause(),u&&u(p)}).on("error",function(h){d.emit("error",h)}).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,C,N){var T,A=a.getTypeOf(C),R=a.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&&(T=x(j))&&b.call(this,T,!0);var M=A==="string"&&R.binary===!1&&R.base64===!1;N&&N.binary!==void 0||(R.binary=!M),(C instanceof h&&C.uncompressedSize===0||R.dir||!C||C.length===0)&&(R.base64=!1,R.binary=!0,C="",R.compression="STORE",A="string");var E=null;E=C instanceof h||C instanceof c?C:g.isNode&&g.isStream(C)?new m(j,C):a.prepareContent(j,C,R.binary,R.optimizedBinaryString,R.base64);var L=new p(j,E,R);this.files[j]=L}var i=n("./utf8"),a=n("./utils"),c=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),h=n("./compressedObject"),p=n("./zipObject"),f=n("./generate"),g=n("./nodejsUtils"),m=n("./nodejs/NodejsStreamInputAdapter"),x=function(j){j.slice(-1)==="/"&&(j=j.substring(0,j.length-1));var C=j.lastIndexOf("/");return 0<C?j.substring(0,C):""},y=function(j){return j.slice(-1)!=="/"&&(j+="/"),j},b=function(j,C){return C=C!==void 0?C:d.createFolders,j=y(j),this.files[j]||s.call(this,j,null,{dir:!0,createFolders:C}),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 C,N,T;for(C in this.files)T=this.files[C],(N=C.slice(this.root.length,C.length))&&C.slice(0,this.root.length)===this.root&&j(N,T)},filter:function(j){var C=[];return this.forEach(function(N,T){j(N,T)&&C.push(T)}),C},file:function(j,C,N){if(arguments.length!==1)return j=this.root+j,s.call(this,j,C,N),this;if(k(j)){var T=j;return this.filter(function(R,M){return!M.dir&&T.test(R)})}var A=this.files[this.root+j];return A&&!A.dir?A:null},folder:function(j){if(!j)return this;if(k(j))return this.filter(function(A,R){return R.dir&&j.test(A)});var C=this.root+j,N=b.call(this,C),T=this.clone();return T.root=N.name,T},remove:function(j){j=this.root+j;var C=this.files[j];if(C||(j.slice(-1)!=="/"&&(j+="/"),C=this.files[j]),C&&!C.dir)delete this.files[j];else for(var N=this.filter(function(A,R){return R.name.slice(0,j.length)===j}),T=0;T<N.length;T++)delete this.files[N[T].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 C,N={};try{if((N=a.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.");a.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 T=N.comment||this.comment||"";C=f.generateWorker(this,N,T)}catch(A){(C=new c("error")).error(A)}return new u(C,N.type||"string",N.mimeType)},generateAsync:function(j,C){return this.generateInternalStream(j).accumulate(C)},generateNodeStream:function(j,C){return(j=j||{}).type||(j.type="nodebuffer"),this.generateInternalStream(j).toNodejsStream(C)}};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(a){s.call(this,a);for(var c=0;c<this.data.length;c++)a[c]=255&a[c]}n("../utils").inherits(i,s),i.prototype.byteAt=function(a){return this.data[this.zero+a]},i.prototype.lastIndexOfSignature=function(a){for(var c=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),h=a.charCodeAt(3),p=this.length-4;0<=p;--p)if(this.data[p]===c&&this.data[p+1]===u&&this.data[p+2]===d&&this.data[p+3]===h)return p-this.zero;return-1},i.prototype.readAndCheckSignature=function(a){var c=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),h=a.charCodeAt(3),p=this.readData(4);return c===p[0]&&u===p[1]&&d===p[2]&&h===p[3]},i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){var s=n("../utils");function i(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var c,u=0;for(this.checkOffset(a),c=this.index+a-1;c>=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=a,u},readString:function(a){return s.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=i},{"../utils":32}],19:[function(n,r,o){var s=n("./Uint8ArrayReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){var s=n("./DataReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},i.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},i.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){var s=n("./ArrayReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){var s=n("../utils"),i=n("../support"),a=n("./ArrayReader"),c=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(h){var p=s.getTypeOf(h);return s.checkSupport(p),p!=="string"||i.uint8array?p==="nodebuffer"?new u(h):i.uint8array?new d(s.transformTo("uint8array",h)):new a(s.transformTo("array",h)):new c(h)}},{"../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 a(c){s.call(this,"ConvertWorker to "+c),this.destType=c}i.inherits(a,s),a.prototype.processChunk=function(c){this.push({data:i.transformTo(this.destType,c.data),meta:c.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){var s=n("./GenericWorker"),i=n("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,s),a.prototype.processChunk=function(c){this.streamInfo.crc32=i(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function a(c){i.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}s.inherits(a,i),a.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=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function a(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(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.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=a},{"../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,a){return this._listeners[i].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,a){if(this._listeners[i])for(var c=0;c<this._listeners[i].length;c++)this._listeners[i][c].call(this,a)},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 a=this;return i.on("data",function(c){a.processChunk(c)}),i.on("end",function(){a.end()}),i.on("error",function(c){a.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,a){return this.extraStreamInfo[i]=a,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"),a=n("./GenericWorker"),c=n("../base64"),u=n("../support"),d=n("../external"),h=null;if(u.nodestream)try{h=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(g,m){return new d.Promise(function(x,y){var b=[],k=g._internalType,S=g._outputType,j=g._mimeType;g.on("data",function(C,N){b.push(C),m&&m(N)}).on("error",function(C){b=[],y(C)}).on("end",function(){try{var C=(function(N,T,A){switch(N){case"blob":return s.newBlob(s.transformTo("arraybuffer",T),A);case"base64":return c.encode(T);default:return s.transformTo(N,T)}})(S,(function(N,T){var A,R=0,M=null,E=0;for(A=0;A<T.length;A++)E+=T[A].length;switch(N){case"string":return T.join("");case"array":return Array.prototype.concat.apply([],T);case"uint8array":for(M=new Uint8Array(E),A=0;A<T.length;A++)M.set(T[A],R),R+=T[A].length;return M;case"nodebuffer":return Buffer.concat(T);default:throw new Error("concat : unsupported type '"+N+"'")}})(k,b),j);x(C)}catch(N){y(N)}b=[]}).resume()})}function f(g,m,x){var y=m;switch(m){case"blob":case"arraybuffer":y="uint8array";break;case"base64":y="string"}try{this._internalType=y,this._outputType=m,this._mimeType=x,s.checkSupport(y),this._worker=g.pipe(new i(y)),g.lock()}catch(b){this._worker=new a("error"),this._worker.error(b)}}f.prototype={accumulate:function(g){return p(this,g)},on:function(g,m){var x=this;return g==="data"?this._worker.on(g,function(y){m.call(x,y.data,y.meta)}):this._worker.on(g,function(){s.delay(m,arguments,x)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(g){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new h(this,{objectMode:this._outputType!=="nodebuffer"},g)}},r.exports=f},{"../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"),a=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 h(){c.call(this,"utf-8 decode"),this.leftOver=null}function p(){c.call(this,"utf-8 encode")}o.utf8encode=function(f){return i.nodebuffer?a.newBufferFrom(f,"utf-8"):(function(g){var m,x,y,b,k,S=g.length,j=0;for(b=0;b<S;b++)(64512&(x=g.charCodeAt(b)))==55296&&b+1<S&&(64512&(y=g.charCodeAt(b+1)))==56320&&(x=65536+(x-55296<<10)+(y-56320),b++),j+=x<128?1:x<2048?2:x<65536?3:4;for(m=i.uint8array?new Uint8Array(j):new Array(j),b=k=0;k<j;b++)(64512&(x=g.charCodeAt(b)))==55296&&b+1<S&&(64512&(y=g.charCodeAt(b+1)))==56320&&(x=65536+(x-55296<<10)+(y-56320),b++),x<128?m[k++]=x:(x<2048?m[k++]=192|x>>>6:(x<65536?m[k++]=224|x>>>12:(m[k++]=240|x>>>18,m[k++]=128|x>>>12&63),m[k++]=128|x>>>6&63),m[k++]=128|63&x);return m})(f)},o.utf8decode=function(f){return i.nodebuffer?s.transformTo("nodebuffer",f).toString("utf-8"):(function(g){var m,x,y,b,k=g.length,S=new Array(2*k);for(m=x=0;m<k;)if((y=g[m++])<128)S[x++]=y;else if(4<(b=u[y]))S[x++]=65533,m+=b-1;else{for(y&=b===2?31:b===3?15:7;1<b&&m<k;)y=y<<6|63&g[m++],b--;1<b?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)})(f=s.transformTo(i.uint8array?"uint8array":"array",f))},s.inherits(h,c),h.prototype.processChunk=function(f){var g=s.transformTo(i.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var m=g;(g=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),g.set(m,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var x=(function(b,k){var S;for((k=k||b.length)>b.length&&(k=b.length),S=k-1;0<=S&&(192&b[S])==128;)S--;return S<0||S===0?k:S+u[b[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:f.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=h,s.inherits(p,c),p.prototype.processChunk=function(f){this.push({data:o.utf8encode(f.data),meta:f.meta})},o.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){var s=n("./support"),i=n("./base64"),a=n("./nodejsUtils"),c=n("./external");function u(m){return m}function d(m,x){for(var y=0;y<m.length;++y)x[y]=255&m.charCodeAt(y);return x}n("setimmediate"),o.newBlob=function(m,x){o.checkSupport("blob");try{return new Blob([m],{type:x})}catch{try{var y=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return y.append(m),y.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var h={stringifyByChunk:function(m,x,y){var b=[],k=0,S=m.length;if(S<=y)return String.fromCharCode.apply(null,m);for(;k<S;)x==="array"||x==="nodebuffer"?b.push(String.fromCharCode.apply(null,m.slice(k,Math.min(k+y,S)))):b.push(String.fromCharCode.apply(null,m.subarray(k,Math.min(k+y,S)))),k+=y;return b.join("")},stringifyByChar:function(m){for(var x="",y=0;y<m.length;y++)x+=String.fromCharCode(m[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,a.allocBuffer(1)).length===1}catch{return!1}})()}};function p(m){var x=65536,y=o.getTypeOf(m),b=!0;if(y==="uint8array"?b=h.applyCanBeUsed.uint8array:y==="nodebuffer"&&(b=h.applyCanBeUsed.nodebuffer),b)for(;1<x;)try{return h.stringifyByChunk(m,y,x)}catch{x=Math.floor(x/2)}return h.stringifyByChar(m)}function f(m,x){for(var y=0;y<m.length;y++)x[y]=m[y];return x}o.applyFromCharCode=p;var g={};g.string={string:u,array:function(m){return d(m,new Array(m.length))},arraybuffer:function(m){return g.string.uint8array(m).buffer},uint8array:function(m){return d(m,new Uint8Array(m.length))},nodebuffer:function(m){return d(m,a.allocBuffer(m.length))}},g.array={string:p,array:u,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(m)}},g.arraybuffer={string:function(m){return p(new Uint8Array(m))},array:function(m){return f(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:u,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(new Uint8Array(m))}},g.uint8array={string:p,array:function(m){return f(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:u,nodebuffer:function(m){return a.newBufferFrom(m)}},g.nodebuffer={string:p,array:function(m){return f(m,new Array(m.length))},arraybuffer:function(m){return g.nodebuffer.uint8array(m).buffer},uint8array:function(m){return f(m,new Uint8Array(m.length))},nodebuffer:u},o.transformTo=function(m,x){if(x=x||"",!m)return x;o.checkSupport(m);var y=o.getTypeOf(x);return g[y][m](x)},o.resolve=function(m){for(var x=m.split("/"),y=[],b=0;b<x.length;b++){var k=x[b];k==="."||k===""&&b!==0&&b!==x.length-1||(k===".."?y.pop():y.push(k))}return y.join("/")},o.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":s.nodebuffer&&a.isBuffer(m)?"nodebuffer":s.uint8array&&m instanceof Uint8Array?"uint8array":s.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(m){if(!s[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(m){var x,y,b="";for(y=0;y<(m||"").length;y++)b+="\\x"+((x=m.charCodeAt(y))<16?"0":"")+x.toString(16).toUpperCase();return b},o.delay=function(m,x,y){setImmediate(function(){m.apply(y||null,x||[])})},o.inherits=function(m,x){function y(){}y.prototype=x.prototype,m.prototype=new y},o.extend=function(){var m,x,y={};for(m=0;m<arguments.length;m++)for(x in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],x)&&y[x]===void 0&&(y[x]=arguments[m][x]);return y},o.prepareContent=function(m,x,y,b,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,C){var N=new FileReader;N.onload=function(T){j(T.target.result)},N.onerror=function(T){C(T.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&&b!==!0&&(S=(function(C){return d(C,s.uint8array?new Uint8Array(C.length):new Array(C.length))})(S))),S):c.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){var s=n("./reader/readerFor"),i=n("./utils"),a=n("./signature"),c=n("./zipEntry"),u=n("./support");function d(h){this.files=[],this.loadOptions=h}d.prototype={checkSignature:function(h){if(!this.reader.readAndCheckSignature(h)){this.reader.index-=4;var p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(p)+", expected "+i.pretty(h)+")")}},isSignature:function(h,p){var f=this.reader.index;this.reader.setIndex(h);var g=this.reader.readString(4)===p;return this.reader.setIndex(f),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 h=this.reader.readData(this.zipCommentLength),p=u.uint8array?"uint8array":"array",f=i.transformTo(p,h);this.zipComment=this.loadOptions.decodeFileName(f)},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 h,p,f,g=this.zip64EndOfCentralSize-44;0<g;)h=this.reader.readInt(2),p=this.reader.readInt(4),f=this.reader.readData(p),this.zip64ExtensibleData[h]={id:h,length:p,value:f}},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 h,p;for(h=0;h<this.files.length;h++)p=this.files[h],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var h;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(h=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(h);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 h=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(h<0)throw this.isSignature(0,a.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(h);var p=h;if(this.checkSignature(a.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,(h=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(h),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.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(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var f=this.centralDirOffset+this.centralDirSize;this.zip64&&(f+=20,f+=12+this.zip64EndOfCentralSize);var g=p-f;if(0<g)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=g);else if(g<0)throw new Error("Corrupted zip: missing "+Math.abs(g)+" bytes.")},prepareReader:function(h){this.reader=s(h)},load:function(h){this.prepareReader(h),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"),a=n("./compressedObject"),c=n("./crc32"),u=n("./utf8"),d=n("./compressions"),h=n("./support");function p(f,g){this.options=f,this.loadOptions=g}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(f){var g,m;if(f.skip(22),this.fileNameLength=f.readInt(2),m=f.readInt(2),this.fileName=f.readData(this.fileNameLength),f.skip(m),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((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 a(this.compressedSize,this.uncompressedSize,this.crc32,g,f.readData(this.compressedSize))},readCentralPart:function(f){this.versionMadeBy=f.readInt(2),f.skip(2),this.bitFlag=f.readInt(2),this.compressionMethod=f.readString(2),this.date=f.readDate(),this.crc32=f.readInt(4),this.compressedSize=f.readInt(4),this.uncompressedSize=f.readInt(4);var g=f.readInt(2);if(this.extraFieldsLength=f.readInt(2),this.fileCommentLength=f.readInt(2),this.diskNumberStart=f.readInt(2),this.internalFileAttributes=f.readInt(2),this.externalFileAttributes=f.readInt(4),this.localHeaderOffset=f.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");f.skip(g),this.readExtraFields(f),this.parseZIP64ExtraField(f),this.fileComment=f.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var f=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=s(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var g,m,x,y=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4<y;)g=f.readInt(2),m=f.readInt(2),x=f.readData(m),this.extraFields[g]={id:g,length:m,value:x};f.setIndex(y)},handleUTF8:function(){var f=h.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 m=i.transformTo(f,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var y=i.transformTo(f,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(y)}}},findExtraFieldUnicodePath:function(){var f=this.extraFields[28789];if(f){var g=s(f.value);return g.readInt(1)!==1||c(this.fileName)!==g.readInt(4)?null:u.utf8decode(g.readData(f.length-5))}return null},findExtraFieldUnicodeComment:function(){var f=this.extraFields[25461];if(f){var g=s(f.value);return g.readInt(1)!==1||c(this.fileComment)!==g.readInt(4)?null:u.utf8decode(g.readData(f.length-5))}return null}},r.exports=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){function s(g,m,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=m,this._dataBinary=x.binary,this.options={compression:x.compression,compressionOptions:x.compressionOptions}}var i=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),c=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");s.prototype={internalStream:function(g){var m=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"),m=this._decompressWorker();var b=!this._dataBinary;b&&!y&&(m=m.pipe(new c.Utf8EncodeWorker)),!b&&y&&(m=m.pipe(new c.Utf8DecodeWorker))}catch(k){(m=new d("error")).error(k)}return new i(m,x,"")},async:function(g,m){return this.internalStream(g).accumulate(m)},nodeStream:function(g,m){return this.internalStream(g||"nodebuffer").toNodejsStream(m)},_compressWorker:function(g,m){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,m)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new a(this._data)}};for(var h=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},f=0;f<h.length;f++)s.prototype[h[f]]=p;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,a,c=s.MutationObserver||s.WebKitMutationObserver;if(c){var u=0,d=new c(g),h=s.document.createTextNode("");d.observe(h,{characterData:!0}),i=function(){h.data=u=++u%2}}else if(s.setImmediate||s.MessageChannel===void 0)i="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var m=s.document.createElement("script");m.onreadystatechange=function(){g(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},s.document.documentElement.appendChild(m)}:function(){setTimeout(g,0)};else{var p=new s.MessageChannel;p.port1.onmessage=g,i=function(){p.port2.postMessage(0)}}var f=[];function g(){var m,x;a=!0;for(var y=f.length;y;){for(x=f,f=[],m=-1;++m<y;)x[m]();y=f.length}a=!1}r.exports=function(m){f.push(m)!==1||a||i()}}).call(this,typeof Fr<"u"?Fr:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){var s=n("immediate");function i(){}var a={},c=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function h(y){if(typeof y!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,y!==i&&m(this,y)}function p(y,b,k){this.promise=y,typeof b=="function"&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function f(y,b,k){s(function(){var S;try{S=b(k)}catch(j){return a.reject(y,j)}S===y?a.reject(y,new TypeError("Cannot resolve promise with itself")):a.resolve(y,S)})}function g(y){var b=y&&y.then;if(y&&(typeof y=="object"||typeof y=="function")&&typeof b=="function")return function(){b.apply(y,arguments)}}function m(y,b){var k=!1;function S(N){k||(k=!0,a.reject(y,N))}function j(N){k||(k=!0,a.resolve(y,N))}var C=x(function(){b(j,S)});C.status==="error"&&S(C.value)}function x(y,b){var k={};try{k.value=y(b),k.status="success"}catch(S){k.status="error",k.value=S}return k}(r.exports=h).prototype.finally=function(y){if(typeof y!="function")return this;var b=this.constructor;return this.then(function(k){return b.resolve(y()).then(function(){return k})},function(k){return b.resolve(y()).then(function(){throw k})})},h.prototype.catch=function(y){return this.then(null,y)},h.prototype.then=function(y,b){if(typeof y!="function"&&this.state===u||typeof b!="function"&&this.state===c)return this;var k=new this.constructor(i);return this.state!==d?f(k,this.state===u?y:b,this.outcome):this.queue.push(new p(k,y,b)),k},p.prototype.callFulfilled=function(y){a.resolve(this.promise,y)},p.prototype.otherCallFulfilled=function(y){f(this.promise,this.onFulfilled,y)},p.prototype.callRejected=function(y){a.reject(this.promise,y)},p.prototype.otherCallRejected=function(y){f(this.promise,this.onRejected,y)},a.resolve=function(y,b){var k=x(g,b);if(k.status==="error")return a.reject(y,k.value);var S=k.value;if(S)m(y,S);else{y.state=u,y.outcome=b;for(var j=-1,C=y.queue.length;++j<C;)y.queue[j].callFulfilled(b)}return y},a.reject=function(y,b){y.state=c,y.outcome=b;for(var k=-1,S=y.queue.length;++k<S;)y.queue[k].callRejected(b);return y},h.resolve=function(y){return y instanceof this?y:a.resolve(new this(i),y)},h.reject=function(y){var b=new this(i);return a.reject(b,y)},h.all=function(y){var b=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),C=0,N=-1,T=new this(i);++N<k;)A(y[N],N);return T;function A(R,M){b.resolve(R).then(function(E){j[M]=E,++C!==k||S||(S=!0,a.resolve(T,j))},function(E){S||(S=!0,a.reject(T,E))})}},h.race=function(y){var b=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,C=new this(i);++j<k;)N=y[j],b.resolve(N).then(function(T){S||(S=!0,a.resolve(C,T))},function(T){S||(S=!0,a.reject(C,T))});var N;return C}},{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"),a=n("./utils/strings"),c=n("./zlib/messages"),u=n("./zlib/zstream"),d=Object.prototype.toString,h=0,p=-1,f=0,g=8;function m(y){if(!(this instanceof m))return new m(y);this.options=i.assign({level:p,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:f,to:""},y||{});var b=this.options;b.raw&&0<b.windowBits?b.windowBits=-b.windowBits:b.gzip&&0<b.windowBits&&b.windowBits<16&&(b.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,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(k!==h)throw new Error(c[k]);if(b.header&&s.deflateSetHeader(this.strm,b.header),b.dictionary){var S;if(S=typeof b.dictionary=="string"?a.string2buf(b.dictionary):d.call(b.dictionary)==="[object ArrayBuffer]"?new Uint8Array(b.dictionary):b.dictionary,(k=s.deflateSetDictionary(this.strm,S))!==h)throw new Error(c[k]);this._dict_set=!0}}function x(y,b){var k=new m(b);if(k.push(y,!0),k.err)throw k.msg||c[k.err];return k.result}m.prototype.push=function(y,b){var k,S,j=this.strm,C=this.options.chunkSize;if(this.ended)return!1;S=b===~~b?b:b===!0?4:0,typeof y=="string"?j.input=a.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(C),j.next_out=0,j.avail_out=C),(k=s.deflate(j,S))!==1&&k!==h)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(a.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===h):S!==2||(this.onEnd(h),!(j.avail_out=0))},m.prototype.onData=function(y){this.chunks.push(y)},m.prototype.onEnd=function(y){y===h&&(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=m,o.deflate=x,o.deflateRaw=function(y,b){return(b=b||{}).raw=!0,x(y,b)},o.gzip=function(y,b){return(b=b||{}).gzip=!0,x(y,b)}},{"./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"),a=n("./utils/strings"),c=n("./zlib/constants"),u=n("./zlib/messages"),d=n("./zlib/zstream"),h=n("./zlib/gzheader"),p=Object.prototype.toString;function f(m){if(!(this instanceof f))return new f(m);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},m||{});var x=this.options;x.raw&&0<=x.windowBits&&x.windowBits<16&&(x.windowBits=-x.windowBits,x.windowBits===0&&(x.windowBits=-15)),!(0<=x.windowBits&&x.windowBits<16)||m&&m.windowBits||(x.windowBits+=32),15<x.windowBits&&x.windowBits<48&&(15&x.windowBits)==0&&(x.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var y=s.inflateInit2(this.strm,x.windowBits);if(y!==c.Z_OK)throw new Error(u[y]);this.header=new h,s.inflateGetHeader(this.strm,this.header)}function g(m,x){var y=new f(x);if(y.push(m,!0),y.err)throw y.msg||u[y.err];return y.result}f.prototype.push=function(m,x){var y,b,k,S,j,C,N=this.strm,T=this.options.chunkSize,A=this.options.dictionary,R=!1;if(this.ended)return!1;b=x===~~x?x:x===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof m=="string"?N.input=a.binstring2buf(m):p.call(m)==="[object ArrayBuffer]"?N.input=new Uint8Array(m):N.input=m,N.next_in=0,N.avail_in=N.input.length;do{if(N.avail_out===0&&(N.output=new i.Buf8(T),N.next_out=0,N.avail_out=T),(y=s.inflate(N,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&A&&(C=typeof A=="string"?a.string2buf(A):p.call(A)==="[object ArrayBuffer]"?new Uint8Array(A):A,y=s.inflateSetDictionary(this.strm,C)),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||b!==c.Z_FINISH&&b!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=a.utf8border(N.output,N.next_out),S=N.next_out-k,j=a.buf2string(N.output,k),N.next_out=S,N.avail_out=T-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&&(b=c.Z_FINISH),b===c.Z_FINISH?(y=s.inflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===c.Z_OK):b!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(N.avail_out=0))},f.prototype.onData=function(m){this.chunks.push(m)},f.prototype.onEnd=function(m){m===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},o.Inflate=f,o.inflate=g,o.inflateRaw=function(m,x){return(x=x||{}).raw=!0,g(m,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 h in d)d.hasOwnProperty(h)&&(c[h]=d[h])}}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,h,p){if(u.subarray&&c.subarray)c.set(u.subarray(d,d+h),p);else for(var f=0;f<h;f++)c[p+f]=u[d+f]},flattenChunks:function(c){var u,d,h,p,f,g;for(u=h=0,d=c.length;u<d;u++)h+=c[u].length;for(g=new Uint8Array(h),u=p=0,d=c.length;u<d;u++)f=c[u],g.set(f,p),p+=f.length;return g}},a={arraySet:function(c,u,d,h,p){for(var f=0;f<h;f++)c[p+f]=u[d+f]},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,a))},o.setTyped(s)},{}],42:[function(n,r,o){var s=n("./common"),i=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!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(h,p){if(p<65537&&(h.subarray&&a||!h.subarray&&i))return String.fromCharCode.apply(null,s.shrinkBuf(h,p));for(var f="",g=0;g<p;g++)f+=String.fromCharCode(h[g]);return f}c[254]=c[254]=1,o.string2buf=function(h){var p,f,g,m,x,y=h.length,b=0;for(m=0;m<y;m++)(64512&(f=h.charCodeAt(m)))==55296&&m+1<y&&(64512&(g=h.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(g-56320),m++),b+=f<128?1:f<2048?2:f<65536?3:4;for(p=new s.Buf8(b),m=x=0;x<b;m++)(64512&(f=h.charCodeAt(m)))==55296&&m+1<y&&(64512&(g=h.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(g-56320),m++),f<128?p[x++]=f:(f<2048?p[x++]=192|f>>>6:(f<65536?p[x++]=224|f>>>12:(p[x++]=240|f>>>18,p[x++]=128|f>>>12&63),p[x++]=128|f>>>6&63),p[x++]=128|63&f);return p},o.buf2binstring=function(h){return d(h,h.length)},o.binstring2buf=function(h){for(var p=new s.Buf8(h.length),f=0,g=p.length;f<g;f++)p[f]=h.charCodeAt(f);return p},o.buf2string=function(h,p){var f,g,m,x,y=p||h.length,b=new Array(2*y);for(f=g=0;f<y;)if((m=h[f++])<128)b[g++]=m;else if(4<(x=c[m]))b[g++]=65533,f+=x-1;else{for(m&=x===2?31:x===3?15:7;1<x&&f<y;)m=m<<6|63&h[f++],x--;1<x?b[g++]=65533:m<65536?b[g++]=m:(m-=65536,b[g++]=55296|m>>10&1023,b[g++]=56320|1023&m)}return d(b,g)},o.utf8border=function(h,p){var f;for((p=p||h.length)>h.length&&(p=h.length),f=p-1;0<=f&&(192&h[f])==128;)f--;return f<0||f===0?p:f+c[h[f]]>p?f:p}},{"./common":41}],43:[function(n,r,o){r.exports=function(s,i,a,c){for(var u=65535&s|0,d=s>>>16&65535|0,h=0;a!==0;){for(a-=h=2e3<a?2e3:a;d=d+(u=u+i[c++]|0)|0,--h;);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,a=[],c=0;c<256;c++){i=c;for(var u=0;u<8;u++)i=1&i?3988292384^i>>>1:i>>>1;a[c]=i}return a})();r.exports=function(i,a,c,u){var d=s,h=u+c;i^=-1;for(var p=u;p<h;p++)i=i>>>8^d[255&(i^a[p])];return-1^i}},{}],46:[function(n,r,o){var s,i=n("../utils/common"),a=n("./trees"),c=n("./adler32"),u=n("./crc32"),d=n("./messages"),h=0,p=4,f=0,g=-2,m=-1,x=4,y=2,b=8,k=9,S=286,j=30,C=19,N=2*S+1,T=15,A=3,R=258,M=R+A+1,E=42,L=113,w=1,D=2,W=3,B=4;function q(_,ee){return _.msg=d[ee],ee}function Y(_){return(_<<1)-(4<_?9:0)}function I(_){for(var ee=_.length;0<=--ee;)_[ee]=0}function H(_){var ee=_.state,J=ee.pending;J>_.avail_out&&(J=_.avail_out),J!==0&&(i.arraySet(_.output,ee.pending_buf,ee.pending_out,J,_.next_out),_.next_out+=J,ee.pending_out+=J,_.total_out+=J,_.avail_out-=J,ee.pending-=J,ee.pending===0&&(ee.pending_out=0))}function V(_,ee){a._tr_flush_block(_,0<=_.block_start?_.block_start:-1,_.strstart-_.block_start,ee),_.block_start=_.strstart,H(_.strm)}function z(_,ee){_.pending_buf[_.pending++]=ee}function oe(_,ee){_.pending_buf[_.pending++]=ee>>>8&255,_.pending_buf[_.pending++]=255&ee}function X(_,ee){var J,O,P=_.max_chain_length,F=_.strstart,U=_.prev_length,G=_.nice_match,$=_.strstart>_.w_size-M?_.strstart-(_.w_size-M):0,ne=_.window,le=_.w_mask,se=_.prev,Z=_.strstart+R,re=ne[F+U-1],ue=ne[F+U];_.prev_length>=_.good_match&&(P>>=2),G>_.lookahead&&(G=_.lookahead);do if(ne[(J=ee)+U]===ue&&ne[J+U-1]===re&&ne[J]===ne[F]&&ne[++J]===ne[F+1]){F+=2,J++;do;while(ne[++F]===ne[++J]&&ne[++F]===ne[++J]&&ne[++F]===ne[++J]&&ne[++F]===ne[++J]&&ne[++F]===ne[++J]&&ne[++F]===ne[++J]&&ne[++F]===ne[++J]&&ne[++F]===ne[++J]&&F<Z);if(O=R-(Z-F),F=Z-R,U<O){if(_.match_start=ee,G<=(U=O))break;re=ne[F+U-1],ue=ne[F+U]}}while((ee=se[ee&le])>$&&--P!=0);return U<=_.lookahead?U:_.lookahead}function de(_){var ee,J,O,P,F,U,G,$,ne,le,se=_.w_size;do{if(P=_.window_size-_.lookahead-_.strstart,_.strstart>=se+(se-M)){for(i.arraySet(_.window,_.window,se,se,0),_.match_start-=se,_.strstart-=se,_.block_start-=se,ee=J=_.hash_size;O=_.head[--ee],_.head[ee]=se<=O?O-se:0,--J;);for(ee=J=se;O=_.prev[--ee],_.prev[ee]=se<=O?O-se:0,--J;);P+=se}if(_.strm.avail_in===0)break;if(U=_.strm,G=_.window,$=_.strstart+_.lookahead,ne=P,le=void 0,le=U.avail_in,ne<le&&(le=ne),J=le===0?0:(U.avail_in-=le,i.arraySet(G,U.input,U.next_in,le,$),U.state.wrap===1?U.adler=c(U.adler,G,le,$):U.state.wrap===2&&(U.adler=u(U.adler,G,le,$)),U.next_in+=le,U.total_in+=le,le),_.lookahead+=J,_.lookahead+_.insert>=A)for(F=_.strstart-_.insert,_.ins_h=_.window[F],_.ins_h=(_.ins_h<<_.hash_shift^_.window[F+1])&_.hash_mask;_.insert&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[F+A-1])&_.hash_mask,_.prev[F&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=F,F++,_.insert--,!(_.lookahead+_.insert<A)););}while(_.lookahead<M&&_.strm.avail_in!==0)}function te(_,ee){for(var J,O;;){if(_.lookahead<M){if(de(_),_.lookahead<M&&ee===h)return w;if(_.lookahead===0)break}if(J=0,_.lookahead>=A&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+A-1])&_.hash_mask,J=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),J!==0&&_.strstart-J<=_.w_size-M&&(_.match_length=X(_,J)),_.match_length>=A)if(O=a._tr_tally(_,_.strstart-_.match_start,_.match_length-A),_.lookahead-=_.match_length,_.match_length<=_.max_lazy_match&&_.lookahead>=A){for(_.match_length--;_.strstart++,_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+A-1])&_.hash_mask,J=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart,--_.match_length!=0;);_.strstart++}else _.strstart+=_.match_length,_.match_length=0,_.ins_h=_.window[_.strstart],_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+1])&_.hash_mask;else O=a._tr_tally(_,0,_.window[_.strstart]),_.lookahead--,_.strstart++;if(O&&(V(_,!1),_.strm.avail_out===0))return w}return _.insert=_.strstart<A-1?_.strstart:A-1,ee===p?(V(_,!0),_.strm.avail_out===0?W:B):_.last_lit&&(V(_,!1),_.strm.avail_out===0)?w:D}function ce(_,ee){for(var J,O,P;;){if(_.lookahead<M){if(de(_),_.lookahead<M&&ee===h)return w;if(_.lookahead===0)break}if(J=0,_.lookahead>=A&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+A-1])&_.hash_mask,J=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),_.prev_length=_.match_length,_.prev_match=_.match_start,_.match_length=A-1,J!==0&&_.prev_length<_.max_lazy_match&&_.strstart-J<=_.w_size-M&&(_.match_length=X(_,J),_.match_length<=5&&(_.strategy===1||_.match_length===A&&4096<_.strstart-_.match_start)&&(_.match_length=A-1)),_.prev_length>=A&&_.match_length<=_.prev_length){for(P=_.strstart+_.lookahead-A,O=a._tr_tally(_,_.strstart-1-_.prev_match,_.prev_length-A),_.lookahead-=_.prev_length-1,_.prev_length-=2;++_.strstart<=P&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+A-1])&_.hash_mask,J=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),--_.prev_length!=0;);if(_.match_available=0,_.match_length=A-1,_.strstart++,O&&(V(_,!1),_.strm.avail_out===0))return w}else if(_.match_available){if((O=a._tr_tally(_,0,_.window[_.strstart-1]))&&V(_,!1),_.strstart++,_.lookahead--,_.strm.avail_out===0)return w}else _.match_available=1,_.strstart++,_.lookahead--}return _.match_available&&(O=a._tr_tally(_,0,_.window[_.strstart-1]),_.match_available=0),_.insert=_.strstart<A-1?_.strstart:A-1,ee===p?(V(_,!0),_.strm.avail_out===0?W:B):_.last_lit&&(V(_,!1),_.strm.avail_out===0)?w:D}function fe(_,ee,J,O,P){this.good_length=_,this.max_lazy=ee,this.nice_length=J,this.max_chain=O,this.func=P}function ge(){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=b,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*C+1)),I(this.dyn_ltree),I(this.dyn_dtree),I(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(T+1),this.heap=new i.Buf16(2*S+1),I(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*S+1),I(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function xe(_){var ee;return _&&_.state?(_.total_in=_.total_out=0,_.data_type=y,(ee=_.state).pending=0,ee.pending_out=0,ee.wrap<0&&(ee.wrap=-ee.wrap),ee.status=ee.wrap?E:L,_.adler=ee.wrap===2?0:1,ee.last_flush=h,a._tr_init(ee),f):q(_,g)}function Ee(_){var ee=xe(_);return ee===f&&(function(J){J.window_size=2*J.w_size,I(J.head),J.max_lazy_match=s[J.level].max_lazy,J.good_match=s[J.level].good_length,J.nice_match=s[J.level].nice_length,J.max_chain_length=s[J.level].max_chain,J.strstart=0,J.block_start=0,J.lookahead=0,J.insert=0,J.match_length=J.prev_length=A-1,J.match_available=0,J.ins_h=0})(_.state),ee}function Oe(_,ee,J,O,P,F){if(!_)return g;var U=1;if(ee===m&&(ee=6),O<0?(U=0,O=-O):15<O&&(U=2,O-=16),P<1||k<P||J!==b||O<8||15<O||ee<0||9<ee||F<0||x<F)return q(_,g);O===8&&(O=9);var G=new ge;return(_.state=G).strm=_,G.wrap=U,G.gzhead=null,G.w_bits=O,G.w_size=1<<G.w_bits,G.w_mask=G.w_size-1,G.hash_bits=P+7,G.hash_size=1<<G.hash_bits,G.hash_mask=G.hash_size-1,G.hash_shift=~~((G.hash_bits+A-1)/A),G.window=new i.Buf8(2*G.w_size),G.head=new i.Buf16(G.hash_size),G.prev=new i.Buf16(G.w_size),G.lit_bufsize=1<<P+6,G.pending_buf_size=4*G.lit_bufsize,G.pending_buf=new i.Buf8(G.pending_buf_size),G.d_buf=1*G.lit_bufsize,G.l_buf=3*G.lit_bufsize,G.level=ee,G.strategy=F,G.method=J,Ee(_)}s=[new fe(0,0,0,0,function(_,ee){var J=65535;for(J>_.pending_buf_size-5&&(J=_.pending_buf_size-5);;){if(_.lookahead<=1){if(de(_),_.lookahead===0&&ee===h)return w;if(_.lookahead===0)break}_.strstart+=_.lookahead,_.lookahead=0;var O=_.block_start+J;if((_.strstart===0||_.strstart>=O)&&(_.lookahead=_.strstart-O,_.strstart=O,V(_,!1),_.strm.avail_out===0)||_.strstart-_.block_start>=_.w_size-M&&(V(_,!1),_.strm.avail_out===0))return w}return _.insert=0,ee===p?(V(_,!0),_.strm.avail_out===0?W:B):(_.strstart>_.block_start&&(V(_,!1),_.strm.avail_out),w)}),new fe(4,4,8,4,te),new fe(4,5,16,8,te),new fe(4,6,32,32,te),new fe(4,4,16,16,ce),new fe(8,16,32,32,ce),new fe(8,16,128,128,ce),new fe(8,32,128,256,ce),new fe(32,128,258,1024,ce),new fe(32,258,258,4096,ce)],o.deflateInit=function(_,ee){return Oe(_,ee,b,15,8,0)},o.deflateInit2=Oe,o.deflateReset=Ee,o.deflateResetKeep=xe,o.deflateSetHeader=function(_,ee){return _&&_.state?_.state.wrap!==2?g:(_.state.gzhead=ee,f):g},o.deflate=function(_,ee){var J,O,P,F;if(!_||!_.state||5<ee||ee<0)return _?q(_,g):g;if(O=_.state,!_.output||!_.input&&_.avail_in!==0||O.status===666&&ee!==p)return q(_,_.avail_out===0?-5:g);if(O.strm=_,J=O.last_flush,O.last_flush=ee,O.status===E)if(O.wrap===2)_.adler=0,z(O,31),z(O,139),z(O,8),O.gzhead?(z(O,(O.gzhead.text?1:0)+(O.gzhead.hcrc?2:0)+(O.gzhead.extra?4:0)+(O.gzhead.name?8:0)+(O.gzhead.comment?16:0)),z(O,255&O.gzhead.time),z(O,O.gzhead.time>>8&255),z(O,O.gzhead.time>>16&255),z(O,O.gzhead.time>>24&255),z(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),z(O,255&O.gzhead.os),O.gzhead.extra&&O.gzhead.extra.length&&(z(O,255&O.gzhead.extra.length),z(O,O.gzhead.extra.length>>8&255)),O.gzhead.hcrc&&(_.adler=u(_.adler,O.pending_buf,O.pending,0)),O.gzindex=0,O.status=69):(z(O,0),z(O,0),z(O,0),z(O,0),z(O,0),z(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),z(O,3),O.status=L);else{var U=b+(O.w_bits-8<<4)<<8;U|=(2<=O.strategy||O.level<2?0:O.level<6?1:O.level===6?2:3)<<6,O.strstart!==0&&(U|=32),U+=31-U%31,O.status=L,oe(O,U),O.strstart!==0&&(oe(O,_.adler>>>16),oe(O,65535&_.adler)),_.adler=1}if(O.status===69)if(O.gzhead.extra){for(P=O.pending;O.gzindex<(65535&O.gzhead.extra.length)&&(O.pending!==O.pending_buf_size||(O.gzhead.hcrc&&O.pending>P&&(_.adler=u(_.adler,O.pending_buf,O.pending-P,P)),H(_),P=O.pending,O.pending!==O.pending_buf_size));)z(O,255&O.gzhead.extra[O.gzindex]),O.gzindex++;O.gzhead.hcrc&&O.pending>P&&(_.adler=u(_.adler,O.pending_buf,O.pending-P,P)),O.gzindex===O.gzhead.extra.length&&(O.gzindex=0,O.status=73)}else O.status=73;if(O.status===73)if(O.gzhead.name){P=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>P&&(_.adler=u(_.adler,O.pending_buf,O.pending-P,P)),H(_),P=O.pending,O.pending===O.pending_buf_size)){F=1;break}F=O.gzindex<O.gzhead.name.length?255&O.gzhead.name.charCodeAt(O.gzindex++):0,z(O,F)}while(F!==0);O.gzhead.hcrc&&O.pending>P&&(_.adler=u(_.adler,O.pending_buf,O.pending-P,P)),F===0&&(O.gzindex=0,O.status=91)}else O.status=91;if(O.status===91)if(O.gzhead.comment){P=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>P&&(_.adler=u(_.adler,O.pending_buf,O.pending-P,P)),H(_),P=O.pending,O.pending===O.pending_buf_size)){F=1;break}F=O.gzindex<O.gzhead.comment.length?255&O.gzhead.comment.charCodeAt(O.gzindex++):0,z(O,F)}while(F!==0);O.gzhead.hcrc&&O.pending>P&&(_.adler=u(_.adler,O.pending_buf,O.pending-P,P)),F===0&&(O.status=103)}else O.status=103;if(O.status===103&&(O.gzhead.hcrc?(O.pending+2>O.pending_buf_size&&H(_),O.pending+2<=O.pending_buf_size&&(z(O,255&_.adler),z(O,_.adler>>8&255),_.adler=0,O.status=L)):O.status=L),O.pending!==0){if(H(_),_.avail_out===0)return O.last_flush=-1,f}else if(_.avail_in===0&&Y(ee)<=Y(J)&&ee!==p)return q(_,-5);if(O.status===666&&_.avail_in!==0)return q(_,-5);if(_.avail_in!==0||O.lookahead!==0||ee!==h&&O.status!==666){var G=O.strategy===2?(function($,ne){for(var le;;){if($.lookahead===0&&(de($),$.lookahead===0)){if(ne===h)return w;break}if($.match_length=0,le=a._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,le&&(V($,!1),$.strm.avail_out===0))return w}return $.insert=0,ne===p?(V($,!0),$.strm.avail_out===0?W:B):$.last_lit&&(V($,!1),$.strm.avail_out===0)?w:D})(O,ee):O.strategy===3?(function($,ne){for(var le,se,Z,re,ue=$.window;;){if($.lookahead<=R){if(de($),$.lookahead<=R&&ne===h)return w;if($.lookahead===0)break}if($.match_length=0,$.lookahead>=A&&0<$.strstart&&(se=ue[Z=$.strstart-1])===ue[++Z]&&se===ue[++Z]&&se===ue[++Z]){re=$.strstart+R;do;while(se===ue[++Z]&&se===ue[++Z]&&se===ue[++Z]&&se===ue[++Z]&&se===ue[++Z]&&se===ue[++Z]&&se===ue[++Z]&&se===ue[++Z]&&Z<re);$.match_length=R-(re-Z),$.match_length>$.lookahead&&($.match_length=$.lookahead)}if($.match_length>=A?(le=a._tr_tally($,1,$.match_length-A),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0):(le=a._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++),le&&(V($,!1),$.strm.avail_out===0))return w}return $.insert=0,ne===p?(V($,!0),$.strm.avail_out===0?W:B):$.last_lit&&(V($,!1),$.strm.avail_out===0)?w:D})(O,ee):s[O.level].func(O,ee);if(G!==W&&G!==B||(O.status=666),G===w||G===W)return _.avail_out===0&&(O.last_flush=-1),f;if(G===D&&(ee===1?a._tr_align(O):ee!==5&&(a._tr_stored_block(O,0,0,!1),ee===3&&(I(O.head),O.lookahead===0&&(O.strstart=0,O.block_start=0,O.insert=0))),H(_),_.avail_out===0))return O.last_flush=-1,f}return ee!==p?f:O.wrap<=0?1:(O.wrap===2?(z(O,255&_.adler),z(O,_.adler>>8&255),z(O,_.adler>>16&255),z(O,_.adler>>24&255),z(O,255&_.total_in),z(O,_.total_in>>8&255),z(O,_.total_in>>16&255),z(O,_.total_in>>24&255)):(oe(O,_.adler>>>16),oe(O,65535&_.adler)),H(_),0<O.wrap&&(O.wrap=-O.wrap),O.pending!==0?f:1)},o.deflateEnd=function(_){var ee;return _&&_.state?(ee=_.state.status)!==E&&ee!==69&&ee!==73&&ee!==91&&ee!==103&&ee!==L&&ee!==666?q(_,g):(_.state=null,ee===L?q(_,-3):f):g},o.deflateSetDictionary=function(_,ee){var J,O,P,F,U,G,$,ne,le=ee.length;if(!_||!_.state||(F=(J=_.state).wrap)===2||F===1&&J.status!==E||J.lookahead)return g;for(F===1&&(_.adler=c(_.adler,ee,le,0)),J.wrap=0,le>=J.w_size&&(F===0&&(I(J.head),J.strstart=0,J.block_start=0,J.insert=0),ne=new i.Buf8(J.w_size),i.arraySet(ne,ee,le-J.w_size,J.w_size,0),ee=ne,le=J.w_size),U=_.avail_in,G=_.next_in,$=_.input,_.avail_in=le,_.next_in=0,_.input=ee,de(J);J.lookahead>=A;){for(O=J.strstart,P=J.lookahead-(A-1);J.ins_h=(J.ins_h<<J.hash_shift^J.window[O+A-1])&J.hash_mask,J.prev[O&J.w_mask]=J.head[J.ins_h],J.head[J.ins_h]=O,O++,--P;);J.strstart=O,J.lookahead=A-1,de(J)}return J.strstart+=J.lookahead,J.block_start=J.strstart,J.insert=J.lookahead,J.lookahead=0,J.match_length=J.prev_length=A-1,J.match_available=0,_.next_in=G,_.input=$,_.avail_in=U,J.wrap=F,f},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 a,c,u,d,h,p,f,g,m,x,y,b,k,S,j,C,N,T,A,R,M,E,L,w,D;a=s.state,c=s.next_in,w=s.input,u=c+(s.avail_in-5),d=s.next_out,D=s.output,h=d-(i-s.avail_out),p=d+(s.avail_out-257),f=a.dmax,g=a.wsize,m=a.whave,x=a.wnext,y=a.window,b=a.hold,k=a.bits,S=a.lencode,j=a.distcode,C=(1<<a.lenbits)-1,N=(1<<a.distbits)-1;e:do{k<15&&(b+=w[c++]<<k,k+=8,b+=w[c++]<<k,k+=8),T=S[b&C];t:for(;;){if(b>>>=A=T>>>24,k-=A,(A=T>>>16&255)===0)D[d++]=65535&T;else{if(!(16&A)){if((64&A)==0){T=S[(65535&T)+(b&(1<<A)-1)];continue t}if(32&A){a.mode=12;break e}s.msg="invalid literal/length code",a.mode=30;break e}R=65535&T,(A&=15)&&(k<A&&(b+=w[c++]<<k,k+=8),R+=b&(1<<A)-1,b>>>=A,k-=A),k<15&&(b+=w[c++]<<k,k+=8,b+=w[c++]<<k,k+=8),T=j[b&N];n:for(;;){if(b>>>=A=T>>>24,k-=A,!(16&(A=T>>>16&255))){if((64&A)==0){T=j[(65535&T)+(b&(1<<A)-1)];continue n}s.msg="invalid distance code",a.mode=30;break e}if(M=65535&T,k<(A&=15)&&(b+=w[c++]<<k,(k+=8)<A&&(b+=w[c++]<<k,k+=8)),f<(M+=b&(1<<A)-1)){s.msg="invalid distance too far back",a.mode=30;break e}if(b>>>=A,k-=A,(A=d-h)<M){if(m<(A=M-A)&&a.sane){s.msg="invalid distance too far back",a.mode=30;break e}if(L=y,(E=0)===x){if(E+=g-A,A<R){for(R-=A;D[d++]=y[E++],--A;);E=d-M,L=D}}else if(x<A){if(E+=g+x-A,(A-=x)<R){for(R-=A;D[d++]=y[E++],--A;);if(E=0,x<R){for(R-=A=x;D[d++]=y[E++],--A;);E=d-M,L=D}}}else if(E+=x-A,A<R){for(R-=A;D[d++]=y[E++],--A;);E=d-M,L=D}for(;2<R;)D[d++]=L[E++],D[d++]=L[E++],D[d++]=L[E++],R-=3;R&&(D[d++]=L[E++],1<R&&(D[d++]=L[E++]))}else{for(E=d-M;D[d++]=D[E++],D[d++]=D[E++],D[d++]=D[E++],2<(R-=3););R&&(D[d++]=D[E++],1<R&&(D[d++]=D[E++]))}break}}break}}while(c<u&&d<p);c-=R=k>>3,b&=(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<p?p-d+257:257-(d-p),a.hold=b,a.bits=k}},{}],49:[function(n,r,o){var s=n("../utils/common"),i=n("./adler32"),a=n("./crc32"),c=n("./inffast"),u=n("./inftrees"),d=1,h=2,p=0,f=-2,g=1,m=852,x=592;function y(E){return(E>>>24&255)+(E>>>8&65280)+((65280&E)<<8)+((255&E)<<24)}function b(){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(E){var L;return E&&E.state?(L=E.state,E.total_in=E.total_out=L.total=0,E.msg="",L.wrap&&(E.adler=1&L.wrap),L.mode=g,L.last=0,L.havedict=0,L.dmax=32768,L.head=null,L.hold=0,L.bits=0,L.lencode=L.lendyn=new s.Buf32(m),L.distcode=L.distdyn=new s.Buf32(x),L.sane=1,L.back=-1,p):f}function S(E){var L;return E&&E.state?((L=E.state).wsize=0,L.whave=0,L.wnext=0,k(E)):f}function j(E,L){var w,D;return E&&E.state?(D=E.state,L<0?(w=0,L=-L):(w=1+(L>>4),L<48&&(L&=15)),L&&(L<8||15<L)?f:(D.window!==null&&D.wbits!==L&&(D.window=null),D.wrap=w,D.wbits=L,S(E))):f}function C(E,L){var w,D;return E?(D=new b,(E.state=D).window=null,(w=j(E,L))!==p&&(E.state=null),w):f}var N,T,A=!0;function R(E){if(A){var L;for(N=new s.Buf32(512),T=new s.Buf32(32),L=0;L<144;)E.lens[L++]=8;for(;L<256;)E.lens[L++]=9;for(;L<280;)E.lens[L++]=7;for(;L<288;)E.lens[L++]=8;for(u(d,E.lens,0,288,N,0,E.work,{bits:9}),L=0;L<32;)E.lens[L++]=5;u(h,E.lens,0,32,T,0,E.work,{bits:5}),A=!1}E.lencode=N,E.lenbits=9,E.distcode=T,E.distbits=5}function M(E,L,w,D){var W,B=E.state;return B.window===null&&(B.wsize=1<<B.wbits,B.wnext=0,B.whave=0,B.window=new s.Buf8(B.wsize)),D>=B.wsize?(s.arraySet(B.window,L,w-B.wsize,B.wsize,0),B.wnext=0,B.whave=B.wsize):(D<(W=B.wsize-B.wnext)&&(W=D),s.arraySet(B.window,L,w-D,W,B.wnext),(D-=W)?(s.arraySet(B.window,L,w-D,D,0),B.wnext=D,B.whave=B.wsize):(B.wnext+=W,B.wnext===B.wsize&&(B.wnext=0),B.whave<B.wsize&&(B.whave+=W))),0}o.inflateReset=S,o.inflateReset2=j,o.inflateResetKeep=k,o.inflateInit=function(E){return C(E,15)},o.inflateInit2=C,o.inflate=function(E,L){var w,D,W,B,q,Y,I,H,V,z,oe,X,de,te,ce,fe,ge,xe,Ee,Oe,_,ee,J,O,P=0,F=new s.Buf8(4),U=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!E||!E.state||!E.output||!E.input&&E.avail_in!==0)return f;(w=E.state).mode===12&&(w.mode=13),q=E.next_out,W=E.output,I=E.avail_out,B=E.next_in,D=E.input,Y=E.avail_in,H=w.hold,V=w.bits,z=Y,oe=I,ee=p;e:for(;;)switch(w.mode){case g:if(w.wrap===0){w.mode=13;break}for(;V<16;){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}if(2&w.wrap&&H===35615){F[w.check=0]=255&H,F[1]=H>>>8&255,w.check=a(w.check,F,2,0),V=H=0,w.mode=2;break}if(w.flags=0,w.head&&(w.head.done=!1),!(1&w.wrap)||(((255&H)<<8)+(H>>8))%31){E.msg="incorrect header check",w.mode=30;break}if((15&H)!=8){E.msg="unknown compression method",w.mode=30;break}if(V-=4,_=8+(15&(H>>>=4)),w.wbits===0)w.wbits=_;else if(_>w.wbits){E.msg="invalid window size",w.mode=30;break}w.dmax=1<<_,E.adler=w.check=1,w.mode=512&H?10:12,V=H=0;break;case 2:for(;V<16;){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}if(w.flags=H,(255&w.flags)!=8){E.msg="unknown compression method",w.mode=30;break}if(57344&w.flags){E.msg="unknown header flags set",w.mode=30;break}w.head&&(w.head.text=H>>8&1),512&w.flags&&(F[0]=255&H,F[1]=H>>>8&255,w.check=a(w.check,F,2,0)),V=H=0,w.mode=3;case 3:for(;V<32;){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}w.head&&(w.head.time=H),512&w.flags&&(F[0]=255&H,F[1]=H>>>8&255,F[2]=H>>>16&255,F[3]=H>>>24&255,w.check=a(w.check,F,4,0)),V=H=0,w.mode=4;case 4:for(;V<16;){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}w.head&&(w.head.xflags=255&H,w.head.os=H>>8),512&w.flags&&(F[0]=255&H,F[1]=H>>>8&255,w.check=a(w.check,F,2,0)),V=H=0,w.mode=5;case 5:if(1024&w.flags){for(;V<16;){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}w.length=H,w.head&&(w.head.extra_len=H),512&w.flags&&(F[0]=255&H,F[1]=H>>>8&255,w.check=a(w.check,F,2,0)),V=H=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&(Y<(X=w.length)&&(X=Y),X&&(w.head&&(_=w.head.extra_len-w.length,w.head.extra||(w.head.extra=new Array(w.head.extra_len)),s.arraySet(w.head.extra,D,B,X,_)),512&w.flags&&(w.check=a(w.check,D,X,B)),Y-=X,B+=X,w.length-=X),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if(Y===0)break e;for(X=0;_=D[B+X++],w.head&&_&&w.length<65536&&(w.head.name+=String.fromCharCode(_)),_&&X<Y;);if(512&w.flags&&(w.check=a(w.check,D,X,B)),Y-=X,B+=X,_)break e}else w.head&&(w.head.name=null);w.length=0,w.mode=8;case 8:if(4096&w.flags){if(Y===0)break e;for(X=0;_=D[B+X++],w.head&&_&&w.length<65536&&(w.head.comment+=String.fromCharCode(_)),_&&X<Y;);if(512&w.flags&&(w.check=a(w.check,D,X,B)),Y-=X,B+=X,_)break e}else w.head&&(w.head.comment=null);w.mode=9;case 9:if(512&w.flags){for(;V<16;){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}if(H!==(65535&w.check)){E.msg="header crc mismatch",w.mode=30;break}V=H=0}w.head&&(w.head.hcrc=w.flags>>9&1,w.head.done=!0),E.adler=w.check=0,w.mode=12;break;case 10:for(;V<32;){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}E.adler=w.check=y(H),V=H=0,w.mode=11;case 11:if(w.havedict===0)return E.next_out=q,E.avail_out=I,E.next_in=B,E.avail_in=Y,w.hold=H,w.bits=V,2;E.adler=w.check=1,w.mode=12;case 12:if(L===5||L===6)break e;case 13:if(w.last){H>>>=7&V,V-=7&V,w.mode=27;break}for(;V<3;){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}switch(w.last=1&H,V-=1,3&(H>>>=1)){case 0:w.mode=14;break;case 1:if(R(w),w.mode=20,L!==6)break;H>>>=2,V-=2;break e;case 2:w.mode=17;break;case 3:E.msg="invalid block type",w.mode=30}H>>>=2,V-=2;break;case 14:for(H>>>=7&V,V-=7&V;V<32;){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}if((65535&H)!=(H>>>16^65535)){E.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&H,V=H=0,w.mode=15,L===6)break e;case 15:w.mode=16;case 16:if(X=w.length){if(Y<X&&(X=Y),I<X&&(X=I),X===0)break e;s.arraySet(W,D,B,X,q),Y-=X,B+=X,I-=X,q+=X,w.length-=X;break}w.mode=12;break;case 17:for(;V<14;){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}if(w.nlen=257+(31&H),H>>>=5,V-=5,w.ndist=1+(31&H),H>>>=5,V-=5,w.ncode=4+(15&H),H>>>=4,V-=4,286<w.nlen||30<w.ndist){E.msg="too many length or distance symbols",w.mode=30;break}w.have=0,w.mode=18;case 18:for(;w.have<w.ncode;){for(;V<3;){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}w.lens[U[w.have++]]=7&H,H>>>=3,V-=3}for(;w.have<19;)w.lens[U[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,J={bits:w.lenbits},ee=u(0,w.lens,0,19,w.lencode,0,w.work,J),w.lenbits=J.bits,ee){E.msg="invalid code lengths set",w.mode=30;break}w.have=0,w.mode=19;case 19:for(;w.have<w.nlen+w.ndist;){for(;fe=(P=w.lencode[H&(1<<w.lenbits)-1])>>>16&255,ge=65535&P,!((ce=P>>>24)<=V);){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}if(ge<16)H>>>=ce,V-=ce,w.lens[w.have++]=ge;else{if(ge===16){for(O=ce+2;V<O;){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}if(H>>>=ce,V-=ce,w.have===0){E.msg="invalid bit length repeat",w.mode=30;break}_=w.lens[w.have-1],X=3+(3&H),H>>>=2,V-=2}else if(ge===17){for(O=ce+3;V<O;){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}V-=ce,_=0,X=3+(7&(H>>>=ce)),H>>>=3,V-=3}else{for(O=ce+7;V<O;){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}V-=ce,_=0,X=11+(127&(H>>>=ce)),H>>>=7,V-=7}if(w.have+X>w.nlen+w.ndist){E.msg="invalid bit length repeat",w.mode=30;break}for(;X--;)w.lens[w.have++]=_}}if(w.mode===30)break;if(w.lens[256]===0){E.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,J={bits:w.lenbits},ee=u(d,w.lens,0,w.nlen,w.lencode,0,w.work,J),w.lenbits=J.bits,ee){E.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,J={bits:w.distbits},ee=u(h,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,J),w.distbits=J.bits,ee){E.msg="invalid distances set",w.mode=30;break}if(w.mode=20,L===6)break e;case 20:w.mode=21;case 21:if(6<=Y&&258<=I){E.next_out=q,E.avail_out=I,E.next_in=B,E.avail_in=Y,w.hold=H,w.bits=V,c(E,oe),q=E.next_out,W=E.output,I=E.avail_out,B=E.next_in,D=E.input,Y=E.avail_in,H=w.hold,V=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;fe=(P=w.lencode[H&(1<<w.lenbits)-1])>>>16&255,ge=65535&P,!((ce=P>>>24)<=V);){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}if(fe&&(240&fe)==0){for(xe=ce,Ee=fe,Oe=ge;fe=(P=w.lencode[Oe+((H&(1<<xe+Ee)-1)>>xe)])>>>16&255,ge=65535&P,!(xe+(ce=P>>>24)<=V);){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}H>>>=xe,V-=xe,w.back+=xe}if(H>>>=ce,V-=ce,w.back+=ce,w.length=ge,fe===0){w.mode=26;break}if(32&fe){w.back=-1,w.mode=12;break}if(64&fe){E.msg="invalid literal/length code",w.mode=30;break}w.extra=15&fe,w.mode=22;case 22:if(w.extra){for(O=w.extra;V<O;){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}w.length+=H&(1<<w.extra)-1,H>>>=w.extra,V-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;fe=(P=w.distcode[H&(1<<w.distbits)-1])>>>16&255,ge=65535&P,!((ce=P>>>24)<=V);){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}if((240&fe)==0){for(xe=ce,Ee=fe,Oe=ge;fe=(P=w.distcode[Oe+((H&(1<<xe+Ee)-1)>>xe)])>>>16&255,ge=65535&P,!(xe+(ce=P>>>24)<=V);){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}H>>>=xe,V-=xe,w.back+=xe}if(H>>>=ce,V-=ce,w.back+=ce,64&fe){E.msg="invalid distance code",w.mode=30;break}w.offset=ge,w.extra=15&fe,w.mode=24;case 24:if(w.extra){for(O=w.extra;V<O;){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}w.offset+=H&(1<<w.extra)-1,H>>>=w.extra,V-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){E.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(I===0)break e;if(X=oe-I,w.offset>X){if((X=w.offset-X)>w.whave&&w.sane){E.msg="invalid distance too far back",w.mode=30;break}de=X>w.wnext?(X-=w.wnext,w.wsize-X):w.wnext-X,X>w.length&&(X=w.length),te=w.window}else te=W,de=q-w.offset,X=w.length;for(I<X&&(X=I),I-=X,w.length-=X;W[q++]=te[de++],--X;);w.length===0&&(w.mode=21);break;case 26:if(I===0)break e;W[q++]=w.length,I--,w.mode=21;break;case 27:if(w.wrap){for(;V<32;){if(Y===0)break e;Y--,H|=D[B++]<<V,V+=8}if(oe-=I,E.total_out+=oe,w.total+=oe,oe&&(E.adler=w.check=w.flags?a(w.check,W,oe,q-oe):i(w.check,W,oe,q-oe)),oe=I,(w.flags?H:y(H))!==w.check){E.msg="incorrect data check",w.mode=30;break}V=H=0}w.mode=28;case 28:if(w.wrap&&w.flags){for(;V<32;){if(Y===0)break e;Y--,H+=D[B++]<<V,V+=8}if(H!==(4294967295&w.total)){E.msg="incorrect length check",w.mode=30;break}V=H=0}w.mode=29;case 29:ee=1;break e;case 30:ee=-3;break e;case 31:return-4;default:return f}return E.next_out=q,E.avail_out=I,E.next_in=B,E.avail_in=Y,w.hold=H,w.bits=V,(w.wsize||oe!==E.avail_out&&w.mode<30&&(w.mode<27||L!==4))&&M(E,E.output,E.next_out,oe-E.avail_out)?(w.mode=31,-4):(z-=E.avail_in,oe-=E.avail_out,E.total_in+=z,E.total_out+=oe,w.total+=oe,w.wrap&&oe&&(E.adler=w.check=w.flags?a(w.check,W,oe,E.next_out-oe):i(w.check,W,oe,E.next_out-oe)),E.data_type=w.bits+(w.last?64:0)+(w.mode===12?128:0)+(w.mode===20||w.mode===15?256:0),(z==0&&oe===0||L===4)&&ee===p&&(ee=-5),ee)},o.inflateEnd=function(E){if(!E||!E.state)return f;var L=E.state;return L.window&&(L.window=null),E.state=null,p},o.inflateGetHeader=function(E,L){var w;return E&&E.state?(2&(w=E.state).wrap)==0?f:((w.head=L).done=!1,p):f},o.inflateSetDictionary=function(E,L){var w,D=L.length;return E&&E.state?(w=E.state).wrap!==0&&w.mode!==11?f:w.mode===11&&i(1,L,D,0)!==w.check?-3:M(E,L,D,D)?(w.mode=31,-4):(w.havedict=1,p):f},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],a=[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,h,p,f,g,m,x,y){var b,k,S,j,C,N,T,A,R,M=y.bits,E=0,L=0,w=0,D=0,W=0,B=0,q=0,Y=0,I=0,H=0,V=null,z=0,oe=new s.Buf16(16),X=new s.Buf16(16),de=null,te=0;for(E=0;E<=15;E++)oe[E]=0;for(L=0;L<f;L++)oe[h[p+L]]++;for(W=M,D=15;1<=D&&oe[D]===0;D--);if(D<W&&(W=D),D===0)return g[m++]=20971520,g[m++]=20971520,y.bits=1,0;for(w=1;w<D&&oe[w]===0;w++);for(W<w&&(W=w),E=Y=1;E<=15;E++)if(Y<<=1,(Y-=oe[E])<0)return-1;if(0<Y&&(d===0||D!==1))return-1;for(X[1]=0,E=1;E<15;E++)X[E+1]=X[E]+oe[E];for(L=0;L<f;L++)h[p+L]!==0&&(x[X[h[p+L]]++]=L);if(N=d===0?(V=de=x,19):d===1?(V=i,z-=257,de=a,te-=257,256):(V=c,de=u,-1),E=w,C=m,q=L=H=0,S=-1,j=(I=1<<(B=W))-1,d===1&&852<I||d===2&&592<I)return 1;for(;;){for(T=E-q,R=x[L]<N?(A=0,x[L]):x[L]>N?(A=de[te+x[L]],V[z+x[L]]):(A=96,0),b=1<<E-q,w=k=1<<B;g[C+(H>>q)+(k-=b)]=T<<24|A<<16|R|0,k!==0;);for(b=1<<E-1;H&b;)b>>=1;if(b!==0?(H&=b-1,H+=b):H=0,L++,--oe[E]==0){if(E===D)break;E=h[p+x[L]]}if(W<E&&(H&j)!==S){for(q===0&&(q=W),C+=w,Y=1<<(B=E-q);B+q<D&&!((Y-=oe[B+q])<=0);)B++,Y<<=1;if(I+=1<<B,d===1&&852<I||d===2&&592<I)return 1;g[S=H&j]=W<<24|B<<16|C-m|0}}return H!==0&&(g[C+H]=E-q<<24|64<<16|0),y.bits=W,0}},{"../utils/common":41}],51:[function(n,r,o){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){var s=n("../utils/common"),i=0,a=1;function c(P){for(var F=P.length;0<=--F;)P[F]=0}var u=0,d=29,h=256,p=h+1+d,f=30,g=19,m=2*p+1,x=15,y=16,b=7,k=256,S=16,j=17,C=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],T=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],R=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],M=new Array(2*(p+2));c(M);var E=new Array(2*f);c(E);var L=new Array(512);c(L);var w=new Array(256);c(w);var D=new Array(d);c(D);var W,B,q,Y=new Array(f);function I(P,F,U,G,$){this.static_tree=P,this.extra_bits=F,this.extra_base=U,this.elems=G,this.max_length=$,this.has_stree=P&&P.length}function H(P,F){this.dyn_tree=P,this.max_code=0,this.stat_desc=F}function V(P){return P<256?L[P]:L[256+(P>>>7)]}function z(P,F){P.pending_buf[P.pending++]=255&F,P.pending_buf[P.pending++]=F>>>8&255}function oe(P,F,U){P.bi_valid>y-U?(P.bi_buf|=F<<P.bi_valid&65535,z(P,P.bi_buf),P.bi_buf=F>>y-P.bi_valid,P.bi_valid+=U-y):(P.bi_buf|=F<<P.bi_valid&65535,P.bi_valid+=U)}function X(P,F,U){oe(P,U[2*F],U[2*F+1])}function de(P,F){for(var U=0;U|=1&P,P>>>=1,U<<=1,0<--F;);return U>>>1}function te(P,F,U){var G,$,ne=new Array(x+1),le=0;for(G=1;G<=x;G++)ne[G]=le=le+U[G-1]<<1;for($=0;$<=F;$++){var se=P[2*$+1];se!==0&&(P[2*$]=de(ne[se]++,se))}}function ce(P){var F;for(F=0;F<p;F++)P.dyn_ltree[2*F]=0;for(F=0;F<f;F++)P.dyn_dtree[2*F]=0;for(F=0;F<g;F++)P.bl_tree[2*F]=0;P.dyn_ltree[2*k]=1,P.opt_len=P.static_len=0,P.last_lit=P.matches=0}function fe(P){8<P.bi_valid?z(P,P.bi_buf):0<P.bi_valid&&(P.pending_buf[P.pending++]=P.bi_buf),P.bi_buf=0,P.bi_valid=0}function ge(P,F,U,G){var $=2*F,ne=2*U;return P[$]<P[ne]||P[$]===P[ne]&&G[F]<=G[U]}function xe(P,F,U){for(var G=P.heap[U],$=U<<1;$<=P.heap_len&&($<P.heap_len&&ge(F,P.heap[$+1],P.heap[$],P.depth)&&$++,!ge(F,G,P.heap[$],P.depth));)P.heap[U]=P.heap[$],U=$,$<<=1;P.heap[U]=G}function Ee(P,F,U){var G,$,ne,le,se=0;if(P.last_lit!==0)for(;G=P.pending_buf[P.d_buf+2*se]<<8|P.pending_buf[P.d_buf+2*se+1],$=P.pending_buf[P.l_buf+se],se++,G===0?X(P,$,F):(X(P,(ne=w[$])+h+1,F),(le=N[ne])!==0&&oe(P,$-=D[ne],le),X(P,ne=V(--G),U),(le=T[ne])!==0&&oe(P,G-=Y[ne],le)),se<P.last_lit;);X(P,k,F)}function Oe(P,F){var U,G,$,ne=F.dyn_tree,le=F.stat_desc.static_tree,se=F.stat_desc.has_stree,Z=F.stat_desc.elems,re=-1;for(P.heap_len=0,P.heap_max=m,U=0;U<Z;U++)ne[2*U]!==0?(P.heap[++P.heap_len]=re=U,P.depth[U]=0):ne[2*U+1]=0;for(;P.heap_len<2;)ne[2*($=P.heap[++P.heap_len]=re<2?++re:0)]=1,P.depth[$]=0,P.opt_len--,se&&(P.static_len-=le[2*$+1]);for(F.max_code=re,U=P.heap_len>>1;1<=U;U--)xe(P,ne,U);for($=Z;U=P.heap[1],P.heap[1]=P.heap[P.heap_len--],xe(P,ne,1),G=P.heap[1],P.heap[--P.heap_max]=U,P.heap[--P.heap_max]=G,ne[2*$]=ne[2*U]+ne[2*G],P.depth[$]=(P.depth[U]>=P.depth[G]?P.depth[U]:P.depth[G])+1,ne[2*U+1]=ne[2*G+1]=$,P.heap[1]=$++,xe(P,ne,1),2<=P.heap_len;);P.heap[--P.heap_max]=P.heap[1],(function(ue,be){var Ae,We,ft,Ie,It,Ut,Ve=be.dyn_tree,Zt=be.max_code,Ct=be.stat_desc.static_tree,Gp=be.stat_desc.has_stree,Yp=be.stat_desc.extra_bits,Fa=be.stat_desc.extra_base,ir=be.stat_desc.max_length,Lr=0;for(Ie=0;Ie<=x;Ie++)ue.bl_count[Ie]=0;for(Ve[2*ue.heap[ue.heap_max]+1]=0,Ae=ue.heap_max+1;Ae<m;Ae++)ir<(Ie=Ve[2*Ve[2*(We=ue.heap[Ae])+1]+1]+1)&&(Ie=ir,Lr++),Ve[2*We+1]=Ie,Zt<We||(ue.bl_count[Ie]++,It=0,Fa<=We&&(It=Yp[We-Fa]),Ut=Ve[2*We],ue.opt_len+=Ut*(Ie+It),Gp&&(ue.static_len+=Ut*(Ct[2*We+1]+It)));if(Lr!==0){do{for(Ie=ir-1;ue.bl_count[Ie]===0;)Ie--;ue.bl_count[Ie]--,ue.bl_count[Ie+1]+=2,ue.bl_count[ir]--,Lr-=2}while(0<Lr);for(Ie=ir;Ie!==0;Ie--)for(We=ue.bl_count[Ie];We!==0;)Zt<(ft=ue.heap[--Ae])||(Ve[2*ft+1]!==Ie&&(ue.opt_len+=(Ie-Ve[2*ft+1])*Ve[2*ft],Ve[2*ft+1]=Ie),We--)}})(P,F),te(ne,re,P.bl_count)}function _(P,F,U){var G,$,ne=-1,le=F[1],se=0,Z=7,re=4;for(le===0&&(Z=138,re=3),F[2*(U+1)+1]=65535,G=0;G<=U;G++)$=le,le=F[2*(G+1)+1],++se<Z&&$===le||(se<re?P.bl_tree[2*$]+=se:$!==0?($!==ne&&P.bl_tree[2*$]++,P.bl_tree[2*S]++):se<=10?P.bl_tree[2*j]++:P.bl_tree[2*C]++,ne=$,re=(se=0)===le?(Z=138,3):$===le?(Z=6,3):(Z=7,4))}function ee(P,F,U){var G,$,ne=-1,le=F[1],se=0,Z=7,re=4;for(le===0&&(Z=138,re=3),G=0;G<=U;G++)if($=le,le=F[2*(G+1)+1],!(++se<Z&&$===le)){if(se<re)for(;X(P,$,P.bl_tree),--se!=0;);else $!==0?($!==ne&&(X(P,$,P.bl_tree),se--),X(P,S,P.bl_tree),oe(P,se-3,2)):se<=10?(X(P,j,P.bl_tree),oe(P,se-3,3)):(X(P,C,P.bl_tree),oe(P,se-11,7));ne=$,re=(se=0)===le?(Z=138,3):$===le?(Z=6,3):(Z=7,4)}}c(Y);var J=!1;function O(P,F,U,G){oe(P,(u<<1)+(G?1:0),3),(function($,ne,le,se){fe($),z($,le),z($,~le),s.arraySet($.pending_buf,$.window,ne,le,$.pending),$.pending+=le})(P,F,U)}o._tr_init=function(P){J||((function(){var F,U,G,$,ne,le=new Array(x+1);for($=G=0;$<d-1;$++)for(D[$]=G,F=0;F<1<<N[$];F++)w[G++]=$;for(w[G-1]=$,$=ne=0;$<16;$++)for(Y[$]=ne,F=0;F<1<<T[$];F++)L[ne++]=$;for(ne>>=7;$<f;$++)for(Y[$]=ne<<7,F=0;F<1<<T[$]-7;F++)L[256+ne++]=$;for(U=0;U<=x;U++)le[U]=0;for(F=0;F<=143;)M[2*F+1]=8,F++,le[8]++;for(;F<=255;)M[2*F+1]=9,F++,le[9]++;for(;F<=279;)M[2*F+1]=7,F++,le[7]++;for(;F<=287;)M[2*F+1]=8,F++,le[8]++;for(te(M,p+1,le),F=0;F<f;F++)E[2*F+1]=5,E[2*F]=de(F,5);W=new I(M,N,h+1,p,x),B=new I(E,T,0,f,x),q=new I(new Array(0),A,0,g,b)})(),J=!0),P.l_desc=new H(P.dyn_ltree,W),P.d_desc=new H(P.dyn_dtree,B),P.bl_desc=new H(P.bl_tree,q),P.bi_buf=0,P.bi_valid=0,ce(P)},o._tr_stored_block=O,o._tr_flush_block=function(P,F,U,G){var $,ne,le=0;0<P.level?(P.strm.data_type===2&&(P.strm.data_type=(function(se){var Z,re=4093624447;for(Z=0;Z<=31;Z++,re>>>=1)if(1&re&&se.dyn_ltree[2*Z]!==0)return i;if(se.dyn_ltree[18]!==0||se.dyn_ltree[20]!==0||se.dyn_ltree[26]!==0)return a;for(Z=32;Z<h;Z++)if(se.dyn_ltree[2*Z]!==0)return a;return i})(P)),Oe(P,P.l_desc),Oe(P,P.d_desc),le=(function(se){var Z;for(_(se,se.dyn_ltree,se.l_desc.max_code),_(se,se.dyn_dtree,se.d_desc.max_code),Oe(se,se.bl_desc),Z=g-1;3<=Z&&se.bl_tree[2*R[Z]+1]===0;Z--);return se.opt_len+=3*(Z+1)+5+5+4,Z})(P),$=P.opt_len+3+7>>>3,(ne=P.static_len+3+7>>>3)<=$&&($=ne)):$=ne=U+5,U+4<=$&&F!==-1?O(P,F,U,G):P.strategy===4||ne===$?(oe(P,2+(G?1:0),3),Ee(P,M,E)):(oe(P,4+(G?1:0),3),(function(se,Z,re,ue){var be;for(oe(se,Z-257,5),oe(se,re-1,5),oe(se,ue-4,4),be=0;be<ue;be++)oe(se,se.bl_tree[2*R[be]+1],3);ee(se,se.dyn_ltree,Z-1),ee(se,se.dyn_dtree,re-1)})(P,P.l_desc.max_code+1,P.d_desc.max_code+1,le+1),Ee(P,P.dyn_ltree,P.dyn_dtree)),ce(P),G&&fe(P)},o._tr_tally=function(P,F,U){return P.pending_buf[P.d_buf+2*P.last_lit]=F>>>8&255,P.pending_buf[P.d_buf+2*P.last_lit+1]=255&F,P.pending_buf[P.l_buf+P.last_lit]=255&U,P.last_lit++,F===0?P.dyn_ltree[2*U]++:(P.matches++,F--,P.dyn_ltree[2*(w[U]+h+1)]++,P.dyn_dtree[2*V(F)]++),P.last_lit===P.lit_bufsize-1},o._tr_align=function(P){oe(P,2,3),X(P,k,M),(function(F){F.bi_valid===16?(z(F,F.bi_buf),F.bi_buf=0,F.bi_valid=0):8<=F.bi_valid&&(F.pending_buf[F.pending++]=255&F.bi_buf,F.bi_buf>>=8,F.bi_valid-=8)})(P)}},{"../utils/common":41}],53:[function(n,r,o){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(s){(function(i,a){if(!i.setImmediate){var c,u,d,h,p=1,f={},g=!1,m=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(){b(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}})()?(h="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",k,!1):i.attachEvent("onmessage",k),function(S){i.postMessage(h+S,"*")}):i.MessageChannel?((d=new MessageChannel).port1.onmessage=function(S){b(S.data)},function(S){d.port2.postMessage(S)}):m&&"onreadystatechange"in m.createElement("script")?(u=m.documentElement,function(S){var j=m.createElement("script");j.onreadystatechange=function(){b(S),j.onreadystatechange=null,u.removeChild(j),j=null},u.appendChild(j)}):function(S){setTimeout(b,0,S)},x.setImmediate=function(S){typeof S!="function"&&(S=new Function(""+S));for(var j=new Array(arguments.length-1),C=0;C<j.length;C++)j[C]=arguments[C+1];var N={callback:S,args:j};return f[p]=N,c(p),p++},x.clearImmediate=y}function y(S){delete f[S]}function b(S){if(g)setTimeout(b,0,S);else{var j=f[S];if(j){g=!0;try{(function(C){var N=C.callback,T=C.args;switch(T.length){case 0:N();break;case 1:N(T[0]);break;case 2:N(T[0],T[1]);break;case 3:N(T[0],T[1],T[2]);break;default:N.apply(a,T)}})(j)}finally{y(S),g=!1}}}}function k(S){S.source===i&&typeof S.data=="string"&&S.data.indexOf(h)===0&&b(+S.data.slice(h.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof Fr<"u"?Fr:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(gs)),gs.exports}var qv=Wv();const Kv=Ri(qv);async function Jv(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 Gv(e){const t=new Kv;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 a=await Jv(i.id);a!==null&&t.file(`#${i.id}.SSE.Response.json`,a)}));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)}const Yv="1.16.4",Xv={version:Yv};function pd(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=pd(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function md(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=pd(e))&&(r&&(r+=" "),r+=t);return r}const Qv=(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},eb=(e,t)=>({classGroupId:e,validator:t}),gd=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),mo="-",hl=[],tb="arbitrary..",nb=e=>{const t=ob(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return rb(i);const a=i.split(mo),c=a[0]===""&&a.length>1?1:0;return xd(a,c,t)},getConflictingClassGroupIds:(i,a)=>{if(a){const c=r[i],u=n[i];return c?u?Qv(u,c):c:u||hl}return n[i]||hl}}},xd=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);if(s){const u=xd(e,t+1,s);if(u)return u}const i=n.validators;if(i===null)return;const a=t===0?e.join(mo):e.slice(t).join(mo),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(a))return d.classGroupId}},rb=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?tb+r:void 0})(),ob=e=>{const{theme:t,classGroups:n}=e;return sb(n,t)},sb=(e,t)=>{const n=gd();for(const r in e){const o=e[r];Gi(o,n,r,t)}return n},Gi=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const i=e[s];ib(i,t,n,r)}},ib=(e,t,n,r)=>{if(typeof e=="string"){ab(e,t,n);return}if(typeof e=="function"){lb(e,t,n,r);return}cb(e,t,n,r)},ab=(e,t,n)=>{const r=e===""?t:yd(t,e);r.classGroupId=n},lb=(e,t,n,r)=>{if(ub(e)){Gi(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(eb(n,e))},cb=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let i=0;i<s;i++){const[a,c]=o[i];Gi(c,yd(t,a),n,r)}},yd=(e,t)=>{let n=e;const r=t.split(mo),o=r.length;for(let s=0;s<o;s++){const i=r[s];let a=n.nextPart.get(i);a||(a=gd(),n.nextPart.set(i,a)),n=a}return n},ub=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,db=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)}}},ei="!",pl=":",fb=[],ml=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),hb=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let i=0,a=0,c=0,u;const d=o.length;for(let m=0;m<d;m++){const x=o[m];if(i===0&&a===0){if(x===pl){s.push(o.slice(c,m)),c=m+1;continue}if(x==="/"){u=m;continue}}x==="["?i++:x==="]"?i--:x==="("?a++:x===")"&&a--}const h=s.length===0?o:o.slice(c);let p=h,f=!1;h.endsWith(ei)?(p=h.slice(0,-1),f=!0):h.startsWith(ei)&&(p=h.slice(1),f=!0);const g=u&&u>c?u-c:void 0;return ml(s,f,p,g)};if(t){const o=t+pl,s=r;r=i=>i.startsWith(o)?s(i.slice(o.length)):ml(fb,!1,i,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},pb=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],a=i[0]==="[",c=t.has(i);a||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}},mb=e=>({cache:db(e.cacheSize),parseClassName:hb(e),sortModifiers:pb(e),...nb(e)}),gb=/\s+/,xb=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,i=[],a=e.trim().split(gb);let c="";for(let u=a.length-1;u>=0;u-=1){const d=a[u],{isExternal:h,modifiers:p,hasImportantModifier:f,baseClassName:g,maybePostfixModifierPosition:m}=n(d);if(h){c=d+(c.length>0?" "+c:c);continue}let x=!!m,y=r(x?g.substring(0,m):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 b=p.length===0?"":p.length===1?p[0]:s(p).join(":"),k=f?b+ei:b,S=k+y;if(i.indexOf(S)>-1)continue;i.push(S);const j=o(y,x);for(let C=0;C<j.length;++C){const N=j[C];i.push(k+N)}c=d+(c.length>0?" "+c:c)}return c},yb=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=vd(n))&&(o&&(o+=" "),o+=r);return o},vd=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=vd(e[r]))&&(n&&(n+=" "),n+=t);return n},vb=(e,...t)=>{let n,r,o,s;const i=c=>{const u=t.reduce((d,h)=>h(d),e());return n=mb(u),r=n.cache.get,o=n.cache.set,s=a,a(c)},a=c=>{const u=r(c);if(u)return u;const d=xb(c,n);return o(c,d),d};return s=i,(...c)=>s(yb(...c))},bb=[],Ye=e=>{const t=n=>n[e]||bb;return t.isThemeGetter=!0,t},bd=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,wd=/^\((?:(\w[\w-]*):)?(.+)\)$/i,wb=/^\d+\/\d+$/,kb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_b=/\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$/,Sb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Cb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,jb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_n=e=>wb.test(e),Ne=e=>!!e&&!Number.isNaN(Number(e)),Yt=e=>!!e&&Number.isInteger(Number(e)),xs=e=>e.endsWith("%")&&Ne(e.slice(0,-1)),Vt=e=>kb.test(e),Eb=()=>!0,Nb=e=>_b.test(e)&&!Sb.test(e),kd=()=>!1,Tb=e=>Cb.test(e),Ab=e=>jb.test(e),Ib=e=>!pe(e)&&!me(e),zb=e=>Xn(e,Cd,kd),pe=e=>bd.test(e),dn=e=>Xn(e,jd,Nb),ys=e=>Xn(e,Mb,Ne),gl=e=>Xn(e,_d,kd),Pb=e=>Xn(e,Sd,Ab),Vr=e=>Xn(e,Ed,Tb),me=e=>wd.test(e),ar=e=>Qn(e,jd),Rb=e=>Qn(e,Lb),xl=e=>Qn(e,_d),Ob=e=>Qn(e,Cd),Db=e=>Qn(e,Sd),Hr=e=>Qn(e,Ed,!0),Xn=(e,t,n)=>{const r=bd.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Qn=(e,t,n=!1)=>{const r=wd.exec(e);return r?r[1]?t(r[1]):n:!1},_d=e=>e==="position"||e==="percentage",Sd=e=>e==="image"||e==="url",Cd=e=>e==="length"||e==="size"||e==="bg-size",jd=e=>e==="length",Mb=e=>e==="number",Lb=e=>e==="family-name",Ed=e=>e==="shadow",Fb=()=>{const e=Ye("color"),t=Ye("font"),n=Ye("text"),r=Ye("font-weight"),o=Ye("tracking"),s=Ye("leading"),i=Ye("breakpoint"),a=Ye("container"),c=Ye("spacing"),u=Ye("radius"),d=Ye("shadow"),h=Ye("inset-shadow"),p=Ye("text-shadow"),f=Ye("drop-shadow"),g=Ye("blur"),m=Ye("perspective"),x=Ye("aspect"),y=Ye("ease"),b=Ye("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(),me,pe],C=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],T=()=>[me,pe,c],A=()=>[_n,"full","auto",...T()],R=()=>[Yt,"none","subgrid",me,pe],M=()=>["auto",{span:["full",Yt,me,pe]},Yt,me,pe],E=()=>[Yt,"auto",me,pe],L=()=>["auto","min","max","fr",me,pe],w=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],D=()=>["start","end","center","stretch","center-safe","end-safe"],W=()=>["auto",...T()],B=()=>[_n,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],q=()=>[e,me,pe],Y=()=>[...S(),xl,gl,{position:[me,pe]}],I=()=>["no-repeat",{repeat:["","x","y","space","round"]}],H=()=>["auto","cover","contain",Ob,zb,{size:[me,pe]}],V=()=>[xs,ar,dn],z=()=>["","none","full",u,me,pe],oe=()=>["",Ne,ar,dn],X=()=>["solid","dashed","dotted","double"],de=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],te=()=>[Ne,xs,xl,gl],ce=()=>["","none",g,me,pe],fe=()=>["none",Ne,me,pe],ge=()=>["none",Ne,me,pe],xe=()=>[Ne,me,pe],Ee=()=>[_n,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Vt],breakpoint:[Vt],color:[Eb],container:[Vt],"drop-shadow":[Vt],ease:["in","out","in-out"],font:[Ib],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Vt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Vt],shadow:[Vt],spacing:["px",Ne],text:[Vt],"text-shadow":[Vt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",_n,pe,me,x]}],container:["container"],columns:[{columns:[Ne,pe,me,a]}],"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:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:A()}],"inset-x":[{"inset-x":A()}],"inset-y":[{"inset-y":A()}],start:[{start:A()}],end:[{end:A()}],top:[{top:A()}],right:[{right:A()}],bottom:[{bottom:A()}],left:[{left:A()}],visibility:["visible","invisible","collapse"],z:[{z:[Yt,"auto",me,pe]}],basis:[{basis:[_n,"full","auto",a,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ne,_n,"auto","initial","none",pe]}],grow:[{grow:["",Ne,me,pe]}],shrink:[{shrink:["",Ne,me,pe]}],order:[{order:[Yt,"first","last","none",me,pe]}],"grid-cols":[{"grid-cols":R()}],"col-start-end":[{col:M()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":R()}],"row-start-end":[{row:M()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":L()}],"auto-rows":[{"auto-rows":L()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...w(),"normal"]}],"justify-items":[{"justify-items":[...D(),"normal"]}],"justify-self":[{"justify-self":["auto",...D()]}],"align-content":[{content:["normal",...w()]}],"align-items":[{items:[...D(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...D(),{baseline:["","last"]}]}],"place-content":[{"place-content":w()}],"place-items":[{"place-items":[...D(),"baseline"]}],"place-self":[{"place-self":["auto",...D()]}],p:[{p:T()}],px:[{px:T()}],py:[{py:T()}],ps:[{ps:T()}],pe:[{pe:T()}],pt:[{pt:T()}],pr:[{pr:T()}],pb:[{pb:T()}],pl:[{pl:T()}],m:[{m:W()}],mx:[{mx:W()}],my:[{my:W()}],ms:[{ms:W()}],me:[{me:W()}],mt:[{mt:W()}],mr:[{mr:W()}],mb:[{mb:W()}],ml:[{ml:W()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:B()}],w:[{w:[a,"screen",...B()]}],"min-w":[{"min-w":[a,"screen","none",...B()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[i]},...B()]}],h:[{h:["screen","lh",...B()]}],"min-h":[{"min-h":["screen","lh","none",...B()]}],"max-h":[{"max-h":["screen","lh",...B()]}],"font-size":[{text:["base",n,ar,dn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,me,ys]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",xs,pe]}],"font-family":[{font:[Rb,pe,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,me,pe]}],"line-clamp":[{"line-clamp":[Ne,"none",me,ys]}],leading:[{leading:[s,...T()]}],"list-image":[{"list-image":["none",me,pe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",me,pe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:q()}],"text-color":[{text:q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...X(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ne,"from-font","auto",me,dn]}],"text-decoration-color":[{decoration:q()}],"underline-offset":[{"underline-offset":[Ne,"auto",me,pe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",me,pe]}],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",me,pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Y()}],"bg-repeat":[{bg:I()}],"bg-size":[{bg:H()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Yt,me,pe],radial:["",me,pe],conic:[Yt,me,pe]},Db,Pb]}],"bg-color":[{bg:q()}],"gradient-from-pos":[{from:V()}],"gradient-via-pos":[{via:V()}],"gradient-to-pos":[{to:V()}],"gradient-from":[{from:q()}],"gradient-via":[{via:q()}],"gradient-to":[{to:q()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...X(),"hidden","none"]}],"divide-style":[{divide:[...X(),"hidden","none"]}],"border-color":[{border:q()}],"border-color-x":[{"border-x":q()}],"border-color-y":[{"border-y":q()}],"border-color-s":[{"border-s":q()}],"border-color-e":[{"border-e":q()}],"border-color-t":[{"border-t":q()}],"border-color-r":[{"border-r":q()}],"border-color-b":[{"border-b":q()}],"border-color-l":[{"border-l":q()}],"divide-color":[{divide:q()}],"outline-style":[{outline:[...X(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ne,me,pe]}],"outline-w":[{outline:["",Ne,ar,dn]}],"outline-color":[{outline:q()}],shadow:[{shadow:["","none",d,Hr,Vr]}],"shadow-color":[{shadow:q()}],"inset-shadow":[{"inset-shadow":["none",h,Hr,Vr]}],"inset-shadow-color":[{"inset-shadow":q()}],"ring-w":[{ring:oe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:q()}],"ring-offset-w":[{"ring-offset":[Ne,dn]}],"ring-offset-color":[{"ring-offset":q()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":q()}],"text-shadow":[{"text-shadow":["none",p,Hr,Vr]}],"text-shadow-color":[{"text-shadow":q()}],opacity:[{opacity:[Ne,me,pe]}],"mix-blend":[{"mix-blend":[...de(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":de()}],"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":[Ne]}],"mask-image-linear-from-pos":[{"mask-linear-from":te()}],"mask-image-linear-to-pos":[{"mask-linear-to":te()}],"mask-image-linear-from-color":[{"mask-linear-from":q()}],"mask-image-linear-to-color":[{"mask-linear-to":q()}],"mask-image-t-from-pos":[{"mask-t-from":te()}],"mask-image-t-to-pos":[{"mask-t-to":te()}],"mask-image-t-from-color":[{"mask-t-from":q()}],"mask-image-t-to-color":[{"mask-t-to":q()}],"mask-image-r-from-pos":[{"mask-r-from":te()}],"mask-image-r-to-pos":[{"mask-r-to":te()}],"mask-image-r-from-color":[{"mask-r-from":q()}],"mask-image-r-to-color":[{"mask-r-to":q()}],"mask-image-b-from-pos":[{"mask-b-from":te()}],"mask-image-b-to-pos":[{"mask-b-to":te()}],"mask-image-b-from-color":[{"mask-b-from":q()}],"mask-image-b-to-color":[{"mask-b-to":q()}],"mask-image-l-from-pos":[{"mask-l-from":te()}],"mask-image-l-to-pos":[{"mask-l-to":te()}],"mask-image-l-from-color":[{"mask-l-from":q()}],"mask-image-l-to-color":[{"mask-l-to":q()}],"mask-image-x-from-pos":[{"mask-x-from":te()}],"mask-image-x-to-pos":[{"mask-x-to":te()}],"mask-image-x-from-color":[{"mask-x-from":q()}],"mask-image-x-to-color":[{"mask-x-to":q()}],"mask-image-y-from-pos":[{"mask-y-from":te()}],"mask-image-y-to-pos":[{"mask-y-to":te()}],"mask-image-y-from-color":[{"mask-y-from":q()}],"mask-image-y-to-color":[{"mask-y-to":q()}],"mask-image-radial":[{"mask-radial":[me,pe]}],"mask-image-radial-from-pos":[{"mask-radial-from":te()}],"mask-image-radial-to-pos":[{"mask-radial-to":te()}],"mask-image-radial-from-color":[{"mask-radial-from":q()}],"mask-image-radial-to-color":[{"mask-radial-to":q()}],"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":[Ne]}],"mask-image-conic-from-pos":[{"mask-conic-from":te()}],"mask-image-conic-to-pos":[{"mask-conic-to":te()}],"mask-image-conic-from-color":[{"mask-conic-from":q()}],"mask-image-conic-to-color":[{"mask-conic-to":q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Y()}],"mask-repeat":[{mask:I()}],"mask-size":[{mask:H()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",me,pe]}],filter:[{filter:["","none",me,pe]}],blur:[{blur:ce()}],brightness:[{brightness:[Ne,me,pe]}],contrast:[{contrast:[Ne,me,pe]}],"drop-shadow":[{"drop-shadow":["","none",f,Hr,Vr]}],"drop-shadow-color":[{"drop-shadow":q()}],grayscale:[{grayscale:["",Ne,me,pe]}],"hue-rotate":[{"hue-rotate":[Ne,me,pe]}],invert:[{invert:["",Ne,me,pe]}],saturate:[{saturate:[Ne,me,pe]}],sepia:[{sepia:["",Ne,me,pe]}],"backdrop-filter":[{"backdrop-filter":["","none",me,pe]}],"backdrop-blur":[{"backdrop-blur":ce()}],"backdrop-brightness":[{"backdrop-brightness":[Ne,me,pe]}],"backdrop-contrast":[{"backdrop-contrast":[Ne,me,pe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ne,me,pe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ne,me,pe]}],"backdrop-invert":[{"backdrop-invert":["",Ne,me,pe]}],"backdrop-opacity":[{"backdrop-opacity":[Ne,me,pe]}],"backdrop-saturate":[{"backdrop-saturate":[Ne,me,pe]}],"backdrop-sepia":[{"backdrop-sepia":["",Ne,me,pe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":T()}],"border-spacing-x":[{"border-spacing-x":T()}],"border-spacing-y":[{"border-spacing-y":T()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",me,pe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ne,"initial",me,pe]}],ease:[{ease:["linear","initial",y,me,pe]}],delay:[{delay:[Ne,me,pe]}],animate:[{animate:["none",b,me,pe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[m,me,pe]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:fe()}],"rotate-x":[{"rotate-x":fe()}],"rotate-y":[{"rotate-y":fe()}],"rotate-z":[{"rotate-z":fe()}],scale:[{scale:ge()}],"scale-x":[{"scale-x":ge()}],"scale-y":[{"scale-y":ge()}],"scale-z":[{"scale-z":ge()}],"scale-3d":["scale-3d"],skew:[{skew:xe()}],"skew-x":[{"skew-x":xe()}],"skew-y":[{"skew-y":xe()}],transform:[{transform:[me,pe,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ee()}],"translate-x":[{"translate-x":Ee()}],"translate-y":[{"translate-y":Ee()}],"translate-z":[{"translate-z":Ee()}],"translate-none":["translate-none"],accent:[{accent:q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:q()}],"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",me,pe]}],"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":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"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",me,pe]}],fill:[{fill:["none",...q()]}],"stroke-w":[{stroke:[Ne,ar,dn,ys]}],stroke:[{stroke:["none",...q()]}],"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"]}},$b=vb(Fb);function he(...e){return $b(md(e))}function qe(e){return e>=1048576?(e/1048576).toFixed(1).replace(/\.0$/,"")+"M":e>=1024?(e/1024).toFixed(1).replace(/\.0$/,"")+"K":e.toString()}function Nd(e){return e===null?"pending":e>=200&&e<300?"success":e>=400&&e<500?"client_error":e>=500?"server_error":"pending"}const yl=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,vl=md,Yi=(e,t)=>n=>{var r;if(t?.variants==null)return vl(e,n?.class,n?.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(u=>{const d=n?.[u],h=s?.[u];if(d===null)return null;const p=yl(d)||yl(h);return o[u][p]}),a=n&&Object.entries(n).reduce((u,d)=>{let[h,p]=d;return p===void 0||(u[h]=p),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:h,className:p,...f}=d;return Object.entries(f).every(g=>{let[m,x]=g;return Array.isArray(x)?x.includes({...s,...a}[m]):{...s,...a}[m]===x})?[...u,h,p]:u},[]);return vl(e,i,c,n?.class,n?.className)};function bl(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Td(...e){return t=>{let n=!1;const r=e.map(o=>{const s=bl(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():bl(e[o],null)}}}}function Pe(...e){return v.useCallback(Td(...e),e)}function Vn(e){const t=Ub(e),n=v.forwardRef((r,o)=>{const{children:s,...i}=r,a=v.Children.toArray(s),c=a.find(Vb);if(c){const u=c.props.children,d=a.map(h=>h===c?v.Children.count(u)>1?v.Children.only(null):v.isValidElement(u)?u.props.children:null:h);return l.jsx(t,{...i,ref:o,children:v.isValidElement(u)?v.cloneElement(u,void 0,d):null})}return l.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var Bb=Vn("Slot");function Ub(e){const t=v.forwardRef((n,r)=>{const{children:o,...s}=n;if(v.isValidElement(o)){const i=Wb(o),a=Hb(s,o.props);return o.type!==v.Fragment&&(a.ref=r?Td(r,i):i),v.cloneElement(o,a)}return v.Children.count(o)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ad=Symbol("radix.slottable");function Zb(e){const t=({children:n})=>l.jsx(l.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Ad,t}function Vb(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ad}function Hb(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]=(...a)=>{const c=s(...a);return o(...a),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Wb(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 qb=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ce=qb.reduce((e,t)=>{const n=Vn(`Primitive.${t}`),r=v.forwardRef((o,s)=>{const{asChild:i,...a}=o,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Kb(e,t){e&&Ar.flushSync(()=>e.dispatchEvent(t))}var Id=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"}),Jb="VisuallyHidden",zd=v.forwardRef((e,t)=>l.jsx(Ce.span,{...e,ref:t,style:{...Id,...e.style}}));zd.displayName=Jb;var Gb=zd;function Yb(e,t){const n=v.createContext(t),r=s=>{const{children:i,...a}=s,c=v.useMemo(()=>a,Object.values(a));return l.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 Gt(e,t=[]){let n=[];function r(s,i){const a=v.createContext(i),c=n.length;n=[...n,i];const u=h=>{const{scope:p,children:f,...g}=h,m=p?.[e]?.[c]||a,x=v.useMemo(()=>g,Object.values(g));return l.jsx(m.Provider,{value:x,children:f})};u.displayName=s+"Provider";function d(h,p){const f=p?.[e]?.[c]||a,g=v.useContext(f);if(g)return g;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${s}\``)}return[u,d]}const o=()=>{const s=n.map(i=>v.createContext(i));return function(a){const c=a?.[e]||s;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,Xb(o,...t)]}function Xb(...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((a,{useScope:c,scopeName:u})=>{const h=c(s)[`__scope${u}`];return{...a,...h}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function Pd(e){const t=e+"CollectionProvider",[n,r]=Gt(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=m=>{const{scope:x,children:y}=m,b=at.useRef(null),k=at.useRef(new Map).current;return l.jsx(o,{scope:x,itemMap:k,collectionRef:b,children:y})};i.displayName=t;const a=e+"CollectionSlot",c=Vn(a),u=at.forwardRef((m,x)=>{const{scope:y,children:b}=m,k=s(a,y),S=Pe(x,k.collectionRef);return l.jsx(c,{ref:S,children:b})});u.displayName=a;const d=e+"CollectionItemSlot",h="data-radix-collection-item",p=Vn(d),f=at.forwardRef((m,x)=>{const{scope:y,children:b,...k}=m,S=at.useRef(null),j=Pe(x,S),C=s(d,y);return at.useEffect(()=>(C.itemMap.set(S,{ref:S,...k}),()=>{C.itemMap.delete(S)})),l.jsx(p,{[h]:"",ref:j,children:b})});f.displayName=d;function g(m){const x=s(e+"CollectionConsumer",m);return at.useCallback(()=>{const b=x.collectionRef.current;if(!b)return[];const k=Array.from(b.querySelectorAll(`[${h}]`));return Array.from(x.itemMap.values()).sort((C,N)=>k.indexOf(C.ref.current)-k.indexOf(N.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:u,ItemSlot:f},g,r]}function we(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}var et=globalThis?.document?v.useLayoutEffect:()=>{},Qb=du[" useInsertionEffect ".trim().toString()]||et;function hn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=e2({defaultProp:t,onChange:n}),a=e!==void 0,c=a?e:o;{const d=v.useRef(e!==void 0);v.useEffect(()=>{const h=d.current;h!==a&&console.warn(`${r} is changing from ${h?"controlled":"uncontrolled"} to ${a?"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=a},[a,r])}const u=v.useCallback(d=>{if(a){const h=t2(d)?d(e):d;h!==e&&i.current?.(h)}else s(d)},[a,e,s,i]);return[c,u]}function e2({defaultProp:e,onChange:t}){const[n,r]=v.useState(e),o=v.useRef(n),s=v.useRef(t);return Qb(()=>{s.current=t},[t]),v.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}function t2(e){return typeof e=="function"}function n2(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var kt=e=>{const{present:t,children:n}=e,r=r2(t),o=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),s=Pe(r.ref,o2(o));return typeof n=="function"||r.isPresent?v.cloneElement(o,{ref:s}):null};kt.displayName="Presence";function r2(e){const[t,n]=v.useState(),r=v.useRef(null),o=v.useRef(e),s=v.useRef("none"),i=e?"mounted":"unmounted",[a,c]=n2(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=Wr(r.current);s.current=a==="mounted"?u:"none"},[a]),et(()=>{const u=r.current,d=o.current;if(d!==e){const p=s.current,f=Wr(u);e?c("MOUNT"):f==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&p!==f?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),et(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,h=f=>{const m=Wr(r.current).includes(CSS.escape(f.animationName));if(f.target===t&&m&&(c("ANIMATION_END"),!o.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},p=f=>{f.target===t&&(s.current=Wr(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:v.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function Wr(e){return e?.animationName||"none"}function o2(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 s2=du[" useId ".trim().toString()]||(()=>{}),i2=0;function Dt(e){const[t,n]=v.useState(s2());return et(()=>{n(r=>r??String(i2++))},[e]),e||(t?`radix-${t}`:"")}var Fo="Collapsible",[a2]=Gt(Fo),[l2,Xi]=a2(Fo),Rd=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:i,...a}=e,[c,u]=hn({prop:r,defaultProp:o??!1,onChange:i,caller:Fo});return l.jsx(l2,{scope:n,disabled:s,contentId:Dt(),open:c,onOpenToggle:v.useCallback(()=>u(d=>!d),[u]),children:l.jsx(Ce.div,{"data-state":ea(c),"data-disabled":s?"":void 0,...a,ref:t})})});Rd.displayName=Fo;var Od="CollapsibleTrigger",Dd=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=Xi(Od,n);return l.jsx(Ce.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":ea(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:we(e.onClick,o.onOpenToggle)})});Dd.displayName=Od;var Qi="CollapsibleContent",Md=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Xi(Qi,e.__scopeCollapsible);return l.jsx(kt,{present:n||o.open,children:({present:s})=>l.jsx(c2,{...r,ref:t,present:s})})});Md.displayName=Qi;var c2=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=e,i=Xi(Qi,n),[a,c]=v.useState(r),u=v.useRef(null),d=Pe(t,u),h=v.useRef(0),p=h.current,f=v.useRef(0),g=f.current,m=i.open||a,x=v.useRef(m),y=v.useRef(void 0);return v.useEffect(()=>{const b=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(b)},[]),et(()=>{const b=u.current;if(b){y.current=y.current||{transitionDuration:b.style.transitionDuration,animationName:b.style.animationName},b.style.transitionDuration="0s",b.style.animationName="none";const k=b.getBoundingClientRect();h.current=k.height,f.current=k.width,x.current||(b.style.transitionDuration=y.current.transitionDuration,b.style.animationName=y.current.animationName),c(r)}},[i.open,r]),l.jsx(Ce.div,{"data-state":ea(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!m,...s,ref:d,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:m&&o})});function ea(e){return e?"open":"closed"}var u2=Rd,d2=v.createContext(void 0);function $o(e){const t=v.useContext(d2);return e||t||"ltr"}function st(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>t.current?.(...n),[])}function f2(e,t=globalThis?.document){const n=st(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 h2="DismissableLayer",ti="dismissableLayer.update",p2="dismissableLayer.pointerDownOutside",m2="dismissableLayer.focusOutside",wl,Ld=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Bo=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...c}=e,u=v.useContext(Ld),[d,h]=v.useState(null),p=d?.ownerDocument??globalThis?.document,[,f]=v.useState({}),g=Pe(t,N=>h(N)),m=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=m.indexOf(x),b=d?m.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,S=b>=y,j=y2(N=>{const T=N.target,A=[...u.branches].some(R=>R.contains(T));!S||A||(o?.(N),i?.(N),N.defaultPrevented||a?.())},p),C=v2(N=>{const T=N.target;[...u.branches].some(R=>R.contains(T))||(s?.(N),i?.(N),N.defaultPrevented||a?.())},p);return f2(N=>{b===u.layers.size-1&&(r?.(N),!N.defaultPrevented&&a&&(N.preventDefault(),a()))},p),v.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(wl=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),kl(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=wl)}},[d,p,n,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),kl())},[d,u]),v.useEffect(()=>{const N=()=>f({});return document.addEventListener(ti,N),()=>document.removeEventListener(ti,N)},[]),l.jsx(Ce.div,{...c,ref:g,style:{pointerEvents:k?S?"auto":"none":void 0,...e.style},onFocusCapture:we(e.onFocusCapture,C.onFocusCapture),onBlurCapture:we(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:we(e.onPointerDownCapture,j.onPointerDownCapture)})});Bo.displayName=h2;var g2="DismissableLayerBranch",x2=v.forwardRef((e,t)=>{const n=v.useContext(Ld),r=v.useRef(null),o=Pe(t,r);return v.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),l.jsx(Ce.div,{...e,ref:o})});x2.displayName=g2;function y2(e,t=globalThis?.document){const n=st(e),r=v.useRef(!1),o=v.useRef(()=>{});return v.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let c=function(){Fd(p2,n,u,{discrete:!0})};const u={originalEvent:a};a.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 v2(e,t=globalThis?.document){const n=st(e),r=v.useRef(!1);return v.useEffect(()=>{const o=s=>{s.target&&!r.current&&Fd(m2,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 kl(){const e=new CustomEvent(ti);document.dispatchEvent(e)}function Fd(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?Kb(o,s):o.dispatchEvent(s)}var vs="focusScope.autoFocusOnMount",bs="focusScope.autoFocusOnUnmount",_l={bubbles:!1,cancelable:!0},b2="FocusScope",ta=v.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[a,c]=v.useState(null),u=st(o),d=st(s),h=v.useRef(null),p=Pe(t,m=>c(m)),f=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let m=function(k){if(f.paused||!a)return;const S=k.target;a.contains(S)?h.current=S:Qt(h.current,{select:!0})},x=function(k){if(f.paused||!a)return;const S=k.relatedTarget;S!==null&&(a.contains(S)||Qt(h.current,{select:!0}))},y=function(k){if(document.activeElement===document.body)for(const j of k)j.removedNodes.length>0&&Qt(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",x);const b=new MutationObserver(y);return a&&b.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",x),b.disconnect()}}},[r,a,f.paused]),v.useEffect(()=>{if(a){Cl.add(f);const m=document.activeElement;if(!a.contains(m)){const y=new CustomEvent(vs,_l);a.addEventListener(vs,u),a.dispatchEvent(y),y.defaultPrevented||(w2(j2($d(a)),{select:!0}),document.activeElement===m&&Qt(a))}return()=>{a.removeEventListener(vs,u),setTimeout(()=>{const y=new CustomEvent(bs,_l);a.addEventListener(bs,d),a.dispatchEvent(y),y.defaultPrevented||Qt(m??document.body,{select:!0}),a.removeEventListener(bs,d),Cl.remove(f)},0)}}},[a,u,d,f]);const g=v.useCallback(m=>{if(!n&&!r||f.paused)return;const x=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,y=document.activeElement;if(x&&y){const b=m.currentTarget,[k,S]=k2(b);k&&S?!m.shiftKey&&y===S?(m.preventDefault(),n&&Qt(k,{select:!0})):m.shiftKey&&y===k&&(m.preventDefault(),n&&Qt(S,{select:!0})):y===b&&m.preventDefault()}},[n,r,f.paused]);return l.jsx(Ce.div,{tabIndex:-1,...i,ref:p,onKeyDown:g})});ta.displayName=b2;function w2(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Qt(r,{select:t}),document.activeElement!==n)return}function k2(e){const t=$d(e),n=Sl(t,e),r=Sl(t.reverse(),e);return[n,r]}function $d(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 Sl(e,t){for(const n of e)if(!_2(n,{upTo:t}))return n}function _2(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 S2(e){return e instanceof HTMLInputElement&&"select"in e}function Qt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&S2(e)&&t&&e.select()}}var Cl=C2();function C2(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=jl(e,t),e.unshift(t)},remove(t){e=jl(e,t),e[0]?.resume()}}}function jl(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function j2(e){return e.filter(t=>t.tagName!=="A")}var E2="Portal",Uo=v.forwardRef((e,t)=>{const{container:n,...r}=e,[o,s]=v.useState(!1);et(()=>s(!0),[]);const i=n||o&&globalThis?.document?.body;return i?Xp.createPortal(l.jsx(Ce.div,{...r,ref:t}),i):null});Uo.displayName=E2;var ws=0;function Bd(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??El()),document.body.insertAdjacentElement("beforeend",e[1]??El()),ws++,()=>{ws===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),ws--}},[])}function El(){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 Pt=function(){return Pt=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},Pt.apply(this,arguments)};function Ud(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 N2(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var oo="right-scroll-bar-position",so="width-before-scroll-bar",T2="with-scroll-bars-hidden",A2="--removed-body-scroll-bar-size";function ks(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function I2(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 z2=typeof window<"u"?v.useLayoutEffect:v.useEffect,Nl=new WeakMap;function P2(e,t){var n=I2(null,function(r){return e.forEach(function(o){return ks(o,r)})});return z2(function(){var r=Nl.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(a){s.has(a)||ks(a,null)}),s.forEach(function(a){o.has(a)||ks(a,i)})}Nl.set(n,e)},[e]),n}function R2(e){return e}function O2(e,t){t===void 0&&(t=R2);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(a){return a!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var a=n;n=[],a.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 D2(e){e===void 0&&(e={});var t=O2(null);return t.options=Pt({async:!0,ssr:!1},e),t}var Zd=function(e){var t=e.sideCar,n=Ud(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,Pt({},n))};Zd.isSideCarExport=!0;function M2(e,t){return e.useMedium(t),Zd}var Vd=D2(),_s=function(){},Zo=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:_s,onWheelCapture:_s,onTouchMoveCapture:_s}),o=r[0],s=r[1],i=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,h=e.shards,p=e.sideCar,f=e.noRelative,g=e.noIsolation,m=e.inert,x=e.allowPinchZoom,y=e.as,b=y===void 0?"div":y,k=e.gapMode,S=Ud(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=p,C=P2([n,t]),N=Pt(Pt({},S),o);return v.createElement(v.Fragment,null,d&&v.createElement(j,{sideCar:Vd,removeScrollBar:u,shards:h,noRelative:f,noIsolation:g,inert:m,setCallbacks:s,allowPinchZoom:!!x,lockRef:n,gapMode:k}),i?v.cloneElement(v.Children.only(a),Pt(Pt({},N),{ref:C})):v.createElement(b,Pt({},N,{className:c,ref:C}),a))});Zo.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Zo.classNames={fullWidth:so,zeroRight:oo};var L2=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function F2(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=L2();return t&&e.setAttribute("nonce",t),e}function $2(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function B2(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var U2=function(){var e=0,t=null;return{add:function(n){e==0&&(t=F2())&&($2(t,n),B2(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Z2=function(){var e=U2();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Hd=function(){var e=Z2(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},V2={left:0,top:0,right:0,gap:0},Ss=function(e){return parseInt(e||"",10)||0},H2=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[Ss(n),Ss(r),Ss(o)]},W2=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return V2;var t=H2(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])}},q2=Hd(),Dn="data-scroll-locked",K2=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),`
41
+ .`.concat(T2,` {
42
42
  overflow: hidden `).concat(r,`;
43
43
  padding-right: `).concat(a,"px ").concat(r,`;
44
44
  }
45
- body[`).concat(Mn,`] {
45
+ body[`).concat(Dn,`] {
46
46
  overflow: hidden `).concat(r,`;
47
47
  overscroll-behavior: contain;
48
48
  `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
@@ -55,53 +55,53 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
55
55
  `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
56
56
  }
57
57
 
58
- .`).concat(ro,` {
58
+ .`).concat(oo,` {
59
59
  right: `).concat(a,"px ").concat(r,`;
60
60
  }
61
61
 
62
- .`).concat(oo,` {
62
+ .`).concat(so,` {
63
63
  margin-right: `).concat(a,"px ").concat(r,`;
64
64
  }
65
65
 
66
- .`).concat(ro," .").concat(ro,` {
66
+ .`).concat(oo," .").concat(oo,` {
67
67
  right: 0 `).concat(r,`;
68
68
  }
69
69
 
70
- .`).concat(oo," .").concat(oo,` {
70
+ .`).concat(so," .").concat(so,` {
71
71
  margin-right: 0 `).concat(r,`;
72
72
  }
73
73
 
74
- body[`).concat(Mn,`] {
75
- `).concat(E2,": ").concat(a,`px;
74
+ body[`).concat(Dn,`] {
75
+ `).concat(A2,": ").concat(a,`px;
76
76
  }
77
- `)},Nl=function(){var e=parseInt(document.body.getAttribute(Mn)||"0",10);return isFinite(e)?e:0},H2=function(){v.useEffect(function(){return document.body.setAttribute(Mn,(Nl()+1).toString()),function(){var e=Nl()-1;e<=0?document.body.removeAttribute(Mn):document.body.setAttribute(Mn,e.toString())}},[])},q2=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;H2();var s=v.useMemo(function(){return Z2(o)},[o]);return v.createElement(V2,{styles:W2(s,!t,o,n?"":"!important")})},ni=!1;if(typeof window<"u")try{var Hr=Object.defineProperty({},"passive",{get:function(){return ni=!0,!0}});window.addEventListener("test",Hr,Hr),window.removeEventListener("test",Hr,Hr)}catch{ni=!1}var Cn=ni?{passive:!1}:!1,K2=function(e){return e.tagName==="TEXTAREA"},Zd=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!K2(e)&&n[t]==="visible")},G2=function(e){return Zd(e,"overflowY")},J2=function(e){return Zd(e,"overflowX")},Tl=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Vd(e,r);if(o){var s=Wd(e,r),i=s[1],a=s[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Y2=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},X2=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Vd=function(e,t){return e==="v"?G2(t):J2(t)},Wd=function(e,t){return e==="v"?Y2(t):X2(t)},Q2=function(e,t){return e==="h"&&t==="rtl"?-1:1},ew=function(e,t,n,r,o){var s=Q2(e,window.getComputedStyle(t).direction),i=s*r,a=n.target,c=t.contains(a),u=!1,d=i>0,h=0,p=0;do{if(!a)break;var f=Wd(e,a),g=f[0],m=f[1],x=f[2],y=m-x-s*g;(g||y)&&Vd(e,a)&&(h+=y,p+=g);var b=a.parentNode;a=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(d&&Math.abs(h)<1||!d&&Math.abs(p)<1)&&(u=!0),u},qr=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Al=function(e){return[e.deltaX,e.deltaY]},Il=function(e){return e&&"current"in e?e.current:e},tw=function(e,t){return e[0]===t[0]&&e[1]===t[1]},nw=function(e){return`
77
+ `)},Tl=function(){var e=parseInt(document.body.getAttribute(Dn)||"0",10);return isFinite(e)?e:0},J2=function(){v.useEffect(function(){return document.body.setAttribute(Dn,(Tl()+1).toString()),function(){var e=Tl()-1;e<=0?document.body.removeAttribute(Dn):document.body.setAttribute(Dn,e.toString())}},[])},G2=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;J2();var s=v.useMemo(function(){return W2(o)},[o]);return v.createElement(q2,{styles:K2(s,!t,o,n?"":"!important")})},ni=!1;if(typeof window<"u")try{var qr=Object.defineProperty({},"passive",{get:function(){return ni=!0,!0}});window.addEventListener("test",qr,qr),window.removeEventListener("test",qr,qr)}catch{ni=!1}var Sn=ni?{passive:!1}:!1,Y2=function(e){return e.tagName==="TEXTAREA"},Wd=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Y2(e)&&n[t]==="visible")},X2=function(e){return Wd(e,"overflowY")},Q2=function(e){return Wd(e,"overflowX")},Al=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=qd(e,r);if(o){var s=Kd(e,r),i=s[1],a=s[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},ew=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},tw=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},qd=function(e,t){return e==="v"?X2(t):Q2(t)},Kd=function(e,t){return e==="v"?ew(t):tw(t)},nw=function(e,t){return e==="h"&&t==="rtl"?-1:1},rw=function(e,t,n,r,o){var s=nw(e,window.getComputedStyle(t).direction),i=s*r,a=n.target,c=t.contains(a),u=!1,d=i>0,h=0,p=0;do{if(!a)break;var f=Kd(e,a),g=f[0],m=f[1],x=f[2],y=m-x-s*g;(g||y)&&qd(e,a)&&(h+=y,p+=g);var b=a.parentNode;a=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!c&&a!==document.body||c&&(t.contains(a)||t===a));return(d&&Math.abs(h)<1||!d&&Math.abs(p)<1)&&(u=!0),u},Kr=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Il=function(e){return[e.deltaX,e.deltaY]},zl=function(e){return e&&"current"in e?e.current:e},ow=function(e,t){return e[0]===t[0]&&e[1]===t[1]},sw=function(e){return`
78
78
  .block-interactivity-`.concat(e,` {pointer-events: none;}
79
79
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
80
- `)},rw=0,jn=[];function ow(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),o=v.useState(rw++)[0],s=v.useState(Ud)[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 m=C2([e.lockRef.current],(e.shards||[]).map(Il),!0).filter(Boolean);return m.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=v.useCallback(function(m,x){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!i.current.allowPinchZoom;var y=qr(m),b=n.current,k="deltaX"in m?m.deltaX:b[0]-y[0],S="deltaY"in m?m.deltaY:b[1]-y[1],C,j=m.target,N=Math.abs(k)>Math.abs(S)?"h":"v";if("touches"in m&&N==="h"&&j.type==="range")return!1;var T=window.getSelection(),A=T&&T.anchorNode,O=A?A===j||A.contains(j):!1;if(O)return!1;var L=Tl(N,j);if(!L)return!0;if(L?C=N:(C=N==="v"?"h":"v",L=Tl(N,j)),!L)return!1;if(!r.current&&"changedTouches"in m&&(k||S)&&(r.current=C),!C)return!0;var E=r.current||C;return ew(E,x,m,E==="h"?k:S)},[]),c=v.useCallback(function(m){var x=m;if(!(!jn.length||jn[jn.length-1]!==s)){var y="deltaY"in x?Al(x):qr(x),b=t.current.filter(function(C){return C.name===x.type&&(C.target===x.target||x.target===C.shadowParent)&&tw(C.delta,y)})[0];if(b&&b.should){x.cancelable&&x.preventDefault();return}if(!b){var k=(i.current.shards||[]).map(Il).filter(Boolean).filter(function(C){return C.contains(x.target)}),S=k.length>0?a(x,k[0]):!i.current.noIsolation;S&&x.cancelable&&x.preventDefault()}}},[]),u=v.useCallback(function(m,x,y,b){var k={name:m,delta:x,target:y,should:b,shadowParent:sw(y)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(S){return S!==k})},1)},[]),d=v.useCallback(function(m){n.current=qr(m),r.current=void 0},[]),h=v.useCallback(function(m){u(m.type,Al(m),m.target,a(m,e.lockRef.current))},[]),p=v.useCallback(function(m){u(m.type,qr(m),m.target,a(m,e.lockRef.current))},[]);v.useEffect(function(){return jn.push(s),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:p}),document.addEventListener("wheel",c,Cn),document.addEventListener("touchmove",c,Cn),document.addEventListener("touchstart",d,Cn),function(){jn=jn.filter(function(m){return m!==s}),document.removeEventListener("wheel",c,Cn),document.removeEventListener("touchmove",c,Cn),document.removeEventListener("touchstart",d,Cn)}},[]);var f=e.removeScrollBar,g=e.inert;return v.createElement(v.Fragment,null,g?v.createElement(s,{styles:nw(o)}):null,f?v.createElement(q2,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function sw(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const iw=P2(Bd,ow);var ta=v.forwardRef(function(e,t){return v.createElement(Uo,Rt({},e,{ref:t,sideCar:iw}))});ta.classNames=Uo.classNames;var aw=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},En=new WeakMap,Kr=new WeakMap,Gr={},Cs=0,Hd=function(e){return e&&(e.host||Hd(e.parentNode))},lw=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Hd(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})},cw=function(e,t,n,r){var o=lw(t,Array.isArray(e)?e:[e]);Gr[n]||(Gr[n]=new WeakMap);var s=Gr[n],i=[],a=new Set,c=new Set(o),u=function(h){!h||a.has(h)||(a.add(h),u(h.parentNode))};o.forEach(u);var d=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(p){if(a.has(p))d(p);else try{var f=p.getAttribute(r),g=f!==null&&f!=="false",m=(En.get(p)||0)+1,x=(s.get(p)||0)+1;En.set(p,m),s.set(p,x),i.push(p),m===1&&g&&Kr.set(p,!0),x===1&&p.setAttribute(n,"true"),g||p.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",p,y)}})};return d(t),a.clear(),Cs++,function(){i.forEach(function(h){var p=En.get(h)-1,f=s.get(h)-1;En.set(h,p),s.set(h,f),p||(Kr.has(h)||h.removeAttribute(r),Kr.delete(h)),f||h.removeAttribute(n)}),Cs--,Cs||(En=new WeakMap,En=new WeakMap,Kr=new WeakMap,Gr={})}},qd=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=aw(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),cw(r,o,n,"aria-hidden")):function(){return null}},Zo="Dialog",[Kd]=Jt(Zo),[uw,At]=Kd(Zo),Gd=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!0}=e,a=v.useRef(null),c=v.useRef(null),[u,d]=pn({prop:r,defaultProp:o??!1,onChange:s,caller:Zo});return l.jsx(uw,{scope:t,triggerRef:a,contentRef:c,contentId:Dt(),titleId:Dt(),descriptionId:Dt(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(h=>!h),[d]),modal:i,children:n})};Gd.displayName=Zo;var Jd="DialogTrigger",Yd=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=At(Jd,n),s=Re(t,o.triggerRef);return l.jsx(Ce.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":oa(o.open),...r,ref:s,onClick:we(e.onClick,o.onOpenToggle)})});Yd.displayName=Jd;var na="DialogPortal",[dw,Xd]=Kd(na,{forceMount:void 0}),Qd=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=At(na,t);return l.jsx(dw,{scope:t,forceMount:n,children:v.Children.map(r,i=>l.jsx(kt,{present:n||s.open,children:l.jsx(Bo,{asChild:!0,container:o,children:i})}))})};Qd.displayName=na;var mo="DialogOverlay",ef=v.forwardRef((e,t)=>{const n=Xd(mo,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=At(mo,e.__scopeDialog);return s.modal?l.jsx(kt,{present:r||s.open,children:l.jsx(hw,{...o,ref:t})}):null});ef.displayName=mo;var fw=Wn("DialogOverlay.RemoveScroll"),hw=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=At(mo,n);return l.jsx(ta,{as:fw,allowPinchZoom:!0,shards:[o.contentRef],children:l.jsx(Ce.div,{"data-state":oa(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),mn="DialogContent",tf=v.forwardRef((e,t)=>{const n=Xd(mn,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=At(mn,e.__scopeDialog);return l.jsx(kt,{present:r||s.open,children:s.modal?l.jsx(pw,{...o,ref:t}):l.jsx(mw,{...o,ref:t})})});tf.displayName=mn;var pw=v.forwardRef((e,t)=>{const n=At(mn,e.__scopeDialog),r=v.useRef(null),o=Re(t,n.contentRef,r);return v.useEffect(()=>{const s=r.current;if(s)return qd(s)},[]),l.jsx(nf,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:we(e.onCloseAutoFocus,s=>{s.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:we(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&s.preventDefault()}),onFocusOutside:we(e.onFocusOutside,s=>s.preventDefault())})}),mw=v.forwardRef((e,t)=>{const n=At(mn,e.__scopeDialog),r=v.useRef(!1),o=v.useRef(!1);return l.jsx(nf,{...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()}})}),nf=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...i}=e,a=At(mn,n),c=v.useRef(null),u=Re(t,c);return Ld(),l.jsxs(l.Fragment,{children:[l.jsx(ea,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:l.jsx($o,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":oa(a.open),...i,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(xw,{titleId:a.titleId}),l.jsx(vw,{contentRef:c,descriptionId:a.descriptionId})]})]})}),ra="DialogTitle",rf=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=At(ra,n);return l.jsx(Ce.h2,{id:o.titleId,...r,ref:t})});rf.displayName=ra;var of="DialogDescription",gw=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=At(of,n);return l.jsx(Ce.p,{id:o.descriptionId,...r,ref:t})});gw.displayName=of;var sf="DialogClose",af=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=At(sf,n);return l.jsx(Ce.button,{type:"button",...r,ref:t,onClick:we(e.onClick,()=>o.onOpenChange(!1))})});af.displayName=sf;function oa(e){return e?"open":"closed"}var lf="DialogTitleWarning",[CT,cf]=Kb(lf,{contentName:mn,titleName:ra,docsSlug:"dialog"}),xw=({titleId:e})=>{const t=cf(lf),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
80
+ `)},iw=0,Cn=[];function aw(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),o=v.useState(iw++)[0],s=v.useState(Hd)[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 m=N2([e.lockRef.current],(e.shards||[]).map(zl),!0).filter(Boolean);return m.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=v.useCallback(function(m,x){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!i.current.allowPinchZoom;var y=Kr(m),b=n.current,k="deltaX"in m?m.deltaX:b[0]-y[0],S="deltaY"in m?m.deltaY:b[1]-y[1],j,C=m.target,N=Math.abs(k)>Math.abs(S)?"h":"v";if("touches"in m&&N==="h"&&C.type==="range")return!1;var T=window.getSelection(),A=T&&T.anchorNode,R=A?A===C||A.contains(C):!1;if(R)return!1;var M=Al(N,C);if(!M)return!0;if(M?j=N:(j=N==="v"?"h":"v",M=Al(N,C)),!M)return!1;if(!r.current&&"changedTouches"in m&&(k||S)&&(r.current=j),!j)return!0;var E=r.current||j;return rw(E,x,m,E==="h"?k:S)},[]),c=v.useCallback(function(m){var x=m;if(!(!Cn.length||Cn[Cn.length-1]!==s)){var y="deltaY"in x?Il(x):Kr(x),b=t.current.filter(function(j){return j.name===x.type&&(j.target===x.target||x.target===j.shadowParent)&&ow(j.delta,y)})[0];if(b&&b.should){x.cancelable&&x.preventDefault();return}if(!b){var k=(i.current.shards||[]).map(zl).filter(Boolean).filter(function(j){return j.contains(x.target)}),S=k.length>0?a(x,k[0]):!i.current.noIsolation;S&&x.cancelable&&x.preventDefault()}}},[]),u=v.useCallback(function(m,x,y,b){var k={name:m,delta:x,target:y,should:b,shadowParent:lw(y)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(S){return S!==k})},1)},[]),d=v.useCallback(function(m){n.current=Kr(m),r.current=void 0},[]),h=v.useCallback(function(m){u(m.type,Il(m),m.target,a(m,e.lockRef.current))},[]),p=v.useCallback(function(m){u(m.type,Kr(m),m.target,a(m,e.lockRef.current))},[]);v.useEffect(function(){return Cn.push(s),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:p}),document.addEventListener("wheel",c,Sn),document.addEventListener("touchmove",c,Sn),document.addEventListener("touchstart",d,Sn),function(){Cn=Cn.filter(function(m){return m!==s}),document.removeEventListener("wheel",c,Sn),document.removeEventListener("touchmove",c,Sn),document.removeEventListener("touchstart",d,Sn)}},[]);var f=e.removeScrollBar,g=e.inert;return v.createElement(v.Fragment,null,g?v.createElement(s,{styles:sw(o)}):null,f?v.createElement(G2,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function lw(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const cw=M2(Vd,aw);var na=v.forwardRef(function(e,t){return v.createElement(Zo,Pt({},e,{ref:t,sideCar:cw}))});na.classNames=Zo.classNames;var uw=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},jn=new WeakMap,Jr=new WeakMap,Gr={},Cs=0,Jd=function(e){return e&&(e.host||Jd(e.parentNode))},dw=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Jd(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})},fw=function(e,t,n,r){var o=dw(t,Array.isArray(e)?e:[e]);Gr[n]||(Gr[n]=new WeakMap);var s=Gr[n],i=[],a=new Set,c=new Set(o),u=function(h){!h||a.has(h)||(a.add(h),u(h.parentNode))};o.forEach(u);var d=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(p){if(a.has(p))d(p);else try{var f=p.getAttribute(r),g=f!==null&&f!=="false",m=(jn.get(p)||0)+1,x=(s.get(p)||0)+1;jn.set(p,m),s.set(p,x),i.push(p),m===1&&g&&Jr.set(p,!0),x===1&&p.setAttribute(n,"true"),g||p.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",p,y)}})};return d(t),a.clear(),Cs++,function(){i.forEach(function(h){var p=jn.get(h)-1,f=s.get(h)-1;jn.set(h,p),s.set(h,f),p||(Jr.has(h)||h.removeAttribute(r),Jr.delete(h)),f||h.removeAttribute(n)}),Cs--,Cs||(jn=new WeakMap,jn=new WeakMap,Jr=new WeakMap,Gr={})}},Gd=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=uw(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),fw(r,o,n,"aria-hidden")):function(){return null}},Vo="Dialog",[Yd]=Gt(Vo),[hw,At]=Yd(Vo),Xd=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!0}=e,a=v.useRef(null),c=v.useRef(null),[u,d]=hn({prop:r,defaultProp:o??!1,onChange:s,caller:Vo});return l.jsx(hw,{scope:t,triggerRef:a,contentRef:c,contentId:Dt(),titleId:Dt(),descriptionId:Dt(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(h=>!h),[d]),modal:i,children:n})};Xd.displayName=Vo;var Qd="DialogTrigger",ef=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=At(Qd,n),s=Pe(t,o.triggerRef);return l.jsx(Ce.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":sa(o.open),...r,ref:s,onClick:we(e.onClick,o.onOpenToggle)})});ef.displayName=Qd;var ra="DialogPortal",[pw,tf]=Yd(ra,{forceMount:void 0}),nf=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=At(ra,t);return l.jsx(pw,{scope:t,forceMount:n,children:v.Children.map(r,i=>l.jsx(kt,{present:n||s.open,children:l.jsx(Uo,{asChild:!0,container:o,children:i})}))})};nf.displayName=ra;var go="DialogOverlay",rf=v.forwardRef((e,t)=>{const n=tf(go,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=At(go,e.__scopeDialog);return s.modal?l.jsx(kt,{present:r||s.open,children:l.jsx(gw,{...o,ref:t})}):null});rf.displayName=go;var mw=Vn("DialogOverlay.RemoveScroll"),gw=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=At(go,n);return l.jsx(na,{as:mw,allowPinchZoom:!0,shards:[o.contentRef],children:l.jsx(Ce.div,{"data-state":sa(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),pn="DialogContent",of=v.forwardRef((e,t)=>{const n=tf(pn,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=At(pn,e.__scopeDialog);return l.jsx(kt,{present:r||s.open,children:s.modal?l.jsx(xw,{...o,ref:t}):l.jsx(yw,{...o,ref:t})})});of.displayName=pn;var xw=v.forwardRef((e,t)=>{const n=At(pn,e.__scopeDialog),r=v.useRef(null),o=Pe(t,n.contentRef,r);return v.useEffect(()=>{const s=r.current;if(s)return Gd(s)},[]),l.jsx(sf,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:we(e.onCloseAutoFocus,s=>{s.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:we(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&s.preventDefault()}),onFocusOutside:we(e.onFocusOutside,s=>s.preventDefault())})}),yw=v.forwardRef((e,t)=>{const n=At(pn,e.__scopeDialog),r=v.useRef(!1),o=v.useRef(!1);return l.jsx(sf,{...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()}})}),sf=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...i}=e,a=At(pn,n),c=v.useRef(null),u=Pe(t,c);return Bd(),l.jsxs(l.Fragment,{children:[l.jsx(ta,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:l.jsx(Bo,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":sa(a.open),...i,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(bw,{titleId:a.titleId}),l.jsx(kw,{contentRef:c,descriptionId:a.descriptionId})]})]})}),oa="DialogTitle",af=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=At(oa,n);return l.jsx(Ce.h2,{id:o.titleId,...r,ref:t})});af.displayName=oa;var lf="DialogDescription",vw=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=At(lf,n);return l.jsx(Ce.p,{id:o.descriptionId,...r,ref:t})});vw.displayName=lf;var cf="DialogClose",uf=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=At(cf,n);return l.jsx(Ce.button,{type:"button",...r,ref:t,onClick:we(e.onClick,()=>o.onOpenChange(!1))})});uf.displayName=cf;function sa(e){return e?"open":"closed"}var df="DialogTitleWarning",[TT,ff]=Yb(df,{contentName:pn,titleName:oa,docsSlug:"dialog"}),bw=({titleId:e})=>{const t=ff(df),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
81
81
 
82
82
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
83
83
 
84
- 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},yw="DialogDescriptionWarning",vw=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${cf(yw).contentName}}.`;return v.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},bw=Gd,ww=Yd,kw=Qd,_w=ef,Sw=tf,Cw=rf,jw=af;function Ew(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 Nw(e){const[t,n]=v.useState(void 0);return et(()=>{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,a;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;i=u.inlineSize,a=u.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const Tw=["top","right","bottom","left"],nn=Math.min,pt=Math.max,go=Math.round,Jr=Math.floor,Mt=e=>({x:e,y:e}),Aw={left:"right",right:"left",bottom:"top",top:"bottom"},Iw={start:"end",end:"start"};function ri(e,t,n){return pt(e,nn(t,n))}function Ht(e,t){return typeof e=="function"?e(t):e}function qt(e){return e.split("-")[0]}function tr(e){return e.split("-")[1]}function sa(e){return e==="x"?"y":"x"}function ia(e){return e==="y"?"height":"width"}const zw=new Set(["top","bottom"]);function Ot(e){return zw.has(qt(e))?"y":"x"}function aa(e){return sa(Ot(e))}function Rw(e,t,n){n===void 0&&(n=!1);const r=tr(e),o=aa(e),s=ia(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=xo(i)),[i,xo(i)]}function Pw(e){const t=xo(e);return[oi(e),t,oi(t)]}function oi(e){return e.replace(/start|end/g,t=>Iw[t])}const zl=["left","right"],Rl=["right","left"],Ow=["top","bottom"],Dw=["bottom","top"];function Mw(e,t,n){switch(e){case"top":case"bottom":return n?t?Rl:zl:t?zl:Rl;case"left":case"right":return t?Ow:Dw;default:return[]}}function Lw(e,t,n,r){const o=tr(e);let s=Mw(qt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(oi)))),s}function xo(e){return e.replace(/left|right|bottom|top/g,t=>Aw[t])}function Fw(e){return{top:0,right:0,bottom:0,left:0,...e}}function uf(e){return typeof e!="number"?Fw(e):{top:e,right:e,bottom:e,left:e}}function yo(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 Pl(e,t,n){let{reference:r,floating:o}=e;const s=Ot(t),i=aa(t),a=ia(i),c=qt(t),u=s==="y",d=r.x+r.width/2-o.width/2,h=r.y+r.height/2-o.height/2,p=r[a]/2-o[a]/2;let f;switch(c){case"top":f={x:d,y:r.y-o.height};break;case"bottom":f={x:d,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:h};break;case"left":f={x:r.x-o.width,y:h};break;default:f={x:r.x,y:r.y}}switch(tr(t)){case"start":f[i]-=p*(n&&u?-1:1);break;case"end":f[i]+=p*(n&&u?-1:1);break}return f}async function $w(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:p=!1,padding:f=0}=Ht(t,e),g=uf(f),x=a[p?h==="floating"?"reference":"floating":h],y=yo(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(a.floating)),boundary:u,rootBoundary:d,strategy:c})),b=h==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.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},C=yo(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:k,strategy:c}):b);return{top:(y.top-C.top+g.top)/S.y,bottom:(C.bottom-y.bottom+g.bottom)/S.y,left:(y.left-C.left+g.left)/S.x,right:(C.right-y.right+g.right)/S.x}}const Bw=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=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:h}=Pl(u,r,c),p=r,f={},g=0;for(let x=0;x<a.length;x++){var m;const{name:y,fn:b}=a[x],{x:k,y:S,data:C,reset:j}=await b({x:d,y:h,initialPlacement:r,placement:p,strategy:o,middlewareData:f,rects:u,platform:{...i,detectOverflow:(m=i.detectOverflow)!=null?m:$w},elements:{reference:e,floating:t}});d=k??d,h=S??h,f={...f,[y]:{...f[y],...C}},j&&g<=50&&(g++,typeof j=="object"&&(j.placement&&(p=j.placement),j.rects&&(u=j.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):j.rects),{x:d,y:h}=Pl(u,p,c)),x=-1)}return{x:d,y:h,placement:p,strategy:o,middlewareData:f}},Uw=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:c}=t,{element:u,padding:d=0}=Ht(e,t)||{};if(u==null)return{};const h=uf(d),p={x:n,y:r},f=aa(o),g=ia(f),m=await i.getDimensions(u),x=f==="y",y=x?"top":"left",b=x?"bottom":"right",k=x?"clientHeight":"clientWidth",S=s.reference[g]+s.reference[f]-p[f]-s.floating[g],C=p[f]-s.reference[f],j=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let N=j?j[k]:0;(!N||!await(i.isElement==null?void 0:i.isElement(j)))&&(N=a.floating[k]||s.floating[g]);const T=S/2-C/2,A=N/2-m[g]/2-1,O=nn(h[y],A),L=nn(h[b],A),E=O,M=N-m[g]-L,w=N/2-m[g]/2+T,D=ri(E,w,M),H=!c.arrow&&tr(o)!=null&&w!==D&&s.reference[g]/2-(w<E?O:L)-m[g]/2<0,B=H?w<E?w-E:w-M:0;return{[f]:p[f]+B,data:{[f]:D,centerOffset:w-D-B,...H&&{alignmentOffset:B}},reset:H}}}),Zw=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:a,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:m=!0,...x}=Ht(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=qt(o),b=Ot(a),k=qt(a)===a,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=p||(k||!m?[xo(a)]:Pw(a)),j=g!=="none";!p&&j&&C.push(...Lw(a,m,g,S));const N=[a,...C],T=await c.detectOverflow(t,x),A=[];let O=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&A.push(T[y]),h){const w=Rw(o,i,S);A.push(T[w[0]],T[w[1]])}if(O=[...O,{placement:o,overflows:A}],!A.every(w=>w<=0)){var L,E;const w=(((L=s.flip)==null?void 0:L.index)||0)+1,D=N[w];if(D&&(!(h==="alignment"?b!==Ot(D):!1)||O.every(q=>Ot(q.placement)===b?q.overflows[0]>0:!0)))return{data:{index:w,overflows:O},reset:{placement:D}};let H=(E=O.filter(B=>B.overflows[0]<=0).sort((B,q)=>B.overflows[1]-q.overflows[1])[0])==null?void 0:E.placement;if(!H)switch(f){case"bestFit":{var M;const B=(M=O.filter(q=>{if(j){const Y=Ot(q.placement);return Y===b||Y==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(Y=>Y>0).reduce((Y,I)=>Y+I,0)]).sort((q,Y)=>q[1]-Y[1])[0])==null?void 0:M[0];B&&(H=B);break}case"initialPlacement":H=a;break}if(o!==H)return{reset:{placement:H}}}return{}}}};function Ol(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Dl(e){return Tw.some(t=>e[t]>=0)}const Vw=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=Ht(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=Ol(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Dl(a)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),a=Ol(i,n.floating);return{data:{escapedOffsets:a,escaped:Dl(a)}}}default:return{}}}}},df=new Set(["left","top"]);async function Ww(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=qt(n),a=tr(n),c=Ot(n)==="y",u=df.has(i)?-1:1,d=s&&c?-1:1,h=Ht(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:g}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof g=="number"&&(f=a==="end"?g*-1:g),c?{x:f*d,y:p*u}:{x:p*u,y:f*d}}const Hw=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:a}=t,c=await Ww(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:i}}}}},qw=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:a=!1,limiter:c={fn:y=>{let{x:b,y:k}=y;return{x:b,y:k}}},...u}=Ht(e,t),d={x:n,y:r},h=await s.detectOverflow(t,u),p=Ot(qt(o)),f=sa(p);let g=d[f],m=d[p];if(i){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",k=g+h[y],S=g-h[b];g=ri(k,g,S)}if(a){const y=p==="y"?"top":"left",b=p==="y"?"bottom":"right",k=m+h[y],S=m-h[b];m=ri(k,m,S)}const x=c.fn({...t,[f]:g,[p]:m});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[f]:i,[p]:a}}}}}},Kw=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=Ht(e,t),d={x:n,y:r},h=Ot(o),p=sa(h);let f=d[p],g=d[h];const m=Ht(a,t),x=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const k=p==="y"?"height":"width",S=s.reference[p]-s.floating[k]+x.mainAxis,C=s.reference[p]+s.reference[k]-x.mainAxis;f<S?f=S:f>C&&(f=C)}if(u){var y,b;const k=p==="y"?"width":"height",S=df.has(qt(o)),C=s.reference[h]-s.floating[k]+(S&&((y=i.offset)==null?void 0:y[h])||0)+(S?0:x.crossAxis),j=s.reference[h]+s.reference[k]+(S?0:((b=i.offset)==null?void 0:b[h])||0)-(S?x.crossAxis:0);g<C?g=C:g>j&&(g=j)}return{[p]:f,[h]:g}}}},Gw=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:a}=t,{apply:c=()=>{},...u}=Ht(e,t),d=await i.detectOverflow(t,u),h=qt(o),p=tr(o),f=Ot(o)==="y",{width:g,height:m}=s.floating;let x,y;h==="top"||h==="bottom"?(x=h,y=p===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(y=h,x=p==="end"?"top":"bottom");const b=m-d.top-d.bottom,k=g-d.left-d.right,S=nn(m-d[x],b),C=nn(g-d[y],k),j=!t.middlewareData.shift;let N=S,T=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(N=b),j&&!p){const O=pt(d.left,0),L=pt(d.right,0),E=pt(d.top,0),M=pt(d.bottom,0);f?T=g-2*(O!==0||L!==0?O+L:pt(d.left,d.right)):N=m-2*(E!==0||M!==0?E+M:pt(d.top,d.bottom))}await c({...t,availableWidth:T,availableHeight:N});const A=await i.getDimensions(a.floating);return g!==A.width||m!==A.height?{reset:{rects:!0}}:{}}}};function Vo(){return typeof window<"u"}function nr(e){return ff(e)?(e.nodeName||"").toLowerCase():"#document"}function gt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function $t(e){var t;return(t=(ff(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ff(e){return Vo()?e instanceof Node||e instanceof gt(e).Node:!1}function Nt(e){return Vo()?e instanceof Element||e instanceof gt(e).Element:!1}function Lt(e){return Vo()?e instanceof HTMLElement||e instanceof gt(e).HTMLElement:!1}function Ml(e){return!Vo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof gt(e).ShadowRoot}const Jw=new Set(["inline","contents"]);function zr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Tt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Jw.has(o)}const Yw=new Set(["table","td","th"]);function Xw(e){return Yw.has(nr(e))}const Qw=[":popover-open",":modal"];function Wo(e){return Qw.some(t=>{try{return e.matches(t)}catch{return!1}})}const ek=["transform","translate","scale","rotate","perspective"],tk=["transform","translate","scale","rotate","perspective","filter"],nk=["paint","layout","strict","content"];function la(e){const t=ca(),n=Nt(e)?Tt(e):e;return ek.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)||tk.some(r=>(n.willChange||"").includes(r))||nk.some(r=>(n.contain||"").includes(r))}function rk(e){let t=rn(e);for(;Lt(t)&&!Hn(t);){if(la(t))return t;if(Wo(t))return null;t=rn(t)}return null}function ca(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const ok=new Set(["html","body","#document"]);function Hn(e){return ok.has(nr(e))}function Tt(e){return gt(e).getComputedStyle(e)}function Ho(e){return Nt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function rn(e){if(nr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ml(e)&&e.host||$t(e);return Ml(t)?t.host:t}function hf(e){const t=rn(e);return Hn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Lt(t)&&zr(t)?t:hf(t)}function Cr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=hf(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=gt(o);if(s){const a=si(i);return t.concat(i,i.visualViewport||[],zr(o)?o:[],a&&n?Cr(a):[])}return t.concat(o,Cr(o,[],n))}function si(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function pf(e){const t=Tt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Lt(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=go(n)!==s||go(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function ua(e){return Nt(e)?e:e.contextElement}function Ln(e){const t=ua(e);if(!Lt(t))return Mt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=pf(t);let i=(s?go(n.width):n.width)/r,a=(s?go(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const sk=Mt(0);function mf(e){const t=gt(e);return!ca()||!t.visualViewport?sk:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ik(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==gt(e)?!1:t}function gn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=ua(e);let i=Mt(1);t&&(r?Nt(r)&&(i=Ln(r)):i=Ln(e));const a=ik(s,n,r)?mf(s):Mt(0);let c=(o.left+a.x)/i.x,u=(o.top+a.y)/i.y,d=o.width/i.x,h=o.height/i.y;if(s){const p=gt(s),f=r&&Nt(r)?gt(r):r;let g=p,m=si(g);for(;m&&r&&f!==g;){const x=Ln(m),y=m.getBoundingClientRect(),b=Tt(m),k=y.left+(m.clientLeft+parseFloat(b.paddingLeft))*x.x,S=y.top+(m.clientTop+parseFloat(b.paddingTop))*x.y;c*=x.x,u*=x.y,d*=x.x,h*=x.y,c+=k,u+=S,g=gt(m),m=si(g)}}return yo({width:d,height:h,x:c,y:u})}function qo(e,t){const n=Ho(e).scrollLeft;return t?t.left+n:gn($t(e)).left+n}function gf(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-qo(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function ak(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=$t(r),a=t?Wo(t.floating):!1;if(r===i||a&&s)return n;let c={scrollLeft:0,scrollTop:0},u=Mt(1);const d=Mt(0),h=Lt(r);if((h||!h&&!s)&&((nr(r)!=="body"||zr(i))&&(c=Ho(r)),Lt(r))){const f=gn(r);u=Ln(r),d.x=f.x+r.clientLeft,d.y=f.y+r.clientTop}const p=i&&!h&&!s?gf(i,c):Mt(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-c.scrollTop*u.y+d.y+p.y}}function lk(e){return Array.from(e.getClientRects())}function ck(e){const t=$t(e),n=Ho(e),r=e.ownerDocument.body,o=pt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=pt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+qo(e);const a=-n.scrollTop;return Tt(r).direction==="rtl"&&(i+=pt(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const Ll=25;function uk(e,t){const n=gt(e),r=$t(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,c=0;if(o){s=o.width,i=o.height;const d=ca();(!d||d&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}const u=qo(r);if(u<=0){const d=r.ownerDocument,h=d.body,p=getComputedStyle(h),f=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(r.clientWidth-h.clientWidth-f);g<=Ll&&(s-=g)}else u<=Ll&&(s+=u);return{width:s,height:i,x:a,y:c}}const dk=new Set(["absolute","fixed"]);function fk(e,t){const n=gn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Lt(e)?Ln(e):Mt(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,c=o*s.x,u=r*s.y;return{width:i,height:a,x:c,y:u}}function Fl(e,t,n){let r;if(t==="viewport")r=uk(e,n);else if(t==="document")r=ck($t(e));else if(Nt(t))r=fk(t,n);else{const o=mf(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return yo(r)}function xf(e,t){const n=rn(e);return n===t||!Nt(n)||Hn(n)?!1:Tt(n).position==="fixed"||xf(n,t)}function hk(e,t){const n=t.get(e);if(n)return n;let r=Cr(e,[],!1).filter(a=>Nt(a)&&nr(a)!=="body"),o=null;const s=Tt(e).position==="fixed";let i=s?rn(e):e;for(;Nt(i)&&!Hn(i);){const a=Tt(i),c=la(i);!c&&a.position==="fixed"&&(o=null),(s?!c&&!o:!c&&a.position==="static"&&!!o&&dk.has(o.position)||zr(i)&&!c&&xf(e,i))?r=r.filter(d=>d!==i):o=a,i=rn(i)}return t.set(e,r),r}function pk(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Wo(t)?[]:hk(t,this._c):[].concat(n),r],a=i[0],c=i.reduce((u,d)=>{const h=Fl(t,d,o);return u.top=pt(h.top,u.top),u.right=nn(h.right,u.right),u.bottom=nn(h.bottom,u.bottom),u.left=pt(h.left,u.left),u},Fl(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function mk(e){const{width:t,height:n}=pf(e);return{width:t,height:n}}function gk(e,t,n){const r=Lt(t),o=$t(t),s=n==="fixed",i=gn(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=Mt(0);function u(){c.x=qo(o)}if(r||!r&&!s)if((nr(t)!=="body"||zr(o))&&(a=Ho(t)),r){const f=gn(t,!0,s,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else o&&u();s&&!r&&o&&u();const d=o&&!r&&!s?gf(o,a):Mt(0),h=i.left+a.scrollLeft-c.x-d.x,p=i.top+a.scrollTop-c.y-d.y;return{x:h,y:p,width:i.width,height:i.height}}function js(e){return Tt(e).position==="static"}function $l(e,t){if(!Lt(e)||Tt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return $t(e)===n&&(n=n.ownerDocument.body),n}function yf(e,t){const n=gt(e);if(Wo(e))return n;if(!Lt(e)){let o=rn(e);for(;o&&!Hn(o);){if(Nt(o)&&!js(o))return o;o=rn(o)}return n}let r=$l(e,t);for(;r&&Xw(r)&&js(r);)r=$l(r,t);return r&&Hn(r)&&js(r)&&!la(r)?n:r||rk(e)||n}const xk=async function(e){const t=this.getOffsetParent||yf,n=this.getDimensions,r=await n(e.floating);return{reference:gk(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function yk(e){return Tt(e).direction==="rtl"}const vk={convertOffsetParentRelativeRectToViewportRelativeRect:ak,getDocumentElement:$t,getClippingRect:pk,getOffsetParent:yf,getElementRects:xk,getClientRects:lk,getDimensions:mk,getScale:Ln,isElement:Nt,isRTL:yk};function vf(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function bk(e,t){let n=null,r;const o=$t(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const u=e.getBoundingClientRect(),{left:d,top:h,width:p,height:f}=u;if(a||t(),!p||!f)return;const g=Jr(h),m=Jr(o.clientWidth-(d+p)),x=Jr(o.clientHeight-(h+f)),y=Jr(d),k={rootMargin:-g+"px "+-m+"px "+-x+"px "+-y+"px",threshold:pt(0,nn(1,c))||1};let S=!0;function C(j){const N=j[0].intersectionRatio;if(N!==c){if(!S)return i();N?i(!1,N):r=setTimeout(()=>{i(!1,1e-7)},1e3)}N===1&&!vf(u,e.getBoundingClientRect())&&i(),S=!1}try{n=new IntersectionObserver(C,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,k)}n.observe(e)}return i(!0),s}function wk(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=ua(e),d=o||s?[...u?Cr(u):[],...Cr(t)]:[];d.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const h=u&&a?bk(u,n):null;let p=-1,f=null;i&&(f=new ResizeObserver(y=>{let[b]=y;b&&b.target===u&&f&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var k;(k=f)==null||k.observe(t)})),n()}),u&&!c&&f.observe(u),f.observe(t));let g,m=c?gn(e):null;c&&x();function x(){const y=gn(e);m&&!vf(m,y)&&n(),m=y,g=requestAnimationFrame(x)}return n(),()=>{var y;d.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),h?.(),(y=f)==null||y.disconnect(),f=null,c&&cancelAnimationFrame(g)}}const kk=Hw,_k=qw,Sk=Zw,Ck=Gw,jk=Vw,Bl=Uw,Ek=Kw,Nk=(e,t,n)=>{const r=new Map,o={platform:vk,...n},s={...o.platform,_c:r};return Bw(e,t,{...o,platform:s})};var Tk=typeof document<"u",Ak=function(){},so=Tk?v.useLayoutEffect:Ak;function vo(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(!vo(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)&&!vo(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function bf(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ul(e,t){const n=bf(e);return Math.round(t*n)/n}function Es(e){const t=v.useRef(e);return so(()=>{t.current=e}),t}function Ik(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[d,h]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=v.useState(r);vo(p,r)||f(r);const[g,m]=v.useState(null),[x,y]=v.useState(null),b=v.useCallback(q=>{q!==j.current&&(j.current=q,m(q))},[]),k=v.useCallback(q=>{q!==N.current&&(N.current=q,y(q))},[]),S=s||g,C=i||x,j=v.useRef(null),N=v.useRef(null),T=v.useRef(d),A=c!=null,O=Es(c),L=Es(o),E=Es(u),M=v.useCallback(()=>{if(!j.current||!N.current)return;const q={placement:t,strategy:n,middleware:p};L.current&&(q.platform=L.current),Nk(j.current,N.current,q).then(Y=>{const I={...Y,isPositioned:E.current!==!1};w.current&&!vo(T.current,I)&&(T.current=I,Tr.flushSync(()=>{h(I)}))})},[p,t,n,L,E]);so(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,h(q=>({...q,isPositioned:!1})))},[u]);const w=v.useRef(!1);so(()=>(w.current=!0,()=>{w.current=!1}),[]),so(()=>{if(S&&(j.current=S),C&&(N.current=C),S&&C){if(O.current)return O.current(S,C,M);M()}},[S,C,M,O,A]);const D=v.useMemo(()=>({reference:j,floating:N,setReference:b,setFloating:k}),[b,k]),H=v.useMemo(()=>({reference:S,floating:C}),[S,C]),B=v.useMemo(()=>{const q={position:n,left:0,top:0};if(!H.floating)return q;const Y=Ul(H.floating,d.x),I=Ul(H.floating,d.y);return a?{...q,transform:"translate("+Y+"px, "+I+"px)",...bf(H.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:I}},[n,a,H.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:M,refs:D,elements:H,floatingStyles:B}),[d,M,D,H,B])}const zk=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?Bl({element:r.current,padding:o}).fn(n):{}:r?Bl({element:r,padding:o}).fn(n):{}}}},Rk=(e,t)=>({...kk(e),options:[e,t]}),Pk=(e,t)=>({..._k(e),options:[e,t]}),Ok=(e,t)=>({...Ek(e),options:[e,t]}),Dk=(e,t)=>({...Sk(e),options:[e,t]}),Mk=(e,t)=>({...Ck(e),options:[e,t]}),Lk=(e,t)=>({...jk(e),options:[e,t]}),Fk=(e,t)=>({...zk(e),options:[e,t]});var $k="Arrow",wf=v.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return l.jsx(Ce.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});wf.displayName=$k;var Bk=wf,da="Popper",[kf,Ko]=Jt(da),[Uk,_f]=kf(da),Sf=e=>{const{__scopePopper:t,children:n}=e,[r,o]=v.useState(null);return l.jsx(Uk,{scope:t,anchor:r,onAnchorChange:o,children:n})};Sf.displayName=da;var Cf="PopperAnchor",jf=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=_f(Cf,n),i=v.useRef(null),a=Re(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:l.jsx(Ce.div,{...o,ref:a})});jf.displayName=Cf;var fa="PopperContent",[Zk,Vk]=kf(fa),Ef=v.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:p=!1,updatePositionStrategy:f="optimized",onPlaced:g,...m}=e,x=_f(fa,n),[y,b]=v.useState(null),k=Re(t,te=>b(te)),[S,C]=v.useState(null),j=Nw(S),N=j?.width??0,T=j?.height??0,A=r+(s!=="center"?"-"+s:""),O=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},L=Array.isArray(u)?u:[u],E=L.length>0,M={padding:O,boundary:L.filter(Hk),altBoundary:E},{refs:w,floatingStyles:D,placement:H,isPositioned:B,middlewareData:q}=Ik({strategy:"fixed",placement:A,whileElementsMounted:(...te)=>wk(...te,{animationFrame:f==="always"}),elements:{reference:x.anchor},middleware:[Rk({mainAxis:o+T,alignmentAxis:i}),c&&Pk({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Ok():void 0,...M}),c&&Dk({...M}),Mk({...M,apply:({elements:te,rects:ce,availableWidth:fe,availableHeight:ge})=>{const{width:xe,height:Ee}=ce.reference,Oe=te.floating.style;Oe.setProperty("--radix-popper-available-width",`${fe}px`),Oe.setProperty("--radix-popper-available-height",`${ge}px`),Oe.setProperty("--radix-popper-anchor-width",`${xe}px`),Oe.setProperty("--radix-popper-anchor-height",`${Ee}px`)}}),S&&Fk({element:S,padding:a}),qk({arrowWidth:N,arrowHeight:T}),p&&Lk({strategy:"referenceHidden",...M})]}),[Y,I]=Af(H),W=st(g);et(()=>{B&&W?.()},[B,W]);const V=q.arrow?.x,z=q.arrow?.y,oe=q.arrow?.centerOffset!==0,[X,de]=v.useState();return et(()=>{y&&de(window.getComputedStyle(y).zIndex)},[y]),l.jsx("div",{ref:w.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:B?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:X,"--radix-popper-transform-origin":[q.transformOrigin?.x,q.transformOrigin?.y].join(" "),...q.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(Zk,{scope:n,placedSide:Y,onArrowChange:C,arrowX:V,arrowY:z,shouldHideArrow:oe,children:l.jsx(Ce.div,{"data-side":Y,"data-align":I,...m,ref:k,style:{...m.style,animation:B?void 0:"none"}})})})});Ef.displayName=fa;var Nf="PopperArrow",Wk={top:"bottom",right:"left",bottom:"top",left:"right"},Tf=v.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=Vk(Nf,r),i=Wk[s.placedSide];return l.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:l.jsx(Bk,{...o,ref:n,style:{...o.style,display:"block"}})})});Tf.displayName=Nf;function Hk(e){return e!==null}var qk=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=o.arrow?.centerOffset!==0,a=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,d]=Af(n),h={start:"0%",center:"50%",end:"100%"}[d],p=(o.arrow?.x??0)+a/2,f=(o.arrow?.y??0)+c/2;let g="",m="";return u==="bottom"?(g=i?h:`${p}px`,m=`${-c}px`):u==="top"?(g=i?h:`${p}px`,m=`${r.floating.height+c}px`):u==="right"?(g=`${-c}px`,m=i?h:`${f}px`):u==="left"&&(g=`${r.floating.width+c}px`,m=i?h:`${f}px`),{data:{x:g,y:m}}}});function Af(e){const[t,n="center"]=e.split("-");return[t,n]}var If=Sf,zf=jf,Rf=Ef,Pf=Tf,Ns="rovingFocusGroup.onEntryFocus",Kk={bubbles:!1,cancelable:!0},Rr="RovingFocusGroup",[ii,Of,Gk]=Ad(Rr),[Jk,Df]=Jt(Rr,[Gk]),[Yk,Xk]=Jk(Rr),Mf=v.forwardRef((e,t)=>l.jsx(ii.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(ii.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Qk,{...e,ref:t})})}));Mf.displayName=Rr;var Qk=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=e,p=v.useRef(null),f=Re(t,p),g=Fo(s),[m,x]=pn({prop:i,defaultProp:a??null,onChange:c,caller:Rr}),[y,b]=v.useState(!1),k=st(u),S=Of(n),C=v.useRef(!1),[j,N]=v.useState(0);return v.useEffect(()=>{const T=p.current;if(T)return T.addEventListener(Ns,k),()=>T.removeEventListener(Ns,k)},[k]),l.jsx(Yk,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:m,onItemFocus:v.useCallback(T=>x(T),[x]),onItemShiftTab:v.useCallback(()=>b(!0),[]),onFocusableItemAdd:v.useCallback(()=>N(T=>T+1),[]),onFocusableItemRemove:v.useCallback(()=>N(T=>T-1),[]),children:l.jsx(Ce.div,{tabIndex:y||j===0?-1:0,"data-orientation":r,...h,ref:f,style:{outline:"none",...e.style},onMouseDown:we(e.onMouseDown,()=>{C.current=!0}),onFocus:we(e.onFocus,T=>{const A=!C.current;if(T.target===T.currentTarget&&A&&!y){const O=new CustomEvent(Ns,Kk);if(T.currentTarget.dispatchEvent(O),!O.defaultPrevented){const L=S().filter(H=>H.focusable),E=L.find(H=>H.active),M=L.find(H=>H.id===m),D=[E,M,...L].filter(Boolean).map(H=>H.ref.current);$f(D,d)}}C.current=!1}),onBlur:we(e.onBlur,()=>b(!1))})})}),Lf="RovingFocusGroupItem",Ff=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...a}=e,c=Dt(),u=s||c,d=Xk(Lf,n),h=d.currentTabStopId===u,p=Of(n),{onFocusableItemAdd:f,onFocusableItemRemove:g,currentTabStopId:m}=d;return v.useEffect(()=>{if(r)return f(),()=>g()},[r,f,g]),l.jsx(ii.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:l.jsx(Ce.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:we(e.onMouseDown,x=>{r?d.onItemFocus(u):x.preventDefault()}),onFocus:we(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:we(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){d.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const y=n_(x,d.orientation,d.dir);if(y!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let k=p().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?r_(k,S+1):k.slice(S+1)}setTimeout(()=>$f(k))}}),children:typeof i=="function"?i({isCurrentTabStop:h,hasTabStop:m!=null}):i})})});Ff.displayName=Lf;var e_={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function t_(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function n_(e,t,n){const r=t_(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return e_[r]}function $f(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function r_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var o_=Mf,s_=Ff;function ai(e,[t,n]){return Math.min(n,Math.max(t,e))}function i_(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var ha="ScrollArea",[Bf]=Jt(ha),[a_,_t]=Bf(ha),Uf=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[a,c]=v.useState(null),[u,d]=v.useState(null),[h,p]=v.useState(null),[f,g]=v.useState(null),[m,x]=v.useState(null),[y,b]=v.useState(0),[k,S]=v.useState(0),[C,j]=v.useState(!1),[N,T]=v.useState(!1),A=Re(t,L=>c(L)),O=Fo(o);return l.jsx(a_,{scope:n,type:r,dir:O,scrollHideDelay:s,scrollArea:a,viewport:u,onViewportChange:d,content:h,onContentChange:p,scrollbarX:f,onScrollbarXChange:g,scrollbarXEnabled:C,onScrollbarXEnabledChange:j,scrollbarY:m,onScrollbarYChange:x,scrollbarYEnabled:N,onScrollbarYEnabledChange:T,onCornerWidthChange:b,onCornerHeightChange:S,children:l.jsx(Ce.div,{dir:O,...i,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})});Uf.displayName=ha;var Zf="ScrollAreaViewport",Vf=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...s}=e,i=_t(Zf,n),a=v.useRef(null),c=Re(t,a,i.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),l.jsx(Ce.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:l.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});Vf.displayName=Zf;var Bt="ScrollAreaScrollbar",Wf=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=_t(Bt,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,a=e.orientation==="horizontal";return v.useEffect(()=>(a?s(!0):i(!0),()=>{a?s(!1):i(!1)}),[a,s,i]),o.type==="hover"?l.jsx(l_,{...r,ref:t,forceMount:n}):o.type==="scroll"?l.jsx(c_,{...r,ref:t,forceMount:n}):o.type==="auto"?l.jsx(Hf,{...r,ref:t,forceMount:n}):o.type==="always"?l.jsx(pa,{...r,ref:t}):null});Wf.displayName=Bt;var l_=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=_t(Bt,e.__scopeScrollArea),[s,i]=v.useState(!1);return v.useEffect(()=>{const a=o.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),i(!0)},d=()=>{c=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",d)}}},[o.scrollArea,o.scrollHideDelay]),l.jsx(kt,{present:n||s,children:l.jsx(Hf,{"data-state":s?"visible":"hidden",...r,ref:t})})}),c_=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=_t(Bt,e.__scopeScrollArea),s=e.orientation==="horizontal",i=Jo(()=>c("SCROLL_END"),100),[a,c]=i_("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return v.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,o.scrollHideDelay,c]),v.useEffect(()=>{const u=o.viewport,d=s?"scrollLeft":"scrollTop";if(u){let h=u[d];const p=()=>{const f=u[d];h!==f&&(c("SCROLL"),i()),h=f};return u.addEventListener("scroll",p),()=>u.removeEventListener("scroll",p)}},[o.viewport,s,c,i]),l.jsx(kt,{present:n||a!=="hidden",children:l.jsx(pa,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:we(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:we(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Hf=v.forwardRef((e,t)=>{const n=_t(Bt,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=v.useState(!1),a=e.orientation==="horizontal",c=Jo(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;i(a?u:d)}},10);return qn(n.viewport,c),qn(n.content,c),l.jsx(kt,{present:r||s,children:l.jsx(pa,{"data-state":s?"visible":"hidden",...o,ref:t})})}),pa=v.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=_t(Bt,e.__scopeScrollArea),s=v.useRef(null),i=v.useRef(0),[a,c]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Yf(a.viewport,a.content),d={...r,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:p=>s.current=p,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:p=>i.current=p};function h(p,f){return m_(p,i.current,a,f)}return n==="horizontal"?l.jsx(u_,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const p=o.viewport.scrollLeft,f=Zl(p,a,o.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:p=>{o.viewport&&(o.viewport.scrollLeft=p)},onDragScroll:p=>{o.viewport&&(o.viewport.scrollLeft=h(p,o.dir))}}):n==="vertical"?l.jsx(d_,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const p=o.viewport.scrollTop,f=Zl(p,a);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:p=>{o.viewport&&(o.viewport.scrollTop=p)},onDragScroll:p=>{o.viewport&&(o.viewport.scrollTop=h(p))}}):null}),u_=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=_t(Bt,e.__scopeScrollArea),[i,a]=v.useState(),c=v.useRef(null),u=Re(t,c,s.onScrollbarXChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(Kf,{"data-orientation":"horizontal",...o,ref:u,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Go(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,h)=>{if(s.viewport){const p=s.viewport.scrollLeft+d.deltaX;e.onWheelScroll(p),Qf(p,h)&&d.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:wo(i.paddingLeft),paddingEnd:wo(i.paddingRight)}})}})}),d_=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=_t(Bt,e.__scopeScrollArea),[i,a]=v.useState(),c=v.useRef(null),u=Re(t,c,s.onScrollbarYChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(Kf,{"data-orientation":"vertical",...o,ref:u,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Go(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,h)=>{if(s.viewport){const p=s.viewport.scrollTop+d.deltaY;e.onWheelScroll(p),Qf(p,h)&&d.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:wo(i.paddingTop),paddingEnd:wo(i.paddingBottom)}})}})}),[f_,qf]=Bf(Bt),Kf=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:h,...p}=e,f=_t(Bt,n),[g,m]=v.useState(null),x=Re(t,A=>m(A)),y=v.useRef(null),b=v.useRef(""),k=f.viewport,S=r.content-r.viewport,C=st(d),j=st(c),N=Jo(h,10);function T(A){if(y.current){const O=A.clientX-y.current.left,L=A.clientY-y.current.top;u({x:O,y:L})}}return v.useEffect(()=>{const A=O=>{const L=O.target;g?.contains(L)&&C(O,S)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[k,g,S,C]),v.useEffect(j,[r,j]),qn(g,N),qn(f.content,N),l.jsx(f_,{scope:n,scrollbar:g,hasThumb:o,onThumbChange:st(s),onThumbPointerUp:st(i),onThumbPositionChange:j,onThumbPointerDown:st(a),children:l.jsx(Ce.div,{...p,ref:x,style:{position:"absolute",...p.style},onPointerDown:we(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),y.current=g.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),T(A))}),onPointerMove:we(e.onPointerMove,T),onPointerUp:we(e.onPointerUp,A=>{const O=A.target;O.hasPointerCapture(A.pointerId)&&O.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=b.current,f.viewport&&(f.viewport.style.scrollBehavior=""),y.current=null})})})}),bo="ScrollAreaThumb",Gf=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=qf(bo,e.__scopeScrollArea);return l.jsx(kt,{present:n||o.hasThumb,children:l.jsx(h_,{ref:t,...r})})}),h_=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=_t(bo,n),i=qf(bo,n),{onThumbPositionChange:a}=i,c=Re(t,h=>i.onThumbChange(h)),u=v.useRef(void 0),d=Jo(()=>{u.current&&(u.current(),u.current=void 0)},100);return v.useEffect(()=>{const h=s.viewport;if(h){const p=()=>{if(d(),!u.current){const f=g_(h,a);u.current=f,a()}};return a(),h.addEventListener("scroll",p),()=>h.removeEventListener("scroll",p)}},[s.viewport,d,a]),l.jsx(Ce.div,{"data-state":i.hasThumb?"visible":"hidden",...o,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:we(e.onPointerDownCapture,h=>{const f=h.target.getBoundingClientRect(),g=h.clientX-f.left,m=h.clientY-f.top;i.onThumbPointerDown({x:g,y:m})}),onPointerUp:we(e.onPointerUp,i.onThumbPointerUp)})});Gf.displayName=bo;var ma="ScrollAreaCorner",Jf=v.forwardRef((e,t)=>{const n=_t(ma,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?l.jsx(p_,{...e,ref:t}):null});Jf.displayName=ma;var p_=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=_t(ma,n),[s,i]=v.useState(0),[a,c]=v.useState(0),u=!!(s&&a);return qn(o.scrollbarX,()=>{const d=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(d),c(d)}),qn(o.scrollbarY,()=>{const d=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(d),i(d)}),u?l.jsx(Ce.div,{...r,ref:t,style:{width:s,height:a,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function wo(e){return e?parseInt(e,10):0}function Yf(e,t){const n=e/t;return isNaN(n)?0:n}function Go(e){const t=Yf(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function m_(e,t,n,r="ltr"){const o=Go(n),s=o/2,i=t||s,a=o-i,c=n.scrollbar.paddingStart+i,u=n.scrollbar.size-n.scrollbar.paddingEnd-a,d=n.content-n.viewport,h=r==="ltr"?[0,d]:[d*-1,0];return Xf([c,u],h)(e)}function Zl(e,t,n="ltr"){const r=Go(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,i=t.content-t.viewport,a=s-r,c=n==="ltr"?[0,i]:[i*-1,0],u=ai(e,c);return Xf([0,i],[0,a])(u)}function Xf(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Qf(e,t){return e>0&&e<t}var g_=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function o(){const s={left:e.scrollLeft,top:e.scrollTop},i=n.left!==s.left,a=n.top!==s.top;(i||a)&&t(),n=s,r=window.requestAnimationFrame(o)})(),()=>window.cancelAnimationFrame(r)};function Jo(e,t){const n=st(e),r=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),v.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function qn(e,t){const n=st(t);et(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}var x_=Uf,y_=Vf,v_=Jf,b_=[" ","Enter","ArrowUp","ArrowDown"],w_=[" ","Enter"],xn="Select",[Yo,Xo,k_]=Ad(xn),[rr]=Jt(xn,[k_,Ko]),Qo=Ko(),[__,an]=rr(xn),[S_,C_]=rr(xn),eh=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:a,onValueChange:c,dir:u,name:d,autoComplete:h,disabled:p,required:f,form:g}=e,m=Qo(t),[x,y]=v.useState(null),[b,k]=v.useState(null),[S,C]=v.useState(!1),j=Fo(u),[N,T]=pn({prop:r,defaultProp:o??!1,onChange:s,caller:xn}),[A,O]=pn({prop:i,defaultProp:a,onChange:c,caller:xn}),L=v.useRef(null),E=x?g||!!x.closest("form"):!0,[M,w]=v.useState(new Set),D=Array.from(M).map(H=>H.props.value).join(";");return l.jsx(If,{...m,children:l.jsxs(__,{required:f,scope:t,trigger:x,onTriggerChange:y,valueNode:b,onValueNodeChange:k,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:Dt(),value:A,onValueChange:O,open:N,onOpenChange:T,dir:j,triggerPointerDownPosRef:L,disabled:p,children:[l.jsx(Yo.Provider,{scope:t,children:l.jsx(S_,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(H=>{w(B=>new Set(B).add(H))},[]),onNativeOptionRemove:v.useCallback(H=>{w(B=>{const q=new Set(B);return q.delete(H),q})},[]),children:n})}),E?l.jsxs(kh,{"aria-hidden":!0,required:f,tabIndex:-1,name:d,autoComplete:h,value:A,onChange:H=>O(H.target.value),disabled:p,form:g,children:[A===void 0?l.jsx("option",{value:""}):null,Array.from(M)]},D):null]})})};eh.displayName=xn;var th="SelectTrigger",nh=v.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=Qo(n),i=an(th,n),a=i.disabled||r,c=Re(t,i.onTriggerChange),u=Xo(n),d=v.useRef("touch"),[h,p,f]=Sh(m=>{const x=u().filter(k=>!k.disabled),y=x.find(k=>k.value===i.value),b=Ch(x,m,y);b!==void 0&&i.onValueChange(b.value)}),g=m=>{a||(i.onOpenChange(!0),f()),m&&(i.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return l.jsx(zf,{asChild:!0,...s,children:l.jsx(Ce.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":_h(i.value)?"":void 0,...o,ref:c,onClick:we(o.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&g(m)}),onPointerDown:we(o.onPointerDown,m=>{d.current=m.pointerType;const x=m.target;x.hasPointerCapture(m.pointerId)&&x.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(g(m),m.preventDefault())}),onKeyDown:we(o.onKeyDown,m=>{const x=h.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&p(m.key),!(x&&m.key===" ")&&b_.includes(m.key)&&(g(),m.preventDefault())})})})});nh.displayName=th;var rh="SelectValue",oh=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...a}=e,c=an(rh,n),{onValueNodeHasChildrenChange:u}=c,d=s!==void 0,h=Re(t,c.onValueNodeChange);return et(()=>{u(d)},[u,d]),l.jsx(Ce.span,{...a,ref:h,style:{pointerEvents:"none"},children:_h(c.value)?l.jsx(l.Fragment,{children:i}):s})});oh.displayName=rh;var j_="SelectIcon",sh=v.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return l.jsx(Ce.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});sh.displayName=j_;var E_="SelectPortal",ih=e=>l.jsx(Bo,{asChild:!0,...e});ih.displayName=E_;var yn="SelectContent",ah=v.forwardRef((e,t)=>{const n=an(yn,e.__scopeSelect),[r,o]=v.useState();if(et(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?Tr.createPortal(l.jsx(lh,{scope:e.__scopeSelect,children:l.jsx(Yo.Slot,{scope:e.__scopeSelect,children:l.jsx("div",{children:e.children})})}),s):null}return l.jsx(ch,{...e,ref:t})});ah.displayName=yn;var jt=10,[lh,ln]=rr(yn),N_="SelectContentImpl",T_=Wn("SelectContent.RemoveScroll"),ch=v.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:p,collisionPadding:f,sticky:g,hideWhenDetached:m,avoidCollisions:x,...y}=e,b=an(yn,n),[k,S]=v.useState(null),[C,j]=v.useState(null),N=Re(t,te=>S(te)),[T,A]=v.useState(null),[O,L]=v.useState(null),E=Xo(n),[M,w]=v.useState(!1),D=v.useRef(!1);v.useEffect(()=>{if(k)return qd(k)},[k]),Ld();const H=v.useCallback(te=>{const[ce,...fe]=E().map(Ee=>Ee.ref.current),[ge]=fe.slice(-1),xe=document.activeElement;for(const Ee of te)if(Ee===xe||(Ee?.scrollIntoView({block:"nearest"}),Ee===ce&&C&&(C.scrollTop=0),Ee===ge&&C&&(C.scrollTop=C.scrollHeight),Ee?.focus(),document.activeElement!==xe))return},[E,C]),B=v.useCallback(()=>H([T,k]),[H,T,k]);v.useEffect(()=>{M&&B()},[M,B]);const{onOpenChange:q,triggerPointerDownPosRef:Y}=b;v.useEffect(()=>{if(k){let te={x:0,y:0};const ce=ge=>{te={x:Math.abs(Math.round(ge.pageX)-(Y.current?.x??0)),y:Math.abs(Math.round(ge.pageY)-(Y.current?.y??0))}},fe=ge=>{te.x<=10&&te.y<=10?ge.preventDefault():k.contains(ge.target)||q(!1),document.removeEventListener("pointermove",ce),Y.current=null};return Y.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",fe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",fe,{capture:!0})}}},[k,q,Y]),v.useEffect(()=>{const te=()=>q(!1);return window.addEventListener("blur",te),window.addEventListener("resize",te),()=>{window.removeEventListener("blur",te),window.removeEventListener("resize",te)}},[q]);const[I,W]=Sh(te=>{const ce=E().filter(xe=>!xe.disabled),fe=ce.find(xe=>xe.ref.current===document.activeElement),ge=Ch(ce,te,fe);ge&&setTimeout(()=>ge.ref.current.focus())}),V=v.useCallback((te,ce,fe)=>{const ge=!D.current&&!fe;(b.value!==void 0&&b.value===ce||ge)&&(A(te),ge&&(D.current=!0))},[b.value]),z=v.useCallback(()=>k?.focus(),[k]),oe=v.useCallback((te,ce,fe)=>{const ge=!D.current&&!fe;(b.value!==void 0&&b.value===ce||ge)&&L(te)},[b.value]),X=r==="popper"?li:uh,de=X===li?{side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:p,collisionPadding:f,sticky:g,hideWhenDetached:m,avoidCollisions:x}:{};return l.jsx(lh,{scope:n,content:k,viewport:C,onViewportChange:j,itemRefCallback:V,selectedItem:T,onItemLeave:z,itemTextRefCallback:oe,focusSelectedItem:B,selectedItemText:O,position:r,isPositioned:M,searchRef:I,children:l.jsx(ta,{as:T_,allowPinchZoom:!0,children:l.jsx(ea,{asChild:!0,trapped:b.open,onMountAutoFocus:te=>{te.preventDefault()},onUnmountAutoFocus:we(o,te=>{b.trigger?.focus({preventScroll:!0}),te.preventDefault()}),children:l.jsx($o,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:te=>te.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:l.jsx(X,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:te=>te.preventDefault(),...y,...de,onPlaced:()=>w(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:we(y.onKeyDown,te=>{const ce=te.ctrlKey||te.altKey||te.metaKey;if(te.key==="Tab"&&te.preventDefault(),!ce&&te.key.length===1&&W(te.key),["ArrowUp","ArrowDown","Home","End"].includes(te.key)){let ge=E().filter(xe=>!xe.disabled).map(xe=>xe.ref.current);if(["ArrowUp","End"].includes(te.key)&&(ge=ge.slice().reverse()),["ArrowUp","ArrowDown"].includes(te.key)){const xe=te.target,Ee=ge.indexOf(xe);ge=ge.slice(Ee+1)}setTimeout(()=>H(ge)),te.preventDefault()}})})})})})})});ch.displayName=N_;var A_="SelectItemAlignedPosition",uh=v.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=an(yn,n),i=ln(yn,n),[a,c]=v.useState(null),[u,d]=v.useState(null),h=Re(t,N=>d(N)),p=Xo(n),f=v.useRef(!1),g=v.useRef(!0),{viewport:m,selectedItem:x,selectedItemText:y,focusSelectedItem:b}=i,k=v.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&u&&m&&x&&y){const N=s.trigger.getBoundingClientRect(),T=u.getBoundingClientRect(),A=s.valueNode.getBoundingClientRect(),O=y.getBoundingClientRect();if(s.dir!=="rtl"){const xe=O.left-T.left,Ee=A.left-xe,Oe=N.left-Ee,_=N.width+Oe,ee=Math.max(_,T.width),G=window.innerWidth-jt,P=ai(Ee,[jt,Math.max(jt,G-ee)]);a.style.minWidth=_+"px",a.style.left=P+"px"}else{const xe=T.right-O.right,Ee=window.innerWidth-A.right-xe,Oe=window.innerWidth-N.right-Ee,_=N.width+Oe,ee=Math.max(_,T.width),G=window.innerWidth-jt,P=ai(Ee,[jt,Math.max(jt,G-ee)]);a.style.minWidth=_+"px",a.style.right=P+"px"}const L=p(),E=window.innerHeight-jt*2,M=m.scrollHeight,w=window.getComputedStyle(u),D=parseInt(w.borderTopWidth,10),H=parseInt(w.paddingTop,10),B=parseInt(w.borderBottomWidth,10),q=parseInt(w.paddingBottom,10),Y=D+H+M+q+B,I=Math.min(x.offsetHeight*5,Y),W=window.getComputedStyle(m),V=parseInt(W.paddingTop,10),z=parseInt(W.paddingBottom,10),oe=N.top+N.height/2-jt,X=E-oe,de=x.offsetHeight/2,te=x.offsetTop+de,ce=D+H+te,fe=Y-ce;if(ce<=oe){const xe=L.length>0&&x===L[L.length-1].ref.current;a.style.bottom="0px";const Ee=u.clientHeight-m.offsetTop-m.offsetHeight,Oe=Math.max(X,de+(xe?z:0)+Ee+B),_=ce+Oe;a.style.height=_+"px"}else{const xe=L.length>0&&x===L[0].ref.current;a.style.top="0px";const Oe=Math.max(oe,D+m.offsetTop+(xe?V:0)+de)+fe;a.style.height=Oe+"px",m.scrollTop=ce-oe+m.offsetTop}a.style.margin=`${jt}px 0`,a.style.minHeight=I+"px",a.style.maxHeight=E+"px",r?.(),requestAnimationFrame(()=>f.current=!0)}},[p,s.trigger,s.valueNode,a,u,m,x,y,s.dir,r]);et(()=>k(),[k]);const[S,C]=v.useState();et(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const j=v.useCallback(N=>{N&&g.current===!0&&(k(),b?.(),g.current=!1)},[k,b]);return l.jsx(z_,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:f,onScrollButtonChange:j,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:l.jsx(Ce.div,{...o,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});uh.displayName=A_;var I_="SelectPopperPosition",li=v.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=jt,...s}=e,i=Qo(n);return l.jsx(Rf,{...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)"}})});li.displayName=I_;var[z_,ga]=rr(yn,{}),ci="SelectViewport",dh=v.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=ln(ci,n),i=ga(ci,n),a=Re(t,s.onViewportChange),c=v.useRef(0);return l.jsxs(l.Fragment,{children:[l.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}),l.jsx(Yo.Slot,{scope:n,children:l.jsx(Ce.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:we(o.onScroll,u=>{const d=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:p}=i;if(p?.current&&h){const f=Math.abs(c.current-d.scrollTop);if(f>0){const g=window.innerHeight-jt*2,m=parseFloat(h.style.minHeight),x=parseFloat(h.style.height),y=Math.max(m,x);if(y<g){const b=y+f,k=Math.min(g,b),S=b-k;h.style.height=k+"px",h.style.bottom==="0px"&&(d.scrollTop=S>0?S:0,h.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});dh.displayName=ci;var fh="SelectGroup",[R_,P_]=rr(fh),O_=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Dt();return l.jsx(R_,{scope:n,id:o,children:l.jsx(Ce.div,{role:"group","aria-labelledby":o,...r,ref:t})})});O_.displayName=fh;var hh="SelectLabel",D_=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=P_(hh,n);return l.jsx(Ce.div,{id:o.id,...r,ref:t})});D_.displayName=hh;var ko="SelectItem",[M_,ph]=rr(ko),mh=v.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,a=an(ko,n),c=ln(ko,n),u=a.value===r,[d,h]=v.useState(s??""),[p,f]=v.useState(!1),g=Re(t,b=>c.itemRefCallback?.(b,r,o)),m=Dt(),x=v.useRef("touch"),y=()=>{o||(a.onValueChange(r),a.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 l.jsx(M_,{scope:n,value:r,disabled:o,textId:m,isSelected:u,onItemTextChange:v.useCallback(b=>{h(k=>k||(b?.textContent??"").trim())},[]),children:l.jsx(Yo.ItemSlot,{scope:n,value:r,disabled:o,textValue:d,children:l.jsx(Ce.div,{role:"option","aria-labelledby":m,"data-highlighted":p?"":void 0,"aria-selected":u&&p,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:g,onFocus:we(i.onFocus,()=>f(!0)),onBlur:we(i.onBlur,()=>f(!1)),onClick:we(i.onClick,()=>{x.current!=="mouse"&&y()}),onPointerUp:we(i.onPointerUp,()=>{x.current==="mouse"&&y()}),onPointerDown:we(i.onPointerDown,b=>{x.current=b.pointerType}),onPointerMove:we(i.onPointerMove,b=>{x.current=b.pointerType,o?c.onItemLeave?.():x.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:we(i.onPointerLeave,b=>{b.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:we(i.onKeyDown,b=>{c.searchRef?.current!==""&&b.key===" "||(w_.includes(b.key)&&y(),b.key===" "&&b.preventDefault())})})})})});mh.displayName=ko;var xr="SelectItemText",gh=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=an(xr,n),a=ln(xr,n),c=ph(xr,n),u=C_(xr,n),[d,h]=v.useState(null),p=Re(t,y=>h(y),c.onItemTextChange,y=>a.itemTextRefCallback?.(y,c.value,c.disabled)),f=d?.textContent,g=v.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:f},c.value),[c.disabled,c.value,f]),{onNativeOptionAdd:m,onNativeOptionRemove:x}=u;return et(()=>(m(g),()=>x(g)),[m,x,g]),l.jsxs(l.Fragment,{children:[l.jsx(Ce.span,{id:c.textId,...s,ref:p}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Tr.createPortal(s.children,i.valueNode):null]})});gh.displayName=xr;var xh="SelectItemIndicator",yh=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return ph(xh,n).isSelected?l.jsx(Ce.span,{"aria-hidden":!0,...r,ref:t}):null});yh.displayName=xh;var ui="SelectScrollUpButton",vh=v.forwardRef((e,t)=>{const n=ln(ui,e.__scopeSelect),r=ga(ui,e.__scopeSelect),[o,s]=v.useState(!1),i=Re(t,r.onScrollButtonChange);return et(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=c.scrollTop>0;s(u)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?l.jsx(wh,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});vh.displayName=ui;var di="SelectScrollDownButton",bh=v.forwardRef((e,t)=>{const n=ln(di,e.__scopeSelect),r=ga(di,e.__scopeSelect),[o,s]=v.useState(!1),i=Re(t,r.onScrollButtonChange);return et(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;s(d)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?l.jsx(wh,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});bh.displayName=di;var wh=v.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=ln("SelectScrollButton",n),i=v.useRef(null),a=Xo(n),c=v.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),et(()=>{a().find(d=>d.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[a]),l.jsx(Ce.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:we(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:we(o.onPointerMove,()=>{s.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:we(o.onPointerLeave,()=>{c()})})}),L_="SelectSeparator",F_=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return l.jsx(Ce.div,{"aria-hidden":!0,...r,ref:t})});F_.displayName=L_;var fi="SelectArrow",$_=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Qo(n),s=an(fi,n),i=ln(fi,n);return s.open&&i.position==="popper"?l.jsx(Pf,{...o,...r,ref:t}):null});$_.displayName=fi;var B_="SelectBubbleInput",kh=v.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=v.useRef(null),s=Re(r,o),i=Ew(t);return v.useEffect(()=>{const a=o.current;if(!a)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const h=new Event("change",{bubbles:!0});d.call(a,t),a.dispatchEvent(h)}},[i,t]),l.jsx(Ce.select,{...n,style:{...Nd,...n.style},ref:s,defaultValue:t})});kh.displayName=B_;function _h(e){return e===""||e===void 0}function Sh(e){const t=st(e),n=v.useRef(""),r=v.useRef(0),o=v.useCallback(i=>{const a=n.current+i;t(a),(function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(a)},[t]),s=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function Ch(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=U_(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 U_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Z_=eh,V_=nh,W_=oh,H_=sh,q_=ih,K_=ah,G_=dh,J_=mh,Y_=gh,X_=yh,Q_=vh,eS=bh,tS="Separator",Vl="horizontal",nS=["horizontal","vertical"],jh=v.forwardRef((e,t)=>{const{decorative:n,orientation:r=Vl,...o}=e,s=rS(r)?r:Vl,a=n?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return l.jsx(Ce.div,{"data-orientation":s,...a,...o,ref:t})});jh.displayName=tS;function rS(e){return nS.includes(e)}var oS=jh,es="Tabs",[sS]=Jt(es,[Df]),Eh=Df(),[iS,xa]=sS(es),Nh=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=Fo(a),[h,p]=pn({prop:r,onChange:o,defaultProp:s??"",caller:es});return l.jsx(iS,{scope:n,baseId:Dt(),value:h,onValueChange:p,orientation:i,dir:d,activationMode:c,children:l.jsx(Ce.div,{dir:d,"data-orientation":i,...u,ref:t})})});Nh.displayName=es;var Th="TabsList",Ah=v.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=xa(Th,n),i=Eh(n);return l.jsx(o_,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:l.jsx(Ce.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});Ah.displayName=Th;var Ih="TabsTrigger",zh=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=xa(Ih,n),a=Eh(n),c=Oh(i.baseId,r),u=Dh(i.baseId,r),d=r===i.value;return l.jsx(s_,{asChild:!0,...a,focusable:!o,active:d,children:l.jsx(Ce.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...s,ref:t,onMouseDown:we(e.onMouseDown,h=>{!o&&h.button===0&&h.ctrlKey===!1?i.onValueChange(r):h.preventDefault()}),onKeyDown:we(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&i.onValueChange(r)}),onFocus:we(e.onFocus,()=>{const h=i.activationMode!=="manual";!d&&!o&&h&&i.onValueChange(r)})})})});zh.displayName=Ih;var Rh="TabsContent",Ph=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,a=xa(Rh,n),c=Oh(a.baseId,r),u=Dh(a.baseId,r),d=r===a.value,h=v.useRef(d);return v.useEffect(()=>{const p=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(p)},[]),l.jsx(kt,{present:o||d,children:({present:p})=>l.jsx(Ce.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!p,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:p&&s})})});Ph.displayName=Rh;function Oh(e,t){return`${e}-trigger-${t}`}function Dh(e,t){return`${e}-content-${t}`}var aS=Nh,lS=Ah,cS=zh,uS=Ph,[ts]=Jt("Tooltip",[Ko]),ns=Ko(),Mh="TooltipProvider",dS=700,hi="tooltip.open",[fS,ya]=ts(Mh),Lh=e=>{const{__scopeTooltip:t,delayDuration:n=dS,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=v.useRef(!0),a=v.useRef(!1),c=v.useRef(0);return v.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),l.jsx(fS,{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:a,onPointerInTransitChange:v.useCallback(u=>{a.current=u},[]),disableHoverableContent:o,children:s})};Lh.displayName=Mh;var jr="Tooltip",[hS,Pr]=ts(jr),Fh=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:i,delayDuration:a}=e,c=ya(jr,e.__scopeTooltip),u=ns(t),[d,h]=v.useState(null),p=Dt(),f=v.useRef(0),g=i??c.disableHoverableContent,m=a??c.delayDuration,x=v.useRef(!1),[y,b]=pn({prop:r,defaultProp:o??!1,onChange:N=>{N?(c.onOpen(),document.dispatchEvent(new CustomEvent(hi))):c.onClose(),s?.(N)},caller:jr}),k=v.useMemo(()=>y?x.current?"delayed-open":"instant-open":"closed",[y]),S=v.useCallback(()=>{window.clearTimeout(f.current),f.current=0,x.current=!1,b(!0)},[b]),C=v.useCallback(()=>{window.clearTimeout(f.current),f.current=0,b(!1)},[b]),j=v.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{x.current=!0,b(!0),f.current=0},m)},[m,b]);return v.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),l.jsx(If,{...u,children:l.jsx(hS,{scope:t,contentId:p,open:y,stateAttribute:k,trigger:d,onTriggerChange:h,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayedRef.current?j():S()},[c.isOpenDelayedRef,j,S]),onTriggerLeave:v.useCallback(()=>{g?C():(window.clearTimeout(f.current),f.current=0)},[C,g]),onOpen:S,onClose:C,disableHoverableContent:g,children:n})})};Fh.displayName=jr;var pi="TooltipTrigger",$h=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Pr(pi,n),s=ya(pi,n),i=ns(n),a=v.useRef(null),c=Re(t,a,o.onTriggerChange),u=v.useRef(!1),d=v.useRef(!1),h=v.useCallback(()=>u.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),l.jsx(zf,{asChild:!0,...i,children:l.jsx(Ce.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:c,onPointerMove:we(e.onPointerMove,p=>{p.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:we(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:we(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:we(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:we(e.onBlur,o.onClose),onClick:we(e.onClick,o.onClose)})})});$h.displayName=pi;var va="TooltipPortal",[pS,mS]=ts(va,{forceMount:void 0}),Bh=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=Pr(va,t);return l.jsx(pS,{scope:t,forceMount:n,children:l.jsx(kt,{present:n||s.open,children:l.jsx(Bo,{asChild:!0,container:o,children:r})})})};Bh.displayName=va;var Kn="TooltipContent",Uh=v.forwardRef((e,t)=>{const n=mS(Kn,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=Pr(Kn,e.__scopeTooltip);return l.jsx(kt,{present:r||i.open,children:i.disableHoverableContent?l.jsx(Zh,{side:o,...s,ref:t}):l.jsx(gS,{side:o,...s,ref:t})})}),gS=v.forwardRef((e,t)=>{const n=Pr(Kn,e.__scopeTooltip),r=ya(Kn,e.__scopeTooltip),o=v.useRef(null),s=Re(t,o),[i,a]=v.useState(null),{trigger:c,onClose:u}=n,d=o.current,{onPointerInTransitChange:h}=r,p=v.useCallback(()=>{a(null),h(!1)},[h]),f=v.useCallback((g,m)=>{const x=g.currentTarget,y={x:g.clientX,y:g.clientY},b=bS(y,x.getBoundingClientRect()),k=wS(y,b),S=kS(m.getBoundingClientRect()),C=SS([...k,...S]);a(C),h(!0)},[h]);return v.useEffect(()=>()=>p(),[p]),v.useEffect(()=>{if(c&&d){const g=x=>f(x,d),m=x=>f(x,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",m)}}},[c,d,f,p]),v.useEffect(()=>{if(i){const g=m=>{const x=m.target,y={x:m.clientX,y:m.clientY},b=c?.contains(x)||d?.contains(x),k=!_S(y,i);b?p():k&&(p(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,i,u,p]),l.jsx(Zh,{...e,ref:s})}),[xS,yS]=ts(jr,{isInside:!1}),vS=$b("TooltipContent"),Zh=v.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...a}=e,c=Pr(Kn,n),u=ns(n),{onClose:d}=c;return v.useEffect(()=>(document.addEventListener(hi,d),()=>document.removeEventListener(hi,d)),[d]),v.useEffect(()=>{if(c.trigger){const h=p=>{p.target?.contains(c.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,d]),l.jsx($o,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:l.jsxs(Rf,{"data-state":c.stateAttribute,...u,...a,ref:t,style:{...a.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:[l.jsx(vS,{children:r}),l.jsx(xS,{scope:n,isInside:!0,children:l.jsx(qb,{id:c.contentId,role:"tooltip",children:o||r})})]})})});Uh.displayName=Kn;var Vh="TooltipArrow",Wh=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=ns(n);return yS(Vh,n).isInside?null:l.jsx(Pf,{...o,...r,ref:t})});Wh.displayName=Vh;function bS(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 wS(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 kS(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 _S(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 a=t[s],c=t[i],u=a.x,d=a.y,h=c.x,p=c.y;d>r!=p>r&&n<(h-u)*(r-d)/(p-d)+u&&(o=!o)}return o}function SS(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),CS(t)}function CS(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 jS=Lh,ES=Fh,NS=$h,TS=Bh,AS=Uh,IS=Wh;const zS=Ji("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 xt({className:e,variant:t="default",asChild:n=!1,...r}){const o=n?Lb:"span";return l.jsx(o,{"data-slot":"badge","data-variant":t,className:he(zS({variant:t}),e),...r})}function rs({...e}){return l.jsx(bw,{"data-slot":"dialog",...e})}function RS({...e}){return l.jsx(ww,{"data-slot":"dialog-trigger",...e})}function PS({...e}){return l.jsx(kw,{"data-slot":"dialog-portal",...e})}function OS({className:e,...t}){return l.jsx(_w,{"data-slot":"dialog-overlay",className:he("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 os({className:e,children:t,...n}){return l.jsxs(PS,{children:[l.jsx(OS,{}),l.jsxs(Sw,{"data-slot":"dialog-content",className:he("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,l.jsxs(jw,{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:[l.jsx(Ki,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function ss({className:e,...t}){return l.jsx("div",{"data-slot":"dialog-header",className:he("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function is({className:e,...t}){return l.jsx(Cw,{"data-slot":"dialog-title",className:he("text-lg font-semibold leading-none tracking-tight",e),...t})}const DS=Ji("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 Xe({className:e,variant:t,size:n,...r}){return l.jsx("button",{"data-slot":"button",className:he(DS({variant:t,size:n,className:e})),...r})}function Hh({open:e,onOpenChange:t,title:n,description:r,confirmLabel:o="Confirm",variant:s="default",onConfirm:i}){return l.jsx(rs,{open:e,onOpenChange:t,children:l.jsxs(os,{children:[l.jsx(ss,{children:l.jsx(is,{children:n})}),l.jsx("p",{className:"text-sm text-muted-foreground",children:r}),l.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[l.jsx(Xe,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Cancel"}),l.jsx(Xe,{variant:s,size:"sm",onClick:()=>{i(),t(!1)},children:o})]})]})})}const MS={anthropic:"Anthropic",openai:"OpenAI",unknown:"Unknown"};function Wl(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function LS({conversationId:e,startTime:t,endTime:n,totalCalls:r,totalInputTokens:o,totalOutputTokens:s,apiFormat:i,expanded:a,onToggle:c,hideApiFormat:u=!1,isLoading:d=!1,userAgent:h,onClear:p}){const[f,g]=v.useState(!1),m=x=>{x.stopPropagation(),p!==void 0&&g(!0)};return l.jsxs("div",{role:"button",tabIndex:0,className:he("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"),onClick:c,onKeyDown:x=>{x.target===x.currentTarget&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),c())},children:[a?l.jsx(vt,{className:"size-4 text-muted-foreground shrink-0"}):d?l.jsx(Sr,{className:"size-4 animate-spin text-muted-foreground shrink-0"}):l.jsx(bt,{className:"size-4 text-muted-foreground shrink-0"}),l.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}),h!=null&&h!==""&&l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:h,children:[l.jsx(Iv,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",children:h})]}),!u&&l.jsx(xt,{variant:"outline",className:he("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:MS[i]}),l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(Ir,{className:"size-3"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[Wl(t)," - ",Wl(n)]})]}),l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(sd,{className:"size-3"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[r," call",r!==1?"s":""]})]}),l.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[l.jsx(Xn,{className:"size-3 text-muted-foreground"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[l.jsx("span",{className:"text-blue-400",children:qe(o)})," / ",l.jsx("span",{className:"text-amber-400",children:qe(s)})]})]}),l.jsx("span",{className:"flex-1 min-w-0"}),p!==void 0&&l.jsx("button",{type:"button",onClick:m,"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-6 rounded hover:bg-muted cursor-pointer",children:l.jsx(ud,{className:"size-3.5"})}),l.jsx(Hh,{open:f,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:()=>{p?.()}})]})}function FS(e){const t=e.find(n=>n.apiFormat!=="unknown");return t!==void 0?t.apiFormat:e[0]?.apiFormat??"unknown"}function $S(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 _o(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 BS(e){const t=new Map;for(const r of e){const o=_o(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,a)=>i.timestamp.localeCompare(a.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 Hl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function US(e){if(e.responseText===null)return null;try{let t=JSON.parse(e.responseText);return typeof t=="string"&&(t=JSON.parse(t)),Hl(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&&Hl(t.choices[0])&&typeof t.choices[0].finish_reason=="string"&&t.choices[0].finish_reason==="stop"?"stop":null:null}catch{return null}}function qh(e){return e==="end_turn"||e==="stop"}function St({className:e,style:t,d:n,eyeStalks:r,eyes:o,legs:s,extras:i}){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:t,className:he("inline-block size-5",e),children:[l.jsx("path",{d:n}),r,o,s,i]})}const cn=l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),l.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),l.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),l.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]}),Kh=l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"7",y1:"16",x2:"5.5",y2:"18.5"}),l.jsx("line",{x1:"9.5",y1:"17",x2:"8.5",y2:"19.5"}),l.jsx("line",{x1:"14.5",y1:"17",x2:"15.5",y2:"19.5"}),l.jsx("line",{x1:"17",y1:"16",x2:"18.5",y2:"18.5"})]});function Gh({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"})]}),legs:cn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.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 ZS({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"9.5",y1:"6.5",x2:"9.5",y2:"4.5"}),l.jsx("line",{x1:"14.5",y1:"6.5",x2:"14.5",y2:"4.5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"})]}),legs:Kh,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C4 9.5 2.5 10 3 12 C3.5 13.5 4.5 13 5 12"}),l.jsx("path",{d:"M19 11 C20 9.5 21.5 10 21 12 C20.5 13.5 19.5 13 19 12"})]})})}function VS({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"7",y1:"7",x2:"6.5",y2:"4.5"}),l.jsx("line",{x1:"17",y1:"7",x2:"17.5",y2:"4.5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"6.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"17.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:cn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M4 12 C2.5 10.5 1 11 1.5 13 C2 14.5 3.5 14 4.5 13"}),l.jsx("path",{d:"M20 12 C21.5 10.5 23 11 22.5 13 C22 14.5 20.5 14 19.5 13"})]})})}function WS({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"6.5",x2:"10",y2:"3.5"}),l.jsx("line",{x1:"14",y1:"6.5",x2:"14",y2:"3.5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"10",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"7",y1:"17",x2:"5",y2:"20.5"}),l.jsx("line",{x1:"9.5",y1:"18.5",x2:"8.5",y2:"21.5"}),l.jsx("line",{x1:"14.5",y1:"18.5",x2:"15.5",y2:"21.5"}),l.jsx("line",{x1:"17",y1:"17",x2:"19",y2:"20.5"})]}),extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M6.5 11 C5 8.5 3 9 3.5 11.5 C4 13.5 5 13 6 12"}),l.jsx("path",{d:"M17.5 11 C19 8.5 21 9 20.5 11.5 C20 13.5 19 13 18 12"})]})})}function HS({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:cn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.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 qS({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),l.jsx("line",{x1:"13.5",y1:"4",x2:"15.5",y2:"5"})]}),legs:cn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.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 KS({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"8",x2:"10",y2:"6"}),l.jsx("line",{x1:"14",y1:"8",x2:"14",y2:"6"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"9",y1:"6",x2:"11",y2:"6.5"}),l.jsx("line",{x1:"13",y1:"6",x2:"15",y2:"6.5"})]}),legs:Kh,extras:l.jsxs(l.Fragment,{children:[l.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"}),l.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 GS({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:cn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),l.jsx("line",{x1:"8.5",y1:"4",x2:"10.5",y2:"4.5"}),l.jsx("line",{x1:"15.5",y1:"4",x2:"13.5",y2:"4.5"}),l.jsx("path",{d:"M9 15.5 C10 14.5 14 14.5 15 15.5"})]})})}function JS({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"}),l.jsx("circle",{cx:"14.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"})]}),legs:cn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),l.jsx("ellipse",{cx:"12",cy:"15",rx:"2",ry:"1.5",fill:"currentColor",stroke:"none"})]})})}function YS({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"9.5",y1:"7",x2:"9",y2:"5"}),l.jsx("line",{x1:"14.5",y1:"7",x2:"15",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"15",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"})]}),legs:cn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9 2 9.5 2.5 12 C3 14 4 13 5 12"}),l.jsx("path",{d:"M19 11 C20.5 9 22 9.5 21.5 12 C21 14 20 13 19 12"}),l.jsx("path",{d:"M9 14.5 C10 16 14 16 15 14.5"}),l.jsx("circle",{cx:"7",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"}),l.jsx("circle",{cx:"17",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"})]})})}function XS({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5.5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5.5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"7.5",y1:"5.5",x2:"16.5",y2:"5.5"}),l.jsx("rect",{x:"7",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"}),l.jsx("rect",{x:"13",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"})]}),legs:cn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),l.jsx("path",{d:"M9.5 15 C10.5 16 13.5 16 14.5 15"})]})})}function QS({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10.5",y1:"9.5",x2:"10.5",y2:"8"}),l.jsx("line",{x1:"13.5",y1:"9.5",x2:"13.5",y2:"8"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"10.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"13.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"8",y1:"16",x2:"6.5",y2:"18"}),l.jsx("line",{x1:"10",y1:"17",x2:"9.5",y2:"19"}),l.jsx("line",{x1:"14",y1:"17",x2:"14.5",y2:"19"}),l.jsx("line",{x1:"16",y1:"16",x2:"17.5",y2:"18"})]}),extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M7.5 12 C6.5 11 5.5 11.5 6 13 C6.5 14 7 13.5 7.5 13"}),l.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 So=[Gh,ZS,VS,WS,HS,qS,KS,GS,JS,YS,XS,QS];function mi(e){return So[Math.abs(e)%So.length]??Gh}const eC="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",tC="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",nC="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",rC="/assets/minimax-BPMzvuL-.jpeg",oC="/assets/alibaba-TTwafVwX.svg",sC="/assets/qwen-CONDcHqt.png",iC="/assets/zhipuai-BPNAnxo-.svg",aC={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen","glm-":"zhipuai"};function Jh(e){if(e===null)return"unknown";const t=e.toLowerCase();for(const[n,r]of Object.entries(aC))if(t.startsWith(n.toLowerCase()))return r;return"unknown"}const kn={width:24,height:24,objectFit:"contain"},lC=at.memo(({className:e})=>l.jsx("img",{src:eC,alt:"Anthropic",className:e,style:kn})),cC=at.memo(({className:e})=>l.jsx("img",{src:tC,alt:"OpenAI",className:e,style:{...kn,background:"white",borderRadius:"4px"}})),uC=at.memo(({className:e})=>l.jsx("img",{src:nC,alt:"DeepSeek",className:e,style:kn})),dC=at.memo(({className:e})=>l.jsx("img",{src:rC,alt:"MiniMax",className:e,style:kn})),fC=at.memo(({className:e})=>l.jsx("img",{src:oC,alt:"Alibaba",className:e,style:kn})),hC=at.memo(({className:e})=>l.jsx("img",{src:sC,alt:"Qwen",className:e,style:kn})),pC=at.memo(({className:e})=>l.jsx("img",{src:iC,alt:"ZhipuAI",className:e,style:kn}));function Yh({provider:e,className:t}){switch(e){case"anthropic":return l.jsx(lC,{className:t});case"openai":return l.jsx(cC,{className:t});case"deepseek":return l.jsx(uC,{className:t});case"minimax":return l.jsx(dC,{className:t});case"alibaba":return l.jsx(fC,{className:t});case"qwen":return l.jsx(hC,{className:t});case"zhipuai":return l.jsx(pC,{className:t});case"unknown":return null}}const mC="x-anthropic-billing-header:";function gC(e){return e.trimStart().toLowerCase().startsWith(mC)}function xC(e){return Uu(e)?Object.prototype.hasOwnProperty.call(e,"system"):!1}function yC(e){if(!Uu(e))return!1;const t=al(e,"type"),n=al(e,"text");return typeof t!="string"||t!=="text"||typeof n!="string"?!1:gC(n)}function vC(e){let t;try{t=JSON.parse(e)}catch{return{body:e,removed:0}}if(!xC(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(yC(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 Je({delayDuration:e=0,...t}){return l.jsx(jS,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Le({...e}){return l.jsx(ES,{"data-slot":"tooltip",...e})}function Fe({...e}){return l.jsx(NS,{"data-slot":"tooltip-trigger",...e})}function $e({className:e,sideOffset:t=0,children:n,...r}){return l.jsx(TS,{children:l.jsxs(AS,{"data-slot":"tooltip-content",sideOffset:t,className:he("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,l.jsx(IS,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function bC(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const wC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,kC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_C={};function ql(e,t){return(_C.jsx?kC:wC).test(e)}const SC=/[ \t\n\f\r]/g;function CC(e){return typeof e=="object"?e.type==="text"?Kl(e.value):!1:Kl(e)}function Kl(e){return e.replace(SC,"")===""}class Or{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Or.prototype.normal={};Or.prototype.property={};Or.prototype.space=void 0;function Xh(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Or(n,r,t)}function gi(e){return e.toLowerCase()}class dt{constructor(t,n){this.attribute=n,this.property=t}}dt.prototype.attribute="";dt.prototype.booleanish=!1;dt.prototype.boolean=!1;dt.prototype.commaOrSpaceSeparated=!1;dt.prototype.commaSeparated=!1;dt.prototype.defined=!1;dt.prototype.mustUseProperty=!1;dt.prototype.number=!1;dt.prototype.overloadedBoolean=!1;dt.prototype.property="";dt.prototype.spaceSeparated=!1;dt.prototype.space=void 0;let jC=0;const je=_n(),Ge=_n(),xi=_n(),ie=_n(),De=_n(),Fn=_n(),ht=_n();function _n(){return 2**++jC}const yi=Object.freeze(Object.defineProperty({__proto__:null,boolean:je,booleanish:Ge,commaOrSpaceSeparated:ht,commaSeparated:Fn,number:ie,overloadedBoolean:xi,spaceSeparated:De},Symbol.toStringTag,{value:"Module"})),Ts=Object.keys(yi);class ba extends dt{constructor(t,n,r,o){let s=-1;if(super(t,n),Gl(this,"space",o),typeof r=="number")for(;++s<Ts.length;){const i=Ts[s];Gl(this,Ts[s],(r&yi[i])===yi[i])}}}ba.prototype.defined=!0;function Gl(e,t,n){n&&(e[t]=n)}function or(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const s=new ba(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[gi(r)]=r,n[gi(s.attribute)]=r}return new Or(t,n,e.space)}const Qh=or({properties:{ariaActiveDescendant:null,ariaAtomic:Ge,ariaAutoComplete:null,ariaBusy:Ge,ariaChecked:Ge,ariaColCount:ie,ariaColIndex:ie,ariaColSpan:ie,ariaControls:De,ariaCurrent:null,ariaDescribedBy:De,ariaDetails:null,ariaDisabled:Ge,ariaDropEffect:De,ariaErrorMessage:null,ariaExpanded:Ge,ariaFlowTo:De,ariaGrabbed:Ge,ariaHasPopup:null,ariaHidden:Ge,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:De,ariaLevel:ie,ariaLive:null,ariaModal:Ge,ariaMultiLine:Ge,ariaMultiSelectable:Ge,ariaOrientation:null,ariaOwns:De,ariaPlaceholder:null,ariaPosInSet:ie,ariaPressed:Ge,ariaReadOnly:Ge,ariaRelevant:null,ariaRequired:Ge,ariaRoleDescription:De,ariaRowCount:ie,ariaRowIndex:ie,ariaRowSpan:ie,ariaSelected:Ge,ariaSetSize:ie,ariaSort:null,ariaValueMax:ie,ariaValueMin:ie,ariaValueNow:ie,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function ep(e,t){return t in e?e[t]:t}function tp(e,t){return ep(e,t.toLowerCase())}const EC=or({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Fn,acceptCharset:De,accessKey:De,action:null,allow:null,allowFullScreen:je,allowPaymentRequest:je,allowUserMedia:je,alt:null,as:null,async:je,autoCapitalize:null,autoComplete:De,autoFocus:je,autoPlay:je,blocking:De,capture:null,charSet:null,checked:je,cite:null,className:De,cols:ie,colSpan:null,content:null,contentEditable:Ge,controls:je,controlsList:De,coords:ie|Fn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:je,defer:je,dir:null,dirName:null,disabled:je,download:xi,draggable:Ge,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:je,formTarget:null,headers:De,height:ie,hidden:xi,high:ie,href:null,hrefLang:null,htmlFor:De,httpEquiv:De,id:null,imageSizes:null,imageSrcSet:null,inert:je,inputMode:null,integrity:null,is:null,isMap:je,itemId:null,itemProp:De,itemRef:De,itemScope:je,itemType:De,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:je,low:ie,manifest:null,max:null,maxLength:ie,media:null,method:null,min:null,minLength:ie,multiple:je,muted:je,name:null,nonce:null,noModule:je,noValidate:je,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:je,optimum:ie,pattern:null,ping:De,placeholder:null,playsInline:je,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:je,referrerPolicy:null,rel:De,required:je,reversed:je,rows:ie,rowSpan:ie,sandbox:De,scope:null,scoped:je,seamless:je,selected:je,shadowRootClonable:je,shadowRootDelegatesFocus:je,shadowRootMode:null,shape:null,size:ie,sizes:null,slot:null,span:ie,spellCheck:Ge,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ie,step:null,style:null,tabIndex:ie,target:null,title:null,translate:null,type:null,typeMustMatch:je,useMap:null,value:Ge,width:ie,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:De,axis:null,background:null,bgColor:null,border:ie,borderColor:null,bottomMargin:ie,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:je,declare:je,event:null,face:null,frame:null,frameBorder:null,hSpace:ie,leftMargin:ie,link:null,longDesc:null,lowSrc:null,marginHeight:ie,marginWidth:ie,noResize:je,noHref:je,noShade:je,noWrap:je,object:null,profile:null,prompt:null,rev:null,rightMargin:ie,rules:null,scheme:null,scrolling:Ge,standby:null,summary:null,text:null,topMargin:ie,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ie,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:je,disableRemotePlayback:je,prefix:null,property:null,results:ie,security:null,unselectable:null},space:"html",transform:tp}),NC=or({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ht,accentHeight:ie,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ie,amplitude:ie,arabicForm:null,ascent:ie,attributeName:null,attributeType:null,azimuth:ie,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ie,by:null,calcMode:null,capHeight:ie,className:De,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ie,diffuseConstant:ie,direction:null,display:null,dur:null,divisor:ie,dominantBaseline:null,download:je,dx:null,dy:null,edgeMode:null,editable:null,elevation:ie,enableBackground:null,end:null,event:null,exponent:ie,externalResourcesRequired:null,fill:null,fillOpacity:ie,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Fn,g2:Fn,glyphName:Fn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ie,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ie,horizOriginX:ie,horizOriginY:ie,id:null,ideographic:ie,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ie,k:ie,k1:ie,k2:ie,k3:ie,k4:ie,kernelMatrix:ht,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ie,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ie,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ie,overlineThickness:ie,paintOrder:null,panose1:null,path:null,pathLength:ie,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:De,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ie,pointsAtY:ie,pointsAtZ:ie,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ht,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ht,rev:ht,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ht,requiredFeatures:ht,requiredFonts:ht,requiredFormats:ht,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ie,specularExponent:ie,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ie,strikethroughThickness:ie,string:null,stroke:null,strokeDashArray:ht,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ie,strokeOpacity:ie,strokeWidth:null,style:null,surfaceScale:ie,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ht,tabIndex:ie,tableValues:null,target:null,targetX:ie,targetY:ie,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ht,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ie,underlineThickness:ie,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ie,values:null,vAlphabetic:ie,vMathematical:ie,vectorEffect:null,vHanging:ie,vIdeographic:ie,version:null,vertAdvY:ie,vertOriginX:ie,vertOriginY:ie,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ie,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ep}),np=or({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),rp=or({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:tp}),op=or({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),TC={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},AC=/[A-Z]/g,Jl=/-[a-z]/g,IC=/^data[-\w.:]+$/i;function zC(e,t){const n=gi(t);let r=t,o=dt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&IC.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Jl,PC);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Jl.test(s)){let i=s.replace(AC,RC);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}o=ba}return new o(r,t)}function RC(e){return"-"+e.toLowerCase()}function PC(e){return e.charAt(1).toUpperCase()}const OC=Xh([Qh,EC,np,rp,op],"html"),wa=Xh([Qh,NC,np,rp,op],"svg");function DC(e){return e.join(" ").trim()}var Nn={},As,Yl;function MC(){if(Yl)return As;Yl=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,i=/^[;\s]*/,a=/^\s+|\s+$/g,c=`
85
- `,u="/",d="*",h="",p="comment",f="declaration";function g(x,y){if(typeof x!="string")throw new TypeError("First argument must be a string");if(!x)return[];y=y||{};var b=1,k=1;function S(w){var D=w.match(t);D&&(b+=D.length);var H=w.lastIndexOf(c);k=~H?w.length-H:k+w.length}function C(){var w={line:b,column:k};return function(D){return D.position=new j(w),A(),D}}function j(w){this.start=w,this.end={line:b,column:k},this.source=y.source}j.prototype.content=x;function N(w){var D=new Error(y.source+":"+b+":"+k+": "+w);if(D.reason=w,D.filename=y.source,D.line=b,D.column=k,D.source=x,!y.silent)throw D}function T(w){var D=w.exec(x);if(D){var H=D[0];return S(H),x=x.slice(H.length),D}}function A(){T(n)}function O(w){var D;for(w=w||[];D=L();)D!==!1&&w.push(D);return w}function L(){var w=C();if(!(u!=x.charAt(0)||d!=x.charAt(1))){for(var D=2;h!=x.charAt(D)&&(d!=x.charAt(D)||u!=x.charAt(D+1));)++D;if(D+=2,h===x.charAt(D-1))return N("End of comment missing");var H=x.slice(2,D-2);return k+=2,S(H),x=x.slice(D),k+=2,w({type:p,comment:H})}}function E(){var w=C(),D=T(r);if(D){if(L(),!T(o))return N("property missing ':'");var H=T(s),B=w({type:f,property:m(D[0].replace(e,h)),value:H?m(H[0].replace(e,h)):h});return T(i),B}}function M(){var w=[];O(w);for(var D;D=E();)D!==!1&&(w.push(D),O(w));return w}return A(),M()}function m(x){return x?x.replace(a,h):h}return As=g,As}var Xl;function LC(){if(Xl)return Nn;Xl=1;var e=Nn&&Nn.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Nn,"__esModule",{value:!0}),Nn.default=n;const t=e(MC());function n(r,o){let s=null;if(!r||typeof r!="string")return s;const i=(0,t.default)(r),a=typeof o=="function";return i.forEach(c=>{if(c.type!=="declaration")return;const{property:u,value:d}=c;a?o(u,d,c):d&&(s=s||{},s[u]=d)}),s}return Nn}var cr={},Ql;function FC(){if(Ql)return cr;Ql=1,Object.defineProperty(cr,"__esModule",{value:!0}),cr.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,s=function(u){return!u||n.test(u)||e.test(u)},i=function(u,d){return d.toUpperCase()},a=function(u,d){return"".concat(d,"-")},c=function(u,d){return d===void 0&&(d={}),s(u)?u:(u=u.toLowerCase(),d.reactCompat?u=u.replace(o,a):u=u.replace(r,a),u.replace(t,i))};return cr.camelCase=c,cr}var ur,ec;function $C(){if(ec)return ur;ec=1;var e=ur&&ur.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(LC()),n=FC();function r(o,s){var i={};return!o||typeof o!="string"||(0,t.default)(o,function(a,c){a&&c&&(i[(0,n.camelCase)(a,s)]=c)}),i}return r.default=r,ur=r,ur}var BC=$C();const UC=Ri(BC),sp=ip("end"),ka=ip("start");function ip(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function ZC(e){const t=ka(e),n=sp(e);if(t&&n)return{start:t,end:n}}function yr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?tc(e.position):"start"in e||"end"in e?tc(e):"line"in e||"column"in e?vi(e):""}function vi(e){return nc(e&&e.line)+":"+nc(e&&e.column)}function tc(e){return vi(e&&e.start)+"-"+vi(e&&e.end)}function nc(e){return e&&typeof e=="number"?e:1}class rt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",s={},i=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?o=t:!s.cause&&t&&(i=!0,o=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?s.ruleId=r:(s.source=r.slice(0,c),s.ruleId=r.slice(c+1))}if(!s.place&&s.ancestors&&s.ancestors){const c=s.ancestors[s.ancestors.length-1];c&&(s.place=c.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=a?a.line:void 0,this.name=yr(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=i&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}rt.prototype.file="";rt.prototype.name="";rt.prototype.reason="";rt.prototype.message="";rt.prototype.stack="";rt.prototype.column=void 0;rt.prototype.line=void 0;rt.prototype.ancestors=void 0;rt.prototype.cause=void 0;rt.prototype.fatal=void 0;rt.prototype.place=void 0;rt.prototype.ruleId=void 0;rt.prototype.source=void 0;const _a={}.hasOwnProperty,VC=new Map,WC=/[A-Z]/g,HC=new Set(["table","tbody","thead","tfoot","tr"]),qC=new Set(["td","th"]),ap="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function KC(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=n5(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=t5(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?wa:OC,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=lp(o,e,void 0);return s&&typeof s!="string"?s:o.create(e,o.Fragment,{children:s||void 0},void 0)}function lp(e,t,n){if(t.type==="element")return GC(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return JC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return XC(e,t,n);if(t.type==="mdxjsEsm")return YC(e,t);if(t.type==="root")return QC(e,t,n);if(t.type==="text")return e5(e,t)}function GC(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=wa,e.schema=o),e.ancestors.push(t);const s=up(e,t.tagName,!1),i=r5(e,t);let a=Ca(e,t);return HC.has(t.tagName)&&(a=a.filter(function(c){return typeof c=="string"?!CC(c):!0})),cp(e,i,s,t),Sa(i,a),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function JC(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Er(e,t.position)}function YC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Er(e,t.position)}function XC(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=wa,e.schema=o),e.ancestors.push(t);const s=t.name===null?e.Fragment:up(e,t.name,!0),i=o5(e,t),a=Ca(e,t);return cp(e,i,s,t),Sa(i,a),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function QC(e,t,n){const r={};return Sa(r,Ca(e,t)),e.create(t,e.Fragment,r,n)}function e5(e,t){return t.value}function cp(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Sa(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function t5(e,t,n){return r;function r(o,s,i,a){const u=Array.isArray(i.children)?n:t;return a?u(s,i,a):u(s,i)}}function n5(e,t){return n;function n(r,o,s,i){const a=Array.isArray(s.children),c=ka(r);return t(o,s,i,a,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function r5(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&_a.call(t.properties,o)){const s=s5(e,o,t.properties[o]);if(s){const[i,a]=s;e.tableCellAlignToStyle&&i==="align"&&typeof a=="string"&&qC.has(t.tagName)?r=a:n[i]=a}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function o5(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const i=s.expression;i.type;const a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Er(e,t.position);else{const o=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,s=e.evaluater.evaluateExpression(a.expression)}else Er(e,t.position);else s=r.value===null?!0:r.value;n[o]=s}return n}function Ca(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:VC;for(;++r<t.children.length;){const s=t.children[r];let i;if(e.passKeys){const c=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(c){const u=o.get(c)||0;i=c+"-"+u,o.set(c,u+1)}}const a=lp(e,s,i);a!==void 0&&n.push(a)}return n}function s5(e,t,n){const r=zC(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?bC(n):DC(n)),r.property==="style"){let o=typeof n=="object"?n:i5(e,String(n));return e.stylePropertyNameCase==="css"&&(o=a5(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?TC[r.property]||r.property:r.attribute,n]}}function i5(e,t){try{return UC(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,o=new rt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=ap+"#cannot-parse-style-attribute",o}}function up(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let s=-1,i;for(;++s<o.length;){const a=ql(o[s])?{type:"Identifier",name:o[s]}:{type:"Literal",value:o[s]};i=i?{type:"MemberExpression",object:i,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=i}else r=ql(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return _a.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);Er(e)}function Er(e,t){const n=new rt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=ap+"#cannot-handle-mdx-estrees-without-createevaluater",n}function a5(e){const t={};let n;for(n in e)_a.call(e,n)&&(t[l5(n)]=e[n]);return t}function l5(e){let t=e.replace(WC,c5);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function c5(e){return"-"+e.toLowerCase()}const Is={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},u5={};function d5(e,t){const n=u5,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return dp(e,r,o)}function dp(e,t,n){if(f5(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return rc(e.children,t,n)}return Array.isArray(e)?rc(e,t,n):""}function rc(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=dp(e[o],t,n);return r.join("")}function f5(e){return!!(e&&typeof e=="object")}const oc=document.createElement("i");function ja(e){const t="&"+e+";";oc.innerHTML=t;const n=oc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ft(e,t,n,r){const o=e.length;let s=0,i;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)i=Array.from(r),i.unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);s<r.length;)i=r.slice(s,s+1e4),i.unshift(t,0),e.splice(...i),s+=1e4,t+=1e4}function yt(e,t){return e.length>0?(Ft(e,e.length,0,t),e):t}const sc={}.hasOwnProperty;function h5(e){const t={};let n=-1;for(;++n<e.length;)p5(t,e[n]);return t}function p5(e,t){let n;for(n in t){const o=(sc.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let i;if(s)for(i in s){sc.call(o,i)||(o[i]=[]);const a=s[i];m5(o[i],Array.isArray(a)?a:a?[a]:[])}}}function m5(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ft(e,0,0,r)}function fp(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function $n(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Pt=un(/[A-Za-z]/),mt=un(/[\dA-Za-z]/),g5=un(/[#-'*+\--9=?A-Z^-~]/);function bi(e){return e!==null&&(e<32||e===127)}const wi=un(/\d/),x5=un(/[\dA-Fa-f]/),y5=un(/[!-/:-@[-`{-~]/);function _e(e){return e!==null&&e<-2}function ct(e){return e!==null&&(e<0||e===32)}function ze(e){return e===-2||e===-1||e===32}const v5=un(new RegExp("\\p{P}|\\p{S}","u")),b5=un(/\s/);function un(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function sr(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const s=e.charCodeAt(n);let i="";if(s===37&&mt(e.charCodeAt(n+1))&&mt(e.charCodeAt(n+2)))o=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(i=String.fromCharCode(s));else if(s>55295&&s<57344){const a=e.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(i=String.fromCharCode(s,a),o=1):i="�"}else i=String.fromCharCode(s);i&&(t.push(e.slice(r,n),encodeURIComponent(i)),r=n+o+1,i=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function Me(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let s=0;return i;function i(c){return ze(c)?(e.enter(n),a(c)):t(c)}function a(c){return ze(c)&&s++<o?(e.consume(c),a):(e.exit(n),t(c))}}const w5={tokenize:k5};function k5(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Me(e,t,"linePrefix")}function o(a){return e.enter("paragraph"),s(a)}function s(a){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,i(a)}function i(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return _e(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),i)}}const _5={tokenize:S5},ic={tokenize:C5};function S5(e){const t=this,n=[];let r=0,o,s,i;return a;function a(k){if(r<n.length){const S=n[r];return t.containerState=S[1],e.attempt(S[0].continuation,c,u)(k)}return u(k)}function c(k){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&b();const S=t.events.length;let C=S,j;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){j=t.events[C][1].end;break}y(r);let N=S;for(;N<t.events.length;)t.events[N][1].end={...j},N++;return Ft(t.events,C+1,0,t.events.slice(S)),t.events.length=N,u(k)}return a(k)}function u(k){if(r===n.length){if(!o)return p(k);if(o.currentConstruct&&o.currentConstruct.concrete)return g(k);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ic,d,h)(k)}function d(k){return o&&b(),y(r),p(k)}function h(k){return t.parser.lazy[t.now().line]=r!==n.length,i=t.now().offset,g(k)}function p(k){return t.containerState={},e.attempt(ic,f,g)(k)}function f(k){return r++,n.push([t.currentConstruct,t.containerState]),p(k)}function g(k){if(k===null){o&&b(),y(0),e.consume(k);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:s}),m(k)}function m(k){if(k===null){x(e.exit("chunkFlow"),!0),y(0),e.consume(k);return}return _e(k)?(e.consume(k),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(k),m)}function x(k,S){const C=t.sliceStream(k);if(S&&C.push(null),k.previous=s,s&&(s.next=k),s=k,o.defineSkip(k.start),o.write(C),t.parser.lazy[k.start.line]){let j=o.events.length;for(;j--;)if(o.events[j][1].start.offset<i&&(!o.events[j][1].end||o.events[j][1].end.offset>i))return;const N=t.events.length;let T=N,A,O;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(A){O=t.events[T][1].end;break}A=!0}for(y(r),j=N;j<t.events.length;)t.events[j][1].end={...O},j++;Ft(t.events,T+1,0,t.events.slice(N)),t.events.length=j}}function y(k){let S=n.length;for(;S-- >k;){const C=n[S];t.containerState=C[1],C[0].exit.call(t,e)}n.length=k}function b(){o.write([null]),s=void 0,o=void 0,t.containerState._closeFlow=void 0}}function C5(e,t,n){return Me(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ac(e){if(e===null||ct(e)||b5(e))return 1;if(v5(e))return 2}function Ea(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const s=e[o].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const ki={name:"attention",resolveAll:j5,tokenize:E5};function j5(e,t){let n=-1,r,o,s,i,a,c,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[r][1].end},p={...e[n][1].start};lc(h,-c),lc(p,c),i={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},a={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},s={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:c>1?"strong":"emphasis",start:{...i.start},end:{...a.end}},e[r][1].end={...i.start},e[n][1].start={...a.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=yt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=yt(u,[["enter",o,t],["enter",i,t],["exit",i,t],["enter",s,t]]),u=yt(u,Ea(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=yt(u,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=yt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Ft(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function E5(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=ac(r);let s;return i;function i(c){return s=c,e.enter("attentionSequence"),a(c)}function a(c){if(c===s)return e.consume(c),a;const u=e.exit("attentionSequence"),d=ac(c),h=!d||d===2&&o||n.includes(c),p=!o||o===2&&d||n.includes(r);return u._open=!!(s===42?h:h&&(o||!p)),u._close=!!(s===42?p:p&&(d||!h)),t(c)}}function lc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const N5={name:"autolink",tokenize:T5};function T5(e,t,n){let r=0;return o;function o(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(f){return Pt(f)?(e.consume(f),i):f===64?n(f):u(f)}function i(f){return f===43||f===45||f===46||mt(f)?(r=1,a(f)):u(f)}function a(f){return f===58?(e.consume(f),r=0,c):(f===43||f===45||f===46||mt(f))&&r++<32?(e.consume(f),a):(r=0,u(f))}function c(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||bi(f)?n(f):(e.consume(f),c)}function u(f){return f===64?(e.consume(f),d):g5(f)?(e.consume(f),u):n(f)}function d(f){return mt(f)?h(f):n(f)}function h(f){return f===46?(e.consume(f),r=0,d):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):p(f)}function p(f){if((f===45||mt(f))&&r++<63){const g=f===45?p:h;return e.consume(f),g}return n(f)}}const as={partial:!0,tokenize:A5};function A5(e,t,n){return r;function r(s){return ze(s)?Me(e,o,"linePrefix")(s):o(s)}function o(s){return s===null||_e(s)?t(s):n(s)}}const hp={continuation:{tokenize:z5},exit:R5,name:"blockQuote",tokenize:I5};function I5(e,t,n){const r=this;return o;function o(i){if(i===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(i),e.exit("blockQuoteMarker"),s}return n(i)}function s(i){return ze(i)?(e.enter("blockQuotePrefixWhitespace"),e.consume(i),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(i))}}function z5(e,t,n){const r=this;return o;function o(i){return ze(i)?Me(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):s(i)}function s(i){return e.attempt(hp,t,n)(i)}}function R5(e){e.exit("blockQuote")}const pp={name:"characterEscape",tokenize:P5};function P5(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),o}function o(s){return y5(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const mp={name:"characterReference",tokenize:O5};function O5(e,t,n){const r=this;let o=0,s,i;return a;function a(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),c}function c(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),s=31,i=mt,d(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,i=x5,d):(e.enter("characterReferenceValue"),s=7,i=wi,d(h))}function d(h){if(h===59&&o){const p=e.exit("characterReferenceValue");return i===mt&&!ja(r.sliceSerialize(p))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return i(h)&&o++<s?(e.consume(h),d):n(h)}}const cc={partial:!0,tokenize:M5},uc={concrete:!0,name:"codeFenced",tokenize:D5};function D5(e,t,n){const r=this,o={partial:!0,tokenize:C};let s=0,i=0,a;return c;function c(j){return u(j)}function u(j){const N=r.events[r.events.length-1];return s=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,a=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(j)}function d(j){return j===a?(i++,e.consume(j),d):i<3?n(j):(e.exit("codeFencedFenceSequence"),ze(j)?Me(e,h,"whitespace")(j):h(j))}function h(j){return j===null||_e(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(cc,m,S)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(j))}function p(j){return j===null||_e(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(j)):ze(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Me(e,f,"whitespace")(j)):j===96&&j===a?n(j):(e.consume(j),p)}function f(j){return j===null||_e(j)?h(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(j))}function g(j){return j===null||_e(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(j)):j===96&&j===a?n(j):(e.consume(j),g)}function m(j){return e.attempt(o,S,x)(j)}function x(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),y}function y(j){return s>0&&ze(j)?Me(e,b,"linePrefix",s+1)(j):b(j)}function b(j){return j===null||_e(j)?e.check(cc,m,S)(j):(e.enter("codeFlowValue"),k(j))}function k(j){return j===null||_e(j)?(e.exit("codeFlowValue"),b(j)):(e.consume(j),k)}function S(j){return e.exit("codeFenced"),t(j)}function C(j,N,T){let A=0;return O;function O(D){return j.enter("lineEnding"),j.consume(D),j.exit("lineEnding"),L}function L(D){return j.enter("codeFencedFence"),ze(D)?Me(j,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):E(D)}function E(D){return D===a?(j.enter("codeFencedFenceSequence"),M(D)):T(D)}function M(D){return D===a?(A++,j.consume(D),M):A>=i?(j.exit("codeFencedFenceSequence"),ze(D)?Me(j,w,"whitespace")(D):w(D)):T(D)}function w(D){return D===null||_e(D)?(j.exit("codeFencedFence"),N(D)):T(D)}}}function M5(e,t,n){const r=this;return o;function o(i){return i===null?n(i):(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s)}function s(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}const zs={name:"codeIndented",tokenize:F5},L5={partial:!0,tokenize:$5};function F5(e,t,n){const r=this;return o;function o(u){return e.enter("codeIndented"),Me(e,s,"linePrefix",5)(u)}function s(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?i(u):n(u)}function i(u){return u===null?c(u):_e(u)?e.attempt(L5,i,c)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||_e(u)?(e.exit("codeFlowValue"),i(u)):(e.consume(u),a)}function c(u){return e.exit("codeIndented"),t(u)}}function $5(e,t,n){const r=this;return o;function o(i){return r.parser.lazy[r.now().line]?n(i):_e(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),o):Me(e,s,"linePrefix",5)(i)}function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):_e(i)?o(i):n(i)}}const B5={name:"codeText",previous:Z5,resolve:U5,tokenize:V5};function U5(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function Z5(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function V5(e,t,n){let r=0,o,s;return i;function i(h){return e.enter("codeText"),e.enter("codeTextSequence"),a(h)}function a(h){return h===96?(e.consume(h),r++,a):(e.exit("codeTextSequence"),c(h))}function c(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),c):h===96?(s=e.enter("codeTextSequence"),o=0,d(h)):_e(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||_e(h)?(e.exit("codeTextData"),c(h)):(e.consume(h),u)}function d(h){return h===96?(e.consume(h),o++,d):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(s.type="codeTextData",u(h))}}class W5{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const o=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&dr(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),dr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),dr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);dr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);dr(this.left,n.reverse())}}}function dr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function gp(e){const t={};let n=-1,r,o,s,i,a,c,u;const d=new W5(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,s=0,s<c.length&&c[s][1].type==="lineEndingBlank"&&(s+=2),s<c.length&&c[s][1].type==="content"))for(;++s<c.length&&c[s][1].type!=="content";)c[s][1].type==="chunkText"&&(c[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,H5(d,n)),n=t[n],u=!0);else if(r[1]._container){for(s=n,o=void 0;s--;)if(i=d.get(s),i[1].type==="lineEnding"||i[1].type==="lineEndingBlank")i[0]==="enter"&&(o&&(d.get(o)[1].type="lineEndingBlank"),i[1].type="lineEnding",o=s);else if(!(i[1].type==="linePrefix"||i[1].type==="listItemIndent"))break;o&&(r[1].end={...d.get(o)[1].start},a=d.slice(o,n),a.unshift(r),d.splice(o,n-o+1,a))}}return Ft(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function H5(e,t){const n=e.get(t)[1],r=e.get(t)[2];let o=t-1;const s=[];let i=n._tokenizer;i||(i=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(i._contentTypeTextTrailing=!0));const a=i.events,c=[],u={};let d,h,p=-1,f=n,g=0,m=0;const x=[m];for(;f;){for(;e.get(++o)[1]!==f;);s.push(o),f._tokenizer||(d=r.sliceStream(f),f.next||d.push(null),h&&i.defineSkip(f.start),f._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(d),f._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),h=f,f=f.next}for(f=n;++p<a.length;)a[p][0]==="exit"&&a[p-1][0]==="enter"&&a[p][1].type===a[p-1][1].type&&a[p][1].start.line!==a[p][1].end.line&&(m=p+1,x.push(m),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(i.events=[],f?(f._tokenizer=void 0,f.previous=void 0):x.pop(),p=x.length;p--;){const y=a.slice(x[p],x[p+1]),b=s.pop();c.push([b,b+y.length-1]),e.splice(b,2,y)}for(c.reverse(),p=-1;++p<c.length;)u[g+c[p][0]]=g+c[p][1],g+=c[p][1]-c[p][0]-1;return u}const q5={resolve:G5,tokenize:J5},K5={partial:!0,tokenize:Y5};function G5(e){return gp(e),e}function J5(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(a)}function o(a){return a===null?s(a):_e(a)?e.check(K5,i,s)(a):(e.consume(a),o)}function s(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function i(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function Y5(e,t,n){const r=this;return o;function o(i){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),Me(e,s,"linePrefix")}function s(i){if(i===null||_e(i))return n(i);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function xp(e,t,n,r,o,s,i,a,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return h;function h(y){return y===60?(e.enter(r),e.enter(o),e.enter(s),e.consume(y),e.exit(s),p):y===null||y===32||y===41||bi(y)?n(y):(e.enter(r),e.enter(i),e.enter(a),e.enter("chunkString",{contentType:"string"}),m(y))}function p(y){return y===62?(e.enter(s),e.consume(y),e.exit(s),e.exit(o),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),f(y))}function f(y){return y===62?(e.exit("chunkString"),e.exit(a),p(y)):y===null||y===60||_e(y)?n(y):(e.consume(y),y===92?g:f)}function g(y){return y===60||y===62||y===92?(e.consume(y),f):f(y)}function m(y){return!d&&(y===null||y===41||ct(y))?(e.exit("chunkString"),e.exit(a),e.exit(i),e.exit(r),t(y)):d<u&&y===40?(e.consume(y),d++,m):y===41?(e.consume(y),d--,m):y===null||y===32||y===40||bi(y)?n(y):(e.consume(y),y===92?x:m)}function x(y){return y===40||y===41||y===92?(e.consume(y),m):m(y)}}function yp(e,t,n,r,o,s){const i=this;let a=0,c;return u;function u(f){return e.enter(r),e.enter(o),e.consume(f),e.exit(o),e.enter(s),d}function d(f){return a>999||f===null||f===91||f===93&&!c||f===94&&!a&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):f===93?(e.exit(s),e.enter(o),e.consume(f),e.exit(o),e.exit(r),t):_e(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(f))}function h(f){return f===null||f===91||f===93||_e(f)||a++>999?(e.exit("chunkString"),d(f)):(e.consume(f),c||(c=!ze(f)),f===92?p:h)}function p(f){return f===91||f===92||f===93?(e.consume(f),a++,h):h(f)}}function vp(e,t,n,r,o,s){let i;return a;function a(p){return p===34||p===39||p===40?(e.enter(r),e.enter(o),e.consume(p),e.exit(o),i=p===40?41:p,c):n(p)}function c(p){return p===i?(e.enter(o),e.consume(p),e.exit(o),e.exit(r),t):(e.enter(s),u(p))}function u(p){return p===i?(e.exit(s),c(i)):p===null?n(p):_e(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Me(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===i||p===null||_e(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?h:d)}function h(p){return p===i||p===92?(e.consume(p),d):d(p)}}function vr(e,t){let n;return r;function r(o){return _e(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):ze(o)?Me(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const X5={name:"definition",tokenize:ej},Q5={partial:!0,tokenize:tj};function ej(e,t,n){const r=this;let o;return s;function s(f){return e.enter("definition"),i(f)}function i(f){return yp.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return o=$n(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),c):n(f)}function c(f){return ct(f)?vr(e,u)(f):u(f)}function u(f){return xp(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function d(f){return e.attempt(Q5,h,h)(f)}function h(f){return ze(f)?Me(e,p,"whitespace")(f):p(f)}function p(f){return f===null||_e(f)?(e.exit("definition"),r.parser.defined.push(o),t(f)):n(f)}}function tj(e,t,n){return r;function r(a){return ct(a)?vr(e,o)(a):n(a)}function o(a){return vp(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return ze(a)?Me(e,i,"whitespace")(a):i(a)}function i(a){return a===null||_e(a)?t(a):n(a)}}const nj={name:"hardBreakEscape",tokenize:rj};function rj(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),o}function o(s){return _e(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const oj={name:"headingAtx",resolve:sj,tokenize:ij};function sj(e,t){let n=e.length-2,r=3,o,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ft(e,r,n-r+1,[["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t]])),e}function ij(e,t,n){let r=0;return o;function o(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),i(d)}function i(d){return d===35&&r++<6?(e.consume(d),i):d===null||ct(d)?(e.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||_e(d)?(e.exit("atxHeading"),t(d)):ze(d)?Me(e,a,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),a(d))}function u(d){return d===null||d===35||ct(d)?(e.exit("atxHeadingText"),a(d)):(e.consume(d),u)}}const aj=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],dc=["pre","script","style","textarea"],lj={concrete:!0,name:"htmlFlow",resolveTo:dj,tokenize:fj},cj={partial:!0,tokenize:pj},uj={partial:!0,tokenize:hj};function dj(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function fj(e,t,n){const r=this;let o,s,i,a,c;return u;function u(z){return d(z)}function d(z){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(z),h}function h(z){return z===33?(e.consume(z),p):z===47?(e.consume(z),s=!0,m):z===63?(e.consume(z),o=3,r.interrupt?t:I):Pt(z)?(e.consume(z),i=String.fromCharCode(z),x):n(z)}function p(z){return z===45?(e.consume(z),o=2,f):z===91?(e.consume(z),o=5,a=0,g):Pt(z)?(e.consume(z),o=4,r.interrupt?t:I):n(z)}function f(z){return z===45?(e.consume(z),r.interrupt?t:I):n(z)}function g(z){const oe="CDATA[";return z===oe.charCodeAt(a++)?(e.consume(z),a===oe.length?r.interrupt?t:E:g):n(z)}function m(z){return Pt(z)?(e.consume(z),i=String.fromCharCode(z),x):n(z)}function x(z){if(z===null||z===47||z===62||ct(z)){const oe=z===47,X=i.toLowerCase();return!oe&&!s&&dc.includes(X)?(o=1,r.interrupt?t(z):E(z)):aj.includes(i.toLowerCase())?(o=6,oe?(e.consume(z),y):r.interrupt?t(z):E(z)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(z):s?b(z):k(z))}return z===45||mt(z)?(e.consume(z),i+=String.fromCharCode(z),x):n(z)}function y(z){return z===62?(e.consume(z),r.interrupt?t:E):n(z)}function b(z){return ze(z)?(e.consume(z),b):O(z)}function k(z){return z===47?(e.consume(z),O):z===58||z===95||Pt(z)?(e.consume(z),S):ze(z)?(e.consume(z),k):O(z)}function S(z){return z===45||z===46||z===58||z===95||mt(z)?(e.consume(z),S):C(z)}function C(z){return z===61?(e.consume(z),j):ze(z)?(e.consume(z),C):k(z)}function j(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(e.consume(z),c=z,N):ze(z)?(e.consume(z),j):T(z)}function N(z){return z===c?(e.consume(z),c=null,A):z===null||_e(z)?n(z):(e.consume(z),N)}function T(z){return z===null||z===34||z===39||z===47||z===60||z===61||z===62||z===96||ct(z)?C(z):(e.consume(z),T)}function A(z){return z===47||z===62||ze(z)?k(z):n(z)}function O(z){return z===62?(e.consume(z),L):n(z)}function L(z){return z===null||_e(z)?E(z):ze(z)?(e.consume(z),L):n(z)}function E(z){return z===45&&o===2?(e.consume(z),H):z===60&&o===1?(e.consume(z),B):z===62&&o===4?(e.consume(z),W):z===63&&o===3?(e.consume(z),I):z===93&&o===5?(e.consume(z),Y):_e(z)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(cj,V,M)(z)):z===null||_e(z)?(e.exit("htmlFlowData"),M(z)):(e.consume(z),E)}function M(z){return e.check(uj,w,V)(z)}function w(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),D}function D(z){return z===null||_e(z)?M(z):(e.enter("htmlFlowData"),E(z))}function H(z){return z===45?(e.consume(z),I):E(z)}function B(z){return z===47?(e.consume(z),i="",q):E(z)}function q(z){if(z===62){const oe=i.toLowerCase();return dc.includes(oe)?(e.consume(z),W):E(z)}return Pt(z)&&i.length<8?(e.consume(z),i+=String.fromCharCode(z),q):E(z)}function Y(z){return z===93?(e.consume(z),I):E(z)}function I(z){return z===62?(e.consume(z),W):z===45&&o===2?(e.consume(z),I):E(z)}function W(z){return z===null||_e(z)?(e.exit("htmlFlowData"),V(z)):(e.consume(z),W)}function V(z){return e.exit("htmlFlow"),t(z)}}function hj(e,t,n){const r=this;return o;function o(i){return _e(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s):n(i)}function s(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}function pj(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(as,t,n)}}const mj={name:"htmlText",tokenize:gj};function gj(e,t,n){const r=this;let o,s,i;return a;function a(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),c}function c(I){return I===33?(e.consume(I),u):I===47?(e.consume(I),C):I===63?(e.consume(I),k):Pt(I)?(e.consume(I),T):n(I)}function u(I){return I===45?(e.consume(I),d):I===91?(e.consume(I),s=0,g):Pt(I)?(e.consume(I),b):n(I)}function d(I){return I===45?(e.consume(I),f):n(I)}function h(I){return I===null?n(I):I===45?(e.consume(I),p):_e(I)?(i=h,B(I)):(e.consume(I),h)}function p(I){return I===45?(e.consume(I),f):h(I)}function f(I){return I===62?H(I):I===45?p(I):h(I)}function g(I){const W="CDATA[";return I===W.charCodeAt(s++)?(e.consume(I),s===W.length?m:g):n(I)}function m(I){return I===null?n(I):I===93?(e.consume(I),x):_e(I)?(i=m,B(I)):(e.consume(I),m)}function x(I){return I===93?(e.consume(I),y):m(I)}function y(I){return I===62?H(I):I===93?(e.consume(I),y):m(I)}function b(I){return I===null||I===62?H(I):_e(I)?(i=b,B(I)):(e.consume(I),b)}function k(I){return I===null?n(I):I===63?(e.consume(I),S):_e(I)?(i=k,B(I)):(e.consume(I),k)}function S(I){return I===62?H(I):k(I)}function C(I){return Pt(I)?(e.consume(I),j):n(I)}function j(I){return I===45||mt(I)?(e.consume(I),j):N(I)}function N(I){return _e(I)?(i=N,B(I)):ze(I)?(e.consume(I),N):H(I)}function T(I){return I===45||mt(I)?(e.consume(I),T):I===47||I===62||ct(I)?A(I):n(I)}function A(I){return I===47?(e.consume(I),H):I===58||I===95||Pt(I)?(e.consume(I),O):_e(I)?(i=A,B(I)):ze(I)?(e.consume(I),A):H(I)}function O(I){return I===45||I===46||I===58||I===95||mt(I)?(e.consume(I),O):L(I)}function L(I){return I===61?(e.consume(I),E):_e(I)?(i=L,B(I)):ze(I)?(e.consume(I),L):A(I)}function E(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),o=I,M):_e(I)?(i=E,B(I)):ze(I)?(e.consume(I),E):(e.consume(I),w)}function M(I){return I===o?(e.consume(I),o=void 0,D):I===null?n(I):_e(I)?(i=M,B(I)):(e.consume(I),M)}function w(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||ct(I)?A(I):(e.consume(I),w)}function D(I){return I===47||I===62||ct(I)?A(I):n(I)}function H(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function B(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),q}function q(I){return ze(I)?Me(e,Y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):Y(I)}function Y(I){return e.enter("htmlTextData"),i(I)}}const Na={name:"labelEnd",resolveAll:bj,resolveTo:wj,tokenize:kj},xj={tokenize:_j},yj={tokenize:Sj},vj={tokenize:Cj};function bj(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==n.length&&Ft(e,0,e.length,n),e}function wj(e,t){let n=e.length,r=0,o,s,i,a;for(;n--;)if(o=e[n][1],s){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(i){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(s=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(i=n);const c={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[s][1].start},end:{...e[i][1].end}},d={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[i-2][1].start}};return a=[["enter",c,t],["enter",u,t]],a=yt(a,e.slice(s+1,s+r+3)),a=yt(a,[["enter",d,t]]),a=yt(a,Ea(t.parser.constructs.insideSpan.null,e.slice(s+r+4,i-3),t)),a=yt(a,[["exit",d,t],e[i-2],e[i-1],["exit",u,t]]),a=yt(a,e.slice(i+1)),a=yt(a,[["exit",c,t]]),Ft(e,s,e.length,a),e}function kj(e,t,n){const r=this;let o=r.events.length,s,i;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){s=r.events[o][1];break}return a;function a(p){return s?s._inactive?h(p):(i=r.parser.defined.includes($n(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),c):n(p)}function c(p){return p===40?e.attempt(xj,d,i?d:h)(p):p===91?e.attempt(yj,d,i?u:h)(p):i?d(p):h(p)}function u(p){return e.attempt(vj,d,h)(p)}function d(p){return t(p)}function h(p){return s._balanced=!0,n(p)}}function _j(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),o}function o(h){return ct(h)?vr(e,s)(h):s(h)}function s(h){return h===41?d(h):xp(e,i,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function i(h){return ct(h)?vr(e,c)(h):d(h)}function a(h){return n(h)}function c(h){return h===34||h===39||h===40?vp(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return ct(h)?vr(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function Sj(e,t,n){const r=this;return o;function o(a){return yp.call(r,e,s,i,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes($n(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function i(a){return n(a)}}function Cj(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),o}function o(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const jj={name:"labelStartImage",resolveAll:Na.resolveAll,tokenize:Ej};function Ej(e,t,n){const r=this;return o;function o(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),s}function s(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),i):n(a)}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Nj={name:"labelStartLink",resolveAll:Na.resolveAll,tokenize:Tj};function Tj(e,t,n){const r=this;return o;function o(i){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(i),e.exit("labelMarker"),e.exit("labelLink"),s}function s(i){return i===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(i):t(i)}}const Rs={name:"lineEnding",tokenize:Aj};function Aj(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Me(e,t,"linePrefix")}}const io={name:"thematicBreak",tokenize:Ij};function Ij(e,t,n){let r=0,o;return s;function s(u){return e.enter("thematicBreak"),i(u)}function i(u){return o=u,a(u)}function a(u){return u===o?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||_e(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===o?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),ze(u)?Me(e,a,"whitespace")(u):a(u))}}const it={continuation:{tokenize:Oj},exit:Mj,name:"list",tokenize:Pj},zj={partial:!0,tokenize:Lj},Rj={partial:!0,tokenize:Dj};function Pj(e,t,n){const r=this,o=r.events[r.events.length-1];let s=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,i=0;return a;function a(f){const g=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:wi(f)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(io,n,u)(f):u(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(f)}return n(f)}function c(f){return wi(f)&&++i<10?(e.consume(f),c):(!r.interrupt||i<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),u(f)):n(f)}function u(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(as,r.interrupt?n:d,e.attempt(zj,p,h))}function d(f){return r.containerState.initialBlankLine=!0,s++,p(f)}function h(f){return ze(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),p):n(f)}function p(f){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function Oj(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(as,o,s);function o(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Me(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!ze(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Rj,t,i)(a))}function i(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Me(e,e.attempt(it,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Dj(e,t,n){const r=this;return Me(e,o,"listItemIndent",r.containerState.size+1);function o(s){const i=r.events[r.events.length-1];return i&&i[1].type==="listItemIndent"&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(s):n(s)}}function Mj(e){e.exit(this.containerState.type)}function Lj(e,t,n){const r=this;return Me(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(s){const i=r.events[r.events.length-1];return!ze(s)&&i&&i[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const fc={name:"setextUnderline",resolveTo:Fj,tokenize:$j};function Fj(e,t){let n=e.length,r,o,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const i={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",s?(e.splice(o,0,["enter",i,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=i,e.push(["exit",i,t]),e}function $j(e,t,n){const r=this;let o;return s;function s(u){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),o=u,i(u)):n(u)}function i(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===o?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),ze(u)?Me(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||_e(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const Bj={tokenize:Uj};function Uj(e){const t=this,n=e.attempt(as,r,e.attempt(this.parser.constructs.flowInitial,o,Me(e,e.attempt(this.parser.constructs.flow,o,e.attempt(q5,o)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Zj={resolveAll:wp()},Vj=bp("string"),Wj=bp("text");function bp(e){return{resolveAll:wp(e==="text"?Hj:void 0),tokenize:t};function t(n){const r=this,o=this.parser.constructs[e],s=n.attempt(o,i,a);return i;function i(d){return u(d)?s(d):a(d)}function a(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),s(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const h=o[d];let p=-1;if(h)for(;++p<h.length;){const f=h[p];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function wp(e){return t;function t(n,r){let o=-1,s;for(;++o<=n.length;)s===void 0?n[o]&&n[o][1].type==="data"&&(s=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==s+2&&(n[s][1].end=n[o-1][1].end,n.splice(s+2,o-s-2),o=s+2),s=void 0);return e?e(n,r):n}}function Hj(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],o=t.sliceStream(r);let s=o.length,i=-1,a=0,c;for(;s--;){const u=o[s];if(typeof u=="string"){for(i=u.length;u.charCodeAt(i-1)===32;)a++,i--;if(i)break;i=-1}else if(u===-2)c=!0,a++;else if(u!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const u={type:n===e.length||c||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?i:r.start._bufferIndex+i,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const qj={42:it,43:it,45:it,48:it,49:it,50:it,51:it,52:it,53:it,54:it,55:it,56:it,57:it,62:hp},Kj={91:X5},Gj={[-2]:zs,[-1]:zs,32:zs},Jj={35:oj,42:io,45:[fc,io],60:lj,61:fc,95:io,96:uc,126:uc},Yj={38:mp,92:pp},Xj={[-5]:Rs,[-4]:Rs,[-3]:Rs,33:jj,38:mp,42:ki,60:[N5,mj],91:Nj,92:[nj,pp],93:Na,95:ki,96:B5},Qj={null:[ki,Zj]},eE={null:[42,95]},tE={null:[]},nE=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:eE,contentInitial:Kj,disable:tE,document:qj,flow:Jj,flowInitial:Gj,insideSpan:Qj,string:Yj,text:Xj},Symbol.toStringTag,{value:"Module"}));function rE(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},s=[];let i=[],a=[];const c={attempt:N(C),check:N(j),consume:b,enter:k,exit:S,interrupt:N(j,{interrupt:!0})},u={code:null,containerState:{},defineSkip:m,events:[],now:g,parser:e,previous:null,sliceSerialize:p,sliceStream:f,write:h};let d=t.tokenize.call(u,c);return t.resolveAll&&s.push(t),u;function h(L){return i=yt(i,L),x(),i[i.length-1]!==null?[]:(T(t,0),u.events=Ea(s,u.events,u),u.events)}function p(L,E){return sE(f(L),E)}function f(L){return oE(i,L)}function g(){const{_bufferIndex:L,_index:E,line:M,column:w,offset:D}=r;return{_bufferIndex:L,_index:E,line:M,column:w,offset:D}}function m(L){o[L.line]=L.column,O()}function x(){let L;for(;r._index<i.length;){const E=i[r._index];if(typeof E=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<E.length;)y(E.charCodeAt(r._bufferIndex));else y(E)}}function y(L){d=d(L)}function b(L){_e(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,O()):L!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===i[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=L}function k(L,E){const M=E||{};return M.type=L,M.start=g(),u.events.push(["enter",M,u]),a.push(M),M}function S(L){const E=a.pop();return E.end=g(),u.events.push(["exit",E,u]),E}function C(L,E){T(L,E.from)}function j(L,E){E.restore()}function N(L,E){return M;function M(w,D,H){let B,q,Y,I;return Array.isArray(w)?V(w):"tokenize"in w?V([w]):W(w);function W(de){return te;function te(ce){const fe=ce!==null&&de[ce],ge=ce!==null&&de.null,xe=[...Array.isArray(fe)?fe:fe?[fe]:[],...Array.isArray(ge)?ge:ge?[ge]:[]];return V(xe)(ce)}}function V(de){return B=de,q=0,de.length===0?H:z(de[q])}function z(de){return te;function te(ce){return I=A(),Y=de,de.partial||(u.currentConstruct=de),de.name&&u.parser.constructs.disable.null.includes(de.name)?X():de.tokenize.call(E?Object.assign(Object.create(u),E):u,c,oe,X)(ce)}}function oe(de){return L(Y,I),D}function X(de){return I.restore(),++q<B.length?z(B[q]):H}}}function T(L,E){L.resolveAll&&!s.includes(L)&&s.push(L),L.resolve&&Ft(u.events,E,u.events.length-E,L.resolve(u.events.slice(E),u)),L.resolveTo&&(u.events=L.resolveTo(u.events,u))}function A(){const L=g(),E=u.previous,M=u.currentConstruct,w=u.events.length,D=Array.from(a);return{from:w,restore:H};function H(){r=L,u.previous=E,u.currentConstruct=M,u.events.length=w,a=D,O()}}function O(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function oE(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,s=t.end._bufferIndex;let i;if(n===o)i=[e[n].slice(r,s)];else{if(i=e.slice(n,o),r>-1){const a=i[0];typeof a=="string"?i[0]=a.slice(r):i.shift()}s>0&&i.push(e[o].slice(0,s))}return i}function sE(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const s=e[n];let i;if(typeof s=="string")i=s;else switch(s){case-5:{i="\r";break}case-4:{i=`
84
+ 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},ww="DialogDescriptionWarning",kw=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ff(ww).contentName}}.`;return v.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},_w=Xd,Sw=ef,Cw=nf,jw=rf,Ew=of,Nw=af,Tw=uf;function Aw(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 Iw(e){const[t,n]=v.useState(void 0);return et(()=>{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,a;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;i=u.inlineSize,a=u.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const zw=["top","right","bottom","left"],nn=Math.min,pt=Math.max,xo=Math.round,Yr=Math.floor,Mt=e=>({x:e,y:e}),Pw={left:"right",right:"left",bottom:"top",top:"bottom"},Rw={start:"end",end:"start"};function ri(e,t,n){return pt(e,nn(t,n))}function Wt(e,t){return typeof e=="function"?e(t):e}function qt(e){return e.split("-")[0]}function er(e){return e.split("-")[1]}function ia(e){return e==="x"?"y":"x"}function aa(e){return e==="y"?"height":"width"}const Ow=new Set(["top","bottom"]);function Ot(e){return Ow.has(qt(e))?"y":"x"}function la(e){return ia(Ot(e))}function Dw(e,t,n){n===void 0&&(n=!1);const r=er(e),o=la(e),s=aa(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=yo(i)),[i,yo(i)]}function Mw(e){const t=yo(e);return[oi(e),t,oi(t)]}function oi(e){return e.replace(/start|end/g,t=>Rw[t])}const Pl=["left","right"],Rl=["right","left"],Lw=["top","bottom"],Fw=["bottom","top"];function $w(e,t,n){switch(e){case"top":case"bottom":return n?t?Rl:Pl:t?Pl:Rl;case"left":case"right":return t?Lw:Fw;default:return[]}}function Bw(e,t,n,r){const o=er(e);let s=$w(qt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(oi)))),s}function yo(e){return e.replace(/left|right|bottom|top/g,t=>Pw[t])}function Uw(e){return{top:0,right:0,bottom:0,left:0,...e}}function hf(e){return typeof e!="number"?Uw(e):{top:e,right:e,bottom:e,left:e}}function vo(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 Ol(e,t,n){let{reference:r,floating:o}=e;const s=Ot(t),i=la(t),a=aa(i),c=qt(t),u=s==="y",d=r.x+r.width/2-o.width/2,h=r.y+r.height/2-o.height/2,p=r[a]/2-o[a]/2;let f;switch(c){case"top":f={x:d,y:r.y-o.height};break;case"bottom":f={x:d,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:h};break;case"left":f={x:r.x-o.width,y:h};break;default:f={x:r.x,y:r.y}}switch(er(t)){case"start":f[i]-=p*(n&&u?-1:1);break;case"end":f[i]+=p*(n&&u?-1:1);break}return f}async function Zw(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:p=!1,padding:f=0}=Wt(t,e),g=hf(f),x=a[p?h==="floating"?"reference":"floating":h],y=vo(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(a.floating)),boundary:u,rootBoundary:d,strategy:c})),b=h==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.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=vo(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:k,strategy:c}):b);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 Vw=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=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:h}=Ol(u,r,c),p=r,f={},g=0;for(let x=0;x<a.length;x++){var m;const{name:y,fn:b}=a[x],{x:k,y:S,data:j,reset:C}=await b({x:d,y:h,initialPlacement:r,placement:p,strategy:o,middlewareData:f,rects:u,platform:{...i,detectOverflow:(m=i.detectOverflow)!=null?m:Zw},elements:{reference:e,floating:t}});d=k??d,h=S??h,f={...f,[y]:{...f[y],...j}},C&&g<=50&&(g++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(u=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:d,y:h}=Ol(u,p,c)),x=-1)}return{x:d,y:h,placement:p,strategy:o,middlewareData:f}},Hw=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:c}=t,{element:u,padding:d=0}=Wt(e,t)||{};if(u==null)return{};const h=hf(d),p={x:n,y:r},f=la(o),g=aa(f),m=await i.getDimensions(u),x=f==="y",y=x?"top":"left",b=x?"bottom":"right",k=x?"clientHeight":"clientWidth",S=s.reference[g]+s.reference[f]-p[f]-s.floating[g],j=p[f]-s.reference[f],C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let N=C?C[k]:0;(!N||!await(i.isElement==null?void 0:i.isElement(C)))&&(N=a.floating[k]||s.floating[g]);const T=S/2-j/2,A=N/2-m[g]/2-1,R=nn(h[y],A),M=nn(h[b],A),E=R,L=N-m[g]-M,w=N/2-m[g]/2+T,D=ri(E,w,L),W=!c.arrow&&er(o)!=null&&w!==D&&s.reference[g]/2-(w<E?R:M)-m[g]/2<0,B=W?w<E?w-E:w-L:0;return{[f]:p[f]+B,data:{[f]:D,centerOffset:w-D-B,...W&&{alignmentOffset:B}},reset:W}}}),Ww=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:a,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:m=!0,...x}=Wt(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=qt(o),b=Ot(a),k=qt(a)===a,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),j=p||(k||!m?[yo(a)]:Mw(a)),C=g!=="none";!p&&C&&j.push(...Bw(a,m,g,S));const N=[a,...j],T=await c.detectOverflow(t,x),A=[];let R=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&A.push(T[y]),h){const w=Dw(o,i,S);A.push(T[w[0]],T[w[1]])}if(R=[...R,{placement:o,overflows:A}],!A.every(w=>w<=0)){var M,E;const w=(((M=s.flip)==null?void 0:M.index)||0)+1,D=N[w];if(D&&(!(h==="alignment"?b!==Ot(D):!1)||R.every(q=>Ot(q.placement)===b?q.overflows[0]>0:!0)))return{data:{index:w,overflows:R},reset:{placement:D}};let W=(E=R.filter(B=>B.overflows[0]<=0).sort((B,q)=>B.overflows[1]-q.overflows[1])[0])==null?void 0:E.placement;if(!W)switch(f){case"bestFit":{var L;const B=(L=R.filter(q=>{if(C){const Y=Ot(q.placement);return Y===b||Y==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(Y=>Y>0).reduce((Y,I)=>Y+I,0)]).sort((q,Y)=>q[1]-Y[1])[0])==null?void 0:L[0];B&&(W=B);break}case"initialPlacement":W=a;break}if(o!==W)return{reset:{placement:W}}}return{}}}};function Dl(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ml(e){return zw.some(t=>e[t]>=0)}const qw=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=Wt(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=Dl(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Ml(a)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),a=Dl(i,n.floating);return{data:{escapedOffsets:a,escaped:Ml(a)}}}default:return{}}}}},pf=new Set(["left","top"]);async function Kw(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=qt(n),a=er(n),c=Ot(n)==="y",u=pf.has(i)?-1:1,d=s&&c?-1:1,h=Wt(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:g}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof g=="number"&&(f=a==="end"?g*-1:g),c?{x:f*d,y:p*u}:{x:p*u,y:f*d}}const Jw=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:a}=t,c=await Kw(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:i}}}}},Gw=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:a=!1,limiter:c={fn:y=>{let{x:b,y:k}=y;return{x:b,y:k}}},...u}=Wt(e,t),d={x:n,y:r},h=await s.detectOverflow(t,u),p=Ot(qt(o)),f=ia(p);let g=d[f],m=d[p];if(i){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",k=g+h[y],S=g-h[b];g=ri(k,g,S)}if(a){const y=p==="y"?"top":"left",b=p==="y"?"bottom":"right",k=m+h[y],S=m-h[b];m=ri(k,m,S)}const x=c.fn({...t,[f]:g,[p]:m});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[f]:i,[p]:a}}}}}},Yw=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=Wt(e,t),d={x:n,y:r},h=Ot(o),p=ia(h);let f=d[p],g=d[h];const m=Wt(a,t),x=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const k=p==="y"?"height":"width",S=s.reference[p]-s.floating[k]+x.mainAxis,j=s.reference[p]+s.reference[k]-x.mainAxis;f<S?f=S:f>j&&(f=j)}if(u){var y,b;const k=p==="y"?"width":"height",S=pf.has(qt(o)),j=s.reference[h]-s.floating[k]+(S&&((y=i.offset)==null?void 0:y[h])||0)+(S?0:x.crossAxis),C=s.reference[h]+s.reference[k]+(S?0:((b=i.offset)==null?void 0:b[h])||0)-(S?x.crossAxis:0);g<j?g=j:g>C&&(g=C)}return{[p]:f,[h]:g}}}},Xw=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:a}=t,{apply:c=()=>{},...u}=Wt(e,t),d=await i.detectOverflow(t,u),h=qt(o),p=er(o),f=Ot(o)==="y",{width:g,height:m}=s.floating;let x,y;h==="top"||h==="bottom"?(x=h,y=p===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(y=h,x=p==="end"?"top":"bottom");const b=m-d.top-d.bottom,k=g-d.left-d.right,S=nn(m-d[x],b),j=nn(g-d[y],k),C=!t.middlewareData.shift;let N=S,T=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(N=b),C&&!p){const R=pt(d.left,0),M=pt(d.right,0),E=pt(d.top,0),L=pt(d.bottom,0);f?T=g-2*(R!==0||M!==0?R+M:pt(d.left,d.right)):N=m-2*(E!==0||L!==0?E+L:pt(d.top,d.bottom))}await c({...t,availableWidth:T,availableHeight:N});const A=await i.getDimensions(a.floating);return g!==A.width||m!==A.height?{reset:{rects:!0}}:{}}}};function Ho(){return typeof window<"u"}function tr(e){return mf(e)?(e.nodeName||"").toLowerCase():"#document"}function gt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function $t(e){var t;return(t=(mf(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function mf(e){return Ho()?e instanceof Node||e instanceof gt(e).Node:!1}function Nt(e){return Ho()?e instanceof Element||e instanceof gt(e).Element:!1}function Lt(e){return Ho()?e instanceof HTMLElement||e instanceof gt(e).HTMLElement:!1}function Ll(e){return!Ho()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof gt(e).ShadowRoot}const Qw=new Set(["inline","contents"]);function Pr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Tt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Qw.has(o)}const ek=new Set(["table","td","th"]);function tk(e){return ek.has(tr(e))}const nk=[":popover-open",":modal"];function Wo(e){return nk.some(t=>{try{return e.matches(t)}catch{return!1}})}const rk=["transform","translate","scale","rotate","perspective"],ok=["transform","translate","scale","rotate","perspective","filter"],sk=["paint","layout","strict","content"];function ca(e){const t=ua(),n=Nt(e)?Tt(e):e;return rk.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)||ok.some(r=>(n.willChange||"").includes(r))||sk.some(r=>(n.contain||"").includes(r))}function ik(e){let t=rn(e);for(;Lt(t)&&!Hn(t);){if(ca(t))return t;if(Wo(t))return null;t=rn(t)}return null}function ua(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const ak=new Set(["html","body","#document"]);function Hn(e){return ak.has(tr(e))}function Tt(e){return gt(e).getComputedStyle(e)}function qo(e){return Nt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function rn(e){if(tr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ll(e)&&e.host||$t(e);return Ll(t)?t.host:t}function gf(e){const t=rn(e);return Hn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Lt(t)&&Pr(t)?t:gf(t)}function Cr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=gf(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=gt(o);if(s){const a=si(i);return t.concat(i,i.visualViewport||[],Pr(o)?o:[],a&&n?Cr(a):[])}return t.concat(o,Cr(o,[],n))}function si(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function xf(e){const t=Tt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Lt(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=xo(n)!==s||xo(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function da(e){return Nt(e)?e:e.contextElement}function Mn(e){const t=da(e);if(!Lt(t))return Mt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=xf(t);let i=(s?xo(n.width):n.width)/r,a=(s?xo(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const lk=Mt(0);function yf(e){const t=gt(e);return!ua()||!t.visualViewport?lk:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ck(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==gt(e)?!1:t}function mn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=da(e);let i=Mt(1);t&&(r?Nt(r)&&(i=Mn(r)):i=Mn(e));const a=ck(s,n,r)?yf(s):Mt(0);let c=(o.left+a.x)/i.x,u=(o.top+a.y)/i.y,d=o.width/i.x,h=o.height/i.y;if(s){const p=gt(s),f=r&&Nt(r)?gt(r):r;let g=p,m=si(g);for(;m&&r&&f!==g;){const x=Mn(m),y=m.getBoundingClientRect(),b=Tt(m),k=y.left+(m.clientLeft+parseFloat(b.paddingLeft))*x.x,S=y.top+(m.clientTop+parseFloat(b.paddingTop))*x.y;c*=x.x,u*=x.y,d*=x.x,h*=x.y,c+=k,u+=S,g=gt(m),m=si(g)}}return vo({width:d,height:h,x:c,y:u})}function Ko(e,t){const n=qo(e).scrollLeft;return t?t.left+n:mn($t(e)).left+n}function vf(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ko(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function uk(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=$t(r),a=t?Wo(t.floating):!1;if(r===i||a&&s)return n;let c={scrollLeft:0,scrollTop:0},u=Mt(1);const d=Mt(0),h=Lt(r);if((h||!h&&!s)&&((tr(r)!=="body"||Pr(i))&&(c=qo(r)),Lt(r))){const f=mn(r);u=Mn(r),d.x=f.x+r.clientLeft,d.y=f.y+r.clientTop}const p=i&&!h&&!s?vf(i,c):Mt(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-c.scrollTop*u.y+d.y+p.y}}function dk(e){return Array.from(e.getClientRects())}function fk(e){const t=$t(e),n=qo(e),r=e.ownerDocument.body,o=pt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=pt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Ko(e);const a=-n.scrollTop;return Tt(r).direction==="rtl"&&(i+=pt(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const Fl=25;function hk(e,t){const n=gt(e),r=$t(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,c=0;if(o){s=o.width,i=o.height;const d=ua();(!d||d&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}const u=Ko(r);if(u<=0){const d=r.ownerDocument,h=d.body,p=getComputedStyle(h),f=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(r.clientWidth-h.clientWidth-f);g<=Fl&&(s-=g)}else u<=Fl&&(s+=u);return{width:s,height:i,x:a,y:c}}const pk=new Set(["absolute","fixed"]);function mk(e,t){const n=mn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Lt(e)?Mn(e):Mt(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,c=o*s.x,u=r*s.y;return{width:i,height:a,x:c,y:u}}function $l(e,t,n){let r;if(t==="viewport")r=hk(e,n);else if(t==="document")r=fk($t(e));else if(Nt(t))r=mk(t,n);else{const o=yf(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return vo(r)}function bf(e,t){const n=rn(e);return n===t||!Nt(n)||Hn(n)?!1:Tt(n).position==="fixed"||bf(n,t)}function gk(e,t){const n=t.get(e);if(n)return n;let r=Cr(e,[],!1).filter(a=>Nt(a)&&tr(a)!=="body"),o=null;const s=Tt(e).position==="fixed";let i=s?rn(e):e;for(;Nt(i)&&!Hn(i);){const a=Tt(i),c=ca(i);!c&&a.position==="fixed"&&(o=null),(s?!c&&!o:!c&&a.position==="static"&&!!o&&pk.has(o.position)||Pr(i)&&!c&&bf(e,i))?r=r.filter(d=>d!==i):o=a,i=rn(i)}return t.set(e,r),r}function xk(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Wo(t)?[]:gk(t,this._c):[].concat(n),r],a=i[0],c=i.reduce((u,d)=>{const h=$l(t,d,o);return u.top=pt(h.top,u.top),u.right=nn(h.right,u.right),u.bottom=nn(h.bottom,u.bottom),u.left=pt(h.left,u.left),u},$l(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function yk(e){const{width:t,height:n}=xf(e);return{width:t,height:n}}function vk(e,t,n){const r=Lt(t),o=$t(t),s=n==="fixed",i=mn(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=Mt(0);function u(){c.x=Ko(o)}if(r||!r&&!s)if((tr(t)!=="body"||Pr(o))&&(a=qo(t)),r){const f=mn(t,!0,s,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else o&&u();s&&!r&&o&&u();const d=o&&!r&&!s?vf(o,a):Mt(0),h=i.left+a.scrollLeft-c.x-d.x,p=i.top+a.scrollTop-c.y-d.y;return{x:h,y:p,width:i.width,height:i.height}}function js(e){return Tt(e).position==="static"}function Bl(e,t){if(!Lt(e)||Tt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return $t(e)===n&&(n=n.ownerDocument.body),n}function wf(e,t){const n=gt(e);if(Wo(e))return n;if(!Lt(e)){let o=rn(e);for(;o&&!Hn(o);){if(Nt(o)&&!js(o))return o;o=rn(o)}return n}let r=Bl(e,t);for(;r&&tk(r)&&js(r);)r=Bl(r,t);return r&&Hn(r)&&js(r)&&!ca(r)?n:r||ik(e)||n}const bk=async function(e){const t=this.getOffsetParent||wf,n=this.getDimensions,r=await n(e.floating);return{reference:vk(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wk(e){return Tt(e).direction==="rtl"}const kk={convertOffsetParentRelativeRectToViewportRelativeRect:uk,getDocumentElement:$t,getClippingRect:xk,getOffsetParent:wf,getElementRects:bk,getClientRects:dk,getDimensions:yk,getScale:Mn,isElement:Nt,isRTL:wk};function kf(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function _k(e,t){let n=null,r;const o=$t(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const u=e.getBoundingClientRect(),{left:d,top:h,width:p,height:f}=u;if(a||t(),!p||!f)return;const g=Yr(h),m=Yr(o.clientWidth-(d+p)),x=Yr(o.clientHeight-(h+f)),y=Yr(d),k={rootMargin:-g+"px "+-m+"px "+-x+"px "+-y+"px",threshold:pt(0,nn(1,c))||1};let S=!0;function j(C){const N=C[0].intersectionRatio;if(N!==c){if(!S)return i();N?i(!1,N):r=setTimeout(()=>{i(!1,1e-7)},1e3)}N===1&&!kf(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 Sk(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=da(e),d=o||s?[...u?Cr(u):[],...Cr(t)]:[];d.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const h=u&&a?_k(u,n):null;let p=-1,f=null;i&&(f=new ResizeObserver(y=>{let[b]=y;b&&b.target===u&&f&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var k;(k=f)==null||k.observe(t)})),n()}),u&&!c&&f.observe(u),f.observe(t));let g,m=c?mn(e):null;c&&x();function x(){const y=mn(e);m&&!kf(m,y)&&n(),m=y,g=requestAnimationFrame(x)}return n(),()=>{var y;d.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),h?.(),(y=f)==null||y.disconnect(),f=null,c&&cancelAnimationFrame(g)}}const Ck=Jw,jk=Gw,Ek=Ww,Nk=Xw,Tk=qw,Ul=Hw,Ak=Yw,Ik=(e,t,n)=>{const r=new Map,o={platform:kk,...n},s={...o.platform,_c:r};return Vw(e,t,{...o,platform:s})};var zk=typeof document<"u",Pk=function(){},io=zk?v.useLayoutEffect:Pk;function bo(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(!bo(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)&&!bo(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function _f(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Zl(e,t){const n=_f(e);return Math.round(t*n)/n}function Es(e){const t=v.useRef(e);return io(()=>{t.current=e}),t}function Rk(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[d,h]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=v.useState(r);bo(p,r)||f(r);const[g,m]=v.useState(null),[x,y]=v.useState(null),b=v.useCallback(q=>{q!==C.current&&(C.current=q,m(q))},[]),k=v.useCallback(q=>{q!==N.current&&(N.current=q,y(q))},[]),S=s||g,j=i||x,C=v.useRef(null),N=v.useRef(null),T=v.useRef(d),A=c!=null,R=Es(c),M=Es(o),E=Es(u),L=v.useCallback(()=>{if(!C.current||!N.current)return;const q={placement:t,strategy:n,middleware:p};M.current&&(q.platform=M.current),Ik(C.current,N.current,q).then(Y=>{const I={...Y,isPositioned:E.current!==!1};w.current&&!bo(T.current,I)&&(T.current=I,Ar.flushSync(()=>{h(I)}))})},[p,t,n,M,E]);io(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,h(q=>({...q,isPositioned:!1})))},[u]);const w=v.useRef(!1);io(()=>(w.current=!0,()=>{w.current=!1}),[]),io(()=>{if(S&&(C.current=S),j&&(N.current=j),S&&j){if(R.current)return R.current(S,j,L);L()}},[S,j,L,R,A]);const D=v.useMemo(()=>({reference:C,floating:N,setReference:b,setFloating:k}),[b,k]),W=v.useMemo(()=>({reference:S,floating:j}),[S,j]),B=v.useMemo(()=>{const q={position:n,left:0,top:0};if(!W.floating)return q;const Y=Zl(W.floating,d.x),I=Zl(W.floating,d.y);return a?{...q,transform:"translate("+Y+"px, "+I+"px)",..._f(W.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:I}},[n,a,W.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:L,refs:D,elements:W,floatingStyles:B}),[d,L,D,W,B])}const Ok=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?Ul({element:r.current,padding:o}).fn(n):{}:r?Ul({element:r,padding:o}).fn(n):{}}}},Dk=(e,t)=>({...Ck(e),options:[e,t]}),Mk=(e,t)=>({...jk(e),options:[e,t]}),Lk=(e,t)=>({...Ak(e),options:[e,t]}),Fk=(e,t)=>({...Ek(e),options:[e,t]}),$k=(e,t)=>({...Nk(e),options:[e,t]}),Bk=(e,t)=>({...Tk(e),options:[e,t]}),Uk=(e,t)=>({...Ok(e),options:[e,t]});var Zk="Arrow",Sf=v.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return l.jsx(Ce.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});Sf.displayName=Zk;var Vk=Sf,fa="Popper",[Cf,Jo]=Gt(fa),[Hk,jf]=Cf(fa),Ef=e=>{const{__scopePopper:t,children:n}=e,[r,o]=v.useState(null);return l.jsx(Hk,{scope:t,anchor:r,onAnchorChange:o,children:n})};Ef.displayName=fa;var Nf="PopperAnchor",Tf=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=jf(Nf,n),i=v.useRef(null),a=Pe(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:l.jsx(Ce.div,{...o,ref:a})});Tf.displayName=Nf;var ha="PopperContent",[Wk,qk]=Cf(ha),Af=v.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:p=!1,updatePositionStrategy:f="optimized",onPlaced:g,...m}=e,x=jf(ha,n),[y,b]=v.useState(null),k=Pe(t,te=>b(te)),[S,j]=v.useState(null),C=Iw(S),N=C?.width??0,T=C?.height??0,A=r+(s!=="center"?"-"+s:""),R=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},M=Array.isArray(u)?u:[u],E=M.length>0,L={padding:R,boundary:M.filter(Jk),altBoundary:E},{refs:w,floatingStyles:D,placement:W,isPositioned:B,middlewareData:q}=Rk({strategy:"fixed",placement:A,whileElementsMounted:(...te)=>Sk(...te,{animationFrame:f==="always"}),elements:{reference:x.anchor},middleware:[Dk({mainAxis:o+T,alignmentAxis:i}),c&&Mk({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Lk():void 0,...L}),c&&Fk({...L}),$k({...L,apply:({elements:te,rects:ce,availableWidth:fe,availableHeight:ge})=>{const{width:xe,height:Ee}=ce.reference,Oe=te.floating.style;Oe.setProperty("--radix-popper-available-width",`${fe}px`),Oe.setProperty("--radix-popper-available-height",`${ge}px`),Oe.setProperty("--radix-popper-anchor-width",`${xe}px`),Oe.setProperty("--radix-popper-anchor-height",`${Ee}px`)}}),S&&Uk({element:S,padding:a}),Gk({arrowWidth:N,arrowHeight:T}),p&&Bk({strategy:"referenceHidden",...L})]}),[Y,I]=Pf(W),H=st(g);et(()=>{B&&H?.()},[B,H]);const V=q.arrow?.x,z=q.arrow?.y,oe=q.arrow?.centerOffset!==0,[X,de]=v.useState();return et(()=>{y&&de(window.getComputedStyle(y).zIndex)},[y]),l.jsx("div",{ref:w.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:B?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:X,"--radix-popper-transform-origin":[q.transformOrigin?.x,q.transformOrigin?.y].join(" "),...q.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(Wk,{scope:n,placedSide:Y,onArrowChange:j,arrowX:V,arrowY:z,shouldHideArrow:oe,children:l.jsx(Ce.div,{"data-side":Y,"data-align":I,...m,ref:k,style:{...m.style,animation:B?void 0:"none"}})})})});Af.displayName=ha;var If="PopperArrow",Kk={top:"bottom",right:"left",bottom:"top",left:"right"},zf=v.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=qk(If,r),i=Kk[s.placedSide];return l.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:l.jsx(Vk,{...o,ref:n,style:{...o.style,display:"block"}})})});zf.displayName=If;function Jk(e){return e!==null}var Gk=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=o.arrow?.centerOffset!==0,a=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,d]=Pf(n),h={start:"0%",center:"50%",end:"100%"}[d],p=(o.arrow?.x??0)+a/2,f=(o.arrow?.y??0)+c/2;let g="",m="";return u==="bottom"?(g=i?h:`${p}px`,m=`${-c}px`):u==="top"?(g=i?h:`${p}px`,m=`${r.floating.height+c}px`):u==="right"?(g=`${-c}px`,m=i?h:`${f}px`):u==="left"&&(g=`${r.floating.width+c}px`,m=i?h:`${f}px`),{data:{x:g,y:m}}}});function Pf(e){const[t,n="center"]=e.split("-");return[t,n]}var Rf=Ef,Of=Tf,Df=Af,Mf=zf,Ns="rovingFocusGroup.onEntryFocus",Yk={bubbles:!1,cancelable:!0},Rr="RovingFocusGroup",[ii,Lf,Xk]=Pd(Rr),[Qk,Ff]=Gt(Rr,[Xk]),[e_,t_]=Qk(Rr),$f=v.forwardRef((e,t)=>l.jsx(ii.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(ii.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(n_,{...e,ref:t})})}));$f.displayName=Rr;var n_=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=e,p=v.useRef(null),f=Pe(t,p),g=$o(s),[m,x]=hn({prop:i,defaultProp:a??null,onChange:c,caller:Rr}),[y,b]=v.useState(!1),k=st(u),S=Lf(n),j=v.useRef(!1),[C,N]=v.useState(0);return v.useEffect(()=>{const T=p.current;if(T)return T.addEventListener(Ns,k),()=>T.removeEventListener(Ns,k)},[k]),l.jsx(e_,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:m,onItemFocus:v.useCallback(T=>x(T),[x]),onItemShiftTab:v.useCallback(()=>b(!0),[]),onFocusableItemAdd:v.useCallback(()=>N(T=>T+1),[]),onFocusableItemRemove:v.useCallback(()=>N(T=>T-1),[]),children:l.jsx(Ce.div,{tabIndex:y||C===0?-1:0,"data-orientation":r,...h,ref:f,style:{outline:"none",...e.style},onMouseDown:we(e.onMouseDown,()=>{j.current=!0}),onFocus:we(e.onFocus,T=>{const A=!j.current;if(T.target===T.currentTarget&&A&&!y){const R=new CustomEvent(Ns,Yk);if(T.currentTarget.dispatchEvent(R),!R.defaultPrevented){const M=S().filter(W=>W.focusable),E=M.find(W=>W.active),L=M.find(W=>W.id===m),D=[E,L,...M].filter(Boolean).map(W=>W.ref.current);Zf(D,d)}}j.current=!1}),onBlur:we(e.onBlur,()=>b(!1))})})}),Bf="RovingFocusGroupItem",Uf=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...a}=e,c=Dt(),u=s||c,d=t_(Bf,n),h=d.currentTabStopId===u,p=Lf(n),{onFocusableItemAdd:f,onFocusableItemRemove:g,currentTabStopId:m}=d;return v.useEffect(()=>{if(r)return f(),()=>g()},[r,f,g]),l.jsx(ii.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:l.jsx(Ce.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:we(e.onMouseDown,x=>{r?d.onItemFocus(u):x.preventDefault()}),onFocus:we(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:we(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){d.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const y=s_(x,d.orientation,d.dir);if(y!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let k=p().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?i_(k,S+1):k.slice(S+1)}setTimeout(()=>Zf(k))}}),children:typeof i=="function"?i({isCurrentTabStop:h,hasTabStop:m!=null}):i})})});Uf.displayName=Bf;var r_={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function o_(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function s_(e,t,n){const r=o_(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return r_[r]}function Zf(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function i_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var a_=$f,l_=Uf;function ai(e,[t,n]){return Math.min(n,Math.max(t,e))}function c_(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var pa="ScrollArea",[Vf]=Gt(pa),[u_,_t]=Vf(pa),Hf=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[a,c]=v.useState(null),[u,d]=v.useState(null),[h,p]=v.useState(null),[f,g]=v.useState(null),[m,x]=v.useState(null),[y,b]=v.useState(0),[k,S]=v.useState(0),[j,C]=v.useState(!1),[N,T]=v.useState(!1),A=Pe(t,M=>c(M)),R=$o(o);return l.jsx(u_,{scope:n,type:r,dir:R,scrollHideDelay:s,scrollArea:a,viewport:u,onViewportChange:d,content:h,onContentChange:p,scrollbarX:f,onScrollbarXChange:g,scrollbarXEnabled:j,onScrollbarXEnabledChange:C,scrollbarY:m,onScrollbarYChange:x,scrollbarYEnabled:N,onScrollbarYEnabledChange:T,onCornerWidthChange:b,onCornerHeightChange:S,children:l.jsx(Ce.div,{dir:R,...i,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})});Hf.displayName=pa;var Wf="ScrollAreaViewport",qf=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...s}=e,i=_t(Wf,n),a=v.useRef(null),c=Pe(t,a,i.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),l.jsx(Ce.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:l.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});qf.displayName=Wf;var Bt="ScrollAreaScrollbar",Kf=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=_t(Bt,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,a=e.orientation==="horizontal";return v.useEffect(()=>(a?s(!0):i(!0),()=>{a?s(!1):i(!1)}),[a,s,i]),o.type==="hover"?l.jsx(d_,{...r,ref:t,forceMount:n}):o.type==="scroll"?l.jsx(f_,{...r,ref:t,forceMount:n}):o.type==="auto"?l.jsx(Jf,{...r,ref:t,forceMount:n}):o.type==="always"?l.jsx(ma,{...r,ref:t}):null});Kf.displayName=Bt;var d_=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=_t(Bt,e.__scopeScrollArea),[s,i]=v.useState(!1);return v.useEffect(()=>{const a=o.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),i(!0)},d=()=>{c=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",d)}}},[o.scrollArea,o.scrollHideDelay]),l.jsx(kt,{present:n||s,children:l.jsx(Jf,{"data-state":s?"visible":"hidden",...r,ref:t})})}),f_=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=_t(Bt,e.__scopeScrollArea),s=e.orientation==="horizontal",i=Yo(()=>c("SCROLL_END"),100),[a,c]=c_("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return v.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,o.scrollHideDelay,c]),v.useEffect(()=>{const u=o.viewport,d=s?"scrollLeft":"scrollTop";if(u){let h=u[d];const p=()=>{const f=u[d];h!==f&&(c("SCROLL"),i()),h=f};return u.addEventListener("scroll",p),()=>u.removeEventListener("scroll",p)}},[o.viewport,s,c,i]),l.jsx(kt,{present:n||a!=="hidden",children:l.jsx(ma,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:we(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:we(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Jf=v.forwardRef((e,t)=>{const n=_t(Bt,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=v.useState(!1),a=e.orientation==="horizontal",c=Yo(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;i(a?u:d)}},10);return Wn(n.viewport,c),Wn(n.content,c),l.jsx(kt,{present:r||s,children:l.jsx(ma,{"data-state":s?"visible":"hidden",...o,ref:t})})}),ma=v.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=_t(Bt,e.__scopeScrollArea),s=v.useRef(null),i=v.useRef(0),[a,c]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=eh(a.viewport,a.content),d={...r,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:p=>s.current=p,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:p=>i.current=p};function h(p,f){return y_(p,i.current,a,f)}return n==="horizontal"?l.jsx(h_,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const p=o.viewport.scrollLeft,f=Vl(p,a,o.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:p=>{o.viewport&&(o.viewport.scrollLeft=p)},onDragScroll:p=>{o.viewport&&(o.viewport.scrollLeft=h(p,o.dir))}}):n==="vertical"?l.jsx(p_,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const p=o.viewport.scrollTop,f=Vl(p,a);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:p=>{o.viewport&&(o.viewport.scrollTop=p)},onDragScroll:p=>{o.viewport&&(o.viewport.scrollTop=h(p))}}):null}),h_=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=_t(Bt,e.__scopeScrollArea),[i,a]=v.useState(),c=v.useRef(null),u=Pe(t,c,s.onScrollbarXChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(Yf,{"data-orientation":"horizontal",...o,ref:u,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Go(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,h)=>{if(s.viewport){const p=s.viewport.scrollLeft+d.deltaX;e.onWheelScroll(p),nh(p,h)&&d.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:ko(i.paddingLeft),paddingEnd:ko(i.paddingRight)}})}})}),p_=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=_t(Bt,e.__scopeScrollArea),[i,a]=v.useState(),c=v.useRef(null),u=Pe(t,c,s.onScrollbarYChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(Yf,{"data-orientation":"vertical",...o,ref:u,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Go(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,h)=>{if(s.viewport){const p=s.viewport.scrollTop+d.deltaY;e.onWheelScroll(p),nh(p,h)&&d.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:ko(i.paddingTop),paddingEnd:ko(i.paddingBottom)}})}})}),[m_,Gf]=Vf(Bt),Yf=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:h,...p}=e,f=_t(Bt,n),[g,m]=v.useState(null),x=Pe(t,A=>m(A)),y=v.useRef(null),b=v.useRef(""),k=f.viewport,S=r.content-r.viewport,j=st(d),C=st(c),N=Yo(h,10);function T(A){if(y.current){const R=A.clientX-y.current.left,M=A.clientY-y.current.top;u({x:R,y:M})}}return v.useEffect(()=>{const A=R=>{const M=R.target;g?.contains(M)&&j(R,S)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[k,g,S,j]),v.useEffect(C,[r,C]),Wn(g,N),Wn(f.content,N),l.jsx(m_,{scope:n,scrollbar:g,hasThumb:o,onThumbChange:st(s),onThumbPointerUp:st(i),onThumbPositionChange:C,onThumbPointerDown:st(a),children:l.jsx(Ce.div,{...p,ref:x,style:{position:"absolute",...p.style},onPointerDown:we(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),y.current=g.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),T(A))}),onPointerMove:we(e.onPointerMove,T),onPointerUp:we(e.onPointerUp,A=>{const R=A.target;R.hasPointerCapture(A.pointerId)&&R.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=b.current,f.viewport&&(f.viewport.style.scrollBehavior=""),y.current=null})})})}),wo="ScrollAreaThumb",Xf=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Gf(wo,e.__scopeScrollArea);return l.jsx(kt,{present:n||o.hasThumb,children:l.jsx(g_,{ref:t,...r})})}),g_=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=_t(wo,n),i=Gf(wo,n),{onThumbPositionChange:a}=i,c=Pe(t,h=>i.onThumbChange(h)),u=v.useRef(void 0),d=Yo(()=>{u.current&&(u.current(),u.current=void 0)},100);return v.useEffect(()=>{const h=s.viewport;if(h){const p=()=>{if(d(),!u.current){const f=v_(h,a);u.current=f,a()}};return a(),h.addEventListener("scroll",p),()=>h.removeEventListener("scroll",p)}},[s.viewport,d,a]),l.jsx(Ce.div,{"data-state":i.hasThumb?"visible":"hidden",...o,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:we(e.onPointerDownCapture,h=>{const f=h.target.getBoundingClientRect(),g=h.clientX-f.left,m=h.clientY-f.top;i.onThumbPointerDown({x:g,y:m})}),onPointerUp:we(e.onPointerUp,i.onThumbPointerUp)})});Xf.displayName=wo;var ga="ScrollAreaCorner",Qf=v.forwardRef((e,t)=>{const n=_t(ga,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?l.jsx(x_,{...e,ref:t}):null});Qf.displayName=ga;var x_=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=_t(ga,n),[s,i]=v.useState(0),[a,c]=v.useState(0),u=!!(s&&a);return Wn(o.scrollbarX,()=>{const d=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(d),c(d)}),Wn(o.scrollbarY,()=>{const d=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(d),i(d)}),u?l.jsx(Ce.div,{...r,ref:t,style:{width:s,height:a,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function ko(e){return e?parseInt(e,10):0}function eh(e,t){const n=e/t;return isNaN(n)?0:n}function Go(e){const t=eh(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function y_(e,t,n,r="ltr"){const o=Go(n),s=o/2,i=t||s,a=o-i,c=n.scrollbar.paddingStart+i,u=n.scrollbar.size-n.scrollbar.paddingEnd-a,d=n.content-n.viewport,h=r==="ltr"?[0,d]:[d*-1,0];return th([c,u],h)(e)}function Vl(e,t,n="ltr"){const r=Go(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,i=t.content-t.viewport,a=s-r,c=n==="ltr"?[0,i]:[i*-1,0],u=ai(e,c);return th([0,i],[0,a])(u)}function th(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function nh(e,t){return e>0&&e<t}var v_=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function o(){const s={left:e.scrollLeft,top:e.scrollTop},i=n.left!==s.left,a=n.top!==s.top;(i||a)&&t(),n=s,r=window.requestAnimationFrame(o)})(),()=>window.cancelAnimationFrame(r)};function Yo(e,t){const n=st(e),r=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),v.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Wn(e,t){const n=st(t);et(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}var b_=Hf,w_=qf,k_=Qf,__=[" ","Enter","ArrowUp","ArrowDown"],S_=[" ","Enter"],gn="Select",[Xo,Qo,C_]=Pd(gn),[nr]=Gt(gn,[C_,Jo]),es=Jo(),[j_,an]=nr(gn),[E_,N_]=nr(gn),rh=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:a,onValueChange:c,dir:u,name:d,autoComplete:h,disabled:p,required:f,form:g}=e,m=es(t),[x,y]=v.useState(null),[b,k]=v.useState(null),[S,j]=v.useState(!1),C=$o(u),[N,T]=hn({prop:r,defaultProp:o??!1,onChange:s,caller:gn}),[A,R]=hn({prop:i,defaultProp:a,onChange:c,caller:gn}),M=v.useRef(null),E=x?g||!!x.closest("form"):!0,[L,w]=v.useState(new Set),D=Array.from(L).map(W=>W.props.value).join(";");return l.jsx(Rf,{...m,children:l.jsxs(j_,{required:f,scope:t,trigger:x,onTriggerChange:y,valueNode:b,onValueNodeChange:k,valueNodeHasChildren:S,onValueNodeHasChildrenChange:j,contentId:Dt(),value:A,onValueChange:R,open:N,onOpenChange:T,dir:C,triggerPointerDownPosRef:M,disabled:p,children:[l.jsx(Xo.Provider,{scope:t,children:l.jsx(E_,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(W=>{w(B=>new Set(B).add(W))},[]),onNativeOptionRemove:v.useCallback(W=>{w(B=>{const q=new Set(B);return q.delete(W),q})},[]),children:n})}),E?l.jsxs(Ch,{"aria-hidden":!0,required:f,tabIndex:-1,name:d,autoComplete:h,value:A,onChange:W=>R(W.target.value),disabled:p,form:g,children:[A===void 0?l.jsx("option",{value:""}):null,Array.from(L)]},D):null]})})};rh.displayName=gn;var oh="SelectTrigger",sh=v.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=es(n),i=an(oh,n),a=i.disabled||r,c=Pe(t,i.onTriggerChange),u=Qo(n),d=v.useRef("touch"),[h,p,f]=Eh(m=>{const x=u().filter(k=>!k.disabled),y=x.find(k=>k.value===i.value),b=Nh(x,m,y);b!==void 0&&i.onValueChange(b.value)}),g=m=>{a||(i.onOpenChange(!0),f()),m&&(i.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return l.jsx(Of,{asChild:!0,...s,children:l.jsx(Ce.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":jh(i.value)?"":void 0,...o,ref:c,onClick:we(o.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&g(m)}),onPointerDown:we(o.onPointerDown,m=>{d.current=m.pointerType;const x=m.target;x.hasPointerCapture(m.pointerId)&&x.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(g(m),m.preventDefault())}),onKeyDown:we(o.onKeyDown,m=>{const x=h.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&p(m.key),!(x&&m.key===" ")&&__.includes(m.key)&&(g(),m.preventDefault())})})})});sh.displayName=oh;var ih="SelectValue",ah=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...a}=e,c=an(ih,n),{onValueNodeHasChildrenChange:u}=c,d=s!==void 0,h=Pe(t,c.onValueNodeChange);return et(()=>{u(d)},[u,d]),l.jsx(Ce.span,{...a,ref:h,style:{pointerEvents:"none"},children:jh(c.value)?l.jsx(l.Fragment,{children:i}):s})});ah.displayName=ih;var T_="SelectIcon",lh=v.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return l.jsx(Ce.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});lh.displayName=T_;var A_="SelectPortal",ch=e=>l.jsx(Uo,{asChild:!0,...e});ch.displayName=A_;var xn="SelectContent",uh=v.forwardRef((e,t)=>{const n=an(xn,e.__scopeSelect),[r,o]=v.useState();if(et(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?Ar.createPortal(l.jsx(dh,{scope:e.__scopeSelect,children:l.jsx(Xo.Slot,{scope:e.__scopeSelect,children:l.jsx("div",{children:e.children})})}),s):null}return l.jsx(fh,{...e,ref:t})});uh.displayName=xn;var jt=10,[dh,ln]=nr(xn),I_="SelectContentImpl",z_=Vn("SelectContent.RemoveScroll"),fh=v.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:p,collisionPadding:f,sticky:g,hideWhenDetached:m,avoidCollisions:x,...y}=e,b=an(xn,n),[k,S]=v.useState(null),[j,C]=v.useState(null),N=Pe(t,te=>S(te)),[T,A]=v.useState(null),[R,M]=v.useState(null),E=Qo(n),[L,w]=v.useState(!1),D=v.useRef(!1);v.useEffect(()=>{if(k)return Gd(k)},[k]),Bd();const W=v.useCallback(te=>{const[ce,...fe]=E().map(Ee=>Ee.ref.current),[ge]=fe.slice(-1),xe=document.activeElement;for(const Ee of te)if(Ee===xe||(Ee?.scrollIntoView({block:"nearest"}),Ee===ce&&j&&(j.scrollTop=0),Ee===ge&&j&&(j.scrollTop=j.scrollHeight),Ee?.focus(),document.activeElement!==xe))return},[E,j]),B=v.useCallback(()=>W([T,k]),[W,T,k]);v.useEffect(()=>{L&&B()},[L,B]);const{onOpenChange:q,triggerPointerDownPosRef:Y}=b;v.useEffect(()=>{if(k){let te={x:0,y:0};const ce=ge=>{te={x:Math.abs(Math.round(ge.pageX)-(Y.current?.x??0)),y:Math.abs(Math.round(ge.pageY)-(Y.current?.y??0))}},fe=ge=>{te.x<=10&&te.y<=10?ge.preventDefault():k.contains(ge.target)||q(!1),document.removeEventListener("pointermove",ce),Y.current=null};return Y.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",fe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",fe,{capture:!0})}}},[k,q,Y]),v.useEffect(()=>{const te=()=>q(!1);return window.addEventListener("blur",te),window.addEventListener("resize",te),()=>{window.removeEventListener("blur",te),window.removeEventListener("resize",te)}},[q]);const[I,H]=Eh(te=>{const ce=E().filter(xe=>!xe.disabled),fe=ce.find(xe=>xe.ref.current===document.activeElement),ge=Nh(ce,te,fe);ge&&setTimeout(()=>ge.ref.current.focus())}),V=v.useCallback((te,ce,fe)=>{const ge=!D.current&&!fe;(b.value!==void 0&&b.value===ce||ge)&&(A(te),ge&&(D.current=!0))},[b.value]),z=v.useCallback(()=>k?.focus(),[k]),oe=v.useCallback((te,ce,fe)=>{const ge=!D.current&&!fe;(b.value!==void 0&&b.value===ce||ge)&&M(te)},[b.value]),X=r==="popper"?li:hh,de=X===li?{side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:p,collisionPadding:f,sticky:g,hideWhenDetached:m,avoidCollisions:x}:{};return l.jsx(dh,{scope:n,content:k,viewport:j,onViewportChange:C,itemRefCallback:V,selectedItem:T,onItemLeave:z,itemTextRefCallback:oe,focusSelectedItem:B,selectedItemText:R,position:r,isPositioned:L,searchRef:I,children:l.jsx(na,{as:z_,allowPinchZoom:!0,children:l.jsx(ta,{asChild:!0,trapped:b.open,onMountAutoFocus:te=>{te.preventDefault()},onUnmountAutoFocus:we(o,te=>{b.trigger?.focus({preventScroll:!0}),te.preventDefault()}),children:l.jsx(Bo,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:te=>te.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:l.jsx(X,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:te=>te.preventDefault(),...y,...de,onPlaced:()=>w(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:we(y.onKeyDown,te=>{const ce=te.ctrlKey||te.altKey||te.metaKey;if(te.key==="Tab"&&te.preventDefault(),!ce&&te.key.length===1&&H(te.key),["ArrowUp","ArrowDown","Home","End"].includes(te.key)){let ge=E().filter(xe=>!xe.disabled).map(xe=>xe.ref.current);if(["ArrowUp","End"].includes(te.key)&&(ge=ge.slice().reverse()),["ArrowUp","ArrowDown"].includes(te.key)){const xe=te.target,Ee=ge.indexOf(xe);ge=ge.slice(Ee+1)}setTimeout(()=>W(ge)),te.preventDefault()}})})})})})})});fh.displayName=I_;var P_="SelectItemAlignedPosition",hh=v.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=an(xn,n),i=ln(xn,n),[a,c]=v.useState(null),[u,d]=v.useState(null),h=Pe(t,N=>d(N)),p=Qo(n),f=v.useRef(!1),g=v.useRef(!0),{viewport:m,selectedItem:x,selectedItemText:y,focusSelectedItem:b}=i,k=v.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&u&&m&&x&&y){const N=s.trigger.getBoundingClientRect(),T=u.getBoundingClientRect(),A=s.valueNode.getBoundingClientRect(),R=y.getBoundingClientRect();if(s.dir!=="rtl"){const xe=R.left-T.left,Ee=A.left-xe,Oe=N.left-Ee,_=N.width+Oe,ee=Math.max(_,T.width),J=window.innerWidth-jt,O=ai(Ee,[jt,Math.max(jt,J-ee)]);a.style.minWidth=_+"px",a.style.left=O+"px"}else{const xe=T.right-R.right,Ee=window.innerWidth-A.right-xe,Oe=window.innerWidth-N.right-Ee,_=N.width+Oe,ee=Math.max(_,T.width),J=window.innerWidth-jt,O=ai(Ee,[jt,Math.max(jt,J-ee)]);a.style.minWidth=_+"px",a.style.right=O+"px"}const M=p(),E=window.innerHeight-jt*2,L=m.scrollHeight,w=window.getComputedStyle(u),D=parseInt(w.borderTopWidth,10),W=parseInt(w.paddingTop,10),B=parseInt(w.borderBottomWidth,10),q=parseInt(w.paddingBottom,10),Y=D+W+L+q+B,I=Math.min(x.offsetHeight*5,Y),H=window.getComputedStyle(m),V=parseInt(H.paddingTop,10),z=parseInt(H.paddingBottom,10),oe=N.top+N.height/2-jt,X=E-oe,de=x.offsetHeight/2,te=x.offsetTop+de,ce=D+W+te,fe=Y-ce;if(ce<=oe){const xe=M.length>0&&x===M[M.length-1].ref.current;a.style.bottom="0px";const Ee=u.clientHeight-m.offsetTop-m.offsetHeight,Oe=Math.max(X,de+(xe?z:0)+Ee+B),_=ce+Oe;a.style.height=_+"px"}else{const xe=M.length>0&&x===M[0].ref.current;a.style.top="0px";const Oe=Math.max(oe,D+m.offsetTop+(xe?V:0)+de)+fe;a.style.height=Oe+"px",m.scrollTop=ce-oe+m.offsetTop}a.style.margin=`${jt}px 0`,a.style.minHeight=I+"px",a.style.maxHeight=E+"px",r?.(),requestAnimationFrame(()=>f.current=!0)}},[p,s.trigger,s.valueNode,a,u,m,x,y,s.dir,r]);et(()=>k(),[k]);const[S,j]=v.useState();et(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const C=v.useCallback(N=>{N&&g.current===!0&&(k(),b?.(),g.current=!1)},[k,b]);return l.jsx(O_,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:f,onScrollButtonChange:C,children:l.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:l.jsx(Ce.div,{...o,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});hh.displayName=P_;var R_="SelectPopperPosition",li=v.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=jt,...s}=e,i=es(n);return l.jsx(Df,{...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)"}})});li.displayName=R_;var[O_,xa]=nr(xn,{}),ci="SelectViewport",ph=v.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=ln(ci,n),i=xa(ci,n),a=Pe(t,s.onViewportChange),c=v.useRef(0);return l.jsxs(l.Fragment,{children:[l.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}),l.jsx(Xo.Slot,{scope:n,children:l.jsx(Ce.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:we(o.onScroll,u=>{const d=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:p}=i;if(p?.current&&h){const f=Math.abs(c.current-d.scrollTop);if(f>0){const g=window.innerHeight-jt*2,m=parseFloat(h.style.minHeight),x=parseFloat(h.style.height),y=Math.max(m,x);if(y<g){const b=y+f,k=Math.min(g,b),S=b-k;h.style.height=k+"px",h.style.bottom==="0px"&&(d.scrollTop=S>0?S:0,h.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});ph.displayName=ci;var mh="SelectGroup",[D_,M_]=nr(mh),L_=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Dt();return l.jsx(D_,{scope:n,id:o,children:l.jsx(Ce.div,{role:"group","aria-labelledby":o,...r,ref:t})})});L_.displayName=mh;var gh="SelectLabel",F_=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=M_(gh,n);return l.jsx(Ce.div,{id:o.id,...r,ref:t})});F_.displayName=gh;var _o="SelectItem",[$_,xh]=nr(_o),yh=v.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,a=an(_o,n),c=ln(_o,n),u=a.value===r,[d,h]=v.useState(s??""),[p,f]=v.useState(!1),g=Pe(t,b=>c.itemRefCallback?.(b,r,o)),m=Dt(),x=v.useRef("touch"),y=()=>{o||(a.onValueChange(r),a.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 l.jsx($_,{scope:n,value:r,disabled:o,textId:m,isSelected:u,onItemTextChange:v.useCallback(b=>{h(k=>k||(b?.textContent??"").trim())},[]),children:l.jsx(Xo.ItemSlot,{scope:n,value:r,disabled:o,textValue:d,children:l.jsx(Ce.div,{role:"option","aria-labelledby":m,"data-highlighted":p?"":void 0,"aria-selected":u&&p,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:g,onFocus:we(i.onFocus,()=>f(!0)),onBlur:we(i.onBlur,()=>f(!1)),onClick:we(i.onClick,()=>{x.current!=="mouse"&&y()}),onPointerUp:we(i.onPointerUp,()=>{x.current==="mouse"&&y()}),onPointerDown:we(i.onPointerDown,b=>{x.current=b.pointerType}),onPointerMove:we(i.onPointerMove,b=>{x.current=b.pointerType,o?c.onItemLeave?.():x.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:we(i.onPointerLeave,b=>{b.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:we(i.onKeyDown,b=>{c.searchRef?.current!==""&&b.key===" "||(S_.includes(b.key)&&y(),b.key===" "&&b.preventDefault())})})})})});yh.displayName=_o;var gr="SelectItemText",vh=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=an(gr,n),a=ln(gr,n),c=xh(gr,n),u=N_(gr,n),[d,h]=v.useState(null),p=Pe(t,y=>h(y),c.onItemTextChange,y=>a.itemTextRefCallback?.(y,c.value,c.disabled)),f=d?.textContent,g=v.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:f},c.value),[c.disabled,c.value,f]),{onNativeOptionAdd:m,onNativeOptionRemove:x}=u;return et(()=>(m(g),()=>x(g)),[m,x,g]),l.jsxs(l.Fragment,{children:[l.jsx(Ce.span,{id:c.textId,...s,ref:p}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Ar.createPortal(s.children,i.valueNode):null]})});vh.displayName=gr;var bh="SelectItemIndicator",wh=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return xh(bh,n).isSelected?l.jsx(Ce.span,{"aria-hidden":!0,...r,ref:t}):null});wh.displayName=bh;var ui="SelectScrollUpButton",kh=v.forwardRef((e,t)=>{const n=ln(ui,e.__scopeSelect),r=xa(ui,e.__scopeSelect),[o,s]=v.useState(!1),i=Pe(t,r.onScrollButtonChange);return et(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=c.scrollTop>0;s(u)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?l.jsx(Sh,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});kh.displayName=ui;var di="SelectScrollDownButton",_h=v.forwardRef((e,t)=>{const n=ln(di,e.__scopeSelect),r=xa(di,e.__scopeSelect),[o,s]=v.useState(!1),i=Pe(t,r.onScrollButtonChange);return et(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;s(d)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?l.jsx(Sh,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});_h.displayName=di;var Sh=v.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=ln("SelectScrollButton",n),i=v.useRef(null),a=Qo(n),c=v.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),et(()=>{a().find(d=>d.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[a]),l.jsx(Ce.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:we(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:we(o.onPointerMove,()=>{s.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:we(o.onPointerLeave,()=>{c()})})}),B_="SelectSeparator",U_=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return l.jsx(Ce.div,{"aria-hidden":!0,...r,ref:t})});U_.displayName=B_;var fi="SelectArrow",Z_=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=es(n),s=an(fi,n),i=ln(fi,n);return s.open&&i.position==="popper"?l.jsx(Mf,{...o,...r,ref:t}):null});Z_.displayName=fi;var V_="SelectBubbleInput",Ch=v.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=v.useRef(null),s=Pe(r,o),i=Aw(t);return v.useEffect(()=>{const a=o.current;if(!a)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const h=new Event("change",{bubbles:!0});d.call(a,t),a.dispatchEvent(h)}},[i,t]),l.jsx(Ce.select,{...n,style:{...Id,...n.style},ref:s,defaultValue:t})});Ch.displayName=V_;function jh(e){return e===""||e===void 0}function Eh(e){const t=st(e),n=v.useRef(""),r=v.useRef(0),o=v.useCallback(i=>{const a=n.current+i;t(a),(function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(a)},[t]),s=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function Nh(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=H_(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 H_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var W_=rh,q_=sh,K_=ah,J_=lh,G_=ch,Y_=uh,X_=ph,Q_=yh,eS=vh,tS=wh,nS=kh,rS=_h,oS="Separator",Hl="horizontal",sS=["horizontal","vertical"],Th=v.forwardRef((e,t)=>{const{decorative:n,orientation:r=Hl,...o}=e,s=iS(r)?r:Hl,a=n?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return l.jsx(Ce.div,{"data-orientation":s,...a,...o,ref:t})});Th.displayName=oS;function iS(e){return sS.includes(e)}var aS=Th,ts="Tabs",[lS]=Gt(ts,[Ff]),Ah=Ff(),[cS,ya]=lS(ts),Ih=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=$o(a),[h,p]=hn({prop:r,onChange:o,defaultProp:s??"",caller:ts});return l.jsx(cS,{scope:n,baseId:Dt(),value:h,onValueChange:p,orientation:i,dir:d,activationMode:c,children:l.jsx(Ce.div,{dir:d,"data-orientation":i,...u,ref:t})})});Ih.displayName=ts;var zh="TabsList",Ph=v.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=ya(zh,n),i=Ah(n);return l.jsx(a_,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:l.jsx(Ce.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});Ph.displayName=zh;var Rh="TabsTrigger",Oh=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=ya(Rh,n),a=Ah(n),c=Lh(i.baseId,r),u=Fh(i.baseId,r),d=r===i.value;return l.jsx(l_,{asChild:!0,...a,focusable:!o,active:d,children:l.jsx(Ce.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...s,ref:t,onMouseDown:we(e.onMouseDown,h=>{!o&&h.button===0&&h.ctrlKey===!1?i.onValueChange(r):h.preventDefault()}),onKeyDown:we(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&i.onValueChange(r)}),onFocus:we(e.onFocus,()=>{const h=i.activationMode!=="manual";!d&&!o&&h&&i.onValueChange(r)})})})});Oh.displayName=Rh;var Dh="TabsContent",Mh=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,a=ya(Dh,n),c=Lh(a.baseId,r),u=Fh(a.baseId,r),d=r===a.value,h=v.useRef(d);return v.useEffect(()=>{const p=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(p)},[]),l.jsx(kt,{present:o||d,children:({present:p})=>l.jsx(Ce.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!p,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:p&&s})})});Mh.displayName=Dh;function Lh(e,t){return`${e}-trigger-${t}`}function Fh(e,t){return`${e}-content-${t}`}var uS=Ih,dS=Ph,fS=Oh,hS=Mh,[ns]=Gt("Tooltip",[Jo]),rs=Jo(),$h="TooltipProvider",pS=700,hi="tooltip.open",[mS,va]=ns($h),Bh=e=>{const{__scopeTooltip:t,delayDuration:n=pS,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=v.useRef(!0),a=v.useRef(!1),c=v.useRef(0);return v.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),l.jsx(mS,{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:a,onPointerInTransitChange:v.useCallback(u=>{a.current=u},[]),disableHoverableContent:o,children:s})};Bh.displayName=$h;var jr="Tooltip",[gS,Or]=ns(jr),Uh=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:i,delayDuration:a}=e,c=va(jr,e.__scopeTooltip),u=rs(t),[d,h]=v.useState(null),p=Dt(),f=v.useRef(0),g=i??c.disableHoverableContent,m=a??c.delayDuration,x=v.useRef(!1),[y,b]=hn({prop:r,defaultProp:o??!1,onChange:N=>{N?(c.onOpen(),document.dispatchEvent(new CustomEvent(hi))):c.onClose(),s?.(N)},caller:jr}),k=v.useMemo(()=>y?x.current?"delayed-open":"instant-open":"closed",[y]),S=v.useCallback(()=>{window.clearTimeout(f.current),f.current=0,x.current=!1,b(!0)},[b]),j=v.useCallback(()=>{window.clearTimeout(f.current),f.current=0,b(!1)},[b]),C=v.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{x.current=!0,b(!0),f.current=0},m)},[m,b]);return v.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),l.jsx(Rf,{...u,children:l.jsx(gS,{scope:t,contentId:p,open:y,stateAttribute:k,trigger:d,onTriggerChange:h,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayedRef.current?C():S()},[c.isOpenDelayedRef,C,S]),onTriggerLeave:v.useCallback(()=>{g?j():(window.clearTimeout(f.current),f.current=0)},[j,g]),onOpen:S,onClose:j,disableHoverableContent:g,children:n})})};Uh.displayName=jr;var pi="TooltipTrigger",Zh=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Or(pi,n),s=va(pi,n),i=rs(n),a=v.useRef(null),c=Pe(t,a,o.onTriggerChange),u=v.useRef(!1),d=v.useRef(!1),h=v.useCallback(()=>u.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),l.jsx(Of,{asChild:!0,...i,children:l.jsx(Ce.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:c,onPointerMove:we(e.onPointerMove,p=>{p.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:we(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:we(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:we(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:we(e.onBlur,o.onClose),onClick:we(e.onClick,o.onClose)})})});Zh.displayName=pi;var ba="TooltipPortal",[xS,yS]=ns(ba,{forceMount:void 0}),Vh=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=Or(ba,t);return l.jsx(xS,{scope:t,forceMount:n,children:l.jsx(kt,{present:n||s.open,children:l.jsx(Uo,{asChild:!0,container:o,children:r})})})};Vh.displayName=ba;var qn="TooltipContent",Hh=v.forwardRef((e,t)=>{const n=yS(qn,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=Or(qn,e.__scopeTooltip);return l.jsx(kt,{present:r||i.open,children:i.disableHoverableContent?l.jsx(Wh,{side:o,...s,ref:t}):l.jsx(vS,{side:o,...s,ref:t})})}),vS=v.forwardRef((e,t)=>{const n=Or(qn,e.__scopeTooltip),r=va(qn,e.__scopeTooltip),o=v.useRef(null),s=Pe(t,o),[i,a]=v.useState(null),{trigger:c,onClose:u}=n,d=o.current,{onPointerInTransitChange:h}=r,p=v.useCallback(()=>{a(null),h(!1)},[h]),f=v.useCallback((g,m)=>{const x=g.currentTarget,y={x:g.clientX,y:g.clientY},b=_S(y,x.getBoundingClientRect()),k=SS(y,b),S=CS(m.getBoundingClientRect()),j=ES([...k,...S]);a(j),h(!0)},[h]);return v.useEffect(()=>()=>p(),[p]),v.useEffect(()=>{if(c&&d){const g=x=>f(x,d),m=x=>f(x,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",m)}}},[c,d,f,p]),v.useEffect(()=>{if(i){const g=m=>{const x=m.target,y={x:m.clientX,y:m.clientY},b=c?.contains(x)||d?.contains(x),k=!jS(y,i);b?p():k&&(p(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,i,u,p]),l.jsx(Wh,{...e,ref:s})}),[bS,wS]=ns(jr,{isInside:!1}),kS=Zb("TooltipContent"),Wh=v.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...a}=e,c=Or(qn,n),u=rs(n),{onClose:d}=c;return v.useEffect(()=>(document.addEventListener(hi,d),()=>document.removeEventListener(hi,d)),[d]),v.useEffect(()=>{if(c.trigger){const h=p=>{p.target?.contains(c.trigger)&&d()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,d]),l.jsx(Bo,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:l.jsxs(Df,{"data-state":c.stateAttribute,...u,...a,ref:t,style:{...a.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:[l.jsx(kS,{children:r}),l.jsx(bS,{scope:n,isInside:!0,children:l.jsx(Gb,{id:c.contentId,role:"tooltip",children:o||r})})]})})});Hh.displayName=qn;var qh="TooltipArrow",Kh=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=rs(n);return wS(qh,n).isInside?null:l.jsx(Mf,{...o,...r,ref:t})});Kh.displayName=qh;function _S(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 SS(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 CS(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 jS(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 a=t[s],c=t[i],u=a.x,d=a.y,h=c.x,p=c.y;d>r!=p>r&&n<(h-u)*(r-d)/(p-d)+u&&(o=!o)}return o}function ES(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),NS(t)}function NS(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 TS=Bh,AS=Uh,IS=Zh,zS=Vh,PS=Hh,RS=Kh;const OS=Yi("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 xt({className:e,variant:t="default",asChild:n=!1,...r}){const o=n?Bb:"span";return l.jsx(o,{"data-slot":"badge","data-variant":t,className:he(OS({variant:t}),e),...r})}function os({...e}){return l.jsx(_w,{"data-slot":"dialog",...e})}function DS({...e}){return l.jsx(Sw,{"data-slot":"dialog-trigger",...e})}function MS({...e}){return l.jsx(Cw,{"data-slot":"dialog-portal",...e})}function LS({className:e,...t}){return l.jsx(jw,{"data-slot":"dialog-overlay",className:he("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 ss({className:e,children:t,...n}){return l.jsxs(MS,{children:[l.jsx(LS,{}),l.jsxs(Ew,{"data-slot":"dialog-content",className:he("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,l.jsxs(Tw,{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:[l.jsx(Ji,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function is({className:e,...t}){return l.jsx("div",{"data-slot":"dialog-header",className:he("flex flex-col space-y-1.5 text-center sm:text-left",e),...t})}function as({className:e,...t}){return l.jsx(Nw,{"data-slot":"dialog-title",className:he("text-lg font-semibold leading-none tracking-tight",e),...t})}const FS=Yi("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 Xe({className:e,variant:t,size:n,...r}){return l.jsx("button",{"data-slot":"button",className:he(FS({variant:t,size:n,className:e})),...r})}function Jh({open:e,onOpenChange:t,title:n,description:r,confirmLabel:o="Confirm",variant:s="default",onConfirm:i}){return l.jsx(os,{open:e,onOpenChange:t,children:l.jsxs(ss,{children:[l.jsx(is,{children:l.jsx(as,{children:n})}),l.jsx("p",{className:"text-sm text-muted-foreground",children:r}),l.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[l.jsx(Xe,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Cancel"}),l.jsx(Xe,{variant:s,size:"sm",onClick:()=>{i(),t(!1)},children:o})]})]})})}const $S={anthropic:"Anthropic",openai:"OpenAI",unknown:"Unknown"};function Wl(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function BS({conversationId:e,startTime:t,endTime:n,totalCalls:r,totalInputTokens:o,totalOutputTokens:s,apiFormat:i,expanded:a,onToggle:c,hideApiFormat:u=!1,isLoading:d=!1,userAgent:h,onClear:p}){const[f,g]=v.useState(!1),m=x=>{x.stopPropagation(),p!==void 0&&g(!0)};return l.jsxs("div",{role:"button",tabIndex:0,className:he("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"),onClick:c,onKeyDown:x=>{x.target===x.currentTarget&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),c())},children:[a?l.jsx(vt,{className:"size-4 text-muted-foreground shrink-0"}):d?l.jsx(Sr,{className:"size-4 animate-spin text-muted-foreground shrink-0"}):l.jsx(bt,{className:"size-4 text-muted-foreground shrink-0"}),l.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}),h!=null&&h!==""&&l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:h,children:[l.jsx(Rv,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",children:h})]}),!u&&l.jsx(xt,{variant:"outline",className:he("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:$S[i]}),l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(zr,{className:"size-3"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[Wl(t)," - ",Wl(n)]})]}),l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(ld,{className:"size-3"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[r," call",r!==1?"s":""]})]}),l.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[l.jsx(Yn,{className:"size-3 text-muted-foreground"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[l.jsx("span",{className:"text-blue-400",children:qe(o)})," / ",l.jsx("span",{className:"text-amber-400",children:qe(s)})]})]}),l.jsx("span",{className:"flex-1 min-w-0"}),p!==void 0&&l.jsx("button",{type:"button",onClick:m,"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-6 rounded hover:bg-muted cursor-pointer",children:l.jsx(hd,{className:"size-3.5"})}),l.jsx(Jh,{open:f,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:()=>{p?.()}})]})}function US(e){const t=e.find(n=>n.apiFormat!=="unknown");return t!==void 0?t.apiFormat:e[0]?.apiFormat??"unknown"}function ZS(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 So(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 VS(e){const t=new Map;for(const r of e){const o=So(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,a)=>i.timestamp.localeCompare(a.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 ql(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function HS(e){if(e.responseText===null)return null;try{let t=JSON.parse(e.responseText);return typeof t=="string"&&(t=JSON.parse(t)),ql(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&&ql(t.choices[0])&&typeof t.choices[0].finish_reason=="string"&&t.choices[0].finish_reason==="stop"?"stop":null:null}catch{return null}}function Gh(e){return e==="end_turn"||e==="stop"}function St({className:e,style:t,d:n,eyeStalks:r,eyes:o,legs:s,extras:i}){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:t,className:he("inline-block size-5",e),children:[l.jsx("path",{d:n}),r,o,s,i]})}const cn=l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),l.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),l.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),l.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]}),Yh=l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"7",y1:"16",x2:"5.5",y2:"18.5"}),l.jsx("line",{x1:"9.5",y1:"17",x2:"8.5",y2:"19.5"}),l.jsx("line",{x1:"14.5",y1:"17",x2:"15.5",y2:"19.5"}),l.jsx("line",{x1:"17",y1:"16",x2:"18.5",y2:"18.5"})]});function Xh({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"})]}),legs:cn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.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 WS({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"9.5",y1:"6.5",x2:"9.5",y2:"4.5"}),l.jsx("line",{x1:"14.5",y1:"6.5",x2:"14.5",y2:"4.5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"})]}),legs:Yh,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C4 9.5 2.5 10 3 12 C3.5 13.5 4.5 13 5 12"}),l.jsx("path",{d:"M19 11 C20 9.5 21.5 10 21 12 C20.5 13.5 19.5 13 19 12"})]})})}function qS({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"7",y1:"7",x2:"6.5",y2:"4.5"}),l.jsx("line",{x1:"17",y1:"7",x2:"17.5",y2:"4.5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"6.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"17.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:cn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M4 12 C2.5 10.5 1 11 1.5 13 C2 14.5 3.5 14 4.5 13"}),l.jsx("path",{d:"M20 12 C21.5 10.5 23 11 22.5 13 C22 14.5 20.5 14 19.5 13"})]})})}function KS({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"6.5",x2:"10",y2:"3.5"}),l.jsx("line",{x1:"14",y1:"6.5",x2:"14",y2:"3.5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"10",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"7",y1:"17",x2:"5",y2:"20.5"}),l.jsx("line",{x1:"9.5",y1:"18.5",x2:"8.5",y2:"21.5"}),l.jsx("line",{x1:"14.5",y1:"18.5",x2:"15.5",y2:"21.5"}),l.jsx("line",{x1:"17",y1:"17",x2:"19",y2:"20.5"})]}),extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M6.5 11 C5 8.5 3 9 3.5 11.5 C4 13.5 5 13 6 12"}),l.jsx("path",{d:"M17.5 11 C19 8.5 21 9 20.5 11.5 C20 13.5 19 13 18 12"})]})})}function JS({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:cn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.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 GS({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),l.jsx("line",{x1:"13.5",y1:"4",x2:"15.5",y2:"5"})]}),legs:cn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.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 YS({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"8",x2:"10",y2:"6"}),l.jsx("line",{x1:"14",y1:"8",x2:"14",y2:"6"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"9",y1:"6",x2:"11",y2:"6.5"}),l.jsx("line",{x1:"13",y1:"6",x2:"15",y2:"6.5"})]}),legs:Yh,extras:l.jsxs(l.Fragment,{children:[l.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"}),l.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 XS({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:cn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),l.jsx("line",{x1:"8.5",y1:"4",x2:"10.5",y2:"4.5"}),l.jsx("line",{x1:"15.5",y1:"4",x2:"13.5",y2:"4.5"}),l.jsx("path",{d:"M9 15.5 C10 14.5 14 14.5 15 15.5"})]})})}function QS({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"}),l.jsx("circle",{cx:"14.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"})]}),legs:cn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),l.jsx("ellipse",{cx:"12",cy:"15",rx:"2",ry:"1.5",fill:"currentColor",stroke:"none"})]})})}function eC({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"9.5",y1:"7",x2:"9",y2:"5"}),l.jsx("line",{x1:"14.5",y1:"7",x2:"15",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"15",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"})]}),legs:cn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9 2 9.5 2.5 12 C3 14 4 13 5 12"}),l.jsx("path",{d:"M19 11 C20.5 9 22 9.5 21.5 12 C21 14 20 13 19 12"}),l.jsx("path",{d:"M9 14.5 C10 16 14 16 15 14.5"}),l.jsx("circle",{cx:"7",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"}),l.jsx("circle",{cx:"17",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"})]})})}function tC({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5.5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5.5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"7.5",y1:"5.5",x2:"16.5",y2:"5.5"}),l.jsx("rect",{x:"7",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"}),l.jsx("rect",{x:"13",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"})]}),legs:cn,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),l.jsx("path",{d:"M9.5 15 C10.5 16 13.5 16 14.5 15"})]})})}function nC({className:e}){return l.jsx(St,{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:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10.5",y1:"9.5",x2:"10.5",y2:"8"}),l.jsx("line",{x1:"13.5",y1:"9.5",x2:"13.5",y2:"8"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"10.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"13.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"8",y1:"16",x2:"6.5",y2:"18"}),l.jsx("line",{x1:"10",y1:"17",x2:"9.5",y2:"19"}),l.jsx("line",{x1:"14",y1:"17",x2:"14.5",y2:"19"}),l.jsx("line",{x1:"16",y1:"16",x2:"17.5",y2:"18"})]}),extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M7.5 12 C6.5 11 5.5 11.5 6 13 C6.5 14 7 13.5 7.5 13"}),l.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 Co=[Xh,WS,qS,KS,JS,GS,YS,XS,QS,eC,tC,nC];function mi(e){return Co[Math.abs(e)%Co.length]??Xh}const rC="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",oC="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",sC="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",iC="/assets/minimax-BPMzvuL-.jpeg",aC="/assets/alibaba-TTwafVwX.svg",lC="/assets/qwen-CONDcHqt.png",cC="/assets/zhipuai-BPNAnxo-.svg",uC={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen","glm-":"zhipuai"};function Qh(e){if(e===null)return"unknown";const t=e.toLowerCase();for(const[n,r]of Object.entries(uC))if(t.startsWith(n.toLowerCase()))return r;return"unknown"}const wn={width:24,height:24,objectFit:"contain"},dC=at.memo(({className:e})=>l.jsx("img",{src:rC,alt:"Anthropic",className:e,style:wn})),fC=at.memo(({className:e})=>l.jsx("img",{src:oC,alt:"OpenAI",className:e,style:{...wn,background:"white",borderRadius:"4px"}})),hC=at.memo(({className:e})=>l.jsx("img",{src:sC,alt:"DeepSeek",className:e,style:wn})),pC=at.memo(({className:e})=>l.jsx("img",{src:iC,alt:"MiniMax",className:e,style:wn})),mC=at.memo(({className:e})=>l.jsx("img",{src:aC,alt:"Alibaba",className:e,style:wn})),gC=at.memo(({className:e})=>l.jsx("img",{src:lC,alt:"Qwen",className:e,style:wn})),xC=at.memo(({className:e})=>l.jsx("img",{src:cC,alt:"ZhipuAI",className:e,style:wn}));function ep({provider:e,className:t}){switch(e){case"anthropic":return l.jsx(dC,{className:t});case"openai":return l.jsx(fC,{className:t});case"deepseek":return l.jsx(hC,{className:t});case"minimax":return l.jsx(pC,{className:t});case"alibaba":return l.jsx(mC,{className:t});case"qwen":return l.jsx(gC,{className:t});case"zhipuai":return l.jsx(xC,{className:t});case"unknown":return null}}const yC="x-anthropic-billing-header:";function vC(e){return e.trimStart().toLowerCase().startsWith(yC)}function bC(e){return Vu(e)?Object.prototype.hasOwnProperty.call(e,"system"):!1}function wC(e){if(!Vu(e))return!1;const t=ll(e,"type"),n=ll(e,"text");return typeof t!="string"||t!=="text"||typeof n!="string"?!1:vC(n)}function kC(e){let t;try{t=JSON.parse(e)}catch{return{body:e,removed:0}}if(!bC(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(wC(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 Ge({delayDuration:e=0,...t}){return l.jsx(TS,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Me({...e}){return l.jsx(AS,{"data-slot":"tooltip",...e})}function Le({...e}){return l.jsx(IS,{"data-slot":"tooltip-trigger",...e})}function Fe({className:e,sideOffset:t=0,children:n,...r}){return l.jsx(zS,{children:l.jsxs(PS,{"data-slot":"tooltip-content",sideOffset:t,className:he("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,l.jsx(RS,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function _C(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const SC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,CC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jC={};function Kl(e,t){return(jC.jsx?CC:SC).test(e)}const EC=/[ \t\n\f\r]/g;function NC(e){return typeof e=="object"?e.type==="text"?Jl(e.value):!1:Jl(e)}function Jl(e){return e.replace(EC,"")===""}class Dr{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Dr.prototype.normal={};Dr.prototype.property={};Dr.prototype.space=void 0;function tp(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Dr(n,r,t)}function gi(e){return e.toLowerCase()}class dt{constructor(t,n){this.attribute=n,this.property=t}}dt.prototype.attribute="";dt.prototype.booleanish=!1;dt.prototype.boolean=!1;dt.prototype.commaOrSpaceSeparated=!1;dt.prototype.commaSeparated=!1;dt.prototype.defined=!1;dt.prototype.mustUseProperty=!1;dt.prototype.number=!1;dt.prototype.overloadedBoolean=!1;dt.prototype.property="";dt.prototype.spaceSeparated=!1;dt.prototype.space=void 0;let TC=0;const je=kn(),Je=kn(),xi=kn(),ie=kn(),De=kn(),Ln=kn(),ht=kn();function kn(){return 2**++TC}const yi=Object.freeze(Object.defineProperty({__proto__:null,boolean:je,booleanish:Je,commaOrSpaceSeparated:ht,commaSeparated:Ln,number:ie,overloadedBoolean:xi,spaceSeparated:De},Symbol.toStringTag,{value:"Module"})),Ts=Object.keys(yi);class wa extends dt{constructor(t,n,r,o){let s=-1;if(super(t,n),Gl(this,"space",o),typeof r=="number")for(;++s<Ts.length;){const i=Ts[s];Gl(this,Ts[s],(r&yi[i])===yi[i])}}}wa.prototype.defined=!0;function Gl(e,t,n){n&&(e[t]=n)}function rr(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const s=new wa(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[gi(r)]=r,n[gi(s.attribute)]=r}return new Dr(t,n,e.space)}const np=rr({properties:{ariaActiveDescendant:null,ariaAtomic:Je,ariaAutoComplete:null,ariaBusy:Je,ariaChecked:Je,ariaColCount:ie,ariaColIndex:ie,ariaColSpan:ie,ariaControls:De,ariaCurrent:null,ariaDescribedBy:De,ariaDetails:null,ariaDisabled:Je,ariaDropEffect:De,ariaErrorMessage:null,ariaExpanded:Je,ariaFlowTo:De,ariaGrabbed:Je,ariaHasPopup:null,ariaHidden:Je,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:De,ariaLevel:ie,ariaLive:null,ariaModal:Je,ariaMultiLine:Je,ariaMultiSelectable:Je,ariaOrientation:null,ariaOwns:De,ariaPlaceholder:null,ariaPosInSet:ie,ariaPressed:Je,ariaReadOnly:Je,ariaRelevant:null,ariaRequired:Je,ariaRoleDescription:De,ariaRowCount:ie,ariaRowIndex:ie,ariaRowSpan:ie,ariaSelected:Je,ariaSetSize:ie,ariaSort:null,ariaValueMax:ie,ariaValueMin:ie,ariaValueNow:ie,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function rp(e,t){return t in e?e[t]:t}function op(e,t){return rp(e,t.toLowerCase())}const AC=rr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ln,acceptCharset:De,accessKey:De,action:null,allow:null,allowFullScreen:je,allowPaymentRequest:je,allowUserMedia:je,alt:null,as:null,async:je,autoCapitalize:null,autoComplete:De,autoFocus:je,autoPlay:je,blocking:De,capture:null,charSet:null,checked:je,cite:null,className:De,cols:ie,colSpan:null,content:null,contentEditable:Je,controls:je,controlsList:De,coords:ie|Ln,crossOrigin:null,data:null,dateTime:null,decoding:null,default:je,defer:je,dir:null,dirName:null,disabled:je,download:xi,draggable:Je,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:je,formTarget:null,headers:De,height:ie,hidden:xi,high:ie,href:null,hrefLang:null,htmlFor:De,httpEquiv:De,id:null,imageSizes:null,imageSrcSet:null,inert:je,inputMode:null,integrity:null,is:null,isMap:je,itemId:null,itemProp:De,itemRef:De,itemScope:je,itemType:De,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:je,low:ie,manifest:null,max:null,maxLength:ie,media:null,method:null,min:null,minLength:ie,multiple:je,muted:je,name:null,nonce:null,noModule:je,noValidate:je,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:je,optimum:ie,pattern:null,ping:De,placeholder:null,playsInline:je,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:je,referrerPolicy:null,rel:De,required:je,reversed:je,rows:ie,rowSpan:ie,sandbox:De,scope:null,scoped:je,seamless:je,selected:je,shadowRootClonable:je,shadowRootDelegatesFocus:je,shadowRootMode:null,shape:null,size:ie,sizes:null,slot:null,span:ie,spellCheck:Je,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ie,step:null,style:null,tabIndex:ie,target:null,title:null,translate:null,type:null,typeMustMatch:je,useMap:null,value:Je,width:ie,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:De,axis:null,background:null,bgColor:null,border:ie,borderColor:null,bottomMargin:ie,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:je,declare:je,event:null,face:null,frame:null,frameBorder:null,hSpace:ie,leftMargin:ie,link:null,longDesc:null,lowSrc:null,marginHeight:ie,marginWidth:ie,noResize:je,noHref:je,noShade:je,noWrap:je,object:null,profile:null,prompt:null,rev:null,rightMargin:ie,rules:null,scheme:null,scrolling:Je,standby:null,summary:null,text:null,topMargin:ie,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ie,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:je,disableRemotePlayback:je,prefix:null,property:null,results:ie,security:null,unselectable:null},space:"html",transform:op}),IC=rr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ht,accentHeight:ie,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ie,amplitude:ie,arabicForm:null,ascent:ie,attributeName:null,attributeType:null,azimuth:ie,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ie,by:null,calcMode:null,capHeight:ie,className:De,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ie,diffuseConstant:ie,direction:null,display:null,dur:null,divisor:ie,dominantBaseline:null,download:je,dx:null,dy:null,edgeMode:null,editable:null,elevation:ie,enableBackground:null,end:null,event:null,exponent:ie,externalResourcesRequired:null,fill:null,fillOpacity:ie,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ln,g2:Ln,glyphName:Ln,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ie,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ie,horizOriginX:ie,horizOriginY:ie,id:null,ideographic:ie,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ie,k:ie,k1:ie,k2:ie,k3:ie,k4:ie,kernelMatrix:ht,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ie,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ie,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ie,overlineThickness:ie,paintOrder:null,panose1:null,path:null,pathLength:ie,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:De,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ie,pointsAtY:ie,pointsAtZ:ie,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ht,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ht,rev:ht,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ht,requiredFeatures:ht,requiredFonts:ht,requiredFormats:ht,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ie,specularExponent:ie,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ie,strikethroughThickness:ie,string:null,stroke:null,strokeDashArray:ht,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ie,strokeOpacity:ie,strokeWidth:null,style:null,surfaceScale:ie,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ht,tabIndex:ie,tableValues:null,target:null,targetX:ie,targetY:ie,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ht,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ie,underlineThickness:ie,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ie,values:null,vAlphabetic:ie,vMathematical:ie,vectorEffect:null,vHanging:ie,vIdeographic:ie,version:null,vertAdvY:ie,vertOriginX:ie,vertOriginY:ie,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ie,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:rp}),sp=rr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),ip=rr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:op}),ap=rr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),zC={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},PC=/[A-Z]/g,Yl=/-[a-z]/g,RC=/^data[-\w.:]+$/i;function OC(e,t){const n=gi(t);let r=t,o=dt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&RC.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Yl,MC);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Yl.test(s)){let i=s.replace(PC,DC);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}o=wa}return new o(r,t)}function DC(e){return"-"+e.toLowerCase()}function MC(e){return e.charAt(1).toUpperCase()}const LC=tp([np,AC,sp,ip,ap],"html"),ka=tp([np,IC,sp,ip,ap],"svg");function FC(e){return e.join(" ").trim()}var En={},As,Xl;function $C(){if(Xl)return As;Xl=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,i=/^[;\s]*/,a=/^\s+|\s+$/g,c=`
85
+ `,u="/",d="*",h="",p="comment",f="declaration";function g(x,y){if(typeof x!="string")throw new TypeError("First argument must be a string");if(!x)return[];y=y||{};var b=1,k=1;function S(w){var D=w.match(t);D&&(b+=D.length);var W=w.lastIndexOf(c);k=~W?w.length-W:k+w.length}function j(){var w={line:b,column:k};return function(D){return D.position=new C(w),A(),D}}function C(w){this.start=w,this.end={line:b,column:k},this.source=y.source}C.prototype.content=x;function N(w){var D=new Error(y.source+":"+b+":"+k+": "+w);if(D.reason=w,D.filename=y.source,D.line=b,D.column=k,D.source=x,!y.silent)throw D}function T(w){var D=w.exec(x);if(D){var W=D[0];return S(W),x=x.slice(W.length),D}}function A(){T(n)}function R(w){var D;for(w=w||[];D=M();)D!==!1&&w.push(D);return w}function M(){var w=j();if(!(u!=x.charAt(0)||d!=x.charAt(1))){for(var D=2;h!=x.charAt(D)&&(d!=x.charAt(D)||u!=x.charAt(D+1));)++D;if(D+=2,h===x.charAt(D-1))return N("End of comment missing");var W=x.slice(2,D-2);return k+=2,S(W),x=x.slice(D),k+=2,w({type:p,comment:W})}}function E(){var w=j(),D=T(r);if(D){if(M(),!T(o))return N("property missing ':'");var W=T(s),B=w({type:f,property:m(D[0].replace(e,h)),value:W?m(W[0].replace(e,h)):h});return T(i),B}}function L(){var w=[];R(w);for(var D;D=E();)D!==!1&&(w.push(D),R(w));return w}return A(),L()}function m(x){return x?x.replace(a,h):h}return As=g,As}var Ql;function BC(){if(Ql)return En;Ql=1;var e=En&&En.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(En,"__esModule",{value:!0}),En.default=n;const t=e($C());function n(r,o){let s=null;if(!r||typeof r!="string")return s;const i=(0,t.default)(r),a=typeof o=="function";return i.forEach(c=>{if(c.type!=="declaration")return;const{property:u,value:d}=c;a?o(u,d,c):d&&(s=s||{},s[u]=d)}),s}return En}var lr={},ec;function UC(){if(ec)return lr;ec=1,Object.defineProperty(lr,"__esModule",{value:!0}),lr.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,s=function(u){return!u||n.test(u)||e.test(u)},i=function(u,d){return d.toUpperCase()},a=function(u,d){return"".concat(d,"-")},c=function(u,d){return d===void 0&&(d={}),s(u)?u:(u=u.toLowerCase(),d.reactCompat?u=u.replace(o,a):u=u.replace(r,a),u.replace(t,i))};return lr.camelCase=c,lr}var cr,tc;function ZC(){if(tc)return cr;tc=1;var e=cr&&cr.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(BC()),n=UC();function r(o,s){var i={};return!o||typeof o!="string"||(0,t.default)(o,function(a,c){a&&c&&(i[(0,n.camelCase)(a,s)]=c)}),i}return r.default=r,cr=r,cr}var VC=ZC();const HC=Ri(VC),lp=cp("end"),_a=cp("start");function cp(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function WC(e){const t=_a(e),n=lp(e);if(t&&n)return{start:t,end:n}}function xr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?nc(e.position):"start"in e||"end"in e?nc(e):"line"in e||"column"in e?vi(e):""}function vi(e){return rc(e&&e.line)+":"+rc(e&&e.column)}function nc(e){return vi(e&&e.start)+"-"+vi(e&&e.end)}function rc(e){return e&&typeof e=="number"?e:1}class rt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",s={},i=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?o=t:!s.cause&&t&&(i=!0,o=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?s.ruleId=r:(s.source=r.slice(0,c),s.ruleId=r.slice(c+1))}if(!s.place&&s.ancestors&&s.ancestors){const c=s.ancestors[s.ancestors.length-1];c&&(s.place=c.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=a?a.line:void 0,this.name=xr(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=i&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}rt.prototype.file="";rt.prototype.name="";rt.prototype.reason="";rt.prototype.message="";rt.prototype.stack="";rt.prototype.column=void 0;rt.prototype.line=void 0;rt.prototype.ancestors=void 0;rt.prototype.cause=void 0;rt.prototype.fatal=void 0;rt.prototype.place=void 0;rt.prototype.ruleId=void 0;rt.prototype.source=void 0;const Sa={}.hasOwnProperty,qC=new Map,KC=/[A-Z]/g,JC=new Set(["table","tbody","thead","tfoot","tr"]),GC=new Set(["td","th"]),up="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function YC(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=s5(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=o5(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?ka:LC,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=dp(o,e,void 0);return s&&typeof s!="string"?s:o.create(e,o.Fragment,{children:s||void 0},void 0)}function dp(e,t,n){if(t.type==="element")return XC(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return QC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return t5(e,t,n);if(t.type==="mdxjsEsm")return e5(e,t);if(t.type==="root")return n5(e,t,n);if(t.type==="text")return r5(e,t)}function XC(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=ka,e.schema=o),e.ancestors.push(t);const s=hp(e,t.tagName,!1),i=i5(e,t);let a=ja(e,t);return JC.has(t.tagName)&&(a=a.filter(function(c){return typeof c=="string"?!NC(c):!0})),fp(e,i,s,t),Ca(i,a),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function QC(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Er(e,t.position)}function e5(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Er(e,t.position)}function t5(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=ka,e.schema=o),e.ancestors.push(t);const s=t.name===null?e.Fragment:hp(e,t.name,!0),i=a5(e,t),a=ja(e,t);return fp(e,i,s,t),Ca(i,a),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function n5(e,t,n){const r={};return Ca(r,ja(e,t)),e.create(t,e.Fragment,r,n)}function r5(e,t){return t.value}function fp(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ca(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function o5(e,t,n){return r;function r(o,s,i,a){const u=Array.isArray(i.children)?n:t;return a?u(s,i,a):u(s,i)}}function s5(e,t){return n;function n(r,o,s,i){const a=Array.isArray(s.children),c=_a(r);return t(o,s,i,a,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function i5(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&Sa.call(t.properties,o)){const s=l5(e,o,t.properties[o]);if(s){const[i,a]=s;e.tableCellAlignToStyle&&i==="align"&&typeof a=="string"&&GC.has(t.tagName)?r=a:n[i]=a}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function a5(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const i=s.expression;i.type;const a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Er(e,t.position);else{const o=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,s=e.evaluater.evaluateExpression(a.expression)}else Er(e,t.position);else s=r.value===null?!0:r.value;n[o]=s}return n}function ja(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:qC;for(;++r<t.children.length;){const s=t.children[r];let i;if(e.passKeys){const c=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(c){const u=o.get(c)||0;i=c+"-"+u,o.set(c,u+1)}}const a=dp(e,s,i);a!==void 0&&n.push(a)}return n}function l5(e,t,n){const r=OC(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?_C(n):FC(n)),r.property==="style"){let o=typeof n=="object"?n:c5(e,String(n));return e.stylePropertyNameCase==="css"&&(o=u5(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?zC[r.property]||r.property:r.attribute,n]}}function c5(e,t){try{return HC(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,o=new rt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=up+"#cannot-parse-style-attribute",o}}function hp(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let s=-1,i;for(;++s<o.length;){const a=Kl(o[s])?{type:"Identifier",name:o[s]}:{type:"Literal",value:o[s]};i=i?{type:"MemberExpression",object:i,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=i}else r=Kl(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return Sa.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);Er(e)}function Er(e,t){const n=new rt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=up+"#cannot-handle-mdx-estrees-without-createevaluater",n}function u5(e){const t={};let n;for(n in e)Sa.call(e,n)&&(t[d5(n)]=e[n]);return t}function d5(e){let t=e.replace(KC,f5);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function f5(e){return"-"+e.toLowerCase()}const Is={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},h5={};function p5(e,t){const n=h5,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return pp(e,r,o)}function pp(e,t,n){if(m5(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return oc(e.children,t,n)}return Array.isArray(e)?oc(e,t,n):""}function oc(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=pp(e[o],t,n);return r.join("")}function m5(e){return!!(e&&typeof e=="object")}const sc=document.createElement("i");function Ea(e){const t="&"+e+";";sc.innerHTML=t;const n=sc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ft(e,t,n,r){const o=e.length;let s=0,i;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)i=Array.from(r),i.unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);s<r.length;)i=r.slice(s,s+1e4),i.unshift(t,0),e.splice(...i),s+=1e4,t+=1e4}function yt(e,t){return e.length>0?(Ft(e,e.length,0,t),e):t}const ic={}.hasOwnProperty;function g5(e){const t={};let n=-1;for(;++n<e.length;)x5(t,e[n]);return t}function x5(e,t){let n;for(n in t){const o=(ic.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let i;if(s)for(i in s){ic.call(o,i)||(o[i]=[]);const a=s[i];y5(o[i],Array.isArray(a)?a:a?[a]:[])}}}function y5(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ft(e,0,0,r)}function mp(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Fn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Rt=un(/[A-Za-z]/),mt=un(/[\dA-Za-z]/),v5=un(/[#-'*+\--9=?A-Z^-~]/);function bi(e){return e!==null&&(e<32||e===127)}const wi=un(/\d/),b5=un(/[\dA-Fa-f]/),w5=un(/[!-/:-@[-`{-~]/);function _e(e){return e!==null&&e<-2}function ct(e){return e!==null&&(e<0||e===32)}function ze(e){return e===-2||e===-1||e===32}const k5=un(new RegExp("\\p{P}|\\p{S}","u")),_5=un(/\s/);function un(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function or(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const s=e.charCodeAt(n);let i="";if(s===37&&mt(e.charCodeAt(n+1))&&mt(e.charCodeAt(n+2)))o=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(i=String.fromCharCode(s));else if(s>55295&&s<57344){const a=e.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(i=String.fromCharCode(s,a),o=1):i="�"}else i=String.fromCharCode(s);i&&(t.push(e.slice(r,n),encodeURIComponent(i)),r=n+o+1,i=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function $e(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let s=0;return i;function i(c){return ze(c)?(e.enter(n),a(c)):t(c)}function a(c){return ze(c)&&s++<o?(e.consume(c),a):(e.exit(n),t(c))}}const S5={tokenize:C5};function C5(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),$e(e,t,"linePrefix")}function o(a){return e.enter("paragraph"),s(a)}function s(a){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,i(a)}function i(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return _e(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),i)}}const j5={tokenize:E5},ac={tokenize:N5};function E5(e){const t=this,n=[];let r=0,o,s,i;return a;function a(k){if(r<n.length){const S=n[r];return t.containerState=S[1],e.attempt(S[0].continuation,c,u)(k)}return u(k)}function c(k){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&b();const S=t.events.length;let j=S,C;for(;j--;)if(t.events[j][0]==="exit"&&t.events[j][1].type==="chunkFlow"){C=t.events[j][1].end;break}y(r);let N=S;for(;N<t.events.length;)t.events[N][1].end={...C},N++;return Ft(t.events,j+1,0,t.events.slice(S)),t.events.length=N,u(k)}return a(k)}function u(k){if(r===n.length){if(!o)return p(k);if(o.currentConstruct&&o.currentConstruct.concrete)return g(k);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ac,d,h)(k)}function d(k){return o&&b(),y(r),p(k)}function h(k){return t.parser.lazy[t.now().line]=r!==n.length,i=t.now().offset,g(k)}function p(k){return t.containerState={},e.attempt(ac,f,g)(k)}function f(k){return r++,n.push([t.currentConstruct,t.containerState]),p(k)}function g(k){if(k===null){o&&b(),y(0),e.consume(k);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:s}),m(k)}function m(k){if(k===null){x(e.exit("chunkFlow"),!0),y(0),e.consume(k);return}return _e(k)?(e.consume(k),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(k),m)}function x(k,S){const j=t.sliceStream(k);if(S&&j.push(null),k.previous=s,s&&(s.next=k),s=k,o.defineSkip(k.start),o.write(j),t.parser.lazy[k.start.line]){let C=o.events.length;for(;C--;)if(o.events[C][1].start.offset<i&&(!o.events[C][1].end||o.events[C][1].end.offset>i))return;const N=t.events.length;let T=N,A,R;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(A){R=t.events[T][1].end;break}A=!0}for(y(r),C=N;C<t.events.length;)t.events[C][1].end={...R},C++;Ft(t.events,T+1,0,t.events.slice(N)),t.events.length=C}}function y(k){let S=n.length;for(;S-- >k;){const j=n[S];t.containerState=j[1],j[0].exit.call(t,e)}n.length=k}function b(){o.write([null]),s=void 0,o=void 0,t.containerState._closeFlow=void 0}}function N5(e,t,n){return $e(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function lc(e){if(e===null||ct(e)||_5(e))return 1;if(k5(e))return 2}function Na(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const s=e[o].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const ki={name:"attention",resolveAll:T5,tokenize:A5};function T5(e,t){let n=-1,r,o,s,i,a,c,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[r][1].end},p={...e[n][1].start};cc(h,-c),cc(p,c),i={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},a={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},s={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:c>1?"strong":"emphasis",start:{...i.start},end:{...a.end}},e[r][1].end={...i.start},e[n][1].start={...a.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=yt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=yt(u,[["enter",o,t],["enter",i,t],["exit",i,t],["enter",s,t]]),u=yt(u,Na(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=yt(u,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=yt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Ft(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function A5(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=lc(r);let s;return i;function i(c){return s=c,e.enter("attentionSequence"),a(c)}function a(c){if(c===s)return e.consume(c),a;const u=e.exit("attentionSequence"),d=lc(c),h=!d||d===2&&o||n.includes(c),p=!o||o===2&&d||n.includes(r);return u._open=!!(s===42?h:h&&(o||!p)),u._close=!!(s===42?p:p&&(d||!h)),t(c)}}function cc(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const I5={name:"autolink",tokenize:z5};function z5(e,t,n){let r=0;return o;function o(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(f){return Rt(f)?(e.consume(f),i):f===64?n(f):u(f)}function i(f){return f===43||f===45||f===46||mt(f)?(r=1,a(f)):u(f)}function a(f){return f===58?(e.consume(f),r=0,c):(f===43||f===45||f===46||mt(f))&&r++<32?(e.consume(f),a):(r=0,u(f))}function c(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||bi(f)?n(f):(e.consume(f),c)}function u(f){return f===64?(e.consume(f),d):v5(f)?(e.consume(f),u):n(f)}function d(f){return mt(f)?h(f):n(f)}function h(f){return f===46?(e.consume(f),r=0,d):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):p(f)}function p(f){if((f===45||mt(f))&&r++<63){const g=f===45?p:h;return e.consume(f),g}return n(f)}}const ls={partial:!0,tokenize:P5};function P5(e,t,n){return r;function r(s){return ze(s)?$e(e,o,"linePrefix")(s):o(s)}function o(s){return s===null||_e(s)?t(s):n(s)}}const gp={continuation:{tokenize:O5},exit:D5,name:"blockQuote",tokenize:R5};function R5(e,t,n){const r=this;return o;function o(i){if(i===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(i),e.exit("blockQuoteMarker"),s}return n(i)}function s(i){return ze(i)?(e.enter("blockQuotePrefixWhitespace"),e.consume(i),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(i))}}function O5(e,t,n){const r=this;return o;function o(i){return ze(i)?$e(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):s(i)}function s(i){return e.attempt(gp,t,n)(i)}}function D5(e){e.exit("blockQuote")}const xp={name:"characterEscape",tokenize:M5};function M5(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),o}function o(s){return w5(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const yp={name:"characterReference",tokenize:L5};function L5(e,t,n){const r=this;let o=0,s,i;return a;function a(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),c}function c(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),s=31,i=mt,d(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,i=b5,d):(e.enter("characterReferenceValue"),s=7,i=wi,d(h))}function d(h){if(h===59&&o){const p=e.exit("characterReferenceValue");return i===mt&&!Ea(r.sliceSerialize(p))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return i(h)&&o++<s?(e.consume(h),d):n(h)}}const uc={partial:!0,tokenize:$5},dc={concrete:!0,name:"codeFenced",tokenize:F5};function F5(e,t,n){const r=this,o={partial:!0,tokenize:j};let s=0,i=0,a;return c;function c(C){return u(C)}function u(C){const N=r.events[r.events.length-1];return s=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,a=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(C)}function d(C){return C===a?(i++,e.consume(C),d):i<3?n(C):(e.exit("codeFencedFenceSequence"),ze(C)?$e(e,h,"whitespace")(C):h(C))}function h(C){return C===null||_e(C)?(e.exit("codeFencedFence"),r.interrupt?t(C):e.check(uc,m,S)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(C))}function p(C){return C===null||_e(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),h(C)):ze(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),$e(e,f,"whitespace")(C)):C===96&&C===a?n(C):(e.consume(C),p)}function f(C){return C===null||_e(C)?h(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(C))}function g(C){return C===null||_e(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(C)):C===96&&C===a?n(C):(e.consume(C),g)}function m(C){return e.attempt(o,S,x)(C)}function x(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),y}function y(C){return s>0&&ze(C)?$e(e,b,"linePrefix",s+1)(C):b(C)}function b(C){return C===null||_e(C)?e.check(uc,m,S)(C):(e.enter("codeFlowValue"),k(C))}function k(C){return C===null||_e(C)?(e.exit("codeFlowValue"),b(C)):(e.consume(C),k)}function S(C){return e.exit("codeFenced"),t(C)}function j(C,N,T){let A=0;return R;function R(D){return C.enter("lineEnding"),C.consume(D),C.exit("lineEnding"),M}function M(D){return C.enter("codeFencedFence"),ze(D)?$e(C,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):E(D)}function E(D){return D===a?(C.enter("codeFencedFenceSequence"),L(D)):T(D)}function L(D){return D===a?(A++,C.consume(D),L):A>=i?(C.exit("codeFencedFenceSequence"),ze(D)?$e(C,w,"whitespace")(D):w(D)):T(D)}function w(D){return D===null||_e(D)?(C.exit("codeFencedFence"),N(D)):T(D)}}}function $5(e,t,n){const r=this;return o;function o(i){return i===null?n(i):(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s)}function s(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}const zs={name:"codeIndented",tokenize:U5},B5={partial:!0,tokenize:Z5};function U5(e,t,n){const r=this;return o;function o(u){return e.enter("codeIndented"),$e(e,s,"linePrefix",5)(u)}function s(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?i(u):n(u)}function i(u){return u===null?c(u):_e(u)?e.attempt(B5,i,c)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||_e(u)?(e.exit("codeFlowValue"),i(u)):(e.consume(u),a)}function c(u){return e.exit("codeIndented"),t(u)}}function Z5(e,t,n){const r=this;return o;function o(i){return r.parser.lazy[r.now().line]?n(i):_e(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),o):$e(e,s,"linePrefix",5)(i)}function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):_e(i)?o(i):n(i)}}const V5={name:"codeText",previous:W5,resolve:H5,tokenize:q5};function H5(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function W5(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function q5(e,t,n){let r=0,o,s;return i;function i(h){return e.enter("codeText"),e.enter("codeTextSequence"),a(h)}function a(h){return h===96?(e.consume(h),r++,a):(e.exit("codeTextSequence"),c(h))}function c(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),c):h===96?(s=e.enter("codeTextSequence"),o=0,d(h)):_e(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||_e(h)?(e.exit("codeTextData"),c(h)):(e.consume(h),u)}function d(h){return h===96?(e.consume(h),o++,d):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(s.type="codeTextData",u(h))}}class K5{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const o=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&ur(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),ur(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),ur(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);ur(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);ur(this.left,n.reverse())}}}function ur(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function vp(e){const t={};let n=-1,r,o,s,i,a,c,u;const d=new K5(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,s=0,s<c.length&&c[s][1].type==="lineEndingBlank"&&(s+=2),s<c.length&&c[s][1].type==="content"))for(;++s<c.length&&c[s][1].type!=="content";)c[s][1].type==="chunkText"&&(c[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,J5(d,n)),n=t[n],u=!0);else if(r[1]._container){for(s=n,o=void 0;s--;)if(i=d.get(s),i[1].type==="lineEnding"||i[1].type==="lineEndingBlank")i[0]==="enter"&&(o&&(d.get(o)[1].type="lineEndingBlank"),i[1].type="lineEnding",o=s);else if(!(i[1].type==="linePrefix"||i[1].type==="listItemIndent"))break;o&&(r[1].end={...d.get(o)[1].start},a=d.slice(o,n),a.unshift(r),d.splice(o,n-o+1,a))}}return Ft(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function J5(e,t){const n=e.get(t)[1],r=e.get(t)[2];let o=t-1;const s=[];let i=n._tokenizer;i||(i=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(i._contentTypeTextTrailing=!0));const a=i.events,c=[],u={};let d,h,p=-1,f=n,g=0,m=0;const x=[m];for(;f;){for(;e.get(++o)[1]!==f;);s.push(o),f._tokenizer||(d=r.sliceStream(f),f.next||d.push(null),h&&i.defineSkip(f.start),f._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(d),f._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),h=f,f=f.next}for(f=n;++p<a.length;)a[p][0]==="exit"&&a[p-1][0]==="enter"&&a[p][1].type===a[p-1][1].type&&a[p][1].start.line!==a[p][1].end.line&&(m=p+1,x.push(m),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(i.events=[],f?(f._tokenizer=void 0,f.previous=void 0):x.pop(),p=x.length;p--;){const y=a.slice(x[p],x[p+1]),b=s.pop();c.push([b,b+y.length-1]),e.splice(b,2,y)}for(c.reverse(),p=-1;++p<c.length;)u[g+c[p][0]]=g+c[p][1],g+=c[p][1]-c[p][0]-1;return u}const G5={resolve:X5,tokenize:Q5},Y5={partial:!0,tokenize:ej};function X5(e){return vp(e),e}function Q5(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(a)}function o(a){return a===null?s(a):_e(a)?e.check(Y5,i,s)(a):(e.consume(a),o)}function s(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function i(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function ej(e,t,n){const r=this;return o;function o(i){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),$e(e,s,"linePrefix")}function s(i){if(i===null||_e(i))return n(i);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function bp(e,t,n,r,o,s,i,a,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return h;function h(y){return y===60?(e.enter(r),e.enter(o),e.enter(s),e.consume(y),e.exit(s),p):y===null||y===32||y===41||bi(y)?n(y):(e.enter(r),e.enter(i),e.enter(a),e.enter("chunkString",{contentType:"string"}),m(y))}function p(y){return y===62?(e.enter(s),e.consume(y),e.exit(s),e.exit(o),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),f(y))}function f(y){return y===62?(e.exit("chunkString"),e.exit(a),p(y)):y===null||y===60||_e(y)?n(y):(e.consume(y),y===92?g:f)}function g(y){return y===60||y===62||y===92?(e.consume(y),f):f(y)}function m(y){return!d&&(y===null||y===41||ct(y))?(e.exit("chunkString"),e.exit(a),e.exit(i),e.exit(r),t(y)):d<u&&y===40?(e.consume(y),d++,m):y===41?(e.consume(y),d--,m):y===null||y===32||y===40||bi(y)?n(y):(e.consume(y),y===92?x:m)}function x(y){return y===40||y===41||y===92?(e.consume(y),m):m(y)}}function wp(e,t,n,r,o,s){const i=this;let a=0,c;return u;function u(f){return e.enter(r),e.enter(o),e.consume(f),e.exit(o),e.enter(s),d}function d(f){return a>999||f===null||f===91||f===93&&!c||f===94&&!a&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):f===93?(e.exit(s),e.enter(o),e.consume(f),e.exit(o),e.exit(r),t):_e(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(f))}function h(f){return f===null||f===91||f===93||_e(f)||a++>999?(e.exit("chunkString"),d(f)):(e.consume(f),c||(c=!ze(f)),f===92?p:h)}function p(f){return f===91||f===92||f===93?(e.consume(f),a++,h):h(f)}}function kp(e,t,n,r,o,s){let i;return a;function a(p){return p===34||p===39||p===40?(e.enter(r),e.enter(o),e.consume(p),e.exit(o),i=p===40?41:p,c):n(p)}function c(p){return p===i?(e.enter(o),e.consume(p),e.exit(o),e.exit(r),t):(e.enter(s),u(p))}function u(p){return p===i?(e.exit(s),c(i)):p===null?n(p):_e(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),$e(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===i||p===null||_e(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?h:d)}function h(p){return p===i||p===92?(e.consume(p),d):d(p)}}function yr(e,t){let n;return r;function r(o){return _e(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):ze(o)?$e(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const tj={name:"definition",tokenize:rj},nj={partial:!0,tokenize:oj};function rj(e,t,n){const r=this;let o;return s;function s(f){return e.enter("definition"),i(f)}function i(f){return wp.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return o=Fn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),c):n(f)}function c(f){return ct(f)?yr(e,u)(f):u(f)}function u(f){return bp(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function d(f){return e.attempt(nj,h,h)(f)}function h(f){return ze(f)?$e(e,p,"whitespace")(f):p(f)}function p(f){return f===null||_e(f)?(e.exit("definition"),r.parser.defined.push(o),t(f)):n(f)}}function oj(e,t,n){return r;function r(a){return ct(a)?yr(e,o)(a):n(a)}function o(a){return kp(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return ze(a)?$e(e,i,"whitespace")(a):i(a)}function i(a){return a===null||_e(a)?t(a):n(a)}}const sj={name:"hardBreakEscape",tokenize:ij};function ij(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),o}function o(s){return _e(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const aj={name:"headingAtx",resolve:lj,tokenize:cj};function lj(e,t){let n=e.length-2,r=3,o,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ft(e,r,n-r+1,[["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t]])),e}function cj(e,t,n){let r=0;return o;function o(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),i(d)}function i(d){return d===35&&r++<6?(e.consume(d),i):d===null||ct(d)?(e.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||_e(d)?(e.exit("atxHeading"),t(d)):ze(d)?$e(e,a,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),a(d))}function u(d){return d===null||d===35||ct(d)?(e.exit("atxHeadingText"),a(d)):(e.consume(d),u)}}const uj=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],fc=["pre","script","style","textarea"],dj={concrete:!0,name:"htmlFlow",resolveTo:pj,tokenize:mj},fj={partial:!0,tokenize:xj},hj={partial:!0,tokenize:gj};function pj(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function mj(e,t,n){const r=this;let o,s,i,a,c;return u;function u(z){return d(z)}function d(z){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(z),h}function h(z){return z===33?(e.consume(z),p):z===47?(e.consume(z),s=!0,m):z===63?(e.consume(z),o=3,r.interrupt?t:I):Rt(z)?(e.consume(z),i=String.fromCharCode(z),x):n(z)}function p(z){return z===45?(e.consume(z),o=2,f):z===91?(e.consume(z),o=5,a=0,g):Rt(z)?(e.consume(z),o=4,r.interrupt?t:I):n(z)}function f(z){return z===45?(e.consume(z),r.interrupt?t:I):n(z)}function g(z){const oe="CDATA[";return z===oe.charCodeAt(a++)?(e.consume(z),a===oe.length?r.interrupt?t:E:g):n(z)}function m(z){return Rt(z)?(e.consume(z),i=String.fromCharCode(z),x):n(z)}function x(z){if(z===null||z===47||z===62||ct(z)){const oe=z===47,X=i.toLowerCase();return!oe&&!s&&fc.includes(X)?(o=1,r.interrupt?t(z):E(z)):uj.includes(i.toLowerCase())?(o=6,oe?(e.consume(z),y):r.interrupt?t(z):E(z)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(z):s?b(z):k(z))}return z===45||mt(z)?(e.consume(z),i+=String.fromCharCode(z),x):n(z)}function y(z){return z===62?(e.consume(z),r.interrupt?t:E):n(z)}function b(z){return ze(z)?(e.consume(z),b):R(z)}function k(z){return z===47?(e.consume(z),R):z===58||z===95||Rt(z)?(e.consume(z),S):ze(z)?(e.consume(z),k):R(z)}function S(z){return z===45||z===46||z===58||z===95||mt(z)?(e.consume(z),S):j(z)}function j(z){return z===61?(e.consume(z),C):ze(z)?(e.consume(z),j):k(z)}function C(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(e.consume(z),c=z,N):ze(z)?(e.consume(z),C):T(z)}function N(z){return z===c?(e.consume(z),c=null,A):z===null||_e(z)?n(z):(e.consume(z),N)}function T(z){return z===null||z===34||z===39||z===47||z===60||z===61||z===62||z===96||ct(z)?j(z):(e.consume(z),T)}function A(z){return z===47||z===62||ze(z)?k(z):n(z)}function R(z){return z===62?(e.consume(z),M):n(z)}function M(z){return z===null||_e(z)?E(z):ze(z)?(e.consume(z),M):n(z)}function E(z){return z===45&&o===2?(e.consume(z),W):z===60&&o===1?(e.consume(z),B):z===62&&o===4?(e.consume(z),H):z===63&&o===3?(e.consume(z),I):z===93&&o===5?(e.consume(z),Y):_e(z)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(fj,V,L)(z)):z===null||_e(z)?(e.exit("htmlFlowData"),L(z)):(e.consume(z),E)}function L(z){return e.check(hj,w,V)(z)}function w(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),D}function D(z){return z===null||_e(z)?L(z):(e.enter("htmlFlowData"),E(z))}function W(z){return z===45?(e.consume(z),I):E(z)}function B(z){return z===47?(e.consume(z),i="",q):E(z)}function q(z){if(z===62){const oe=i.toLowerCase();return fc.includes(oe)?(e.consume(z),H):E(z)}return Rt(z)&&i.length<8?(e.consume(z),i+=String.fromCharCode(z),q):E(z)}function Y(z){return z===93?(e.consume(z),I):E(z)}function I(z){return z===62?(e.consume(z),H):z===45&&o===2?(e.consume(z),I):E(z)}function H(z){return z===null||_e(z)?(e.exit("htmlFlowData"),V(z)):(e.consume(z),H)}function V(z){return e.exit("htmlFlow"),t(z)}}function gj(e,t,n){const r=this;return o;function o(i){return _e(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s):n(i)}function s(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}function xj(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(ls,t,n)}}const yj={name:"htmlText",tokenize:vj};function vj(e,t,n){const r=this;let o,s,i;return a;function a(I){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(I),c}function c(I){return I===33?(e.consume(I),u):I===47?(e.consume(I),j):I===63?(e.consume(I),k):Rt(I)?(e.consume(I),T):n(I)}function u(I){return I===45?(e.consume(I),d):I===91?(e.consume(I),s=0,g):Rt(I)?(e.consume(I),b):n(I)}function d(I){return I===45?(e.consume(I),f):n(I)}function h(I){return I===null?n(I):I===45?(e.consume(I),p):_e(I)?(i=h,B(I)):(e.consume(I),h)}function p(I){return I===45?(e.consume(I),f):h(I)}function f(I){return I===62?W(I):I===45?p(I):h(I)}function g(I){const H="CDATA[";return I===H.charCodeAt(s++)?(e.consume(I),s===H.length?m:g):n(I)}function m(I){return I===null?n(I):I===93?(e.consume(I),x):_e(I)?(i=m,B(I)):(e.consume(I),m)}function x(I){return I===93?(e.consume(I),y):m(I)}function y(I){return I===62?W(I):I===93?(e.consume(I),y):m(I)}function b(I){return I===null||I===62?W(I):_e(I)?(i=b,B(I)):(e.consume(I),b)}function k(I){return I===null?n(I):I===63?(e.consume(I),S):_e(I)?(i=k,B(I)):(e.consume(I),k)}function S(I){return I===62?W(I):k(I)}function j(I){return Rt(I)?(e.consume(I),C):n(I)}function C(I){return I===45||mt(I)?(e.consume(I),C):N(I)}function N(I){return _e(I)?(i=N,B(I)):ze(I)?(e.consume(I),N):W(I)}function T(I){return I===45||mt(I)?(e.consume(I),T):I===47||I===62||ct(I)?A(I):n(I)}function A(I){return I===47?(e.consume(I),W):I===58||I===95||Rt(I)?(e.consume(I),R):_e(I)?(i=A,B(I)):ze(I)?(e.consume(I),A):W(I)}function R(I){return I===45||I===46||I===58||I===95||mt(I)?(e.consume(I),R):M(I)}function M(I){return I===61?(e.consume(I),E):_e(I)?(i=M,B(I)):ze(I)?(e.consume(I),M):A(I)}function E(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),o=I,L):_e(I)?(i=E,B(I)):ze(I)?(e.consume(I),E):(e.consume(I),w)}function L(I){return I===o?(e.consume(I),o=void 0,D):I===null?n(I):_e(I)?(i=L,B(I)):(e.consume(I),L)}function w(I){return I===null||I===34||I===39||I===60||I===61||I===96?n(I):I===47||I===62||ct(I)?A(I):(e.consume(I),w)}function D(I){return I===47||I===62||ct(I)?A(I):n(I)}function W(I){return I===62?(e.consume(I),e.exit("htmlTextData"),e.exit("htmlText"),t):n(I)}function B(I){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),q}function q(I){return ze(I)?$e(e,Y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):Y(I)}function Y(I){return e.enter("htmlTextData"),i(I)}}const Ta={name:"labelEnd",resolveAll:_j,resolveTo:Sj,tokenize:Cj},bj={tokenize:jj},wj={tokenize:Ej},kj={tokenize:Nj};function _j(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==n.length&&Ft(e,0,e.length,n),e}function Sj(e,t){let n=e.length,r=0,o,s,i,a;for(;n--;)if(o=e[n][1],s){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(i){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(s=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(i=n);const c={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[s][1].start},end:{...e[i][1].end}},d={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[i-2][1].start}};return a=[["enter",c,t],["enter",u,t]],a=yt(a,e.slice(s+1,s+r+3)),a=yt(a,[["enter",d,t]]),a=yt(a,Na(t.parser.constructs.insideSpan.null,e.slice(s+r+4,i-3),t)),a=yt(a,[["exit",d,t],e[i-2],e[i-1],["exit",u,t]]),a=yt(a,e.slice(i+1)),a=yt(a,[["exit",c,t]]),Ft(e,s,e.length,a),e}function Cj(e,t,n){const r=this;let o=r.events.length,s,i;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){s=r.events[o][1];break}return a;function a(p){return s?s._inactive?h(p):(i=r.parser.defined.includes(Fn(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),c):n(p)}function c(p){return p===40?e.attempt(bj,d,i?d:h)(p):p===91?e.attempt(wj,d,i?u:h)(p):i?d(p):h(p)}function u(p){return e.attempt(kj,d,h)(p)}function d(p){return t(p)}function h(p){return s._balanced=!0,n(p)}}function jj(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),o}function o(h){return ct(h)?yr(e,s)(h):s(h)}function s(h){return h===41?d(h):bp(e,i,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function i(h){return ct(h)?yr(e,c)(h):d(h)}function a(h){return n(h)}function c(h){return h===34||h===39||h===40?kp(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return ct(h)?yr(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function Ej(e,t,n){const r=this;return o;function o(a){return wp.call(r,e,s,i,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(Fn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function i(a){return n(a)}}function Nj(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),o}function o(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const Tj={name:"labelStartImage",resolveAll:Ta.resolveAll,tokenize:Aj};function Aj(e,t,n){const r=this;return o;function o(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),s}function s(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),i):n(a)}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Ij={name:"labelStartLink",resolveAll:Ta.resolveAll,tokenize:zj};function zj(e,t,n){const r=this;return o;function o(i){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(i),e.exit("labelMarker"),e.exit("labelLink"),s}function s(i){return i===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(i):t(i)}}const Ps={name:"lineEnding",tokenize:Pj};function Pj(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),$e(e,t,"linePrefix")}}const ao={name:"thematicBreak",tokenize:Rj};function Rj(e,t,n){let r=0,o;return s;function s(u){return e.enter("thematicBreak"),i(u)}function i(u){return o=u,a(u)}function a(u){return u===o?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||_e(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===o?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),ze(u)?$e(e,a,"whitespace")(u):a(u))}}const it={continuation:{tokenize:Lj},exit:$j,name:"list",tokenize:Mj},Oj={partial:!0,tokenize:Bj},Dj={partial:!0,tokenize:Fj};function Mj(e,t,n){const r=this,o=r.events[r.events.length-1];let s=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,i=0;return a;function a(f){const g=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:wi(f)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(ao,n,u)(f):u(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(f)}return n(f)}function c(f){return wi(f)&&++i<10?(e.consume(f),c):(!r.interrupt||i<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),u(f)):n(f)}function u(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(ls,r.interrupt?n:d,e.attempt(Oj,p,h))}function d(f){return r.containerState.initialBlankLine=!0,s++,p(f)}function h(f){return ze(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),p):n(f)}function p(f){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function Lj(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ls,o,s);function o(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,$e(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!ze(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Dj,t,i)(a))}function i(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,$e(e,e.attempt(it,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Fj(e,t,n){const r=this;return $e(e,o,"listItemIndent",r.containerState.size+1);function o(s){const i=r.events[r.events.length-1];return i&&i[1].type==="listItemIndent"&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(s):n(s)}}function $j(e){e.exit(this.containerState.type)}function Bj(e,t,n){const r=this;return $e(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(s){const i=r.events[r.events.length-1];return!ze(s)&&i&&i[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const hc={name:"setextUnderline",resolveTo:Uj,tokenize:Zj};function Uj(e,t){let n=e.length,r,o,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const i={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",s?(e.splice(o,0,["enter",i,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=i,e.push(["exit",i,t]),e}function Zj(e,t,n){const r=this;let o;return s;function s(u){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),o=u,i(u)):n(u)}function i(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===o?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),ze(u)?$e(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||_e(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const Vj={tokenize:Hj};function Hj(e){const t=this,n=e.attempt(ls,r,e.attempt(this.parser.constructs.flowInitial,o,$e(e,e.attempt(this.parser.constructs.flow,o,e.attempt(G5,o)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Wj={resolveAll:Sp()},qj=_p("string"),Kj=_p("text");function _p(e){return{resolveAll:Sp(e==="text"?Jj:void 0),tokenize:t};function t(n){const r=this,o=this.parser.constructs[e],s=n.attempt(o,i,a);return i;function i(d){return u(d)?s(d):a(d)}function a(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),s(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const h=o[d];let p=-1;if(h)for(;++p<h.length;){const f=h[p];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function Sp(e){return t;function t(n,r){let o=-1,s;for(;++o<=n.length;)s===void 0?n[o]&&n[o][1].type==="data"&&(s=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==s+2&&(n[s][1].end=n[o-1][1].end,n.splice(s+2,o-s-2),o=s+2),s=void 0);return e?e(n,r):n}}function Jj(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],o=t.sliceStream(r);let s=o.length,i=-1,a=0,c;for(;s--;){const u=o[s];if(typeof u=="string"){for(i=u.length;u.charCodeAt(i-1)===32;)a++,i--;if(i)break;i=-1}else if(u===-2)c=!0,a++;else if(u!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const u={type:n===e.length||c||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?i:r.start._bufferIndex+i,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const Gj={42:it,43:it,45:it,48:it,49:it,50:it,51:it,52:it,53:it,54:it,55:it,56:it,57:it,62:gp},Yj={91:tj},Xj={[-2]:zs,[-1]:zs,32:zs},Qj={35:aj,42:ao,45:[hc,ao],60:dj,61:hc,95:ao,96:dc,126:dc},eE={38:yp,92:xp},tE={[-5]:Ps,[-4]:Ps,[-3]:Ps,33:Tj,38:yp,42:ki,60:[I5,yj],91:Ij,92:[sj,xp],93:Ta,95:ki,96:V5},nE={null:[ki,Wj]},rE={null:[42,95]},oE={null:[]},sE=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:rE,contentInitial:Yj,disable:oE,document:Gj,flow:Qj,flowInitial:Xj,insideSpan:nE,string:eE,text:tE},Symbol.toStringTag,{value:"Module"}));function iE(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},s=[];let i=[],a=[];const c={attempt:N(j),check:N(C),consume:b,enter:k,exit:S,interrupt:N(C,{interrupt:!0})},u={code:null,containerState:{},defineSkip:m,events:[],now:g,parser:e,previous:null,sliceSerialize:p,sliceStream:f,write:h};let d=t.tokenize.call(u,c);return t.resolveAll&&s.push(t),u;function h(M){return i=yt(i,M),x(),i[i.length-1]!==null?[]:(T(t,0),u.events=Na(s,u.events,u),u.events)}function p(M,E){return lE(f(M),E)}function f(M){return aE(i,M)}function g(){const{_bufferIndex:M,_index:E,line:L,column:w,offset:D}=r;return{_bufferIndex:M,_index:E,line:L,column:w,offset:D}}function m(M){o[M.line]=M.column,R()}function x(){let M;for(;r._index<i.length;){const E=i[r._index];if(typeof E=="string")for(M=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===M&&r._bufferIndex<E.length;)y(E.charCodeAt(r._bufferIndex));else y(E)}}function y(M){d=d(M)}function b(M){_e(M)?(r.line++,r.column=1,r.offset+=M===-3?2:1,R()):M!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===i[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=M}function k(M,E){const L=E||{};return L.type=M,L.start=g(),u.events.push(["enter",L,u]),a.push(L),L}function S(M){const E=a.pop();return E.end=g(),u.events.push(["exit",E,u]),E}function j(M,E){T(M,E.from)}function C(M,E){E.restore()}function N(M,E){return L;function L(w,D,W){let B,q,Y,I;return Array.isArray(w)?V(w):"tokenize"in w?V([w]):H(w);function H(de){return te;function te(ce){const fe=ce!==null&&de[ce],ge=ce!==null&&de.null,xe=[...Array.isArray(fe)?fe:fe?[fe]:[],...Array.isArray(ge)?ge:ge?[ge]:[]];return V(xe)(ce)}}function V(de){return B=de,q=0,de.length===0?W:z(de[q])}function z(de){return te;function te(ce){return I=A(),Y=de,de.partial||(u.currentConstruct=de),de.name&&u.parser.constructs.disable.null.includes(de.name)?X():de.tokenize.call(E?Object.assign(Object.create(u),E):u,c,oe,X)(ce)}}function oe(de){return M(Y,I),D}function X(de){return I.restore(),++q<B.length?z(B[q]):W}}}function T(M,E){M.resolveAll&&!s.includes(M)&&s.push(M),M.resolve&&Ft(u.events,E,u.events.length-E,M.resolve(u.events.slice(E),u)),M.resolveTo&&(u.events=M.resolveTo(u.events,u))}function A(){const M=g(),E=u.previous,L=u.currentConstruct,w=u.events.length,D=Array.from(a);return{from:w,restore:W};function W(){r=M,u.previous=E,u.currentConstruct=L,u.events.length=w,a=D,R()}}function R(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function aE(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,s=t.end._bufferIndex;let i;if(n===o)i=[e[n].slice(r,s)];else{if(i=e.slice(n,o),r>-1){const a=i[0];typeof a=="string"?i[0]=a.slice(r):i.shift()}s>0&&i.push(e[o].slice(0,s))}return i}function lE(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const s=e[n];let i;if(typeof s=="string")i=s;else switch(s){case-5:{i="\r";break}case-4:{i=`
86
86
  `;break}case-3:{i=`\r
87
- `;break}case-2:{i=t?" ":" ";break}case-1:{if(!t&&o)continue;i=" ";break}default:i=String.fromCharCode(s)}o=s===-2,r.push(i)}return r.join("")}function iE(e){const r={constructs:h5([nE,...(e||{}).extensions||[]]),content:o(w5),defined:[],document:o(_5),flow:o(Bj),lazy:{},string:o(Vj),text:o(Wj)};return r;function o(s){return i;function i(a){return rE(r,s,a)}}}function aE(e){for(;!gp(e););return e}const hc=/[\0\t\n\r]/g;function lE(){let e=1,t="",n=!0,r;return o;function o(s,i,a){const c=[];let u,d,h,p,f;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(i||void 0).decode(s)),h=0,t="",n&&(s.charCodeAt(0)===65279&&h++,n=void 0);h<s.length;){if(hc.lastIndex=h,u=hc.exec(s),p=u&&u.index!==void 0?u.index:s.length,f=s.charCodeAt(p),!u){t=s.slice(h);break}if(f===10&&h===p&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),h<p&&(c.push(s.slice(h,p)),e+=p-h),f){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}h=p+1}return a&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const cE=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function uE(e){return e.replace(cE,dE)}function dE(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),s=o===120||o===88;return fp(n.slice(s?2:1),s?16:10)}return ja(n)||e}const kp={}.hasOwnProperty;function fE(e,t,n){return typeof t!="string"&&(n=t,t=void 0),hE(n)(aE(iE(n).document().write(lE()(e,t,!0))))}function hE(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(F),autolinkProtocol:A,autolinkEmail:A,atxHeading:s(ee),blockQuote:s(ge),characterEscape:A,characterReference:A,codeFenced:s(xe),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:s(xe,i),codeText:s(Ee,i),codeTextData:A,data:A,codeFlowValue:A,definition:s(Oe),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:s(_),hardBreakEscape:s(G),hardBreakTrailing:s(G),htmlFlow:s(P,i),htmlFlowData:A,htmlText:s(P,i),htmlTextData:A,image:s(R),label:i,link:s(F),listItem:s(J),listItemValue:p,listOrdered:s(U,h),listUnordered:s(U),paragraph:s($),reference:z,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:s(ee),strong:s(ne),thematicBreak:s(se)},exit:{atxHeading:c(),atxHeadingSequence:C,autolink:c(),autolinkEmail:fe,autolinkProtocol:ce,blockQuote:c(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:X,characterReferenceMarkerNumeric:X,characterReferenceValue:de,characterReference:te,codeFenced:c(x),codeFencedFence:m,codeFencedFenceInfo:f,codeFencedFenceMeta:g,codeFlowValue:O,codeIndented:c(y),codeText:c(D),codeTextData:O,data:O,definition:c(),definitionDestinationString:S,definitionLabelString:b,definitionTitleString:k,emphasis:c(),hardBreakEscape:c(E),hardBreakTrailing:c(E),htmlFlow:c(M),htmlFlowData:O,htmlText:c(w),htmlTextData:O,image:c(B),label:Y,labelText:q,lineEnding:L,link:c(H),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:oe,resourceDestinationString:I,resourceTitleString:W,resource:V,setextHeading:c(T),setextHeadingLineSequence:N,setextHeadingText:j,strong:c(),thematicBreak:c()}};_p(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Z){let re={type:"root",children:[]};const ue={stack:[re],tokenStack:[],config:t,enter:a,exit:u,buffer:i,resume:d,data:n},be=[];let Ae=-1;for(;++Ae<Z.length;)if(Z[Ae][1].type==="listOrdered"||Z[Ae][1].type==="listUnordered")if(Z[Ae][0]==="enter")be.push(Ae);else{const He=be.pop();Ae=o(Z,He,Ae)}for(Ae=-1;++Ae<Z.length;){const He=t[Z[Ae][0]];kp.call(He,Z[Ae][1].type)&&He[Z[Ae][1].type].call(Object.assign({sliceSerialize:Z[Ae][2].sliceSerialize},ue),Z[Ae][1])}if(ue.tokenStack.length>0){const He=ue.tokenStack[ue.tokenStack.length-1];(He[1]||pc).call(ue,void 0,He[0])}for(re.position={start:Xt(Z.length>0?Z[0][1].start:{line:1,column:1,offset:0}),end:Xt(Z.length>0?Z[Z.length-2][1].end:{line:1,column:1,offset:0})},Ae=-1;++Ae<t.transforms.length;)re=t.transforms[Ae](re)||re;return re}function o(Z,re,ue){let be=re-1,Ae=-1,He=!1,ft,Ie,It,Ut;for(;++be<=ue;){const Ve=Z[be];switch(Ve[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ve[0]==="enter"?Ae++:Ae--,Ut=void 0;break}case"lineEndingBlank":{Ve[0]==="enter"&&(ft&&!Ut&&!Ae&&!It&&(It=be),Ut=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ut=void 0}if(!Ae&&Ve[0]==="enter"&&Ve[1].type==="listItemPrefix"||Ae===-1&&Ve[0]==="exit"&&(Ve[1].type==="listUnordered"||Ve[1].type==="listOrdered")){if(ft){let Zt=be;for(Ie=void 0;Zt--;){const Ct=Z[Zt];if(Ct[1].type==="lineEnding"||Ct[1].type==="lineEndingBlank"){if(Ct[0]==="exit")continue;Ie&&(Z[Ie][1].type="lineEndingBlank",He=!0),Ct[1].type="lineEnding",Ie=Zt}else if(!(Ct[1].type==="linePrefix"||Ct[1].type==="blockQuotePrefix"||Ct[1].type==="blockQuotePrefixWhitespace"||Ct[1].type==="blockQuoteMarker"||Ct[1].type==="listItemIndent"))break}It&&(!Ie||It<Ie)&&(ft._spread=!0),ft.end=Object.assign({},Ie?Z[Ie][1].start:Ve[1].end),Z.splice(Ie||be,0,["exit",ft,Ve[2]]),be++,ue++}if(Ve[1].type==="listItemPrefix"){const Zt={type:"listItem",_spread:!1,start:Object.assign({},Ve[1].start),end:void 0};ft=Zt,Z.splice(be,0,["enter",Zt,Ve[2]]),be++,ue++,It=void 0,Ut=!0}}}return Z[re][1]._spread=He,ue}function s(Z,re){return ue;function ue(be){a.call(this,Z(be),be),re&&re.call(this,be)}}function i(){this.stack.push({type:"fragment",children:[]})}function a(Z,re,ue){this.stack[this.stack.length-1].children.push(Z),this.stack.push(Z),this.tokenStack.push([re,ue||void 0]),Z.position={start:Xt(re.start),end:void 0}}function c(Z){return re;function re(ue){Z&&Z.call(this,ue),u.call(this,ue)}}function u(Z,re){const ue=this.stack.pop(),be=this.tokenStack.pop();if(be)be[0].type!==Z.type&&(re?re.call(this,Z,be[0]):(be[1]||pc).call(this,Z,be[0]));else throw new Error("Cannot close `"+Z.type+"` ("+yr({start:Z.start,end:Z.end})+"): it’s not open");ue.position.end=Xt(Z.end)}function d(){return d5(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function p(Z){if(this.data.expectingFirstListItemValue){const re=this.stack[this.stack.length-2];re.start=Number.parseInt(this.sliceSerialize(Z),10),this.data.expectingFirstListItemValue=void 0}}function f(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.lang=Z}function g(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.meta=Z}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.value=Z.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.value=Z.replace(/(\r?\n|\r)$/g,"")}function b(Z){const re=this.resume(),ue=this.stack[this.stack.length-1];ue.label=re,ue.identifier=$n(this.sliceSerialize(Z)).toLowerCase()}function k(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.title=Z}function S(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.url=Z}function C(Z){const re=this.stack[this.stack.length-1];if(!re.depth){const ue=this.sliceSerialize(Z).length;re.depth=ue}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function N(Z){const re=this.stack[this.stack.length-1];re.depth=this.sliceSerialize(Z).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function A(Z){const ue=this.stack[this.stack.length-1].children;let be=ue[ue.length-1];(!be||be.type!=="text")&&(be=le(),be.position={start:Xt(Z.start),end:void 0},ue.push(be)),this.stack.push(be)}function O(Z){const re=this.stack.pop();re.value+=this.sliceSerialize(Z),re.position.end=Xt(Z.end)}function L(Z){const re=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ue=re.children[re.children.length-1];ue.position.end=Xt(Z.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(re.type)&&(A.call(this,Z),O.call(this,Z))}function E(){this.data.atHardBreak=!0}function M(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.value=Z}function w(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.value=Z}function D(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.value=Z}function H(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const re=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=re,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function B(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const re=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=re,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function q(Z){const re=this.sliceSerialize(Z),ue=this.stack[this.stack.length-2];ue.label=uE(re),ue.identifier=$n(re).toLowerCase()}function Y(){const Z=this.stack[this.stack.length-1],re=this.resume(),ue=this.stack[this.stack.length-1];if(this.data.inReference=!0,ue.type==="link"){const be=Z.children;ue.children=be}else ue.alt=re}function I(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.url=Z}function W(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.title=Z}function V(){this.data.inReference=void 0}function z(){this.data.referenceType="collapsed"}function oe(Z){const re=this.resume(),ue=this.stack[this.stack.length-1];ue.label=re,ue.identifier=$n(this.sliceSerialize(Z)).toLowerCase(),this.data.referenceType="full"}function X(Z){this.data.characterReferenceType=Z.type}function de(Z){const re=this.sliceSerialize(Z),ue=this.data.characterReferenceType;let be;ue?(be=fp(re,ue==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):be=ja(re);const Ae=this.stack[this.stack.length-1];Ae.value+=be}function te(Z){const re=this.stack.pop();re.position.end=Xt(Z.end)}function ce(Z){O.call(this,Z);const re=this.stack[this.stack.length-1];re.url=this.sliceSerialize(Z)}function fe(Z){O.call(this,Z);const re=this.stack[this.stack.length-1];re.url="mailto:"+this.sliceSerialize(Z)}function ge(){return{type:"blockquote",children:[]}}function xe(){return{type:"code",lang:null,meta:null,value:""}}function Ee(){return{type:"inlineCode",value:""}}function Oe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function _(){return{type:"emphasis",children:[]}}function ee(){return{type:"heading",depth:0,children:[]}}function G(){return{type:"break"}}function P(){return{type:"html",value:""}}function R(){return{type:"image",title:null,url:"",alt:null}}function F(){return{type:"link",title:null,url:"",children:[]}}function U(Z){return{type:"list",ordered:Z.type==="listOrdered",start:null,spread:Z._spread,children:[]}}function J(Z){return{type:"listItem",spread:Z._spread,checked:null,children:[]}}function $(){return{type:"paragraph",children:[]}}function ne(){return{type:"strong",children:[]}}function le(){return{type:"text",value:""}}function se(){return{type:"thematicBreak"}}}function Xt(e){return{line:e.line,column:e.column,offset:e.offset}}function _p(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?_p(e,r):pE(e,r)}}function pE(e,t){let n;for(n in t)if(kp.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function pc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+yr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+yr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+yr({start:t.start,end:t.end})+") is still open")}function mE(e){const t=this;t.parser=n;function n(r){return fE(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function gE(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function xE(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
88
- `}]}function yE(e,t){const n=t.value?t.value+`
89
- `:"",r={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function vE(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function bE(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function wE(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=sr(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let i,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),i=e.footnoteOrder.length):i=s+1,a+=1,e.footnoteCounts.set(r,a);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function kE(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _E(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Sp(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const o=e.all(t),s=o[0];s&&s.type==="text"?s.value="["+s.value:o.unshift({type:"text",value:"["});const i=o[o.length-1];return i&&i.type==="text"?i.value+=r:o.push({type:"text",value:r}),o}function SE(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Sp(e,t);const o={src:sr(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(o.title=r.title);const s={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,s),e.applyData(t,s)}function CE(e,t){const n={src:sr(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function jE(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function EE(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Sp(e,t);const o={href:sr(r.url||"")};r.title!==null&&r.title!==void 0&&(o.title=r.title);const s={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function NE(e,t){const n={href:sr(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function TE(e,t,n){const r=e.all(t),o=n?AE(n):Cp(t),s={},i=[];if(typeof t.checked=="boolean"){const d=r[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const d=r[a];(o||a!==0||d.type!=="element"||d.tagName!=="p")&&i.push({type:"text",value:`
87
+ `;break}case-2:{i=t?" ":" ";break}case-1:{if(!t&&o)continue;i=" ";break}default:i=String.fromCharCode(s)}o=s===-2,r.push(i)}return r.join("")}function cE(e){const r={constructs:g5([sE,...(e||{}).extensions||[]]),content:o(S5),defined:[],document:o(j5),flow:o(Vj),lazy:{},string:o(qj),text:o(Kj)};return r;function o(s){return i;function i(a){return iE(r,s,a)}}}function uE(e){for(;!vp(e););return e}const pc=/[\0\t\n\r]/g;function dE(){let e=1,t="",n=!0,r;return o;function o(s,i,a){const c=[];let u,d,h,p,f;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(i||void 0).decode(s)),h=0,t="",n&&(s.charCodeAt(0)===65279&&h++,n=void 0);h<s.length;){if(pc.lastIndex=h,u=pc.exec(s),p=u&&u.index!==void 0?u.index:s.length,f=s.charCodeAt(p),!u){t=s.slice(h);break}if(f===10&&h===p&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),h<p&&(c.push(s.slice(h,p)),e+=p-h),f){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}h=p+1}return a&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const fE=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function hE(e){return e.replace(fE,pE)}function pE(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),s=o===120||o===88;return mp(n.slice(s?2:1),s?16:10)}return Ea(n)||e}const Cp={}.hasOwnProperty;function mE(e,t,n){return typeof t!="string"&&(n=t,t=void 0),gE(n)(uE(cE(n).document().write(dE()(e,t,!0))))}function gE(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(F),autolinkProtocol:A,autolinkEmail:A,atxHeading:s(ee),blockQuote:s(ge),characterEscape:A,characterReference:A,codeFenced:s(xe),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:s(xe,i),codeText:s(Ee,i),codeTextData:A,data:A,codeFlowValue:A,definition:s(Oe),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:s(_),hardBreakEscape:s(J),hardBreakTrailing:s(J),htmlFlow:s(O,i),htmlFlowData:A,htmlText:s(O,i),htmlTextData:A,image:s(P),label:i,link:s(F),listItem:s(G),listItemValue:p,listOrdered:s(U,h),listUnordered:s(U),paragraph:s($),reference:z,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:s(ee),strong:s(ne),thematicBreak:s(se)},exit:{atxHeading:c(),atxHeadingSequence:j,autolink:c(),autolinkEmail:fe,autolinkProtocol:ce,blockQuote:c(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:X,characterReferenceMarkerNumeric:X,characterReferenceValue:de,characterReference:te,codeFenced:c(x),codeFencedFence:m,codeFencedFenceInfo:f,codeFencedFenceMeta:g,codeFlowValue:R,codeIndented:c(y),codeText:c(D),codeTextData:R,data:R,definition:c(),definitionDestinationString:S,definitionLabelString:b,definitionTitleString:k,emphasis:c(),hardBreakEscape:c(E),hardBreakTrailing:c(E),htmlFlow:c(L),htmlFlowData:R,htmlText:c(w),htmlTextData:R,image:c(B),label:Y,labelText:q,lineEnding:M,link:c(W),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:oe,resourceDestinationString:I,resourceTitleString:H,resource:V,setextHeading:c(T),setextHeadingLineSequence:N,setextHeadingText:C,strong:c(),thematicBreak:c()}};jp(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(Z){let re={type:"root",children:[]};const ue={stack:[re],tokenStack:[],config:t,enter:a,exit:u,buffer:i,resume:d,data:n},be=[];let Ae=-1;for(;++Ae<Z.length;)if(Z[Ae][1].type==="listOrdered"||Z[Ae][1].type==="listUnordered")if(Z[Ae][0]==="enter")be.push(Ae);else{const We=be.pop();Ae=o(Z,We,Ae)}for(Ae=-1;++Ae<Z.length;){const We=t[Z[Ae][0]];Cp.call(We,Z[Ae][1].type)&&We[Z[Ae][1].type].call(Object.assign({sliceSerialize:Z[Ae][2].sliceSerialize},ue),Z[Ae][1])}if(ue.tokenStack.length>0){const We=ue.tokenStack[ue.tokenStack.length-1];(We[1]||mc).call(ue,void 0,We[0])}for(re.position={start:Xt(Z.length>0?Z[0][1].start:{line:1,column:1,offset:0}),end:Xt(Z.length>0?Z[Z.length-2][1].end:{line:1,column:1,offset:0})},Ae=-1;++Ae<t.transforms.length;)re=t.transforms[Ae](re)||re;return re}function o(Z,re,ue){let be=re-1,Ae=-1,We=!1,ft,Ie,It,Ut;for(;++be<=ue;){const Ve=Z[be];switch(Ve[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ve[0]==="enter"?Ae++:Ae--,Ut=void 0;break}case"lineEndingBlank":{Ve[0]==="enter"&&(ft&&!Ut&&!Ae&&!It&&(It=be),Ut=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ut=void 0}if(!Ae&&Ve[0]==="enter"&&Ve[1].type==="listItemPrefix"||Ae===-1&&Ve[0]==="exit"&&(Ve[1].type==="listUnordered"||Ve[1].type==="listOrdered")){if(ft){let Zt=be;for(Ie=void 0;Zt--;){const Ct=Z[Zt];if(Ct[1].type==="lineEnding"||Ct[1].type==="lineEndingBlank"){if(Ct[0]==="exit")continue;Ie&&(Z[Ie][1].type="lineEndingBlank",We=!0),Ct[1].type="lineEnding",Ie=Zt}else if(!(Ct[1].type==="linePrefix"||Ct[1].type==="blockQuotePrefix"||Ct[1].type==="blockQuotePrefixWhitespace"||Ct[1].type==="blockQuoteMarker"||Ct[1].type==="listItemIndent"))break}It&&(!Ie||It<Ie)&&(ft._spread=!0),ft.end=Object.assign({},Ie?Z[Ie][1].start:Ve[1].end),Z.splice(Ie||be,0,["exit",ft,Ve[2]]),be++,ue++}if(Ve[1].type==="listItemPrefix"){const Zt={type:"listItem",_spread:!1,start:Object.assign({},Ve[1].start),end:void 0};ft=Zt,Z.splice(be,0,["enter",Zt,Ve[2]]),be++,ue++,It=void 0,Ut=!0}}}return Z[re][1]._spread=We,ue}function s(Z,re){return ue;function ue(be){a.call(this,Z(be),be),re&&re.call(this,be)}}function i(){this.stack.push({type:"fragment",children:[]})}function a(Z,re,ue){this.stack[this.stack.length-1].children.push(Z),this.stack.push(Z),this.tokenStack.push([re,ue||void 0]),Z.position={start:Xt(re.start),end:void 0}}function c(Z){return re;function re(ue){Z&&Z.call(this,ue),u.call(this,ue)}}function u(Z,re){const ue=this.stack.pop(),be=this.tokenStack.pop();if(be)be[0].type!==Z.type&&(re?re.call(this,Z,be[0]):(be[1]||mc).call(this,Z,be[0]));else throw new Error("Cannot close `"+Z.type+"` ("+xr({start:Z.start,end:Z.end})+"): it’s not open");ue.position.end=Xt(Z.end)}function d(){return p5(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function p(Z){if(this.data.expectingFirstListItemValue){const re=this.stack[this.stack.length-2];re.start=Number.parseInt(this.sliceSerialize(Z),10),this.data.expectingFirstListItemValue=void 0}}function f(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.lang=Z}function g(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.meta=Z}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.value=Z.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.value=Z.replace(/(\r?\n|\r)$/g,"")}function b(Z){const re=this.resume(),ue=this.stack[this.stack.length-1];ue.label=re,ue.identifier=Fn(this.sliceSerialize(Z)).toLowerCase()}function k(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.title=Z}function S(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.url=Z}function j(Z){const re=this.stack[this.stack.length-1];if(!re.depth){const ue=this.sliceSerialize(Z).length;re.depth=ue}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function N(Z){const re=this.stack[this.stack.length-1];re.depth=this.sliceSerialize(Z).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function A(Z){const ue=this.stack[this.stack.length-1].children;let be=ue[ue.length-1];(!be||be.type!=="text")&&(be=le(),be.position={start:Xt(Z.start),end:void 0},ue.push(be)),this.stack.push(be)}function R(Z){const re=this.stack.pop();re.value+=this.sliceSerialize(Z),re.position.end=Xt(Z.end)}function M(Z){const re=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ue=re.children[re.children.length-1];ue.position.end=Xt(Z.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(re.type)&&(A.call(this,Z),R.call(this,Z))}function E(){this.data.atHardBreak=!0}function L(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.value=Z}function w(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.value=Z}function D(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.value=Z}function W(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const re=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=re,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function B(){const Z=this.stack[this.stack.length-1];if(this.data.inReference){const re=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=re,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function q(Z){const re=this.sliceSerialize(Z),ue=this.stack[this.stack.length-2];ue.label=hE(re),ue.identifier=Fn(re).toLowerCase()}function Y(){const Z=this.stack[this.stack.length-1],re=this.resume(),ue=this.stack[this.stack.length-1];if(this.data.inReference=!0,ue.type==="link"){const be=Z.children;ue.children=be}else ue.alt=re}function I(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.url=Z}function H(){const Z=this.resume(),re=this.stack[this.stack.length-1];re.title=Z}function V(){this.data.inReference=void 0}function z(){this.data.referenceType="collapsed"}function oe(Z){const re=this.resume(),ue=this.stack[this.stack.length-1];ue.label=re,ue.identifier=Fn(this.sliceSerialize(Z)).toLowerCase(),this.data.referenceType="full"}function X(Z){this.data.characterReferenceType=Z.type}function de(Z){const re=this.sliceSerialize(Z),ue=this.data.characterReferenceType;let be;ue?(be=mp(re,ue==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):be=Ea(re);const Ae=this.stack[this.stack.length-1];Ae.value+=be}function te(Z){const re=this.stack.pop();re.position.end=Xt(Z.end)}function ce(Z){R.call(this,Z);const re=this.stack[this.stack.length-1];re.url=this.sliceSerialize(Z)}function fe(Z){R.call(this,Z);const re=this.stack[this.stack.length-1];re.url="mailto:"+this.sliceSerialize(Z)}function ge(){return{type:"blockquote",children:[]}}function xe(){return{type:"code",lang:null,meta:null,value:""}}function Ee(){return{type:"inlineCode",value:""}}function Oe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function _(){return{type:"emphasis",children:[]}}function ee(){return{type:"heading",depth:0,children:[]}}function J(){return{type:"break"}}function O(){return{type:"html",value:""}}function P(){return{type:"image",title:null,url:"",alt:null}}function F(){return{type:"link",title:null,url:"",children:[]}}function U(Z){return{type:"list",ordered:Z.type==="listOrdered",start:null,spread:Z._spread,children:[]}}function G(Z){return{type:"listItem",spread:Z._spread,checked:null,children:[]}}function $(){return{type:"paragraph",children:[]}}function ne(){return{type:"strong",children:[]}}function le(){return{type:"text",value:""}}function se(){return{type:"thematicBreak"}}}function Xt(e){return{line:e.line,column:e.column,offset:e.offset}}function jp(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?jp(e,r):xE(e,r)}}function xE(e,t){let n;for(n in t)if(Cp.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function mc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+xr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+xr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+xr({start:t.start,end:t.end})+") is still open")}function yE(e){const t=this;t.parser=n;function n(r){return mE(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function vE(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function bE(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
88
+ `}]}function wE(e,t){const n=t.value?t.value+`
89
+ `:"",r={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function kE(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _E(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function SE(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=or(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let i,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),i=e.footnoteOrder.length):i=s+1,a+=1,e.footnoteCounts.set(r,a);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function CE(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function jE(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Ep(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const o=e.all(t),s=o[0];s&&s.type==="text"?s.value="["+s.value:o.unshift({type:"text",value:"["});const i=o[o.length-1];return i&&i.type==="text"?i.value+=r:o.push({type:"text",value:r}),o}function EE(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Ep(e,t);const o={src:or(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(o.title=r.title);const s={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,s),e.applyData(t,s)}function NE(e,t){const n={src:or(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function TE(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function AE(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Ep(e,t);const o={href:or(r.url||"")};r.title!==null&&r.title!==void 0&&(o.title=r.title);const s={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function IE(e,t){const n={href:or(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function zE(e,t,n){const r=e.all(t),o=n?PE(n):Np(t),s={},i=[];if(typeof t.checked=="boolean"){const d=r[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const d=r[a];(o||a!==0||d.type!=="element"||d.tagName!=="p")&&i.push({type:"text",value:`
90
90
  `}),d.type==="element"&&d.tagName==="p"&&!o?i.push(...d.children):i.push(d)}const c=r[r.length-1];c&&(o||c.type!=="element"||c.tagName!=="p")&&i.push({type:"text",value:`
91
- `});const u={type:"element",tagName:"li",properties:s,children:i};return e.patch(t,u),e.applyData(t,u)}function AE(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=Cp(n[r])}return t}function Cp(e){const t=e.spread;return t??e.children.length>1}function IE(e,t){const n={},r=e.all(t);let o=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++o<r.length;){const i=r[o];if(i.type==="element"&&i.tagName==="li"&&i.properties&&Array.isArray(i.properties.className)&&i.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function zE(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function RE(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function PE(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function OE(e,t){const n=e.all(t),r=n.shift(),o=[];if(r){const i={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],i),o.push(i)}if(n.length>0){const i={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=ka(t.children[1]),c=sp(t.children[t.children.length-1]);a&&c&&(i.position={start:a,end:c}),o.push(i)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,s),e.applyData(t,s)}function DE(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",i=n&&n.type==="table"?n.align:void 0,a=i?i.length:t.children.length;let c=-1;const u=[];for(;++c<a;){const h=t.children[c],p={},f=i?i[c]:void 0;f&&(p.align=f);let g={type:"element",tagName:s,properties:p,children:[]};h&&(g.children=e.all(h),e.patch(h,g),g=e.applyData(h,g)),u.push(g)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function ME(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const mc=9,gc=32;function LE(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const s=[];for(;r;)s.push(xc(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return s.push(xc(t.slice(o),o>0,!1)),s.join("")}function xc(e,t,n){let r=0,o=e.length;if(t){let s=e.codePointAt(r);for(;s===mc||s===gc;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(o-1);for(;s===mc||s===gc;)o--,s=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function FE(e,t){const n={type:"text",value:LE(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function $E(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const BE={blockquote:gE,break:xE,code:yE,delete:vE,emphasis:bE,footnoteReference:wE,heading:kE,html:_E,imageReference:SE,image:CE,inlineCode:jE,linkReference:EE,link:NE,listItem:TE,list:IE,paragraph:zE,root:RE,strong:PE,table:OE,tableCell:ME,tableRow:DE,text:FE,thematicBreak:$E,toml:Yr,yaml:Yr,definition:Yr,footnoteDefinition:Yr};function Yr(){}const jp=-1,ls=0,br=1,Co=2,Ta=3,Aa=4,Ia=5,za=6,Ep=7,Np=8,yc=typeof self=="object"?self:globalThis,UE=(e,t)=>{const n=(o,s)=>(e.set(s,o),o),r=o=>{if(e.has(o))return e.get(o);const[s,i]=t[o];switch(s){case ls:case jp:return n(i,o);case br:{const a=n([],o);for(const c of i)a.push(r(c));return a}case Co:{const a=n({},o);for(const[c,u]of i)a[r(c)]=r(u);return a}case Ta:return n(new Date(i),o);case Aa:{const{source:a,flags:c}=i;return n(new RegExp(a,c),o)}case Ia:{const a=n(new Map,o);for(const[c,u]of i)a.set(r(c),r(u));return a}case za:{const a=n(new Set,o);for(const c of i)a.add(r(c));return a}case Ep:{const{name:a,message:c}=i;return n(new yc[a](c),o)}case Np:return n(BigInt(i),o);case"BigInt":return n(Object(BigInt(i)),o);case"ArrayBuffer":return n(new Uint8Array(i).buffer,i);case"DataView":{const{buffer:a}=new Uint8Array(i);return n(new DataView(a),i)}}return n(new yc[s](i),o)};return r},vc=e=>UE(new Map,e)(0),Tn="",{toString:ZE}={},{keys:VE}=Object,fr=e=>{const t=typeof e;if(t!=="object"||!e)return[ls,t];const n=ZE.call(e).slice(8,-1);switch(n){case"Array":return[br,Tn];case"Object":return[Co,Tn];case"Date":return[Ta,Tn];case"RegExp":return[Aa,Tn];case"Map":return[Ia,Tn];case"Set":return[za,Tn];case"DataView":return[br,n]}return n.includes("Array")?[br,n]:n.includes("Error")?[Ep,n]:[Co,n]},Xr=([e,t])=>e===ls&&(t==="function"||t==="symbol"),WE=(e,t,n,r)=>{const o=(i,a)=>{const c=r.push(i)-1;return n.set(a,c),c},s=i=>{if(n.has(i))return n.get(i);let[a,c]=fr(i);switch(a){case ls:{let d=i;switch(c){case"bigint":a=Np,d=i.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return o([jp],i)}return o([a,d],i)}case br:{if(c){let p=i;return c==="DataView"?p=new Uint8Array(i.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(i)),o([c,[...p]],i)}const d=[],h=o([a,d],i);for(const p of i)d.push(s(p));return h}case Co:{if(c)switch(c){case"BigInt":return o([c,i.toString()],i);case"Boolean":case"Number":case"String":return o([c,i.valueOf()],i)}if(t&&"toJSON"in i)return s(i.toJSON());const d=[],h=o([a,d],i);for(const p of VE(i))(e||!Xr(fr(i[p])))&&d.push([s(p),s(i[p])]);return h}case Ta:return o([a,i.toISOString()],i);case Aa:{const{source:d,flags:h}=i;return o([a,{source:d,flags:h}],i)}case Ia:{const d=[],h=o([a,d],i);for(const[p,f]of i)(e||!(Xr(fr(p))||Xr(fr(f))))&&d.push([s(p),s(f)]);return h}case za:{const d=[],h=o([a,d],i);for(const p of i)(e||!Xr(fr(p)))&&d.push(s(p));return h}}const{message:u}=i;return o([a,{name:c,message:u}],i)};return s},bc=(e,{json:t,lossy:n}={})=>{const r=[];return WE(!(t||n),!!t,new Map,r)(e),r},jo=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?vc(bc(e,t)):structuredClone(e):(e,t)=>vc(bc(e,t));function HE(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function qE(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function KE(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||HE,r=e.options.footnoteBackLabel||qE,o=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",i=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),h=String(u.identifier).toUpperCase(),p=sr(h.toLowerCase());let f=0;const g=[],m=e.footnoteCounts.get(h);for(;m!==void 0&&++f<=m;){g.length>0&&g.push({type:"text",value:" "});let b=typeof n=="string"?n:n(c,f);typeof b=="string"&&(b={type:"text",value:b}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,f),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const x=d[d.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const b=x.children[x.children.length-1];b&&b.type==="text"?b.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...g)}else d.push(...g);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(d,!0)};e.patch(u,y),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...jo(i),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
91
+ `});const u={type:"element",tagName:"li",properties:s,children:i};return e.patch(t,u),e.applyData(t,u)}function PE(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=Np(n[r])}return t}function Np(e){const t=e.spread;return t??e.children.length>1}function RE(e,t){const n={},r=e.all(t);let o=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++o<r.length;){const i=r[o];if(i.type==="element"&&i.tagName==="li"&&i.properties&&Array.isArray(i.properties.className)&&i.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function OE(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function DE(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function ME(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function LE(e,t){const n=e.all(t),r=n.shift(),o=[];if(r){const i={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],i),o.push(i)}if(n.length>0){const i={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=_a(t.children[1]),c=lp(t.children[t.children.length-1]);a&&c&&(i.position={start:a,end:c}),o.push(i)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,s),e.applyData(t,s)}function FE(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",i=n&&n.type==="table"?n.align:void 0,a=i?i.length:t.children.length;let c=-1;const u=[];for(;++c<a;){const h=t.children[c],p={},f=i?i[c]:void 0;f&&(p.align=f);let g={type:"element",tagName:s,properties:p,children:[]};h&&(g.children=e.all(h),e.patch(h,g),g=e.applyData(h,g)),u.push(g)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function $E(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const gc=9,xc=32;function BE(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const s=[];for(;r;)s.push(yc(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return s.push(yc(t.slice(o),o>0,!1)),s.join("")}function yc(e,t,n){let r=0,o=e.length;if(t){let s=e.codePointAt(r);for(;s===gc||s===xc;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(o-1);for(;s===gc||s===xc;)o--,s=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function UE(e,t){const n={type:"text",value:BE(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function ZE(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const VE={blockquote:vE,break:bE,code:wE,delete:kE,emphasis:_E,footnoteReference:SE,heading:CE,html:jE,imageReference:EE,image:NE,inlineCode:TE,linkReference:AE,link:IE,listItem:zE,list:RE,paragraph:OE,root:DE,strong:ME,table:LE,tableCell:$E,tableRow:FE,text:UE,thematicBreak:ZE,toml:Xr,yaml:Xr,definition:Xr,footnoteDefinition:Xr};function Xr(){}const Tp=-1,cs=0,vr=1,jo=2,Aa=3,Ia=4,za=5,Pa=6,Ap=7,Ip=8,vc=typeof self=="object"?self:globalThis,HE=(e,t)=>{const n=(o,s)=>(e.set(s,o),o),r=o=>{if(e.has(o))return e.get(o);const[s,i]=t[o];switch(s){case cs:case Tp:return n(i,o);case vr:{const a=n([],o);for(const c of i)a.push(r(c));return a}case jo:{const a=n({},o);for(const[c,u]of i)a[r(c)]=r(u);return a}case Aa:return n(new Date(i),o);case Ia:{const{source:a,flags:c}=i;return n(new RegExp(a,c),o)}case za:{const a=n(new Map,o);for(const[c,u]of i)a.set(r(c),r(u));return a}case Pa:{const a=n(new Set,o);for(const c of i)a.add(r(c));return a}case Ap:{const{name:a,message:c}=i;return n(new vc[a](c),o)}case Ip:return n(BigInt(i),o);case"BigInt":return n(Object(BigInt(i)),o);case"ArrayBuffer":return n(new Uint8Array(i).buffer,i);case"DataView":{const{buffer:a}=new Uint8Array(i);return n(new DataView(a),i)}}return n(new vc[s](i),o)};return r},bc=e=>HE(new Map,e)(0),Nn="",{toString:WE}={},{keys:qE}=Object,dr=e=>{const t=typeof e;if(t!=="object"||!e)return[cs,t];const n=WE.call(e).slice(8,-1);switch(n){case"Array":return[vr,Nn];case"Object":return[jo,Nn];case"Date":return[Aa,Nn];case"RegExp":return[Ia,Nn];case"Map":return[za,Nn];case"Set":return[Pa,Nn];case"DataView":return[vr,n]}return n.includes("Array")?[vr,n]:n.includes("Error")?[Ap,n]:[jo,n]},Qr=([e,t])=>e===cs&&(t==="function"||t==="symbol"),KE=(e,t,n,r)=>{const o=(i,a)=>{const c=r.push(i)-1;return n.set(a,c),c},s=i=>{if(n.has(i))return n.get(i);let[a,c]=dr(i);switch(a){case cs:{let d=i;switch(c){case"bigint":a=Ip,d=i.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return o([Tp],i)}return o([a,d],i)}case vr:{if(c){let p=i;return c==="DataView"?p=new Uint8Array(i.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(i)),o([c,[...p]],i)}const d=[],h=o([a,d],i);for(const p of i)d.push(s(p));return h}case jo:{if(c)switch(c){case"BigInt":return o([c,i.toString()],i);case"Boolean":case"Number":case"String":return o([c,i.valueOf()],i)}if(t&&"toJSON"in i)return s(i.toJSON());const d=[],h=o([a,d],i);for(const p of qE(i))(e||!Qr(dr(i[p])))&&d.push([s(p),s(i[p])]);return h}case Aa:return o([a,i.toISOString()],i);case Ia:{const{source:d,flags:h}=i;return o([a,{source:d,flags:h}],i)}case za:{const d=[],h=o([a,d],i);for(const[p,f]of i)(e||!(Qr(dr(p))||Qr(dr(f))))&&d.push([s(p),s(f)]);return h}case Pa:{const d=[],h=o([a,d],i);for(const p of i)(e||!Qr(dr(p)))&&d.push(s(p));return h}}const{message:u}=i;return o([a,{name:c,message:u}],i)};return s},wc=(e,{json:t,lossy:n}={})=>{const r=[];return KE(!(t||n),!!t,new Map,r)(e),r},Eo=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?bc(wc(e,t)):structuredClone(e):(e,t)=>bc(wc(e,t));function JE(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function GE(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function YE(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||JE,r=e.options.footnoteBackLabel||GE,o=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",i=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),h=String(u.identifier).toUpperCase(),p=or(h.toLowerCase());let f=0;const g=[],m=e.footnoteCounts.get(h);for(;m!==void 0&&++f<=m;){g.length>0&&g.push({type:"text",value:" "});let b=typeof n=="string"?n:n(c,f);typeof b=="string"&&(b={type:"text",value:b}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,f),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const x=d[d.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const b=x.children[x.children.length-1];b&&b.type==="text"?b.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...g)}else d.push(...g);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(d,!0)};e.patch(u,y),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Eo(i),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
92
92
  `},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
93
- `}]}}const Tp=(function(e){if(e==null)return XE;if(typeof e=="function")return cs(e);if(typeof e=="object")return Array.isArray(e)?GE(e):JE(e);if(typeof e=="string")return YE(e);throw new Error("Expected function, string, or object as test")});function GE(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Tp(e[n]);return cs(r);function r(...o){let s=-1;for(;++s<t.length;)if(t[s].apply(this,o))return!0;return!1}}function JE(e){const t=e;return cs(n);function n(r){const o=r;let s;for(s in e)if(o[s]!==t[s])return!1;return!0}}function YE(e){return cs(t);function t(n){return n&&n.type===e}}function cs(e){return t;function t(n,r,o){return!!(QE(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function XE(){return!0}function QE(e){return e!==null&&typeof e=="object"&&"type"in e}const Ap=[],e3=!0,wc=!1,t3="skip";function n3(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;const s=Tp(o),i=r?-1:1;a(e,void 0,[])();function a(c,u,d){const h=c&&typeof c=="object"?c:{};if(typeof h.type=="string"){const f=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=Ap,g,m,x;if((!t||s(c,u,d[d.length-1]||void 0))&&(f=r3(n(c,d)),f[0]===wc))return f;if("children"in c&&c.children){const y=c;if(y.children&&f[0]!==t3)for(m=(r?y.children.length:-1)+i,x=d.concat(y);m>-1&&m<y.children.length;){const b=y.children[m];if(g=a(b,m,x)(),g[0]===wc)return g;m=typeof g[1]=="number"?g[1]:m+i}}return f}}}function r3(e){return Array.isArray(e)?e:typeof e=="number"?[e3,e]:e==null?Ap:[e]}function Ip(e,t,n,r){let o,s,i;typeof t=="function"&&typeof n!="function"?(s=void 0,i=t,o=n):(s=t,i=n,o=r),n3(e,s,a,o);function a(c,u){const d=u[u.length-1],h=d?d.children.indexOf(c):void 0;return i(c,h,d)}}const _i={}.hasOwnProperty,o3={};function s3(e,t){const n=t||o3,r=new Map,o=new Map,s=new Map,i={...BE,...n.handlers},a={all:u,applyData:a3,definitionById:r,footnoteById:o,footnoteCounts:s,footnoteOrder:[],handlers:i,one:c,options:n,patch:i3,wrap:c3};return Ip(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?r:o,p=String(d.identifier).toUpperCase();h.has(p)||h.set(p,d)}}),a;function c(d,h){const p=d.type,f=a.handlers[p];if(_i.call(a.handlers,p)&&f)return f(a,d,h);if(a.options.passThrough&&a.options.passThrough.includes(p)){if("children"in d){const{children:m,...x}=d,y=jo(x);return y.children=a.all(d),y}return jo(d)}return(a.options.unknownHandler||l3)(a,d,h)}function u(d){const h=[];if("children"in d){const p=d.children;let f=-1;for(;++f<p.length;){const g=a.one(p[f],d);if(g){if(f&&p[f-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=kc(g.value)),!Array.isArray(g)&&g.type==="element")){const m=g.children[0];m&&m.type==="text"&&(m.value=kc(m.value))}Array.isArray(g)?h.push(...g):h.push(g)}}}return h}}function i3(e,t){e.position&&(t.position=ZC(e))}function a3(e,t){let n=t;if(e&&e.data){const r=e.data.hName,o=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const i="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:i}}n.type==="element"&&s&&Object.assign(n.properties,jo(s)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function l3(e,t){const n=t.data||{},r="value"in t&&!(_i.call(n,"hProperties")||_i.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function c3(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
93
+ `}]}}const zp=(function(e){if(e==null)return tN;if(typeof e=="function")return us(e);if(typeof e=="object")return Array.isArray(e)?XE(e):QE(e);if(typeof e=="string")return eN(e);throw new Error("Expected function, string, or object as test")});function XE(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=zp(e[n]);return us(r);function r(...o){let s=-1;for(;++s<t.length;)if(t[s].apply(this,o))return!0;return!1}}function QE(e){const t=e;return us(n);function n(r){const o=r;let s;for(s in e)if(o[s]!==t[s])return!1;return!0}}function eN(e){return us(t);function t(n){return n&&n.type===e}}function us(e){return t;function t(n,r,o){return!!(nN(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function tN(){return!0}function nN(e){return e!==null&&typeof e=="object"&&"type"in e}const Pp=[],rN=!0,kc=!1,oN="skip";function sN(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;const s=zp(o),i=r?-1:1;a(e,void 0,[])();function a(c,u,d){const h=c&&typeof c=="object"?c:{};if(typeof h.type=="string"){const f=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=Pp,g,m,x;if((!t||s(c,u,d[d.length-1]||void 0))&&(f=iN(n(c,d)),f[0]===kc))return f;if("children"in c&&c.children){const y=c;if(y.children&&f[0]!==oN)for(m=(r?y.children.length:-1)+i,x=d.concat(y);m>-1&&m<y.children.length;){const b=y.children[m];if(g=a(b,m,x)(),g[0]===kc)return g;m=typeof g[1]=="number"?g[1]:m+i}}return f}}}function iN(e){return Array.isArray(e)?e:typeof e=="number"?[rN,e]:e==null?Pp:[e]}function Rp(e,t,n,r){let o,s,i;typeof t=="function"&&typeof n!="function"?(s=void 0,i=t,o=n):(s=t,i=n,o=r),sN(e,s,a,o);function a(c,u){const d=u[u.length-1],h=d?d.children.indexOf(c):void 0;return i(c,h,d)}}const _i={}.hasOwnProperty,aN={};function lN(e,t){const n=t||aN,r=new Map,o=new Map,s=new Map,i={...VE,...n.handlers},a={all:u,applyData:uN,definitionById:r,footnoteById:o,footnoteCounts:s,footnoteOrder:[],handlers:i,one:c,options:n,patch:cN,wrap:fN};return Rp(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const h=d.type==="definition"?r:o,p=String(d.identifier).toUpperCase();h.has(p)||h.set(p,d)}}),a;function c(d,h){const p=d.type,f=a.handlers[p];if(_i.call(a.handlers,p)&&f)return f(a,d,h);if(a.options.passThrough&&a.options.passThrough.includes(p)){if("children"in d){const{children:m,...x}=d,y=Eo(x);return y.children=a.all(d),y}return Eo(d)}return(a.options.unknownHandler||dN)(a,d,h)}function u(d){const h=[];if("children"in d){const p=d.children;let f=-1;for(;++f<p.length;){const g=a.one(p[f],d);if(g){if(f&&p[f-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=_c(g.value)),!Array.isArray(g)&&g.type==="element")){const m=g.children[0];m&&m.type==="text"&&(m.value=_c(m.value))}Array.isArray(g)?h.push(...g):h.push(g)}}}return h}}function cN(e,t){e.position&&(t.position=WC(e))}function uN(e,t){let n=t;if(e&&e.data){const r=e.data.hName,o=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const i="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:i}}n.type==="element"&&s&&Object.assign(n.properties,Eo(s)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function dN(e,t){const n=t.data||{},r="value"in t&&!(_i.call(n,"hProperties")||_i.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function fN(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
94
94
  `});++r<e.length;)r&&n.push({type:"text",value:`
95
95
  `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
96
- `}),n}function kc(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function _c(e,t){const n=s3(e,t),r=n.one(e,void 0),o=KE(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&s.children.push({type:"text",value:`
97
- `},o),s}function u3(e,t){return e&&"run"in e?async function(n,r){const o=_c(n,{file:r,...t});await e.run(o,r)}:function(n,r){return _c(n,{file:r,...e||t})}}function Sc(e){if(e)throw e}var Ps,Cc;function d3(){if(Cc)return Ps;Cc=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},s=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var d=e.call(u,"constructor"),h=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!d&&!h)return!1;var p;for(p in u);return typeof p>"u"||e.call(u,p)},i=function(u,d){n&&d.name==="__proto__"?n(u,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):u[d.name]=d.newValue},a=function(u,d){if(d==="__proto__")if(e.call(u,d)){if(r)return r(u,d).value}else return;return u[d]};return Ps=function c(){var u,d,h,p,f,g,m=arguments[0],x=1,y=arguments.length,b=!1;for(typeof m=="boolean"&&(b=m,m=arguments[1]||{},x=2),(m==null||typeof m!="object"&&typeof m!="function")&&(m={});x<y;++x)if(u=arguments[x],u!=null)for(d in u)h=a(m,d),p=a(u,d),m!==p&&(b&&p&&(s(p)||(f=o(p)))?(f?(f=!1,g=h&&o(h)?h:[]):g=h&&s(h)?h:{},i(m,{name:d,newValue:c(b,g,p)})):typeof p<"u"&&i(m,{name:d,newValue:p}));return m},Ps}var f3=d3();const Os=Ri(f3);function Si(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function h3(){const e=[],t={run:n,use:r};return t;function n(...o){let s=-1;const i=o.pop();if(typeof i!="function")throw new TypeError("Expected function as last argument, not "+i);a(null,...o);function a(c,...u){const d=e[++s];let h=-1;if(c){i(c);return}for(;++h<o.length;)(u[h]===null||u[h]===void 0)&&(u[h]=o[h]);o=u,d?p3(d,a)(...u):i(null,...u)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function p3(e,t){let n;return r;function r(...i){const a=e.length>i.length;let c;a&&i.push(o);try{c=e.apply(this,i)}catch(u){const d=u;if(a&&n)throw d;return o(d)}a||(c&&c.then&&typeof c.then=="function"?c.then(s,o):c instanceof Error?o(c):s(c))}function o(i,...a){n||(n=!0,t(i,...a))}function s(i){o(null,i)}}const zt={basename:m3,dirname:g3,extname:x3,join:y3,sep:"/"};function m3(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Dr(e);let n=0,r=-1,o=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(s){n=o+1;break}}else r<0&&(s=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let i=-1,a=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(s){n=o+1;break}}else i<0&&(s=!0,i=o+1),a>-1&&(e.codePointAt(o)===t.codePointAt(a--)?a<0&&(r=o):(a=-1,r=i));return n===r?r=i:r<0&&(r=e.length),e.slice(n,r)}function g3(e){if(Dr(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function x3(e){Dr(e);let t=e.length,n=-1,r=0,o=-1,s=0,i;for(;t--;){const a=e.codePointAt(t);if(a===47){if(i){r=t+1;break}continue}n<0&&(i=!0,n=t+1),a===46?o<0?o=t:s!==1&&(s=1):o>-1&&(s=-1)}return o<0||n<0||s===0||s===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function y3(...e){let t=-1,n;for(;++t<e.length;)Dr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":v3(n)}function v3(e){Dr(e);const t=e.codePointAt(0)===47;let n=b3(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function b3(e,t){let n="",r=0,o=-1,s=0,i=-1,a,c;for(;++i<=e.length;){if(i<e.length)a=e.codePointAt(i);else{if(a===47)break;a=47}if(a===47){if(!(o===i-1||s===1))if(o!==i-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),o=i,s=0;continue}}else if(n.length>0){n="",r=0,o=i,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,i):n=e.slice(o+1,i),r=i-o-1;o=i,s=0}else a===46&&s>-1?s++:s=-1}return n}function Dr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const w3={cwd:k3};function k3(){return"/"}function Ci(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function _3(e){if(typeof e=="string")e=new URL(e);else if(!Ci(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return S3(e)}function S3(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const Ds=["history","path","basename","stem","extname","dirname"];class zp{constructor(t){let n;t?Ci(t)?n={path:t}:typeof t=="string"||C3(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":w3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ds.length;){const s=Ds[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let o;for(o in n)Ds.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?zt.basename(this.path):void 0}set basename(t){Ls(t,"basename"),Ms(t,"basename"),this.path=zt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?zt.dirname(this.path):void 0}set dirname(t){jc(this.basename,"dirname"),this.path=zt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?zt.extname(this.path):void 0}set extname(t){if(Ms(t,"extname"),jc(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=zt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ci(t)&&(t=_3(t)),Ls(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?zt.basename(this.path,this.extname):void 0}set stem(t){Ls(t,"stem"),Ms(t,"stem"),this.path=zt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){const o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){const o=new rt(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Ms(e,t){if(e&&e.includes(zt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+zt.sep+"`")}function Ls(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function jc(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function C3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const j3=(function(e){const r=this.constructor.prototype,o=r[e],s=function(){return o.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),E3={}.hasOwnProperty;class Ra extends j3{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=h3()}copy(){const t=new Ra;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Os(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Bs("data",this.frozen),this.namespace[t]=n,this):E3.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Bs("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Qr(t),r=this.parser||this.Parser;return Fs("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Fs("process",this.parser||this.Parser),$s("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(s,i){const a=Qr(t),c=r.parse(a);r.run(c,a,function(d,h,p){if(d||!h||!p)return u(d);const f=h,g=r.stringify(f,p);A3(g)?p.value=g:p.result=g,u(d,p)});function u(d,h){d||!h?i(d):s?s(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),Fs("processSync",this.parser||this.Parser),$s("processSync",this.compiler||this.Compiler),this.process(t,o),Nc("processSync","process",n),r;function o(s,i){n=!0,Sc(s),r=i}}run(t,n,r){Ec(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(i,a){const c=Qr(n);o.run(t,c,u);function u(d,h,p){const f=h||t;d?a(d):i?i(f):r(void 0,f,p)}}}runSync(t,n){let r=!1,o;return this.run(t,n,s),Nc("runSync","run",r),o;function s(i,a){Sc(i),o=a,r=!0}}stringify(t,n){this.freeze();const r=Qr(n),o=this.compiler||this.Compiler;return $s("stringify",o),Ec(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(Bs("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):i(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...h]=u;c(d,h)}else i(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function i(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(u.plugins),u.settings&&(o.settings=Os(!0,o.settings,u.settings))}function a(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];s(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let h=-1,p=-1;for(;++h<r.length;)if(r[h][0]===u){p=h;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[f,...g]=d;const m=r[p][1];Si(m)&&Si(f)&&(f=Os(!0,m,f)),r[p]=[u,f,...g]}}}}const N3=new Ra().freeze();function Fs(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function $s(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Bs(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ec(e){if(!Si(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Nc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Qr(e){return T3(e)?e:new zp(e)}function T3(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function A3(e){return typeof e=="string"||I3(e)}function I3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const z3="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Tc=[],Ac={allowDangerousHtml:!0},R3=/^(https?|ircs?|mailto|xmpp)$/i,P3=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Gn(e){const t=O3(e),n=D3(e);return M3(t.runSync(t.parse(n),n),e)}function O3(e){const t=e.rehypePlugins||Tc,n=e.remarkPlugins||Tc,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ac}:Ac;return N3().use(mE).use(n).use(u3,r).use(t)}function D3(e){const t=e.children||"",n=new zp;return typeof t=="string"&&(n.value=t),n}function M3(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,s=t.disallowedElements,i=t.skipHtml,a=t.unwrapDisallowed,c=t.urlTransform||L3;for(const d of P3)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+z3+d.id,void 0);return Ip(e,u),KC(e,{Fragment:l.Fragment,components:o,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function u(d,h,p){if(d.type==="raw"&&p&&typeof h=="number")return i?p.children.splice(h,1):p.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let f;for(f in Is)if(Object.hasOwn(Is,f)&&Object.hasOwn(d.properties,f)){const g=d.properties[f],m=Is[f];(m===null||m.includes(d.tagName))&&(d.properties[f]=c(String(g||""),f,d))}}if(d.type==="element"){let f=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!f&&r&&typeof h=="number"&&(f=!r(d,h,p)),f&&p&&typeof h=="number")return a&&d.children?p.children.splice(h,1,...d.children):p.children.splice(h,1),h}}}function L3(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||r!==-1&&t>r||R3.test(e.slice(0,t))?e:""}function Rp(e){if(e===null)return"null";if(Array.isArray(e))return"array";switch(typeof e){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"object":return"object";case"bigint":case"symbol":case"undefined":case"function":return"object"}}function Eo(e){return e!==null&&(Array.isArray(e)||typeof e=="object")}function F3(e,t){const n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0)return n.value}function Pa(e){return Array.isArray(e)?e.map((t,n)=>[String(n),t]):typeof e=="object"&&e!==null?Object.keys(e).map(t=>{const n=F3(e,t);return[t,Jn(n)]}):[]}function Ic(e){return Array.isArray(e)?e.length:typeof e=="object"&&e!==null?Object.keys(e).length:0}const zc=120;function $3({text:e}){const[t,n]=v.useState(!1);return e.length>zc?l.jsxs("span",{className:"text-emerald-400 break-all",children:['"',t?l.jsx("span",{className:"cursor-pointer prose prose-sm dark:prose-invert inline max-w-none [&_p]:inline [&_p]:my-0 [&_code]:text-emerald-300 [&_a]:text-emerald-300",onClick:o=>{o.stopPropagation(),n(!1)},onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.stopPropagation(),n(!1))},role:"button",tabIndex:0,children:l.jsx(Gn,{children:e})}):l.jsxs(Le,{delayDuration:300,children:[l.jsxs(Fe,{onClick:o=>{o.stopPropagation(),n(!0)},className:"text-left cursor-pointer",children:[l.jsx("span",{children:e.slice(0,zc)}),l.jsx("span",{className:"text-emerald-400/50",children:"…"})]}),l.jsxs($e,{side:"bottom",className:"max-w-md text-xs p-2 break-words whitespace-pre-wrap",children:[e.slice(0,500),e.length>500?"…":""]})]}),'"']}):l.jsxs("span",{className:"text-emerald-400 break-all",children:['"',l.jsx("span",{className:"prose prose-sm dark:prose-invert inline max-w-none [&_p]:inline [&_p]:my-0 [&_code]:text-emerald-300 [&_a]:text-emerald-300",children:l.jsx(Gn,{children:e})}),'"']})}function Pp({value:e}){if(e===null)return l.jsx("span",{className:"text-rose-400 italic",children:"null"});switch(typeof e){case"string":return l.jsx($3,{text:e});case"number":return l.jsx("span",{className:"text-amber-400",children:e});case"boolean":return l.jsx("span",{className:"text-blue-400",children:e?"true":"false"});case"object":case"bigint":case"symbol":case"undefined":case"function":return l.jsx("span",{className:"text-muted-foreground",children:JSON.stringify(e)})}}function Rc({value:e}){const[t,n]=v.useState(!1);function r(o){o.stopPropagation(),window.navigator.clipboard.writeText(JSON.stringify(e,null,2)).then(()=>{n(!0),setTimeout(()=>{n(!1)},2e3)})}return l.jsx("button",{type:"button",onClick:r,className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors",title:"Copy JSON",children:t?l.jsx(Gt,{className:"size-3 text-green-500"}):l.jsx(wn,{className:"size-3"})})}function B3({value:e}){const[t,n]=v.useState(!1);function r(o){o.stopPropagation(),window.navigator.clipboard.writeText(JSON.stringify(e,null,2)).then(()=>{n(!0),setTimeout(()=>{n(!1)},2e3)})}return l.jsx("button",{type:"button",onClick:r,className:"opacity-0 group-hover/row:opacity-100 hover:bg-muted p-0.5 rounded transition-opacity shrink-0",title:"Copy to clipboard",children:t?l.jsx(Gt,{className:"size-3 text-green-500"}):l.jsx(wn,{className:"size-3 text-muted-foreground"})})}function Pc(e){return Eo(e)?Pa(e).some(([,t])=>Eo(t)):!1}function U3({allExpanded:e,onClick:t}){return l.jsx("button",{type:"button",onClick:t,className:"opacity-0 group-hover/row:opacity-100 hover:bg-muted p-0.5 rounded transition-opacity shrink-0",title:e?"Collapse all":"Expand all",children:e?l.jsx(Dy,{className:"size-3.5 text-muted-foreground"}):l.jsx(Py,{className:"size-3.5 text-muted-foreground"})})}const Z3=v.memo(function e({name:t,value:n,level:r,defaultExpandDepth:o,isArrayItem:s}){const[i,a]=v.useState(r<o),[c,u]=v.useState(0),[d,h]=v.useState(null),[p,f]=v.useState(!1),g=Eo(n),m=Rp(n),x=m==="array"?"[":"{",y=m==="array"?"]":"}";function b(){p?(a(!1),h(0),u(C=>C+1),f(!1)):(a(!0),h(Number.POSITIVE_INFINITY),u(C=>C+1),f(!0))}function k(C){C.stopPropagation(),b()}const S=d??o;return l.jsxs("div",{className:he(r>0&&"border-l border-border/50 ml-2"),children:[l.jsxs("div",{className:he("flex items-start gap-1 py-0.5 px-1 -ml-1 rounded-sm group/row",g&&"cursor-pointer hover:bg-muted/50"),onClick:g?()=>{i&&f(!1),a(!i)}:void 0,onKeyDown:g?C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),a(!i))}:void 0,onDoubleClick:g&&Pc(n)?()=>b():void 0,role:g?"button":void 0,tabIndex:g?0:void 0,children:[g?l.jsx("span",{className:"w-4 h-5 flex items-center justify-center shrink-0",children:i?l.jsx(vt,{className:"size-3 text-muted-foreground"}):l.jsx(bt,{className:"size-3 text-muted-foreground"})}):l.jsx("span",{className:"w-4 shrink-0"}),l.jsx("span",{className:he("shrink-0",s?"text-muted-foreground":"text-cyan-400"),children:s?t:`"${t}"`}),l.jsx("span",{className:"text-muted-foreground shrink-0",children:g?"":":"}),g?l.jsxs("span",{className:"text-muted-foreground",children:[x,l.jsxs("span",{className:"text-muted-foreground/60 text-xs",children:[" ",Ic(n)," ",Ic(n)===1?"item":"items"," ",y]})]}):l.jsx("span",{className:"min-w-0",children:l.jsx(Pp,{value:n})}),g&&Pc(n)&&l.jsx(U3,{allExpanded:p,onClick:k}),l.jsx(B3,{value:n})]}),g&&i&&l.jsxs("div",{className:"pl-4",children:[Pa(n).map(([C,j])=>l.jsx(e,{name:C,value:j,level:r+1,defaultExpandDepth:S,isArrayItem:m==="array"},C)),l.jsx("div",{className:"text-muted-foreground py-0.5 px-1",children:y})]},c)]})});function us({data:e,defaultExpandDepth:t=2,className:n,showCopy:r=!1}){if(!Eo(e))return l.jsx(Je,{children:l.jsx("div",{className:he("font-mono text-xs leading-relaxed",n),children:l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Pp,{value:e}),r&&l.jsx(Rc,{value:e})]})})});const i=Rp(e)==="array";return l.jsx(Je,{children:l.jsxs("div",{className:he("font-mono text-xs leading-relaxed",n),children:[r&&l.jsx(Rc,{value:e}),Pa(e).map(([a,c])=>l.jsx(Z3,{name:a,value:c,level:0,defaultExpandDepth:t,isArrayItem:i},a))]})})}function fn({text:e,defaultExpandDepth:t=2,className:n}){try{const r=JSON.parse(e);return l.jsx(us,{data:Jn(r),defaultExpandDepth:t,className:n})}catch{return l.jsx("pre",{className:he("font-mono text-xs whitespace-pre-wrap break-words",n),children:e})}}function Jn(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=>Jn(n));const t={};for(const n of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,n);t[n]=Jn(r?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function Pn({className:e,orientation:t="horizontal",...n}){return l.jsx(aS,{"data-slot":"tabs","data-orientation":t,orientation:t,className:he("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",e),...n})}const V3=Ji("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 On({className:e,variant:t="default",...n}){return l.jsx(lS,{"data-slot":"tabs-list","data-variant":t,className:he(V3({variant:t}),e),...n})}function tt({className:e,...t}){return l.jsx(cS,{"data-slot":"tabs-trigger",className:he("focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent","data-[state=active]:bg-background dark:data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 data-[state=active]:text-foreground","after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",e),...t})}function nt({className:e,...t}){return l.jsx(uS,{"data-slot":"tabs-content",className:he("flex-1 outline-none",e),...t})}class Op{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),a=this.removeEmpty(this.tokenize(s,r)),c=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(a,c,r,o)}diffWithOptionsObj(t,n,r,o){var s;const i=b=>{if(b=this.postProcess(b,r),o){setTimeout(function(){o(b)},0);return}else return b},a=n.length,c=t.length;let u=1,d=a+c;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));const h=(s=r.timeout)!==null&&s!==void 0?s:1/0,p=Date.now()+h,f=[{oldPos:-1,lastComponent:void 0}];let g=this.extractCommon(f[0],n,t,0,r);if(f[0].oldPos+1>=c&&g+1>=a)return i(this.buildValues(f[0].lastComponent,n,t));let m=-1/0,x=1/0;const y=()=>{for(let b=Math.max(m,-u);b<=Math.min(x,u);b+=2){let k;const S=f[b-1],C=f[b+1];S&&(f[b-1]=void 0);let j=!1;if(C){const T=C.oldPos-b;j=C&&0<=T&&T<a}const N=S&&S.oldPos+1<c;if(!j&&!N){f[b]=void 0;continue}if(!N||j&&S.oldPos<C.oldPos?k=this.addToPath(C,!0,!1,0,r):k=this.addToPath(S,!1,!0,1,r),g=this.extractCommon(k,n,t,b,r),k.oldPos+1>=c&&g+1>=a)return i(this.buildValues(k.lastComponent,n,t))||!0;f[b]=k,k.oldPos+1>=c&&(x=Math.min(x,b-1)),g+1>=a&&(m=Math.max(m,b+1))}u++};if(o)(function b(){setTimeout(function(){if(u>d||Date.now()>p)return o(void 0);y()||b()},0)})();else for(;u<=d&&Date.now()<=p;){const b=y();if(b)return b}}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,a=r.length;let c=t.oldPos,u=c-o,d=0;for(;u+1<i&&c+1<a&&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 a=0,c=0,u=0;for(;a<i;a++){const d=o[a];if(d.removed)d.value=this.join(r.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let h=n.slice(c,c+d.count);h=h.map(function(p,f){const g=r[u+f];return g.length>p.length?g:p}),d.value=this.join(h)}else d.value=this.join(n.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return o}}class W3 extends Op{constructor(){super(...arguments),this.tokenize=Mp}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
96
+ `}),n}function _c(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Sc(e,t){const n=lN(e,t),r=n.one(e,void 0),o=YE(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&s.children.push({type:"text",value:`
97
+ `},o),s}function hN(e,t){return e&&"run"in e?async function(n,r){const o=Sc(n,{file:r,...t});await e.run(o,r)}:function(n,r){return Sc(n,{file:r,...e||t})}}function Cc(e){if(e)throw e}var Rs,jc;function pN(){if(jc)return Rs;jc=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},s=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var d=e.call(u,"constructor"),h=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!d&&!h)return!1;var p;for(p in u);return typeof p>"u"||e.call(u,p)},i=function(u,d){n&&d.name==="__proto__"?n(u,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):u[d.name]=d.newValue},a=function(u,d){if(d==="__proto__")if(e.call(u,d)){if(r)return r(u,d).value}else return;return u[d]};return Rs=function c(){var u,d,h,p,f,g,m=arguments[0],x=1,y=arguments.length,b=!1;for(typeof m=="boolean"&&(b=m,m=arguments[1]||{},x=2),(m==null||typeof m!="object"&&typeof m!="function")&&(m={});x<y;++x)if(u=arguments[x],u!=null)for(d in u)h=a(m,d),p=a(u,d),m!==p&&(b&&p&&(s(p)||(f=o(p)))?(f?(f=!1,g=h&&o(h)?h:[]):g=h&&s(h)?h:{},i(m,{name:d,newValue:c(b,g,p)})):typeof p<"u"&&i(m,{name:d,newValue:p}));return m},Rs}var mN=pN();const Os=Ri(mN);function Si(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function gN(){const e=[],t={run:n,use:r};return t;function n(...o){let s=-1;const i=o.pop();if(typeof i!="function")throw new TypeError("Expected function as last argument, not "+i);a(null,...o);function a(c,...u){const d=e[++s];let h=-1;if(c){i(c);return}for(;++h<o.length;)(u[h]===null||u[h]===void 0)&&(u[h]=o[h]);o=u,d?xN(d,a)(...u):i(null,...u)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function xN(e,t){let n;return r;function r(...i){const a=e.length>i.length;let c;a&&i.push(o);try{c=e.apply(this,i)}catch(u){const d=u;if(a&&n)throw d;return o(d)}a||(c&&c.then&&typeof c.then=="function"?c.then(s,o):c instanceof Error?o(c):s(c))}function o(i,...a){n||(n=!0,t(i,...a))}function s(i){o(null,i)}}const zt={basename:yN,dirname:vN,extname:bN,join:wN,sep:"/"};function yN(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Mr(e);let n=0,r=-1,o=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(s){n=o+1;break}}else r<0&&(s=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let i=-1,a=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(s){n=o+1;break}}else i<0&&(s=!0,i=o+1),a>-1&&(e.codePointAt(o)===t.codePointAt(a--)?a<0&&(r=o):(a=-1,r=i));return n===r?r=i:r<0&&(r=e.length),e.slice(n,r)}function vN(e){if(Mr(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function bN(e){Mr(e);let t=e.length,n=-1,r=0,o=-1,s=0,i;for(;t--;){const a=e.codePointAt(t);if(a===47){if(i){r=t+1;break}continue}n<0&&(i=!0,n=t+1),a===46?o<0?o=t:s!==1&&(s=1):o>-1&&(s=-1)}return o<0||n<0||s===0||s===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function wN(...e){let t=-1,n;for(;++t<e.length;)Mr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":kN(n)}function kN(e){Mr(e);const t=e.codePointAt(0)===47;let n=_N(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function _N(e,t){let n="",r=0,o=-1,s=0,i=-1,a,c;for(;++i<=e.length;){if(i<e.length)a=e.codePointAt(i);else{if(a===47)break;a=47}if(a===47){if(!(o===i-1||s===1))if(o!==i-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),o=i,s=0;continue}}else if(n.length>0){n="",r=0,o=i,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,i):n=e.slice(o+1,i),r=i-o-1;o=i,s=0}else a===46&&s>-1?s++:s=-1}return n}function Mr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const SN={cwd:CN};function CN(){return"/"}function Ci(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function jN(e){if(typeof e=="string")e=new URL(e);else if(!Ci(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return EN(e)}function EN(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const Ds=["history","path","basename","stem","extname","dirname"];class Op{constructor(t){let n;t?Ci(t)?n={path:t}:typeof t=="string"||NN(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":SN.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ds.length;){const s=Ds[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let o;for(o in n)Ds.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?zt.basename(this.path):void 0}set basename(t){Ls(t,"basename"),Ms(t,"basename"),this.path=zt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?zt.dirname(this.path):void 0}set dirname(t){Ec(this.basename,"dirname"),this.path=zt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?zt.extname(this.path):void 0}set extname(t){if(Ms(t,"extname"),Ec(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=zt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ci(t)&&(t=jN(t)),Ls(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?zt.basename(this.path,this.extname):void 0}set stem(t){Ls(t,"stem"),Ms(t,"stem"),this.path=zt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){const o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){const o=new rt(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Ms(e,t){if(e&&e.includes(zt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+zt.sep+"`")}function Ls(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Ec(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function NN(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const TN=(function(e){const r=this.constructor.prototype,o=r[e],s=function(){return o.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),AN={}.hasOwnProperty;class Ra extends TN{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=gN()}copy(){const t=new Ra;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Os(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Bs("data",this.frozen),this.namespace[t]=n,this):AN.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Bs("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=eo(t),r=this.parser||this.Parser;return Fs("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Fs("process",this.parser||this.Parser),$s("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(s,i){const a=eo(t),c=r.parse(a);r.run(c,a,function(d,h,p){if(d||!h||!p)return u(d);const f=h,g=r.stringify(f,p);PN(g)?p.value=g:p.result=g,u(d,p)});function u(d,h){d||!h?i(d):s?s(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),Fs("processSync",this.parser||this.Parser),$s("processSync",this.compiler||this.Compiler),this.process(t,o),Tc("processSync","process",n),r;function o(s,i){n=!0,Cc(s),r=i}}run(t,n,r){Nc(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(i,a){const c=eo(n);o.run(t,c,u);function u(d,h,p){const f=h||t;d?a(d):i?i(f):r(void 0,f,p)}}}runSync(t,n){let r=!1,o;return this.run(t,n,s),Tc("runSync","run",r),o;function s(i,a){Cc(i),o=a,r=!0}}stringify(t,n){this.freeze();const r=eo(n),o=this.compiler||this.Compiler;return $s("stringify",o),Nc(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(Bs("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):i(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...h]=u;c(d,h)}else i(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function i(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(u.plugins),u.settings&&(o.settings=Os(!0,o.settings,u.settings))}function a(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];s(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let h=-1,p=-1;for(;++h<r.length;)if(r[h][0]===u){p=h;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[f,...g]=d;const m=r[p][1];Si(m)&&Si(f)&&(f=Os(!0,m,f)),r[p]=[u,f,...g]}}}}const IN=new Ra().freeze();function Fs(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function $s(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Bs(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Nc(e){if(!Si(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Tc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function eo(e){return zN(e)?e:new Op(e)}function zN(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function PN(e){return typeof e=="string"||RN(e)}function RN(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const ON="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ac=[],Ic={allowDangerousHtml:!0},DN=/^(https?|ircs?|mailto|xmpp)$/i,MN=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Kn(e){const t=LN(e),n=FN(e);return $N(t.runSync(t.parse(n),n),e)}function LN(e){const t=e.rehypePlugins||Ac,n=e.remarkPlugins||Ac,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ic}:Ic;return IN().use(yE).use(n).use(hN,r).use(t)}function FN(e){const t=e.children||"",n=new Op;return typeof t=="string"&&(n.value=t),n}function $N(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,s=t.disallowedElements,i=t.skipHtml,a=t.unwrapDisallowed,c=t.urlTransform||BN;for(const d of MN)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+ON+d.id,void 0);return Rp(e,u),YC(e,{Fragment:l.Fragment,components:o,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function u(d,h,p){if(d.type==="raw"&&p&&typeof h=="number")return i?p.children.splice(h,1):p.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let f;for(f in Is)if(Object.hasOwn(Is,f)&&Object.hasOwn(d.properties,f)){const g=d.properties[f],m=Is[f];(m===null||m.includes(d.tagName))&&(d.properties[f]=c(String(g||""),f,d))}}if(d.type==="element"){let f=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!f&&r&&typeof h=="number"&&(f=!r(d,h,p)),f&&p&&typeof h=="number")return a&&d.children?p.children.splice(h,1,...d.children):p.children.splice(h,1),h}}}function BN(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||r!==-1&&t>r||DN.test(e.slice(0,t))?e:""}function Dp(e){if(e===null)return"null";if(Array.isArray(e))return"array";switch(typeof e){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"object":return"object";case"bigint":case"symbol":case"undefined":case"function":return"object"}}function No(e){return e!==null&&(Array.isArray(e)||typeof e=="object")}function Oa(e){return Array.isArray(e)?e.map((t,n)=>[String(n),t]):typeof e=="object"&&e!==null?Object.entries(e):[]}const zc=1e3,ji=2;function UN(e,t=Number.POSITIVE_INFINITY){let n=0;const r=[e];for(;r.length>0;){const o=r.pop();if(o!==void 0){if(n+=1,n>t)return n;if(No(o))for(const[,s]of Oa(o))r.push(s)}}return n}function ZN(e){const t=UN(e,zc),n=t>zc;return{depth:n?ji:Number.POSITIVE_INFINITY,limited:n,countedNodes:t}}function Pc(e){const t=v.useMemo(()=>e===null?null:Lp(e),[e]),n=t?.kind==="json"?t.data:null,r=v.useMemo(()=>n===null?null:ZN(n),[n]),[o,s]=v.useState(!1),[i,a]=v.useState(0),[c,u]=v.useState(0),[d,h]=v.useTransition(),p=v.useCallback(()=>{const f=!o,g=f&&r!==null?r.depth:0;h(()=>{s(f),a(g),u(m=>m+1)})},[o,r]);return{parsedData:n,policy:r,isExpanded:o,toggle:p,isPending:d,bulkDepth:i,bulkRevision:c}}function Rc({policy:e,isExpanded:t,isPending:n,onToggle:r}){if(e===null)return null;const o=n?"Updating...":t?"Collapse all":e.limited?`Expand ${ji} levels`:"Expand all",s=e.limited&&!t?`Large JSON detected; expand ${ji} levels to protect rendering performance`:t?"Collapse all JSON nodes":"Expand all JSON nodes";return l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsxs(Xe,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:i=>{i.stopPropagation(),r()},disabled:n,"aria-pressed":t,children:[t?l.jsx(Fy,{className:"size-3 mr-1"}):l.jsx(od,{className:"size-3 mr-1"}),o]})}),l.jsx(Fe,{children:s})]})}const Oc=120;function VN({text:e}){const[t,n]=v.useState(!1);return e.length>Oc?l.jsxs("span",{className:"text-emerald-400 break-all",children:['"',t?l.jsx("span",{className:"cursor-pointer prose prose-sm dark:prose-invert inline max-w-none [&_p]:inline [&_p]:my-0 [&_code]:text-emerald-300 [&_a]:text-emerald-300",onClick:o=>{o.stopPropagation(),n(!1)},onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.stopPropagation(),n(!1))},role:"button",tabIndex:0,children:l.jsx(Kn,{children:e})}):l.jsxs(Me,{delayDuration:300,children:[l.jsxs(Le,{onClick:o=>{o.stopPropagation(),n(!0)},className:"text-left cursor-pointer",children:[l.jsx("span",{children:e.slice(0,Oc)}),l.jsx("span",{className:"text-emerald-400/50",children:"…"})]}),l.jsxs(Fe,{side:"bottom",className:"max-w-md text-xs p-2 break-words whitespace-pre-wrap",children:[e.slice(0,500),e.length>500?"…":""]})]}),'"']}):l.jsxs("span",{className:"text-emerald-400 break-all",children:['"',l.jsx("span",{className:"prose prose-sm dark:prose-invert inline max-w-none [&_p]:inline [&_p]:my-0 [&_code]:text-emerald-300 [&_a]:text-emerald-300",children:l.jsx(Kn,{children:e})}),'"']})}function Mp({value:e}){if(e===null)return l.jsx("span",{className:"text-rose-400 italic",children:"null"});switch(typeof e){case"string":return l.jsx(VN,{text:e});case"number":return l.jsx("span",{className:"text-amber-400",children:e});case"boolean":return l.jsx("span",{className:"text-blue-400",children:e?"true":"false"});case"object":case"bigint":case"symbol":case"undefined":case"function":return l.jsx("span",{className:"text-muted-foreground",children:JSON.stringify(e)})}}function Dc({value:e}){const[t,n]=v.useState(!1);function r(o){o.stopPropagation(),window.navigator.clipboard.writeText(JSON.stringify(e,null,2)).then(()=>{n(!0),setTimeout(()=>{n(!1)},2e3)})}return l.jsx("button",{type:"button",onClick:r,className:"inline-flex items-center gap-1 text-[10px] text-muted-foreground hover:text-foreground transition-colors",title:"Copy JSON",children:t?l.jsx(Jt,{className:"size-3 text-green-500"}):l.jsx(bn,{className:"size-3"})})}function HN({value:e}){const[t,n]=v.useState(!1);function r(o){o.stopPropagation(),window.navigator.clipboard.writeText(JSON.stringify(e,null,2)).then(()=>{n(!0),setTimeout(()=>{n(!1)},2e3)})}return l.jsx("button",{type:"button",onClick:r,className:"opacity-0 group-hover/row:opacity-100 hover:bg-muted p-0.5 rounded transition-opacity shrink-0",title:"Copy to clipboard",children:t?l.jsx(Jt,{className:"size-3 text-green-500"}):l.jsx(bn,{className:"size-3 text-muted-foreground"})})}function WN({onClick:e}){return l.jsx("button",{type:"button",onClick:e,className:"opacity-0 group-hover/row:opacity-100 hover:bg-muted p-0.5 rounded transition-opacity shrink-0",title:"Expand all descendants",children:l.jsx(od,{className:"size-3.5 text-muted-foreground"})})}const qN=v.memo(function e({name:t,value:n,level:r,defaultExpandDepth:o,isArrayItem:s}){const[i,a]=v.useState(r<o),[c,u]=v.useState(0),[d,h]=v.useState(null),p=No(n),f=d===Number.POSITIVE_INFINITY,g=v.useMemo(()=>Oa(n),[n]),m=v.useMemo(()=>g.some(([,T])=>No(T)),[g]),x=Dp(n),y=x==="array"?"[":"{",b=x==="array"?"]":"}";function k(){a(!0),h(Number.POSITIVE_INFINITY),u(T=>T+1)}function S(){a(!1),h(0),u(T=>T+1)}function j(){f?S():a(!i)}function C(T){T.stopPropagation(),k()}const N=d??o;return l.jsxs("div",{className:he(r>0&&"border-l border-border/50 ml-2"),children:[l.jsxs("div",{className:he("flex items-start gap-1 py-0.5 px-1 -ml-1 rounded-sm group/row",p&&"cursor-pointer hover:bg-muted/50"),onClick:p?j:void 0,onKeyDown:p?T=>{(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),j())}:void 0,onDoubleClick:p&&m?()=>k():void 0,role:p?"button":void 0,tabIndex:p?0:void 0,children:[p?l.jsx("span",{className:"w-4 h-5 flex items-center justify-center shrink-0",children:i?l.jsx(vt,{className:"size-3 text-muted-foreground"}):l.jsx(bt,{className:"size-3 text-muted-foreground"})}):l.jsx("span",{className:"w-4 shrink-0"}),l.jsx("span",{className:he("shrink-0",s?"text-muted-foreground":"text-cyan-400"),children:s?t:`"${t}"`}),l.jsx("span",{className:"text-muted-foreground shrink-0",children:p?"":":"}),p?l.jsxs("span",{className:"text-muted-foreground",children:[y,l.jsxs("span",{className:"text-muted-foreground/60 text-xs",children:[" ",g.length," ",g.length===1?"item":"items"," ",b]})]}):l.jsx("span",{className:"min-w-0",children:l.jsx(Mp,{value:n})}),p&&m&&!f&&l.jsx(WN,{onClick:C}),l.jsx(HN,{value:n})]}),p&&i&&l.jsxs("div",{className:"pl-4",children:[g.map(([T,A])=>l.jsx(e,{name:T,value:A,level:r+1,defaultExpandDepth:N,isArrayItem:x==="array"},T)),l.jsx("div",{className:"text-muted-foreground py-0.5 px-1",children:b})]},c)]})});function Jn({data:e,defaultExpandDepth:t=0,className:n,showCopy:r=!1,bulkDepth:o,bulkRevision:s}){const i=No(e),a=v.useMemo(()=>Oa(e),[e]),c=o??t,u=s??0;if(!i)return l.jsx(Ge,{children:l.jsx("div",{className:he("font-mono text-xs leading-relaxed",n),children:l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(Mp,{value:e}),r&&l.jsx(Dc,{value:e})]})})});const h=Dp(e)==="array";return l.jsx(Ge,{children:l.jsxs("div",{className:he("font-mono text-xs leading-relaxed",n),children:[r&&l.jsx("div",{className:"mb-2 flex items-center justify-end gap-2",children:l.jsx(Dc,{value:e})}),l.jsx("div",{children:a.map(([p,f])=>l.jsx(qN,{name:p,value:f,level:0,defaultExpandDepth:c,isArrayItem:h},p))},u)]})})}function Lp(e){try{const t=JSON.parse(e);return{kind:"json",data:Nr(t)}}catch{return{kind:"text"}}}const br=v.memo(function({text:t,defaultExpandDepth:n=0,className:r}){const o=v.useMemo(()=>Lp(t),[t]);return o.kind==="json"?l.jsx(Jn,{data:o.data,defaultExpandDepth:n,className:r}):l.jsx("pre",{className:he("font-mono text-xs whitespace-pre-wrap break-words",r),children:t})});function Nr(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=>Nr(n));const t={};for(const n of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,n);t[n]=Nr(r?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function Pn({className:e,orientation:t="horizontal",...n}){return l.jsx(uS,{"data-slot":"tabs","data-orientation":t,orientation:t,className:he("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",e),...n})}const KN=Yi("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 Rn({className:e,variant:t="default",...n}){return l.jsx(dS,{"data-slot":"tabs-list","data-variant":t,className:he(KN({variant:t}),e),...n})}function tt({className:e,...t}){return l.jsx(fS,{"data-slot":"tabs-trigger",className:he("focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent","data-[state=active]:bg-background dark:data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 data-[state=active]:text-foreground","after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100",e),...t})}function nt({className:e,...t}){return l.jsx(hS,{"data-slot":"tabs-content",className:he("flex-1 outline-none",e),...t})}class Fp{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),a=this.removeEmpty(this.tokenize(s,r)),c=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(a,c,r,o)}diffWithOptionsObj(t,n,r,o){var s;const i=b=>{if(b=this.postProcess(b,r),o){setTimeout(function(){o(b)},0);return}else return b},a=n.length,c=t.length;let u=1,d=a+c;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));const h=(s=r.timeout)!==null&&s!==void 0?s:1/0,p=Date.now()+h,f=[{oldPos:-1,lastComponent:void 0}];let g=this.extractCommon(f[0],n,t,0,r);if(f[0].oldPos+1>=c&&g+1>=a)return i(this.buildValues(f[0].lastComponent,n,t));let m=-1/0,x=1/0;const y=()=>{for(let b=Math.max(m,-u);b<=Math.min(x,u);b+=2){let k;const S=f[b-1],j=f[b+1];S&&(f[b-1]=void 0);let C=!1;if(j){const T=j.oldPos-b;C=j&&0<=T&&T<a}const N=S&&S.oldPos+1<c;if(!C&&!N){f[b]=void 0;continue}if(!N||C&&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,b,r),k.oldPos+1>=c&&g+1>=a)return i(this.buildValues(k.lastComponent,n,t))||!0;f[b]=k,k.oldPos+1>=c&&(x=Math.min(x,b-1)),g+1>=a&&(m=Math.max(m,b+1))}u++};if(o)(function b(){setTimeout(function(){if(u>d||Date.now()>p)return o(void 0);y()||b()},0)})();else for(;u<=d&&Date.now()<=p;){const b=y();if(b)return b}}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,a=r.length;let c=t.oldPos,u=c-o,d=0;for(;u+1<i&&c+1<a&&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 a=0,c=0,u=0;for(;a<i;a++){const d=o[a];if(d.removed)d.value=this.join(r.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let h=n.slice(c,c+d.count);h=h.map(function(p,f){const g=r[u+f];return g.length>p.length?g:p}),d.value=this.join(h)}else d.value=this.join(n.slice(c,c+d.count));c+=d.count,d.added||(u+=d.count)}}return o}}class JN extends Fp{constructor(){super(...arguments),this.tokenize=Bp}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
98
98
  `))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
99
99
  `))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
100
100
  `)&&(t=t.slice(0,-1)),n.endsWith(`
101
- `)&&(n=n.slice(0,-1))),super.equals(t,n,r)}}const H3=new W3;function Dp(e,t,n){return H3.diff(e,t,n)}function Mp(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
102
- `));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 q3 extends Op{constructor(){super(...arguments),this.tokenize=Mp}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(ji(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 K3=new q3;function G3(e,t,n){return K3.diff(e,t,n)}function ji(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]=ji(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 a=[];let c;for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&a.push(c);for(a.sort(),s=0;s<a.length;s+=1)c=a[s],i[c]=ji(e[c],t,n,r,c);t.pop(),n.pop()}else i=e;return i}function Oc(e){return e===void 0?[]:Object.entries(e).map(t=>[t[0].toLowerCase(),t[1]]).sort(([t],[n])=>t.localeCompare(n))}function Dc([e,t]){return`${e}: ${t}`}function Ei(e){const t=[];let n=0,r=0;for(const o of e){const s=o.value.split(`
103
- `);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 J3(e,t){const n=Oc(e).map(Dc).join(`
104
- `),r=Oc(t).map(Dc).join(`
105
- `);if(n===r)return{lines:[],isEmpty:!0};const o=Dp(n,r);return{lines:Ei(o),isEmpty:!1}}function Mc(e){try{const t=JSON.parse(e);return t===null||typeof t=="string"||typeof t=="object"?t:null}catch{return null}}function Y3(e,t){const n=e??"",r=t??"";if(n===r)return{lines:[],isEmpty:!0};const o=Mc(n),s=Mc(r);if(o!==null&&s!==null){const a=G3(o,s)??[];if(a.length===1){const c=a[0];if(c!==void 0&&!c.added&&!c.removed)return{lines:[],isEmpty:!0}}return{lines:Ei(a),isEmpty:!1}}const i=Dp(n,r);return{lines:Ei(i),isEmpty:!1}}function X3(e,t,n){const r=new Array(e);return new Proxy(r,{get(o,s,i){if(typeof s=="string"){const a=s.charCodeAt(0);if(a>=48&&a<=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 An(e,t,n){let r=n.initialDeps??[],o,s=!0;function i(){const a=e();return(a.length!==r.length||a.some((u,d)=>r[d]!==u))&&(r=a,o=t(...a),n?.onChange&&!(s&&n.skipInitialOnChange)&&n.onChange(o),s=!1),o}return i.updateDeps=a=>{r=a},i}function Lc(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const Fc=(e,t)=>Math.abs(e-t)<1.01,Q3=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}};let hr;const $c=()=>{if(hr!==void 0)return hr;if(typeof navigator>"u")return hr=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return hr=!0;const e=navigator.maxTouchPoints;return hr=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Bc=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},eN=e=>e,tN=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},nN=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=i=>{const{width:a,height:c}=i;t({width:Math.round(a),height:Math.round(c)})};if(o(Bc(n)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(i=>{const a=()=>{const c=i[0];if(c?.borderBoxSize){const u=c.borderBoxSize[0];if(u){o({width:u.inlineSize,height:u.blockSize});return}}o(Bc(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},No={passive:!0},rN=typeof window>"u"?!0:"onscrollend"in window,oN=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const o=e.targetWindow;if(!o)return;const s=e.options.useScrollendEvent&&rN;let i=0;const a=s?null:Q3(o,()=>t(i,!1),e.options.isScrollingResetDelay),c=h=>()=>{i=n(r),a?.(),t(i,h)},u=c(!0),d=c(!1);return r.addEventListener("scroll",u,No),s&&r.addEventListener("scrollend",d,No),()=>{r.removeEventListener("scroll",u),s&&r.removeEventListener("scrollend",d)}},sN=(e,t)=>oN(e,t,n=>{const{horizontal:r,isRtl:o}=e.options;return r?n.scrollLeft*(o&&-1||1):n.scrollTop}),iN=(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"]},aN=(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})},lN=aN;class cN{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 a=s.target,c=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[u,d]of this.elementsCache)if(d===a){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(a,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:eN,rangeExtractor:tN,onChange:()=>{},measureElement:iN,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 a=null,c=null;if(i!==void 0&&i.enabled&&s.enabled&&s.anchorTo==="end"&&this.scrollElement!==null){const u=i.count,d=s.count,h=this.getMeasurements(),p=u>0?((r=h[0])==null?void 0:r.key)??i.getItemKey(0):null,f=u>0?((o=h[u-1])==null?void 0:o.key)??i.getItemKey(u-1):null;if(d!==u||u>0&&d>0&&(s.getItemKey(0)!==p||s.getItemKey(d-1)!==f)){const x=u>0?this.getVirtualItemForOffset(this.getScrollOffset())??h[0]:null;x&&(a=[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)!==f)&&(c=y)}}this.options=s,(a||c)&&(this.pendingScrollAnchor=[a?.[0]??null,a?.[1]??0,c])},this.notify=n=>{var r,o;(o=(r=this.options).onChange)==null||o.call(r,this,n)},this.maybeNotify=An(()=>(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)},a=()=>{this._iosTouching=!1,!(!$c()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",i,No),s.addEventListener("touchend",a,No),this.unsubs.push(()=>{s.removeEventListener("touchstart",i),s.removeEventListener("touchend",a),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,a]=o;if(s!==null){const{count:c,getItemKey:u}=this.options;let d=0;for(;d<c&&u(d)!==s;)d++;const h=d<c?this.getMeasurements()[d]:void 0;if(h){const p=h.start+i-this.getScrollOffset();Fc(p,0)||this.applyScrollAdjustment(p)}}a&&this.scrollToEnd({behavior:a})}},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 a=n[i];if(o.has(a.lane))continue;const c=s.get(a.lane);if(c==null||a.end>c.end?s.set(a.lane,a):a.end<c.end&&o.set(a.lane,!0),o.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((i,a)=>i.end===a.end?i.index-a.index:i.end-a.end)[0]:void 0},this.getMeasurementOptions=An(()=>[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,a,c)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:a,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=An(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:a,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 h=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),a===1){const g=this.options.gap,m=n*2;let x=this._flatMeasurements;if(!x||x.length<m){const k=new Float64Array(m);x&&h>0&&k.set(x.subarray(0,h*2)),x=k,this._flatMeasurements=x}let y;if(h===0)y=r+o;else{const k=h-1;y=x[k*2]+x[k*2+1]+g}for(let k=h;k<n;k++){const S=s(k),C=d.get(S),j=typeof C=="number"?C:this.options.estimateSize(k);x[k*2]=y,x[k*2+1]=j,y+=j+g}const b=X3(n,x,s);return this.measurementsCache=b,b}const p=this.measurementsCache.slice(0,h),f=new Array(a).fill(void 0);for(let g=0;g<h;g++){const m=p[g];m&&(f[m.lane]=g)}for(let g=h;g<n;g++){const m=s(g),x=this.laneAssignments.get(g);let y,b;const k=c==="estimate"||d.has(m);if(x!==void 0&&this.options.lanes>1){y=x;const N=f[y],T=N!==void 0?p[N]:void 0;b=T?T.end+this.options.gap:r+o}else{const N=this.options.lanes===1?p[g-1]:this.getFurthestMeasurement(p,g);b=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(m),C=typeof S=="number"?S:this.options.estimateSize(g),j=b+C;p[g]={index:g,start:b,size:C,end:j,key:m,lane:y},f[y]=g}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=An(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,s)=>this.range=n.length>0&&r>0?uN({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=An(()=>{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),a=Math.min(this.options.count-1,o+s);return n>=i&&n<=a}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((i,a)=>{i.isConnected||(this.observer.unobserve(i),this.elementsCache.delete(a))});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,a,c;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)c=this.options.getItemKey(n),a=u[n*2],i=u[n*2+1];else{const p=this.measurementsCache[n];if(!p)return;c=p.key,a=p.start,i=p.size}const d=this.itemSizeCache.get(c)??i,h=r-d;if(h!==0){const p=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,f=p?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:a,size:i,end:a+i,lane:0},h,this):a<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(c,r),this.itemSizeCacheVersion++,p?this.applyScrollAdjustment(this.getTotalSize()-f):g&&this.applyScrollAdjustment(h),this.notify(!1)}},this.getVirtualItems=An(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let s=0,i=n.length;s<i;s++){const a=n[s],c=r[a];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=Lp(0,r.length-1,s?a=>o[a*2]:a=>Lc(r[a]).start,n);return Lc(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 a=this.getMaxScrollOffset();return Math.max(Math.min(a,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 a=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,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,a]=s,c=this.now();this.scrollState={index:n,align:a,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(a=>a===null);){const a=r[i];s[a.lane]===null&&(s[a.lane]=a.end),i--}o=Math.max(...s.filter(a=>a!==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&&($c()&&(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&&Fc(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 a=this.getSize()||600,c=Math.abs(o-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&c>a;this.scrollState.lastTargetOffset=o,u||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Lp=(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 uN({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,a=o?d=>o[d*2]+o[d*2+1]:d=>e[d].end;if(e.length<=r)return{startIndex:0,endIndex:s};let c=Lp(0,s,i,n),u=c;if(r===1)for(;u<s&&a(u)<n+t;)u++;else if(r>1){const d=Array(r).fill(0);for(;u<s&&d.some(p=>p<n+t);){const p=e[u];d[p.lane]=p.end,u++}const h=Array(r).fill(n+t);for(;c>=0&&h.some(p=>p>=n);){const p=e[c];h[p.lane]=p.start,c--}c=Math.max(0,c-c%r),u=Math.min(s,u+(r-1-u%r))}return{startIndex:c,endIndex:u}}const Uc=typeof document<"u"?v.useLayoutEffect:v.useEffect;function dN({useFlushSync:e=!0,...t}){const n=v.useReducer(s=>s+1,0)[1],r={...t,onChange:(s,i)=>{var a;e&&i?Tr.flushSync(n):n(),(a=t.onChange)==null||a.call(t,s,i)}},[o]=v.useState(()=>new cN(r));return o.setOptions(r),Uc(()=>o._didMount(),[]),Uc(()=>o._willUpdate()),o}function fN(e){return dN({observeElementRect:nN,observeElementOffset:sN,scrollToFn:lN,...e})}const hN=22,Us=1e4;function pN(e){return e==="added"?"+":e==="removed"?"-":" "}function mN(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 gN=function({result:t,emptyLabel:n}){const[r,o]=v.useState("unified"),s=v.useRef(null),i=fN({count:t.lines.length,getScrollElement:()=>s.current,estimateSize:()=>hN,overscan:10});if(t.isEmpty)return l.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 a=t.lines.length,c=a>Us,u=c?t.lines.slice(0,Us):t.lines;return l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[l.jsxs("span",{children:[a.toLocaleString()," line",a===1?"":"s",c&&` (showing first ${Us.toLocaleString()})`]}),l.jsxs("div",{className:"inline-flex rounded-md border border-border overflow-hidden",children:[l.jsxs("button",{type:"button",onClick:()=>o("unified"),"aria-pressed":r==="unified",className:he("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:[l.jsx(ld,{className:"size-3"}),"Unified"]}),l.jsxs("button",{type:"button",onClick:()=>o("split"),"aria-pressed":r==="split",className:he("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:[l.jsx(rd,{className:"size-3"}),"Split"]})]})]}),l.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"?l.jsx(xN,{virtualizer:i,lines:u}):l.jsx(bN,{lines:u})})]})};function xN({virtualizer:e,lines:t}){return l.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:l.jsxs("div",{"data-index":n.index,ref:e.measureElement,className:he("flex items-start gap-3 px-2",mN(r.kind)),style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${n.start}px)`},children:[l.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:r.oldLineNumber??""}),l.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:r.newLineNumber??""}),l.jsx("span",{className:he("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:pN(r.kind)}),l.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:r.text})]},n.key)})})}function yN(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 a=e[n];a!==void 0&&o.push(a),n+=1}for(;n<e.length&&e[n]?.kind==="added";){const a=e[n];a!==void 0&&s.push(a),n+=1}const i=Math.max(o.length,s.length);for(let a=0;a<i;a+=1){const c=o[a],u=s[a];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 vN(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 bN({lines:e}){const t=yN(e);return l.jsx("div",{"data-testid":"diff-split",children:t.map((n,r)=>l.jsxs("div",{className:he("grid grid-cols-2 font-mono text-xs",vN(n.kind)),children:[l.jsxs("div",{className:"flex items-start gap-2 px-2 border-r border-border/50",children:[l.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.left?.lineNumber??""}),l.jsx("span",{className:he("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?"-":" "}),l.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.left?.text??""})]}),l.jsxs("div",{className:"flex items-start gap-2 px-2",children:[l.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.right?.lineNumber??""}),l.jsx("span",{className:he("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?"+":" "}),l.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.right?.text??""})]})]},r))})}const Fp=v.memo(gN);function wN(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const Zc={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:"",pending:"bg-muted text-muted-foreground border-border"};function Vc({trend:e}){if(e===null)return null;const t=e.direction==="up",n=t?Cy:_y,r=t?"+":"-";return l.jsxs("span",{className:"flex items-center gap-0.5 text-muted-foreground tabular-nums",children:[l.jsx(n,{className:t?"size-3 text-emerald-400":"size-3 text-rose-400"}),l.jsxs("span",{className:"font-mono",children:[r,qe(e.delta)]})]})}const kN=v.memo(function({log:e,messageCount:t=null,toolCount:n=null,expanded:r,onToggle:o,responseToolNames:s=null,cacheTrend:i=null}){const a=Cd(e.responseStatus),c=e.inputTokens!==null||e.outputTokens!==null,u=v.useMemo(()=>s?.join(", ")??null,[s]);return l.jsx(Je,{children:l.jsxs("div",{role:"button",tabIndex:0,className:he("flex items-center gap-2 px-3 py-1 cursor-pointer transition-colors","hover:bg-muted/50","select-none"),onClick:o,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),o())},children:[l.jsxs("span",{className:"text-blue-400/80 font-mono text-xs font-semibold tabular-nums shrink-0",children:["#",e.id]}),e.model!==null&&l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsx("span",{className:"shrink-0",children:l.jsx(Yh,{provider:Jh(e.model),className:"size-4"})})}),l.jsx($e,{children:e.model})]}),a!=="success"&&l.jsx(l.Fragment,{children:a==="server_error"?l.jsx(xt,{variant:"destructive",className:"text-[10px] px-1.5 py-0 h-4 font-mono tabular-nums",children:e.responseStatus}):a==="pending"?l.jsx(xt,{variant:"outline",className:he("text-[10px] px-1.5 py-0 h-4 font-mono tabular-nums",Zc[a]),children:l.jsx(Sr,{className:"size-3 animate-spin"})}):l.jsx(xt,{variant:"outline",className:he("text-[10px] px-1.5 py-0 h-4 font-mono tabular-nums",Zc[a]),children:e.responseStatus})}),e.elapsedMs!==null&&l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(Ir,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:wN(e.elapsedMs)})]}),c&&l.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[l.jsx(Xn,{className:"size-3 text-muted-foreground"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[l.jsxs("span",{className:e.inputTokens!==null?"text-blue-400":"text-muted-foreground",children:["IN ",e.inputTokens!==null?qe(e.inputTokens):"—"]})," / ",l.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&&l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[l.jsx(Vc,{trend:i?.creation??null}),l.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",qe(e.cacheCreationInputTokens)]})]})}),l.jsx($e,{children:"Tokens cached for reuse, reducing future API cost"})]}),e.cacheReadInputTokens!==null&&e.cacheReadInputTokens>0&&l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[l.jsx(Vc,{trend:i?.read??null}),l.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",qe(e.cacheReadInputTokens)]})]})}),l.jsx($e,{children:"Tokens served from cache, reducing API cost"})]}),t!==null&&l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(sd,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:t})]}),n!==null&&l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(ul,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:n})]}),s!==null&&s.length>0&&l.jsxs("span",{className:"flex items-center gap-1 text-amber-400/80 text-xs shrink-0",children:[l.jsx(ul,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums truncate max-w-[160px]",children:u})]}),e.origin!==null&&l.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:`Origin: ${e.origin}`,children:[l.jsx(sv,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",title:e.origin,children:e.origin})]}),(e.clientPid!==null||e.clientProjectFolder!==null)&&l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-purple-400/80 text-xs shrink-0",children:[l.jsx(ev,{className:"size-3"}),e.clientProjectFolder!==null?l.jsx("span",{className:"font-mono tabular-nums",children:e.clientProjectFolder}):l.jsxs("span",{className:"font-mono tabular-nums",children:["PID ",e.clientPid]})]})}),l.jsx($e,{children:e.clientCwd!==null?`PID: ${e.clientPid??"?"} CWD: ${e.clientCwd}`:`Process ID: ${e.clientPid??"?"}`})]}),e.streaming&&l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsx(pv,{className:"size-3 text-muted-foreground/60 shrink-0"})}),l.jsx($e,{children:"Request used SSE streaming"})]}),l.jsx("span",{className:"flex-1 min-w-0"}),r?l.jsx(vt,{className:"size-4 text-muted-foreground shrink-0"}):l.jsx(bt,{className:"size-4 text-muted-foreground shrink-0"})]})})});function $p({className:e,orientation:t="horizontal",decorative:n=!0,...r}){return l.jsx(oS,{"data-slot":"separator",decorative:n,orientation:t,className:he("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...r})}function ds({...e}){return l.jsx(a2,{"data-slot":"collapsible",...e})}function fs({...e}){return l.jsx(Rd,{"data-slot":"collapsible-trigger",...e})}function hs({...e}){return l.jsx(Pd,{"data-slot":"collapsible-content",...e})}function Oa({className:e,children:t,...n}){return l.jsxs(x_,{"data-slot":"scroll-area",className:he("relative",e),...n,children:[l.jsx(y_,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),l.jsx(_N,{}),l.jsx(v_,{})]})}function _N({className:e,orientation:t="vertical",...n}){return l.jsx(Wf,{"data-slot":"scroll-area-scrollbar",orientation:t,className:he("flex touch-none p-px transition-colors select-none",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e),...n,children:l.jsx(Gf,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}function SN(e){return l.jsx(l.Fragment,{})}function CN({text:e}){const[t,n]=v.useState(!1);return l.jsxs(ds,{open:t,onOpenChange:n,children:[l.jsxs(fs,{className:"flex items-center gap-1.5 py-0.5 cursor-pointer hover:opacity-80 transition-opacity group",children:[t?l.jsx(vt,{className:"size-3 text-muted-foreground"}):l.jsx(bt,{className:"size-3 text-muted-foreground"}),l.jsx("span",{className:"text-muted-foreground text-xs italic select-none opacity-60",children:"[system-reminder]"})]}),l.jsx(hs,{children:l.jsx("div",{className:"pl-4 pt-1",children:l.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&_pre]:bg-muted [&_pre]:text-foreground [&_code]:text-[0.8em] [&_p]:my-1 [&_ul]:my-1 [&_ol]:my-1",children:l.jsx(Gn,{children:e})})})})]})}const jN=/<think>([\s\S]*?)<\/think>/gi,EN=/<think>([\s\S]*?)<\/think>/i;function Bp(e){const t=EN.exec(e);if(!t||t[1]===void 0)return{thinking:null,remainingText:e};const n=t[1].trim(),r=e.replace(jN,"").trim();return{thinking:n,remainingText:r}}const NN=v.memo(function({text:t}){if(t.includes("<system-reminder>"))return l.jsx(CN,{text:t});const{thinking:n,remainingText:r}=Bp(t);return l.jsxs("div",{className:"space-y-2",children:[n!==null&&l.jsx(To,{thinking:n}),r.length>0&&l.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&_pre]:bg-muted [&_pre]:text-foreground [&_code]:text-[0.8em] [&_p]:my-1 [&_ul]:my-1 [&_ol]:my-1",children:l.jsx(Gn,{children:r})}),n===null&&r.length===0&&l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty text block"})]})}),To=v.memo(function({thinking:t}){const[n,r]=v.useState(!1);return l.jsx(ds,{open:n,onOpenChange:r,children:l.jsxs("div",{className:"border-l-2 border-purple-500/40 my-1",children:[l.jsxs(fs,{className:"flex items-center gap-1.5 px-3 py-1 w-full text-left cursor-pointer hover:bg-purple-500/5 transition-colors rounded-r-sm group",children:[l.jsx(Ey,{className:"size-3.5 text-purple-400 shrink-0"}),l.jsx("span",{className:"text-xs font-medium text-purple-400",children:"Thinking"}),l.jsxs(xt,{variant:"ghost",className:"text-[10px] text-muted-foreground px-1.5 py-0 h-4 font-mono",children:[t.length.toLocaleString()," chars"]}),l.jsx("span",{className:"flex-1"}),n?l.jsx(vt,{className:"size-3 text-muted-foreground"}):l.jsx(bt,{className:"size-3 text-muted-foreground"})]}),l.jsx(hs,{children:l.jsx("div",{className:"px-3 pb-2",children:l.jsx(Oa,{className:"max-h-[60vh]",children:l.jsx("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap font-mono leading-relaxed",children:t})})})})]})})}),TN=v.memo(function({name:t,input:n}){const[r,o]=v.useState(!1);return l.jsx(ds,{open:r,onOpenChange:o,children:l.jsxs("div",{className:"border-l-2 border-blue-500/40 my-1",children:[l.jsxs(fs,{className:"flex items-center gap-1.5 px-3 py-1 w-full text-left cursor-pointer hover:bg-blue-500/5 transition-colors rounded-r-sm group",children:[l.jsx(cd,{className:"size-3.5 text-blue-400 shrink-0"}),l.jsx(xt,{variant:"outline",className:"text-[10px] font-mono px-1.5 py-0 h-4",children:t}),l.jsx("span",{className:"flex-1"}),r?l.jsx(vt,{className:"size-3 text-muted-foreground"}):l.jsx(bt,{className:"size-3 text-muted-foreground"})]}),l.jsx(hs,{children:l.jsx("div",{className:"px-3 pb-2",children:l.jsx(Oa,{className:"max-h-[60vh]",children:l.jsx(us,{data:Jn(n),defaultExpandDepth:2})})})})]})})}),AN=v.memo(function({block:t}){switch(t.type){case"text":return l.jsx(NN,{text:t.text});case"thinking":case"think":return l.jsx(To,{thinking:t.thinking});case"tool_use":return l.jsx(TN,{name:t.name,input:t.input});default:return SN()}}),IN=v.memo(function({response:t}){return l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx(xt,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-5 font-mono",children:t.model}),t.stop_reason!==null&&l.jsxs(xt,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-5 font-mono flex items-center gap-1",children:[l.jsx(nd,{className:"size-2.5"}),t.stop_reason]}),l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[l.jsx(Xn,{className:"size-3"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[qe(t.usage.input_tokens??0)," in /"," ",qe(t.usage.output_tokens??0)," out"]}),t.usage.cache_creation_input_tokens!==void 0&&t.usage.cache_creation_input_tokens!==null&&t.usage.cache_creation_input_tokens>0&&l.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",qe(t.usage.cache_creation_input_tokens)]}),t.usage.cache_read_input_tokens!==void 0&&t.usage.cache_read_input_tokens!==null&&t.usage.cache_read_input_tokens>0&&l.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",qe(t.usage.cache_read_input_tokens)]})]})]}),l.jsx($p,{className:"opacity-50"}),l.jsxs("div",{className:"space-y-2",children:[t.content.map((n,r)=>l.jsx(AN,{block:n},r)),t.content.length===0&&l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty response content"})]})]})});function zN(e){if(e===void 0||e==="")return{};try{return JSON.parse(e)}catch{return null}}function RN({call:e}){const[t,n]=v.useState(!1),r=e.function.name??"(unnamed tool)",o=zN(e.function.arguments);return l.jsx(ds,{open:t,onOpenChange:n,children:l.jsxs("div",{className:"border-l-2 border-blue-500/40 my-1",children:[l.jsxs(fs,{className:"flex items-center gap-1.5 px-3 py-1 w-full text-left cursor-pointer hover:bg-blue-500/5 transition-colors rounded-r-sm group",children:[l.jsx(cd,{className:"size-3.5 text-blue-400 shrink-0"}),l.jsx(xt,{variant:"outline",className:"text-[10px] font-mono px-1.5 py-0 h-4",children:r}),e.id!==void 0&&e.id!==""&&l.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/60 truncate",children:e.id}),l.jsx("span",{className:"flex-1"}),t?l.jsx(vt,{className:"size-3 text-muted-foreground"}):l.jsx(bt,{className:"size-3 text-muted-foreground"})]}),l.jsx(hs,{children:l.jsx("div",{className:"px-3 pb-2",children:l.jsx(Oa,{className:"max-h-[60vh]",children:o===null?l.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words text-rose-300/90",children:e.function.arguments}):l.jsx(us,{data:Jn(o),defaultExpandDepth:2})})})})]})})}const PN=v.memo(function({response:t}){const n=t.choices[0],r=n?.message,o=r?.tool_calls??[];return l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx(xt,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-5 font-mono",children:t.model}),n?.finish_reason!==null&&n?.finish_reason!==void 0&&l.jsxs(xt,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-5 font-mono flex items-center gap-1",children:[l.jsx(nd,{className:"size-2.5"}),n.finish_reason]}),l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[l.jsx(Xn,{className:"size-3"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[qe(t.usage.prompt_tokens??0)," in /"," ",qe(t.usage.completion_tokens??0)," out"]})]})]}),l.jsx($p,{className:"opacity-50"}),l.jsxs("div",{className:"space-y-2",children:[r?.reasoning_content!==null&&r?.reasoning_content!==void 0&&r.reasoning_content.length>0&&l.jsx(To,{thinking:r.reasoning_content}),r?.content!==null&&r?.content!==void 0&&r.content.length>0&&(()=>{const s=r.reasoning_content!==null&&r.reasoning_content!==void 0&&r.reasoning_content.length>0,{thinking:i,remainingText:a}=Bp(r.content);return l.jsxs("div",{className:"space-y-2",children:[i!==null&&!s&&l.jsx(To,{thinking:i}),a.length>0&&l.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&_pre]:bg-muted [&_pre]:text-foreground [&_code]:text-[0.8em] [&_p]:my-1 [&_ul]:my-1 [&_ol]:my-1",children:l.jsx(Gn,{children:a})})]})})(),o.map((s,i)=>l.jsx(RN,{call:s},s.id??`tc-${i}`)),r?.function_call!==null&&r?.function_call!==void 0&&l.jsxs("div",{className:"border border-blue-500/30 rounded-md p-3 bg-blue-500/5",children:[l.jsx("div",{className:"text-xs text-blue-400 font-mono mb-1",children:"function_call"}),l.jsxs("div",{className:"font-mono text-xs",children:[l.jsx("span",{className:"text-blue-300",children:r.function_call.name}),l.jsxs("span",{className:"text-muted-foreground",children:["(",r.function_call.arguments,")"]})]})]}),(r?.content===null||r?.content===void 0||r.content.length===0)&&(r?.reasoning_content===null||r?.reasoning_content===void 0||r.reasoning_content.length===0)&&(r?.function_call===null||r?.function_call===void 0)&&o.length===0&&l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty response content"})]})]})});function Up(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ON(e){return Up(e)&&e.object==="chat.completion"}function DN(e){return Up(e)&&e.type==="message"&&Array.isArray(e.content)}function MN(e,t){return e==="openai"&&ON(t)?l.jsx(PN,{response:t}):e==="anthropic"&&DN(t)?l.jsx(IN,{response:t}):null}const LN="/v1/chat/completions",FN="/chat/completions",$N="/v1/messages";class BN{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 ir=new BN;function UN(e){return ir.getByPath(e)??null}function ZN(e){return UN(e)?.format??"unknown"}ir.registerPath($N,"anthropic");ir.registerPath(LN,"openai");ir.registerPath(FN,"openai");function VN(e){if(e==="")return{};try{const t=JSON.parse(e);return t!==null&&typeof t=="object"&&!Array.isArray(t)?{...t}:{}}catch{return{}}}function WN(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:VN(e.inputJson)}}}function Zp(e,t,n,r){const o=new Map;let s="",i="",a=null,c=null,u=0,d=0;const h=1e3;let p=0,f=0;const g=[];for(const x of e.split(`
106
- `)){const y=x.trim();if(y.startsWith("data: "))try{const b=JSON.parse(y.slice(6)),k=iy.safeParse(b);if(!k.success)continue;const S=k.data;switch(p===0&&(f=Date.now()),r===!0&&g.length<h&&g.push({index:p,timestamp:Date.now()-f,type:S.type,data:S}),p++,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 C=S.content_block;switch(C.type){case"text":o.set(S.index,{type:"text",text:C.text??""});break;case"thinking":o.set(S.index,{type:"thinking",thinking:C.thinking??"",signature:C.signature??""});break;case"think":o.set(S.index,{type:"think",thinking:C.thinking??"",signature:C.signature??""});break;case"tool_use":o.set(S.index,{type:"tool_use",id:C.id,name:C.name,inputJson:""});break}break}case"content_block_delta":{const C=o.get(S.index);if(C===void 0)break;const j=S.delta;j.type==="text_delta"&&C.type==="text"?C.text+=j.text:j.type==="thinking_delta"&&(C.type==="thinking"||C.type==="think")?C.thinking+=j.thinking:j.type==="signature_delta"&&(C.type==="thinking"||C.type==="think")?C.signature+=j.signature:j.type==="input_json_delta"&&C.type==="tool_use"&&(C.inputJson+=j.partial_json);break}case"message_delta":a=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:p>h});const m=[...o.entries()].sort(([x],[y])=>x-y).map(([,x])=>WN(x));return JSON.stringify({id:s,type:"message",model:i!==""?i:n??"",role:"assistant",content:m,stop_reason:a,stop_sequence:c,usage:{input_tokens:u,output_tokens:d}})}const HN={format:"anthropic",parseRequest(e,t){try{const n=JSON.parse(e),r=Hu.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=qu.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 Zp(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}}};ir.register(HN);class qN{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 Da=new qN,KN="https://api.anthropic.com",GN={MiniMax:"https://api.minimaxi.com/anthropic"},JN={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(GN))if(t.startsWith(n.toLowerCase()))return!0;return!0},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:KN},extractStream(e,t,n,r){return Zp(e,t,n,r)}};Da.register(JN);function Ma(e,t,n,r=!0){let o="",s="",i="",a="",c=null,u=0,d=0,h=!1,p=!1;const f=new Map,g=1e3;let m=0,x=0;const y=[];for(const k of e.split(`
107
- `)){const S=k.trim();if(!S.startsWith("data: "))continue;const C=S.slice(6);if(C==="[DONE]")break;try{const j=JSON.parse(C);if(typeof j=="object"&&j!==null&&!Array.isArray(j)){const A=Object.getOwnPropertyDescriptor(j,"error");if(A!==void 0&&typeof A.value=="object"&&A.value!==null){const O=Object.getOwnPropertyDescriptor(A.value,"message");O!==void 0&&typeof O.value=="string"&&(t.error=O.value);continue}}const N=fy.safeParse(j);if(!N.success)continue;const T=N.data;if(m===0&&(x=Date.now()),r===!0&&y.length<g&&y.push({index:m,timestamp:Date.now()-x,type:"chat.completion.chunk",data:T}),m++,p||(o=T.id,s=T.model,p=!0),!h&&T.usage!==void 0&&T.usage!==null){if(u=T.usage.prompt_tokens??0,d=T.usage.completion_tokens??0,t.inputTokens=u,typeof j=="object"&&j!==null&&!Array.isArray(j)){const A=Object.getOwnPropertyDescriptor(j,"usage");if(A!==void 0&&typeof A.value=="object"&&A.value!==null){const O=Object.getOwnPropertyDescriptor(A.value,"prompt_tokens_details");if(O!==void 0&&typeof O.value=="object"&&O.value!==null){const L=Object.getOwnPropertyDescriptor(O.value,"cached_tokens");L!==void 0&&typeof L.value=="number"&&(t.cacheReadInputTokens=L.value)}}}h=!0}for(const A of T.choices){const O=A.delta;O.content!==void 0&&O.content!==null&&(i+=O.content),O.reasoning_content!==void 0&&O.reasoning_content!==null&&(a+=O.reasoning_content),O.thinking!==void 0&&O.thinking!==null&&(a+=O.thinking);const L=O.think;if(L!=null&&(a+=L),A.finish_reason!==void 0&&A.finish_reason!==null&&(c=A.finish_reason),O.tool_calls!==void 0&&O.tool_calls!==null)for(const E of O.tool_calls){let M=f.get(E.index);M===void 0&&(M={index:E.index,type:"function",function:{name:"",arguments:""}},f.set(E.index,M)),E.id!==void 0&&(M.id=E.id),E.function?.name!==void 0&&(M.function.name+=E.function.name),E.function?.arguments!==void 0&&(M.function.arguments+=E.function.arguments)}}}catch{}}r===!0&&(t.streamingChunks={chunks:y,truncated:m>g}),h||(d=Math.ceil(i.length/4)),t.outputTokens=d;const b={role:"assistant",content:i};return a&&(b.reasoning_content=a),f.size>0&&(b.tool_calls=[...f.values()]),JSON.stringify({id:o,object:"chat.completion",created:Math.floor(Date.now()/1e3),model:s!==""?s:n??"",choices:[{index:0,message:b,finish_reason:c}],usage:{prompt_tokens:u,completion_tokens:d,total_tokens:u+d}})}const YN={format:"openai",parseRequest(e,t){try{const n=JSON.parse(e),r=Ju.safeParse(n);return r.success?{model:r.data.model,sessionId:t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){const t=Xu(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 Ma(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}}};ir.register(YN);const XN="https://api.openai.com/v1",QN={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:XN},extractStream(e,t,n,r){return Ma(e,t,n,r)}};Da.register(QN);const e4="https://dashscope.aliyuncs.com/compatible-mode/v1",t4={name:"alibaba",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return!!(t.startsWith("glm-5")||t.startsWith("qwen"))},getUpstreamBase(e,t){return e4},extractStream(e,t,n){return Ma(e,t,n)}};Da.register(t4);function hn(e){return{parsed:null,comparisonValue:e,messageCount:null,toolCount:null}}const Bn={parsed:null,toolNames:null},n4={format:"anthropic",analyzeRequest(e){if(e===null)return hn(e);try{const t=Hu.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}:hn(e)}catch{return hn(e)}},analyzeResponse(e){if(e===null)return Bn;try{let t=JSON.parse(e);typeof t=="string"&&(t=JSON.parse(t));const n=qu.safeParse(t);if(!n.success)return Bn;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 Bn}}},r4={format:"openai",analyzeRequest(e){if(e===null)return hn(e);try{const t=Ju.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}:hn(e)}catch{return hn(e)}},analyzeResponse(e){if(e===null)return Bn;const t=Xu(e);if(t===null)return Bn;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}}},o4={format:"unknown",analyzeRequest(e){return hn(e)},analyzeResponse(){return Bn}},s4={anthropic:n4,openai:r4,unknown:o4};function Ao(e){return s4[e]}function Nr(e){const t=ZN(e.path);return t==="unknown"?e.apiFormat:t}function i4(e){switch(e){case"success":return"text-emerald-400";case"client_error":return"text-amber-400";case"server_error":return"text-red-400";case"pending":return"text-muted-foreground"}}function pr({status:e}){const t=Cd(e),n=i4(t);return e===null?l.jsx("span",{className:"text-xs text-muted-foreground italic",children:"pending"}):l.jsxs("span",{className:he("flex items-center gap-1 text-xs font-mono font-semibold",n),children:[t==="server_error"&&l.jsx(Ev,{className:"size-3"}),e]})}function Wc({text:e}){return l.jsx("div",{className:"rounded-md border border-red-500/30 bg-red-500/5 p-3",children:l.jsx("pre",{className:"text-xs text-red-300 whitespace-pre-wrap font-mono leading-relaxed overflow-auto max-h-[60vh]",children:e})})}function a4({text:e}){return l.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&_pre]:bg-muted [&_pre]:text-foreground [&_code]:text-[0.8em] [&_p]:my-1 [&_ul]:my-1 [&_ol]:my-1",children:l.jsx(Gn,{children:e})})}const ao=v.memo(function({responseText:t,responseStatus:n,streaming:r,inputTokens:o,outputTokens:s,cacheCreationInputTokens:i,cacheReadInputTokens:a,apiFormat:c,error:u}){const d=c??"unknown",h=v.useMemo(()=>Ao(d).analyzeResponse(t).parsed,[d,t]);return t===null&&u===void 0?l.jsxs("div",{className:"flex items-center gap-2 py-3",children:[l.jsx(pr,{status:n}),l.jsx("span",{className:"text-xs text-muted-foreground italic",children:"No response"})]}):n!==null&&n>=400?l.jsxs("div",{className:"space-y-2",children:[l.jsx(pr,{status:n}),l.jsx(Wc,{text:t??""}),u!=null&&l.jsxs("div",{className:"rounded border border-destructive/50 bg-destructive/10 p-3 text-xs",children:[l.jsx("div",{className:"font-semibold text-destructive mb-1",children:"SSE Error"}),l.jsx("div",{className:"text-muted-foreground font-mono",children:u})]})]}):u!=null?l.jsxs("div",{className:"space-y-2",children:[l.jsx(pr,{status:n}),l.jsxs("div",{className:"rounded border border-destructive/50 bg-destructive/10 p-3 text-xs",children:[l.jsx("div",{className:"font-semibold text-destructive mb-1",children:"SSE Error"}),l.jsx("div",{className:"text-muted-foreground font-mono",children:u})]}),t!==null&&l.jsx("div",{className:"mt-2",children:l.jsx(Wc,{text:t})})]}):h!==null?l.jsxs("div",{className:"space-y-2",children:[l.jsx(pr,{status:n}),MN(d,h)]}):l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(pr,{status:n}),r&&(o!==null||s!==null)&&l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[l.jsx(Xn,{className:"size-3"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[o!==null?qe(o):"—"," in /"," ",s!==null?qe(s):"—"," out"]}),i!=null&&i>0&&l.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",qe(i)]}),a!=null&&a>0&&l.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",qe(a)]})]})]}),l.jsx(a4,{text:t??""})]})}),l4=ae({success:Qe(),error:K().optional(),responseStatus:ve().optional(),responseText:K().optional(),inputTokens:ve().optional(),outputTokens:ve().optional(),elapsedMs:ve().optional(),streaming:Qe().optional()});function c4({log:e,open:t,onOpenChange:n}){const[r,o]=v.useState(()=>e.rawRequestBody??"{}"),[s,i]=v.useState(null),[a,c]=v.useState(!1),[u,d]=v.useState(null);async function h(){c(!0),d(null),i(null);try{const g=await(await fetch(`/api/logs/${e.id}/replay`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({modifiedBody:r})})).json(),m=l4.safeParse(g);if(!m.success){d("Invalid response from server"),c(!1);return}const x=m.data;i(x),x.success||d(x.error??"Replay failed")}catch(f){d(f instanceof Error?f.message:"Network error")}finally{c(!1)}}function p(){i(null),d(null),n(!1)}return l.jsx(rs,{open:t,onOpenChange:p,children:l.jsxs(os,{className:"max-w-4xl max-h-[85vh] overflow-auto",children:[l.jsx(ss,{children:l.jsxs(is,{className:"flex items-center gap-2",children:[l.jsx(id,{className:"size-4"}),"Replay Request #",e.id]})}),l.jsxs(Pn,{defaultValue:"modified",children:[l.jsxs(On,{children:[l.jsx(tt,{value:"modified",children:"Modified Request"}),l.jsx(tt,{value:"original",children:"Original Response"}),s&&l.jsx(tt,{value:"replay",children:"Replay Response"})]}),l.jsxs(nt,{value:"modified",className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Request Body (JSON)"}),l.jsx(Je,{children:l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsx("textarea",{className:"w-full h-64 p-3 font-mono text-xs bg-muted rounded-md border border-input resize-none focus:outline-none focus:ring-2 focus:ring-ring",value:r,onChange:f=>o(f.target.value),spellCheck:!1})}),l.jsx($e,{children:"Edit the request body before re-sending to the provider"})]})})]}),u!==null&&u!==""&&l.jsx("div",{className:"text-sm text-destructive bg-destructive/10 px-3 py-2 rounded-md",children:u}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Xe,{onClick:()=>{h()},disabled:a,children:a?"Replaying...":"Replay"})}),s&&s.success&&l.jsxs(Pn,{defaultValue:"parsed",children:[l.jsxs(On,{children:[l.jsx(tt,{value:"parsed",children:"Response"}),l.jsx(tt,{value:"raw",children:"Raw Response"})]}),l.jsx(nt,{value:"parsed",children:l.jsx(ao,{responseText:s.responseText??null,responseStatus:s.responseStatus??null,streaming:s.streaming??!1,inputTokens:s.inputTokens??null,outputTokens:s.outputTokens??null,apiFormat:e.apiFormat})}),l.jsx(nt,{value:"raw",children:l.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto",children:s.responseText??"No response"})})]})]}),l.jsx(nt,{value:"original",children:e.responseText!==null?l.jsxs(Pn,{defaultValue:"parsed",children:[l.jsxs(On,{children:[l.jsx(tt,{value:"parsed",children:"Response"}),l.jsx(tt,{value:"raw",children:"Raw Response"})]}),l.jsx(nt,{value:"parsed",children:l.jsx(ao,{responseText:e.responseText,responseStatus:e.responseStatus,streaming:e.streaming,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens,cacheReadInputTokens:e.cacheReadInputTokens,apiFormat:e.apiFormat})}),l.jsx(nt,{value:"raw",children:l.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto",children:e.responseText})})]}):l.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No original response"})}),s&&s.success&&l.jsx(nt,{value:"replay",children:s.responseText!==null?l.jsxs(Pn,{defaultValue:"parsed",children:[l.jsxs(On,{children:[l.jsx(tt,{value:"parsed",children:"Response"}),l.jsx(tt,{value:"raw",children:"Raw Response"})]}),l.jsx(nt,{value:"parsed",children:l.jsx(ao,{responseText:s.responseText??null,responseStatus:s.responseStatus??null,streaming:s.streaming??!1,inputTokens:s.inputTokens??null,outputTokens:s.outputTokens??null,apiFormat:e.apiFormat})}),l.jsx(nt,{value:"raw",children:l.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto",children:s.responseText})})]}):l.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No replay response"})})]})]})})}const u4=v.memo(function({logId:t,truncated:n}){const[r,o]=v.useState(!1),[s,i]=v.useState({status:"idle"}),[a,c]=v.useState(new Set);v.useEffect(()=>{if(!r||s.status!=="idle")return;let p=!1;return i({status:"loading"}),fetch(`/api/logs/${t}/chunks`).then(f=>f.ok?f.json():Promise.reject(new Error("Chunks not found"))).then(f=>{p||i({status:"success",chunks:f.chunks})}).catch(()=>{p||i({status:"error",message:"Chunk data unavailable"})}),()=>{p=!0}},[r,t]);const u=v.useMemo(()=>{if(s.status!=="success")return[];const p=new Map;for(const f of s.chunks){const g=p.get(f.index);g?g.push(f):p.set(f.index,[f])}return Array.from(p.entries()).map(([f,g])=>({index:f,chunks:g})).sort((f,g)=>f.index-g.index)},[s]),d=p=>{c(f=>{const g=new Set(f);return g.has(p)?g.delete(p):g.add(p),g})};function h(){return s.status==="idle"||s.status==="loading"?l.jsxs("div",{className:"flex items-center gap-2 py-2 text-xs text-muted-foreground",children:[l.jsx(Sr,{className:"size-3 animate-spin"}),l.jsx("span",{children:"Loading chunks..."})]}):s.status==="error"?l.jsx("div",{className:"py-2 text-xs text-muted-foreground italic",children:s.message}):l.jsxs("div",{className:"p-2 space-y-1",children:[l.jsxs("div",{className:"text-[10px] text-muted-foreground font-mono mb-2",children:[u.length," index group",u.length!==1?"s":""," available"]}),u.map(p=>{const f=a.has(p.index);return l.jsxs("div",{className:"rounded border border-border bg-background",children:[l.jsxs("button",{type:"button",className:"flex items-center gap-2 w-full px-2 py-1.5 text-left hover:bg-muted/50 transition-colors cursor-pointer",onClick:()=>d(p.index),children:[f?l.jsx(vt,{className:"size-3 text-muted-foreground"}):l.jsx(bt,{className:"size-3 text-muted-foreground"}),l.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:["[",p.index,"] ",p.chunks[0]?.type??""]}),l.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:[p.chunks.length," chunk",p.chunks.length!==1?"s":""]})]}),f&&l.jsx("div",{className:"px-2 pb-2 space-y-1",children:p.chunks.map(g=>l.jsxs("div",{className:"rounded border border-border bg-muted/20 p-2",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:["+",g.timestamp,"ms"]}),l.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:g.type})]}),l.jsx(us,{data:g,defaultExpandDepth:1,showCopy:!0})]},g.index))})]},p.index)})]})}return l.jsxs("div",{className:"space-y-1",children:[l.jsx(Je,{children:l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsxs("button",{type:"button",className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer",onClick:()=>o(p=>!p),children:[r?l.jsx(vt,{className:"size-3"}):l.jsx(bt,{className:"size-3"}),l.jsx("span",{children:"Raw SSE Events"}),l.jsxs(xt,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono ml-1",children:[t,n===!0?"+":""]})]})}),l.jsx($e,{children:"Server-Sent Events streaming chunks from the provider"})]})}),r===!0?l.jsx("div",{className:"rounded-md border border-border bg-muted/20 overflow-auto max-h-64",children:h()}):null]})});function Hc(e,t,n){return e==="anthropic"&&t==="full"&&n}function d4(e,t){return e==="full"&&t}function f4(e,t,n,r){return e==="anthropic"&&t==="full"&&n&&r}function Zs({text:e,label:t,copied:n,onCopy:r}){return e===null?null:l.jsx("button",{type:"button",onClick:r,className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors px-2 py-1 rounded hover:bg-muted",children:n?l.jsxs(l.Fragment,{children:[l.jsx(Gt,{className:"size-3 text-green-500"}),l.jsx("span",{className:"text-green-500",children:"Copied!"})]}):l.jsxs(l.Fragment,{children:[l.jsx(wn,{className:"size-3"}),l.jsx("span",{children:t})]})})}function qc({active:e,onClick:t}){return l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsxs("button",{type:"button",onClick:t,"aria-pressed":e,className:he("flex items-center gap-1.5 text-xs px-2 py-1 rounded transition-colors",e?"bg-primary/10 text-primary":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:[l.jsx(od,{className:"size-3"}),e?"Showing diff":"Diff with Raw"]})}),l.jsx($e,{children:e?"Hide diff view":"Compare proxy output against the original raw version"})]})}const h4=v.memo(function({rawBody:e,displayedBody:t,emptyLabel:n}){const r=v.useMemo(()=>Y3(e,t),[e,t]);return l.jsx(Fp,{result:r,emptyLabel:n})}),p4=v.memo(function({rawHeaders:e,headers:t,emptyLabel:n}){const r=v.useMemo(()=>J3(e,t),[e,t]);return l.jsx(Fp,{result:r,emptyLabel:n})});function Vs(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 m4=v.memo(function({log:e,viewMode:t="simple",strip:n,cacheTrend:r=null,onCompareWithPrevious:o}){const[s,i]=v.useState(!1),[a,c]=v.useState(!1),[u,d]=v.useState(!1),[h,p]=v.useState(!1),[f,g]=v.useState("request"),m=Nr(e),x=Ao(m),y=v.useMemo(()=>x.analyzeRequest(e.rawRequestBody),[x,e.rawRequestBody]),b=v.useMemo(()=>x.analyzeResponse(e.responseText),[x,e.responseText]),S=v.useMemo(()=>!n||m!=="anthropic"||e.rawRequestBody===null?null:vC(e.rawRequestBody).body,[e.rawRequestBody,m,n])??e.rawRequestBody,C=Vs(S),j=Vs(e.rawRequestBody),N=Vs(e.responseText);return l.jsxs(Je,{children:[l.jsxs("div",{className:"border border-border rounded-lg mb-1 overflow-hidden",children:[l.jsx(kN,{log:e,messageCount:y.messageCount,toolCount:y.toolCount,expanded:s,onToggle:()=>i(!s),responseToolNames:b.toolNames,cacheTrend:r}),s&&l.jsx("div",{onClick:T=>T.stopPropagation(),onKeyDown:T=>T.stopPropagation(),children:l.jsxs(Pn,{value:f,onValueChange:g,children:[l.jsxs(On,{className:"mx-4 mt-2",children:[t==="full"&&l.jsx(tt,{value:"raw-headers",children:"Raw Headers"}),t==="full"&&l.jsx(tt,{value:"headers",children:"Headers"}),Hc(m,t,n)&&l.jsx(tt,{value:"raw-request",children:"Raw Request"}),l.jsx(tt,{value:"request",children:"Request"}),t==="full"&&l.jsx(tt,{value:"raw",children:"Raw Response"}),l.jsx(tt,{value:"parsed",children:"Response"})]}),Hc(m,t,n)&&l.jsx(nt,{value:"raw-request",children:f==="raw-request"&&l.jsxs("div",{className:"px-4 py-3",children:[l.jsx("div",{className:"flex justify-end mb-2",children:l.jsx(Zs,{text:e.rawRequestBody,label:"Copy Raw Request",copied:j.copied,onCopy:j.copy})}),e.rawRequestBody!==null?l.jsx(fn,{text:e.rawRequestBody,defaultExpandDepth:1}):l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"})]})}),l.jsx(nt,{value:"request",children:f==="request"&&l.jsxs("div",{className:"px-4 py-3",children:[l.jsxs("div",{className:"flex justify-end gap-2 mb-2",children:[f4(m,t,n,e.rawRequestBody!==null)&&l.jsx(qc,{active:h,onClick:T=>{T.stopPropagation(),p(!h)}}),o!==void 0&&l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsxs(Xe,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:T=>{T.stopPropagation(),o(e)},children:[l.jsx(od,{className:"size-3 mr-1"}),"Diff with Previous"]})}),l.jsx($e,{children:"Compare this request with the immediately preceding one"})]}),l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsxs(Xe,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:T=>{T.stopPropagation(),c(!0)},children:[l.jsx(id,{className:"size-3 mr-1"}),"Replay"]})}),l.jsx($e,{children:"Re-send this request to the provider"})]}),l.jsx(Zs,{text:S,label:"Copy Request",copied:C.copied,onCopy:C.copy})]}),h?l.jsx(h4,{rawBody:e.rawRequestBody,displayedBody:S,emptyLabel:"No transformation applied — raw and sent request bodies are identical."}):S!==null?l.jsx(fn,{text:S,defaultExpandDepth:1}):l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"})]})}),t==="full"&&l.jsx(nt,{value:"headers",children:f==="headers"&&l.jsxs("div",{className:"px-4 py-3",children:[l.jsx("div",{className:"flex justify-end gap-2 mb-2",children:d4(t,e.rawHeaders!==void 0&&Object.keys(e.rawHeaders).length>0)&&l.jsx(qc,{active:u,onClick:T=>{T.stopPropagation(),d(!u)}})}),u?l.jsx(p4,{rawHeaders:e.rawHeaders,headers:e.headers,emptyLabel:"No transformation applied — raw and processed headers are identical."}):e.headers&&Object.keys(e.headers).length>0?l.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.headers).sort(([T],[A])=>T.localeCompare(A)).map(([T,A])=>l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[T,":"]}),l.jsx("span",{className:"text-muted-foreground truncate",title:A,children:A})]},T))}):l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No headers captured"})]})}),t==="full"&&l.jsx(nt,{value:"raw-headers",children:f==="raw-headers"&&l.jsx("div",{className:"px-4 py-3",children:e.rawHeaders&&Object.keys(e.rawHeaders).length>0?l.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.rawHeaders).sort(([T],[A])=>T.localeCompare(A)).map(([T,A])=>l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[T,":"]}),l.jsx("span",{className:"text-muted-foreground truncate",title:A,children:A})]},T))}):l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No raw headers captured"})})}),l.jsx(nt,{value:"raw",children:f==="raw"&&l.jsxs("div",{className:"px-4 py-3 space-y-3",children:[e.error!==void 0&&e.error!==null&&l.jsxs("div",{className:"rounded border border-destructive/50 bg-destructive/10 p-3 text-xs",children:[l.jsx("div",{className:"font-semibold text-destructive mb-1",children:"SSE Error"}),l.jsx("div",{className:"text-muted-foreground font-mono",children:e.error})]}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Zs,{text:e.responseText,label:"Copy Response",copied:N.copied,onCopy:N.copy})}),e.responseText!==null?l.jsx(fn,{text:e.responseText,defaultExpandDepth:1}):l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No response"}),e.streaming===!0&&l.jsx(u4,{logId:e.id,truncated:e.streamingChunksPath!==null})]})}),l.jsx(nt,{value:"parsed",children:f==="parsed"&&l.jsx("div",{className:"px-4 py-3",children:l.jsx(ao,{responseText:e.responseText,responseStatus:e.responseStatus,streaming:e.streaming,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens,cacheReadInputTokens:e.cacheReadInputTokens,apiFormat:m,error:e.error})})})]})})]}),l.jsx(c4,{log:e,open:a,onOpenChange:c})]})});function g4({stopReason:e,isPending:t,isFirst:n,isTurnStart:r,crabIndex:o=0,collapsible:s=!1,onToggle:i}){const a=e==="end_turn"||e==="stop",c=t&&!a,u=v.useMemo(()=>mi(o),[o]),d=s&&i?{role:"button",tabIndex:0,className:"cursor-pointer",onClick:h=>{h.stopPropagation(),i()},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),i())}}:{};return l.jsxs("div",{className:"flex flex-col items-center w-6 shrink-0 pt-0.5 pb-0.5",children:[l.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]",children:!n&&l.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),a?l.jsx("span",{title:e==="end_turn"?"End of Turn (Anthropic)":"End of Turn (OpenAI)",...d,children:l.jsx(u,{className:he("size-3.5 text-amber-400","animate-crab-settle","drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})}):r?l.jsx("span",{title:"Start of turn",...d,children:l.jsx(u,{className:he("size-3.5 text-emerald-400","animate-crab-appear","drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}):c?l.jsx("span",{title:"Processing…",children:l.jsx(u,{className:he("size-3.5 text-amber-300/80","animate-crab-crawl")})}):l.jsx("span",{children:l.jsx(u,{className:"size-3.5 text-muted-foreground/40"})}),l.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:!a&&l.jsx("div",{className:he("w-0.5 h-full",t?"border-dashed bg-transparent border-l-2 border-muted-foreground/20":"bg-muted-foreground/30")})})]})}function x4(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const y4=v.memo(function({entries:t,viewMode:n,strip:r,cacheTrends:o,onCompareWithPrevious:s,comparisonPredecessors:i,turnIndex:a=0}){const c=t.length-1,u=t[c]?.stopReason??null,d=u!==null?qh(u):!1,h=t[c]?.log.responseStatus===null,p=d&&!h,[f,g]=v.useState(!1),m=v.useRef(d);v.useEffect(()=>{d&&!m.current&&g(!0),m.current=d},[d]);const x=v.useCallback(()=>{p&&g(A=>!A)},[p]),y=v.useMemo(()=>{let A=0,O=0,L=0,E=!1,M=!1;for(const w of t)w.log.inputTokens!==null&&(A+=w.log.inputTokens,E=!0),w.log.outputTokens!==null&&(O+=w.log.outputTokens,E=!0),w.log.elapsedMs!==null&&(L+=w.log.elapsedMs,M=!0);return{totalInput:A,totalOutput:O,hasTokens:E,totalElapsed:L,hasElapsed:M}},[t,c]),b=v.useMemo(()=>{const A=new Set;for(const O of t){const L=Jh(O.log.model);L!=="unknown"&&A.add(L)}return[...A]},[t]),k=v.useMemo(()=>mi(t[0]?.log.id??0),[t]),S=v.useMemo(()=>mi(t[c]?.log.id??0),[t,c]),C=a%2===0?"bg-muted/10":"bg-muted/25",[j,N]=v.useState(0),T=v.useRef(null);return v.useEffect(()=>{const A=T.current;if(!A)return;let O=0;const L=new ResizeObserver(()=>{window.cancelAnimationFrame(O),O=window.requestAnimationFrame(()=>N(E=>E+1))});return L.observe(A),()=>{L.disconnect(),window.cancelAnimationFrame(O)}},[]),l.jsx("div",{ref:T,className:he("border rounded-lg",h?"border-amber-500/10":"border-transparent"),children:f?l.jsxs("div",{className:"flex items-stretch",children:[l.jsxs("div",{className:"w-6 shrink-0 flex flex-col items-center pt-0.5 pb-0.5",children:[l.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]"}),l.jsx("span",{role:"button",tabIndex:0,title:"Start of turn — click to expand",className:"cursor-pointer",onClick:A=>{A.stopPropagation(),x()},onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),x())},children:l.jsx(k,{className:he("size-3.5 text-emerald-400","animate-crab-appear","drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}),l.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:l.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),l.jsx("span",{role:"button",tabIndex:0,title:"End of Turn — click to expand",className:"cursor-pointer",onClick:A=>{A.stopPropagation(),x()},onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),x())},children:l.jsx(S,{className:he("size-3.5 text-amber-400","animate-crab-settle","drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})})]}),l.jsxs("div",{className:he("flex-1 min-w-0 mb-0.5 rounded-lg border border-border py-1 px-3 flex items-center gap-3 text-xs cursor-pointer",C),onClick:x,role:"button",tabIndex:0,onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),x())},children:[l.jsxs("span",{className:"text-blue-400/80 font-mono font-semibold tabular-nums shrink-0",children:["#",t[0]?.log.id??"?"," ~ #",t[c]?.log.id??"?"]}),l.jsxs("span",{className:"text-muted-foreground shrink-0",children:[t.length," request",t.length>1?"s":""]}),b.length>0&&l.jsx("span",{className:"flex items-center gap-0.5 shrink-0",children:b.map(A=>l.jsx(Yh,{provider:A,className:"size-4"},A))}),y.hasElapsed&&l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground shrink-0",children:[l.jsx(Ir,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:x4(y.totalElapsed)})]}),y.hasTokens&&l.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[l.jsx(Xn,{className:"size-3 text-muted-foreground"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[l.jsxs("span",{className:"text-blue-400",children:["IN ",qe(y.totalInput)]})," / ",l.jsxs("span",{className:"text-amber-400",children:["OUT ",qe(y.totalOutput)]})]})]}),l.jsx("span",{className:"flex-1 min-w-0"}),l.jsx(bt,{className:"size-4 text-muted-foreground shrink-0"})]})]}):t.map((A,O)=>{const{log:L,stopReason:E}=A,M=O===0;return l.jsxs("div",{className:"flex items-stretch",children:[l.jsx(g4,{stopReason:E,isPending:L.responseStatus===null,isFirst:O===0,isTurnStart:M,crabIndex:L.id%12,collapsible:p&&t.length>1&&M,onToggle:x}),l.jsx("div",{className:he("flex-1 min-w-0 mb-0.5 rounded-lg",C),children:l.jsx(m4,{log:L,viewMode:n,strip:r,cacheTrend:o?.get(L.id)??null,onCompareWithPrevious:i.has(L.id)?s:void 0})})]},L.id)})})});function v4(e,t){return e||t}function b4(e){const t=[];let n=[],r=0;for(const o of e){n.push({log:o,stopReason:US(o)});const s=n[n.length-1];s!==void 0&&qh(s.stopReason)&&(t.push({entries:n,turnIndex:r}),n=[],r+=1)}return n.length>0&&t.push({entries:n,turnIndex:r}),t}function w4(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=Nr(o),a=Nr(s);i==="unknown"||i!==a||t.set(o.id,s)}return t}function k4(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 _4=v.memo(function({group:e,viewMode:t="simple",strip:n,cacheTrends:r,onCompareWithPrevious:o,comparisonPredecessors:s,onClearGroup:i,standalone:a=!1}){const[c,u]=v.useState(!1),d=v.useMemo(()=>k4(e.logs),[e.logs]),h=e.logs[0]?.timestamp??new Date().toISOString(),p=e.logs[e.logs.length-1]?.timestamp??new Date().toISOString(),f=$S(e.logs),g=e.logs.some(y=>y.responseStatus===null),m=v.useMemo(()=>b4(e.logs),[e.logs]),x=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 l.jsxs("div",{className:"mb-2",children:[!a&&l.jsx(LS,{conversationId:x,startTime:h,endTime:p,totalCalls:e.logs.length,totalInputTokens:d.totalInputTokens,totalOutputTokens:d.totalOutputTokens,apiFormat:FS(e.logs),expanded:c,onToggle:()=>u(!c),hideApiFormat:f,isLoading:g,userAgent:e.logs[0]?.userAgent??null,onClear:()=>i(e.logs.map(y=>y.id))}),v4(a,c)&&l.jsx("div",{className:"max-h-[70vh] overflow-y-auto",children:m.map(y=>l.jsx(y4,{entries:y.entries,viewMode:t,strip:n,cacheTrends:r,onCompareWithPrevious:o,comparisonPredecessors:s,turnIndex:y.turnIndex},y.turnIndex))})]})});function S4({className:e}){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:he("inline-block size-5",e),children:[l.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"}),l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"}),l.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),l.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),l.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),l.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),l.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]})}function Kc({...e}){return l.jsx(Z_,{"data-slot":"select",...e})}function Gc({...e}){return l.jsx(W_,{"data-slot":"select-value",...e})}function Jc({className:e,size:t="default",children:n,...r}){return l.jsxs(V_,{"data-slot":"select-trigger","data-size":t,className:he("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,l.jsx(H_,{asChild:!0,children:l.jsx(vt,{className:"size-4 opacity-50"})})]})}function Yc({className:e,children:t,position:n="popper",align:r="center",...o}){return l.jsx(q_,{children:l.jsxs(K_,{"data-slot":"select-content",className:he("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:[l.jsx(C4,{}),l.jsx(G_,{className:he("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),l.jsx(j4,{})]})})}function eo({className:e,children:t,...n}){return l.jsxs(J_,{"data-slot":"select-item",className:he("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:[l.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:l.jsx(X_,{children:l.jsx(Gt,{className:"size-4"})})}),l.jsx(Y_,{children:t})]})}function C4({className:e,...t}){return l.jsx(Q_,{"data-slot":"select-scroll-up-button",className:he("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(zy,{className:"size-4"})})}function j4({className:e,...t}){return l.jsx(eS,{"data-slot":"select-scroll-down-button",className:he("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(vt,{className:"size-4"})})}function E4(){return l.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[l.jsx("title",{children:"Claude Code"}),l.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 N4(){return l.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[l.jsx("title",{children:"OpenCode"}),l.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})]})}function T4(){return l.jsxs("svg",{fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[l.jsx("title",{children:"MiMo Code"}),l.jsx("text",{x:"12",y:"18",textAnchor:"middle",fontSize:"16",fontWeight:"800",fontFamily:"system-ui, sans-serif",children:"M"})]})}const A4=ae({name:K(),apiKey:K(),format:lt(["anthropic","openai"]),anthropicBaseUrl:K(),openaiBaseUrl:K(),models:Pe(K()),sourceTool:lt(["claude-code","opencode","mimo-code"]),alreadyExists:Qe()}),I4=ae({providers:Pe(A4),warnings:Pe(K()).optional()}),z4=ae({success:Qe().optional(),imported:ve().optional(),message:K().optional(),errors:Pe(K()).optional()}),R4={"claude-code":E4,opencode:N4,"mimo-code":T4};function P4({open:e,onOpenChange:t,onImportComplete:n}){const[r,o]=v.useState(!1),[s,i]=v.useState(null),[a,c]=v.useState([]),[u,d]=v.useState([]),[h,p]=v.useState(new Set),[f,g]=v.useState(!1),[m,x]=v.useState(null),[y,b]=v.useState(null),k=v.useCallback(()=>{o(!0),i(null),d([]),c([]),p(new Set),x(null),b(null),fetch("/api/providers/scan").then(N=>N.ok?N.json().then(T=>{const A=I4.safeParse(T);if(!A.success){i(`Invalid response: ${A.error.message}`);return}c(A.data.providers),d(A.data.warnings??[]);const O=new Set;A.data.providers.forEach((L,E)=>{L.alreadyExists||O.add(E)}),p(O)}):N.text().then(T=>{i(`Scan failed (${N.status}): ${T}`)})).catch(N=>{i(N instanceof Error?N.message:String(N))}).finally(()=>{o(!1)})},[]);v.useEffect(()=>{e&&k()},[e,k]);const S=v.useCallback(N=>{p(T=>{const A=new Set(T);return A.has(N)?A.delete(N):A.add(N),A})},[]),C=v.useCallback(()=>{const N=a.filter((O,L)=>h.has(L));if(N.length===0)return;g(!0),b(null),x(null);const T=new Date().toISOString(),A=N.map(O=>({id:window.crypto.randomUUID(),name:O.name,apiKey:O.apiKey,format:O.format,anthropicBaseUrl:O.anthropicBaseUrl,openaiBaseUrl:O.openaiBaseUrl,models:O.models,createdAt:T,updatedAt:T}));fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providers:A})}).then(O=>O.json()).then(O=>{const L=z4.safeParse(O);if(!L.success){b(`Invalid response: ${L.error.message}`);return}const E=L.data;c(M=>M.map((w,D)=>h.has(D)?{...w,alreadyExists:!0}:w)),p(new Set),E.errors!==void 0&&E.errors.length>0&&E.message!==void 0?x(E.message):x(`Imported ${E.imported??N.length} provider(s)`),n()}).catch(O=>{b(O instanceof Error?O.message:String(O))}).finally(()=>{g(!1)})},[a,h,n]),j=a.some(N=>!N.alreadyExists);return l.jsx(rs,{open:e,onOpenChange:t,children:l.jsxs(os,{className:"max-w-xl max-h-[80vh] overflow-hidden flex flex-col",children:[l.jsxs(ss,{children:[l.jsx(is,{children:"Import from External Tools"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Detect provider configurations from Claude Code, OpenCode, and MiMo Code."})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto space-y-3",children:[r&&l.jsxs("div",{className:"flex items-center justify-center py-8 gap-2 text-muted-foreground",children:[l.jsx(Sr,{className:"size-4 animate-spin"}),l.jsx("span",{className:"text-sm",children:"Scanning for external providers..."})]}),s!==null&&l.jsxs("div",{className:"flex items-center gap-2 text-destructive text-sm py-4",children:[l.jsx(_r,{className:"size-4"}),s]}),!r&&s===null&&a.length===0&&l.jsxs("p",{className:"text-sm text-muted-foreground py-8 text-center",children:["No external provider configurations found.",l.jsx("br",{}),l.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&&a.map((N,T)=>l.jsxs("label",{className:`flex items-start gap-3 p-3 border rounded-md ${N.alreadyExists?"":"cursor-pointer hover:bg-muted/50"}`,children:[!N.alreadyExists&&l.jsx("input",{type:"checkbox",checked:h.has(T),disabled:f,onChange:()=>S(T),className:"mt-0.5 size-4"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[(()=>{const A=R4[N.sourceTool];return A===void 0?null:l.jsx(A,{})})(),N.alreadyExists&&l.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Already added"})]}),l.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`:""]}),l.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:N.format==="anthropic"?N.anthropicBaseUrl:N.openaiBaseUrl}),l.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&&l.jsx("div",{className:"text-xs text-muted-foreground space-y-1 border-t pt-2",children:u.map((N,T)=>l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(_r,{className:"size-3"}),N]},T))}),m!==null&&l.jsx("div",{className:"text-sm text-green-500 border-t pt-2",children:m}),y!==null&&l.jsx("div",{className:"text-sm text-destructive border-t pt-2",children:y})]}),l.jsxs("div",{className:"flex items-center justify-between pt-3 border-t",children:[l.jsxs(Xe,{variant:"outline",size:"sm",onClick:k,disabled:r,children:[l.jsx(Sr,{className:`size-3 mr-1 ${r?"animate-spin":""}`}),"Rescan"]}),l.jsxs(Xe,{size:"sm",onClick:C,disabled:!j||h.size===0||f,children:[l.jsx(Zi,{className:"size-3 mr-1"}),f?"Importing...":`Import Selected (${h.size})`]})]})]})})}function Vp(e){return e.length<=8?"••••••••":e.slice(0,4)+"••••••••"+e.slice(-4)}const O4={deepseek:"https://api-docs.deepseek.com/zh-cn/"};function D4(e){return Object.prototype.hasOwnProperty.call(e,"success")}function M4(e){return Object.prototype.hasOwnProperty.call(e,"notConfigured")}function L4(e){const t={className:"size-3",strokeWidth:2};switch(e){case"timeout":return l.jsx(Ir,{...t});case"network_unreachable":return l.jsx(Rv,{...t});case"connection_refused":return l.jsx(Ov,{...t});case"auth_failed":return l.jsx(lv,{...t});case"rate_limited":return l.jsx(nv,{...t});case"server_error":return l.jsx(wv,{...t});case"invalid_response":return l.jsx(By,{...t});case"unknown":return l.jsx(_r,{...t});default:return l.jsx(_r,{...t})}}function to({result:e}){const[t,n]=v.useState(!1);if(!D4(e))return M4(e)?l.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[l.jsx(Hi,{className:"size-3"}),l.jsx("span",{children:"Not configured"})]}):l.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[l.jsx(ad,{className:"size-3 animate-spin"}),l.jsx("span",{children:"Testing..."})]});if(e.success){const c=[];e.inputTokens!==void 0&&c.push(l.jsxs("span",{children:[e.inputTokens," in"]},"in")),e.outputTokens!==void 0&&c.push(l.jsxs("span",{children:[e.outputTokens," out"]},"out")),e.cacheCreationInputTokens!==void 0&&e.cacheCreationInputTokens>0&&c.push(l.jsx(Je,{children:l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["+",e.cacheCreationInputTokens," cache"]})}),l.jsx($e,{children:"Tokens cached for reuse, reducing future API cost"})]})},"cache-create")),e.cacheReadInputTokens!==void 0&&e.cacheReadInputTokens>0&&c.push(l.jsx(Je,{children:l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["~",e.cacheReadInputTokens," cached"]})}),l.jsx($e,{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 l.jsx(Je,{children:l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 shrink-0",children:[l.jsx(Fy,{className:"size-3"}),l.jsx("span",{children:"Connected"}),c.length>0&&l.jsxs("span",{className:"text-muted-foreground",children:["(",u,")"]})]})}),l.jsx($e,{children:"Connection test passed"})]})})}const r=e.error,o=r?.message??"Connection failed",s=r?.hint,i=r?.details,a=r?.type??"unknown";return l.jsxs("div",{className:"flex flex-col gap-1 shrink-0",children:[l.jsxs("div",{className:"flex items-center gap-1 text-xs text-red-600 max-w-[200px]",children:[L4(a),l.jsx(Je,{children:l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsx("span",{className:"truncate",children:o})}),l.jsx($e,{children:"Connection test failed"})]})}),i!==void 0&&l.jsx(Je,{children:l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>n(!t),className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:t?l.jsx(Vi,{className:"size-3"}):l.jsx(Wi,{className:"size-3"})})}),l.jsx($e,{children:t?"Hide error details":"Show detailed error information"})]})})]}),t&&i!==void 0&&l.jsxs("div",{className:"text-xs text-muted-foreground bg-muted/50 rounded p-2 max-w-[300px]",children:[s!==void 0&&l.jsx("div",{className:"mb-1",children:s}),l.jsx("div",{className:"font-mono whitespace-pre-wrap break-all text-red-400/80",children:i})]})]})}function F4(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 $4({provider:e,testResults:t,isTesting:n,testingTimeLeft:r,isHighlighted:o,onEdit:s,onDelete:i,onTest:a}){const[c,u]=v.useState(!1),[d,h]=v.useState(!1),[p,f]=v.useState(!1),g=v.useRef(null),m=v.useRef(void 0);t?.testedAt!==void 0&&t.testedAt!==m.current&&(m.current=t.testedAt,g.current=null);const x=v.useCallback(()=>{f(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(()=>{}),h(!0),setTimeout(()=>h(!1),2e3)}const b=e.apiDocsUrl??Object.entries(O4).find(([k])=>e.name.toLowerCase().includes(k))?.[1];return l.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:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[l.jsx("span",{className:"font-medium truncate",children:e.name}),e.source==="company"&&l.jsx(Je,{children:l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.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:"公司"})}),l.jsx($e,{children:"Company-provided API key"})]})}),e.source==="personal"&&l.jsx(Je,{children:l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.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:"个人"})}),l.jsx($e,{children:"Your personal API key"})]})})]}),b!==void 0&&l.jsxs("a",{href:b,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1 text-xs",title:"View API documentation",children:[l.jsx(Jy,{className:"size-3"}),l.jsx("span",{className:"sr-only",children:"Docs"})]})]}),e.models!==void 0&&e.models.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1",children:e.models.map(k=>l.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:k},k))}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("code",{className:"text-xs text-muted-foreground bg-muted px-2 py-1 rounded flex-1 truncate",children:c?e.apiKey:Vp(e.apiKey)}),l.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?l.jsx(Vi,{className:"size-4"}):l.jsx(Wi,{className:"size-4"})}),l.jsx("button",{type:"button",onClick:y,className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":"Copy API key",children:d?l.jsx(Gt,{className:"size-4 text-green-500"}):l.jsx(wn,{className:"size-4"})})]}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"text-xs text-muted-foreground min-w-0 flex-1",children:[l.jsx("span",{className:"font-medium",children:"Anthropic:"})," ",l.jsx("span",{className:"truncate",children:e.anthropicBaseUrl})]}),t&&l.jsx(to,{result:t.anthropic.nonStreaming})]}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"text-xs text-muted-foreground min-w-0 flex-1",children:[l.jsx("span",{className:"font-medium",children:"OpenAI:"})," ",l.jsx("span",{className:"truncate",children:e.openaiBaseUrl})]}),t&&l.jsx(to,{result:t.openai.nonStreaming})]}),t?.testedAt!==void 0&&l.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[l.jsx(Ir,{className:"size-3"}),l.jsxs("span",{children:["Tested ",F4(t.testedAt)]})]}),t?.models!==void 0&&Object.keys(t.models).length>0&&l.jsxs("div",{className:"border-t pt-2",children:[l.jsxs("button",{type:"button",onClick:x,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",children:[l.jsx("span",{className:"font-mono",children:p?"▾":"▸"}),"Model Test Results (",Object.keys(t.models).length,")"]}),p&&l.jsx("div",{className:"mt-2 overflow-x-auto",children:l.jsxs("table",{className:"w-full text-xs border-collapse",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-border",children:[l.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Model"}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&l.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Anthropic"}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&l.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"OpenAI"})]})}),l.jsx("tbody",{children:Object.entries(t.models).map(([k,S])=>l.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[l.jsx("td",{className:"py-1 px-2 font-medium",children:k}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&l.jsx("td",{className:"py-1 px-2",children:l.jsx(to,{result:S.anthropic.nonStreaming})}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&l.jsx("td",{className:"py-1 px-2",children:l.jsx(to,{result:S.openai.nonStreaming})})]},k))})]})})]}),l.jsxs("div",{className:"flex gap-2 pt-1 border-t",children:[a!==void 0&&l.jsxs(Xe,{variant:"outline",size:"sm",onClick:()=>a(e.id),className:"text-xs h-7 gap-1",disabled:n??!1,children:[l.jsx(ad,{className:`size-3 ${n??!1?"animate-spin":""}`}),n??!1?r!==void 0?`Testing (${r}s)`:"Testing...":"Test"]}),l.jsxs(Xe,{variant:"outline",size:"sm",onClick:()=>s(e),className:"text-xs h-7 gap-1",disabled:n??!1,children:[l.jsx(qi,{className:"size-3"}),"Edit"]}),l.jsxs(Xe,{variant:"outline",size:"sm",onClick:()=>i(e.id),className:"text-xs h-7 gap-1 text-destructive hover:text-destructive",disabled:n??!1,children:[l.jsx(ud,{className:"size-3"}),"Delete"]})]})]})}const B4={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"}},Xc=["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"],Qc=["glm-5","glm-5.1","qwen3.6-plus","qwen3.7-max"];function U4({provider:e,onSubmit:t,onCancel:n}){const[r,o]=v.useState(e?.name??""),[s,i]=v.useState(e?.apiKey??""),[a,c]=v.useState(!1),[u,d]=v.useState(!1),h=e?.models,[p,f]=v.useState(h!==void 0&&h.length>0?h:[""]),[g,m]=v.useState("anthropic"),[x,y]=v.useState(e?.anthropicBaseUrl??""),[b,k]=v.useState(e?.openaiBaseUrl??""),[S,C]=v.useState(e?.apiDocsUrl??""),[j,N]=v.useState(e?.source),[T,A]=v.useState({}),[O,L]=v.useState(!1),[E,M]=v.useState(null),w=v.useRef([]);v.useEffect(()=>{if(E===null)return;const X=E;function de(te){if(!(te.target instanceof Node))return;const ce=w.current[X];ce!=null&&!ce.contains(te.target)&&M(null)}return document.addEventListener("mousedown",de),()=>document.removeEventListener("mousedown",de)},[E]);const[D,H]=v.useState(!1),[B,q]=v.useState(!1),Y=r.toLowerCase().includes("minimax"),I=r.toLowerCase().includes("alibaba");function W(){navigator.clipboard.writeText(s).catch(()=>{}),d(!0),setTimeout(()=>d(!1),2e3)}v.useEffect(()=>{e&&(o(e.name),i(e.apiKey),f((e.models?.length??0)>0?e.models:[""]),y(e.anthropicBaseUrl??""),k(e.openaiBaseUrl??""),C(e.apiDocsUrl??""),N(e.source),H(!1),q(!1))},[e]),v.useEffect(()=>{const X=r.toLowerCase();for(const[de,te]of Object.entries(B4))if(X.includes(de)){te.format==="anthropic"&&!D?y(te.baseUrl):te.format==="openai"&&!B&&k(te.baseUrl),te.apiDocsUrl!==void 0&&!S&&C(te.apiDocsUrl),de==="minimax"&&p.length===1&&p[0]===""&&f([Xc[0]??""]),de==="alibaba"&&p.length===1&&p[0]===""&&f([Qc[0]??""]);break}},[r]);function V(){const X={};return r.trim()||(X.name="Name is required"),s.trim()||(X.apiKey="API key is required"),(p.length===0||p.every(de=>!de.trim()))&&(X.models="At least one model is required"),x.trim()&&!z(x.trim())&&(X.anthropicBaseUrl="Invalid URL format"),b.trim()&&!z(b.trim())&&(X.openaiBaseUrl="Invalid URL format"),!x.trim()&&!b.trim()&&(X.format="At least one format URL (Anthropic or OpenAI) is required"),A(X),Object.keys(X).length===0}function z(X){try{return new URL(X),!0}catch{return!1}}function oe(X){if(X.preventDefault(),!!V()){L(!0);try{t({name:r.trim(),apiKey:s.trim(),models:p.map(de=>de.trim()).filter(de=>de!==""),anthropicBaseUrl:x.trim()||void 0,openaiBaseUrl:b.trim()||void 0,apiDocsUrl:S.trim()||void 0,source:j})}finally{L(!1)}}}return l.jsxs("form",{onSubmit:oe,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{htmlFor:"provider-name",className:"text-sm font-medium",children:["Name ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsx("input",{id:"provider-name",type:"text",value:r,onChange:X=>o(X.target.value),placeholder:"Provider Name",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),T.name!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:T.name})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"provider-source",className:"text-sm font-medium",children:"Token Source"}),l.jsxs("select",{id:"provider-source",value:j??"",onChange:X=>N(X.target.value==="company"||X.target.value==="personal"?X.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:[l.jsx("option",{value:"",children:"—"}),l.jsx("option",{value:"personal",children:"个人 (Personal)"}),l.jsx("option",{value:"company",children:"公司 (Company)"})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Label whether this API key is company-provided or personal."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{htmlFor:"provider-apikey",className:"text-sm font-medium",children:["API Key ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{id:"provider-apikey",type:"text",value:a||s.length===0?s:Vp(s),onChange:X=>i(X.target.value),onFocus:()=>{!a&&s.length>0&&c(!0)},placeholder:"sk-ant-...",readOnly:!a&&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"}),l.jsx("button",{type:"button",onClick:()=>c(X=>!X),className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":a?"Hide API key":"Show API key",children:a?l.jsx(Vi,{className:"size-4"}):l.jsx(Wi,{className:"size-4"})}),l.jsx("button",{type:"button",onClick:W,className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":"Copy API key",children:u?l.jsx(Gt,{className:"size-4 text-green-500"}):l.jsx(wn,{className:"size-4"})})]}),T.apiKey!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:T.apiKey})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{className:"text-sm font-medium",children:["Models ",l.jsx("span",{className:"text-destructive",children:"*"})]}),p.map((X,de)=>l.jsxs("div",{ref:te=>{w.current[de]=te},className:"flex items-center gap-2",children:[l.jsxs("div",{className:"relative flex-1",children:[l.jsx("input",{type:"text",value:X,onChange:te=>{f(ce=>{const fe=[...ce];return fe[de]=te.target.value,fe})},placeholder:Y||I?"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"}),(Y||I)&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",onClick:()=>M(E===de?null:de),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:l.jsx(vt,{className:"size-4"})}),E===de&&l.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:(Y?Xc:Qc).map(te=>l.jsx("button",{type:"button",onClick:()=>{f(ce=>{const fe=[...ce];return fe[de]=te,fe}),M(null)},className:"w-full text-left px-3 py-2 text-sm hover:bg-muted transition-colors",children:te},te))})]})]}),p.length>1&&l.jsx("button",{type:"button",onClick:()=>f(te=>te.filter((ce,fe)=>fe!==de)),className:"text-muted-foreground hover:text-destructive transition-colors p-1 shrink-0","aria-label":"Remove model",children:l.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:[l.jsx("path",{d:"M3 6h18"}),l.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),l.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]})})]},de)),l.jsx("button",{type:"button",onClick:()=>f(X=>[...X,""]),className:"text-xs text-primary hover:underline flex items-center gap-1",children:"+ Add Model"}),T.models!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:T.models})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex gap-1 border-b border-border",children:[l.jsx(Je,{children:l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>m("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"})}),l.jsx($e,{children:"Anthropic Messages API protocol"})]})}),l.jsx(Je,{children:l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>m("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"})}),l.jsx($e,{children:"OpenAI Chat Completions API protocol"})]})})]}),T.format!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:T.format})]}),g==="anthropic"&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"provider-anthropic-base-url",className:"text-sm font-medium",children:"Anthropic Base URL"}),l.jsx("input",{id:"provider-anthropic-base-url",type:"text",value:x,onChange:X=>{H(!0),y(X.target.value)},placeholder:"https://api.anthropic.com",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),T.anthropicBaseUrl!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:T.anthropicBaseUrl}),l.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"&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"provider-openai-base-url",className:"text-sm font-medium",children:"OpenAI Base URL"}),l.jsx("input",{id:"provider-openai-base-url",type:"text",value:b,onChange:X=>{q(!0),k(X.target.value)},placeholder:"https://api.openai.com/v1",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),T.openaiBaseUrl!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:T.openaiBaseUrl}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"OpenAI-compatible endpoint URL. Leave empty if this provider does not support OpenAI format."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"provider-api-docs-url",className:"text-sm font-medium",children:"API Docs URL"}),l.jsx("input",{id:"provider-api-docs-url",type:"text",value:S,onChange:X=>C(X.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"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional API documentation URL. If not set, uses known provider docs."})]}),l.jsxs("div",{className:"sticky bottom-0 bg-card border-t flex gap-2 justify-end pt-2 pb-2",children:[l.jsx(Xe,{type:"button",variant:"outline",onClick:n,disabled:O,children:"Cancel"}),l.jsx(Xe,{type:"submit",disabled:O,children:O?"Saving...":e?"Update Provider":"Add Provider"})]})]})}const Ni=ae({id:K(),name:K(),apiKey:K(),model:K().optional(),models:Pe(K()).min(1),format:lt(["anthropic","openai"]).optional(),baseUrl:K().optional(),anthropicBaseUrl:K().optional(),openaiBaseUrl:K().optional(),authHeader:lt(["bearer","x-api-key"]).optional().default("bearer"),apiDocsUrl:K().optional(),source:lt(["company","personal"]).optional(),createdAt:K(),updatedAt:K()}),Z4=lt(["timeout","network_unreachable","connection_refused","auth_failed","rate_limited","server_error","invalid_response","unknown"]),V4=ae({message:K(),type:Z4,details:K().optional(),hint:K().optional()}),W4=ae({type:lt(["text","thinking"]),text:K().optional(),thinking:K().optional()}),H4=ae({success:Qe(),error:V4.optional(),model:K().optional(),inputTokens:ve().optional(),outputTokens:ve().optional(),cacheCreationInputTokens:ve().optional(),cacheReadInputTokens:ve().optional(),latencyMs:ve().optional(),content:Pe(W4).optional(),rawResponse:K().optional(),streaming:Qe().optional(),streamingChunks:ae({chunks:Pe(Qu),truncated:Qe().default(!1)}).optional(),requestHeaders:Wt(K(),K()).optional()}),eu=Kt([H4,ae({notConfigured:Se(!0)}),ae({testing:Se(!0)})]),Io=ae({nonStreaming:eu,streaming:eu}),q4=ae({anthropic:Io,openai:Io}),K4=ae({anthropic:Io,openai:Io,models:Wt(K(),q4).optional(),testedAt:K().optional()});function G4(){return{anthropic:{nonStreaming:{testing:!0},streaming:{testing:!0}},openai:{nonStreaming:{testing:!0},streaming:{testing:!0}}}}function tu(e,t){const n=()=>({nonStreaming:{success:!1,error:{message:e,type:t}},streaming:{notConfigured:!0}});return{anthropic:n(),openai:n()}}const J4=ae({providerConfig:K()}),Y4=ae({success:Qe().optional(),imported:ve().optional(),message:K().optional(),errors:Pe(K()).optional()}),X4=30,Ws="Network error: could not reach the server. Is the proxy running?";function nu(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 Q4({externalProviders:e,isLoading:t=!1,externalTestResults:n,externalTestingProviders:r,externalTestingTimeLeft:o,onProvidersMutate:s,onTestResultsChange:i,onTestingProvidersChange:a,onTestingTimeLeftChange:c}){const[u,d]=v.useState(!1),[h,p]=v.useState(),[f,g]=v.useState(null),[m,x]=v.useState({}),[y,b]=v.useState(new Set),[k,S]=v.useState({}),[C,j]=v.useState(null),[N,T]=v.useState(!1),[A,O]=v.useState(null),[L,E]=v.useState(!1),[M,w]=v.useState(!1),[D,H]=v.useState(null),[B,q]=v.useState("all"),Y=v.useRef(null),I=v.useRef(null),W=e??[],V=v.useMemo(()=>{const U=B==="all"?W:W.filter(J=>J.source===B);return B==="all"?[...U].sort((J,$)=>{const ne={personal:0,company:1};return(ne[J.source??""]??2)-(ne[$.source??""]??2)}):U},[W,B]),z=n??m,oe=r??y,X=o??k,de=c?(U,J)=>c(U,J):(U,J)=>{S(J===void 0?$=>{const ne={...$};return delete ne[U],ne}:$=>({...$,[U]:J}))};v.useEffect(()=>{(async()=>{try{const U=await fetch("/api/config/paths");if(U.ok){const J=await In(U,J4);j(J.providerConfig)}}catch{}})()},[]);const te=v.useCallback(U=>{I.current!==null&&clearTimeout(I.current),O(U),Y.current?.scrollTo({top:Y.current.scrollHeight,behavior:"smooth"}),I.current=setTimeout(()=>{O(null),I.current=null},2e3)},[]);v.useEffect(()=>()=>{I.current!==null&&clearTimeout(I.current)},[]);const ce=v.useCallback(()=>{s?.().catch(()=>{})},[s]),fe=v.useCallback((U,J)=>{i?i(U,J):x($=>({...$,[U]:J}))},[i]),ge=v.useCallback((U,J)=>{if(a){a(U,J);return}b($=>{const ne=new Set($);return J?ne.add(U):ne.delete(U),ne})},[a]),xe=v.useCallback(async U=>{fe(U,G4()),ge(U,!0);const J=new AbortController;let $=X4;de(U,$);const ne=setInterval(()=>{$--,de(U,$),$<=0&&(clearInterval(ne),J.abort())},1e3);try{const le=await fetch(`/api/providers/${U}/test`,{method:"POST",signal:J.signal});if(le.ok){const se=await In(le,K4);fe(U,se)}else fe(U,tu(`HTTP ${le.status}: ${le.statusText}`,"server_error"))}catch(le){le instanceof Error&&le.name==="AbortError"&&fe(U,tu("Request timed out","timeout"))}finally{clearInterval(ne),de(U,void 0),ge(U,!1)}},[de,fe,ge]);function Ee(U){(async()=>{try{const J=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(nu(U))});if(!J.ok){g(await no(J,"Failed to add provider"));return}const $=await In(J,Ni);d(!1),te($.id),ce(),await xe($.id)}catch{g(Ws)}})()}function Oe(U){h&&(async()=>{try{const J=await fetch(`/api/providers/${h.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(nu(U))});if(!J.ok){g(await no(J,"Failed to update provider"));return}const $=await In(J,Ni);p(void 0),te($.id),ce(),((U.apiKey??"")!==(h.apiKey??"")||JSON.stringify(U.models)!==JSON.stringify(h.models)||(U.anthropicBaseUrl??"")!==(h.anthropicBaseUrl??"")||(U.openaiBaseUrl??"")!==(h.openaiBaseUrl??""))&&await xe($.id)}catch{g(Ws)}})()}function _(U){H(U),w(!0)}function ee(){const U=D;U!==null&&(async()=>{let J;try{J=await fetch(`/api/providers/${U}`,{method:"DELETE"})}catch{g(Ws);return}if(!J.ok){g(await no(J,"Failed to delete provider"));return}ce()})()}const G=v.useRef(null);function P(U){const J="/api/providers/export";(async()=>{try{const $=await fetch(J);if(!$.ok){g("Failed to export providers");return}const ne=await $.blob(),le=URL.createObjectURL(ne),se=document.createElement("a");se.href=le,se.download=$.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]??"providers.json",document.body.appendChild(se),se.click(),document.body.removeChild(se),URL.revokeObjectURL(le)}catch{g("Failed to export providers")}})()}function R(){G.current?.click()}function F(U){const J=U.target.files?.[0];J&&(async()=>{try{const $=await J.text(),ne=await fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)}),le=await In(ne,Y4);ne.ok&&le.imported!==void 0&&le.imported>0?(ce(),g(null)):le.errors&&le.errors.length>0?g(le.errors.join("; ")):g(le.message??"Import failed")}catch{g("Failed to import providers")}U.target.value=""})()}return t?l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading providers..."})}):u||h?l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{className:"flex items-center justify-between sticky top-0 bg-background z-10 pb-2",children:l.jsx("h3",{className:"text-lg font-medium",children:h?"Edit Provider":"Add New Provider"})}),l.jsx(U4,{provider:h,onSubmit:h?Oe:Ee,onCancel:()=>{d(!1),p(void 0)}})]}):l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between sticky top-0 z-10 bg-background pb-2",children:[l.jsx("h3",{className:"text-lg font-medium",children:"Providers"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Je,{children:l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsxs(Xe,{variant:"outline",size:"sm",onClick:()=>P(),className:"gap-1 hover:bg-muted",children:[l.jsx(Zi,{className:"size-3"}),"Export"]})}),l.jsx($e,{children:"Download providers as JSON for backup or sharing"})]})}),l.jsx(Je,{children:l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsxs(Xe,{variant:"outline",size:"sm",onClick:R,className:"gap-1 hover:bg-muted",children:[l.jsx(Tv,{className:"size-3"}),"Import"]})}),l.jsx($e,{children:"Import providers from an exported JSON file"})]})}),l.jsx("input",{type:"file",ref:G,accept:".json",onChange:F,style:{display:"none"}}),l.jsx(Je,{children:l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsxs(Xe,{variant:"outline",size:"sm",onClick:()=>E(!0),className:"gap-1",children:[l.jsx(vv,{className:"size-3"}),"Scan"]})}),l.jsx($e,{children:"Detect and import provider configs from Claude Code and OpenCode"})]})}),l.jsxs(Xe,{onClick:()=>d(!0),size:"sm",className:"gap-1",children:[l.jsx(ho,{className:"size-4"}),"Add Provider"]})]})]}),C!==null&&l.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/30 rounded-md px-3 py-2",children:[l.jsx("span",{className:"shrink-0",children:"Config:"}),l.jsx("span",{className:"font-mono truncate",title:C,children:C}),l.jsx(Je,{children:l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>{window.navigator.clipboard.writeText(C).then(()=>{T(!0),setTimeout(()=>T(!1),2e3)})},className:"shrink-0 ml-auto text-muted-foreground hover:text-foreground transition-colors",children:N?l.jsx(Gt,{className:"size-3 text-green-500"}):l.jsx(wn,{className:"size-3"})})}),l.jsx($e,{children:"Copy config file path to clipboard"})]})})]}),f!==null&&l.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive bg-destructive/10 rounded-md px-3 py-2",children:[l.jsx(_r,{className:"size-4 shrink-0"}),f]}),W.length===0?l.jsxs("div",{className:"text-center py-12 space-y-3",children:[l.jsx("p",{className:"text-sm text-muted-foreground",children:"No providers configured yet."}),l.jsxs(Xe,{onClick:()=>d(!0),variant:"outline",size:"sm",children:[l.jsx(ho,{className:"size-4"}),"Add Your First Provider"]})]}):l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{className:"flex gap-1 border-b border-border",children:["all","personal","company"].map(U=>l.jsx(Je,{children:l.jsxs(Le,{children:[l.jsx(Fe,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>q(U),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${B===U?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:U==="all"?"All":U==="personal"?"Personal":"Company"})}),l.jsx($e,{children:U==="all"?"Show all providers":U==="personal"?"Providers you configured yourself":"Providers set by your organization"})]})},U))}),l.jsx("div",{ref:Y,className:"space-y-3",children:V.map(U=>l.jsx($4,{provider:U,testResults:z[U.id],isTesting:oe.has(U.id),testingTimeLeft:X[U.id],isHighlighted:U.id===A,onEdit:J=>p(J),onDelete:_,onTest:J=>{xe(J)}},U.id))})]}),l.jsx(P4,{open:L,onOpenChange:E,onImportComplete:()=>{s!==void 0&&s()}}),l.jsx(Hh,{open:M,onOpenChange:w,title:"Delete Provider",description:"Are you sure you want to delete this provider? This action cannot be undone.",confirmLabel:"Delete",variant:"destructive",onConfirm:ee})]})}async function eT(e){return Ar(e,Ni.array(),void 0,t=>`Failed to fetch ${e}: ${t.status}`)}function tT(){const e=zi("/api/providers",eT,{revalidateOnFocus:!1,revalidateIfStale:!1});return{providers:e.data??[],isLoading:e.isLoading,isError:e.error,mutate:e.mutate}}function nT(){const[e,t]=v.useState(!1),[n,r]=v.useState("providers"),{providers:o,isLoading:s,mutate:i}=tT(),[a,c]=v.useState({}),[u,d]=v.useState(new Set),[h,p]=v.useState({}),f=v.useCallback((x,y)=>{c(b=>({...b,[x]:y}))},[]),g=v.useCallback((x,y)=>{d(b=>{const k=new Set(b);return y?k.add(x):k.delete(x),k})},[]),m=v.useCallback((x,y)=>{p(b=>{if(y===void 0){const k={...b};return delete k[x],k}return{...b,[x]:y}})},[]);return l.jsxs(rs,{open:e,onOpenChange:t,children:[l.jsx(RS,{asChild:!0,children:l.jsxs(Xe,{variant:"ghost",size:"icon",className:"size-8",children:[l.jsx(_v,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Settings"})]})}),l.jsxs(os,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[l.jsx(ss,{children:l.jsx(is,{children:"Settings"})}),l.jsxs(Pn,{value:n,onValueChange:r,className:"flex-1 overflow-hidden",children:[l.jsxs(On,{children:[l.jsx(tt,{value:"providers",children:"Providers"}),l.jsx(tt,{value:"proxy",children:"Proxy"})]}),l.jsxs("div",{className:"mt-4 overflow-y-auto flex-1 pr-3",children:[l.jsx(nt,{value:"providers",children:l.jsx(Q4,{externalProviders:o,isLoading:s,externalTestResults:a,externalTestingProviders:u,externalTestingTimeLeft:h,onProvidersMutate:()=>i(),onTestResultsChange:f,onTestingProvidersChange:g,onTestingTimeLeftChange:m})}),l.jsx(nt,{value:"proxy",children:l.jsx(rT,{})})]})]})]})]})}function rT(){const{strip:e,isLoading:t,setStrip:n}=ed(),[r,o]=v.useState(null),[s,i]=v.useState(!1),a=v.useCallback(async c=>{o(null),i(!0);try{await n(c)}catch(u){o(u instanceof Error?u.message:String(u))}finally{i(!1)}},[n]);return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("h3",{className:"text-sm font-semibold",children:"Claude Code billing header"}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["When enabled, the proxy strips the synthetic ",l.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 ",l.jsx("code",{children:"LLM_INSPECTOR_STRIP_CLAUDE_CODE_BILLING_HEADER"})," environment variable; your choice is persisted to ",l.jsx("code",{children:"config.json"})," and overrides the env var for subsequent requests."]})]}),l.jsxs("label",{className:"flex items-center gap-3",children:[l.jsx("input",{type:"checkbox",role:"switch",checked:e,disabled:t||s,onChange:c=>{a(c.currentTarget.checked)},className:"size-4 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"}),l.jsx("span",{className:"text-sm",children:t?"Loading…":e?"Stripping enabled":"Stripping disabled"})]}),r!==null&&l.jsxs("p",{className:"text-xs text-destructive",children:["Failed to save: ",r]})]})}function oT(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:ru(s.cacheCreationInputTokens,i.cacheCreationInputTokens),read:ru(s.cacheReadInputTokens,i.cacheReadInputTokens)})}}return t}function ru(e,t){return t===null||e===null?null:t>e?{direction:"up",delta:t-e}:t<e?{direction:"down",delta:e-t}:null}const sT="";function mr(e){if(e.length===0)return sT;let t="";for(let n=0;n<e.length;n++){const r=e[n];r!==void 0&&(typeof r=="number"?t+=`[${r}]`:n===0?t+=r:t+=`.${r}`)}return t}function iT(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ou(e){if(typeof e=="string")try{return zo(JSON.parse(e))}catch{return{kind:"primitive",value:e}}return zo(e)}function zo(e){if(e===null)return{kind:"primitive",value:null};if(typeof e=="string")return{kind:"primitive",value:e};if(typeof e=="number")return{kind:"primitive",value:e};if(typeof e=="boolean")return{kind:"primitive",value:e};if(Array.isArray(e))return{kind:"array",value:e.map(t=>zo(t))};if(iT(e)){const t={};for(const n of Object.keys(e).sort())t[n]=zo(e[n]);return{kind:"object",value:t}}return{kind:"primitive",value:null}}function aT(e,t){const n=[];return Ti([],e,t,n),n}function Ti(e,t,n,r){const o=mr(e);if(Ai(t,n)){r.push({kind:"equal",path:o,value:t});return}if(t.kind!==n.kind){r.push({kind:"changed",path:o,left:t,right:n});return}if(t.kind==="primitive"&&n.kind==="primitive"){r.push({kind:"changed",path:o,left:t,right:n});return}if(t.kind==="object"&&n.kind==="object"){const s=Object.keys(t.value),i=Object.keys(n.value),a=new Set(i);for(const c of s){const u=t.value[c];if(u!==void 0)if(!a.has(c))r.push({kind:"removed",path:mr([...e,c]),value:u});else{const d=n.value[c];if(d===void 0)continue;Ti([...e,c],u,d,r)}}for(const c of i){if(s.includes(c))continue;const u=n.value[c];u!==void 0&&r.push({kind:"added",path:mr([...e,c]),value:u})}return}if(t.kind==="array"&&n.kind==="array"){const s=Math.min(t.value.length,n.value.length);for(let i=0;i<s;i++){const a=t.value[i],c=n.value[i];a===void 0||c===void 0||Ti([...e,i],a,c,r)}for(let i=s;i<n.value.length;i++){const a=n.value[i];a!==void 0&&r.push({kind:"added",path:mr([...e,i]),value:a})}for(let i=s;i<t.value.length;i++){const a=t.value[i];a!==void 0&&r.push({kind:"removed",path:mr([...e,i]),value:a})}}}function Ai(e,t){if(e.kind!==t.kind)return!1;if(e.kind==="primitive"&&t.kind==="primitive")return e.value===t.value;if(e.kind==="array"&&t.kind==="array"){if(e.value.length!==t.value.length)return!1;for(let n=0;n<e.value.length;n++){const r=e.value[n],o=t.value[n];if(r===void 0||o===void 0||!Ai(r,o))return!1}return!0}if(e.kind==="object"&&t.kind==="object"){const n=Object.keys(e.value),r=Object.keys(t.value);if(n.length!==r.length)return!1;for(const o of n){const s=e.value[o],i=t.value[o];if(s===void 0||i===void 0||!Ai(s,i))return!1}return!0}return!1}function Et(e,t=80){let n;switch(e.kind){case"primitive":n=e.value===null?"null":JSON.stringify(e.value);break;case"array":n=`[… ${e.value.length} items]`;break;case"object":n=`{… ${Object.keys(e.value).length} keys}`;break}return n.length>t&&(n=`${n.slice(0,t-1)}…`),n}function lo(e,t=2){return JSON.stringify(Ii(e),null,t)}function Ii(e){switch(e.kind){case"primitive":return e.value;case"array":return e.value.map(Ii);case"object":{const t={};for(const[n,r]of Object.entries(e.value))t[n]=Ii(r);return t}}}function su(e){if(e==="")return"";for(let t=e.length-1;t>=0;t--){const n=e[t];if(n==="."||n==="[")return e.substring(0,t)}return""}function iu(e){return e.kind==="equal"&&(e.value.kind==="object"||e.value.kind==="array")}function lT(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if(r!==void 0&&iu(r)){const o=su(r.path);let s=n+1;for(;s<e.length;){const i=e[s];if(i===void 0||!iu(i)||su(i.path)!==o)break;s++}if(s-n>1){const i=[];for(let a=n;a<s;a++){const c=e[a];c!==void 0&&c.kind==="equal"&&i.push(c)}t.push({kind:"equal-run",ops:i}),n=s;continue}}r!==void 0&&t.push({kind:"single",op:r}),n++}return t}const Wp={added:{icon:ho,accent:"text-emerald-600 dark:text-emerald-400",bg:"bg-emerald-500/5 hover:bg-emerald-500/10",border:"border-l-emerald-500",label:"ADDED"},removed:{icon:Hi,accent:"text-rose-600 dark:text-rose-400",bg:"bg-rose-500/5 hover:bg-rose-500/10",border:"border-l-rose-500",label:"REMOVED"},changed:{icon:qi,accent:"text-amber-600 dark:text-amber-400",bg:"bg-amber-500/5 hover:bg-amber-500/10",border:"border-l-amber-500",label:"CHANGED"},equal:{icon:Ky,accent:"text-muted-foreground/70",bg:"bg-muted/20 hover:bg-muted/30",border:"border-l-muted-foreground/20",label:"EQUAL"}};function cT({ops:e,expanded:t,onToggle:n}){const r=e[0],o=e[e.length-1];if(r===void 0||o===void 0)return l.jsx("div",{className:"text-muted-foreground/40 text-xs",children:"—"});const s=r.path,i=o.path,a=e.length===1?s:`${s} … ${i}`,c=r.value.kind==="array"?`${e.length} equal arrays`:r.value.kind==="object"?`${e.length} equal objects`:"equal",u=Wp.equal;return l.jsxs("div",{className:he("border-l-4 rounded-sm",u.border,u.bg),children:[l.jsxs("button",{type:"button",onClick:n,className:"w-full text-left flex items-center gap-2 px-3 py-1.5 text-xs text-muted-foreground cursor-pointer",children:[l.jsx(bt,{className:he("size-3 transition-transform shrink-0",t&&"rotate-90")}),l.jsx(u.icon,{className:he("size-3 shrink-0",u.accent)}),l.jsx("span",{className:"font-mono truncate flex-1",title:`${s} … ${i}`,children:a}),l.jsx("span",{className:he("text-[10px] uppercase tracking-wider shrink-0",u.accent),children:u.label}),l.jsxs("span",{className:"text-muted-foreground/60 shrink-0",children:["(",c,")"]})]}),t&&l.jsx("div",{className:"ml-5 mt-1 mb-2 space-y-2 pr-2",children:e.map(d=>l.jsxs("div",{className:"border border-border/50 rounded p-2 bg-muted/20",children:[l.jsx("div",{className:"font-mono text-xs text-muted-foreground mb-1",children:d.path}),l.jsx(fn,{text:lo(d.value),defaultExpandDepth:2})]},d.path))})]})}function uT({op:e,idx:t,copiedPath:n,onCopyPath:r,expanded:o,onToggle:s}){const i=Wp[e.kind],a=i.icon,c=e.kind==="added"||e.kind==="removed"?e.value.kind==="object"||e.value.kind==="array":e.kind==="changed"?e.left.kind==="object"||e.left.kind==="array"||e.right.kind==="object"||e.right.kind==="array":!1,u=e.kind==="changed"?[{text:Et(e.left,400),tone:"text-rose-700 dark:text-rose-300 line-through"},{text:Et(e.right,400),tone:"text-emerald-700 dark:text-emerald-300"}]:e.kind==="removed"?[{text:Et(e.value,400),tone:"text-rose-700 dark:text-rose-300 line-through"}]:e.kind==="added"?[{text:Et(e.value,400),tone:"text-emerald-700 dark:text-emerald-300"}]:[{text:Et(e.value,400),tone:"text-muted-foreground"}],d=n===e.path&&e.path!=="";return l.jsxs("div",{"data-diff-idx":t,"data-diff-kind":e.kind,className:he("border-l-4 rounded-sm px-3 py-2 my-0.5 transition-colors",i.border,i.bg),children:[l.jsxs("button",{type:"button",onClick:s,disabled:!c,className:he("w-full flex items-center gap-2 text-xs text-left rounded-sm",c?"cursor-pointer":"cursor-default"),"aria-expanded":c?o:void 0,"aria-label":c?o?`Collapse ${e.path||"root"}`:`Expand ${e.path||"root"}`:void 0,children:[c?l.jsx(bt,{className:he("size-3 shrink-0 transition-transform",i.accent,o&&"rotate-90")}):l.jsx("span",{className:"size-3 shrink-0","aria-hidden":"true"}),l.jsx(a,{className:he("size-3.5 shrink-0",i.accent),strokeWidth:2.5}),l.jsx("span",{className:"font-mono truncate flex-1 min-w-0",title:e.path||"(root)",children:e.path===""?"(root)":e.path}),l.jsx("span",{className:he("text-[9px] font-bold uppercase tracking-wider shrink-0 px-1.5 py-0.5 rounded",i.accent,e.kind==="equal"?"bg-muted/40":"bg-background/60"),children:i.label}),e.path!==""&&l.jsx("span",{role:"button",tabIndex:0,onClick:h=>{h.stopPropagation(),r(e.path)},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.stopPropagation(),h.preventDefault(),r(e.path))},className:he("shrink-0 p-1 rounded transition-colors cursor-pointer inline-flex items-center justify-center",d?"text-emerald-500":"text-muted-foreground/50 hover:text-foreground hover:bg-muted"),"aria-label":d?"Copied":"Copy path",title:d?"Copied!":"Copy path",children:d?l.jsx(Gt,{className:"size-3"}):l.jsx(wn,{className:"size-3"})})]}),u.map((h,p)=>l.jsx("div",{className:he("font-mono text-xs mt-1 break-all pl-5",h.tone),children:h.text},p)),l.jsx("div",{className:"overflow-hidden transition-all duration-200",style:{maxHeight:o&&c?"2000px":"0"},"aria-hidden":!o,children:o&&c&&e.kind!=="equal"?l.jsx(dT,{op:e}):null})]})}function dT({op:e}){if(e.kind==="added"||e.kind==="removed")return l.jsx("div",{className:"pl-5 mt-2 border border-border/50 rounded p-2 bg-muted/20",children:l.jsx(fn,{text:lo(e.value),defaultExpandDepth:2})});const t=e.left.kind==="object"||e.left.kind==="array",n=e.right.kind==="object"||e.right.kind==="array";return!t&&!n?l.jsx("div",{className:"pl-5 mt-2 text-xs text-muted-foreground/70 italic",children:"Primitive values are shown inline above."}):l.jsxs("div",{className:"pl-5 mt-2 grid grid-cols-1 md:grid-cols-2 gap-2",children:[l.jsxs("div",{className:"border border-rose-500/30 rounded p-2 bg-rose-500/5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-wider text-rose-500 mb-1",children:"Old"}),l.jsx(fn,{text:lo(e.left),defaultExpandDepth:2})]}),l.jsxs("div",{className:"border border-emerald-500/30 rounded p-2 bg-emerald-500/5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-wider text-emerald-500 mb-1",children:"New"}),l.jsx(fn,{text:lo(e.right),defaultExpandDepth:2})]})]})}function fT({counts:e,onJumpTo:t}){const n=e.added+e.removed+e.changed;return l.jsxs("div",{className:"px-4 py-2 border-b border-border bg-muted/20 flex items-center gap-2 text-xs flex-wrap",children:[l.jsxs("span",{className:"text-muted-foreground font-medium",children:[n," ",n===1?"change":"changes"]}),l.jsxs("button",{type:"button",onClick:()=>t("removed"),disabled:e.removed===0,className:he("inline-flex items-center gap-1 px-2 py-0.5 rounded-full border cursor-pointer transition-colors",e.removed>0?"border-rose-500/40 text-rose-600 dark:text-rose-400 bg-rose-500/10 hover:bg-rose-500/20":"border-border text-muted-foreground/40 cursor-not-allowed"),title:e.removed>0?"Jump to first removed":"No removals",children:[l.jsx(Hi,{className:"size-3"}),e.removed," removed"]}),l.jsxs("button",{type:"button",onClick:()=>t("added"),disabled:e.added===0,className:he("inline-flex items-center gap-1 px-2 py-0.5 rounded-full border cursor-pointer transition-colors",e.added>0?"border-emerald-500/40 text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 hover:bg-emerald-500/20":"border-border text-muted-foreground/40 cursor-not-allowed"),title:e.added>0?"Jump to first added":"No additions",children:[l.jsx(ho,{className:"size-3"}),e.added," added"]}),l.jsxs("button",{type:"button",onClick:()=>t("changed"),disabled:e.changed===0,className:he("inline-flex items-center gap-1 px-2 py-0.5 rounded-full border cursor-pointer transition-colors",e.changed>0?"border-amber-500/40 text-amber-600 dark:text-amber-400 bg-amber-500/10 hover:bg-amber-500/20":"border-border text-muted-foreground/40 cursor-not-allowed"),title:e.changed>0?"Jump to first changed":"No changes",children:[l.jsx(qi,{className:"size-3"}),e.changed," changed"]})]})}function hT({mode:e,onChange:t}){return l.jsxs("div",{className:"inline-flex rounded-md border border-border overflow-hidden",children:[l.jsxs("button",{type:"button",onClick:()=>t("unified"),"aria-pressed":e==="unified",className:he("flex items-center gap-1 px-2 py-1 text-xs transition-colors cursor-pointer",e==="unified"?"bg-muted text-foreground":"hover:bg-muted/50 text-muted-foreground"),title:"Unified view (single column, emphasized diffs)",children:[l.jsx(ld,{className:"size-3"}),"Unified"]}),l.jsxs("button",{type:"button",onClick:()=>t("split"),"aria-pressed":e==="split",className:he("flex items-center gap-1 px-2 py-1 text-xs transition-colors border-l border-border cursor-pointer",e==="split"?"bg-muted text-foreground":"hover:bg-muted/50 text-muted-foreground"),title:"Split view (path | left | right)",children:[l.jsx(rd,{className:"size-3"}),"Split"]})]})}function au({log:e,side:t}){const n=_o(e);return l.jsxs("div",{className:"flex-1 min-w-0 space-y-1 text-xs",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(xt,{variant:"outline",className:he("text-[10px] px-1.5 py-0 h-5 font-mono shrink-0",t==="left"?"border-rose-500/40 text-rose-400":"border-emerald-500/40 text-emerald-400"),children:t==="left"?"← Left":"Right →"}),l.jsxs("span",{className:"font-mono text-blue-400/80",children:["#",e.id]}),e.model!==null&&l.jsx("span",{className:"font-mono text-muted-foreground truncate",children:e.model})]}),l.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground font-mono",children:[e.cacheCreationInputTokens!==null&&e.cacheCreationInputTokens>0&&l.jsxs("span",{className:"text-emerald-400",children:["Cache +",qe(e.cacheCreationInputTokens)]}),e.cacheReadInputTokens!==null&&e.cacheReadInputTokens>0&&l.jsxs("span",{className:"text-purple-400",children:["Cache ~",qe(e.cacheReadInputTokens)]}),l.jsx("span",{className:"truncate",title:e.timestamp,children:e.timestamp})]}),l.jsxs("div",{className:"text-muted-foreground/70 font-mono truncate",title:n,children:["session: ",n]})]})}function pT({left:e,right:t,onClose:n}){const r=v.useMemo(()=>{const j=Ao(Nr(e)).analyzeRequest(e.rawRequestBody),N=Ao(Nr(t)).analyzeRequest(t.rawRequestBody),T=ou(j.comparisonValue),A=ou(N.comparisonValue);return aT(T,A)},[e.apiFormat,e.path,e.rawRequestBody,t.apiFormat,t.path,t.rawRequestBody]),o=v.useMemo(()=>lT(r),[r]),s=v.useMemo(()=>{let j=0,N=0,T=0;for(const A of o)if(A.kind==="single")switch(A.op.kind){case"added":j++;break;case"removed":N++;break;case"changed":T++;break}return{added:j,removed:N,changed:T}},[o]),[i,a]=v.useState(new Set),c=j=>{a(N=>{const T=new Set(N);return T.has(j)?T.delete(j):T.add(j),T})},[u,d]=v.useState(new Set),h=j=>{d(N=>{const T=new Set(N);return T.has(j)?T.delete(j):T.add(j),T})};v.useEffect(()=>{d(new Set)},[e.id,t.id]);const[p,f]=v.useState("unified"),g=v.useRef(null),[m,x]=v.useState(null),y=v.useRef(null),b=j=>{window.navigator.clipboard.writeText(j).then(()=>{x(j),y.current!==null&&clearTimeout(y.current),y.current=setTimeout(()=>x(null),1500)})};v.useEffect(()=>()=>{y.current!==null&&clearTimeout(y.current)},[]);const k=j=>{const N=o.findIndex(O=>O.kind==="single"&&O.op.kind===j);if(N===-1)return;const T=g.current;if(T===null)return;const A=T.querySelector(`[data-diff-idx="${N}"]`);A!==null&&A.scrollIntoView({behavior:"smooth",block:"center"})};v.useEffect(()=>{const j=T=>{T.key==="Escape"&&n()};document.addEventListener("keydown",j);const N=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",j),document.body.style.overflow=N}},[n]);const S=_o(e)===_o(t),C=r.length===1&&r[0]?.kind==="equal";return l.jsxs("div",{className:"fixed inset-0 z-50 flex justify-end",role:"dialog","aria-modal":"true","aria-label":"Compare two log requests",children:[l.jsx("button",{type:"button",onClick:n,"aria-label":"Close compare drawer",className:"absolute inset-0 bg-black/40 cursor-default",tabIndex:-1}),l.jsxs("div",{className:he("relative bg-background border-l border-border shadow-xl","w-full md:w-[70vw] max-w-[1100px] flex flex-col h-full"),onClick:j=>j.stopPropagation(),onKeyDown:j=>j.stopPropagation(),children:[l.jsxs("div",{className:"flex items-start gap-4 px-4 py-3 border-b border-border",children:[l.jsxs("div",{className:"flex-1 flex gap-4 min-w-0",children:[l.jsx(au,{log:e,side:"left"}),l.jsx(au,{log:t,side:"right"})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[l.jsx(hT,{mode:p,onChange:f}),l.jsx("button",{type:"button",onClick:n,"aria-label":"Close",className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-muted cursor-pointer",children:l.jsx(Ki,{className:"size-4"})})]})]}),!S&&l.jsx("div",{className:"px-4 py-1.5 text-xs text-amber-400 bg-amber-500/10 border-b border-border",children:"Heads up: the two selected logs are from different sessions."}),C?l.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto flex items-center justify-center text-muted-foreground text-sm",children:"The two Request payloads are identical."}):l.jsxs(l.Fragment,{children:[l.jsx(fT,{counts:s,onJumpTo:k}),l.jsx("div",{ref:g,className:"flex-1 min-h-0 overflow-y-auto",children:p==="unified"?l.jsx("div",{className:"px-3 py-2 space-y-0.5",children:o.map((j,N)=>{if(j.kind==="equal-run")return l.jsx(cT,{ops:j.ops,expanded:i.has(N),onToggle:()=>c(N)},`r${N}`);const T=j.op;return l.jsx(uT,{op:T,idx:N,copiedPath:m,onCopyPath:b,expanded:u.has(N),onToggle:()=>h(N)},`o${N}`)})}):l.jsx(mT,{grouped:o,left:e,right:t})})]})]})]})}function mT({grouped:e,left:t,right:n}){return l.jsxs("div",{className:"grid grid-cols-[200px_1fr_1fr] gap-x-2 gap-y-0.5 px-3 py-2 text-xs",children:[l.jsxs("div",{className:"grid grid-cols-[200px_1fr_1fr] gap-x-2 col-span-3 pb-2 mb-2 border-b border-border text-[10px] uppercase tracking-wider text-muted-foreground",children:[l.jsx("span",{children:"Path"}),l.jsxs("span",{children:["Left (Log #",t.id,")"]}),l.jsxs("span",{children:["Right (Log #",n.id,")"]})]}),e.map((r,o)=>{if(r.kind==="equal-run")return l.jsxs("div",{className:"col-span-3 px-2 py-1 text-xs text-muted-foreground/60",children:[r.ops.length," equal siblings collapsed — switch to Unified to expand"]},o);const s=r.op;return s.kind==="equal"?l.jsxs("div",{className:"col-span-3 grid grid-cols-[200px_1fr_1fr] gap-x-2 px-2 py-0.5 text-muted-foreground",children:[l.jsx("span",{className:"font-mono text-xs truncate",title:s.path,children:s.path}),l.jsx("span",{className:"font-mono text-xs break-all opacity-60",children:Et(s.value,200)}),l.jsx("span",{className:"font-mono text-xs break-all opacity-60",children:Et(s.value,200)})]},o):s.kind==="added"?l.jsxs("div",{className:"col-span-3 px-2 py-1 rounded text-xs border-l-2 border-l-emerald-400/70 bg-emerald-500/5",children:[l.jsx("div",{className:"font-mono text-xs text-muted-foreground mb-0.5",children:s.path}),l.jsxs("div",{className:"font-mono break-all text-emerald-300/90",children:["+ ",Et(s.value,400)]})]},o):s.kind==="removed"?l.jsxs("div",{className:"col-span-3 px-2 py-1 rounded text-xs border-l-2 border-l-rose-400/70 bg-rose-500/5",children:[l.jsx("div",{className:"font-mono text-xs text-muted-foreground mb-0.5",children:s.path}),l.jsxs("div",{className:"font-mono break-all text-rose-300/90 line-through",children:["− ",Et(s.value,400)]})]},o):l.jsxs("div",{className:"col-span-3 px-2 py-1 rounded text-xs border-l-2 border-l-amber-400/70 bg-amber-500/5",children:[l.jsx("div",{className:"font-mono text-xs text-muted-foreground mb-1",children:s.path}),l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsx("div",{className:"font-mono text-rose-300/90 break-all line-through",children:Et(s.left,400)}),l.jsx("div",{className:"font-mono text-emerald-300/90 break-all",children:Et(s.right,400)})]})]},o)})]})}function gT(e){return e.length<=30?e:e.slice(0,12)+"…"+e.slice(-12)}function xT(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 yT({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 l.jsxs("div",{className:"inline-flex items-center gap-2 bg-muted rounded-md px-3 py-2",children:[l.jsx("pre",{className:"text-blue-500 font-mono text-sm m-0",children:e}),l.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?l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M20 6 9 17l-5-5"})}):l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),l.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 vT({logs:e,sessions:t,models:n,selectedSession:r,selectedModel:o,onSessionChange:s,onModelChange:i,onClearAll:a,onClearGroup:c,viewMode:u,onViewModeChange:d,strip:h}){const{totalIn:p,totalOut:f}=v.useMemo(()=>xT(e),[e]),[g,m]=v.useState(!1),[x,y]=v.useState(null),[b,k]=v.useState("hidden");v.useEffect(()=>{const E=50+So.length*400,M=setTimeout(()=>k("playing"),50),w=setTimeout(()=>k("done"),E);return()=>{clearTimeout(M),clearTimeout(w)}},[]);const S=v.useCallback(async()=>{m(!0);try{await qv(e)}finally{m(!1)}},[e]);v.useEffect(()=>{y(null)},[r,o]);const C=v.useCallback(()=>{y(null)},[]),j=v.useMemo(()=>BS(e),[e]),N=v.useMemo(()=>oT(j),[j]),T=v.useMemo(()=>w4(j),[j]),A=v.useCallback(O=>{const L=T.get(O.id);L!==void 0&&y([L,O])},[T]);return l.jsxs("div",{className:"max-w-[1200px] mx-auto flex flex-col h-screen",style:{maxHeight:"100vh"},children:[l.jsxs("div",{className:"flex items-end px-6 pt-6 pb-8 relative",children:[l.jsxs("h1",{className:"text-lg font-bold flex items-end gap-2 absolute left-1/2 -translate-x-1/2 whitespace-nowrap",children:[l.jsxs("span",{className:"flex items-end gap-1 group cursor-default","aria-hidden":"true",children:[l.jsx(S4,{className:"size-10 text-amber-500 transition-all duration-300 group-hover:scale-125 group-hover:-translate-y-1.5"}),l.jsx("span",{className:"flex items-end gap-0.5",children:So.map((O,L)=>{const E=["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"][L],M=b==="hidden"?"opacity-0 scale-0":b==="playing"?"animate-crab-piano-pop":"";return l.jsx(O,{className:`size-5 ${E} transition-all duration-300 ease-out group-hover:scale-125 group-hover:-translate-y-1 ${M}`,style:{transitionDelay:`${L*50}ms`,...b==="playing"?{animationDelay:`${L*400}ms`}:{}}},L)})})]}),l.jsxs("span",{className:"flex items-baseline gap-2",children:["LLM Inspector",l.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["v",Gv.version]})]})]}),l.jsx("div",{className:"ml-auto",children:l.jsx(nT,{})})]}),l.jsxs("div",{className:"flex items-center gap-3 px-6 mb-4",children:[l.jsxs(Kc,{value:r,onValueChange:s,children:[l.jsx(Jc,{className:"flex-1 max-w-[350px] text-xs",children:l.jsx(Gc,{placeholder:"All sessions"})}),l.jsxs(Yc,{children:[l.jsx(eo,{value:"__all__",children:"All sessions"}),t.map(O=>l.jsx(eo,{value:O,children:gT(O)},O))]})]}),l.jsxs(Kc,{value:o,onValueChange:i,children:[l.jsx(Jc,{className:"flex-1 max-w-[250px] text-xs",children:l.jsx(Gc,{placeholder:"All models"})}),l.jsxs(Yc,{children:[l.jsx(eo,{value:"__all__",children:"All models"}),n.map(O=>l.jsx(eo,{value:O,children:O},O))]})]}),l.jsxs("div",{className:"flex items-center border border-border rounded-md overflow-hidden",children:[l.jsx("button",{type:"button",onClick:()=>d("simple"),className:`px-2 py-1 cursor-pointer transition-colors text-xs ${u==="simple"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Simple"}),l.jsx("button",{type:"button",onClick:()=>d("full"),className:`px-2 py-1 cursor-pointer transition-colors text-xs ${u==="full"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Full"})]}),l.jsx("div",{className:"flex-1"}),l.jsxs("span",{className:"text-muted-foreground text-xs font-mono",children:[e.length," request",e.length!==1?"s":"",p>0||f>0?` · ${p.toLocaleString()} in / ${f.toLocaleString()} out`:""]}),e.length>0&&l.jsx("button",{type:"button",onClick:()=>{S()},disabled:g,className:"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",title:"Export all logs as JSON ZIP",children:g?l.jsx("span",{children:"Exporting..."}):l.jsxs(l.Fragment,{children:[l.jsx(Zi,{className:"size-3"}),l.jsx("span",{children:"Export"})]})}),l.jsx("button",{type:"button",onClick:a,className:"text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:"Clear all logs",children:"Clear"})]}),l.jsx("div",{className:"flex-1 min-h-0 px-6 pb-6",children:e.length===0?l.jsxs("div",{className:"text-center text-muted-foreground py-16 space-y-4",children:[l.jsx("p",{className:"text-sm",children:"No requests captured yet."}),l.jsx("p",{className:"text-xs",children:"Route AI coding tools through the proxy:"}),l.jsx(yT,{command:"LLM_BASE_URL=http://localhost:25947/proxy <your-tool>"})]}):l.jsx("div",{className:"overflow-y-auto h-full flex flex-col gap-2",children:j.map(O=>l.jsx(_4,{group:O,viewMode:u,strip:h,cacheTrends:N,onCompareWithPrevious:A,comparisonPredecessors:T,onClearGroup:c,standalone:j.length===1},O.id))})}),x!==null&&l.jsx(pT,{left:x[0],right:x[1],onClose:C})]})}const bT=Kt([ae({type:Se("init"),logs:Pe(ll)}),ae({type:Se("update"),log:ll})]);function Hs(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function qs(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function wT(e,t,n){return t==="__all__"&&n==="__all__"?e:e.filter(r=>!(t!=="__all__"&&r.sessionId!==t||n!=="__all__"&&r.model!==n))}const kT=50;function _T(){const[e,t]=v.useState([]),[n,r]=v.useState([]),[o,s]=v.useState([]),[i,a]=v.useState("__all__"),[c,u]=v.useState("__all__"),[d,h]=v.useState("simple"),[p,f]=v.useState(null),g=v.useRef(null),m=v.useRef(null),x=v.useRef(new Map),y=v.useRef([]),b=v.useRef([]),k=v.useRef(null),S=v.useMemo(()=>wT(e,i,c),[e,i,c]),C=v.useCallback(()=>{k.current=null;const L=b.current;b.current=[],L.length!==0&&t(E=>{let M=E,w=!1,D=!1;for(const H of L){const B=x.current.get(H.id);B!==void 0?M=[...M.slice(0,B),H,...M.slice(B+1)]:(x.current.set(H.id,M.length),M=[...M,H]),H.sessionId!==null&&H.sessionId!==""&&!n.includes(H.sessionId)&&(w=!0),H.model!==null&&H.model!==""&&!o.includes(H.model)&&(D=!0)}return y.current=M,w&&r(H=>Hs(M)),D&&s(H=>qs(M)),M})},[n,o]),j=v.useCallback(L=>{b.current.push(L),k.current===null&&(k.current=setTimeout(C,kT))},[C]),N=v.useCallback(()=>{g.current&&g.current.close();const L=new EventSource("/api/logs/stream");g.current=L,L.onmessage=E=>{try{const M=String(E.data),w=JSON.parse(M),D=bT.safeParse(w);if(!D.success){f("Failed to parse SSE data");return}const H=D.data;if(H.type==="init"){k.current!==null&&(clearTimeout(k.current),k.current=null),b.current=[];const B=new Map;for(let q=0;q<H.logs.length;q++){const Y=H.logs[q];Y!==void 0&&B.set(Y.id,q)}x.current=B,y.current=H.logs,t(H.logs),r(Hs(H.logs)),s(qs(H.logs)),f(null)}else H.type==="update"&&j(H.log)}catch{f("Failed to parse SSE data")}},L.onerror=()=>{f("SSE connection lost, reconnecting..."),L.close(),m.current!==null&&clearTimeout(m.current),m.current=setTimeout(N,3e3)}},[j]);v.useEffect(()=>(N(),()=>{g.current&&(g.current.close(),g.current=null),m.current!==null&&(clearTimeout(m.current),m.current=null),k.current!==null&&(clearTimeout(k.current),k.current=null)}),[N]);const T=v.useCallback(()=>{(async()=>{try{if(!(await fetch("/api/logs",{method:"DELETE"})).ok){f("Failed to clear logs");return}x.current.clear(),y.current=[],t([]),r([]),s([]),f(null)}catch(L){f(L instanceof Error?L.message:"Unknown error clearing logs")}})()},[]),A=v.useCallback(L=>{L.length!==0&&(async()=>{try{if(!(await fetch("/api/logs",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:L})})).ok){f("Failed to clear group");return}const M=new Set(L);t(w=>{const D=w.filter(B=>!M.has(B.id)),H=new Map;for(let B=0;B<D.length;B++){const q=D[B];q!==void 0&&H.set(q.id,B)}return x.current=H,y.current=D,r(Hs(D)),s(qs(D)),D}),f(null)}catch(E){f(E instanceof Error?E.message:"Unknown error clearing group")}})()},[]),{strip:O}=ed();return l.jsxs(l.Fragment,{children:[p!==null&&l.jsx("div",{className:"fixed top-4 right-4 bg-destructive text-destructive-foreground px-4 py-2 rounded-md text-sm z-50",children:p}),l.jsx(Uv,{}),l.jsx(vT,{logs:S,sessions:n,models:o,selectedSession:i,selectedModel:c,onSessionChange:a,onModelChange:u,onClearAll:T,onClearGroup:A,viewMode:d,onViewModeChange:h,strip:O})]})}const jT=_T;export{jT as component};
101
+ `)&&(n=n.slice(0,-1))),super.equals(t,n,r)}}const GN=new JN;function $p(e,t,n){return GN.diff(e,t,n)}function Bp(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
102
+ `));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 YN extends Fp{constructor(){super(...arguments),this.tokenize=Bp}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(Ei(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 XN=new YN;function QN(e,t,n){return XN.diff(e,t,n)}function Ei(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]=Ei(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 a=[];let c;for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&a.push(c);for(a.sort(),s=0;s<a.length;s+=1)c=a[s],i[c]=Ei(e[c],t,n,r,c);t.pop(),n.pop()}else i=e;return i}function Mc(e){return e===void 0?[]:Object.entries(e).map(t=>[t[0].toLowerCase(),t[1]]).sort(([t],[n])=>t.localeCompare(n))}function Lc([e,t]){return`${e}: ${t}`}function Ni(e){const t=[];let n=0,r=0;for(const o of e){const s=o.value.split(`
103
+ `);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 e3(e,t){const n=Mc(e).map(Lc).join(`
104
+ `),r=Mc(t).map(Lc).join(`
105
+ `);if(n===r)return{lines:[],isEmpty:!0};const o=$p(n,r);return{lines:Ni(o),isEmpty:!1}}function Fc(e){try{const t=JSON.parse(e);return t===null||typeof t=="string"||typeof t=="object"?t:null}catch{return null}}function t3(e,t){const n=e??"",r=t??"";if(n===r)return{lines:[],isEmpty:!0};const o=Fc(n),s=Fc(r);if(o!==null&&s!==null){const a=QN(o,s)??[];if(a.length===1){const c=a[0];if(c!==void 0&&!c.added&&!c.removed)return{lines:[],isEmpty:!0}}return{lines:Ni(a),isEmpty:!1}}const i=$p(n,r);return{lines:Ni(i),isEmpty:!1}}function n3(e,t,n){const r=new Array(e);return new Proxy(r,{get(o,s,i){if(typeof s=="string"){const a=s.charCodeAt(0);if(a>=48&&a<=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 Tn(e,t,n){let r=n.initialDeps??[],o,s=!0;function i(){const a=e();return(a.length!==r.length||a.some((u,d)=>r[d]!==u))&&(r=a,o=t(...a),n?.onChange&&!(s&&n.skipInitialOnChange)&&n.onChange(o),s=!1),o}return i.updateDeps=a=>{r=a},i}function $c(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const Bc=(e,t)=>Math.abs(e-t)<1.01,r3=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}};let fr;const Uc=()=>{if(fr!==void 0)return fr;if(typeof navigator>"u")return fr=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return fr=!0;const e=navigator.maxTouchPoints;return fr=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Zc=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},o3=e=>e,s3=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},i3=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=i=>{const{width:a,height:c}=i;t({width:Math.round(a),height:Math.round(c)})};if(o(Zc(n)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(i=>{const a=()=>{const c=i[0];if(c?.borderBoxSize){const u=c.borderBoxSize[0];if(u){o({width:u.inlineSize,height:u.blockSize});return}}o(Zc(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},To={passive:!0},a3=typeof window>"u"?!0:"onscrollend"in window,l3=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const o=e.targetWindow;if(!o)return;const s=e.options.useScrollendEvent&&a3;let i=0;const a=s?null:r3(o,()=>t(i,!1),e.options.isScrollingResetDelay),c=h=>()=>{i=n(r),a?.(),t(i,h)},u=c(!0),d=c(!1);return r.addEventListener("scroll",u,To),s&&r.addEventListener("scrollend",d,To),()=>{r.removeEventListener("scroll",u),s&&r.removeEventListener("scrollend",d)}},c3=(e,t)=>l3(e,t,n=>{const{horizontal:r,isRtl:o}=e.options;return r?n.scrollLeft*(o&&-1||1):n.scrollTop}),u3=(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"]},d3=(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})},f3=d3;class h3{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 a=s.target,c=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[u,d]of this.elementsCache)if(d===a){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(a,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:o3,rangeExtractor:s3,onChange:()=>{},measureElement:u3,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 a=null,c=null;if(i!==void 0&&i.enabled&&s.enabled&&s.anchorTo==="end"&&this.scrollElement!==null){const u=i.count,d=s.count,h=this.getMeasurements(),p=u>0?((r=h[0])==null?void 0:r.key)??i.getItemKey(0):null,f=u>0?((o=h[u-1])==null?void 0:o.key)??i.getItemKey(u-1):null;if(d!==u||u>0&&d>0&&(s.getItemKey(0)!==p||s.getItemKey(d-1)!==f)){const x=u>0?this.getVirtualItemForOffset(this.getScrollOffset())??h[0]:null;x&&(a=[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)!==f)&&(c=y)}}this.options=s,(a||c)&&(this.pendingScrollAnchor=[a?.[0]??null,a?.[1]??0,c])},this.notify=n=>{var r,o;(o=(r=this.options).onChange)==null||o.call(r,this,n)},this.maybeNotify=Tn(()=>(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)},a=()=>{this._iosTouching=!1,!(!Uc()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",i,To),s.addEventListener("touchend",a,To),this.unsubs.push(()=>{s.removeEventListener("touchstart",i),s.removeEventListener("touchend",a),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,a]=o;if(s!==null){const{count:c,getItemKey:u}=this.options;let d=0;for(;d<c&&u(d)!==s;)d++;const h=d<c?this.getMeasurements()[d]:void 0;if(h){const p=h.start+i-this.getScrollOffset();Bc(p,0)||this.applyScrollAdjustment(p)}}a&&this.scrollToEnd({behavior:a})}},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 a=n[i];if(o.has(a.lane))continue;const c=s.get(a.lane);if(c==null||a.end>c.end?s.set(a.lane,a):a.end<c.end&&o.set(a.lane,!0),o.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((i,a)=>i.end===a.end?i.index-a.index:i.end-a.end)[0]:void 0},this.getMeasurementOptions=Tn(()=>[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,a,c)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:a,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=Tn(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:a,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 h=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),a===1){const g=this.options.gap,m=n*2;let x=this._flatMeasurements;if(!x||x.length<m){const k=new Float64Array(m);x&&h>0&&k.set(x.subarray(0,h*2)),x=k,this._flatMeasurements=x}let y;if(h===0)y=r+o;else{const k=h-1;y=x[k*2]+x[k*2+1]+g}for(let k=h;k<n;k++){const S=s(k),j=d.get(S),C=typeof j=="number"?j:this.options.estimateSize(k);x[k*2]=y,x[k*2+1]=C,y+=C+g}const b=n3(n,x,s);return this.measurementsCache=b,b}const p=this.measurementsCache.slice(0,h),f=new Array(a).fill(void 0);for(let g=0;g<h;g++){const m=p[g];m&&(f[m.lane]=g)}for(let g=h;g<n;g++){const m=s(g),x=this.laneAssignments.get(g);let y,b;const k=c==="estimate"||d.has(m);if(x!==void 0&&this.options.lanes>1){y=x;const N=f[y],T=N!==void 0?p[N]:void 0;b=T?T.end+this.options.gap:r+o}else{const N=this.options.lanes===1?p[g-1]:this.getFurthestMeasurement(p,g);b=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(m),j=typeof S=="number"?S:this.options.estimateSize(g),C=b+j;p[g]={index:g,start:b,size:j,end:C,key:m,lane:y},f[y]=g}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Tn(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,s)=>this.range=n.length>0&&r>0?p3({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=Tn(()=>{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),a=Math.min(this.options.count-1,o+s);return n>=i&&n<=a}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((i,a)=>{i.isConnected||(this.observer.unobserve(i),this.elementsCache.delete(a))});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,a,c;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)c=this.options.getItemKey(n),a=u[n*2],i=u[n*2+1];else{const p=this.measurementsCache[n];if(!p)return;c=p.key,a=p.start,i=p.size}const d=this.itemSizeCache.get(c)??i,h=r-d;if(h!==0){const p=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,f=p?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:a,size:i,end:a+i,lane:0},h,this):a<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(c,r),this.itemSizeCacheVersion++,p?this.applyScrollAdjustment(this.getTotalSize()-f):g&&this.applyScrollAdjustment(h),this.notify(!1)}},this.getVirtualItems=Tn(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let s=0,i=n.length;s<i;s++){const a=n[s],c=r[a];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=Up(0,r.length-1,s?a=>o[a*2]:a=>$c(r[a]).start,n);return $c(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 a=this.getMaxScrollOffset();return Math.max(Math.min(a,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 a=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,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,a]=s,c=this.now();this.scrollState={index:n,align:a,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(a=>a===null);){const a=r[i];s[a.lane]===null&&(s[a.lane]=a.end),i--}o=Math.max(...s.filter(a=>a!==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&&(Uc()&&(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&&Bc(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 a=this.getSize()||600,c=Math.abs(o-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&c>a;this.scrollState.lastTargetOffset=o,u||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Up=(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 p3({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,a=o?d=>o[d*2]+o[d*2+1]:d=>e[d].end;if(e.length<=r)return{startIndex:0,endIndex:s};let c=Up(0,s,i,n),u=c;if(r===1)for(;u<s&&a(u)<n+t;)u++;else if(r>1){const d=Array(r).fill(0);for(;u<s&&d.some(p=>p<n+t);){const p=e[u];d[p.lane]=p.end,u++}const h=Array(r).fill(n+t);for(;c>=0&&h.some(p=>p>=n);){const p=e[c];h[p.lane]=p.start,c--}c=Math.max(0,c-c%r),u=Math.min(s,u+(r-1-u%r))}return{startIndex:c,endIndex:u}}const Vc=typeof document<"u"?v.useLayoutEffect:v.useEffect;function m3({useFlushSync:e=!0,...t}){const n=v.useReducer(s=>s+1,0)[1],r={...t,onChange:(s,i)=>{var a;e&&i?Ar.flushSync(n):n(),(a=t.onChange)==null||a.call(t,s,i)}},[o]=v.useState(()=>new h3(r));return o.setOptions(r),Vc(()=>o._didMount(),[]),Vc(()=>o._willUpdate()),o}function g3(e){return m3({observeElementRect:i3,observeElementOffset:c3,scrollToFn:f3,...e})}const x3=22,Us=1e4;function y3(e){return e==="added"?"+":e==="removed"?"-":" "}function v3(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 b3=function({result:t,emptyLabel:n}){const[r,o]=v.useState("unified"),s=v.useRef(null),i=g3({count:t.lines.length,getScrollElement:()=>s.current,estimateSize:()=>x3,overscan:10});if(t.isEmpty)return l.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 a=t.lines.length,c=a>Us,u=c?t.lines.slice(0,Us):t.lines;return l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[l.jsxs("span",{children:[a.toLocaleString()," line",a===1?"":"s",c&&` (showing first ${Us.toLocaleString()})`]}),l.jsxs("div",{className:"inline-flex rounded-md border border-border overflow-hidden",children:[l.jsxs("button",{type:"button",onClick:()=>o("unified"),"aria-pressed":r==="unified",className:he("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:[l.jsx(dd,{className:"size-3"}),"Unified"]}),l.jsxs("button",{type:"button",onClick:()=>o("split"),"aria-pressed":r==="split",className:he("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:[l.jsx(id,{className:"size-3"}),"Split"]})]})]}),l.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"?l.jsx(w3,{virtualizer:i,lines:u}):l.jsx(S3,{lines:u})})]})};function w3({virtualizer:e,lines:t}){return l.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:l.jsxs("div",{"data-index":n.index,ref:e.measureElement,className:he("flex items-start gap-3 px-2",v3(r.kind)),style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${n.start}px)`},children:[l.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:r.oldLineNumber??""}),l.jsx("span",{className:"select-none text-muted-foreground/60 w-10 text-right tabular-nums",children:r.newLineNumber??""}),l.jsx("span",{className:he("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:y3(r.kind)}),l.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:r.text})]},n.key)})})}function k3(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 a=e[n];a!==void 0&&o.push(a),n+=1}for(;n<e.length&&e[n]?.kind==="added";){const a=e[n];a!==void 0&&s.push(a),n+=1}const i=Math.max(o.length,s.length);for(let a=0;a<i;a+=1){const c=o[a],u=s[a];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 _3(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 S3({lines:e}){const t=k3(e);return l.jsx("div",{"data-testid":"diff-split",children:t.map((n,r)=>l.jsxs("div",{className:he("grid grid-cols-2 font-mono text-xs",_3(n.kind)),children:[l.jsxs("div",{className:"flex items-start gap-2 px-2 border-r border-border/50",children:[l.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.left?.lineNumber??""}),l.jsx("span",{className:he("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?"-":" "}),l.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.left?.text??""})]}),l.jsxs("div",{className:"flex items-start gap-2 px-2",children:[l.jsx("span",{className:"select-none text-muted-foreground/60 w-8 text-right tabular-nums",children:n.right?.lineNumber??""}),l.jsx("span",{className:he("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?"+":" "}),l.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:n.right?.text??""})]})]},r))})}const Zp=v.memo(b3);function C3(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const Hc={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:"",pending:"bg-muted text-muted-foreground border-border"};function Wc({trend:e}){if(e===null)return null;const t=e.direction==="up",n=t?Ty:Ey,r=t?"+":"-";return l.jsxs("span",{className:"flex items-center gap-0.5 text-muted-foreground tabular-nums",children:[l.jsx(n,{className:t?"size-3 text-emerald-400":"size-3 text-rose-400"}),l.jsxs("span",{className:"font-mono",children:[r,qe(e.delta)]})]})}const j3=v.memo(function({log:e,messageCount:t=null,toolCount:n=null,expanded:r,onToggle:o,responseToolNames:s=null,cacheTrend:i=null}){const a=Nd(e.responseStatus),c=e.inputTokens!==null||e.outputTokens!==null,u=v.useMemo(()=>s?.join(", ")??null,[s]);return l.jsx(Ge,{children:l.jsxs("div",{role:"button",tabIndex:0,className:he("flex items-center gap-2 px-3 py-1 cursor-pointer transition-colors","hover:bg-muted/50","select-none"),onClick:o,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),o())},children:[l.jsxs("span",{className:"text-blue-400/80 font-mono text-xs font-semibold tabular-nums shrink-0",children:["#",e.id]}),e.model!==null&&l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsx("span",{className:"shrink-0",children:l.jsx(ep,{provider:Qh(e.model),className:"size-4"})})}),l.jsx(Fe,{children:e.model})]}),a!=="success"&&l.jsx(l.Fragment,{children:a==="server_error"?l.jsx(xt,{variant:"destructive",className:"text-[10px] px-1.5 py-0 h-4 font-mono tabular-nums",children:e.responseStatus}):a==="pending"?l.jsx(xt,{variant:"outline",className:he("text-[10px] px-1.5 py-0 h-4 font-mono tabular-nums",Hc[a]),children:l.jsx(Sr,{className:"size-3 animate-spin"})}):l.jsx(xt,{variant:"outline",className:he("text-[10px] px-1.5 py-0 h-4 font-mono tabular-nums",Hc[a]),children:e.responseStatus})}),e.elapsedMs!==null&&l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(zr,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:C3(e.elapsedMs)})]}),c&&l.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[l.jsx(Yn,{className:"size-3 text-muted-foreground"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[l.jsxs("span",{className:e.inputTokens!==null?"text-blue-400":"text-muted-foreground",children:["IN ",e.inputTokens!==null?qe(e.inputTokens):"—"]})," / ",l.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&&l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[l.jsx(Wc,{trend:i?.creation??null}),l.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",qe(e.cacheCreationInputTokens)]})]})}),l.jsx(Fe,{children:"Tokens cached for reuse, reducing future API cost"})]}),e.cacheReadInputTokens!==null&&e.cacheReadInputTokens>0&&l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[l.jsx(Wc,{trend:i?.read??null}),l.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",qe(e.cacheReadInputTokens)]})]})}),l.jsx(Fe,{children:"Tokens served from cache, reducing API cost"})]}),t!==null&&l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(ld,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:t})]}),n!==null&&l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(dl,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:n})]}),s!==null&&s.length>0&&l.jsxs("span",{className:"flex items-center gap-1 text-amber-400/80 text-xs shrink-0",children:[l.jsx(dl,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums truncate max-w-[160px]",children:u})]}),e.origin!==null&&l.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:`Origin: ${e.origin}`,children:[l.jsx(lv,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",title:e.origin,children:e.origin})]}),(e.clientPid!==null||e.clientProjectFolder!==null)&&l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-purple-400/80 text-xs shrink-0",children:[l.jsx(rv,{className:"size-3"}),e.clientProjectFolder!==null?l.jsx("span",{className:"font-mono tabular-nums",children:e.clientProjectFolder}):l.jsxs("span",{className:"font-mono tabular-nums",children:["PID ",e.clientPid]})]})}),l.jsx(Fe,{children:e.clientCwd!==null?`PID: ${e.clientPid??"?"} CWD: ${e.clientCwd}`:`Process ID: ${e.clientPid??"?"}`})]}),e.streaming&&l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsx(xv,{className:"size-3 text-muted-foreground/60 shrink-0"})}),l.jsx(Fe,{children:"Request used SSE streaming"})]}),l.jsx("span",{className:"flex-1 min-w-0"}),r?l.jsx(vt,{className:"size-4 text-muted-foreground shrink-0"}):l.jsx(bt,{className:"size-4 text-muted-foreground shrink-0"})]})})});function Vp({className:e,orientation:t="horizontal",decorative:n=!0,...r}){return l.jsx(aS,{"data-slot":"separator",decorative:n,orientation:t,className:he("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...r})}function ds({...e}){return l.jsx(u2,{"data-slot":"collapsible",...e})}function fs({...e}){return l.jsx(Dd,{"data-slot":"collapsible-trigger",...e})}function hs({...e}){return l.jsx(Md,{"data-slot":"collapsible-content",...e})}function Da({className:e,children:t,...n}){return l.jsxs(b_,{"data-slot":"scroll-area",className:he("relative",e),...n,children:[l.jsx(w_,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),l.jsx(E3,{}),l.jsx(k_,{})]})}function E3({className:e,orientation:t="vertical",...n}){return l.jsx(Kf,{"data-slot":"scroll-area-scrollbar",orientation:t,className:he("flex touch-none p-px transition-colors select-none",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e),...n,children:l.jsx(Xf,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}function N3(e){return l.jsx(l.Fragment,{})}function T3({text:e}){const[t,n]=v.useState(!1);return l.jsxs(ds,{open:t,onOpenChange:n,children:[l.jsxs(fs,{className:"flex items-center gap-1.5 py-0.5 cursor-pointer hover:opacity-80 transition-opacity group",children:[t?l.jsx(vt,{className:"size-3 text-muted-foreground"}):l.jsx(bt,{className:"size-3 text-muted-foreground"}),l.jsx("span",{className:"text-muted-foreground text-xs italic select-none opacity-60",children:"[system-reminder]"})]}),l.jsx(hs,{children:l.jsx("div",{className:"pl-4 pt-1",children:l.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&_pre]:bg-muted [&_pre]:text-foreground [&_code]:text-[0.8em] [&_p]:my-1 [&_ul]:my-1 [&_ol]:my-1",children:l.jsx(Kn,{children:e})})})})]})}const A3=/<think>([\s\S]*?)<\/think>/gi,I3=/<think>([\s\S]*?)<\/think>/i;function Hp(e){const t=I3.exec(e);if(!t||t[1]===void 0)return{thinking:null,remainingText:e};const n=t[1].trim(),r=e.replace(A3,"").trim();return{thinking:n,remainingText:r}}const z3=v.memo(function({text:t}){if(t.includes("<system-reminder>"))return l.jsx(T3,{text:t});const{thinking:n,remainingText:r}=Hp(t);return l.jsxs("div",{className:"space-y-2",children:[n!==null&&l.jsx(Ao,{thinking:n}),r.length>0&&l.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&_pre]:bg-muted [&_pre]:text-foreground [&_code]:text-[0.8em] [&_p]:my-1 [&_ul]:my-1 [&_ol]:my-1",children:l.jsx(Kn,{children:r})}),n===null&&r.length===0&&l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty text block"})]})}),Ao=v.memo(function({thinking:t}){const[n,r]=v.useState(!1);return l.jsx(ds,{open:n,onOpenChange:r,children:l.jsxs("div",{className:"border-l-2 border-purple-500/40 my-1",children:[l.jsxs(fs,{className:"flex items-center gap-1.5 px-3 py-1 w-full text-left cursor-pointer hover:bg-purple-500/5 transition-colors rounded-r-sm group",children:[l.jsx(Iy,{className:"size-3.5 text-purple-400 shrink-0"}),l.jsx("span",{className:"text-xs font-medium text-purple-400",children:"Thinking"}),l.jsxs(xt,{variant:"ghost",className:"text-[10px] text-muted-foreground px-1.5 py-0 h-4 font-mono",children:[t.length.toLocaleString()," chars"]}),l.jsx("span",{className:"flex-1"}),n?l.jsx(vt,{className:"size-3 text-muted-foreground"}):l.jsx(bt,{className:"size-3 text-muted-foreground"})]}),l.jsx(hs,{children:l.jsx("div",{className:"px-3 pb-2",children:l.jsx(Da,{className:"max-h-[60vh]",children:l.jsx("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap font-mono leading-relaxed",children:t})})})})]})})}),P3=v.memo(function({name:t,input:n}){const[r,o]=v.useState(!1);return l.jsx(ds,{open:r,onOpenChange:o,children:l.jsxs("div",{className:"border-l-2 border-blue-500/40 my-1",children:[l.jsxs(fs,{className:"flex items-center gap-1.5 px-3 py-1 w-full text-left cursor-pointer hover:bg-blue-500/5 transition-colors rounded-r-sm group",children:[l.jsx(fd,{className:"size-3.5 text-blue-400 shrink-0"}),l.jsx(xt,{variant:"outline",className:"text-[10px] font-mono px-1.5 py-0 h-4",children:t}),l.jsx("span",{className:"flex-1"}),r?l.jsx(vt,{className:"size-3 text-muted-foreground"}):l.jsx(bt,{className:"size-3 text-muted-foreground"})]}),l.jsx(hs,{children:l.jsx("div",{className:"px-3 pb-2",children:l.jsx(Da,{className:"max-h-[60vh]",children:l.jsx(Jn,{data:Nr(n),defaultExpandDepth:0})})})})]})})}),R3=v.memo(function({block:t}){switch(t.type){case"text":return l.jsx(z3,{text:t.text});case"thinking":case"think":return l.jsx(Ao,{thinking:t.thinking});case"tool_use":return l.jsx(P3,{name:t.name,input:t.input});default:return N3()}}),O3=v.memo(function({response:t}){return l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx(xt,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-5 font-mono",children:t.model}),t.stop_reason!==null&&l.jsxs(xt,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-5 font-mono flex items-center gap-1",children:[l.jsx(sd,{className:"size-2.5"}),t.stop_reason]}),l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[l.jsx(Yn,{className:"size-3"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[qe(t.usage.input_tokens??0)," in /"," ",qe(t.usage.output_tokens??0)," out"]}),t.usage.cache_creation_input_tokens!==void 0&&t.usage.cache_creation_input_tokens!==null&&t.usage.cache_creation_input_tokens>0&&l.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",qe(t.usage.cache_creation_input_tokens)]}),t.usage.cache_read_input_tokens!==void 0&&t.usage.cache_read_input_tokens!==null&&t.usage.cache_read_input_tokens>0&&l.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",qe(t.usage.cache_read_input_tokens)]})]})]}),l.jsx(Vp,{className:"opacity-50"}),l.jsxs("div",{className:"space-y-2",children:[t.content.map((n,r)=>l.jsx(R3,{block:n},r)),t.content.length===0&&l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty response content"})]})]})});function D3(e){if(e===void 0||e==="")return{};try{return JSON.parse(e)}catch{return null}}function M3({call:e}){const[t,n]=v.useState(!1),r=e.function.name??"(unnamed tool)",o=D3(e.function.arguments);return l.jsx(ds,{open:t,onOpenChange:n,children:l.jsxs("div",{className:"border-l-2 border-blue-500/40 my-1",children:[l.jsxs(fs,{className:"flex items-center gap-1.5 px-3 py-1 w-full text-left cursor-pointer hover:bg-blue-500/5 transition-colors rounded-r-sm group",children:[l.jsx(fd,{className:"size-3.5 text-blue-400 shrink-0"}),l.jsx(xt,{variant:"outline",className:"text-[10px] font-mono px-1.5 py-0 h-4",children:r}),e.id!==void 0&&e.id!==""&&l.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/60 truncate",children:e.id}),l.jsx("span",{className:"flex-1"}),t?l.jsx(vt,{className:"size-3 text-muted-foreground"}):l.jsx(bt,{className:"size-3 text-muted-foreground"})]}),l.jsx(hs,{children:l.jsx("div",{className:"px-3 pb-2",children:l.jsx(Da,{className:"max-h-[60vh]",children:o===null?l.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words text-rose-300/90",children:e.function.arguments}):l.jsx(Jn,{data:Nr(o),defaultExpandDepth:0})})})})]})})}const L3=v.memo(function({response:t}){const n=t.choices[0],r=n?.message,o=r?.tool_calls??[];return l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[l.jsx(xt,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-5 font-mono",children:t.model}),n?.finish_reason!==null&&n?.finish_reason!==void 0&&l.jsxs(xt,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-5 font-mono flex items-center gap-1",children:[l.jsx(sd,{className:"size-2.5"}),n.finish_reason]}),l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[l.jsx(Yn,{className:"size-3"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[qe(t.usage.prompt_tokens??0)," in /"," ",qe(t.usage.completion_tokens??0)," out"]})]})]}),l.jsx(Vp,{className:"opacity-50"}),l.jsxs("div",{className:"space-y-2",children:[r?.reasoning_content!==null&&r?.reasoning_content!==void 0&&r.reasoning_content.length>0&&l.jsx(Ao,{thinking:r.reasoning_content}),r?.content!==null&&r?.content!==void 0&&r.content.length>0&&(()=>{const s=r.reasoning_content!==null&&r.reasoning_content!==void 0&&r.reasoning_content.length>0,{thinking:i,remainingText:a}=Hp(r.content);return l.jsxs("div",{className:"space-y-2",children:[i!==null&&!s&&l.jsx(Ao,{thinking:i}),a.length>0&&l.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&_pre]:bg-muted [&_pre]:text-foreground [&_code]:text-[0.8em] [&_p]:my-1 [&_ul]:my-1 [&_ol]:my-1",children:l.jsx(Kn,{children:a})})]})})(),o.map((s,i)=>l.jsx(M3,{call:s},s.id??`tc-${i}`)),r?.function_call!==null&&r?.function_call!==void 0&&l.jsxs("div",{className:"border border-blue-500/30 rounded-md p-3 bg-blue-500/5",children:[l.jsx("div",{className:"text-xs text-blue-400 font-mono mb-1",children:"function_call"}),l.jsxs("div",{className:"font-mono text-xs",children:[l.jsx("span",{className:"text-blue-300",children:r.function_call.name}),l.jsxs("span",{className:"text-muted-foreground",children:["(",r.function_call.arguments,")"]})]})]}),(r?.content===null||r?.content===void 0||r.content.length===0)&&(r?.reasoning_content===null||r?.reasoning_content===void 0||r.reasoning_content.length===0)&&(r?.function_call===null||r?.function_call===void 0)&&o.length===0&&l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty response content"})]})]})});function Wp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function F3(e){return Wp(e)&&e.object==="chat.completion"}function $3(e){return Wp(e)&&e.type==="message"&&Array.isArray(e.content)}function B3(e,t){return e==="openai"&&F3(t)?l.jsx(L3,{response:t}):e==="anthropic"&&$3(t)?l.jsx(O3,{response:t}):null}const U3="/v1/chat/completions",Z3="/chat/completions",V3="/v1/messages";class H3{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 sr=new H3;function W3(e){return sr.getByPath(e)??null}function q3(e){return W3(e)?.format??"unknown"}sr.registerPath(V3,"anthropic");sr.registerPath(U3,"openai");sr.registerPath(Z3,"openai");function K3(e){if(e==="")return{};try{const t=JSON.parse(e);return t!==null&&typeof t=="object"&&!Array.isArray(t)?{...t}:{}}catch{return{}}}function J3(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:K3(e.inputJson)}}}function qp(e,t,n,r){const o=new Map;let s="",i="",a=null,c=null,u=0,d=0;const h=1e3;let p=0,f=0;const g=[];for(const x of e.split(`
106
+ `)){const y=x.trim();if(y.startsWith("data: "))try{const b=JSON.parse(y.slice(6)),k=uy.safeParse(b);if(!k.success)continue;const S=k.data;switch(p===0&&(f=Date.now()),r===!0&&g.length<h&&g.push({index:p,timestamp:Date.now()-f,type:S.type,data:S}),p++,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 C=S.delta;C.type==="text_delta"&&j.type==="text"?j.text+=C.text:C.type==="thinking_delta"&&(j.type==="thinking"||j.type==="think")?j.thinking+=C.thinking:C.type==="signature_delta"&&(j.type==="thinking"||j.type==="think")?j.signature+=C.signature:C.type==="input_json_delta"&&j.type==="tool_use"&&(j.inputJson+=C.partial_json);break}case"message_delta":a=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:p>h});const m=[...o.entries()].sort(([x],[y])=>x-y).map(([,x])=>J3(x));return JSON.stringify({id:s,type:"message",model:i!==""?i:n??"",role:"assistant",content:m,stop_reason:a,stop_sequence:c,usage:{input_tokens:u,output_tokens:d}})}const G3={format:"anthropic",parseRequest(e,t){try{const n=JSON.parse(e),r=Ku.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=Ju.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 qp(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}}};sr.register(G3);class Y3{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 Ma=new Y3,X3="https://api.anthropic.com",Q3={MiniMax:"https://api.minimaxi.com/anthropic"},e4={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(Q3))if(t.startsWith(n.toLowerCase()))return!0;return!0},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:X3},extractStream(e,t,n,r){return qp(e,t,n,r)}};Ma.register(e4);function La(e,t,n,r=!0){let o="",s="",i="",a="",c=null,u=0,d=0,h=!1,p=!1;const f=new Map,g=1e3;let m=0,x=0;const y=[];for(const k of e.split(`
107
+ `)){const S=k.trim();if(!S.startsWith("data: "))continue;const j=S.slice(6);if(j==="[DONE]")break;try{const C=JSON.parse(j);if(typeof C=="object"&&C!==null&&!Array.isArray(C)){const A=Object.getOwnPropertyDescriptor(C,"error");if(A!==void 0&&typeof A.value=="object"&&A.value!==null){const R=Object.getOwnPropertyDescriptor(A.value,"message");R!==void 0&&typeof R.value=="string"&&(t.error=R.value);continue}}const N=gy.safeParse(C);if(!N.success)continue;const T=N.data;if(m===0&&(x=Date.now()),r===!0&&y.length<g&&y.push({index:m,timestamp:Date.now()-x,type:"chat.completion.chunk",data:T}),m++,p||(o=T.id,s=T.model,p=!0),!h&&T.usage!==void 0&&T.usage!==null){if(u=T.usage.prompt_tokens??0,d=T.usage.completion_tokens??0,t.inputTokens=u,typeof C=="object"&&C!==null&&!Array.isArray(C)){const A=Object.getOwnPropertyDescriptor(C,"usage");if(A!==void 0&&typeof A.value=="object"&&A.value!==null){const R=Object.getOwnPropertyDescriptor(A.value,"prompt_tokens_details");if(R!==void 0&&typeof R.value=="object"&&R.value!==null){const M=Object.getOwnPropertyDescriptor(R.value,"cached_tokens");M!==void 0&&typeof M.value=="number"&&(t.cacheReadInputTokens=M.value)}}}h=!0}for(const A of T.choices){const R=A.delta;R.content!==void 0&&R.content!==null&&(i+=R.content),R.reasoning_content!==void 0&&R.reasoning_content!==null&&(a+=R.reasoning_content),R.thinking!==void 0&&R.thinking!==null&&(a+=R.thinking);const M=R.think;if(M!=null&&(a+=M),A.finish_reason!==void 0&&A.finish_reason!==null&&(c=A.finish_reason),R.tool_calls!==void 0&&R.tool_calls!==null)for(const E of R.tool_calls){let L=f.get(E.index);L===void 0&&(L={index:E.index,type:"function",function:{name:"",arguments:""}},f.set(E.index,L)),E.id!==void 0&&(L.id=E.id),E.function?.name!==void 0&&(L.function.name+=E.function.name),E.function?.arguments!==void 0&&(L.function.arguments+=E.function.arguments)}}}catch{}}r===!0&&(t.streamingChunks={chunks:y,truncated:m>g}),h||(d=Math.ceil(i.length/4)),t.outputTokens=d;const b={role:"assistant",content:i};return a&&(b.reasoning_content=a),f.size>0&&(b.tool_calls=[...f.values()]),JSON.stringify({id:o,object:"chat.completion",created:Math.floor(Date.now()/1e3),model:s!==""?s:n??"",choices:[{index:0,message:b,finish_reason:c}],usage:{prompt_tokens:u,completion_tokens:d,total_tokens:u+d}})}const t4={format:"openai",parseRequest(e,t){try{const n=JSON.parse(e),r=Xu.safeParse(n);return r.success?{model:r.data.model,sessionId:t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){const t=ed(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 La(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}}};sr.register(t4);const n4="https://api.openai.com/v1",r4={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:n4},extractStream(e,t,n,r){return La(e,t,n,r)}};Ma.register(r4);const o4="https://dashscope.aliyuncs.com/compatible-mode/v1",s4={name:"alibaba",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return!!(t.startsWith("glm-5")||t.startsWith("qwen"))},getUpstreamBase(e,t){return o4},extractStream(e,t,n){return La(e,t,n)}};Ma.register(s4);function fn(e){return{parsed:null,comparisonValue:e,messageCount:null,toolCount:null}}const $n={parsed:null,toolNames:null},i4={format:"anthropic",analyzeRequest(e){if(e===null)return fn(e);try{const t=Ku.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}:fn(e)}catch{return fn(e)}},analyzeResponse(e){if(e===null)return $n;try{let t=JSON.parse(e);typeof t=="string"&&(t=JSON.parse(t));const n=Ju.safeParse(t);if(!n.success)return $n;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 $n}}},a4={format:"openai",analyzeRequest(e){if(e===null)return fn(e);try{const t=Xu.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}:fn(e)}catch{return fn(e)}},analyzeResponse(e){if(e===null)return $n;const t=ed(e);if(t===null)return $n;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}}},l4={format:"unknown",analyzeRequest(e){return fn(e)},analyzeResponse(){return $n}},c4={anthropic:i4,openai:a4,unknown:l4};function Io(e){return c4[e]}function Tr(e){const t=q3(e.path);return t==="unknown"?e.apiFormat:t}function u4(e){switch(e){case"success":return"text-emerald-400";case"client_error":return"text-amber-400";case"server_error":return"text-red-400";case"pending":return"text-muted-foreground"}}function hr({status:e}){const t=Nd(e),n=u4(t);return e===null?l.jsx("span",{className:"text-xs text-muted-foreground italic",children:"pending"}):l.jsxs("span",{className:he("flex items-center gap-1 text-xs font-mono font-semibold",n),children:[t==="server_error"&&l.jsx(Av,{className:"size-3"}),e]})}function qc({text:e}){return l.jsx("div",{className:"rounded-md border border-red-500/30 bg-red-500/5 p-3",children:l.jsx("pre",{className:"text-xs text-red-300 whitespace-pre-wrap font-mono leading-relaxed overflow-auto max-h-[60vh]",children:e})})}function d4({text:e}){return l.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none [&_pre]:bg-muted [&_pre]:text-foreground [&_code]:text-[0.8em] [&_p]:my-1 [&_ul]:my-1 [&_ol]:my-1",children:l.jsx(Kn,{children:e})})}const lo=v.memo(function({responseText:t,responseStatus:n,streaming:r,inputTokens:o,outputTokens:s,cacheCreationInputTokens:i,cacheReadInputTokens:a,apiFormat:c,error:u}){const d=c??"unknown",h=v.useMemo(()=>Io(d).analyzeResponse(t).parsed,[d,t]);return t===null&&u===void 0?l.jsxs("div",{className:"flex items-center gap-2 py-3",children:[l.jsx(hr,{status:n}),l.jsx("span",{className:"text-xs text-muted-foreground italic",children:"No response"})]}):n!==null&&n>=400?l.jsxs("div",{className:"space-y-2",children:[l.jsx(hr,{status:n}),l.jsx(qc,{text:t??""}),u!=null&&l.jsxs("div",{className:"rounded border border-destructive/50 bg-destructive/10 p-3 text-xs",children:[l.jsx("div",{className:"font-semibold text-destructive mb-1",children:"SSE Error"}),l.jsx("div",{className:"text-muted-foreground font-mono",children:u})]})]}):u!=null?l.jsxs("div",{className:"space-y-2",children:[l.jsx(hr,{status:n}),l.jsxs("div",{className:"rounded border border-destructive/50 bg-destructive/10 p-3 text-xs",children:[l.jsx("div",{className:"font-semibold text-destructive mb-1",children:"SSE Error"}),l.jsx("div",{className:"text-muted-foreground font-mono",children:u})]}),t!==null&&l.jsx("div",{className:"mt-2",children:l.jsx(qc,{text:t})})]}):h!==null?l.jsxs("div",{className:"space-y-2",children:[l.jsx(hr,{status:n}),B3(d,h)]}):l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(hr,{status:n}),r&&(o!==null||s!==null)&&l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[l.jsx(Yn,{className:"size-3"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[o!==null?qe(o):"—"," in /"," ",s!==null?qe(s):"—"," out"]}),i!=null&&i>0&&l.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",qe(i)]}),a!=null&&a>0&&l.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",qe(a)]})]})]}),l.jsx(d4,{text:t??""})]})}),f4=ae({success:Qe(),error:K().optional(),responseStatus:ve().optional(),responseText:K().optional(),inputTokens:ve().optional(),outputTokens:ve().optional(),elapsedMs:ve().optional(),streaming:Qe().optional()});function h4({log:e,open:t,onOpenChange:n}){const[r,o]=v.useState(()=>e.rawRequestBody??"{}"),[s,i]=v.useState(null),[a,c]=v.useState(!1),[u,d]=v.useState(null);async function h(){c(!0),d(null),i(null);try{const g=await(await fetch(`/api/logs/${e.id}/replay`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({modifiedBody:r})})).json(),m=f4.safeParse(g);if(!m.success){d("Invalid response from server"),c(!1);return}const x=m.data;i(x),x.success||d(x.error??"Replay failed")}catch(f){d(f instanceof Error?f.message:"Network error")}finally{c(!1)}}function p(){i(null),d(null),n(!1)}return l.jsx(os,{open:t,onOpenChange:p,children:l.jsxs(ss,{className:"max-w-4xl max-h-[85vh] overflow-auto",children:[l.jsx(is,{children:l.jsxs(as,{className:"flex items-center gap-2",children:[l.jsx(cd,{className:"size-4"}),"Replay Request #",e.id]})}),l.jsxs(Pn,{defaultValue:"modified",children:[l.jsxs(Rn,{children:[l.jsx(tt,{value:"modified",children:"Modified Request"}),l.jsx(tt,{value:"original",children:"Original Response"}),s&&l.jsx(tt,{value:"replay",children:"Replay Response"})]}),l.jsxs(nt,{value:"modified",className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Request Body (JSON)"}),l.jsx(Ge,{children:l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsx("textarea",{className:"w-full h-64 p-3 font-mono text-xs bg-muted rounded-md border border-input resize-none focus:outline-none focus:ring-2 focus:ring-ring",value:r,onChange:f=>o(f.target.value),spellCheck:!1})}),l.jsx(Fe,{children:"Edit the request body before re-sending to the provider"})]})})]}),u!==null&&u!==""&&l.jsx("div",{className:"text-sm text-destructive bg-destructive/10 px-3 py-2 rounded-md",children:u}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Xe,{onClick:()=>{h()},disabled:a,children:a?"Replaying...":"Replay"})}),s&&s.success&&l.jsxs(Pn,{defaultValue:"parsed",children:[l.jsxs(Rn,{children:[l.jsx(tt,{value:"parsed",children:"Response"}),l.jsx(tt,{value:"raw",children:"Raw Response"})]}),l.jsx(nt,{value:"parsed",children:l.jsx(lo,{responseText:s.responseText??null,responseStatus:s.responseStatus??null,streaming:s.streaming??!1,inputTokens:s.inputTokens??null,outputTokens:s.outputTokens??null,apiFormat:e.apiFormat})}),l.jsx(nt,{value:"raw",children:l.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto",children:s.responseText??"No response"})})]})]}),l.jsx(nt,{value:"original",children:e.responseText!==null?l.jsxs(Pn,{defaultValue:"parsed",children:[l.jsxs(Rn,{children:[l.jsx(tt,{value:"parsed",children:"Response"}),l.jsx(tt,{value:"raw",children:"Raw Response"})]}),l.jsx(nt,{value:"parsed",children:l.jsx(lo,{responseText:e.responseText,responseStatus:e.responseStatus,streaming:e.streaming,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens,cacheReadInputTokens:e.cacheReadInputTokens,apiFormat:e.apiFormat})}),l.jsx(nt,{value:"raw",children:l.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto",children:e.responseText})})]}):l.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No original response"})}),s&&s.success&&l.jsx(nt,{value:"replay",children:s.responseText!==null?l.jsxs(Pn,{defaultValue:"parsed",children:[l.jsxs(Rn,{children:[l.jsx(tt,{value:"parsed",children:"Response"}),l.jsx(tt,{value:"raw",children:"Raw Response"})]}),l.jsx(nt,{value:"parsed",children:l.jsx(lo,{responseText:s.responseText??null,responseStatus:s.responseStatus??null,streaming:s.streaming??!1,inputTokens:s.inputTokens??null,outputTokens:s.outputTokens??null,apiFormat:e.apiFormat})}),l.jsx(nt,{value:"raw",children:l.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto",children:s.responseText})})]}):l.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No replay response"})})]})]})})}const p4=v.memo(function({logId:t,truncated:n}){const[r,o]=v.useState(!1),[s,i]=v.useState({status:"idle"}),[a,c]=v.useState(new Set);v.useEffect(()=>{if(!r||s.status!=="idle")return;let p=!1;return i({status:"loading"}),fetch(`/api/logs/${t}/chunks`).then(f=>f.ok?f.json():Promise.reject(new Error("Chunks not found"))).then(f=>{p||i({status:"success",chunks:f.chunks})}).catch(()=>{p||i({status:"error",message:"Chunk data unavailable"})}),()=>{p=!0}},[r,t]);const u=v.useMemo(()=>{if(s.status!=="success")return[];const p=new Map;for(const f of s.chunks){const g=p.get(f.index);g?g.push(f):p.set(f.index,[f])}return Array.from(p.entries()).map(([f,g])=>({index:f,chunks:g})).sort((f,g)=>f.index-g.index)},[s]),d=p=>{c(f=>{const g=new Set(f);return g.has(p)?g.delete(p):g.add(p),g})};function h(){return s.status==="idle"||s.status==="loading"?l.jsxs("div",{className:"flex items-center gap-2 py-2 text-xs text-muted-foreground",children:[l.jsx(Sr,{className:"size-3 animate-spin"}),l.jsx("span",{children:"Loading chunks..."})]}):s.status==="error"?l.jsx("div",{className:"py-2 text-xs text-muted-foreground italic",children:s.message}):l.jsxs("div",{className:"p-2 space-y-1",children:[l.jsxs("div",{className:"text-[10px] text-muted-foreground font-mono mb-2",children:[u.length," index group",u.length!==1?"s":""," available"]}),u.map(p=>{const f=a.has(p.index);return l.jsxs("div",{className:"rounded border border-border bg-background",children:[l.jsxs("button",{type:"button",className:"flex items-center gap-2 w-full px-2 py-1.5 text-left hover:bg-muted/50 transition-colors cursor-pointer",onClick:()=>d(p.index),children:[f?l.jsx(vt,{className:"size-3 text-muted-foreground"}):l.jsx(bt,{className:"size-3 text-muted-foreground"}),l.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:["[",p.index,"] ",p.chunks[0]?.type??""]}),l.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:[p.chunks.length," chunk",p.chunks.length!==1?"s":""]})]}),f&&l.jsx("div",{className:"px-2 pb-2 space-y-1",children:p.chunks.map(g=>l.jsxs("div",{className:"rounded border border-border bg-muted/20 p-2",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:["+",g.timestamp,"ms"]}),l.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:g.type})]}),l.jsx(Jn,{data:g,defaultExpandDepth:0,showCopy:!0})]},g.index))})]},p.index)})]})}return l.jsxs("div",{className:"space-y-1",children:[l.jsx(Ge,{children:l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsxs("button",{type:"button",className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer",onClick:()=>o(p=>!p),children:[r?l.jsx(vt,{className:"size-3"}):l.jsx(bt,{className:"size-3"}),l.jsx("span",{children:"Raw SSE Events"}),l.jsxs(xt,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono ml-1",children:[t,n===!0?"+":""]})]})}),l.jsx(Fe,{children:"Server-Sent Events streaming chunks from the provider"})]})}),r===!0?l.jsx("div",{className:"rounded-md border border-border bg-muted/20 overflow-auto max-h-64",children:h()}):null]})});function Kc(e,t,n){return e==="anthropic"&&t==="full"&&n}function m4(e,t){return e==="full"&&t}function g4(e,t,n,r){return e==="anthropic"&&t==="full"&&n&&r}function Zs({text:e,label:t,copied:n,onCopy:r}){return e===null?null:l.jsx("button",{type:"button",onClick:r,className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors px-2 py-1 rounded hover:bg-muted",children:n?l.jsxs(l.Fragment,{children:[l.jsx(Jt,{className:"size-3 text-green-500"}),l.jsx("span",{className:"text-green-500",children:"Copied!"})]}):l.jsxs(l.Fragment,{children:[l.jsx(bn,{className:"size-3"}),l.jsx("span",{children:t})]})})}function Jc({active:e,onClick:t}){return l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsxs("button",{type:"button",onClick:t,"aria-pressed":e,className:he("flex items-center gap-1.5 text-xs px-2 py-1 rounded transition-colors",e?"bg-primary/10 text-primary":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:[l.jsx(ad,{className:"size-3"}),e?"Showing diff":"Diff with Raw"]})}),l.jsx(Fe,{children:e?"Hide diff view":"Compare proxy output against the original raw version"})]})}const x4=v.memo(function({rawBody:e,displayedBody:t,emptyLabel:n}){const r=v.useMemo(()=>t3(e,t),[e,t]);return l.jsx(Zp,{result:r,emptyLabel:n})}),y4=v.memo(function({rawHeaders:e,headers:t,emptyLabel:n}){const r=v.useMemo(()=>e3(e,t),[e,t]);return l.jsx(Zp,{result:r,emptyLabel:n})});function Vs(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 v4=v.memo(function({log:e,viewMode:t="simple",strip:n,cacheTrend:r=null,onCompareWithPrevious:o}){const[s,i]=v.useState(!1),[a,c]=v.useState(!1),[u,d]=v.useState(!1),[h,p]=v.useState(!1),[f,g]=v.useState("request"),m=Tr(e),x=Io(m),y=v.useMemo(()=>x.analyzeRequest(e.rawRequestBody),[x,e.rawRequestBody]),b=v.useMemo(()=>x.analyzeResponse(e.responseText),[x,e.responseText]),S=v.useMemo(()=>!n||m!=="anthropic"||e.rawRequestBody===null?null:kC(e.rawRequestBody).body,[e.rawRequestBody,m,n])??e.rawRequestBody,j=Vs(S),C=Vs(e.rawRequestBody),N=Vs(e.responseText),T=Pc(S),A=Pc(e.rawRequestBody);return l.jsxs(Ge,{children:[l.jsxs("div",{className:"border border-border rounded-lg mb-1 overflow-hidden",children:[l.jsx(j3,{log:e,messageCount:y.messageCount,toolCount:y.toolCount,expanded:s,onToggle:()=>i(!s),responseToolNames:b.toolNames,cacheTrend:r}),s&&l.jsx("div",{onClick:R=>R.stopPropagation(),onKeyDown:R=>R.stopPropagation(),children:l.jsxs(Pn,{value:f,onValueChange:g,children:[l.jsxs(Rn,{className:"mx-4 mt-2",children:[t==="full"&&l.jsx(tt,{value:"raw-headers",children:"Raw Headers"}),t==="full"&&l.jsx(tt,{value:"headers",children:"Headers"}),Kc(m,t,n)&&l.jsx(tt,{value:"raw-request",children:"Raw Request"}),l.jsx(tt,{value:"request",children:"Request"}),t==="full"&&l.jsx(tt,{value:"raw",children:"Raw Response"}),l.jsx(tt,{value:"parsed",children:"Response"})]}),Kc(m,t,n)&&l.jsx(nt,{value:"raw-request",children:f==="raw-request"&&l.jsxs("div",{className:"px-4 py-3",children:[l.jsxs("div",{className:"flex justify-end gap-2 mb-2",children:[l.jsx(Rc,{policy:A.policy,isExpanded:A.isExpanded,isPending:A.isPending,onToggle:A.toggle}),l.jsx(Zs,{text:e.rawRequestBody,label:"Copy",copied:C.copied,onCopy:C.copy})]}),e.rawRequestBody===null?l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"}):A.parsedData!==null?l.jsx(Jn,{data:A.parsedData,bulkDepth:A.bulkDepth,bulkRevision:A.bulkRevision}):l.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:e.rawRequestBody})]})}),l.jsx(nt,{value:"request",children:f==="request"&&l.jsxs("div",{className:"px-4 py-3",children:[l.jsxs("div",{className:"flex justify-end gap-2 mb-2",children:[g4(m,t,n,e.rawRequestBody!==null)&&l.jsx(Jc,{active:h,onClick:R=>{R.stopPropagation(),p(!h)}}),o!==void 0&&l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsxs(Xe,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:R=>{R.stopPropagation(),o(e)},children:[l.jsx(ad,{className:"size-3 mr-1"}),"Diff with Previous"]})}),l.jsx(Fe,{children:"Compare this request with the immediately preceding one"})]}),l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsxs(Xe,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:R=>{R.stopPropagation(),c(!0)},children:[l.jsx(cd,{className:"size-3 mr-1"}),"Replay"]})}),l.jsx(Fe,{children:"Re-send this request to the provider"})]}),l.jsx(Rc,{policy:T.policy,isExpanded:T.isExpanded,isPending:T.isPending,onToggle:T.toggle}),l.jsx(Zs,{text:S,label:"Copy",copied:j.copied,onCopy:j.copy})]}),h?l.jsx(x4,{rawBody:e.rawRequestBody,displayedBody:S,emptyLabel:"No transformation applied — raw and sent request bodies are identical."}):S===null?l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"}):T.parsedData!==null?l.jsx(Jn,{data:T.parsedData,bulkDepth:T.bulkDepth,bulkRevision:T.bulkRevision}):l.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words",children:S})]})}),t==="full"&&l.jsx(nt,{value:"headers",children:f==="headers"&&l.jsxs("div",{className:"px-4 py-3",children:[l.jsx("div",{className:"flex justify-end gap-2 mb-2",children:m4(t,e.rawHeaders!==void 0&&Object.keys(e.rawHeaders).length>0)&&l.jsx(Jc,{active:u,onClick:R=>{R.stopPropagation(),d(!u)}})}),u?l.jsx(y4,{rawHeaders:e.rawHeaders,headers:e.headers,emptyLabel:"No transformation applied — raw and processed headers are identical."}):e.headers&&Object.keys(e.headers).length>0?l.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.headers).sort(([R],[M])=>R.localeCompare(M)).map(([R,M])=>l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[R,":"]}),l.jsx("span",{className:"text-muted-foreground truncate",title:M,children:M})]},R))}):l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No headers captured"})]})}),t==="full"&&l.jsx(nt,{value:"raw-headers",children:f==="raw-headers"&&l.jsx("div",{className:"px-4 py-3",children:e.rawHeaders&&Object.keys(e.rawHeaders).length>0?l.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.rawHeaders).sort(([R],[M])=>R.localeCompare(M)).map(([R,M])=>l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[R,":"]}),l.jsx("span",{className:"text-muted-foreground truncate",title:M,children:M})]},R))}):l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No raw headers captured"})})}),l.jsx(nt,{value:"raw",children:f==="raw"&&l.jsxs("div",{className:"px-4 py-3 space-y-3",children:[e.error!==void 0&&e.error!==null&&l.jsxs("div",{className:"rounded border border-destructive/50 bg-destructive/10 p-3 text-xs",children:[l.jsx("div",{className:"font-semibold text-destructive mb-1",children:"SSE Error"}),l.jsx("div",{className:"text-muted-foreground font-mono",children:e.error})]}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Zs,{text:e.responseText,label:"Copy",copied:N.copied,onCopy:N.copy})}),e.responseText!==null?l.jsx(br,{text:e.responseText,defaultExpandDepth:0}):l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No response"}),e.streaming===!0&&l.jsx(p4,{logId:e.id,truncated:e.streamingChunksPath!==null})]})}),l.jsx(nt,{value:"parsed",children:f==="parsed"&&l.jsx("div",{className:"px-4 py-3",children:l.jsx(lo,{responseText:e.responseText,responseStatus:e.responseStatus,streaming:e.streaming,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens,cacheReadInputTokens:e.cacheReadInputTokens,apiFormat:m,error:e.error})})})]})})]}),l.jsx(h4,{log:e,open:a,onOpenChange:c})]})});function b4({stopReason:e,isPending:t,isFirst:n,isTurnStart:r,crabIndex:o=0,collapsible:s=!1,onToggle:i}){const a=e==="end_turn"||e==="stop",c=t&&!a,u=v.useMemo(()=>mi(o),[o]),d=s&&i?{role:"button",tabIndex:0,className:"cursor-pointer",onClick:h=>{h.stopPropagation(),i()},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),i())}}:{};return l.jsxs("div",{className:"flex flex-col items-center w-6 shrink-0 pt-0.5 pb-0.5",children:[l.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]",children:!n&&l.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),a?l.jsx("span",{title:e==="end_turn"?"End of Turn (Anthropic)":"End of Turn (OpenAI)",...d,children:l.jsx(u,{className:he("size-3.5 text-amber-400","animate-crab-settle","drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})}):r?l.jsx("span",{title:"Start of turn",...d,children:l.jsx(u,{className:he("size-3.5 text-emerald-400","animate-crab-appear","drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}):c?l.jsx("span",{title:"Processing…",children:l.jsx(u,{className:he("size-3.5 text-amber-300/80","animate-crab-crawl")})}):l.jsx("span",{children:l.jsx(u,{className:"size-3.5 text-muted-foreground/40"})}),l.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:!a&&l.jsx("div",{className:he("w-0.5 h-full",t?"border-dashed bg-transparent border-l-2 border-muted-foreground/20":"bg-muted-foreground/30")})})]})}function w4(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const k4=v.memo(function({entries:t,viewMode:n,strip:r,cacheTrends:o,onCompareWithPrevious:s,comparisonPredecessors:i,turnIndex:a=0}){const c=t.length-1,u=t[c]?.stopReason??null,d=u!==null?Gh(u):!1,h=t[c]?.log.responseStatus===null,p=d&&!h,[f,g]=v.useState(!1),m=v.useRef(d);v.useEffect(()=>{d&&!m.current&&g(!0),m.current=d},[d]);const x=v.useCallback(()=>{p&&g(A=>!A)},[p]),y=v.useMemo(()=>{let A=0,R=0,M=0,E=!1,L=!1;for(const w of t)w.log.inputTokens!==null&&(A+=w.log.inputTokens,E=!0),w.log.outputTokens!==null&&(R+=w.log.outputTokens,E=!0),w.log.elapsedMs!==null&&(M+=w.log.elapsedMs,L=!0);return{totalInput:A,totalOutput:R,hasTokens:E,totalElapsed:M,hasElapsed:L}},[t,c]),b=v.useMemo(()=>{const A=new Set;for(const R of t){const M=Qh(R.log.model);M!=="unknown"&&A.add(M)}return[...A]},[t]),k=v.useMemo(()=>mi(t[0]?.log.id??0),[t]),S=v.useMemo(()=>mi(t[c]?.log.id??0),[t,c]),j=a%2===0?"bg-muted/10":"bg-muted/25",[C,N]=v.useState(0),T=v.useRef(null);return v.useEffect(()=>{const A=T.current;if(!A)return;let R=0;const M=new ResizeObserver(()=>{window.cancelAnimationFrame(R),R=window.requestAnimationFrame(()=>N(E=>E+1))});return M.observe(A),()=>{M.disconnect(),window.cancelAnimationFrame(R)}},[]),l.jsx("div",{ref:T,className:he("border rounded-lg",h?"border-amber-500/10":"border-transparent"),children:f?l.jsxs("div",{className:"flex items-stretch",children:[l.jsxs("div",{className:"w-6 shrink-0 flex flex-col items-center pt-0.5 pb-0.5",children:[l.jsx("div",{className:"flex justify-center h-[calc(0.75rem-8px)]"}),l.jsx("span",{role:"button",tabIndex:0,title:"Start of turn — click to expand",className:"cursor-pointer",onClick:A=>{A.stopPropagation(),x()},onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),x())},children:l.jsx(k,{className:he("size-3.5 text-emerald-400","animate-crab-appear","drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}),l.jsx("div",{className:"flex-1 flex justify-center min-h-0",children:l.jsx("div",{className:"w-0.5 bg-muted-foreground/30 h-full"})}),l.jsx("span",{role:"button",tabIndex:0,title:"End of Turn — click to expand",className:"cursor-pointer",onClick:A=>{A.stopPropagation(),x()},onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),x())},children:l.jsx(S,{className:he("size-3.5 text-amber-400","animate-crab-settle","drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})})]}),l.jsxs("div",{className:he("flex-1 min-w-0 mb-0.5 rounded-lg border border-border py-1 px-3 flex items-center gap-3 text-xs cursor-pointer",j),onClick:x,role:"button",tabIndex:0,onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),x())},children:[l.jsxs("span",{className:"text-blue-400/80 font-mono font-semibold tabular-nums shrink-0",children:["#",t[0]?.log.id??"?"," ~ #",t[c]?.log.id??"?"]}),l.jsxs("span",{className:"text-muted-foreground shrink-0",children:[t.length," request",t.length>1?"s":""]}),b.length>0&&l.jsx("span",{className:"flex items-center gap-0.5 shrink-0",children:b.map(A=>l.jsx(ep,{provider:A,className:"size-4"},A))}),y.hasElapsed&&l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground shrink-0",children:[l.jsx(zr,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:w4(y.totalElapsed)})]}),y.hasTokens&&l.jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[l.jsx(Yn,{className:"size-3 text-muted-foreground"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[l.jsxs("span",{className:"text-blue-400",children:["IN ",qe(y.totalInput)]})," / ",l.jsxs("span",{className:"text-amber-400",children:["OUT ",qe(y.totalOutput)]})]})]}),l.jsx("span",{className:"flex-1 min-w-0"}),l.jsx(bt,{className:"size-4 text-muted-foreground shrink-0"})]})]}):t.map((A,R)=>{const{log:M,stopReason:E}=A,L=R===0;return l.jsxs("div",{className:"flex items-stretch",children:[l.jsx(b4,{stopReason:E,isPending:M.responseStatus===null,isFirst:R===0,isTurnStart:L,crabIndex:M.id%12,collapsible:p&&t.length>1&&L,onToggle:x}),l.jsx("div",{className:he("flex-1 min-w-0 mb-0.5 rounded-lg",j),children:l.jsx(v4,{log:M,viewMode:n,strip:r,cacheTrend:o?.get(M.id)??null,onCompareWithPrevious:i.has(M.id)?s:void 0})})]},M.id)})})});function _4(e,t){return e||t}function S4(e){const t=[];let n=[],r=0;for(const o of e){n.push({log:o,stopReason:HS(o)});const s=n[n.length-1];s!==void 0&&Gh(s.stopReason)&&(t.push({entries:n,turnIndex:r}),n=[],r+=1)}return n.length>0&&t.push({entries:n,turnIndex:r}),t}function C4(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=Tr(o),a=Tr(s);i==="unknown"||i!==a||t.set(o.id,s)}return t}function j4(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 E4=v.memo(function({group:e,viewMode:t="simple",strip:n,cacheTrends:r,onCompareWithPrevious:o,comparisonPredecessors:s,onClearGroup:i,standalone:a=!1}){const[c,u]=v.useState(!1),d=v.useMemo(()=>j4(e.logs),[e.logs]),h=e.logs[0]?.timestamp??new Date().toISOString(),p=e.logs[e.logs.length-1]?.timestamp??new Date().toISOString(),f=ZS(e.logs),g=e.logs.some(y=>y.responseStatus===null),m=v.useMemo(()=>S4(e.logs),[e.logs]),x=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 l.jsxs("div",{className:"mb-2",children:[!a&&l.jsx(BS,{conversationId:x,startTime:h,endTime:p,totalCalls:e.logs.length,totalInputTokens:d.totalInputTokens,totalOutputTokens:d.totalOutputTokens,apiFormat:US(e.logs),expanded:c,onToggle:()=>u(!c),hideApiFormat:f,isLoading:g,userAgent:e.logs[0]?.userAgent??null,onClear:()=>i(e.logs.map(y=>y.id))}),_4(a,c)&&l.jsx("div",{className:"max-h-[70vh] overflow-y-auto",children:m.map(y=>l.jsx(k4,{entries:y.entries,viewMode:t,strip:n,cacheTrends:r,onCompareWithPrevious:o,comparisonPredecessors:s,turnIndex:y.turnIndex},y.turnIndex))})]})});function N4({className:e}){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:he("inline-block size-5",e),children:[l.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"}),l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"}),l.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),l.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),l.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),l.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),l.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]})}function Gc({...e}){return l.jsx(W_,{"data-slot":"select",...e})}function Yc({...e}){return l.jsx(K_,{"data-slot":"select-value",...e})}function Xc({className:e,size:t="default",children:n,...r}){return l.jsxs(q_,{"data-slot":"select-trigger","data-size":t,className:he("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,l.jsx(J_,{asChild:!0,children:l.jsx(vt,{className:"size-4 opacity-50"})})]})}function Qc({className:e,children:t,position:n="popper",align:r="center",...o}){return l.jsx(G_,{children:l.jsxs(Y_,{"data-slot":"select-content",className:he("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:[l.jsx(T4,{}),l.jsx(X_,{className:he("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),l.jsx(A4,{})]})})}function to({className:e,children:t,...n}){return l.jsxs(Q_,{"data-slot":"select-item",className:he("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:[l.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:l.jsx(tS,{children:l.jsx(Jt,{className:"size-4"})})}),l.jsx(eS,{children:t})]})}function T4({className:e,...t}){return l.jsx(nS,{"data-slot":"select-scroll-up-button",className:he("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Dy,{className:"size-4"})})}function A4({className:e,...t}){return l.jsx(rS,{"data-slot":"select-scroll-down-button",className:he("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(vt,{className:"size-4"})})}function I4(){return l.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[l.jsx("title",{children:"Claude Code"}),l.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 z4(){return l.jsxs("svg",{fill:"currentColor",fillRule:"evenodd",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[l.jsx("title",{children:"OpenCode"}),l.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})]})}function P4(){return l.jsxs("svg",{fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"size-6 shrink-0",children:[l.jsx("title",{children:"MiMo Code"}),l.jsx("text",{x:"12",y:"18",textAnchor:"middle",fontSize:"16",fontWeight:"800",fontFamily:"system-ui, sans-serif",children:"M"})]})}const R4=ae({name:K(),apiKey:K(),format:lt(["anthropic","openai"]),anthropicBaseUrl:K(),openaiBaseUrl:K(),models:Re(K()),sourceTool:lt(["claude-code","opencode","mimo-code"]),alreadyExists:Qe()}),O4=ae({providers:Re(R4),warnings:Re(K()).optional()}),D4=ae({success:Qe().optional(),imported:ve().optional(),message:K().optional(),errors:Re(K()).optional()}),M4={"claude-code":I4,opencode:z4,"mimo-code":P4};function L4({open:e,onOpenChange:t,onImportComplete:n}){const[r,o]=v.useState(!1),[s,i]=v.useState(null),[a,c]=v.useState([]),[u,d]=v.useState([]),[h,p]=v.useState(new Set),[f,g]=v.useState(!1),[m,x]=v.useState(null),[y,b]=v.useState(null),k=v.useCallback(()=>{o(!0),i(null),d([]),c([]),p(new Set),x(null),b(null),fetch("/api/providers/scan").then(N=>N.ok?N.json().then(T=>{const A=O4.safeParse(T);if(!A.success){i(`Invalid response: ${A.error.message}`);return}c(A.data.providers),d(A.data.warnings??[]);const R=new Set;A.data.providers.forEach((M,E)=>{M.alreadyExists||R.add(E)}),p(R)}):N.text().then(T=>{i(`Scan failed (${N.status}): ${T}`)})).catch(N=>{i(N instanceof Error?N.message:String(N))}).finally(()=>{o(!1)})},[]);v.useEffect(()=>{e&&k()},[e,k]);const S=v.useCallback(N=>{p(T=>{const A=new Set(T);return A.has(N)?A.delete(N):A.add(N),A})},[]),j=v.useCallback(()=>{const N=a.filter((R,M)=>h.has(M));if(N.length===0)return;g(!0),b(null),x(null);const T=new Date().toISOString(),A=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:T,updatedAt:T}));fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providers:A})}).then(R=>R.json()).then(R=>{const M=D4.safeParse(R);if(!M.success){b(`Invalid response: ${M.error.message}`);return}const E=M.data;c(L=>L.map((w,D)=>h.has(D)?{...w,alreadyExists:!0}:w)),p(new Set),E.errors!==void 0&&E.errors.length>0&&E.message!==void 0?x(E.message):x(`Imported ${E.imported??N.length} provider(s)`),n()}).catch(R=>{b(R instanceof Error?R.message:String(R))}).finally(()=>{g(!1)})},[a,h,n]),C=a.some(N=>!N.alreadyExists);return l.jsx(os,{open:e,onOpenChange:t,children:l.jsxs(ss,{className:"max-w-xl max-h-[80vh] overflow-hidden flex flex-col",children:[l.jsxs(is,{children:[l.jsx(as,{children:"Import from External Tools"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Detect provider configurations from Claude Code, OpenCode, and MiMo Code."})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto space-y-3",children:[r&&l.jsxs("div",{className:"flex items-center justify-center py-8 gap-2 text-muted-foreground",children:[l.jsx(Sr,{className:"size-4 animate-spin"}),l.jsx("span",{className:"text-sm",children:"Scanning for external providers..."})]}),s!==null&&l.jsxs("div",{className:"flex items-center gap-2 text-destructive text-sm py-4",children:[l.jsx(_r,{className:"size-4"}),s]}),!r&&s===null&&a.length===0&&l.jsxs("p",{className:"text-sm text-muted-foreground py-8 text-center",children:["No external provider configurations found.",l.jsx("br",{}),l.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&&a.map((N,T)=>l.jsxs("label",{className:`flex items-start gap-3 p-3 border rounded-md ${N.alreadyExists?"":"cursor-pointer hover:bg-muted/50"}`,children:[!N.alreadyExists&&l.jsx("input",{type:"checkbox",checked:h.has(T),disabled:f,onChange:()=>S(T),className:"mt-0.5 size-4"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[(()=>{const A=M4[N.sourceTool];return A===void 0?null:l.jsx(A,{})})(),N.alreadyExists&&l.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Already added"})]}),l.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`:""]}),l.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:N.format==="anthropic"?N.anthropicBaseUrl:N.openaiBaseUrl}),l.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&&l.jsx("div",{className:"text-xs text-muted-foreground space-y-1 border-t pt-2",children:u.map((N,T)=>l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(_r,{className:"size-3"}),N]},T))}),m!==null&&l.jsx("div",{className:"text-sm text-green-500 border-t pt-2",children:m}),y!==null&&l.jsx("div",{className:"text-sm text-destructive border-t pt-2",children:y})]}),l.jsxs("div",{className:"flex items-center justify-between pt-3 border-t",children:[l.jsxs(Xe,{variant:"outline",size:"sm",onClick:k,disabled:r,children:[l.jsx(Sr,{className:`size-3 mr-1 ${r?"animate-spin":""}`}),"Rescan"]}),l.jsxs(Xe,{size:"sm",onClick:j,disabled:!C||h.size===0||f,children:[l.jsx(Vi,{className:"size-3 mr-1"}),f?"Importing...":`Import Selected (${h.size})`]})]})]})})}function Kp(e){return e.length<=8?"••••••••":e.slice(0,4)+"••••••••"+e.slice(-4)}const F4={deepseek:"https://api-docs.deepseek.com/zh-cn/"};function $4(e){return Object.prototype.hasOwnProperty.call(e,"success")}function B4(e){return Object.prototype.hasOwnProperty.call(e,"notConfigured")}function U4(e){const t={className:"size-3",strokeWidth:2};switch(e){case"timeout":return l.jsx(zr,{...t});case"network_unreachable":return l.jsx(Dv,{...t});case"connection_refused":return l.jsx(Lv,{...t});case"auth_failed":return l.jsx(dv,{...t});case"rate_limited":return l.jsx(sv,{...t});case"server_error":return l.jsx(Sv,{...t});case"invalid_response":return l.jsx(Vy,{...t});case"unknown":return l.jsx(_r,{...t});default:return l.jsx(_r,{...t})}}function no({result:e}){const[t,n]=v.useState(!1);if(!$4(e))return B4(e)?l.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[l.jsx(qi,{className:"size-3"}),l.jsx("span",{children:"Not configured"})]}):l.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[l.jsx(ud,{className:"size-3 animate-spin"}),l.jsx("span",{children:"Testing..."})]});if(e.success){const c=[];e.inputTokens!==void 0&&c.push(l.jsxs("span",{children:[e.inputTokens," in"]},"in")),e.outputTokens!==void 0&&c.push(l.jsxs("span",{children:[e.outputTokens," out"]},"out")),e.cacheCreationInputTokens!==void 0&&e.cacheCreationInputTokens>0&&c.push(l.jsx(Ge,{children:l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["+",e.cacheCreationInputTokens," cache"]})}),l.jsx(Fe,{children:"Tokens cached for reuse, reducing future API cost"})]})},"cache-create")),e.cacheReadInputTokens!==void 0&&e.cacheReadInputTokens>0&&c.push(l.jsx(Ge,{children:l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["~",e.cacheReadInputTokens," cached"]})}),l.jsx(Fe,{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 l.jsx(Ge,{children:l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 shrink-0",children:[l.jsx(Uy,{className:"size-3"}),l.jsx("span",{children:"Connected"}),c.length>0&&l.jsxs("span",{className:"text-muted-foreground",children:["(",u,")"]})]})}),l.jsx(Fe,{children:"Connection test passed"})]})})}const r=e.error,o=r?.message??"Connection failed",s=r?.hint,i=r?.details,a=r?.type??"unknown";return l.jsxs("div",{className:"flex flex-col gap-1 shrink-0",children:[l.jsxs("div",{className:"flex items-center gap-1 text-xs text-red-600 max-w-[200px]",children:[U4(a),l.jsx(Ge,{children:l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsx("span",{className:"truncate",children:o})}),l.jsx(Fe,{children:"Connection test failed"})]})}),i!==void 0&&l.jsx(Ge,{children:l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>n(!t),className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors",children:t?l.jsx(Hi,{className:"size-3"}):l.jsx(Wi,{className:"size-3"})})}),l.jsx(Fe,{children:t?"Hide error details":"Show detailed error information"})]})})]}),t&&i!==void 0&&l.jsxs("div",{className:"text-xs text-muted-foreground bg-muted/50 rounded p-2 max-w-[300px]",children:[s!==void 0&&l.jsx("div",{className:"mb-1",children:s}),l.jsx("div",{className:"font-mono whitespace-pre-wrap break-all text-red-400/80",children:i})]})]})}function Z4(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 V4({provider:e,testResults:t,isTesting:n,testingTimeLeft:r,isHighlighted:o,onEdit:s,onDelete:i,onTest:a}){const[c,u]=v.useState(!1),[d,h]=v.useState(!1),[p,f]=v.useState(!1),g=v.useRef(null),m=v.useRef(void 0);t?.testedAt!==void 0&&t.testedAt!==m.current&&(m.current=t.testedAt,g.current=null);const x=v.useCallback(()=>{f(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(()=>{}),h(!0),setTimeout(()=>h(!1),2e3)}const b=e.apiDocsUrl??Object.entries(F4).find(([k])=>e.name.toLowerCase().includes(k))?.[1];return l.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:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[l.jsx("span",{className:"font-medium truncate",children:e.name}),e.source==="company"&&l.jsx(Ge,{children:l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.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:"公司"})}),l.jsx(Fe,{children:"Company-provided API key"})]})}),e.source==="personal"&&l.jsx(Ge,{children:l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.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:"个人"})}),l.jsx(Fe,{children:"Your personal API key"})]})})]}),b!==void 0&&l.jsxs("a",{href:b,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1 text-xs",title:"View API documentation",children:[l.jsx(Qy,{className:"size-3"}),l.jsx("span",{className:"sr-only",children:"Docs"})]})]}),e.models!==void 0&&e.models.length>0&&l.jsx("div",{className:"flex flex-wrap gap-1",children:e.models.map(k=>l.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:k},k))}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("code",{className:"text-xs text-muted-foreground bg-muted px-2 py-1 rounded flex-1 truncate",children:c?e.apiKey:Kp(e.apiKey)}),l.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?l.jsx(Hi,{className:"size-4"}):l.jsx(Wi,{className:"size-4"})}),l.jsx("button",{type:"button",onClick:y,className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":"Copy API key",children:d?l.jsx(Jt,{className:"size-4 text-green-500"}):l.jsx(bn,{className:"size-4"})})]}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"text-xs text-muted-foreground min-w-0 flex-1",children:[l.jsx("span",{className:"font-medium",children:"Anthropic:"})," ",l.jsx("span",{className:"truncate",children:e.anthropicBaseUrl})]}),t&&l.jsx(no,{result:t.anthropic.nonStreaming})]}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"text-xs text-muted-foreground min-w-0 flex-1",children:[l.jsx("span",{className:"font-medium",children:"OpenAI:"})," ",l.jsx("span",{className:"truncate",children:e.openaiBaseUrl})]}),t&&l.jsx(no,{result:t.openai.nonStreaming})]}),t?.testedAt!==void 0&&l.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[l.jsx(zr,{className:"size-3"}),l.jsxs("span",{children:["Tested ",Z4(t.testedAt)]})]}),t?.models!==void 0&&Object.keys(t.models).length>0&&l.jsxs("div",{className:"border-t pt-2",children:[l.jsxs("button",{type:"button",onClick:x,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",children:[l.jsx("span",{className:"font-mono",children:p?"▾":"▸"}),"Model Test Results (",Object.keys(t.models).length,")"]}),p&&l.jsx("div",{className:"mt-2 overflow-x-auto",children:l.jsxs("table",{className:"w-full text-xs border-collapse",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-border",children:[l.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Model"}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&l.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Anthropic"}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&l.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"OpenAI"})]})}),l.jsx("tbody",{children:Object.entries(t.models).map(([k,S])=>l.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[l.jsx("td",{className:"py-1 px-2 font-medium",children:k}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&l.jsx("td",{className:"py-1 px-2",children:l.jsx(no,{result:S.anthropic.nonStreaming})}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&l.jsx("td",{className:"py-1 px-2",children:l.jsx(no,{result:S.openai.nonStreaming})})]},k))})]})})]}),l.jsxs("div",{className:"flex gap-2 pt-1 border-t",children:[a!==void 0&&l.jsxs(Xe,{variant:"outline",size:"sm",onClick:()=>a(e.id),className:"text-xs h-7 gap-1",disabled:n??!1,children:[l.jsx(ud,{className:`size-3 ${n??!1?"animate-spin":""}`}),n??!1?r!==void 0?`Testing (${r}s)`:"Testing...":"Test"]}),l.jsxs(Xe,{variant:"outline",size:"sm",onClick:()=>s(e),className:"text-xs h-7 gap-1",disabled:n??!1,children:[l.jsx(Ki,{className:"size-3"}),"Edit"]}),l.jsxs(Xe,{variant:"outline",size:"sm",onClick:()=>i(e.id),className:"text-xs h-7 gap-1 text-destructive hover:text-destructive",disabled:n??!1,children:[l.jsx(hd,{className:"size-3"}),"Delete"]})]})]})}const H4={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"}},eu=["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"],tu=["glm-5","glm-5.1","qwen3.6-plus","qwen3.7-max"];function W4({provider:e,onSubmit:t,onCancel:n}){const[r,o]=v.useState(e?.name??""),[s,i]=v.useState(e?.apiKey??""),[a,c]=v.useState(!1),[u,d]=v.useState(!1),h=e?.models,[p,f]=v.useState(h!==void 0&&h.length>0?h:[""]),[g,m]=v.useState("anthropic"),[x,y]=v.useState(e?.anthropicBaseUrl??""),[b,k]=v.useState(e?.openaiBaseUrl??""),[S,j]=v.useState(e?.apiDocsUrl??""),[C,N]=v.useState(e?.source),[T,A]=v.useState({}),[R,M]=v.useState(!1),[E,L]=v.useState(null),w=v.useRef([]);v.useEffect(()=>{if(E===null)return;const X=E;function de(te){if(!(te.target instanceof Node))return;const ce=w.current[X];ce!=null&&!ce.contains(te.target)&&L(null)}return document.addEventListener("mousedown",de),()=>document.removeEventListener("mousedown",de)},[E]);const[D,W]=v.useState(!1),[B,q]=v.useState(!1),Y=r.toLowerCase().includes("minimax"),I=r.toLowerCase().includes("alibaba");function H(){navigator.clipboard.writeText(s).catch(()=>{}),d(!0),setTimeout(()=>d(!1),2e3)}v.useEffect(()=>{e&&(o(e.name),i(e.apiKey),f((e.models?.length??0)>0?e.models:[""]),y(e.anthropicBaseUrl??""),k(e.openaiBaseUrl??""),j(e.apiDocsUrl??""),N(e.source),W(!1),q(!1))},[e]),v.useEffect(()=>{const X=r.toLowerCase();for(const[de,te]of Object.entries(H4))if(X.includes(de)){te.format==="anthropic"&&!D?y(te.baseUrl):te.format==="openai"&&!B&&k(te.baseUrl),te.apiDocsUrl!==void 0&&!S&&j(te.apiDocsUrl),de==="minimax"&&p.length===1&&p[0]===""&&f([eu[0]??""]),de==="alibaba"&&p.length===1&&p[0]===""&&f([tu[0]??""]);break}},[r]);function V(){const X={};return r.trim()||(X.name="Name is required"),s.trim()||(X.apiKey="API key is required"),(p.length===0||p.every(de=>!de.trim()))&&(X.models="At least one model is required"),x.trim()&&!z(x.trim())&&(X.anthropicBaseUrl="Invalid URL format"),b.trim()&&!z(b.trim())&&(X.openaiBaseUrl="Invalid URL format"),!x.trim()&&!b.trim()&&(X.format="At least one format URL (Anthropic or OpenAI) is required"),A(X),Object.keys(X).length===0}function z(X){try{return new URL(X),!0}catch{return!1}}function oe(X){if(X.preventDefault(),!!V()){M(!0);try{t({name:r.trim(),apiKey:s.trim(),models:p.map(de=>de.trim()).filter(de=>de!==""),anthropicBaseUrl:x.trim()||void 0,openaiBaseUrl:b.trim()||void 0,apiDocsUrl:S.trim()||void 0,source:C})}finally{M(!1)}}}return l.jsxs("form",{onSubmit:oe,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{htmlFor:"provider-name",className:"text-sm font-medium",children:["Name ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsx("input",{id:"provider-name",type:"text",value:r,onChange:X=>o(X.target.value),placeholder:"Provider Name",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),T.name!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:T.name})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"provider-source",className:"text-sm font-medium",children:"Token Source"}),l.jsxs("select",{id:"provider-source",value:C??"",onChange:X=>N(X.target.value==="company"||X.target.value==="personal"?X.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:[l.jsx("option",{value:"",children:"—"}),l.jsx("option",{value:"personal",children:"个人 (Personal)"}),l.jsx("option",{value:"company",children:"公司 (Company)"})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Label whether this API key is company-provided or personal."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{htmlFor:"provider-apikey",className:"text-sm font-medium",children:["API Key ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("input",{id:"provider-apikey",type:"text",value:a||s.length===0?s:Kp(s),onChange:X=>i(X.target.value),onFocus:()=>{!a&&s.length>0&&c(!0)},placeholder:"sk-ant-...",readOnly:!a&&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"}),l.jsx("button",{type:"button",onClick:()=>c(X=>!X),className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":a?"Hide API key":"Show API key",children:a?l.jsx(Hi,{className:"size-4"}):l.jsx(Wi,{className:"size-4"})}),l.jsx("button",{type:"button",onClick:H,className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":"Copy API key",children:u?l.jsx(Jt,{className:"size-4 text-green-500"}):l.jsx(bn,{className:"size-4"})})]}),T.apiKey!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:T.apiKey})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{className:"text-sm font-medium",children:["Models ",l.jsx("span",{className:"text-destructive",children:"*"})]}),p.map((X,de)=>l.jsxs("div",{ref:te=>{w.current[de]=te},className:"flex items-center gap-2",children:[l.jsxs("div",{className:"relative flex-1",children:[l.jsx("input",{type:"text",value:X,onChange:te=>{f(ce=>{const fe=[...ce];return fe[de]=te.target.value,fe})},placeholder:Y||I?"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"}),(Y||I)&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",onClick:()=>L(E===de?null:de),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:l.jsx(vt,{className:"size-4"})}),E===de&&l.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:(Y?eu:tu).map(te=>l.jsx("button",{type:"button",onClick:()=>{f(ce=>{const fe=[...ce];return fe[de]=te,fe}),L(null)},className:"w-full text-left px-3 py-2 text-sm hover:bg-muted transition-colors",children:te},te))})]})]}),p.length>1&&l.jsx("button",{type:"button",onClick:()=>f(te=>te.filter((ce,fe)=>fe!==de)),className:"text-muted-foreground hover:text-destructive transition-colors p-1 shrink-0","aria-label":"Remove model",children:l.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:[l.jsx("path",{d:"M3 6h18"}),l.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),l.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]})})]},de)),l.jsx("button",{type:"button",onClick:()=>f(X=>[...X,""]),className:"text-xs text-primary hover:underline flex items-center gap-1",children:"+ Add Model"}),T.models!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:T.models})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex gap-1 border-b border-border",children:[l.jsx(Ge,{children:l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>m("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"})}),l.jsx(Fe,{children:"Anthropic Messages API protocol"})]})}),l.jsx(Ge,{children:l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>m("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"})}),l.jsx(Fe,{children:"OpenAI Chat Completions API protocol"})]})})]}),T.format!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:T.format})]}),g==="anthropic"&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"provider-anthropic-base-url",className:"text-sm font-medium",children:"Anthropic Base URL"}),l.jsx("input",{id:"provider-anthropic-base-url",type:"text",value:x,onChange:X=>{W(!0),y(X.target.value)},placeholder:"https://api.anthropic.com",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),T.anthropicBaseUrl!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:T.anthropicBaseUrl}),l.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"&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"provider-openai-base-url",className:"text-sm font-medium",children:"OpenAI Base URL"}),l.jsx("input",{id:"provider-openai-base-url",type:"text",value:b,onChange:X=>{q(!0),k(X.target.value)},placeholder:"https://api.openai.com/v1",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),T.openaiBaseUrl!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:T.openaiBaseUrl}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"OpenAI-compatible endpoint URL. Leave empty if this provider does not support OpenAI format."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"provider-api-docs-url",className:"text-sm font-medium",children:"API Docs URL"}),l.jsx("input",{id:"provider-api-docs-url",type:"text",value:S,onChange:X=>j(X.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"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional API documentation URL. If not set, uses known provider docs."})]}),l.jsxs("div",{className:"sticky bottom-0 bg-card border-t flex gap-2 justify-end pt-2 pb-2",children:[l.jsx(Xe,{type:"button",variant:"outline",onClick:n,disabled:R,children:"Cancel"}),l.jsx(Xe,{type:"submit",disabled:R,children:R?"Saving...":e?"Update Provider":"Add Provider"})]})]})}const Ti=ae({id:K(),name:K(),apiKey:K(),model:K().optional(),models:Re(K()).min(1),format:lt(["anthropic","openai"]).optional(),baseUrl:K().optional(),anthropicBaseUrl:K().optional(),openaiBaseUrl:K().optional(),authHeader:lt(["bearer","x-api-key"]).optional().default("bearer"),apiDocsUrl:K().optional(),source:lt(["company","personal"]).optional(),createdAt:K(),updatedAt:K()}),q4=lt(["timeout","network_unreachable","connection_refused","auth_failed","rate_limited","server_error","invalid_response","unknown"]),K4=ae({message:K(),type:q4,details:K().optional(),hint:K().optional()}),J4=ae({type:lt(["text","thinking"]),text:K().optional(),thinking:K().optional()}),G4=ae({success:Qe(),error:K4.optional(),model:K().optional(),inputTokens:ve().optional(),outputTokens:ve().optional(),cacheCreationInputTokens:ve().optional(),cacheReadInputTokens:ve().optional(),latencyMs:ve().optional(),content:Re(J4).optional(),rawResponse:K().optional(),streaming:Qe().optional(),streamingChunks:ae({chunks:Re(td),truncated:Qe().default(!1)}).optional(),requestHeaders:Ht(K(),K()).optional()}),nu=Kt([G4,ae({notConfigured:Se(!0)}),ae({testing:Se(!0)})]),zo=ae({nonStreaming:nu,streaming:nu}),Y4=ae({anthropic:zo,openai:zo}),X4=ae({anthropic:zo,openai:zo,models:Ht(K(),Y4).optional(),testedAt:K().optional()});function Q4(){return{anthropic:{nonStreaming:{testing:!0},streaming:{testing:!0}},openai:{nonStreaming:{testing:!0},streaming:{testing:!0}}}}function ru(e,t){const n=()=>({nonStreaming:{success:!1,error:{message:e,type:t}},streaming:{notConfigured:!0}});return{anthropic:n(),openai:n()}}const eT=ae({providerConfig:K()}),tT=ae({success:Qe().optional(),imported:ve().optional(),message:K().optional(),errors:Re(K()).optional()}),nT=30,Hs="Network error: could not reach the server. Is the proxy running?";function ou(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 rT({externalProviders:e,isLoading:t=!1,externalTestResults:n,externalTestingProviders:r,externalTestingTimeLeft:o,onProvidersMutate:s,onTestResultsChange:i,onTestingProvidersChange:a,onTestingTimeLeftChange:c}){const[u,d]=v.useState(!1),[h,p]=v.useState(),[f,g]=v.useState(null),[m,x]=v.useState({}),[y,b]=v.useState(new Set),[k,S]=v.useState({}),[j,C]=v.useState(null),[N,T]=v.useState(!1),[A,R]=v.useState(null),[M,E]=v.useState(!1),[L,w]=v.useState(!1),[D,W]=v.useState(null),[B,q]=v.useState("all"),Y=v.useRef(null),I=v.useRef(null),H=e??[],V=v.useMemo(()=>{const U=B==="all"?H:H.filter(G=>G.source===B);return B==="all"?[...U].sort((G,$)=>{const ne={personal:0,company:1};return(ne[G.source??""]??2)-(ne[$.source??""]??2)}):U},[H,B]),z=n??m,oe=r??y,X=o??k,de=c?(U,G)=>c(U,G):(U,G)=>{S(G===void 0?$=>{const ne={...$};return delete ne[U],ne}:$=>({...$,[U]:G}))};v.useEffect(()=>{(async()=>{try{const U=await fetch("/api/config/paths");if(U.ok){const G=await An(U,eT);C(G.providerConfig)}}catch{}})()},[]);const te=v.useCallback(U=>{I.current!==null&&clearTimeout(I.current),R(U),Y.current?.scrollTo({top:Y.current.scrollHeight,behavior:"smooth"}),I.current=setTimeout(()=>{R(null),I.current=null},2e3)},[]);v.useEffect(()=>()=>{I.current!==null&&clearTimeout(I.current)},[]);const ce=v.useCallback(()=>{s?.().catch(()=>{})},[s]),fe=v.useCallback((U,G)=>{i?i(U,G):x($=>({...$,[U]:G}))},[i]),ge=v.useCallback((U,G)=>{if(a){a(U,G);return}b($=>{const ne=new Set($);return G?ne.add(U):ne.delete(U),ne})},[a]),xe=v.useCallback(async U=>{fe(U,Q4()),ge(U,!0);const G=new AbortController;let $=nT;de(U,$);const ne=setInterval(()=>{$--,de(U,$),$<=0&&(clearInterval(ne),G.abort())},1e3);try{const le=await fetch(`/api/providers/${U}/test`,{method:"POST",signal:G.signal});if(le.ok){const se=await An(le,X4);fe(U,se)}else fe(U,ru(`HTTP ${le.status}: ${le.statusText}`,"server_error"))}catch(le){le instanceof Error&&le.name==="AbortError"&&fe(U,ru("Request timed out","timeout"))}finally{clearInterval(ne),de(U,void 0),ge(U,!1)}},[de,fe,ge]);function Ee(U){(async()=>{try{const G=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ou(U))});if(!G.ok){g(await ro(G,"Failed to add provider"));return}const $=await An(G,Ti);d(!1),te($.id),ce(),await xe($.id)}catch{g(Hs)}})()}function Oe(U){h&&(async()=>{try{const G=await fetch(`/api/providers/${h.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(ou(U))});if(!G.ok){g(await ro(G,"Failed to update provider"));return}const $=await An(G,Ti);p(void 0),te($.id),ce(),((U.apiKey??"")!==(h.apiKey??"")||JSON.stringify(U.models)!==JSON.stringify(h.models)||(U.anthropicBaseUrl??"")!==(h.anthropicBaseUrl??"")||(U.openaiBaseUrl??"")!==(h.openaiBaseUrl??""))&&await xe($.id)}catch{g(Hs)}})()}function _(U){W(U),w(!0)}function ee(){const U=D;U!==null&&(async()=>{let G;try{G=await fetch(`/api/providers/${U}`,{method:"DELETE"})}catch{g(Hs);return}if(!G.ok){g(await ro(G,"Failed to delete provider"));return}ce()})()}const J=v.useRef(null);function O(U){const G="/api/providers/export";(async()=>{try{const $=await fetch(G);if(!$.ok){g("Failed to export providers");return}const ne=await $.blob(),le=URL.createObjectURL(ne),se=document.createElement("a");se.href=le,se.download=$.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]??"providers.json",document.body.appendChild(se),se.click(),document.body.removeChild(se),URL.revokeObjectURL(le)}catch{g("Failed to export providers")}})()}function P(){J.current?.click()}function F(U){const G=U.target.files?.[0];G&&(async()=>{try{const $=await G.text(),ne=await fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)}),le=await An(ne,tT);ne.ok&&le.imported!==void 0&&le.imported>0?(ce(),g(null)):le.errors&&le.errors.length>0?g(le.errors.join("; ")):g(le.message??"Import failed")}catch{g("Failed to import providers")}U.target.value=""})()}return t?l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading providers..."})}):u||h?l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{className:"flex items-center justify-between sticky top-0 bg-background z-10 pb-2",children:l.jsx("h3",{className:"text-lg font-medium",children:h?"Edit Provider":"Add New Provider"})}),l.jsx(W4,{provider:h,onSubmit:h?Oe:Ee,onCancel:()=>{d(!1),p(void 0)}})]}):l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between sticky top-0 z-10 bg-background pb-2",children:[l.jsx("h3",{className:"text-lg font-medium",children:"Providers"}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Ge,{children:l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsxs(Xe,{variant:"outline",size:"sm",onClick:()=>O(),className:"gap-1 hover:bg-muted",children:[l.jsx(Vi,{className:"size-3"}),"Export"]})}),l.jsx(Fe,{children:"Download providers as JSON for backup or sharing"})]})}),l.jsx(Ge,{children:l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsxs(Xe,{variant:"outline",size:"sm",onClick:P,className:"gap-1 hover:bg-muted",children:[l.jsx(zv,{className:"size-3"}),"Import"]})}),l.jsx(Fe,{children:"Import providers from an exported JSON file"})]})}),l.jsx("input",{type:"file",ref:J,accept:".json",onChange:F,style:{display:"none"}}),l.jsx(Ge,{children:l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsxs(Xe,{variant:"outline",size:"sm",onClick:()=>E(!0),className:"gap-1",children:[l.jsx(kv,{className:"size-3"}),"Scan"]})}),l.jsx(Fe,{children:"Detect and import provider configs from Claude Code and OpenCode"})]})}),l.jsxs(Xe,{onClick:()=>d(!0),size:"sm",className:"gap-1",children:[l.jsx(po,{className:"size-4"}),"Add Provider"]})]})]}),j!==null&&l.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/30 rounded-md px-3 py-2",children:[l.jsx("span",{className:"shrink-0",children:"Config:"}),l.jsx("span",{className:"font-mono truncate",title:j,children:j}),l.jsx(Ge,{children:l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>{window.navigator.clipboard.writeText(j).then(()=>{T(!0),setTimeout(()=>T(!1),2e3)})},className:"shrink-0 ml-auto text-muted-foreground hover:text-foreground transition-colors",children:N?l.jsx(Jt,{className:"size-3 text-green-500"}):l.jsx(bn,{className:"size-3"})})}),l.jsx(Fe,{children:"Copy config file path to clipboard"})]})})]}),f!==null&&l.jsxs("div",{className:"flex items-center gap-2 text-sm text-destructive bg-destructive/10 rounded-md px-3 py-2",children:[l.jsx(_r,{className:"size-4 shrink-0"}),f]}),H.length===0?l.jsxs("div",{className:"text-center py-12 space-y-3",children:[l.jsx("p",{className:"text-sm text-muted-foreground",children:"No providers configured yet."}),l.jsxs(Xe,{onClick:()=>d(!0),variant:"outline",size:"sm",children:[l.jsx(po,{className:"size-4"}),"Add Your First Provider"]})]}):l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{className:"flex gap-1 border-b border-border",children:["all","personal","company"].map(U=>l.jsx(Ge,{children:l.jsxs(Me,{children:[l.jsx(Le,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>q(U),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${B===U?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:U==="all"?"All":U==="personal"?"Personal":"Company"})}),l.jsx(Fe,{children:U==="all"?"Show all providers":U==="personal"?"Providers you configured yourself":"Providers set by your organization"})]})},U))}),l.jsx("div",{ref:Y,className:"space-y-3",children:V.map(U=>l.jsx(V4,{provider:U,testResults:z[U.id],isTesting:oe.has(U.id),testingTimeLeft:X[U.id],isHighlighted:U.id===A,onEdit:G=>p(G),onDelete:_,onTest:G=>{xe(G)}},U.id))})]}),l.jsx(L4,{open:M,onOpenChange:E,onImportComplete:()=>{s!==void 0&&s()}}),l.jsx(Jh,{open:L,onOpenChange:w,title:"Delete Provider",description:"Are you sure you want to delete this provider? This action cannot be undone.",confirmLabel:"Delete",variant:"destructive",onConfirm:ee})]})}async function oT(e){return Ir(e,Ti.array(),void 0,t=>`Failed to fetch ${e}: ${t.status}`)}function sT(){const e=Pi("/api/providers",oT,{revalidateOnFocus:!1,revalidateIfStale:!1});return{providers:e.data??[],isLoading:e.isLoading,isError:e.error,mutate:e.mutate}}function iT(){const[e,t]=v.useState(!1),[n,r]=v.useState("providers"),{providers:o,isLoading:s,mutate:i}=sT(),[a,c]=v.useState({}),[u,d]=v.useState(new Set),[h,p]=v.useState({}),f=v.useCallback((x,y)=>{c(b=>({...b,[x]:y}))},[]),g=v.useCallback((x,y)=>{d(b=>{const k=new Set(b);return y?k.add(x):k.delete(x),k})},[]),m=v.useCallback((x,y)=>{p(b=>{if(y===void 0){const k={...b};return delete k[x],k}return{...b,[x]:y}})},[]);return l.jsxs(os,{open:e,onOpenChange:t,children:[l.jsx(DS,{asChild:!0,children:l.jsxs(Xe,{variant:"ghost",size:"icon",className:"size-8",children:[l.jsx(jv,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Settings"})]})}),l.jsxs(ss,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[l.jsx(is,{children:l.jsx(as,{children:"Settings"})}),l.jsxs(Pn,{value:n,onValueChange:r,className:"flex-1 overflow-hidden",children:[l.jsxs(Rn,{children:[l.jsx(tt,{value:"providers",children:"Providers"}),l.jsx(tt,{value:"proxy",children:"Proxy"})]}),l.jsxs("div",{className:"mt-4 overflow-y-auto flex-1 pr-3",children:[l.jsx(nt,{value:"providers",children:l.jsx(rT,{externalProviders:o,isLoading:s,externalTestResults:a,externalTestingProviders:u,externalTestingTimeLeft:h,onProvidersMutate:()=>i(),onTestResultsChange:f,onTestingProvidersChange:g,onTestingTimeLeftChange:m})}),l.jsx(nt,{value:"proxy",children:l.jsx(aT,{})})]})]})]})]})}function aT(){const{strip:e,isLoading:t,setStrip:n}=nd(),[r,o]=v.useState(null),[s,i]=v.useState(!1),a=v.useCallback(async c=>{o(null),i(!0);try{await n(c)}catch(u){o(u instanceof Error?u.message:String(u))}finally{i(!1)}},[n]);return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("h3",{className:"text-sm font-semibold",children:"Claude Code billing header"}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["When enabled, the proxy strips the synthetic ",l.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 ",l.jsx("code",{children:"LLM_INSPECTOR_STRIP_CLAUDE_CODE_BILLING_HEADER"})," environment variable; your choice is persisted to ",l.jsx("code",{children:"config.json"})," and overrides the env var for subsequent requests."]})]}),l.jsxs("label",{className:"flex items-center gap-3",children:[l.jsx("input",{type:"checkbox",role:"switch",checked:e,disabled:t||s,onChange:c=>{a(c.currentTarget.checked)},className:"size-4 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"}),l.jsx("span",{className:"text-sm",children:t?"Loading…":e?"Stripping enabled":"Stripping disabled"})]}),r!==null&&l.jsxs("p",{className:"text-xs text-destructive",children:["Failed to save: ",r]})]})}function lT(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:su(s.cacheCreationInputTokens,i.cacheCreationInputTokens),read:su(s.cacheReadInputTokens,i.cacheReadInputTokens)})}}return t}function su(e,t){return t===null||e===null?null:t>e?{direction:"up",delta:t-e}:t<e?{direction:"down",delta:e-t}:null}const cT="";function pr(e){if(e.length===0)return cT;let t="";for(let n=0;n<e.length;n++){const r=e[n];r!==void 0&&(typeof r=="number"?t+=`[${r}]`:n===0?t+=r:t+=`.${r}`)}return t}function uT(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function iu(e){if(typeof e=="string")try{return Po(JSON.parse(e))}catch{return{kind:"primitive",value:e}}return Po(e)}function Po(e){if(e===null)return{kind:"primitive",value:null};if(typeof e=="string")return{kind:"primitive",value:e};if(typeof e=="number")return{kind:"primitive",value:e};if(typeof e=="boolean")return{kind:"primitive",value:e};if(Array.isArray(e))return{kind:"array",value:e.map(t=>Po(t))};if(uT(e)){const t={};for(const n of Object.keys(e).sort())t[n]=Po(e[n]);return{kind:"object",value:t}}return{kind:"primitive",value:null}}function dT(e,t){const n=[];return Ai([],e,t,n),n}function Ai(e,t,n,r){const o=pr(e);if(Ii(t,n)){r.push({kind:"equal",path:o,value:t});return}if(t.kind!==n.kind){r.push({kind:"changed",path:o,left:t,right:n});return}if(t.kind==="primitive"&&n.kind==="primitive"){r.push({kind:"changed",path:o,left:t,right:n});return}if(t.kind==="object"&&n.kind==="object"){const s=Object.keys(t.value),i=Object.keys(n.value),a=new Set(i);for(const c of s){const u=t.value[c];if(u!==void 0)if(!a.has(c))r.push({kind:"removed",path:pr([...e,c]),value:u});else{const d=n.value[c];if(d===void 0)continue;Ai([...e,c],u,d,r)}}for(const c of i){if(s.includes(c))continue;const u=n.value[c];u!==void 0&&r.push({kind:"added",path:pr([...e,c]),value:u})}return}if(t.kind==="array"&&n.kind==="array"){const s=Math.min(t.value.length,n.value.length);for(let i=0;i<s;i++){const a=t.value[i],c=n.value[i];a===void 0||c===void 0||Ai([...e,i],a,c,r)}for(let i=s;i<n.value.length;i++){const a=n.value[i];a!==void 0&&r.push({kind:"added",path:pr([...e,i]),value:a})}for(let i=s;i<t.value.length;i++){const a=t.value[i];a!==void 0&&r.push({kind:"removed",path:pr([...e,i]),value:a})}}}function Ii(e,t){if(e.kind!==t.kind)return!1;if(e.kind==="primitive"&&t.kind==="primitive")return e.value===t.value;if(e.kind==="array"&&t.kind==="array"){if(e.value.length!==t.value.length)return!1;for(let n=0;n<e.value.length;n++){const r=e.value[n],o=t.value[n];if(r===void 0||o===void 0||!Ii(r,o))return!1}return!0}if(e.kind==="object"&&t.kind==="object"){const n=Object.keys(e.value),r=Object.keys(t.value);if(n.length!==r.length)return!1;for(const o of n){const s=e.value[o],i=t.value[o];if(s===void 0||i===void 0||!Ii(s,i))return!1}return!0}return!1}function Et(e,t=80){let n;switch(e.kind){case"primitive":n=e.value===null?"null":JSON.stringify(e.value);break;case"array":n=`[… ${e.value.length} items]`;break;case"object":n=`{… ${Object.keys(e.value).length} keys}`;break}return n.length>t&&(n=`${n.slice(0,t-1)}…`),n}function co(e,t=2){return JSON.stringify(zi(e),null,t)}function zi(e){switch(e.kind){case"primitive":return e.value;case"array":return e.value.map(zi);case"object":{const t={};for(const[n,r]of Object.entries(e.value))t[n]=zi(r);return t}}}function au(e){if(e==="")return"";for(let t=e.length-1;t>=0;t--){const n=e[t];if(n==="."||n==="[")return e.substring(0,t)}return""}function lu(e){return e.kind==="equal"&&(e.value.kind==="object"||e.value.kind==="array")}function fT(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if(r!==void 0&&lu(r)){const o=au(r.path);let s=n+1;for(;s<e.length;){const i=e[s];if(i===void 0||!lu(i)||au(i.path)!==o)break;s++}if(s-n>1){const i=[];for(let a=n;a<s;a++){const c=e[a];c!==void 0&&c.kind==="equal"&&i.push(c)}t.push({kind:"equal-run",ops:i}),n=s;continue}}r!==void 0&&t.push({kind:"single",op:r}),n++}return t}const Jp={added:{icon:po,accent:"text-emerald-600 dark:text-emerald-400",bg:"bg-emerald-500/5 hover:bg-emerald-500/10",border:"border-l-emerald-500",label:"ADDED"},removed:{icon:qi,accent:"text-rose-600 dark:text-rose-400",bg:"bg-rose-500/5 hover:bg-rose-500/10",border:"border-l-rose-500",label:"REMOVED"},changed:{icon:Ki,accent:"text-amber-600 dark:text-amber-400",bg:"bg-amber-500/5 hover:bg-amber-500/10",border:"border-l-amber-500",label:"CHANGED"},equal:{icon:Yy,accent:"text-muted-foreground/70",bg:"bg-muted/20 hover:bg-muted/30",border:"border-l-muted-foreground/20",label:"EQUAL"}};function hT({ops:e,expanded:t,onToggle:n}){const r=e[0],o=e[e.length-1];if(r===void 0||o===void 0)return l.jsx("div",{className:"text-muted-foreground/40 text-xs",children:"—"});const s=r.path,i=o.path,a=e.length===1?s:`${s} … ${i}`,c=r.value.kind==="array"?`${e.length} equal arrays`:r.value.kind==="object"?`${e.length} equal objects`:"equal",u=Jp.equal;return l.jsxs("div",{className:he("border-l-4 rounded-sm",u.border,u.bg),children:[l.jsxs("button",{type:"button",onClick:n,className:"w-full text-left flex items-center gap-2 px-3 py-1.5 text-xs text-muted-foreground cursor-pointer",children:[l.jsx(bt,{className:he("size-3 transition-transform shrink-0",t&&"rotate-90")}),l.jsx(u.icon,{className:he("size-3 shrink-0",u.accent)}),l.jsx("span",{className:"font-mono truncate flex-1",title:`${s} … ${i}`,children:a}),l.jsx("span",{className:he("text-[10px] uppercase tracking-wider shrink-0",u.accent),children:u.label}),l.jsxs("span",{className:"text-muted-foreground/60 shrink-0",children:["(",c,")"]})]}),t&&l.jsx("div",{className:"ml-5 mt-1 mb-2 space-y-2 pr-2",children:e.map(d=>l.jsxs("div",{className:"border border-border/50 rounded p-2 bg-muted/20",children:[l.jsx("div",{className:"font-mono text-xs text-muted-foreground mb-1",children:d.path}),l.jsx(br,{text:co(d.value),defaultExpandDepth:0})]},d.path))})]})}function pT({op:e,idx:t,copiedPath:n,onCopyPath:r,expanded:o,onToggle:s}){const i=Jp[e.kind],a=i.icon,c=e.kind==="added"||e.kind==="removed"?e.value.kind==="object"||e.value.kind==="array":e.kind==="changed"?e.left.kind==="object"||e.left.kind==="array"||e.right.kind==="object"||e.right.kind==="array":!1,u=e.kind==="changed"?[{text:Et(e.left,400),tone:"text-rose-700 dark:text-rose-300 line-through"},{text:Et(e.right,400),tone:"text-emerald-700 dark:text-emerald-300"}]:e.kind==="removed"?[{text:Et(e.value,400),tone:"text-rose-700 dark:text-rose-300 line-through"}]:e.kind==="added"?[{text:Et(e.value,400),tone:"text-emerald-700 dark:text-emerald-300"}]:[{text:Et(e.value,400),tone:"text-muted-foreground"}],d=n===e.path&&e.path!=="";return l.jsxs("div",{"data-diff-idx":t,"data-diff-kind":e.kind,className:he("border-l-4 rounded-sm px-3 py-2 my-0.5 transition-colors",i.border,i.bg),children:[l.jsxs("button",{type:"button",onClick:s,disabled:!c,className:he("w-full flex items-center gap-2 text-xs text-left rounded-sm",c?"cursor-pointer":"cursor-default"),"aria-expanded":c?o:void 0,"aria-label":c?o?`Collapse ${e.path||"root"}`:`Expand ${e.path||"root"}`:void 0,children:[c?l.jsx(bt,{className:he("size-3 shrink-0 transition-transform",i.accent,o&&"rotate-90")}):l.jsx("span",{className:"size-3 shrink-0","aria-hidden":"true"}),l.jsx(a,{className:he("size-3.5 shrink-0",i.accent),strokeWidth:2.5}),l.jsx("span",{className:"font-mono truncate flex-1 min-w-0",title:e.path||"(root)",children:e.path===""?"(root)":e.path}),l.jsx("span",{className:he("text-[9px] font-bold uppercase tracking-wider shrink-0 px-1.5 py-0.5 rounded",i.accent,e.kind==="equal"?"bg-muted/40":"bg-background/60"),children:i.label}),e.path!==""&&l.jsx("span",{role:"button",tabIndex:0,onClick:h=>{h.stopPropagation(),r(e.path)},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.stopPropagation(),h.preventDefault(),r(e.path))},className:he("shrink-0 p-1 rounded transition-colors cursor-pointer inline-flex items-center justify-center",d?"text-emerald-500":"text-muted-foreground/50 hover:text-foreground hover:bg-muted"),"aria-label":d?"Copied":"Copy",title:d?"Copied!":"Copy",children:d?l.jsx(Jt,{className:"size-3"}):l.jsx(bn,{className:"size-3"})})]}),u.map((h,p)=>l.jsx("div",{className:he("font-mono text-xs mt-1 break-all pl-5",h.tone),children:h.text},p)),l.jsx("div",{className:"overflow-hidden transition-all duration-200",style:{maxHeight:o&&c?"2000px":"0"},"aria-hidden":!o,children:o&&c&&e.kind!=="equal"?l.jsx(mT,{op:e}):null})]})}function mT({op:e}){if(e.kind==="added"||e.kind==="removed")return l.jsx("div",{className:"pl-5 mt-2 border border-border/50 rounded p-2 bg-muted/20",children:l.jsx(br,{text:co(e.value),defaultExpandDepth:0})});const t=e.left.kind==="object"||e.left.kind==="array",n=e.right.kind==="object"||e.right.kind==="array";return!t&&!n?l.jsx("div",{className:"pl-5 mt-2 text-xs text-muted-foreground/70 italic",children:"Primitive values are shown inline above."}):l.jsxs("div",{className:"pl-5 mt-2 grid grid-cols-1 md:grid-cols-2 gap-2",children:[l.jsxs("div",{className:"border border-rose-500/30 rounded p-2 bg-rose-500/5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-wider text-rose-500 mb-1",children:"Old"}),l.jsx(br,{text:co(e.left),defaultExpandDepth:0})]}),l.jsxs("div",{className:"border border-emerald-500/30 rounded p-2 bg-emerald-500/5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-wider text-emerald-500 mb-1",children:"New"}),l.jsx(br,{text:co(e.right),defaultExpandDepth:0})]})]})}function gT({counts:e,onJumpTo:t}){const n=e.added+e.removed+e.changed;return l.jsxs("div",{className:"px-4 py-2 border-b border-border bg-muted/20 flex items-center gap-2 text-xs flex-wrap",children:[l.jsxs("span",{className:"text-muted-foreground font-medium",children:[n," ",n===1?"change":"changes"]}),l.jsxs("button",{type:"button",onClick:()=>t("removed"),disabled:e.removed===0,className:he("inline-flex items-center gap-1 px-2 py-0.5 rounded-full border cursor-pointer transition-colors",e.removed>0?"border-rose-500/40 text-rose-600 dark:text-rose-400 bg-rose-500/10 hover:bg-rose-500/20":"border-border text-muted-foreground/40 cursor-not-allowed"),title:e.removed>0?"Jump to first removed":"No removals",children:[l.jsx(qi,{className:"size-3"}),e.removed," removed"]}),l.jsxs("button",{type:"button",onClick:()=>t("added"),disabled:e.added===0,className:he("inline-flex items-center gap-1 px-2 py-0.5 rounded-full border cursor-pointer transition-colors",e.added>0?"border-emerald-500/40 text-emerald-600 dark:text-emerald-400 bg-emerald-500/10 hover:bg-emerald-500/20":"border-border text-muted-foreground/40 cursor-not-allowed"),title:e.added>0?"Jump to first added":"No additions",children:[l.jsx(po,{className:"size-3"}),e.added," added"]}),l.jsxs("button",{type:"button",onClick:()=>t("changed"),disabled:e.changed===0,className:he("inline-flex items-center gap-1 px-2 py-0.5 rounded-full border cursor-pointer transition-colors",e.changed>0?"border-amber-500/40 text-amber-600 dark:text-amber-400 bg-amber-500/10 hover:bg-amber-500/20":"border-border text-muted-foreground/40 cursor-not-allowed"),title:e.changed>0?"Jump to first changed":"No changes",children:[l.jsx(Ki,{className:"size-3"}),e.changed," changed"]})]})}function xT({mode:e,onChange:t}){return l.jsxs("div",{className:"inline-flex rounded-md border border-border overflow-hidden",children:[l.jsxs("button",{type:"button",onClick:()=>t("unified"),"aria-pressed":e==="unified",className:he("flex items-center gap-1 px-2 py-1 text-xs transition-colors cursor-pointer",e==="unified"?"bg-muted text-foreground":"hover:bg-muted/50 text-muted-foreground"),title:"Unified view (single column, emphasized diffs)",children:[l.jsx(dd,{className:"size-3"}),"Unified"]}),l.jsxs("button",{type:"button",onClick:()=>t("split"),"aria-pressed":e==="split",className:he("flex items-center gap-1 px-2 py-1 text-xs transition-colors border-l border-border cursor-pointer",e==="split"?"bg-muted text-foreground":"hover:bg-muted/50 text-muted-foreground"),title:"Split view (path | left | right)",children:[l.jsx(id,{className:"size-3"}),"Split"]})]})}function cu({log:e,side:t}){const n=So(e);return l.jsxs("div",{className:"flex-1 min-w-0 space-y-1 text-xs",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(xt,{variant:"outline",className:he("text-[10px] px-1.5 py-0 h-5 font-mono shrink-0",t==="left"?"border-rose-500/40 text-rose-400":"border-emerald-500/40 text-emerald-400"),children:t==="left"?"← Left":"Right →"}),l.jsxs("span",{className:"font-mono text-blue-400/80",children:["#",e.id]}),e.model!==null&&l.jsx("span",{className:"font-mono text-muted-foreground truncate",children:e.model})]}),l.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground font-mono",children:[e.cacheCreationInputTokens!==null&&e.cacheCreationInputTokens>0&&l.jsxs("span",{className:"text-emerald-400",children:["Cache +",qe(e.cacheCreationInputTokens)]}),e.cacheReadInputTokens!==null&&e.cacheReadInputTokens>0&&l.jsxs("span",{className:"text-purple-400",children:["Cache ~",qe(e.cacheReadInputTokens)]}),l.jsx("span",{className:"truncate",title:e.timestamp,children:e.timestamp})]}),l.jsxs("div",{className:"text-muted-foreground/70 font-mono truncate",title:n,children:["session: ",n]})]})}function yT({left:e,right:t,onClose:n}){const r=v.useMemo(()=>{const C=Io(Tr(e)).analyzeRequest(e.rawRequestBody),N=Io(Tr(t)).analyzeRequest(t.rawRequestBody),T=iu(C.comparisonValue),A=iu(N.comparisonValue);return dT(T,A)},[e.apiFormat,e.path,e.rawRequestBody,t.apiFormat,t.path,t.rawRequestBody]),o=v.useMemo(()=>fT(r),[r]),s=v.useMemo(()=>{let C=0,N=0,T=0;for(const A of o)if(A.kind==="single")switch(A.op.kind){case"added":C++;break;case"removed":N++;break;case"changed":T++;break}return{added:C,removed:N,changed:T}},[o]),[i,a]=v.useState(new Set),c=C=>{a(N=>{const T=new Set(N);return T.has(C)?T.delete(C):T.add(C),T})},[u,d]=v.useState(new Set),h=C=>{d(N=>{const T=new Set(N);return T.has(C)?T.delete(C):T.add(C),T})};v.useEffect(()=>{d(new Set)},[e.id,t.id]);const[p,f]=v.useState("unified"),g=v.useRef(null),[m,x]=v.useState(null),y=v.useRef(null),b=C=>{window.navigator.clipboard.writeText(C).then(()=>{x(C),y.current!==null&&clearTimeout(y.current),y.current=setTimeout(()=>x(null),1500)})};v.useEffect(()=>()=>{y.current!==null&&clearTimeout(y.current)},[]);const k=C=>{const N=o.findIndex(R=>R.kind==="single"&&R.op.kind===C);if(N===-1)return;const T=g.current;if(T===null)return;const A=T.querySelector(`[data-diff-idx="${N}"]`);A!==null&&A.scrollIntoView({behavior:"smooth",block:"center"})};v.useEffect(()=>{const C=T=>{T.key==="Escape"&&n()};document.addEventListener("keydown",C);const N=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",C),document.body.style.overflow=N}},[n]);const S=So(e)===So(t),j=r.length===1&&r[0]?.kind==="equal";return l.jsxs("div",{className:"fixed inset-0 z-50 flex justify-end",role:"dialog","aria-modal":"true","aria-label":"Compare two log requests",children:[l.jsx("button",{type:"button",onClick:n,"aria-label":"Close compare drawer",className:"absolute inset-0 bg-black/40 cursor-default",tabIndex:-1}),l.jsxs("div",{className:he("relative bg-background border-l border-border shadow-xl","w-full md:w-[70vw] max-w-[1100px] flex flex-col h-full"),onClick:C=>C.stopPropagation(),onKeyDown:C=>C.stopPropagation(),children:[l.jsxs("div",{className:"flex items-start gap-4 px-4 py-3 border-b border-border",children:[l.jsxs("div",{className:"flex-1 flex gap-4 min-w-0",children:[l.jsx(cu,{log:e,side:"left"}),l.jsx(cu,{log:t,side:"right"})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[l.jsx(xT,{mode:p,onChange:f}),l.jsx("button",{type:"button",onClick:n,"aria-label":"Close",className:"p-1 rounded text-muted-foreground hover:text-foreground hover:bg-muted cursor-pointer",children:l.jsx(Ji,{className:"size-4"})})]})]}),!S&&l.jsx("div",{className:"px-4 py-1.5 text-xs text-amber-400 bg-amber-500/10 border-b border-border",children:"Heads up: the two selected logs are from different sessions."}),j?l.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto flex items-center justify-center text-muted-foreground text-sm",children:"The two Request payloads are identical."}):l.jsxs(l.Fragment,{children:[l.jsx(gT,{counts:s,onJumpTo:k}),l.jsx("div",{ref:g,className:"flex-1 min-h-0 overflow-y-auto",children:p==="unified"?l.jsx("div",{className:"px-3 py-2 space-y-0.5",children:o.map((C,N)=>{if(C.kind==="equal-run")return l.jsx(hT,{ops:C.ops,expanded:i.has(N),onToggle:()=>c(N)},`r${N}`);const T=C.op;return l.jsx(pT,{op:T,idx:N,copiedPath:m,onCopyPath:b,expanded:u.has(N),onToggle:()=>h(N)},`o${N}`)})}):l.jsx(vT,{grouped:o,left:e,right:t})})]})]})]})}function vT({grouped:e,left:t,right:n}){return l.jsxs("div",{className:"grid grid-cols-[200px_1fr_1fr] gap-x-2 gap-y-0.5 px-3 py-2 text-xs",children:[l.jsxs("div",{className:"grid grid-cols-[200px_1fr_1fr] gap-x-2 col-span-3 pb-2 mb-2 border-b border-border text-[10px] uppercase tracking-wider text-muted-foreground",children:[l.jsx("span",{children:"Path"}),l.jsxs("span",{children:["Left (Log #",t.id,")"]}),l.jsxs("span",{children:["Right (Log #",n.id,")"]})]}),e.map((r,o)=>{if(r.kind==="equal-run")return l.jsxs("div",{className:"col-span-3 px-2 py-1 text-xs text-muted-foreground/60",children:[r.ops.length," equal siblings collapsed — switch to Unified to expand"]},o);const s=r.op;return s.kind==="equal"?l.jsxs("div",{className:"col-span-3 grid grid-cols-[200px_1fr_1fr] gap-x-2 px-2 py-0.5 text-muted-foreground",children:[l.jsx("span",{className:"font-mono text-xs truncate",title:s.path,children:s.path}),l.jsx("span",{className:"font-mono text-xs break-all opacity-60",children:Et(s.value,200)}),l.jsx("span",{className:"font-mono text-xs break-all opacity-60",children:Et(s.value,200)})]},o):s.kind==="added"?l.jsxs("div",{className:"col-span-3 px-2 py-1 rounded text-xs border-l-2 border-l-emerald-400/70 bg-emerald-500/5",children:[l.jsx("div",{className:"font-mono text-xs text-muted-foreground mb-0.5",children:s.path}),l.jsxs("div",{className:"font-mono break-all text-emerald-300/90",children:["+ ",Et(s.value,400)]})]},o):s.kind==="removed"?l.jsxs("div",{className:"col-span-3 px-2 py-1 rounded text-xs border-l-2 border-l-rose-400/70 bg-rose-500/5",children:[l.jsx("div",{className:"font-mono text-xs text-muted-foreground mb-0.5",children:s.path}),l.jsxs("div",{className:"font-mono break-all text-rose-300/90 line-through",children:["− ",Et(s.value,400)]})]},o):l.jsxs("div",{className:"col-span-3 px-2 py-1 rounded text-xs border-l-2 border-l-amber-400/70 bg-amber-500/5",children:[l.jsx("div",{className:"font-mono text-xs text-muted-foreground mb-1",children:s.path}),l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsx("div",{className:"font-mono text-rose-300/90 break-all line-through",children:Et(s.left,400)}),l.jsx("div",{className:"font-mono text-emerald-300/90 break-all",children:Et(s.right,400)})]})]},o)})]})}function bT(e){return e.length<=30?e:e.slice(0,12)+"…"+e.slice(-12)}function wT(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 kT({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 l.jsxs("div",{className:"inline-flex items-center gap-2 bg-muted rounded-md px-3 py-2",children:[l.jsx("pre",{className:"text-blue-500 font-mono text-sm m-0",children:e}),l.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?l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:"M20 6 9 17l-5-5"})}):l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),l.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 _T({logs:e,sessions:t,models:n,selectedSession:r,selectedModel:o,onSessionChange:s,onModelChange:i,onClearAll:a,onClearGroup:c,viewMode:u,onViewModeChange:d,strip:h}){const{totalIn:p,totalOut:f}=v.useMemo(()=>wT(e),[e]),[g,m]=v.useState(!1),[x,y]=v.useState(null),[b,k]=v.useState("hidden");v.useEffect(()=>{const E=50+Co.length*400,L=setTimeout(()=>k("playing"),50),w=setTimeout(()=>k("done"),E);return()=>{clearTimeout(L),clearTimeout(w)}},[]);const S=v.useCallback(async()=>{m(!0);try{await Gv(e)}finally{m(!1)}},[e]);v.useEffect(()=>{y(null)},[r,o]);const j=v.useCallback(()=>{y(null)},[]),C=v.useMemo(()=>VS(e),[e]),N=v.useMemo(()=>lT(C),[C]),T=v.useMemo(()=>C4(C),[C]),A=v.useCallback(R=>{const M=T.get(R.id);M!==void 0&&y([M,R])},[T]);return l.jsxs("div",{className:"max-w-[1200px] mx-auto flex flex-col h-screen",style:{maxHeight:"100vh"},children:[l.jsxs("div",{className:"flex items-end px-6 pt-6 pb-8 relative",children:[l.jsxs("h1",{className:"text-lg font-bold flex items-end gap-2 absolute left-1/2 -translate-x-1/2 whitespace-nowrap",children:[l.jsxs("span",{className:"flex items-end gap-1 group cursor-default","aria-hidden":"true",children:[l.jsx(N4,{className:"size-10 text-amber-500 transition-all duration-300 group-hover:scale-125 group-hover:-translate-y-1.5"}),l.jsx("span",{className:"flex items-end gap-0.5",children:Co.map((R,M)=>{const E=["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"][M],L=b==="hidden"?"opacity-0 scale-0":b==="playing"?"animate-crab-piano-pop":"";return l.jsx(R,{className:`size-5 ${E} transition-all duration-300 ease-out group-hover:scale-125 group-hover:-translate-y-1 ${L}`,style:{transitionDelay:`${M*50}ms`,...b==="playing"?{animationDelay:`${M*400}ms`}:{}}},M)})})]}),l.jsxs("span",{className:"flex items-baseline gap-2",children:["LLM Inspector",l.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["v",Xv.version]})]})]}),l.jsx("div",{className:"ml-auto",children:l.jsx(iT,{})})]}),l.jsxs("div",{className:"flex items-center gap-3 px-6 mb-4",children:[l.jsxs(Gc,{value:r,onValueChange:s,children:[l.jsx(Xc,{className:"flex-1 max-w-[350px] text-xs",children:l.jsx(Yc,{placeholder:"All sessions"})}),l.jsxs(Qc,{children:[l.jsx(to,{value:"__all__",children:"All sessions"}),t.map(R=>l.jsx(to,{value:R,children:bT(R)},R))]})]}),l.jsxs(Gc,{value:o,onValueChange:i,children:[l.jsx(Xc,{className:"flex-1 max-w-[250px] text-xs",children:l.jsx(Yc,{placeholder:"All models"})}),l.jsxs(Qc,{children:[l.jsx(to,{value:"__all__",children:"All models"}),n.map(R=>l.jsx(to,{value:R,children:R},R))]})]}),l.jsxs("div",{className:"flex items-center border border-border rounded-md overflow-hidden",children:[l.jsx("button",{type:"button",onClick:()=>d("simple"),className:`px-2 py-1 cursor-pointer transition-colors text-xs ${u==="simple"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Simple"}),l.jsx("button",{type:"button",onClick:()=>d("full"),className:`px-2 py-1 cursor-pointer transition-colors text-xs ${u==="full"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Full"})]}),l.jsx("div",{className:"flex-1"}),l.jsxs("span",{className:"text-muted-foreground text-xs font-mono",children:[e.length," request",e.length!==1?"s":"",p>0||f>0?` · ${p.toLocaleString()} in / ${f.toLocaleString()} out`:""]}),e.length>0&&l.jsx("button",{type:"button",onClick:()=>{S()},disabled:g,className:"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",title:"Export all logs as JSON ZIP",children:g?l.jsx("span",{children:"Exporting..."}):l.jsxs(l.Fragment,{children:[l.jsx(Vi,{className:"size-3"}),l.jsx("span",{children:"Export"})]})}),l.jsx("button",{type:"button",onClick:a,className:"text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:"Clear all logs",children:"Clear"})]}),l.jsx("div",{className:"flex-1 min-h-0 px-6 pb-6",children:e.length===0?l.jsxs("div",{className:"text-center text-muted-foreground py-16 space-y-4",children:[l.jsx("p",{className:"text-sm",children:"No requests captured yet."}),l.jsx("p",{className:"text-xs",children:"Route AI coding tools through the proxy:"}),l.jsx(kT,{command:"LLM_BASE_URL=http://localhost:25947/proxy <your-tool>"})]}):l.jsx("div",{className:"overflow-y-auto h-full flex flex-col gap-2",children:C.map(R=>l.jsx(E4,{group:R,viewMode:u,strip:h,cacheTrends:N,onCompareWithPrevious:A,comparisonPredecessors:T,onClearGroup:c,standalone:C.length===1},R.id))})}),x!==null&&l.jsx(yT,{left:x[0],right:x[1],onClose:j})]})}const ST=Kt([ae({type:Se("init"),logs:Re(cl)}),ae({type:Se("update"),log:cl})]);function Ws(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function qs(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function CT(e,t,n){return t==="__all__"&&n==="__all__"?e:e.filter(r=>!(t!=="__all__"&&r.sessionId!==t||n!=="__all__"&&r.model!==n))}const jT=50;function ET(){const[e,t]=v.useState([]),[n,r]=v.useState([]),[o,s]=v.useState([]),[i,a]=v.useState("__all__"),[c,u]=v.useState("__all__"),[d,h]=v.useState("simple"),[p,f]=v.useState(null),g=v.useRef(null),m=v.useRef(null),x=v.useRef(new Map),y=v.useRef([]),b=v.useRef([]),k=v.useRef(null),S=v.useMemo(()=>CT(e,i,c),[e,i,c]),j=v.useCallback(()=>{k.current=null;const M=b.current;b.current=[],M.length!==0&&t(E=>{let L=E,w=!1,D=!1;for(const W of M){const B=x.current.get(W.id);B!==void 0?L=[...L.slice(0,B),W,...L.slice(B+1)]:(x.current.set(W.id,L.length),L=[...L,W]),W.sessionId!==null&&W.sessionId!==""&&!n.includes(W.sessionId)&&(w=!0),W.model!==null&&W.model!==""&&!o.includes(W.model)&&(D=!0)}return y.current=L,w&&r(W=>Ws(L)),D&&s(W=>qs(L)),L})},[n,o]),C=v.useCallback(M=>{b.current.push(M),k.current===null&&(k.current=setTimeout(j,jT))},[j]),N=v.useCallback(()=>{g.current&&g.current.close();const M=new EventSource("/api/logs/stream");g.current=M,M.onmessage=E=>{try{const L=String(E.data),w=JSON.parse(L),D=ST.safeParse(w);if(!D.success){f("Failed to parse SSE data");return}const W=D.data;if(W.type==="init"){k.current!==null&&(clearTimeout(k.current),k.current=null),b.current=[];const B=new Map;for(let q=0;q<W.logs.length;q++){const Y=W.logs[q];Y!==void 0&&B.set(Y.id,q)}x.current=B,y.current=W.logs,t(W.logs),r(Ws(W.logs)),s(qs(W.logs)),f(null)}else W.type==="update"&&C(W.log)}catch{f("Failed to parse SSE data")}},M.onerror=()=>{f("SSE connection lost, reconnecting..."),M.close(),m.current!==null&&clearTimeout(m.current),m.current=setTimeout(N,3e3)}},[C]);v.useEffect(()=>(N(),()=>{g.current&&(g.current.close(),g.current=null),m.current!==null&&(clearTimeout(m.current),m.current=null),k.current!==null&&(clearTimeout(k.current),k.current=null)}),[N]);const T=v.useCallback(()=>{(async()=>{try{if(!(await fetch("/api/logs",{method:"DELETE"})).ok){f("Failed to clear logs");return}x.current.clear(),y.current=[],t([]),r([]),s([]),f(null)}catch(M){f(M instanceof Error?M.message:"Unknown error clearing logs")}})()},[]),A=v.useCallback(M=>{M.length!==0&&(async()=>{try{if(!(await fetch("/api/logs",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:M})})).ok){f("Failed to clear group");return}const L=new Set(M);t(w=>{const D=w.filter(B=>!L.has(B.id)),W=new Map;for(let B=0;B<D.length;B++){const q=D[B];q!==void 0&&W.set(q.id,B)}return x.current=W,y.current=D,r(Ws(D)),s(qs(D)),D}),f(null)}catch(E){f(E instanceof Error?E.message:"Unknown error clearing group")}})()},[]),{strip:R}=nd();return l.jsxs(l.Fragment,{children:[p!==null&&l.jsx("div",{className:"fixed top-4 right-4 bg-destructive text-destructive-foreground px-4 py-2 rounded-md text-sm z-50",children:p}),l.jsx(Hv,{}),l.jsx(_T,{logs:S,sessions:n,models:o,selectedSession:i,selectedModel:c,onSessionChange:a,onModelChange:u,onClearAll:T,onClearGroup:A,viewMode:d,onViewModeChange:h,strip:R})]})}const AT=ET;export{AT as component};