@tonyclaw/llm-inspector 1.14.8 → 1.14.9

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.
@@ -0,0 +1,105 @@
1
+ import{u as Kc,a as Np,r as v,b as kr,j as l,R as at,c as Gc,d as Tp,e as Ar,g as bs}from"./main-C8OUJKbz.js";function Q(e,t,n){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);const u=s.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 i extends o{}Object.defineProperty(i,"name",{value:e});function s(a){var c;const u=n?.Parent?new i:this;r(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}class Pn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Jc extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Yc={};function Xt(e){return Yc}function Xc(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 Mi(e,t){return typeof t=="bigint"?t.toString():t}function Co(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ws(e){return e==null}function ks(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Ap(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}const i=n>o?n:o,s=Number.parseInt(e.toFixed(i).replace(".","")),a=Number.parseInt(t.toFixed(i).replace(".",""));return s%a/10**i}const Sa=Symbol("evaluating");function Ae(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Sa)return r===void 0&&(r=Sa,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function gn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function nn(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Ca(e){return JSON.stringify(e)}function Ip(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Qc="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function mr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const zp=Co(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Ln(e){if(mr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(mr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function eu(e){return Ln(e)?{...e}:Array.isArray(e)?[...e]:e}const Pp=new Set(["string","number","symbol"]);function Fn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function rn(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 Rp(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Op={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 Dp(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=nn(e._zod.def,{get shape(){const s={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(s[a]=n.shape[a])}return gn(this,"shape",s),s},checks:[]});return rn(e,i)}function Mp(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=nn(e._zod.def,{get shape(){const s={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete s[a]}return gn(this,"shape",s),s},checks:[]});return rn(e,i)}function Lp(e,t){if(!Ln(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const s in t)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=nn(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return gn(this,"shape",i),i}});return rn(e,o)}function Fp(e,t){if(!Ln(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=nn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return gn(this,"shape",r),r}});return rn(e,n)}function $p(e,t){const n=nn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return gn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return rn(e,n)}function Bp(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 s=nn(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 gn(this,"shape",c),c},checks:[]});return rn(t,s)}function Up(e,t,n){const r=nn(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(n)for(const s in n){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(i[s]=new e({type:"nonoptional",innerType:o[s]}))}else for(const s in o)i[s]=new e({type:"nonoptional",innerType:o[s]});return gn(this,"shape",i),i}});return rn(t,r)}function Tn(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 An(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Ir(e){return typeof e=="string"?e:e?.message}function Qt(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=Ir(e.inst?._zod.def?.error?.(e))??Ir(t?.error?.(e))??Ir(n.customError?.(e))??Ir(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function _s(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function gr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const tu=(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,Mi,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},nu=Q("$ZodError",tu),ru=Q("$ZodError",tu,{Parent:Error});function Zp(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 Vp(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>r({issues:s}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let s=n,a=0;for(;a<i.path.length;){const c=i.path[a];a===i.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(i))):s[c]=s[c]||{_errors:[]},s=s[c],a++}}};return r(e),n}const Ss=e=>(t,n,r,o)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new Pn;if(s.issues.length){const a=new(o?.Err??e)(s.issues.map(c=>Qt(c,i,Xt())));throw Qc(a,o?.callee),a}return s.value},Cs=e=>async(t,n,r,o)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const a=new(o?.Err??e)(s.issues.map(c=>Qt(c,i,Xt())));throw Qc(a,o?.callee),a}return s.value},jo=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Pn;return i.issues.length?{success:!1,error:new(e??nu)(i.issues.map(s=>Qt(s,o,Xt())))}:{success:!0,data:i.value}},Wp=jo(ru),Eo=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>Qt(s,o,Xt())))}:{success:!0,data:i.value}},Hp=Eo(ru),qp=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ss(e)(t,n,o)},Kp=e=>(t,n,r)=>Ss(e)(t,n,r),Gp=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Cs(e)(t,n,o)},Jp=e=>async(t,n,r)=>Cs(e)(t,n,r),Yp=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return jo(e)(t,n,o)},Xp=e=>(t,n,r)=>jo(e)(t,n,r),Qp=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Eo(e)(t,n,o)},em=e=>async(t,n,r)=>Eo(e)(t,n,r),tm=/^[cC][^\s-]{8,}$/,nm=/^[0-9a-z]+$/,rm=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,om=/^[0-9a-vA-V]{20}$/,im=/^[A-Za-z0-9]{27}$/,sm=/^[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)?)?)$/,lm=/^([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})$/,ja=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)$/,cm=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,um="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function dm(){return new RegExp(um,"u")}const fm=/^(?:(?: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])$/,hm=/^(([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}|:))$/,pm=/^((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])$/,mm=/^(([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])$/,gm=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ou=/^[A-Za-z0-9_-]*$/,xm=/^\+[1-9]\d{6,14}$/,iu="(?:(?:\\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])))",ym=new RegExp(`^${iu}$`);function su(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 vm(e){return new RegExp(`^${su(e)}$`)}function bm(e){const t=su({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(`^${iu}T(?:${r})$`)}const wm=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},km=/^-?\d+$/,au=/^-?\d+(?:\.\d+)?$/,_m=/^(?:true|false)$/i,Sm=/^null$/i,Cm=/^[^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=[])}),lu={number:"number",bigint:"bigint",object:"date"},cu=Q("$ZodCheckLessThan",(e,t)=>{ut.init(e,t);const n=lu[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),uu=Q("$ZodCheckGreaterThan",(e,t)=>{ut.init(e,t);const n=lu[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Em=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):Ap(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})}}),Nm=Q("$ZodCheckNumberFormat",(e,t)=>{ut.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,i]=Op[t.format];e._zod.onattach.push(s=>{const a=s._zod.bag;a.format=t.format,a.minimum=o,a.maximum=i,n&&(a.pattern=km)}),e._zod.check=s=>{const a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.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}):s.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&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Tm=Q("$ZodCheckMaxLength",(e,t)=>{var n;ut.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ws(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 s=_s(o);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Am=Q("$ZodCheckMinLength",(e,t)=>{var n;ut.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ws(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 s=_s(o);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Im=Q("$ZodCheckLengthEquals",(e,t)=>{var n;ut.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ws(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,i=o.length;if(i===t.length)return;const s=_s(o),a=i>t.length;r.issues.push({origin:s,...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})}}),No=Q("$ZodCheckStringFormat",(e,t)=>{var n,r;ut.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),zm=Q("$ZodCheckRegex",(e,t)=>{No.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})}}),Pm=Q("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Cm),No.init(e,t)}),Rm=Q("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=jm),No.init(e,t)}),Om=Q("$ZodCheckIncludes",(e,t)=>{ut.init(e,t);const n=Fn(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Dm=Q("$ZodCheckStartsWith",(e,t)=>{ut.init(e,t);const n=new RegExp(`^${Fn(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})}}),Mm=Q("$ZodCheckEndsWith",(e,t)=>{ut.init(e,t);const n=new RegExp(`.*${Fn(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})}}),Lm=Q("$ZodCheckOverwrite",(e,t)=>{ut.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Fm{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
+ `).filter(s=>s),o=Math.min(...r.map(s=>s.length-s.trimStart().length)),i=r.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(const s of i)this.content.push(s)}compile(){const t=Function,n=this?.args,o=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...n,o.join(`
3
+ `))}}const $m={major:4,minor:3,patch:6},Ue=Q("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=$m;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const i of o._zod.onattach)i(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(s,a,c)=>{let u=Tn(s),d;for(const h of a){if(h._zod.def.when){if(!h._zod.def.when(s))continue}else if(u)continue;const p=s.issues.length,f=h._zod.check(s);if(f instanceof Promise&&c?.async===!1)throw new Pn;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await f,s.issues.length!==p&&(u||(u=Tn(s,p)))});else{if(s.issues.length===p)continue;u||(u=Tn(s,p))}}return d?d.then(()=>s):s},i=(s,a,c)=>{if(Tn(s))return s.aborted=!0,s;const u=o(a,r,c);if(u instanceof Promise){if(c.async===!1)throw new Pn;return u.then(d=>e._zod.parse(d,c))}return e._zod.parse(u,c)};e._zod.run=(s,a)=>{if(a.skipChecks)return e._zod.parse(s,a);if(a.direction==="backward"){const u=e._zod.parse({value:s.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(d=>i(d,s,a)):i(u,s,a)}const c=e._zod.parse(s,a);if(c instanceof Promise){if(a.async===!1)throw new Pn;return c.then(u=>o(u,r,a))}return o(c,r,a)}}Ae(e,"~standard",()=>({validate:o=>{try{const i=Wp(e,o);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return Hp(e,o).then(s=>s.success?{value:s.data}:{issues:s.error?.issues})}},vendor:"zod",version:1}))}),js=Q("$ZodString",(e,t)=>{Ue.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??wm(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}}),Ve=Q("$ZodStringFormat",(e,t)=>{No.init(e,t),js.init(e,t)}),Bm=Q("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=lm),Ve.init(e,t)}),Um=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=ja(r))}else t.pattern??(t.pattern=ja());Ve.init(e,t)}),Zm=Q("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=cm),Ve.init(e,t)}),Vm=Q("$ZodURL",(e,t)=>{Ve.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})}}}),Wm=Q("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=dm()),Ve.init(e,t)}),Hm=Q("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=sm),Ve.init(e,t)}),qm=Q("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=tm),Ve.init(e,t)}),Km=Q("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=nm),Ve.init(e,t)}),Gm=Q("$ZodULID",(e,t)=>{t.pattern??(t.pattern=rm),Ve.init(e,t)}),Jm=Q("$ZodXID",(e,t)=>{t.pattern??(t.pattern=om),Ve.init(e,t)}),Ym=Q("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=im),Ve.init(e,t)}),Xm=Q("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=bm(t)),Ve.init(e,t)}),Qm=Q("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ym),Ve.init(e,t)}),eg=Q("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=vm(t)),Ve.init(e,t)}),tg=Q("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=am),Ve.init(e,t)}),ng=Q("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=fm),Ve.init(e,t),e._zod.bag.format="ipv4"}),rg=Q("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=hm),Ve.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),og=Q("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=pm),Ve.init(e,t)}),ig=Q("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=mm),Ve.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,i]=r;if(!i)throw new Error;const s=Number(i);if(`${s}`!==i)throw new Error;if(s<0||s>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 du(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const sg=Q("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=gm),Ve.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{du(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function ag(e){if(!ou.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return du(n)}const lg=Q("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ou),Ve.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})}}),cg=Q("$ZodE164",(e,t)=>{t.pattern??(t.pattern=xm),Ve.init(e,t)});function ug(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 dg=Q("$ZodJWT",(e,t)=>{Ve.init(e,t),e._zod.check=n=>{ug(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),fu=Q("$ZodNumber",(e,t)=>{Ue.init(e,t),e._zod.pattern=e._zod.bag.pattern??au,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),fg=Q("$ZodNumberFormat",(e,t)=>{Nm.init(e,t),fu.init(e,t)}),hg=Q("$ZodBoolean",(e,t)=>{Ue.init(e,t),e._zod.pattern=_m,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}}),pg=Q("$ZodNull",(e,t)=>{Ue.init(e,t),e._zod.pattern=Sm,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}}),mg=Q("$ZodUnknown",(e,t)=>{Ue.init(e,t),e._zod.parse=n=>n}),gg=Q("$ZodNever",(e,t)=>{Ue.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Ea(e,t,n){e.issues.length&&t.issues.push(...An(n,e.issues)),t.value[n]=e.value}const xg=Q("$ZodArray",(e,t)=>{Ue.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let s=0;s<o.length;s++){const a=o[s],c=t.element._zod.run({value:a,issues:[]},r);c instanceof Promise?i.push(c.then(u=>Ea(u,n,s))):Ea(c,n,s)}return i.length?Promise.all(i).then(()=>n):n}});function to(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...An(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function hu(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=Rp(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function pu(e,t,n,r,o,i){const s=[],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"){s.push(h);continue}const p=c.run({value:t[h],issues:[]},r);p instanceof Promise?e.push(p.then(f=>to(f,n,h,t,d))):to(p,n,h,t,d)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const yg=Q("$ZodObject",(e,t)=>{if(Ue.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=Co(()=>hu(t));Ae(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=mr,i=t.catchall;let s;e._zod.parse=(a,c)=>{s??(s=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=s.shape;for(const p of s.keys){const f=h[p],x=f._zod.optout==="optional",m=f._zod.run({value:u[p],issues:[]},c);m instanceof Promise?d.push(m.then(y=>to(y,a,p,u,x))):to(m,a,p,u,x)}return i?pu(d,u,a,c,r.value,e):d.length?Promise.all(d).then(()=>a):a}}),vg=Q("$ZodObjectJIT",(e,t)=>{yg.init(e,t);const n=e._zod.parse,r=Co(()=>hu(t)),o=p=>{const f=new Fm(["shape","payload","ctx"]),x=r.value,m=k=>{const S=Ca(k);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};f.write("const input = payload.value;");const y=Object.create(null);let g=0;for(const k of x.keys)y[k]=`key_${g++}`;f.write("const newResult = {};");for(const k of x.keys){const S=y[k],N=Ca(k),E=p[k]?._zod?.optout==="optional";f.write(`const ${S} = ${m(k)};`),E?f.write(`
4
+ if (${S}.issues.length) {
5
+ if (${N} in input) {
6
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
7
+ ...iss,
8
+ path: iss.path ? [${N}, ...iss.path] : [${N}]
9
+ })));
10
+ }
11
+ }
12
+
13
+ if (${S}.value === undefined) {
14
+ if (${N} in input) {
15
+ newResult[${N}] = undefined;
16
+ }
17
+ } else {
18
+ newResult[${N}] = ${S}.value;
19
+ }
20
+
21
+ `):f.write(`
22
+ if (${S}.issues.length) {
23
+ payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
24
+ ...iss,
25
+ path: iss.path ? [${N}, ...iss.path] : [${N}]
26
+ })));
27
+ }
28
+
29
+ if (${S}.value === undefined) {
30
+ if (${N} in input) {
31
+ newResult[${N}] = undefined;
32
+ }
33
+ } else {
34
+ newResult[${N}] = ${S}.value;
35
+ }
36
+
37
+ `)}f.write("payload.value = newResult;"),f.write("return payload;");const b=f.compile();return(k,S)=>b(p,k,S)};let i;const s=mr,a=!Yc.jitless,u=a&&zp.value,d=t.catchall;let h;e._zod.parse=(p,f)=>{h??(h=r.value);const x=p.value;return s(x)?a&&u&&f?.async===!1&&f.jitless!==!0?(i||(i=o(t.shape)),p=i(p,f),d?pu([],x,p,f,h,e):p):n(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),p)}});function Na(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!Tn(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>Qt(s,r,Xt())))}),t)}const mu=Q("$ZodUnion",(e,t)=>{Ue.init(e,t),Ae(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Ae(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Ae(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Ae(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>ks(i.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let s=!1;const a=[];for(const c of t.options){const u=c._zod.run({value:o.value,issues:[]},i);if(u instanceof Promise)a.push(u),s=!0;else{if(u.issues.length===0)return u;a.push(u)}}return s?Promise.all(a).then(c=>Na(c,o,e,i)):Na(a,o,e,i)}}),bg=Q("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,mu.init(e,t);const n=e._zod.parse;Ae(e._zod,"propValues",()=>{const o={};for(const i of t.options){const s=i._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[a,c]of Object.entries(s)){o[a]||(o[a]=new Set);for(const u of c)o[a].add(u)}}return o});const r=Co(()=>{const o=t.options,i=new Map;for(const s of o){const a=s._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const c of a){if(i.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,s)}}return i});e._zod.parse=(o,i)=>{const s=o.value;if(!mr(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;const a=r.value.get(s?.[t.discriminator]);return a?a._zod.run(o,i):t.unionFallback?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),o)}}),wg=Q("$ZodIntersection",(e,t)=>{Ue.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>Ta(n,c,u)):Ta(n,i,s)}});function Li(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(Ln(e)&&Ln(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};for(const i of r){const s=Li(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],s=Li(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Ta(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 i=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(i.length&&o&&e.issues.push({...o,keys:i}),Tn(e))return e;const s=Li(t.value,n.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}const kg=Q("$ZodRecord",(e,t)=>{Ue.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Ln(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],s=t.keyType._zod.values;if(s){n.value={};const a=new Set;for(const u of s)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?i.push(d.then(h=>{h.issues.length&&n.issues.push(...An(u,h.issues)),n.value[u]=h.value})):(d.issues.length&&n.issues.push(...An(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"&&au.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=>Qt(h,r,Xt())),input:a,path:[a],inst:e});continue}const d=t.valueType._zod.run({value:o[a],issues:[]},r);d instanceof Promise?i.push(d.then(h=>{h.issues.length&&n.issues.push(...An(a,h.issues)),n.value[c.value]=h.value})):(d.issues.length&&n.issues.push(...An(a,d.issues)),n.value[c.value]=d.value)}}return i.length?Promise.all(i).then(()=>n):n}}),_g=Q("$ZodEnum",(e,t)=>{Ue.init(e,t);const n=Xc(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Pp.has(typeof o)).map(o=>typeof o=="string"?Fn(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:n,input:s,inst:e}),o}}),Sg=Q("$ZodLiteral",(e,t)=>{if(Ue.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"?Fn(r):r?Fn(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),Cg=Q("$ZodTransform",(e,t)=>{Ue.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Jc(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(n.value=s,n));if(o instanceof Promise)throw new Pn;return n.value=o,n}});function Aa(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const gu=Q("$ZodOptional",(e,t)=>{Ue.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ae(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ae(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ks(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Aa(i,n.value)):Aa(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),jg=Q("$ZodExactOptional",(e,t)=>{gu.init(e,t),Ae(e._zod,"values",()=>t.innerType._zod.values),Ae(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Eg=Q("$ZodNullable",(e,t)=>{Ue.init(e,t),Ae(e._zod,"optin",()=>t.innerType._zod.optin),Ae(e._zod,"optout",()=>t.innerType._zod.optout),Ae(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ks(n.source)}|null)$`):void 0}),Ae(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)}),Ng=Q("$ZodDefault",(e,t)=>{Ue.init(e,t),e._zod.optin="optional",Ae(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Ia(i,t)):Ia(o,t)}});function Ia(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Tg=Q("$ZodPrefault",(e,t)=>{Ue.init(e,t),e._zod.optin="optional",Ae(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))}),Ag=Q("$ZodNonOptional",(e,t)=>{Ue.init(e,t),Ae(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>za(i,e)):za(o,e)}});function za(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 Ig=Q("$ZodCatch",(e,t)=>{Ue.init(e,t),Ae(e._zod,"optin",()=>t.innerType._zod.optin),Ae(e._zod,"optout",()=>t.innerType._zod.optout),Ae(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(s=>Qt(s,r,Xt()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>Qt(i,r,Xt()))},input:n.value}),n.issues=[]),n)}}),zg=Q("$ZodPipe",(e,t)=>{Ue.init(e,t),Ae(e._zod,"values",()=>t.in._zod.values),Ae(e._zod,"optin",()=>t.in._zod.optin),Ae(e._zod,"optout",()=>t.out._zod.optout),Ae(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(s=>zr(s,t.in,r)):zr(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>zr(i,t.out,r)):zr(o,t.out,r)}});function zr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Pg=Q("$ZodReadonly",(e,t)=>{Ue.init(e,t),Ae(e._zod,"propValues",()=>t.innerType._zod.propValues),Ae(e._zod,"values",()=>t.innerType._zod.values),Ae(e._zod,"optin",()=>t.innerType?._zod?.optin),Ae(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(Pa):Pa(o)}});function Pa(e){return e.value=Object.freeze(e.value),e}const Rg=Q("$ZodLazy",(e,t)=>{Ue.init(e,t),Ae(e._zod,"innerType",()=>t.getter()),Ae(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Ae(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Ae(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Ae(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),Og=Q("$ZodCustom",(e,t)=>{ut.init(e,t),Ue.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>Ra(i,n,r,e));Ra(o,n,r,e)}});function Ra(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(gr(o))}}var Oa;class Dg{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 Mg(){return new Dg}(Oa=globalThis).__zod_globalRegistry??(Oa.__zod_globalRegistry=Mg());const ur=globalThis.__zod_globalRegistry;function Lg(e,t){return new e({type:"string",...ye(t)})}function Fg(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ye(t)})}function Da(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ye(t)})}function $g(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ye(t)})}function Bg(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ye(t)})}function Ug(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ye(t)})}function Zg(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ye(t)})}function Vg(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ye(t)})}function Wg(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ye(t)})}function Hg(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ye(t)})}function qg(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ye(t)})}function Kg(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ye(t)})}function Gg(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ye(t)})}function Jg(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ye(t)})}function Yg(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ye(t)})}function Xg(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ye(t)})}function Qg(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ye(t)})}function ex(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ye(t)})}function tx(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ye(t)})}function nx(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ye(t)})}function rx(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ye(t)})}function ox(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ye(t)})}function ix(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ye(t)})}function sx(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 lx(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ye(t)})}function cx(e,t){return new e({type:"string",format:"duration",check:"string_format",...ye(t)})}function ux(e,t){return new e({type:"number",checks:[],...ye(t)})}function dx(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ye(t)})}function fx(e,t){return new e({type:"boolean",...ye(t)})}function hx(e,t){return new e({type:"null",...ye(t)})}function px(e){return new e({type:"unknown"})}function mx(e,t){return new e({type:"never",...ye(t)})}function Ma(e,t){return new cu({check:"less_than",...ye(t),value:e,inclusive:!1})}function si(e,t){return new cu({check:"less_than",...ye(t),value:e,inclusive:!0})}function La(e,t){return new uu({check:"greater_than",...ye(t),value:e,inclusive:!1})}function ai(e,t){return new uu({check:"greater_than",...ye(t),value:e,inclusive:!0})}function Fa(e,t){return new Em({check:"multiple_of",...ye(t),value:e})}function xu(e,t){return new Tm({check:"max_length",...ye(t),maximum:e})}function no(e,t){return new Am({check:"min_length",...ye(t),minimum:e})}function yu(e,t){return new Im({check:"length_equals",...ye(t),length:e})}function gx(e,t){return new zm({check:"string_format",format:"regex",...ye(t),pattern:e})}function xx(e){return new Pm({check:"string_format",format:"lowercase",...ye(e)})}function yx(e){return new Rm({check:"string_format",format:"uppercase",...ye(e)})}function vx(e,t){return new Om({check:"string_format",format:"includes",...ye(t),includes:e})}function bx(e,t){return new Dm({check:"string_format",format:"starts_with",...ye(t),prefix:e})}function wx(e,t){return new Mm({check:"string_format",format:"ends_with",...ye(t),suffix:e})}function qn(e){return new Lm({check:"overwrite",tx:e})}function kx(e){return qn(t=>t.normalize(e))}function _x(){return qn(e=>e.trim())}function Sx(){return qn(e=>e.toLowerCase())}function Cx(){return qn(e=>e.toUpperCase())}function jx(){return qn(e=>Ip(e))}function Ex(e,t,n){return new e({type:"array",element:t,...ye(n)})}function Nx(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ye(n)})}function Tx(e){const t=Ax(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(gr(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(gr(o))}},e(n.value,n)));return t}function Ax(e,t){const n=new ut({check:"custom",...ye(t)});return n._zod.check=e,n}function vu(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??ur,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Ke(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s);const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const d={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,d);else{const p=s.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&&(s.ref||(s.ref=h),Ke(h,t,d),t.seen.get(h).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(s.schema,c),t.io==="input"&&ot(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&s.schema._prefault&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function bu(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 s of e.seen.entries()){const a=e.metadataRegistry.get(s[0])?.id;if(a){const c=r.get(a);if(c&&c!==s[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,s[0])}}const o=s=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const h=e.external.registry.get(s[0])?.id,p=e.external.uri??(x=>x);if(h)return{ref:p(h)};const f=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=f,{defId:f,ref:`${p("__shared")}#/${a}/${f}`}}if(s[1]===n)return{ref:"#"};const u=`#/${a}/`,d=s[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},i=s=>{if(s[1].schema.$ref)return;const a=s[1],{ref:c,defId:u}=o(s);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 s of e.seen.entries()){const a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
38
+
39
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const s of e.seen.entries()){const a=s[1];if(t===s[0]){i(s);continue}if(e.external){const u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1&&e.reused==="ref"){i(s);continue}}}function wu(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=s=>{const a=e.seen.get(s);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),s._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=s._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:s,jsonSchema:c,path:a.path??[]})};for(const s of[...e.seen.entries()].reverse())r(s[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 s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(s)}Object.assign(o,n.def??n.schema);const i=e.external?.defs??{};for(const s of e.seen.entries()){const a=s[1];a.def&&a.defId&&(i[a.defId]=a.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const s=JSON.parse(JSON.stringify(o));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:ro(t,"input",e.processors),output:ro(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}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 Ix=(e,t={})=>n=>{const r=vu({...n,processors:t});return Ke(e,r),bu(r,e),wu(r,e)},ro=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r??{},s=vu({...o??{},target:i,io:t,processors:n});return Ke(e,s),bu(s,e),wu(s,e)},zx={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Px=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),a&&(o.format=zx[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}))])}},Rx=(e,t,n,r)=>{const o=n,{minimum:i,maximum:s,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 i=="number"&&(o.minimum=i,typeof d=="number"&&t.target!=="draft-04"&&(d>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof s=="number"&&(o.maximum=s,typeof u=="number"&&t.target!=="draft-04"&&(u<=s?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},Ox=(e,t,n,r)=>{n.type="boolean"},Dx=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},Mx=(e,t,n,r)=>{n.not={}},Lx=(e,t,n,r)=>{},Fx=(e,t,n,r)=>{const o=e._zod.def,i=Xc(o.entries);i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),n.enum=i},$x=(e,t,n,r)=>{const o=e._zod.def,i=[];for(const s of o.values)if(s===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){const s=i[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),i.every(s=>typeof s=="boolean")&&(n.type="boolean"),i.every(s=>s===null)&&(n.type="null"),n.enum=i},Bx=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Ux=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Zx=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;typeof s=="number"&&(o.minItems=s),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=Ke(i.element,t,{...r,path:[...r.path,"items"]})},Vx=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object",o.properties={};const s=i.shape;for(const u in s)o.properties[u]=Ke(s[u],t,{...r,path:[...r.path,"properties",u]});const a=new Set(Object.keys(s)),c=new Set([...a].filter(u=>{const d=i.shape[u]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));c.size>0&&(o.required=Array.from(c)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Ke(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Wx=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>Ke(a,t,{...r,path:[...r.path,i?"oneOf":"anyOf",c]}));i?n.oneOf=s:n.anyOf=s},Hx=(e,t,n,r)=>{const o=e._zod.def,i=Ke(o.left,t,{...r,path:[...r.path,"allOf",0]}),s=Ke(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];n.allOf=c},qx=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const s=i.keyType,c=s._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){const d=Ke(i.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(i.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Ke(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=s._zod.values;if(u){const d=[...u].filter(h=>typeof h=="string"||typeof h=="number");d.length>0&&(o.required=d)}},Kx=(e,t,n,r)=>{const o=e._zod.def,i=Ke(o.innerType,t,r),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},Gx=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Jx=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Yx=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Xx=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=s},Qx=(e,t,n,r)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Ke(i,t,r);const s=t.seen.get(e);s.ref=i},e0=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},ku=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},t0=(e,t,n,r)=>{const o=e._zod.innerType;Ke(o,t,r);const i=t.seen.get(e);i.ref=o},n0=Q("ZodISODateTime",(e,t)=>{Xm.init(e,t),He.init(e,t)});function r0(e){return sx(n0,e)}const o0=Q("ZodISODate",(e,t)=>{Qm.init(e,t),He.init(e,t)});function i0(e){return ax(o0,e)}const s0=Q("ZodISOTime",(e,t)=>{eg.init(e,t),He.init(e,t)});function a0(e){return lx(s0,e)}const l0=Q("ZodISODuration",(e,t)=>{tg.init(e,t),He.init(e,t)});function c0(e){return cx(l0,e)}const u0=(e,t)=>{nu.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Vp(e,n)},flatten:{value:n=>Zp(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Mi,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Mi,2)}},isEmpty:{get(){return e.issues.length===0}}})},bt=Q("ZodError",u0,{Parent:Error}),d0=Ss(bt),f0=Cs(bt),h0=jo(bt),p0=Eo(bt),m0=qp(bt),g0=Kp(bt),x0=Gp(bt),y0=Jp(bt),v0=Yp(bt),b0=Xp(bt),w0=Qp(bt),k0=em(bt),Ze=Q("ZodType",(e,t)=>(Ue.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ro(e,"input"),output:ro(e,"output")}}),e.toJSONSchema=Ix(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(nn(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)=>rn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>d0(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>h0(e,n,r),e.parseAsync=async(n,r)=>f0(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>p0(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>m0(e,n,r),e.decode=(n,r)=>g0(e,n,r),e.encodeAsync=async(n,r)=>x0(e,n,r),e.decodeAsync=async(n,r)=>y0(e,n,r),e.safeEncode=(n,r)=>v0(e,n,r),e.safeDecode=(n,r)=>b0(e,n,r),e.safeEncodeAsync=async(n,r)=>w0(e,n,r),e.safeDecodeAsync=async(n,r)=>k0(e,n,r),e.refine=(n,r)=>e.check(yy(n,r)),e.superRefine=n=>e.check(vy(n)),e.overwrite=n=>e.check(qn(n)),e.optional=()=>Za(e),e.exactOptional=()=>ry(e),e.nullable=()=>Va(e),e.nullish=()=>Za(Va(e)),e.nonoptional=n=>cy(e,n),e.array=()=>Oe(e),e.or=n=>qt([e,n]),e.and=n=>Y0(e,n),e.transform=n=>Wa(e,ty(n)),e.default=n=>sy(e,n),e.prefault=n=>ly(e,n),e.catch=n=>dy(e,n),e.pipe=n=>Wa(e,n),e.readonly=()=>py(e),e.describe=n=>{const r=e.clone();return ur.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return ur.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return ur.get(e);const r=e.clone();return ur.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),_u=Q("_ZodString",(e,t)=>{js.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Px(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(gx(...r)),e.includes=(...r)=>e.check(vx(...r)),e.startsWith=(...r)=>e.check(bx(...r)),e.endsWith=(...r)=>e.check(wx(...r)),e.min=(...r)=>e.check(no(...r)),e.max=(...r)=>e.check(xu(...r)),e.length=(...r)=>e.check(yu(...r)),e.nonempty=(...r)=>e.check(no(1,...r)),e.lowercase=r=>e.check(xx(r)),e.uppercase=r=>e.check(yx(r)),e.trim=()=>e.check(_x()),e.normalize=(...r)=>e.check(kx(...r)),e.toLowerCase=()=>e.check(Sx()),e.toUpperCase=()=>e.check(Cx()),e.slugify=()=>e.check(jx())}),_0=Q("ZodString",(e,t)=>{js.init(e,t),_u.init(e,t),e.email=n=>e.check(Fg(S0,n)),e.url=n=>e.check(Vg(C0,n)),e.jwt=n=>e.check(ix($0,n)),e.emoji=n=>e.check(Wg(j0,n)),e.guid=n=>e.check(Da($a,n)),e.uuid=n=>e.check($g(Pr,n)),e.uuidv4=n=>e.check(Bg(Pr,n)),e.uuidv6=n=>e.check(Ug(Pr,n)),e.uuidv7=n=>e.check(Zg(Pr,n)),e.nanoid=n=>e.check(Hg(E0,n)),e.guid=n=>e.check(Da($a,n)),e.cuid=n=>e.check(qg(N0,n)),e.cuid2=n=>e.check(Kg(T0,n)),e.ulid=n=>e.check(Gg(A0,n)),e.base64=n=>e.check(nx(M0,n)),e.base64url=n=>e.check(rx(L0,n)),e.xid=n=>e.check(Jg(I0,n)),e.ksuid=n=>e.check(Yg(z0,n)),e.ipv4=n=>e.check(Xg(P0,n)),e.ipv6=n=>e.check(Qg(R0,n)),e.cidrv4=n=>e.check(ex(O0,n)),e.cidrv6=n=>e.check(tx(D0,n)),e.e164=n=>e.check(ox(F0,n)),e.datetime=n=>e.check(r0(n)),e.date=n=>e.check(i0(n)),e.time=n=>e.check(a0(n)),e.duration=n=>e.check(c0(n))});function K(e){return Lg(_0,e)}const He=Q("ZodStringFormat",(e,t)=>{Ve.init(e,t),_u.init(e,t)}),S0=Q("ZodEmail",(e,t)=>{Zm.init(e,t),He.init(e,t)}),$a=Q("ZodGUID",(e,t)=>{Bm.init(e,t),He.init(e,t)}),Pr=Q("ZodUUID",(e,t)=>{Um.init(e,t),He.init(e,t)}),C0=Q("ZodURL",(e,t)=>{Vm.init(e,t),He.init(e,t)}),j0=Q("ZodEmoji",(e,t)=>{Wm.init(e,t),He.init(e,t)}),E0=Q("ZodNanoID",(e,t)=>{Hm.init(e,t),He.init(e,t)}),N0=Q("ZodCUID",(e,t)=>{qm.init(e,t),He.init(e,t)}),T0=Q("ZodCUID2",(e,t)=>{Km.init(e,t),He.init(e,t)}),A0=Q("ZodULID",(e,t)=>{Gm.init(e,t),He.init(e,t)}),I0=Q("ZodXID",(e,t)=>{Jm.init(e,t),He.init(e,t)}),z0=Q("ZodKSUID",(e,t)=>{Ym.init(e,t),He.init(e,t)}),P0=Q("ZodIPv4",(e,t)=>{ng.init(e,t),He.init(e,t)}),R0=Q("ZodIPv6",(e,t)=>{rg.init(e,t),He.init(e,t)}),O0=Q("ZodCIDRv4",(e,t)=>{og.init(e,t),He.init(e,t)}),D0=Q("ZodCIDRv6",(e,t)=>{ig.init(e,t),He.init(e,t)}),M0=Q("ZodBase64",(e,t)=>{sg.init(e,t),He.init(e,t)}),L0=Q("ZodBase64URL",(e,t)=>{lg.init(e,t),He.init(e,t)}),F0=Q("ZodE164",(e,t)=>{cg.init(e,t),He.init(e,t)}),$0=Q("ZodJWT",(e,t)=>{dg.init(e,t),He.init(e,t)}),Su=Q("ZodNumber",(e,t)=>{fu.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Rx(e,r,o),e.gt=(r,o)=>e.check(La(r,o)),e.gte=(r,o)=>e.check(ai(r,o)),e.min=(r,o)=>e.check(ai(r,o)),e.lt=(r,o)=>e.check(Ma(r,o)),e.lte=(r,o)=>e.check(si(r,o)),e.max=(r,o)=>e.check(si(r,o)),e.int=r=>e.check(Ba(r)),e.safe=r=>e.check(Ba(r)),e.positive=r=>e.check(La(0,r)),e.nonnegative=r=>e.check(ai(0,r)),e.negative=r=>e.check(Ma(0,r)),e.nonpositive=r=>e.check(si(0,r)),e.multipleOf=(r,o)=>e.check(Fa(r,o)),e.step=(r,o)=>e.check(Fa(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 ux(Su,e)}const B0=Q("ZodNumberFormat",(e,t)=>{fg.init(e,t),Su.init(e,t)});function Ba(e){return dx(B0,e)}const U0=Q("ZodBoolean",(e,t)=>{hg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ox(e,n,r)});function nt(e){return fx(U0,e)}const Z0=Q("ZodNull",(e,t)=>{pg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Dx(e,n,r)});function Fi(e){return hx(Z0,e)}const V0=Q("ZodUnknown",(e,t)=>{mg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lx()});function Ua(){return px(V0)}const W0=Q("ZodNever",(e,t)=>{gg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mx(e,n,r)});function H0(e){return mx(W0,e)}const q0=Q("ZodArray",(e,t)=>{xg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zx(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(no(n,r)),e.nonempty=n=>e.check(no(1,n)),e.max=(n,r)=>e.check(xu(n,r)),e.length=(n,r)=>e.check(yu(n,r)),e.unwrap=()=>e.element});function Oe(e,t){return Ex(q0,e,t)}const K0=Q("ZodObject",(e,t)=>{vg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vx(e,n,r,o),Ae(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:Ua()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ua()}),e.strict=()=>e.clone({...e._zod.def,catchall:H0()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Lp(e,n),e.safeExtend=n=>Fp(e,n),e.merge=n=>$p(e,n),e.pick=n=>Dp(e,n),e.omit=n=>Mp(e,n),e.partial=(...n)=>Bp(ju,e,n[0]),e.required=(...n)=>Up(Eu,e,n[0])});function ae(e,t){const n={type:"object",shape:e??{},...ye(t)};return new K0(n)}const Cu=Q("ZodUnion",(e,t)=>{mu.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wx(e,n,r,o),e.options=t.options});function qt(e,t){return new Cu({type:"union",options:e,...ye(t)})}const G0=Q("ZodDiscriminatedUnion",(e,t)=>{Cu.init(e,t),bg.init(e,t)});function xn(e,t,n){return new G0({type:"union",options:t,discriminator:e,...ye(n)})}const J0=Q("ZodIntersection",(e,t)=>{wg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hx(e,n,r,o)});function Y0(e,t){return new J0({type:"intersection",left:e,right:t})}const X0=Q("ZodRecord",(e,t)=>{kg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qx(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Vt(e,t,n){return new X0({type:"record",keyType:e,valueType:t,...ye(n)})}const $i=Q("ZodEnum",(e,t)=>{_g.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Fx(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const s of r)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new $i({...t,checks:[],...ye(o),entries:i})},e.exclude=(r,o)=>{const i={...t.entries};for(const s of r)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new $i({...t,checks:[],...ye(o),entries:i})}});function lt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new $i({type:"enum",entries:n,...ye(t)})}const Q0=Q("ZodLiteral",(e,t)=>{Sg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$x(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 Q0({type:"literal",values:Array.isArray(e)?e:[e],...ye(t)})}const ey=Q("ZodTransform",(e,t)=>{Cg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ux(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Jc(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(gr(i,n.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),n.issues.push(gr(s))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function ty(e){return new ey({type:"transform",transform:e})}const ju=Q("ZodOptional",(e,t)=>{gu.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ku(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Za(e){return new ju({type:"optional",innerType:e})}const ny=Q("ZodExactOptional",(e,t)=>{jg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ku(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ry(e){return new ny({type:"optional",innerType:e})}const oy=Q("ZodNullable",(e,t)=>{Eg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Kx(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Va(e){return new oy({type:"nullable",innerType:e})}const iy=Q("ZodDefault",(e,t)=>{Ng.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jx(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function sy(e,t){return new iy({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():eu(t)}})}const ay=Q("ZodPrefault",(e,t)=>{Tg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yx(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ly(e,t){return new ay({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():eu(t)}})}const Eu=Q("ZodNonOptional",(e,t)=>{Ag.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gx(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function cy(e,t){return new Eu({type:"nonoptional",innerType:e,...ye(t)})}const uy=Q("ZodCatch",(e,t)=>{Ig.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xx(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function dy(e,t){return new uy({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const fy=Q("ZodPipe",(e,t)=>{zg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qx(e,n,r,o),e.in=t.in,e.out=t.out});function Wa(e,t){return new fy({type:"pipe",in:e,out:t})}const hy=Q("ZodReadonly",(e,t)=>{Pg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>e0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function py(e){return new hy({type:"readonly",innerType:e})}const my=Q("ZodLazy",(e,t)=>{Rg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>t0(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function gy(e){return new my({type:"lazy",getter:e})}const xy=Q("ZodCustom",(e,t)=>{Og.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bx(e,n)});function yy(e,t={}){return Nx(xy,e,t)}function vy(e){return Tx(e)}const $n=gy(()=>qt([K(),ve(),nt(),Fi(),Oe($n),Vt(K(),$n)])),Es=ae({type:K(),ttl:K().optional(),scope:K().optional()}),Ns=ae({type:Se("text"),text:K(),cache_control:Es.optional()}),Nu=ae({type:Se("thinking"),thinking:K(),signature:K().optional()}),by=ae({type:Se("think"),thinking:K(),signature:K().optional()}),wy=ae({type:Se("base64"),media_type:K(),data:K()}),Tu=ae({type:Se("image"),source:wy}),Au=ae({type:Se("tool_use"),id:K(),name:K(),input:Vt(K(),$n)}),ky=xn("type",[Ns,Tu]),_y=ae({type:Se("tool_result"),tool_use_id:K().optional(),content:qt([K(),Oe(ky)]),is_error:nt().optional()}),Sy=xn("type",[Ns,Nu,Tu,Au,_y]),Cy=qt([K(),Oe(Sy)]),jy=ae({role:lt(["user","assistant"]),content:Cy}),Ey=ae({type:Se("text"),text:K(),cache_control:Es.optional()}),Ny=ae({type:K(),properties:Vt(K(),Vt(K(),$n)).optional(),required:Oe(K()).optional(),additionalProperties:nt().optional(),$schema:K().optional()}),Ty=ae({name:K(),description:K().optional(),input_schema:Ny.optional(),cache_control:Es.optional()}),Ay=xn("type",[ae({type:Se("enabled"),budget_tokens:ve()}),ae({type:Se("disabled")}),ae({type:Se("adaptive")})]),Iy=ae({model:K(),messages:Oe(jy),system:Oe(Ey).optional(),tools:Oe(Ty).optional(),max_tokens:ve().optional(),temperature:ve().optional(),stream:nt().optional(),thinking:Ay.optional(),metadata:ae({user_id:K().optional()}).optional()}),Ts=xn("type",[Ns,Nu,by,Au]),zy=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(),Py=ae({id:K(),type:Se("message"),model:K(),role:Se("assistant"),content:Oe(Ts),stop_reason:K().nullable(),stop_sequence:K().nullable().optional(),usage:zy}).passthrough(),Ry=ae({type:Se("message_start"),message:ae({id:K(),type:Se("message"),model:K(),role:Se("assistant"),content:Oe(Ts),stop_reason:Fi(),stop_sequence:Fi(),usage:ae({input_tokens:ve(),cache_creation_input_tokens:ve().optional(),cache_read_input_tokens:ve().optional()}).passthrough()})}),Oy=ae({type:Se("content_block_start"),index:ve(),content_block:Ts}),Dy=xn("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()})]),My=ae({type:Se("content_block_delta"),index:ve(),delta:Dy}),Ly=ae({type:Se("content_block_stop"),index:ve()}),Fy=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()}),$y=ae({type:Se("message_stop")}),By=ae({type:Se("ping")}),Uy=ae({type:Se("error"),error:ae({type:K(),message:K()})});xn("type",[Ry,Oy,My,Ly,Fy,$y,By,Uy]);const Zy=Iy,Iu=Py,Vy=qt([K(),Oe(xn("type",[ae({type:Se("text"),text:K()}),ae({type:Se("image_url"),image_url:ae({url:K(),detail:K().optional()})})]))]),zu=ae({role:lt(["system","user","assistant","tool"]),content:Vy,name:K().optional(),reasoning_content:K().optional(),thinking:K().optional(),think:K().optional()}),Wy=ae({name:K(),arguments:K()}),Pu=ae({index:ve().optional(),id:K().optional(),type:Se("function").optional(),function:ae({name:K().optional(),arguments:K().optional()})});zu.extend({content:qt([K(),Oe(ae({type:Se("text"),text:K()}))]).optional(),function_call:Wy.optional(),tool_calls:Oe(Pu).optional()});const Hy=ae({type:Se("function"),function:ae({name:K(),description:K().optional(),parameters:Vt(K(),$n)})}),Ha=ae({model:K(),messages:Oe(zu),temperature:ve().optional(),max_tokens:ve().optional(),stream:nt().optional(),tools:Oe(Hy).optional(),tool_choice:qt([lt(["auto","none","required"]),ae({type:Se("auto")}),ae({type:Se("none")}),ae({type:Se("function"),function:ae({name:K()})})]).optional(),user:K().optional()}),Ru=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:Oe(ae({index:ve(),id:K().optional(),type:Se("function").optional(),function:ae({name:K().optional(),arguments:K().optional()})})).nullable().optional()}),qy=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:Oe(Pu).optional()}).optional(),delta:Ru.optional(),finish_reason:K().nullable()}),Ky=ae({id:K(),object:Se("chat.completion"),created:ve(),model:K(),choices:Oe(qy),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();ae({id:K(),object:Se("chat.completion.chunk"),created:ve(),model:K(),choices:Oe(ae({index:ve(),delta:Ru,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 Ou(e){try{const t=JSON.parse(e),n=Ky.safeParse(t);return n.success?n.data:null}catch{return null}}const Du=ae({index:ve(),timestamp:ve(),type:K(),data:$n}),Gy=ae({chunks:Oe(Du),truncated:nt().optional().default(!1)}),Bi=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:nt(),userAgent:K().nullable(),origin:K().nullable(),rawHeaders:Vt(K(),K()).optional(),headers:Vt(K(),K()).optional(),apiFormat:lt(["anthropic","openai","unknown"]).default("unknown"),isTest:nt().optional().default(!1),providerName:K().nullable().optional(),clientPort:ve().nullable().optional(),clientPid:ve().nullable().optional(),clientCwd:K().nullable().optional(),clientProjectFolder:K().nullable().optional(),streamingChunks:Gy.optional(),streamingChunksPath:K().nullable().optional(),error:K().nullable().optional()});ae({model:K()});ae({model:K().optional(),metadata:ae({user_id:K().optional()}).passthrough().optional()});function oo(e){if(e===null)return null;try{const t=JSON.parse(e),n=Zy.safeParse(t);return n.success?n.data:null}catch{return null}}const Jy=ae({error:K()});async function Nn(e,t){const n=await e.json();return t.parse(n)}async function Kr(e,t){try{const n=await e.json(),r=Jy.safeParse(n);return r.success?r.data.error:t}catch{return t}}async function As(e,t,n,r){const o=await fetch(e,n);if(!o.ok){const i=r?.(o)??`Request failed with status ${o.status}`;throw new Error(await Kr(o,i))}return Nn(o,t)}const Mu=ae({stripClaudeCodeBillingHeader:nt()}),Ui="/api/config";async function Yy(e){return As(e,Mu,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function Xy(e){return As(Ui,Mu,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function Lu(){const e=Kc(Ui,Yy,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=Np(),n=e.data?.stripClaudeCodeBillingHeader??!1,r=async o=>{await t(Ui,Xy({stripClaudeCodeBillingHeader:o}),{optimisticData:{stripClaudeCodeBillingHeader:o},rollbackOnError:!0,revalidate:!1})};return{strip:n,isLoading:e.isLoading,isError:e.error!==void 0,setStrip:r}}function Qy(e,t,n){const r=new Array(e);return new Proxy(r,{get(o,i,s){if(typeof i=="string"){const a=i.charCodeAt(0);if(a>=48&&a<=57){const c=+i;if(Number.isInteger(c)&&c>=0&&c<e){let u=o[c];if(!u){const d=t[c*2];u=o[c]={index:c,key:n(c),start:d,size:t[c*2+1],end:d+t[c*2+1],lane:0}}return u}}if(i==="length")return e}return Reflect.get(o,i,s)}})}function wn(e,t,n){let r=n.initialDeps??[],o,i=!0;function s(){const a=e();return(a.length!==r.length||a.some((u,d)=>r[d]!==u))&&(r=a,o=t(...a),n?.onChange&&!(i&&n.skipInitialOnChange)&&n.onChange(o),i=!1),o}return s.updateDeps=a=>{r=a},s}function qa(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const Ka=(e,t)=>Math.abs(e-t)<1.01,ev=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}};let nr;const Ga=()=>{if(nr!==void 0)return nr;if(typeof navigator>"u")return nr=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return nr=!0;const e=navigator.maxTouchPoints;return nr=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Ja=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},tv=e=>e,nv=e=>{const t=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,o=new Array(r);for(let i=0;i<r;i++)o[i]=t+i;return o},rv=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=s=>{const{width:a,height:c}=s;t({width:Math.round(a),height:Math.round(c)})};if(o(Ja(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(s=>{const a=()=>{const c=s[0];if(c?.borderBoxSize){const u=c.borderBoxSize[0];if(u){o({width:u.inlineSize,height:u.blockSize});return}}o(Ja(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},io={passive:!0},ov=typeof window>"u"?!0:"onscrollend"in window,iv=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const o=e.targetWindow;if(!o)return;const i=e.options.useScrollendEvent&&ov;let s=0;const a=i?null:ev(o,()=>t(s,!1),e.options.isScrollingResetDelay),c=h=>()=>{s=n(r),a?.(),t(s,h)},u=c(!0),d=c(!1);return r.addEventListener("scroll",u,io),i&&r.addEventListener("scrollend",d,io),()=>{r.removeEventListener("scroll",u),i&&r.removeEventListener("scrollend",d)}},sv=(e,t)=>iv(e,t,n=>{const{horizontal:r,isRtl:o}=e.options;return r?n.scrollLeft*(o&&-1||1):n.scrollTop}),av=(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"]},lv=(e,{adjustments:t=0,behavior:n},r)=>{var o,i;(i=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||i.call(o,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})},cv=lv;class uv{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,r,o;return((o=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:o.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(o=>{o.forEach(i=>{const s=()=>{const a=i.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,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()})}));return{disconnect:()=>{var o;(o=r())==null||o.disconnect(),n=null},observe:o=>{var i;return(i=r())==null?void 0:i.observe(o,{box:"border-box"})},unobserve:o=>{var i;return(i=r())==null?void 0:i.unobserve(o)}}})(),this.range=null,this.setOptions=n=>{var r,o;const i={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:tv,rangeExtractor:nv,onChange:()=>{},measureElement:av,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate"};for(const u in n){const d=n[u];d!==void 0&&(i[u]=d)}const s=this.options;let a=null,c=null;if(s!==void 0&&s.enabled&&i.enabled&&i.anchorTo==="end"&&this.scrollElement!==null){const u=s.count,d=i.count,h=this.getMeasurements(),p=u>0?((r=h[0])==null?void 0:r.key)??s.getItemKey(0):null,f=u>0?((o=h[u-1])==null?void 0:o.key)??s.getItemKey(u-1):null;if(d!==u||u>0&&d>0&&(i.getItemKey(0)!==p||i.getItemKey(d-1)!==f)){const y=u>0?this.getVirtualItemForOffset(this.getScrollOffset())??h[0]:null;y&&(a=[y.key,this.getScrollOffset()-y.start]);const g=i.followOnAppend===!0?"auto":i.followOnAppend||null;g&&d>u&&this.isAtEnd(s.scrollEndThreshold)&&(u===0||i.getItemKey(d-1)!==f)&&(c=g)}}this.options=i,(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=wn(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(i=>{this.observer.observe(i)}),this.unsubs.push(this.options.observeElementRect(this,i=>{this.scrollRect=i,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(i,s)=>{this._intendedScrollOffset!==null&&Math.abs(i-this._intendedScrollOffset)<1.5&&(i=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=s?this.getScrollOffset()<i?"forward":"backward":null,this.scrollOffset=i,this.isScrolling=s,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const i=this.scrollElement,s=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},a=()=>{this._iosTouching=!1,!(!Ga()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};i.addEventListener("touchstart",s,io),i.addEventListener("touchend",a,io),this.unsubs.push(()=>{i.removeEventListener("touchstart",s),i.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[i,s,a]=o;if(i!==null){const{count:c,getItemKey:u}=this.options;let d=0;for(;d<c&&u(d)!==i;)d++;const h=d<c?this.getMeasurements()[d]:void 0;if(h){const p=h.start+s-this.getScrollOffset();Ka(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,i=new Map;for(let s=r-1;s>=0;s--){const a=n[s];if(o.has(a.lane))continue;const c=i.get(a.lane);if(c==null||a.end>c.end?i.set(a.lane,a):a.end<c.end&&o.set(a.lane,!0),o.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((s,a)=>s.end===a.end?s.index-a.index:s.end-a.end)[0]:void 0},this.getMeasurementOptions=wn(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,r,o,i,s,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:i,enabled:s,lanes:a,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=wn(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:o,getItemKey:i,enabled:s,lanes:a,laneAssignmentMode:c},u)=>{const d=this.itemSizeCache;if(!s)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const x of this.laneAssignments.keys())x>=n&&this.laneAssignments.delete(x);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(x=>{this.itemSizeCache.set(x.key,x.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 x=this.options.gap,m=n*2;let y=this._flatMeasurements;if(!y||y.length<m){const k=new Float64Array(m);y&&h>0&&k.set(y.subarray(0,h*2)),y=k,this._flatMeasurements=y}let g;if(h===0)g=r+o;else{const k=h-1;g=y[k*2]+y[k*2+1]+x}for(let k=h;k<n;k++){const S=i(k),N=d.get(S),C=typeof N=="number"?N:this.options.estimateSize(k);y[k*2]=g,y[k*2+1]=C,g+=C+x}const b=Qy(n,y,i);return this.measurementsCache=b,b}const p=this.measurementsCache.slice(0,h),f=new Array(a).fill(void 0);for(let x=0;x<h;x++){const m=p[x];m&&(f[m.lane]=x)}for(let x=h;x<n;x++){const m=i(x),y=this.laneAssignments.get(x);let g,b;const k=c==="estimate"||d.has(m);if(y!==void 0&&this.options.lanes>1){g=y;const E=f[g],T=E!==void 0?p[E]:void 0;b=T?T.end+this.options.gap:r+o}else{const E=this.options.lanes===1?p[x-1]:this.getFurthestMeasurement(p,x);b=E?E.end+this.options.gap:r+o,g=E?E.lane:x%this.options.lanes,this.options.lanes>1&&k&&this.laneAssignments.set(x,g)}const S=d.get(m),N=typeof S=="number"?S:this.options.estimateSize(x),C=b+N;p[x]={index:x,start:b,size:N,end:C,key:m,lane:g},f[g]=x}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=wn(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,i)=>this.range=n.length>0&&r>0?dv({measurements:n,outerSize:r,scrollOffset:o,lanes:i,flat:i===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=wn(()=>{let n=null,r=null;const o=this.calculateRange();return o&&(n=o.startIndex,r=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,o,i,s)=>i===null||s===null?[]:n({startIndex:i,endIndex:s,overscan:r,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,o=n.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(o!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),s=Math.max(0,o-i),a=Math.min(this.options.count-1,o+i);return n>=s&&n<=a}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((s,a)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(a))});return}const r=this.indexFromElement(n),o=this.options.getItemKey(r),i=this.elementsCache.get(o);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(o,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var o,i;if(n<0||n>=this.options.count)return;let s,a,c;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)c=this.options.getItemKey(n),a=u[n*2],s=u[n*2+1];else{const p=this.measurementsCache[n];if(!p)return;c=p.key,a=p.start,s=p.size}const d=this.itemSizeCache.get(c)??s,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,x=((i=this.scrollState)==null?void 0:i.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:c,start:a,size:s,end:a+s,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):x&&this.applyScrollAdjustment(h),this.notify(!1)}},this.getVirtualItems=wn(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let i=0,s=n.length;i<s;i++){const a=n[i],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,i=this.options.lanes===1&&o!=null,s=Fu(0,r.length-1,i?a=>o[a*2]:a=>qa(r[a]).start,n);return qa(r[s])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,r,o=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),s=this.getScrollOffset();r==="auto"&&(r=n>=s+i?"end":"start"),r==="center"?n+=(o-i)/2:r==="end"&&(n-=i);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(),i=this.getScrollOffset(),s=this.measurementsCache[n];if(!s)return;if(r==="auto")if(s.end>=i+o-this.options.scrollPaddingEnd)r="end";else if(s.start<=i+this.options.scrollPaddingStart)r="start";else return[i,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const a=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,r,s.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:o="auto"}={})=>{const i=this.getOffsetForAlignment(n,r),s=this.now();this.scrollState={index:null,align:r,behavior:o,startedAt:s,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:o="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const i=this.getOffsetForIndex(n,r);if(!i)return;const[s,a]=i,c=this.now();this.scrollState={index:n,align:a,behavior:o,startedAt:c,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const o=this.getScrollOffset()+n,i=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:i,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let o;if(r.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const i=r.length-1,s=this._flatMeasurements;s!=null?o=s[i*2]+s[i*2+1]:o=((n=r[i])==null?void 0:n.end)??0}else{const i=Array(this.options.lanes).fill(null);let s=r.length-1;for(;s>=0&&i.some(a=>a===null);){const a=r[s];i[a.lane]===null&&(i[a.lane]=a.end),s--}o=Math.max(...i.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&&(Ga()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:n}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=r?r[0]:this.scrollState.lastTargetOffset,i=1,s=o!==this.scrollState.lastTargetOffset;if(!s&&Ka(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,s){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 Fu=(e,t,n,r)=>{for(;e<=t;){const o=(e+t)/2|0,i=n(o);if(i<r)e=o+1;else if(i>r)t=o-1;else return o}return e>0?e-1:0};function dv({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:o}){const i=e.length-1,s=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:i};let c=Fu(0,i,s,n),u=c;if(r===1)for(;u<i&&a(u)<n+t;)u++;else if(r>1){const d=Array(r).fill(0);for(;u<i&&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(i,u+(r-1-u%r))}return{startIndex:c,endIndex:u}}const Ya=typeof document<"u"?v.useLayoutEffect:v.useEffect;function fv({useFlushSync:e=!0,...t}){const n=v.useReducer(i=>i+1,0)[1],r={...t,onChange:(i,s)=>{var a;e&&s?kr.flushSync(n):n(),(a=t.onChange)==null||a.call(t,i,s)}},[o]=v.useState(()=>new uv(r));return o.setOptions(r),Ya(()=>o._didMount(),[]),Ya(()=>o._willUpdate()),o}function $u(e){return fv({observeElementRect:rv,observeElementOffset:sv,scrollToFn:cv,...e})}const Bu=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const hv=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const pv=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const Xa=e=>{const t=pv(e);return t.charAt(0).toUpperCase()+t.slice(1)};var mv={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 gv=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const xv=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:s,...a},c)=>v.createElement("svg",{ref:c,...mv,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Bu("lucide",o),...!i&&!gv(a)&&{"aria-hidden":"true"},...a},[...s.map(([u,d])=>v.createElement(u,d)),...Array.isArray(i)?i:[i]]));const be=(e,t)=>{const n=v.forwardRef(({className:r,...o},i)=>v.createElement(xv,{ref:i,iconNode:t,className:Bu(`lucide-${hv(Xa(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Xa(e),n};const yv=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],vv=be("arrow-down",yv);const bv=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],wv=be("arrow-up",bv);const kv=[["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"}]],_v=be("brain",kv);const Sv=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],on=be("check",Sv);const Cv=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],vt=be("chevron-down",Cv);const jv=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],jt=be("chevron-right",jv);const Ev=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Nv=be("chevron-up",Ev);const Tv=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],Av=be("chevrons-down",Tv);const Iv=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],zv=be("chevrons-up",Iv);const Pv=[["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"}]],xr=be("circle-alert",Pv);const Rv=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Ov=be("circle-check-big",Rv);const Dv=[["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"}]],Mv=be("circle-question-mark",Dv);const Lv=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],Uu=be("circle-stop",Lv);const Fv=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],To=be("clock",Fv);const $v=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Zu=be("columns-2",$v);const Bv=[["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"}]],yn=be("copy",Bv);const Uv=[["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"}]],Is=be("download",Uv);const Zv=[["line",{x1:"5",x2:"19",y1:"9",y2:"9",key:"1nwqeh"}],["line",{x1:"5",x2:"19",y1:"15",y2:"15",key:"g8yjpy"}]],Vv=be("equal",Zv);const Wv=[["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"}]],Hv=be("external-link",Wv);const qv=[["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"}]],zs=be("eye-off",qv);const Kv=[["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"}]],Ps=be("eye",Kv);const Gv=[["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"}]],Jv=be("file-terminal",Gv);const Yv=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Xv=be("gauge",Yv);const Qv=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],Vu=be("git-branch",Qv);const eb=[["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"}]],Wu=be("git-compare-arrows",eb);const tb=[["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"}]],nb=be("globe",tb);const rb=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],ob=be("layout-grid",rb);const ib=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Qa=be("list",ib);const sb=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],yr=be("loader-circle",sb);const ab=[["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"}]],lb=be("lock",ab);const cb=[["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"}]],Hu=be("message-square",cb);const ub=[["path",{d:"M5 12h14",key:"1ays0h"}]],Rs=be("minus",ub);const db=[["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"}]],Os=be("pencil",db);const fb=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],so=be("plus",fb);const hb=[["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"}]],pb=be("radio",hb);const mb=[["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"}]],qu=be("rotate-ccw",mb);const gb=[["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"}]],Ku=be("rotate-cw",gb);const xb=[["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"}]],Gu=be("rows-3",xb);const yb=[["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"}]],vb=be("scan",yb);const bb=[["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"}]],wb=be("server",bb);const kb=[["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"}]],_b=be("settings",kb);const Sb=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Ju=be("terminal",Sb);const Cb=[["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"}]],jb=be("trash-2",Cb);const Eb=[["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"}]],Nb=be("triangle-alert",Eb);const Tb=[["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"}]],Ab=be("upload",Tb);const Ib=[["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"}]],zb=be("user",Ib);const Pb=[["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"}]],Rb=be("wifi-off",Pb);const Ob=[["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"}]],Db=be("wifi",Ob);const Mb=[["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"}]],el=be("wrench",Mb);const Lb=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Yu=be("x",Lb);const Fb=[["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"}]],_r=be("zap",Fb);function Xu(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=Xu(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Qu(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Xu(e))&&(r&&(r+=" "),r+=t);return r}const $b=(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},Bb=(e,t)=>({classGroupId:e,validator:t}),ed=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),ao="-",tl=[],Ub="arbitrary..",Zb=e=>{const t=Wb(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return Vb(s);const a=s.split(ao),c=a[0]===""&&a.length>1?1:0;return td(a,c,t)},getConflictingClassGroupIds:(s,a)=>{if(a){const c=r[s],u=n[s];return c?u?$b(u,c):c:u||tl}return n[s]||tl}}},td=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],i=n.nextPart.get(o);if(i){const u=td(e,t+1,i);if(u)return u}const s=n.validators;if(s===null)return;const a=t===0?e.join(ao):e.slice(t).join(ao),c=s.length;for(let u=0;u<c;u++){const d=s[u];if(d.validator(a))return d.classGroupId}},Vb=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?Ub+r:void 0})(),Wb=e=>{const{theme:t,classGroups:n}=e;return Hb(n,t)},Hb=(e,t)=>{const n=ed();for(const r in e){const o=e[r];Ds(o,n,r,t)}return n},Ds=(e,t,n,r)=>{const o=e.length;for(let i=0;i<o;i++){const s=e[i];qb(s,t,n,r)}},qb=(e,t,n,r)=>{if(typeof e=="string"){Kb(e,t,n);return}if(typeof e=="function"){Gb(e,t,n,r);return}Jb(e,t,n,r)},Kb=(e,t,n)=>{const r=e===""?t:nd(t,e);r.classGroupId=n},Gb=(e,t,n,r)=>{if(Yb(e)){Ds(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Bb(n,e))},Jb=(e,t,n,r)=>{const o=Object.entries(e),i=o.length;for(let s=0;s<i;s++){const[a,c]=o[s];Ds(c,nd(t,a),n,r)}},nd=(e,t)=>{let n=e;const r=t.split(ao),o=r.length;for(let i=0;i<o;i++){const s=r[i];let a=n.nextPart.get(s);a||(a=ed(),n.nextPart.set(s,a)),n=a}return n},Yb=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Xb=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(i,s)=>{n[i]=s,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(i){let s=n[i];if(s!==void 0)return s;if((s=r[i])!==void 0)return o(i,s),s},set(i,s){i in n?n[i]=s:o(i,s)}}},Zi="!",nl=":",Qb=[],rl=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),e1=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const i=[];let s=0,a=0,c=0,u;const d=o.length;for(let m=0;m<d;m++){const y=o[m];if(s===0&&a===0){if(y===nl){i.push(o.slice(c,m)),c=m+1;continue}if(y==="/"){u=m;continue}}y==="["?s++:y==="]"?s--:y==="("?a++:y===")"&&a--}const h=i.length===0?o:o.slice(c);let p=h,f=!1;h.endsWith(Zi)?(p=h.slice(0,-1),f=!0):h.startsWith(Zi)&&(p=h.slice(1),f=!0);const x=u&&u>c?u-c:void 0;return rl(i,f,p,x)};if(t){const o=t+nl,i=r;r=s=>s.startsWith(o)?i(s.slice(o.length)):rl(Qb,!1,s,void 0,!0)}if(n){const o=r;r=i=>n({className:i,parseClassName:o})}return r},t1=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let i=0;i<n.length;i++){const s=n[i],a=s[0]==="[",c=t.has(s);a||c?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(s)):o.push(s)}return o.length>0&&(o.sort(),r.push(...o)),r}},n1=e=>({cache:Xb(e.cacheSize),parseClassName:e1(e),sortModifiers:t1(e),...Zb(e)}),r1=/\s+/,o1=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:i}=t,s=[],a=e.trim().split(r1);let c="";for(let u=a.length-1;u>=0;u-=1){const d=a[u],{isExternal:h,modifiers:p,hasImportantModifier:f,baseClassName:x,maybePostfixModifierPosition:m}=n(d);if(h){c=d+(c.length>0?" "+c:c);continue}let y=!!m,g=r(y?x.substring(0,m):x);if(!g){if(!y){c=d+(c.length>0?" "+c:c);continue}if(g=r(x),!g){c=d+(c.length>0?" "+c:c);continue}y=!1}const b=p.length===0?"":p.length===1?p[0]:i(p).join(":"),k=f?b+Zi:b,S=k+g;if(s.indexOf(S)>-1)continue;s.push(S);const N=o(g,y);for(let C=0;C<N.length;++C){const E=N[C];s.push(k+E)}c=d+(c.length>0?" "+c:c)}return c},i1=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=rd(n))&&(o&&(o+=" "),o+=r);return o},rd=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=rd(e[r]))&&(n&&(n+=" "),n+=t);return n},s1=(e,...t)=>{let n,r,o,i;const s=c=>{const u=t.reduce((d,h)=>h(d),e());return n=n1(u),r=n.cache.get,o=n.cache.set,i=a,a(c)},a=c=>{const u=r(c);if(u)return u;const d=o1(c,n);return o(c,d),d};return i=s,(...c)=>i(i1(...c))},a1=[],Je=e=>{const t=n=>n[e]||a1;return t.isThemeGetter=!0,t},od=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,id=/^\((?:(\w[\w-]*):)?(.+)\)$/i,l1=/^\d+\/\d+$/,c1=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,u1=/\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$/,d1=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,f1=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,h1=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,kn=e=>l1.test(e),Ne=e=>!!e&&!Number.isNaN(Number(e)),Gt=e=>!!e&&Number.isInteger(Number(e)),li=e=>e.endsWith("%")&&Ne(e.slice(0,-1)),Zt=e=>c1.test(e),p1=()=>!0,m1=e=>u1.test(e)&&!d1.test(e),sd=()=>!1,g1=e=>f1.test(e),x1=e=>h1.test(e),y1=e=>!pe(e)&&!me(e),v1=e=>Kn(e,cd,sd),pe=e=>od.test(e),cn=e=>Kn(e,ud,m1),ci=e=>Kn(e,S1,Ne),ol=e=>Kn(e,ad,sd),b1=e=>Kn(e,ld,x1),Rr=e=>Kn(e,dd,g1),me=e=>id.test(e),rr=e=>Gn(e,ud),w1=e=>Gn(e,C1),il=e=>Gn(e,ad),k1=e=>Gn(e,cd),_1=e=>Gn(e,ld),Or=e=>Gn(e,dd,!0),Kn=(e,t,n)=>{const r=od.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Gn=(e,t,n=!1)=>{const r=id.exec(e);return r?r[1]?t(r[1]):n:!1},ad=e=>e==="position"||e==="percentage",ld=e=>e==="image"||e==="url",cd=e=>e==="length"||e==="size"||e==="bg-size",ud=e=>e==="length",S1=e=>e==="number",C1=e=>e==="family-name",dd=e=>e==="shadow",j1=()=>{const e=Je("color"),t=Je("font"),n=Je("text"),r=Je("font-weight"),o=Je("tracking"),i=Je("leading"),s=Je("breakpoint"),a=Je("container"),c=Je("spacing"),u=Je("radius"),d=Je("shadow"),h=Je("inset-shadow"),p=Je("text-shadow"),f=Je("drop-shadow"),x=Je("blur"),m=Je("perspective"),y=Je("aspect"),g=Je("ease"),b=Je("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"],N=()=>[...S(),me,pe],C=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],T=()=>[me,pe,c],R=()=>[kn,"full","auto",...T()],M=()=>[Gt,"none","subgrid",me,pe],L=()=>["auto",{span:["full",Gt,me,pe]},Gt,me,pe],j=()=>[Gt,"auto",me,pe],D=()=>["auto","min","max","fr",me,pe],w=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],P=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...T()],B=()=>[kn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],q=()=>[e,me,pe],X=()=>[...S(),il,ol,{position:[me,pe]}],A=()=>["no-repeat",{repeat:["","x","y","space","round"]}],W=()=>["auto","cover","contain",k1,v1,{size:[me,pe]}],V=()=>[li,rr,cn],I=()=>["","none","full",u,me,pe],oe=()=>["",Ne,rr,cn],Y=()=>["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,li,il,ol],ce=()=>["","none",x,me,pe],fe=()=>["none",Ne,me,pe],ge=()=>["none",Ne,me,pe],xe=()=>[Ne,me,pe],Ee=()=>[kn,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Zt],breakpoint:[Zt],color:[p1],container:[Zt],"drop-shadow":[Zt],ease:["in","out","in-out"],font:[y1],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Zt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Zt],shadow:[Zt],spacing:["px",Ne],text:[Zt],"text-shadow":[Zt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",kn,pe,me,y]}],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:N()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:R()}],"inset-x":[{"inset-x":R()}],"inset-y":[{"inset-y":R()}],start:[{start:R()}],end:[{end:R()}],top:[{top:R()}],right:[{right:R()}],bottom:[{bottom:R()}],left:[{left:R()}],visibility:["visible","invisible","collapse"],z:[{z:[Gt,"auto",me,pe]}],basis:[{basis:[kn,"full","auto",a,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ne,kn,"auto","initial","none",pe]}],grow:[{grow:["",Ne,me,pe]}],shrink:[{shrink:["",Ne,me,pe]}],order:[{order:[Gt,"first","last","none",me,pe]}],"grid-cols":[{"grid-cols":M()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":j()}],"col-end":[{"col-end":j()}],"grid-rows":[{"grid-rows":M()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":j()}],"row-end":[{"row-end":j()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...w(),"normal"]}],"justify-items":[{"justify-items":[...P(),"normal"]}],"justify-self":[{"justify-self":["auto",...P()]}],"align-content":[{content:["normal",...w()]}],"align-items":[{items:[...P(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...P(),{baseline:["","last"]}]}],"place-content":[{"place-content":w()}],"place-items":[{"place-items":[...P(),"baseline"]}],"place-self":[{"place-self":["auto",...P()]}],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:[s]},...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,rr,cn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,me,ci]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",li,pe]}],"font-family":[{font:[w1,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,ci]}],leading:[{leading:[i,...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:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ne,"from-font","auto",me,cn]}],"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:X()}],"bg-repeat":[{bg:A()}],"bg-size":[{bg:W()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Gt,me,pe],radial:["",me,pe],conic:[Gt,me,pe]},_1,b1]}],"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:I()}],"rounded-s":[{"rounded-s":I()}],"rounded-e":[{"rounded-e":I()}],"rounded-t":[{"rounded-t":I()}],"rounded-r":[{"rounded-r":I()}],"rounded-b":[{"rounded-b":I()}],"rounded-l":[{"rounded-l":I()}],"rounded-ss":[{"rounded-ss":I()}],"rounded-se":[{"rounded-se":I()}],"rounded-ee":[{"rounded-ee":I()}],"rounded-es":[{"rounded-es":I()}],"rounded-tl":[{"rounded-tl":I()}],"rounded-tr":[{"rounded-tr":I()}],"rounded-br":[{"rounded-br":I()}],"rounded-bl":[{"rounded-bl":I()}],"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:[...Y(),"hidden","none"]}],"divide-style":[{divide:[...Y(),"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:[...Y(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ne,me,pe]}],"outline-w":[{outline:["",Ne,rr,cn]}],"outline-color":[{outline:q()}],shadow:[{shadow:["","none",d,Or,Rr]}],"shadow-color":[{shadow:q()}],"inset-shadow":[{"inset-shadow":["none",h,Or,Rr]}],"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,cn]}],"ring-offset-color":[{"ring-offset":q()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":q()}],"text-shadow":[{"text-shadow":["none",p,Or,Rr]}],"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:X()}],"mask-repeat":[{mask:A()}],"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,Or,Rr]}],"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",g,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":N()}],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:N()}],"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,rr,cn,ci]}],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"]}},E1=s1(j1);function he(...e){return E1(Qu(e))}function Ye(e){return e>=1048576?(e/1048576).toFixed(1).replace(/\.0$/,"")+"M":e>=1024?(e/1024).toFixed(1).replace(/\.0$/,"")+"K":e.toString()}function fd(e){return e===null?"pending":e>=200&&e<300?"success":e>=400&&e<500?"client_error":e>=500?"server_error":"pending"}function sl(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function hd(...e){return t=>{let n=!1;const r=e.map(o=>{const i=sl(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():sl(e[o],null)}}}}function Le(...e){return v.useCallback(hd(...e),e)}function Bn(e){const t=T1(e),n=v.forwardRef((r,o)=>{const{children:i,...s}=r,a=v.Children.toArray(i),c=a.find(I1);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,{...s,ref:o,children:v.isValidElement(u)?v.cloneElement(u,void 0,d):null})}return l.jsx(t,{...s,ref:o,children:i})});return n.displayName=`${e}.Slot`,n}var N1=Bn("Slot");function T1(e){const t=v.forwardRef((n,r)=>{const{children:o,...i}=n;if(v.isValidElement(o)){const s=P1(o),a=z1(i,o.props);return o.type!==v.Fragment&&(a.ref=r?hd(r,s):s),v.cloneElement(o,a)}return v.Children.count(o)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var pd=Symbol("radix.slottable");function A1(e){const t=({children:n})=>l.jsx(l.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=pd,t}function I1(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===pd}function z1(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{const c=i(...a);return o(...a),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function P1(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 R1=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ce=R1.reduce((e,t)=>{const n=Bn(`Primitive.${t}`),r=v.forwardRef((o,i)=>{const{asChild:s,...a}=o,c=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:i})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function O1(e,t){e&&kr.flushSync(()=>e.dispatchEvent(t))}var md=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"}),D1="VisuallyHidden",gd=v.forwardRef((e,t)=>l.jsx(Ce.span,{...e,ref:t,style:{...md,...e.style}}));gd.displayName=D1;var M1=gd;function L1(e,t){const n=v.createContext(t),r=i=>{const{children:s,...a}=i,c=v.useMemo(()=>a,Object.values(a));return l.jsx(n.Provider,{value:c,children:s})};r.displayName=e+"Provider";function o(i){const s=v.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function Kt(e,t=[]){let n=[];function r(i,s){const a=v.createContext(s),c=n.length;n=[...n,s];const u=h=>{const{scope:p,children:f,...x}=h,m=p?.[e]?.[c]||a,y=v.useMemo(()=>x,Object.values(x));return l.jsx(m.Provider,{value:y,children:f})};u.displayName=i+"Provider";function d(h,p){const f=p?.[e]?.[c]||a,x=v.useContext(f);if(x)return x;if(s!==void 0)return s;throw new Error(`\`${h}\` must be used within \`${i}\``)}return[u,d]}const o=()=>{const i=n.map(s=>v.createContext(s));return function(a){const c=a?.[e]||i;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,F1(o,...t)]}function F1(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:c,scopeName:u})=>{const h=c(i)[`__scope${u}`];return{...a,...h}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function xd(e){const t=e+"CollectionProvider",[n,r]=Kt(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=m=>{const{scope:y,children:g}=m,b=at.useRef(null),k=at.useRef(new Map).current;return l.jsx(o,{scope:y,itemMap:k,collectionRef:b,children:g})};s.displayName=t;const a=e+"CollectionSlot",c=Bn(a),u=at.forwardRef((m,y)=>{const{scope:g,children:b}=m,k=i(a,g),S=Le(y,k.collectionRef);return l.jsx(c,{ref:S,children:b})});u.displayName=a;const d=e+"CollectionItemSlot",h="data-radix-collection-item",p=Bn(d),f=at.forwardRef((m,y)=>{const{scope:g,children:b,...k}=m,S=at.useRef(null),N=Le(y,S),C=i(d,g);return at.useEffect(()=>(C.itemMap.set(S,{ref:S,...k}),()=>{C.itemMap.delete(S)})),l.jsx(p,{[h]:"",ref:N,children:b})});f.displayName=d;function x(m){const y=i(e+"CollectionConsumer",m);return at.useCallback(()=>{const b=y.collectionRef.current;if(!b)return[];const k=Array.from(b.querySelectorAll(`[${h}]`));return Array.from(y.itemMap.values()).sort((C,E)=>k.indexOf(C.ref.current)-k.indexOf(E.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:s,Slot:u,ItemSlot:f},x,r]}function ke(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}var Qe=globalThis?.document?v.useLayoutEffect:()=>{},$1=Gc[" useInsertionEffect ".trim().toString()]||Qe;function dn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,i,s]=B1({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=U1(d)?d(e):d;h!==e&&s.current?.(h)}else i(d)},[a,e,i,s]);return[c,u]}function B1({defaultProp:e,onChange:t}){const[n,r]=v.useState(e),o=v.useRef(n),i=v.useRef(t);return $1(()=>{i.current=t},[t]),v.useEffect(()=>{o.current!==n&&(i.current?.(n),o.current=n)},[n,o]),[n,r,i]}function U1(e){return typeof e=="function"}function Z1(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var wt=e=>{const{present:t,children:n}=e,r=V1(t),o=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),i=Le(r.ref,W1(o));return typeof n=="function"||r.isPresent?v.cloneElement(o,{ref:i}):null};wt.displayName="Presence";function V1(e){const[t,n]=v.useState(),r=v.useRef(null),o=v.useRef(e),i=v.useRef("none"),s=e?"mounted":"unmounted",[a,c]=Z1(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=Dr(r.current);i.current=a==="mounted"?u:"none"},[a]),Qe(()=>{const u=r.current,d=o.current;if(d!==e){const p=i.current,f=Dr(u);e?c("MOUNT"):f==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&p!==f?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),Qe(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,h=f=>{const m=Dr(r.current).includes(CSS.escape(f.animationName));if(f.target===t&&m&&(c("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},p=f=>{f.target===t&&(i.current=Dr(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 Dr(e){return e?.animationName||"none"}function W1(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var H1=Gc[" useId ".trim().toString()]||(()=>{}),q1=0;function Ot(e){const[t,n]=v.useState(H1());return Qe(()=>{n(r=>r??String(q1++))},[e]),t?`radix-${t}`:""}var Ao="Collapsible",[K1]=Kt(Ao),[G1,Ms]=K1(Ao),yd=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:i,onOpenChange:s,...a}=e,[c,u]=dn({prop:r,defaultProp:o??!1,onChange:s,caller:Ao});return l.jsx(G1,{scope:n,disabled:i,contentId:Ot(),open:c,onOpenToggle:v.useCallback(()=>u(d=>!d),[u]),children:l.jsx(Ce.div,{"data-state":Fs(c),"data-disabled":i?"":void 0,...a,ref:t})})});yd.displayName=Ao;var vd="CollapsibleTrigger",bd=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=Ms(vd,n);return l.jsx(Ce.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":Fs(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:ke(e.onClick,o.onOpenToggle)})});bd.displayName=vd;var Ls="CollapsibleContent",wd=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Ms(Ls,e.__scopeCollapsible);return l.jsx(wt,{present:n||o.open,children:({present:i})=>l.jsx(J1,{...r,ref:t,present:i})})});wd.displayName=Ls;var J1=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...i}=e,s=Ms(Ls,n),[a,c]=v.useState(r),u=v.useRef(null),d=Le(t,u),h=v.useRef(0),p=h.current,f=v.useRef(0),x=f.current,m=s.open||a,y=v.useRef(m),g=v.useRef(void 0);return v.useEffect(()=>{const b=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(b)},[]),Qe(()=>{const b=u.current;if(b){g.current=g.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,y.current||(b.style.transitionDuration=g.current.transitionDuration,b.style.animationName=g.current.animationName),c(r)}},[s.open,r]),l.jsx(Ce.div,{"data-state":Fs(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!m,...i,ref:d,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...e.style},children:m&&o})});function Fs(e){return e?"open":"closed"}var Y1=yd,X1=v.createContext(void 0);function Io(e){const t=v.useContext(X1);return e||t||"ltr"}function it(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>t.current?.(...n),[])}function Q1(e,t=globalThis?.document){const n=it(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 ew="DismissableLayer",Vi="dismissableLayer.update",tw="dismissableLayer.pointerDownOutside",nw="dismissableLayer.focusOutside",al,kd=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),zo=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...c}=e,u=v.useContext(kd),[d,h]=v.useState(null),p=d?.ownerDocument??globalThis?.document,[,f]=v.useState({}),x=Le(t,E=>h(E)),m=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),g=m.indexOf(y),b=d?m.indexOf(d):-1,k=u.layersWithOutsidePointerEventsDisabled.size>0,S=b>=g,N=iw(E=>{const T=E.target,R=[...u.branches].some(M=>M.contains(T));!S||R||(o?.(E),s?.(E),E.defaultPrevented||a?.())},p),C=sw(E=>{const T=E.target;[...u.branches].some(M=>M.contains(T))||(i?.(E),s?.(E),E.defaultPrevented||a?.())},p);return Q1(E=>{b===u.layers.size-1&&(r?.(E),!E.defaultPrevented&&a&&(E.preventDefault(),a()))},p),v.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(al=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),ll(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=al)}},[d,p,n,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),ll())},[d,u]),v.useEffect(()=>{const E=()=>f({});return document.addEventListener(Vi,E),()=>document.removeEventListener(Vi,E)},[]),l.jsx(Ce.div,{...c,ref:x,style:{pointerEvents:k?S?"auto":"none":void 0,...e.style},onFocusCapture:ke(e.onFocusCapture,C.onFocusCapture),onBlurCapture:ke(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:ke(e.onPointerDownCapture,N.onPointerDownCapture)})});zo.displayName=ew;var rw="DismissableLayerBranch",ow=v.forwardRef((e,t)=>{const n=v.useContext(kd),r=v.useRef(null),o=Le(t,r);return v.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),l.jsx(Ce.div,{...e,ref:o})});ow.displayName=rw;function iw(e,t=globalThis?.document){const n=it(e),r=v.useRef(!1),o=v.useRef(()=>{});return v.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let c=function(){_d(tw,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},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function sw(e,t=globalThis?.document){const n=it(e),r=v.useRef(!1);return v.useEffect(()=>{const o=i=>{i.target&&!r.current&&_d(nw,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ll(){const e=new CustomEvent(Vi);document.dispatchEvent(e)}function _d(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?O1(o,i):o.dispatchEvent(i)}var ui="focusScope.autoFocusOnMount",di="focusScope.autoFocusOnUnmount",cl={bubbles:!1,cancelable:!0},aw="FocusScope",$s=v.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[a,c]=v.useState(null),u=it(o),d=it(i),h=v.useRef(null),p=Le(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:Yt(h.current,{select:!0})},y=function(k){if(f.paused||!a)return;const S=k.relatedTarget;S!==null&&(a.contains(S)||Yt(h.current,{select:!0}))},g=function(k){if(document.activeElement===document.body)for(const N of k)N.removedNodes.length>0&&Yt(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",y);const b=new MutationObserver(g);return a&&b.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",y),b.disconnect()}}},[r,a,f.paused]),v.useEffect(()=>{if(a){dl.add(f);const m=document.activeElement;if(!a.contains(m)){const g=new CustomEvent(ui,cl);a.addEventListener(ui,u),a.dispatchEvent(g),g.defaultPrevented||(lw(hw(Sd(a)),{select:!0}),document.activeElement===m&&Yt(a))}return()=>{a.removeEventListener(ui,u),setTimeout(()=>{const g=new CustomEvent(di,cl);a.addEventListener(di,d),a.dispatchEvent(g),g.defaultPrevented||Yt(m??document.body,{select:!0}),a.removeEventListener(di,d),dl.remove(f)},0)}}},[a,u,d,f]);const x=v.useCallback(m=>{if(!n&&!r||f.paused)return;const y=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,g=document.activeElement;if(y&&g){const b=m.currentTarget,[k,S]=cw(b);k&&S?!m.shiftKey&&g===S?(m.preventDefault(),n&&Yt(k,{select:!0})):m.shiftKey&&g===k&&(m.preventDefault(),n&&Yt(S,{select:!0})):g===b&&m.preventDefault()}},[n,r,f.paused]);return l.jsx(Ce.div,{tabIndex:-1,...s,ref:p,onKeyDown:x})});$s.displayName=aw;function lw(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Yt(r,{select:t}),document.activeElement!==n)return}function cw(e){const t=Sd(e),n=ul(t,e),r=ul(t.reverse(),e);return[n,r]}function Sd(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 ul(e,t){for(const n of e)if(!uw(n,{upTo:t}))return n}function uw(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 dw(e){return e instanceof HTMLInputElement&&"select"in e}function Yt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&dw(e)&&t&&e.select()}}var dl=fw();function fw(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=fl(e,t),e.unshift(t)},remove(t){e=fl(e,t),e[0]?.resume()}}}function fl(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function hw(e){return e.filter(t=>t.tagName!=="A")}var pw="Portal",Po=v.forwardRef((e,t)=>{const{container:n,...r}=e,[o,i]=v.useState(!1);Qe(()=>i(!0),[]);const s=n||o&&globalThis?.document?.body;return s?Tp.createPortal(l.jsx(Ce.div,{...r,ref:t}),s):null});Po.displayName=pw;var fi=0;function Cd(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??hl()),document.body.insertAdjacentElement("beforeend",e[1]??hl()),fi++,()=>{fi===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),fi--}},[])}function hl(){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 zt=function(){return zt=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},zt.apply(this,arguments)};function jd(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 mw(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,i;r<o;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var Gr="right-scroll-bar-position",Jr="width-before-scroll-bar",gw="with-scroll-bars-hidden",xw="--removed-body-scroll-bar-size";function hi(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function yw(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 vw=typeof window<"u"?v.useLayoutEffect:v.useEffect,pl=new WeakMap;function bw(e,t){var n=yw(null,function(r){return e.forEach(function(o){return hi(o,r)})});return vw(function(){var r=pl.get(n);if(r){var o=new Set(r),i=new Set(e),s=n.current;o.forEach(function(a){i.has(a)||hi(a,null)}),i.forEach(function(a){o.has(a)||hi(a,s)})}pl.set(n,e)},[e]),n}function ww(e){return e}function kw(e,t){t===void 0&&(t=ww);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(i){var s=t(i,r);return n.push(s),function(){n=n.filter(function(a){return a!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(a){return i(a)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var a=n;n=[],a.forEach(i),s=n}var c=function(){var d=s;s=[],d.forEach(i)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){s.push(d),u()},filter:function(d){return s=s.filter(d),n}}}};return o}function _w(e){e===void 0&&(e={});var t=kw(null);return t.options=zt({async:!0,ssr:!1},e),t}var Ed=function(e){var t=e.sideCar,n=jd(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,zt({},n))};Ed.isSideCarExport=!0;function Sw(e,t){return e.useMedium(t),Ed}var Nd=_w(),pi=function(){},Ro=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:pi,onWheelCapture:pi,onTouchMoveCapture:pi}),o=r[0],i=r[1],s=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,h=e.shards,p=e.sideCar,f=e.noRelative,x=e.noIsolation,m=e.inert,y=e.allowPinchZoom,g=e.as,b=g===void 0?"div":g,k=e.gapMode,S=jd(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=p,C=bw([n,t]),E=zt(zt({},S),o);return v.createElement(v.Fragment,null,d&&v.createElement(N,{sideCar:Nd,removeScrollBar:u,shards:h,noRelative:f,noIsolation:x,inert:m,setCallbacks:i,allowPinchZoom:!!y,lockRef:n,gapMode:k}),s?v.cloneElement(v.Children.only(a),zt(zt({},E),{ref:C})):v.createElement(b,zt({},E,{className:c,ref:C}),a))});Ro.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ro.classNames={fullWidth:Jr,zeroRight:Gr};var Cw=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function jw(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Cw();return t&&e.setAttribute("nonce",t),e}function Ew(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Nw(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Tw=function(){var e=0,t=null;return{add:function(n){e==0&&(t=jw())&&(Ew(t,n),Nw(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Aw=function(){var e=Tw();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Td=function(){var e=Aw(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Iw={left:0,top:0,right:0,gap:0},mi=function(e){return parseInt(e||"",10)||0},zw=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[mi(n),mi(r),mi(o)]},Pw=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Iw;var t=zw(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])}},Rw=Td(),Rn="data-scroll-locked",Ow=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,a=e.gap;return n===void 0&&(n="margin"),`
40
+ .`.concat(gw,` {
41
+ overflow: hidden `).concat(r,`;
42
+ padding-right: `).concat(a,"px ").concat(r,`;
43
+ }
44
+ body[`).concat(Rn,`] {
45
+ overflow: hidden `).concat(r,`;
46
+ overscroll-behavior: contain;
47
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
48
+ padding-left: `.concat(o,`px;
49
+ padding-top: `).concat(i,`px;
50
+ padding-right: `).concat(s,`px;
51
+ margin-left:0;
52
+ margin-top:0;
53
+ margin-right: `).concat(a,"px ").concat(r,`;
54
+ `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),`
55
+ }
56
+
57
+ .`).concat(Gr,` {
58
+ right: `).concat(a,"px ").concat(r,`;
59
+ }
60
+
61
+ .`).concat(Jr,` {
62
+ margin-right: `).concat(a,"px ").concat(r,`;
63
+ }
64
+
65
+ .`).concat(Gr," .").concat(Gr,` {
66
+ right: 0 `).concat(r,`;
67
+ }
68
+
69
+ .`).concat(Jr," .").concat(Jr,` {
70
+ margin-right: 0 `).concat(r,`;
71
+ }
72
+
73
+ body[`).concat(Rn,`] {
74
+ `).concat(xw,": ").concat(a,`px;
75
+ }
76
+ `)},ml=function(){var e=parseInt(document.body.getAttribute(Rn)||"0",10);return isFinite(e)?e:0},Dw=function(){v.useEffect(function(){return document.body.setAttribute(Rn,(ml()+1).toString()),function(){var e=ml()-1;e<=0?document.body.removeAttribute(Rn):document.body.setAttribute(Rn,e.toString())}},[])},Mw=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Dw();var i=v.useMemo(function(){return Pw(o)},[o]);return v.createElement(Rw,{styles:Ow(i,!t,o,n?"":"!important")})},Wi=!1;if(typeof window<"u")try{var Mr=Object.defineProperty({},"passive",{get:function(){return Wi=!0,!0}});window.addEventListener("test",Mr,Mr),window.removeEventListener("test",Mr,Mr)}catch{Wi=!1}var _n=Wi?{passive:!1}:!1,Lw=function(e){return e.tagName==="TEXTAREA"},Ad=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Lw(e)&&n[t]==="visible")},Fw=function(e){return Ad(e,"overflowY")},$w=function(e){return Ad(e,"overflowX")},gl=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Id(e,r);if(o){var i=zd(e,r),s=i[1],a=i[2];if(s>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Bw=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Uw=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Id=function(e,t){return e==="v"?Fw(t):$w(t)},zd=function(e,t){return e==="v"?Bw(t):Uw(t)},Zw=function(e,t){return e==="h"&&t==="rtl"?-1:1},Vw=function(e,t,n,r,o){var i=Zw(e,window.getComputedStyle(t).direction),s=i*r,a=n.target,c=t.contains(a),u=!1,d=s>0,h=0,p=0;do{if(!a)break;var f=zd(e,a),x=f[0],m=f[1],y=f[2],g=m-y-i*x;(x||g)&&Id(e,a)&&(h+=g,p+=x);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},Lr=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},xl=function(e){return[e.deltaX,e.deltaY]},yl=function(e){return e&&"current"in e?e.current:e},Ww=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Hw=function(e){return`
77
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
78
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
79
+ `)},qw=0,Sn=[];function Kw(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),o=v.useState(qw++)[0],i=v.useState(Td)[0],s=v.useRef(e);v.useEffect(function(){s.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=mw([e.lockRef.current],(e.shards||[]).map(yl),!0).filter(Boolean);return m.forEach(function(y){return y.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=v.useCallback(function(m,y){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!s.current.allowPinchZoom;var g=Lr(m),b=n.current,k="deltaX"in m?m.deltaX:b[0]-g[0],S="deltaY"in m?m.deltaY:b[1]-g[1],N,C=m.target,E=Math.abs(k)>Math.abs(S)?"h":"v";if("touches"in m&&E==="h"&&C.type==="range")return!1;var T=window.getSelection(),R=T&&T.anchorNode,M=R?R===C||R.contains(C):!1;if(M)return!1;var L=gl(E,C);if(!L)return!0;if(L?N=E:(N=E==="v"?"h":"v",L=gl(E,C)),!L)return!1;if(!r.current&&"changedTouches"in m&&(k||S)&&(r.current=N),!N)return!0;var j=r.current||N;return Vw(j,y,m,j==="h"?k:S)},[]),c=v.useCallback(function(m){var y=m;if(!(!Sn.length||Sn[Sn.length-1]!==i)){var g="deltaY"in y?xl(y):Lr(y),b=t.current.filter(function(N){return N.name===y.type&&(N.target===y.target||y.target===N.shadowParent)&&Ww(N.delta,g)})[0];if(b&&b.should){y.cancelable&&y.preventDefault();return}if(!b){var k=(s.current.shards||[]).map(yl).filter(Boolean).filter(function(N){return N.contains(y.target)}),S=k.length>0?a(y,k[0]):!s.current.noIsolation;S&&y.cancelable&&y.preventDefault()}}},[]),u=v.useCallback(function(m,y,g,b){var k={name:m,delta:y,target:g,should:b,shadowParent:Gw(g)};t.current.push(k),setTimeout(function(){t.current=t.current.filter(function(S){return S!==k})},1)},[]),d=v.useCallback(function(m){n.current=Lr(m),r.current=void 0},[]),h=v.useCallback(function(m){u(m.type,xl(m),m.target,a(m,e.lockRef.current))},[]),p=v.useCallback(function(m){u(m.type,Lr(m),m.target,a(m,e.lockRef.current))},[]);v.useEffect(function(){return Sn.push(i),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:p}),document.addEventListener("wheel",c,_n),document.addEventListener("touchmove",c,_n),document.addEventListener("touchstart",d,_n),function(){Sn=Sn.filter(function(m){return m!==i}),document.removeEventListener("wheel",c,_n),document.removeEventListener("touchmove",c,_n),document.removeEventListener("touchstart",d,_n)}},[]);var f=e.removeScrollBar,x=e.inert;return v.createElement(v.Fragment,null,x?v.createElement(i,{styles:Hw(o)}):null,f?v.createElement(Mw,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Gw(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Jw=Sw(Nd,Kw);var Bs=v.forwardRef(function(e,t){return v.createElement(Ro,zt({},e,{ref:t,sideCar:Jw}))});Bs.classNames=Ro.classNames;var Yw=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Cn=new WeakMap,Fr=new WeakMap,$r={},gi=0,Pd=function(e){return e&&(e.host||Pd(e.parentNode))},Xw=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Pd(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})},Qw=function(e,t,n,r){var o=Xw(t,Array.isArray(e)?e:[e]);$r[n]||($r[n]=new WeakMap);var i=$r[n],s=[],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),x=f!==null&&f!=="false",m=(Cn.get(p)||0)+1,y=(i.get(p)||0)+1;Cn.set(p,m),i.set(p,y),s.push(p),m===1&&x&&Fr.set(p,!0),y===1&&p.setAttribute(n,"true"),x||p.setAttribute(r,"true")}catch(g){console.error("aria-hidden: cannot operate on ",p,g)}})};return d(t),a.clear(),gi++,function(){s.forEach(function(h){var p=Cn.get(h)-1,f=i.get(h)-1;Cn.set(h,p),i.set(h,f),p||(Fr.has(h)||h.removeAttribute(r),Fr.delete(h)),f||h.removeAttribute(n)}),gi--,gi||(Cn=new WeakMap,Cn=new WeakMap,Fr=new WeakMap,$r={})}},Rd=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=Yw(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),Qw(r,o,n,"aria-hidden")):function(){return null}},Oo="Dialog",[Od]=Kt(Oo),[e2,Tt]=Od(Oo),Dd=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=e,a=v.useRef(null),c=v.useRef(null),[u,d]=dn({prop:r,defaultProp:o??!1,onChange:i,caller:Oo});return l.jsx(e2,{scope:t,triggerRef:a,contentRef:c,contentId:Ot(),titleId:Ot(),descriptionId:Ot(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(h=>!h),[d]),modal:s,children:n})};Dd.displayName=Oo;var Md="DialogTrigger",Ld=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Tt(Md,n),i=Le(t,o.triggerRef);return l.jsx(Ce.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Vs(o.open),...r,ref:i,onClick:ke(e.onClick,o.onOpenToggle)})});Ld.displayName=Md;var Us="DialogPortal",[t2,Fd]=Od(Us,{forceMount:void 0}),$d=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=Tt(Us,t);return l.jsx(t2,{scope:t,forceMount:n,children:v.Children.map(r,s=>l.jsx(wt,{present:n||i.open,children:l.jsx(Po,{asChild:!0,container:o,children:s})}))})};$d.displayName=Us;var lo="DialogOverlay",Bd=v.forwardRef((e,t)=>{const n=Fd(lo,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=Tt(lo,e.__scopeDialog);return i.modal?l.jsx(wt,{present:r||i.open,children:l.jsx(r2,{...o,ref:t})}):null});Bd.displayName=lo;var n2=Bn("DialogOverlay.RemoveScroll"),r2=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Tt(lo,n);return l.jsx(Bs,{as:n2,allowPinchZoom:!0,shards:[o.contentRef],children:l.jsx(Ce.div,{"data-state":Vs(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),fn="DialogContent",Ud=v.forwardRef((e,t)=>{const n=Fd(fn,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=Tt(fn,e.__scopeDialog);return l.jsx(wt,{present:r||i.open,children:i.modal?l.jsx(o2,{...o,ref:t}):l.jsx(i2,{...o,ref:t})})});Ud.displayName=fn;var o2=v.forwardRef((e,t)=>{const n=Tt(fn,e.__scopeDialog),r=v.useRef(null),o=Le(t,n.contentRef,r);return v.useEffect(()=>{const i=r.current;if(i)return Rd(i)},[]),l.jsx(Zd,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ke(e.onCloseAutoFocus,i=>{i.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:ke(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&i.preventDefault()}),onFocusOutside:ke(e.onFocusOutside,i=>i.preventDefault())})}),i2=v.forwardRef((e,t)=>{const n=Tt(fn,e.__scopeDialog),r=v.useRef(!1),o=v.useRef(!1);return l.jsx(Zd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;n.triggerRef.current?.contains(s)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),Zd=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=e,a=Tt(fn,n),c=v.useRef(null),u=Le(t,c);return Cd(),l.jsxs(l.Fragment,{children:[l.jsx($s,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:l.jsx(zo,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Vs(a.open),...s,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(a2,{titleId:a.titleId}),l.jsx(c2,{contentRef:c,descriptionId:a.descriptionId})]})]})}),Zs="DialogTitle",Vd=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Tt(Zs,n);return l.jsx(Ce.h2,{id:o.titleId,...r,ref:t})});Vd.displayName=Zs;var Wd="DialogDescription",s2=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Tt(Wd,n);return l.jsx(Ce.p,{id:o.descriptionId,...r,ref:t})});s2.displayName=Wd;var Hd="DialogClose",qd=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Tt(Hd,n);return l.jsx(Ce.button,{type:"button",...r,ref:t,onClick:ke(e.onClick,()=>o.onOpenChange(!1))})});qd.displayName=Hd;function Vs(e){return e?"open":"closed"}var Kd="DialogTitleWarning",[vT,Gd]=L1(Kd,{contentName:fn,titleName:Zs,docsSlug:"dialog"}),a2=({titleId:e})=>{const t=Gd(Kd),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
80
+
81
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
82
+
83
+ 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},l2="DialogDescriptionWarning",c2=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Gd(l2).contentName}}.`;return v.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},u2=Dd,d2=Ld,f2=$d,h2=Bd,p2=Ud,m2=Vd,g2=qd;function x2(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 y2(e){const[t,n]=v.useState(void 0);return Qe(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const c=i.borderBoxSize,u=Array.isArray(c)?c[0]:c;s=u.inlineSize,a=u.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const v2=["top","right","bottom","left"],en=Math.min,pt=Math.max,co=Math.round,Br=Math.floor,Dt=e=>({x:e,y:e}),b2={left:"right",right:"left",bottom:"top",top:"bottom"},w2={start:"end",end:"start"};function Hi(e,t,n){return pt(e,en(t,n))}function Wt(e,t){return typeof e=="function"?e(t):e}function Ht(e){return e.split("-")[0]}function Jn(e){return e.split("-")[1]}function Ws(e){return e==="x"?"y":"x"}function Hs(e){return e==="y"?"height":"width"}const k2=new Set(["top","bottom"]);function Rt(e){return k2.has(Ht(e))?"y":"x"}function qs(e){return Ws(Rt(e))}function _2(e,t,n){n===void 0&&(n=!1);const r=Jn(e),o=qs(e),i=Hs(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=uo(s)),[s,uo(s)]}function S2(e){const t=uo(e);return[qi(e),t,qi(t)]}function qi(e){return e.replace(/start|end/g,t=>w2[t])}const vl=["left","right"],bl=["right","left"],C2=["top","bottom"],j2=["bottom","top"];function E2(e,t,n){switch(e){case"top":case"bottom":return n?t?bl:vl:t?vl:bl;case"left":case"right":return t?C2:j2;default:return[]}}function N2(e,t,n,r){const o=Jn(e);let i=E2(Ht(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(qi)))),i}function uo(e){return e.replace(/left|right|bottom|top/g,t=>b2[t])}function T2(e){return{top:0,right:0,bottom:0,left:0,...e}}function Jd(e){return typeof e!="number"?T2(e):{top:e,right:e,bottom:e,left:e}}function fo(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 wl(e,t,n){let{reference:r,floating:o}=e;const i=Rt(t),s=qs(t),a=Hs(s),c=Ht(t),u=i==="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(Jn(t)){case"start":f[s]-=p*(n&&u?-1:1);break;case"end":f[s]+=p*(n&&u?-1:1);break}return f}async function A2(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:p=!1,padding:f=0}=Wt(t,e),x=Jd(f),y=a[p?h==="floating"?"reference":"floating":h],g=fo(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:c})),b=h==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),S=await(i.isElement==null?void 0:i.isElement(k))?await(i.getScale==null?void 0:i.getScale(k))||{x:1,y:1}:{x:1,y:1},N=fo(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:k,strategy:c}):b);return{top:(g.top-N.top+x.top)/S.y,bottom:(N.bottom-g.bottom+x.bottom)/S.y,left:(g.left-N.left+x.left)/S.x,right:(N.right-g.right+x.right)/S.x}}const I2=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:h}=wl(u,r,c),p=r,f={},x=0;for(let y=0;y<a.length;y++){var m;const{name:g,fn:b}=a[y],{x:k,y:S,data:N,reset:C}=await b({x:d,y:h,initialPlacement:r,placement:p,strategy:o,middlewareData:f,rects:u,platform:{...s,detectOverflow:(m=s.detectOverflow)!=null?m:A2},elements:{reference:e,floating:t}});d=k??d,h=S??h,f={...f,[g]:{...f[g],...N}},C&&x<=50&&(x++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(u=C.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:d,y:h}=wl(u,p,c)),y=-1)}return{x:d,y:h,placement:p,strategy:o,middlewareData:f}},z2=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:c}=t,{element:u,padding:d=0}=Wt(e,t)||{};if(u==null)return{};const h=Jd(d),p={x:n,y:r},f=qs(o),x=Hs(f),m=await s.getDimensions(u),y=f==="y",g=y?"top":"left",b=y?"bottom":"right",k=y?"clientHeight":"clientWidth",S=i.reference[x]+i.reference[f]-p[f]-i.floating[x],N=p[f]-i.reference[f],C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let E=C?C[k]:0;(!E||!await(s.isElement==null?void 0:s.isElement(C)))&&(E=a.floating[k]||i.floating[x]);const T=S/2-N/2,R=E/2-m[x]/2-1,M=en(h[g],R),L=en(h[b],R),j=M,D=E-m[x]-L,w=E/2-m[x]/2+T,P=Hi(j,w,D),H=!c.arrow&&Jn(o)!=null&&w!==P&&i.reference[x]/2-(w<j?M:L)-m[x]/2<0,B=H?w<j?w-j:w-D:0;return{[f]:p[f]+B,data:{[f]:P,centerOffset:w-P-B,...H&&{alignmentOffset:B}},reset:H}}}),P2=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:m=!0,...y}=Wt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=Ht(o),b=Rt(a),k=Ht(a)===a,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),N=p||(k||!m?[uo(a)]:S2(a)),C=x!=="none";!p&&C&&N.push(...N2(a,m,x,S));const E=[a,...N],T=await c.detectOverflow(t,y),R=[];let M=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&R.push(T[g]),h){const w=_2(o,s,S);R.push(T[w[0]],T[w[1]])}if(M=[...M,{placement:o,overflows:R}],!R.every(w=>w<=0)){var L,j;const w=(((L=i.flip)==null?void 0:L.index)||0)+1,P=E[w];if(P&&(!(h==="alignment"?b!==Rt(P):!1)||M.every(q=>Rt(q.placement)===b?q.overflows[0]>0:!0)))return{data:{index:w,overflows:M},reset:{placement:P}};let H=(j=M.filter(B=>B.overflows[0]<=0).sort((B,q)=>B.overflows[1]-q.overflows[1])[0])==null?void 0:j.placement;if(!H)switch(f){case"bestFit":{var D;const B=(D=M.filter(q=>{if(C){const X=Rt(q.placement);return X===b||X==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(X=>X>0).reduce((X,A)=>X+A,0)]).sort((q,X)=>q[1]-X[1])[0])==null?void 0:D[0];B&&(H=B);break}case"initialPlacement":H=a;break}if(o!==H)return{reset:{placement:H}}}return{}}}};function kl(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function _l(e){return v2.some(t=>e[t]>=0)}const R2=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...i}=Wt(e,t);switch(o){case"referenceHidden":{const s=await r.detectOverflow(t,{...i,elementContext:"reference"}),a=kl(s,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:_l(a)}}}case"escaped":{const s=await r.detectOverflow(t,{...i,altBoundary:!0}),a=kl(s,n.floating);return{data:{escapedOffsets:a,escaped:_l(a)}}}default:return{}}}}},Yd=new Set(["left","top"]);async function O2(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Ht(n),a=Jn(n),c=Rt(n)==="y",u=Yd.has(s)?-1:1,d=i&&c?-1:1,h=Wt(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:x}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof x=="number"&&(f=a==="end"?x*-1:x),c?{x:f*d,y:p*u}:{x:p*u,y:f*d}}const D2=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,c=await O2(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:s}}}}},M2=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:s=!0,crossAxis:a=!1,limiter:c={fn:g=>{let{x:b,y:k}=g;return{x:b,y:k}}},...u}=Wt(e,t),d={x:n,y:r},h=await i.detectOverflow(t,u),p=Rt(Ht(o)),f=Ws(p);let x=d[f],m=d[p];if(s){const g=f==="y"?"top":"left",b=f==="y"?"bottom":"right",k=x+h[g],S=x-h[b];x=Hi(k,x,S)}if(a){const g=p==="y"?"top":"left",b=p==="y"?"bottom":"right",k=m+h[g],S=m-h[b];m=Hi(k,m,S)}const y=c.fn({...t,[f]:x,[p]:m});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[f]:s,[p]:a}}}}}},L2=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=Wt(e,t),d={x:n,y:r},h=Rt(o),p=Ws(h);let f=d[p],x=d[h];const m=Wt(a,t),y=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const k=p==="y"?"height":"width",S=i.reference[p]-i.floating[k]+y.mainAxis,N=i.reference[p]+i.reference[k]-y.mainAxis;f<S?f=S:f>N&&(f=N)}if(u){var g,b;const k=p==="y"?"width":"height",S=Yd.has(Ht(o)),N=i.reference[h]-i.floating[k]+(S&&((g=s.offset)==null?void 0:g[h])||0)+(S?0:y.crossAxis),C=i.reference[h]+i.reference[k]+(S?0:((b=s.offset)==null?void 0:b[h])||0)-(S?y.crossAxis:0);x<N?x=N:x>C&&(x=C)}return{[p]:f,[h]:x}}}},F2=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:a}=t,{apply:c=()=>{},...u}=Wt(e,t),d=await s.detectOverflow(t,u),h=Ht(o),p=Jn(o),f=Rt(o)==="y",{width:x,height:m}=i.floating;let y,g;h==="top"||h==="bottom"?(y=h,g=p===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(g=h,y=p==="end"?"top":"bottom");const b=m-d.top-d.bottom,k=x-d.left-d.right,S=en(m-d[y],b),N=en(x-d[g],k),C=!t.middlewareData.shift;let E=S,T=N;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=k),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=b),C&&!p){const M=pt(d.left,0),L=pt(d.right,0),j=pt(d.top,0),D=pt(d.bottom,0);f?T=x-2*(M!==0||L!==0?M+L:pt(d.left,d.right)):E=m-2*(j!==0||D!==0?j+D:pt(d.top,d.bottom))}await c({...t,availableWidth:T,availableHeight:E});const R=await s.getDimensions(a.floating);return x!==R.width||m!==R.height?{reset:{rects:!0}}:{}}}};function Do(){return typeof window<"u"}function Yn(e){return Xd(e)?(e.nodeName||"").toLowerCase():"#document"}function gt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ft(e){var t;return(t=(Xd(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Xd(e){return Do()?e instanceof Node||e instanceof gt(e).Node:!1}function Et(e){return Do()?e instanceof Element||e instanceof gt(e).Element:!1}function Mt(e){return Do()?e instanceof HTMLElement||e instanceof gt(e).HTMLElement:!1}function Sl(e){return!Do()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof gt(e).ShadowRoot}const $2=new Set(["inline","contents"]);function Sr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Nt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!$2.has(o)}const B2=new Set(["table","td","th"]);function U2(e){return B2.has(Yn(e))}const Z2=[":popover-open",":modal"];function Mo(e){return Z2.some(t=>{try{return e.matches(t)}catch{return!1}})}const V2=["transform","translate","scale","rotate","perspective"],W2=["transform","translate","scale","rotate","perspective","filter"],H2=["paint","layout","strict","content"];function Ks(e){const t=Gs(),n=Et(e)?Nt(e):e;return V2.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)||W2.some(r=>(n.willChange||"").includes(r))||H2.some(r=>(n.contain||"").includes(r))}function q2(e){let t=tn(e);for(;Mt(t)&&!Un(t);){if(Ks(t))return t;if(Mo(t))return null;t=tn(t)}return null}function Gs(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const K2=new Set(["html","body","#document"]);function Un(e){return K2.has(Yn(e))}function Nt(e){return gt(e).getComputedStyle(e)}function Lo(e){return Et(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function tn(e){if(Yn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Sl(e)&&e.host||Ft(e);return Sl(t)?t.host:t}function Qd(e){const t=tn(e);return Un(t)?e.ownerDocument?e.ownerDocument.body:e.body:Mt(t)&&Sr(t)?t:Qd(t)}function vr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Qd(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=gt(o);if(i){const a=Ki(s);return t.concat(s,s.visualViewport||[],Sr(o)?o:[],a&&n?vr(a):[])}return t.concat(o,vr(o,[],n))}function Ki(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ef(e){const t=Nt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Mt(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=co(n)!==i||co(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function Js(e){return Et(e)?e:e.contextElement}function On(e){const t=Js(e);if(!Mt(t))return Dt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=ef(t);let s=(i?co(n.width):n.width)/r,a=(i?co(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const G2=Dt(0);function tf(e){const t=gt(e);return!Gs()||!t.visualViewport?G2:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function J2(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==gt(e)?!1:t}function hn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Js(e);let s=Dt(1);t&&(r?Et(r)&&(s=On(r)):s=On(e));const a=J2(i,n,r)?tf(i):Dt(0);let c=(o.left+a.x)/s.x,u=(o.top+a.y)/s.y,d=o.width/s.x,h=o.height/s.y;if(i){const p=gt(i),f=r&&Et(r)?gt(r):r;let x=p,m=Ki(x);for(;m&&r&&f!==x;){const y=On(m),g=m.getBoundingClientRect(),b=Nt(m),k=g.left+(m.clientLeft+parseFloat(b.paddingLeft))*y.x,S=g.top+(m.clientTop+parseFloat(b.paddingTop))*y.y;c*=y.x,u*=y.y,d*=y.x,h*=y.y,c+=k,u+=S,x=gt(m),m=Ki(x)}}return fo({width:d,height:h,x:c,y:u})}function Fo(e,t){const n=Lo(e).scrollLeft;return t?t.left+n:hn(Ft(e)).left+n}function nf(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Fo(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Y2(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=Ft(r),a=t?Mo(t.floating):!1;if(r===s||a&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Dt(1);const d=Dt(0),h=Mt(r);if((h||!h&&!i)&&((Yn(r)!=="body"||Sr(s))&&(c=Lo(r)),Mt(r))){const f=hn(r);u=On(r),d.x=f.x+r.clientLeft,d.y=f.y+r.clientTop}const p=s&&!h&&!i?nf(s,c):Dt(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 X2(e){return Array.from(e.getClientRects())}function Q2(e){const t=Ft(e),n=Lo(e),r=e.ownerDocument.body,o=pt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=pt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Fo(e);const a=-n.scrollTop;return Nt(r).direction==="rtl"&&(s+=pt(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}const Cl=25;function ek(e,t){const n=gt(e),r=Ft(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,c=0;if(o){i=o.width,s=o.height;const d=Gs();(!d||d&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}const u=Fo(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,x=Math.abs(r.clientWidth-h.clientWidth-f);x<=Cl&&(i-=x)}else u<=Cl&&(i+=u);return{width:i,height:s,x:a,y:c}}const tk=new Set(["absolute","fixed"]);function nk(e,t){const n=hn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Mt(e)?On(e):Dt(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,c=o*i.x,u=r*i.y;return{width:s,height:a,x:c,y:u}}function jl(e,t,n){let r;if(t==="viewport")r=ek(e,n);else if(t==="document")r=Q2(Ft(e));else if(Et(t))r=nk(t,n);else{const o=tf(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return fo(r)}function rf(e,t){const n=tn(e);return n===t||!Et(n)||Un(n)?!1:Nt(n).position==="fixed"||rf(n,t)}function rk(e,t){const n=t.get(e);if(n)return n;let r=vr(e,[],!1).filter(a=>Et(a)&&Yn(a)!=="body"),o=null;const i=Nt(e).position==="fixed";let s=i?tn(e):e;for(;Et(s)&&!Un(s);){const a=Nt(s),c=Ks(s);!c&&a.position==="fixed"&&(o=null),(i?!c&&!o:!c&&a.position==="static"&&!!o&&tk.has(o.position)||Sr(s)&&!c&&rf(e,s))?r=r.filter(d=>d!==s):o=a,s=tn(s)}return t.set(e,r),r}function ok(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?Mo(t)?[]:rk(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((u,d)=>{const h=jl(t,d,o);return u.top=pt(h.top,u.top),u.right=en(h.right,u.right),u.bottom=en(h.bottom,u.bottom),u.left=pt(h.left,u.left),u},jl(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function ik(e){const{width:t,height:n}=ef(e);return{width:t,height:n}}function sk(e,t,n){const r=Mt(t),o=Ft(t),i=n==="fixed",s=hn(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Dt(0);function u(){c.x=Fo(o)}if(r||!r&&!i)if((Yn(t)!=="body"||Sr(o))&&(a=Lo(t)),r){const f=hn(t,!0,i,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else o&&u();i&&!r&&o&&u();const d=o&&!r&&!i?nf(o,a):Dt(0),h=s.left+a.scrollLeft-c.x-d.x,p=s.top+a.scrollTop-c.y-d.y;return{x:h,y:p,width:s.width,height:s.height}}function xi(e){return Nt(e).position==="static"}function El(e,t){if(!Mt(e)||Nt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ft(e)===n&&(n=n.ownerDocument.body),n}function of(e,t){const n=gt(e);if(Mo(e))return n;if(!Mt(e)){let o=tn(e);for(;o&&!Un(o);){if(Et(o)&&!xi(o))return o;o=tn(o)}return n}let r=El(e,t);for(;r&&U2(r)&&xi(r);)r=El(r,t);return r&&Un(r)&&xi(r)&&!Ks(r)?n:r||q2(e)||n}const ak=async function(e){const t=this.getOffsetParent||of,n=this.getDimensions,r=await n(e.floating);return{reference:sk(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function lk(e){return Nt(e).direction==="rtl"}const ck={convertOffsetParentRelativeRectToViewportRelativeRect:Y2,getDocumentElement:Ft,getClippingRect:ok,getOffsetParent:of,getElementRects:ak,getClientRects:X2,getDimensions:ik,getScale:On,isElement:Et,isRTL:lk};function sf(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function uk(e,t){let n=null,r;const o=Ft(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),i();const u=e.getBoundingClientRect(),{left:d,top:h,width:p,height:f}=u;if(a||t(),!p||!f)return;const x=Br(h),m=Br(o.clientWidth-(d+p)),y=Br(o.clientHeight-(h+f)),g=Br(d),k={rootMargin:-x+"px "+-m+"px "+-y+"px "+-g+"px",threshold:pt(0,en(1,c))||1};let S=!0;function N(C){const E=C[0].intersectionRatio;if(E!==c){if(!S)return s();E?s(!1,E):r=setTimeout(()=>{s(!1,1e-7)},1e3)}E===1&&!sf(u,e.getBoundingClientRect())&&s(),S=!1}try{n=new IntersectionObserver(N,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(N,k)}n.observe(e)}return s(!0),i}function dk(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=Js(e),d=o||i?[...u?vr(u):[],...vr(t)]:[];d.forEach(g=>{o&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const h=u&&a?uk(u,n):null;let p=-1,f=null;s&&(f=new ResizeObserver(g=>{let[b]=g;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 x,m=c?hn(e):null;c&&y();function y(){const g=hn(e);m&&!sf(m,g)&&n(),m=g,x=requestAnimationFrame(y)}return n(),()=>{var g;d.forEach(b=>{o&&b.removeEventListener("scroll",n),i&&b.removeEventListener("resize",n)}),h?.(),(g=f)==null||g.disconnect(),f=null,c&&cancelAnimationFrame(x)}}const fk=D2,hk=M2,pk=P2,mk=F2,gk=R2,Nl=z2,xk=L2,yk=(e,t,n)=>{const r=new Map,o={platform:ck,...n},i={...o.platform,_c:r};return I2(e,t,{...o,platform:i})};var vk=typeof document<"u",bk=function(){},Yr=vk?v.useLayoutEffect:bk;function ho(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(!ho(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!ho(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function af(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Tl(e,t){const n=af(e);return Math.round(t*n)/n}function yi(e){const t=v.useRef(e);return Yr(()=>{t.current=e}),t}function wk(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},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);ho(p,r)||f(r);const[x,m]=v.useState(null),[y,g]=v.useState(null),b=v.useCallback(q=>{q!==C.current&&(C.current=q,m(q))},[]),k=v.useCallback(q=>{q!==E.current&&(E.current=q,g(q))},[]),S=i||x,N=s||y,C=v.useRef(null),E=v.useRef(null),T=v.useRef(d),R=c!=null,M=yi(c),L=yi(o),j=yi(u),D=v.useCallback(()=>{if(!C.current||!E.current)return;const q={placement:t,strategy:n,middleware:p};L.current&&(q.platform=L.current),yk(C.current,E.current,q).then(X=>{const A={...X,isPositioned:j.current!==!1};w.current&&!ho(T.current,A)&&(T.current=A,kr.flushSync(()=>{h(A)}))})},[p,t,n,L,j]);Yr(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,h(q=>({...q,isPositioned:!1})))},[u]);const w=v.useRef(!1);Yr(()=>(w.current=!0,()=>{w.current=!1}),[]),Yr(()=>{if(S&&(C.current=S),N&&(E.current=N),S&&N){if(M.current)return M.current(S,N,D);D()}},[S,N,D,M,R]);const P=v.useMemo(()=>({reference:C,floating:E,setReference:b,setFloating:k}),[b,k]),H=v.useMemo(()=>({reference:S,floating:N}),[S,N]),B=v.useMemo(()=>{const q={position:n,left:0,top:0};if(!H.floating)return q;const X=Tl(H.floating,d.x),A=Tl(H.floating,d.y);return a?{...q,transform:"translate("+X+"px, "+A+"px)",...af(H.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:X,top:A}},[n,a,H.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:D,refs:P,elements:H,floatingStyles:B}),[d,D,P,H,B])}const kk=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?Nl({element:r.current,padding:o}).fn(n):{}:r?Nl({element:r,padding:o}).fn(n):{}}}},_k=(e,t)=>({...fk(e),options:[e,t]}),Sk=(e,t)=>({...hk(e),options:[e,t]}),Ck=(e,t)=>({...xk(e),options:[e,t]}),jk=(e,t)=>({...pk(e),options:[e,t]}),Ek=(e,t)=>({...mk(e),options:[e,t]}),Nk=(e,t)=>({...gk(e),options:[e,t]}),Tk=(e,t)=>({...kk(e),options:[e,t]});var Ak="Arrow",lf=v.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return l.jsx(Ce.svg,{...i,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"})})});lf.displayName=Ak;var Ik=lf,Ys="Popper",[cf,$o]=Kt(Ys),[zk,uf]=cf(Ys),df=e=>{const{__scopePopper:t,children:n}=e,[r,o]=v.useState(null);return l.jsx(zk,{scope:t,anchor:r,onAnchorChange:o,children:n})};df.displayName=Ys;var ff="PopperAnchor",hf=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=uf(ff,n),s=v.useRef(null),a=Le(t,s),c=v.useRef(null);return v.useEffect(()=>{const u=c.current;c.current=r?.current||s.current,u!==c.current&&i.onAnchorChange(c.current)}),r?null:l.jsx(Ce.div,{...o,ref:a})});hf.displayName=ff;var Xs="PopperContent",[Pk,Rk]=cf(Xs),pf=v.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:p=!1,updatePositionStrategy:f="optimized",onPlaced:x,...m}=e,y=uf(Xs,n),[g,b]=v.useState(null),k=Le(t,te=>b(te)),[S,N]=v.useState(null),C=y2(S),E=C?.width??0,T=C?.height??0,R=r+(i!=="center"?"-"+i:""),M=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},L=Array.isArray(u)?u:[u],j=L.length>0,D={padding:M,boundary:L.filter(Dk),altBoundary:j},{refs:w,floatingStyles:P,placement:H,isPositioned:B,middlewareData:q}=wk({strategy:"fixed",placement:R,whileElementsMounted:(...te)=>dk(...te,{animationFrame:f==="always"}),elements:{reference:y.anchor},middleware:[_k({mainAxis:o+T,alignmentAxis:s}),c&&Sk({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Ck():void 0,...D}),c&&jk({...D}),Ek({...D,apply:({elements:te,rects:ce,availableWidth:fe,availableHeight:ge})=>{const{width:xe,height:Ee}=ce.reference,Fe=te.floating.style;Fe.setProperty("--radix-popper-available-width",`${fe}px`),Fe.setProperty("--radix-popper-available-height",`${ge}px`),Fe.setProperty("--radix-popper-anchor-width",`${xe}px`),Fe.setProperty("--radix-popper-anchor-height",`${Ee}px`)}}),S&&Tk({element:S,padding:a}),Mk({arrowWidth:E,arrowHeight:T}),p&&Nk({strategy:"referenceHidden",...D})]}),[X,A]=xf(H),W=it(x);Qe(()=>{B&&W?.()},[B,W]);const V=q.arrow?.x,I=q.arrow?.y,oe=q.arrow?.centerOffset!==0,[Y,de]=v.useState();return Qe(()=>{g&&de(window.getComputedStyle(g).zIndex)},[g]),l.jsx("div",{ref:w.setFloating,"data-radix-popper-content-wrapper":"",style:{...P,transform:B?P.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,"--radix-popper-transform-origin":[q.transformOrigin?.x,q.transformOrigin?.y].join(" "),...q.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(Pk,{scope:n,placedSide:X,onArrowChange:N,arrowX:V,arrowY:I,shouldHideArrow:oe,children:l.jsx(Ce.div,{"data-side":X,"data-align":A,...m,ref:k,style:{...m.style,animation:B?void 0:"none"}})})})});pf.displayName=Xs;var mf="PopperArrow",Ok={top:"bottom",right:"left",bottom:"top",left:"right"},gf=v.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=Rk(mf,r),s=Ok[i.placedSide];return l.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:l.jsx(Ik,{...o,ref:n,style:{...o.style,display:"block"}})})});gf.displayName=mf;function Dk(e){return e!==null}var Mk=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,s=o.arrow?.centerOffset!==0,a=s?0:e.arrowWidth,c=s?0:e.arrowHeight,[u,d]=xf(n),h={start:"0%",center:"50%",end:"100%"}[d],p=(o.arrow?.x??0)+a/2,f=(o.arrow?.y??0)+c/2;let x="",m="";return u==="bottom"?(x=s?h:`${p}px`,m=`${-c}px`):u==="top"?(x=s?h:`${p}px`,m=`${r.floating.height+c}px`):u==="right"?(x=`${-c}px`,m=s?h:`${f}px`):u==="left"&&(x=`${r.floating.width+c}px`,m=s?h:`${f}px`),{data:{x,y:m}}}});function xf(e){const[t,n="center"]=e.split("-");return[t,n]}var yf=df,vf=hf,bf=pf,wf=gf,vi="rovingFocusGroup.onEntryFocus",Lk={bubbles:!1,cancelable:!0},Cr="RovingFocusGroup",[Gi,kf,Fk]=xd(Cr),[$k,_f]=Kt(Cr,[Fk]),[Bk,Uk]=$k(Cr),Sf=v.forwardRef((e,t)=>l.jsx(Gi.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Gi.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Zk,{...e,ref:t})})}));Sf.displayName=Cr;var Zk=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=e,p=v.useRef(null),f=Le(t,p),x=Io(i),[m,y]=dn({prop:s,defaultProp:a??null,onChange:c,caller:Cr}),[g,b]=v.useState(!1),k=it(u),S=kf(n),N=v.useRef(!1),[C,E]=v.useState(0);return v.useEffect(()=>{const T=p.current;if(T)return T.addEventListener(vi,k),()=>T.removeEventListener(vi,k)},[k]),l.jsx(Bk,{scope:n,orientation:r,dir:x,loop:o,currentTabStopId:m,onItemFocus:v.useCallback(T=>y(T),[y]),onItemShiftTab:v.useCallback(()=>b(!0),[]),onFocusableItemAdd:v.useCallback(()=>E(T=>T+1),[]),onFocusableItemRemove:v.useCallback(()=>E(T=>T-1),[]),children:l.jsx(Ce.div,{tabIndex:g||C===0?-1:0,"data-orientation":r,...h,ref:f,style:{outline:"none",...e.style},onMouseDown:ke(e.onMouseDown,()=>{N.current=!0}),onFocus:ke(e.onFocus,T=>{const R=!N.current;if(T.target===T.currentTarget&&R&&!g){const M=new CustomEvent(vi,Lk);if(T.currentTarget.dispatchEvent(M),!M.defaultPrevented){const L=S().filter(H=>H.focusable),j=L.find(H=>H.active),D=L.find(H=>H.id===m),P=[j,D,...L].filter(Boolean).map(H=>H.ref.current);Ef(P,d)}}N.current=!1}),onBlur:ke(e.onBlur,()=>b(!1))})})}),Cf="RovingFocusGroupItem",jf=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,children:s,...a}=e,c=Ot(),u=i||c,d=Uk(Cf,n),h=d.currentTabStopId===u,p=kf(n),{onFocusableItemAdd:f,onFocusableItemRemove:x,currentTabStopId:m}=d;return v.useEffect(()=>{if(r)return f(),()=>x()},[r,f,x]),l.jsx(Gi.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:ke(e.onMouseDown,y=>{r?d.onItemFocus(u):y.preventDefault()}),onFocus:ke(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:ke(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){d.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const g=Hk(y,d.orientation,d.dir);if(g!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let k=p().filter(S=>S.focusable).map(S=>S.ref.current);if(g==="last")k.reverse();else if(g==="prev"||g==="next"){g==="prev"&&k.reverse();const S=k.indexOf(y.currentTarget);k=d.loop?qk(k,S+1):k.slice(S+1)}setTimeout(()=>Ef(k))}}),children:typeof s=="function"?s({isCurrentTabStop:h,hasTabStop:m!=null}):s})})});jf.displayName=Cf;var Vk={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Wk(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Hk(e,t,n){const r=Wk(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Vk[r]}function Ef(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function qk(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Kk=Sf,Gk=jf;function Ji(e,[t,n]){return Math.min(n,Math.max(t,e))}function Jk(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var Qs="ScrollArea",[Nf]=Kt(Qs),[Yk,kt]=Nf(Qs),Tf=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:i=600,...s}=e,[a,c]=v.useState(null),[u,d]=v.useState(null),[h,p]=v.useState(null),[f,x]=v.useState(null),[m,y]=v.useState(null),[g,b]=v.useState(0),[k,S]=v.useState(0),[N,C]=v.useState(!1),[E,T]=v.useState(!1),R=Le(t,L=>c(L)),M=Io(o);return l.jsx(Yk,{scope:n,type:r,dir:M,scrollHideDelay:i,scrollArea:a,viewport:u,onViewportChange:d,content:h,onContentChange:p,scrollbarX:f,onScrollbarXChange:x,scrollbarXEnabled:N,onScrollbarXEnabledChange:C,scrollbarY:m,onScrollbarYChange:y,scrollbarYEnabled:E,onScrollbarYEnabledChange:T,onCornerWidthChange:b,onCornerHeightChange:S,children:l.jsx(Ce.div,{dir:M,...s,ref:R,style:{position:"relative","--radix-scroll-area-corner-width":g+"px","--radix-scroll-area-corner-height":k+"px",...e.style}})})});Tf.displayName=Qs;var Af="ScrollAreaViewport",If=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...i}=e,s=kt(Af,n),a=v.useRef(null),c=Le(t,a,s.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":"",...i,ref:c,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style},children:l.jsx("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});If.displayName=Af;var $t="ScrollAreaScrollbar",zf=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=kt($t,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=o,a=e.orientation==="horizontal";return v.useEffect(()=>(a?i(!0):s(!0),()=>{a?i(!1):s(!1)}),[a,i,s]),o.type==="hover"?l.jsx(Xk,{...r,ref:t,forceMount:n}):o.type==="scroll"?l.jsx(Qk,{...r,ref:t,forceMount:n}):o.type==="auto"?l.jsx(Pf,{...r,ref:t,forceMount:n}):o.type==="always"?l.jsx(ea,{...r,ref:t}):null});zf.displayName=$t;var Xk=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=kt($t,e.__scopeScrollArea),[i,s]=v.useState(!1);return v.useEffect(()=>{const a=o.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),s(!0)},d=()=>{c=window.setTimeout(()=>s(!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(wt,{present:n||i,children:l.jsx(Pf,{"data-state":i?"visible":"hidden",...r,ref:t})})}),Qk=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=kt($t,e.__scopeScrollArea),i=e.orientation==="horizontal",s=Uo(()=>c("SCROLL_END"),100),[a,c]=Jk("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=i?"scrollLeft":"scrollTop";if(u){let h=u[d];const p=()=>{const f=u[d];h!==f&&(c("SCROLL"),s()),h=f};return u.addEventListener("scroll",p),()=>u.removeEventListener("scroll",p)}},[o.viewport,i,c,s]),l.jsx(wt,{present:n||a!=="hidden",children:l.jsx(ea,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:ke(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:ke(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Pf=v.forwardRef((e,t)=>{const n=kt($t,e.__scopeScrollArea),{forceMount:r,...o}=e,[i,s]=v.useState(!1),a=e.orientation==="horizontal",c=Uo(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;s(a?u:d)}},10);return Zn(n.viewport,c),Zn(n.content,c),l.jsx(wt,{present:r||i,children:l.jsx(ea,{"data-state":i?"visible":"hidden",...o,ref:t})})}),ea=v.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=kt($t,e.__scopeScrollArea),i=v.useRef(null),s=v.useRef(0),[a,c]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Lf(a.viewport,a.content),d={...r,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:p=>i.current=p,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:p=>s.current=p};function h(p,f){return i_(p,s.current,a,f)}return n==="horizontal"?l.jsx(e_,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const p=o.viewport.scrollLeft,f=Al(p,a,o.dir);i.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(t_,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&i.current){const p=o.viewport.scrollTop,f=Al(p,a);i.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}),e_=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=kt($t,e.__scopeScrollArea),[s,a]=v.useState(),c=v.useRef(null),u=Le(t,c,i.onScrollbarXChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(Of,{"data-orientation":"horizontal",...o,ref:u,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Bo(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,h)=>{if(i.viewport){const p=i.viewport.scrollLeft+d.deltaX;e.onWheelScroll(p),$f(p,h)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&s&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:mo(s.paddingLeft),paddingEnd:mo(s.paddingRight)}})}})}),t_=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,i=kt($t,e.__scopeScrollArea),[s,a]=v.useState(),c=v.useRef(null),u=Le(t,c,i.onScrollbarYChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(Of,{"data-orientation":"vertical",...o,ref:u,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Bo(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,h)=>{if(i.viewport){const p=i.viewport.scrollTop+d.deltaY;e.onWheelScroll(p),$f(p,h)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&s&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:mo(s.paddingTop),paddingEnd:mo(s.paddingBottom)}})}})}),[n_,Rf]=Nf($t),Of=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:i,onThumbPointerUp:s,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:h,...p}=e,f=kt($t,n),[x,m]=v.useState(null),y=Le(t,R=>m(R)),g=v.useRef(null),b=v.useRef(""),k=f.viewport,S=r.content-r.viewport,N=it(d),C=it(c),E=Uo(h,10);function T(R){if(g.current){const M=R.clientX-g.current.left,L=R.clientY-g.current.top;u({x:M,y:L})}}return v.useEffect(()=>{const R=M=>{const L=M.target;x?.contains(L)&&N(M,S)};return document.addEventListener("wheel",R,{passive:!1}),()=>document.removeEventListener("wheel",R,{passive:!1})},[k,x,S,N]),v.useEffect(C,[r,C]),Zn(x,E),Zn(f.content,E),l.jsx(n_,{scope:n,scrollbar:x,hasThumb:o,onThumbChange:it(i),onThumbPointerUp:it(s),onThumbPositionChange:C,onThumbPointerDown:it(a),children:l.jsx(Ce.div,{...p,ref:y,style:{position:"absolute",...p.style},onPointerDown:ke(e.onPointerDown,R=>{R.button===0&&(R.target.setPointerCapture(R.pointerId),g.current=x.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),T(R))}),onPointerMove:ke(e.onPointerMove,T),onPointerUp:ke(e.onPointerUp,R=>{const M=R.target;M.hasPointerCapture(R.pointerId)&&M.releasePointerCapture(R.pointerId),document.body.style.webkitUserSelect=b.current,f.viewport&&(f.viewport.style.scrollBehavior=""),g.current=null})})})}),po="ScrollAreaThumb",Df=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Rf(po,e.__scopeScrollArea);return l.jsx(wt,{present:n||o.hasThumb,children:l.jsx(r_,{ref:t,...r})})}),r_=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,i=kt(po,n),s=Rf(po,n),{onThumbPositionChange:a}=s,c=Le(t,h=>s.onThumbChange(h)),u=v.useRef(void 0),d=Uo(()=>{u.current&&(u.current(),u.current=void 0)},100);return v.useEffect(()=>{const h=i.viewport;if(h){const p=()=>{if(d(),!u.current){const f=s_(h,a);u.current=f,a()}};return a(),h.addEventListener("scroll",p),()=>h.removeEventListener("scroll",p)}},[i.viewport,d,a]),l.jsx(Ce.div,{"data-state":s.hasThumb?"visible":"hidden",...o,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:ke(e.onPointerDownCapture,h=>{const f=h.target.getBoundingClientRect(),x=h.clientX-f.left,m=h.clientY-f.top;s.onThumbPointerDown({x,y:m})}),onPointerUp:ke(e.onPointerUp,s.onThumbPointerUp)})});Df.displayName=po;var ta="ScrollAreaCorner",Mf=v.forwardRef((e,t)=>{const n=kt(ta,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?l.jsx(o_,{...e,ref:t}):null});Mf.displayName=ta;var o_=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=kt(ta,n),[i,s]=v.useState(0),[a,c]=v.useState(0),u=!!(i&&a);return Zn(o.scrollbarX,()=>{const d=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(d),c(d)}),Zn(o.scrollbarY,()=>{const d=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(d),s(d)}),u?l.jsx(Ce.div,{...r,ref:t,style:{width:i,height:a,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function mo(e){return e?parseInt(e,10):0}function Lf(e,t){const n=e/t;return isNaN(n)?0:n}function Bo(e){const t=Lf(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function i_(e,t,n,r="ltr"){const o=Bo(n),i=o/2,s=t||i,a=o-s,c=n.scrollbar.paddingStart+s,u=n.scrollbar.size-n.scrollbar.paddingEnd-a,d=n.content-n.viewport,h=r==="ltr"?[0,d]:[d*-1,0];return Ff([c,u],h)(e)}function Al(e,t,n="ltr"){const r=Bo(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-o,s=t.content-t.viewport,a=i-r,c=n==="ltr"?[0,s]:[s*-1,0],u=Ji(e,c);return Ff([0,s],[0,a])(u)}function Ff(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 $f(e,t){return e>0&&e<t}var s_=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function o(){const i={left:e.scrollLeft,top:e.scrollTop},s=n.left!==i.left,a=n.top!==i.top;(s||a)&&t(),n=i,r=window.requestAnimationFrame(o)})(),()=>window.cancelAnimationFrame(r)};function Uo(e,t){const n=it(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 Zn(e,t){const n=it(t);Qe(()=>{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 a_=Tf,l_=If,c_=Mf,u_=[" ","Enter","ArrowUp","ArrowDown"],d_=[" ","Enter"],pn="Select",[Zo,Vo,f_]=xd(pn),[Xn]=Kt(pn,[f_,$o]),Wo=$o(),[h_,sn]=Xn(pn),[p_,m_]=Xn(pn),Bf=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:i,value:s,defaultValue:a,onValueChange:c,dir:u,name:d,autoComplete:h,disabled:p,required:f,form:x}=e,m=Wo(t),[y,g]=v.useState(null),[b,k]=v.useState(null),[S,N]=v.useState(!1),C=Io(u),[E,T]=dn({prop:r,defaultProp:o??!1,onChange:i,caller:pn}),[R,M]=dn({prop:s,defaultProp:a,onChange:c,caller:pn}),L=v.useRef(null),j=y?x||!!y.closest("form"):!0,[D,w]=v.useState(new Set),P=Array.from(D).map(H=>H.props.value).join(";");return l.jsx(yf,{...m,children:l.jsxs(h_,{required:f,scope:t,trigger:y,onTriggerChange:g,valueNode:b,onValueNodeChange:k,valueNodeHasChildren:S,onValueNodeHasChildrenChange:N,contentId:Ot(),value:R,onValueChange:M,open:E,onOpenChange:T,dir:C,triggerPointerDownPosRef:L,disabled:p,children:[l.jsx(Zo.Provider,{scope:t,children:l.jsx(p_,{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})}),j?l.jsxs(ch,{"aria-hidden":!0,required:f,tabIndex:-1,name:d,autoComplete:h,value:R,onChange:H=>M(H.target.value),disabled:p,form:x,children:[R===void 0?l.jsx("option",{value:""}):null,Array.from(D)]},P):null]})})};Bf.displayName=pn;var Uf="SelectTrigger",Zf=v.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,i=Wo(n),s=sn(Uf,n),a=s.disabled||r,c=Le(t,s.onTriggerChange),u=Vo(n),d=v.useRef("touch"),[h,p,f]=dh(m=>{const y=u().filter(k=>!k.disabled),g=y.find(k=>k.value===s.value),b=fh(y,m,g);b!==void 0&&s.onValueChange(b.value)}),x=m=>{a||(s.onOpenChange(!0),f()),m&&(s.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return l.jsx(vf,{asChild:!0,...i,children:l.jsx(Ce.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":uh(s.value)?"":void 0,...o,ref:c,onClick:ke(o.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&x(m)}),onPointerDown:ke(o.onPointerDown,m=>{d.current=m.pointerType;const y=m.target;y.hasPointerCapture(m.pointerId)&&y.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(x(m),m.preventDefault())}),onKeyDown:ke(o.onKeyDown,m=>{const y=h.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&p(m.key),!(y&&m.key===" ")&&u_.includes(m.key)&&(x(),m.preventDefault())})})})});Zf.displayName=Uf;var Vf="SelectValue",Wf=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:i,placeholder:s="",...a}=e,c=sn(Vf,n),{onValueNodeHasChildrenChange:u}=c,d=i!==void 0,h=Le(t,c.onValueNodeChange);return Qe(()=>{u(d)},[u,d]),l.jsx(Ce.span,{...a,ref:h,style:{pointerEvents:"none"},children:uh(c.value)?l.jsx(l.Fragment,{children:s}):i})});Wf.displayName=Vf;var g_="SelectIcon",Hf=v.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return l.jsx(Ce.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});Hf.displayName=g_;var x_="SelectPortal",qf=e=>l.jsx(Po,{asChild:!0,...e});qf.displayName=x_;var mn="SelectContent",Kf=v.forwardRef((e,t)=>{const n=sn(mn,e.__scopeSelect),[r,o]=v.useState();if(Qe(()=>{o(new DocumentFragment)},[]),!n.open){const i=r;return i?kr.createPortal(l.jsx(Gf,{scope:e.__scopeSelect,children:l.jsx(Zo.Slot,{scope:e.__scopeSelect,children:l.jsx("div",{children:e.children})})}),i):null}return l.jsx(Jf,{...e,ref:t})});Kf.displayName=mn;var St=10,[Gf,an]=Xn(mn),y_="SelectContentImpl",v_=Bn("SelectContent.RemoveScroll"),Jf=v.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:i,onPointerDownOutside:s,side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:p,collisionPadding:f,sticky:x,hideWhenDetached:m,avoidCollisions:y,...g}=e,b=sn(mn,n),[k,S]=v.useState(null),[N,C]=v.useState(null),E=Le(t,te=>S(te)),[T,R]=v.useState(null),[M,L]=v.useState(null),j=Vo(n),[D,w]=v.useState(!1),P=v.useRef(!1);v.useEffect(()=>{if(k)return Rd(k)},[k]),Cd();const H=v.useCallback(te=>{const[ce,...fe]=j().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&&N&&(N.scrollTop=0),Ee===ge&&N&&(N.scrollTop=N.scrollHeight),Ee?.focus(),document.activeElement!==xe))return},[j,N]),B=v.useCallback(()=>H([T,k]),[H,T,k]);v.useEffect(()=>{D&&B()},[D,B]);const{onOpenChange:q,triggerPointerDownPosRef:X}=b;v.useEffect(()=>{if(k){let te={x:0,y:0};const ce=ge=>{te={x:Math.abs(Math.round(ge.pageX)-(X.current?.x??0)),y:Math.abs(Math.round(ge.pageY)-(X.current?.y??0))}},fe=ge=>{te.x<=10&&te.y<=10?ge.preventDefault():k.contains(ge.target)||q(!1),document.removeEventListener("pointermove",ce),X.current=null};return X.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,X]),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[A,W]=dh(te=>{const ce=j().filter(xe=>!xe.disabled),fe=ce.find(xe=>xe.ref.current===document.activeElement),ge=fh(ce,te,fe);ge&&setTimeout(()=>ge.ref.current.focus())}),V=v.useCallback((te,ce,fe)=>{const ge=!P.current&&!fe;(b.value!==void 0&&b.value===ce||ge)&&(R(te),ge&&(P.current=!0))},[b.value]),I=v.useCallback(()=>k?.focus(),[k]),oe=v.useCallback((te,ce,fe)=>{const ge=!P.current&&!fe;(b.value!==void 0&&b.value===ce||ge)&&L(te)},[b.value]),Y=r==="popper"?Yi:Yf,de=Y===Yi?{side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:p,collisionPadding:f,sticky:x,hideWhenDetached:m,avoidCollisions:y}:{};return l.jsx(Gf,{scope:n,content:k,viewport:N,onViewportChange:C,itemRefCallback:V,selectedItem:T,onItemLeave:I,itemTextRefCallback:oe,focusSelectedItem:B,selectedItemText:M,position:r,isPositioned:D,searchRef:A,children:l.jsx(Bs,{as:v_,allowPinchZoom:!0,children:l.jsx($s,{asChild:!0,trapped:b.open,onMountAutoFocus:te=>{te.preventDefault()},onUnmountAutoFocus:ke(o,te=>{b.trigger?.focus({preventScroll:!0}),te.preventDefault()}),children:l.jsx(zo,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:te=>te.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:l.jsx(Y,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:te=>te.preventDefault(),...g,...de,onPlaced:()=>w(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:ke(g.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=j().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()}})})})})})})});Jf.displayName=y_;var b_="SelectItemAlignedPosition",Yf=v.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,i=sn(mn,n),s=an(mn,n),[a,c]=v.useState(null),[u,d]=v.useState(null),h=Le(t,E=>d(E)),p=Vo(n),f=v.useRef(!1),x=v.useRef(!0),{viewport:m,selectedItem:y,selectedItemText:g,focusSelectedItem:b}=s,k=v.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&u&&m&&y&&g){const E=i.trigger.getBoundingClientRect(),T=u.getBoundingClientRect(),R=i.valueNode.getBoundingClientRect(),M=g.getBoundingClientRect();if(i.dir!=="rtl"){const xe=M.left-T.left,Ee=R.left-xe,Fe=E.left-Ee,_=E.width+Fe,ee=Math.max(_,T.width),G=window.innerWidth-St,O=Ji(Ee,[St,Math.max(St,G-ee)]);a.style.minWidth=_+"px",a.style.left=O+"px"}else{const xe=T.right-M.right,Ee=window.innerWidth-R.right-xe,Fe=window.innerWidth-E.right-Ee,_=E.width+Fe,ee=Math.max(_,T.width),G=window.innerWidth-St,O=Ji(Ee,[St,Math.max(St,G-ee)]);a.style.minWidth=_+"px",a.style.right=O+"px"}const L=p(),j=window.innerHeight-St*2,D=m.scrollHeight,w=window.getComputedStyle(u),P=parseInt(w.borderTopWidth,10),H=parseInt(w.paddingTop,10),B=parseInt(w.borderBottomWidth,10),q=parseInt(w.paddingBottom,10),X=P+H+D+q+B,A=Math.min(y.offsetHeight*5,X),W=window.getComputedStyle(m),V=parseInt(W.paddingTop,10),I=parseInt(W.paddingBottom,10),oe=E.top+E.height/2-St,Y=j-oe,de=y.offsetHeight/2,te=y.offsetTop+de,ce=P+H+te,fe=X-ce;if(ce<=oe){const xe=L.length>0&&y===L[L.length-1].ref.current;a.style.bottom="0px";const Ee=u.clientHeight-m.offsetTop-m.offsetHeight,Fe=Math.max(Y,de+(xe?I:0)+Ee+B),_=ce+Fe;a.style.height=_+"px"}else{const xe=L.length>0&&y===L[0].ref.current;a.style.top="0px";const Fe=Math.max(oe,P+m.offsetTop+(xe?V:0)+de)+fe;a.style.height=Fe+"px",m.scrollTop=ce-oe+m.offsetTop}a.style.margin=`${St}px 0`,a.style.minHeight=A+"px",a.style.maxHeight=j+"px",r?.(),requestAnimationFrame(()=>f.current=!0)}},[p,i.trigger,i.valueNode,a,u,m,y,g,i.dir,r]);Qe(()=>k(),[k]);const[S,N]=v.useState();Qe(()=>{u&&N(window.getComputedStyle(u).zIndex)},[u]);const C=v.useCallback(E=>{E&&x.current===!0&&(k(),b?.(),x.current=!1)},[k,b]);return l.jsx(k_,{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}})})})});Yf.displayName=b_;var w_="SelectPopperPosition",Yi=v.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=St,...i}=e,s=Wo(n);return l.jsx(bf,{...s,...i,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Yi.displayName=w_;var[k_,na]=Xn(mn,{}),Xi="SelectViewport",Xf=v.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,i=an(Xi,n),s=na(Xi,n),a=Le(t,i.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(Zo.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:ke(o.onScroll,u=>{const d=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:p}=s;if(p?.current&&h){const f=Math.abs(c.current-d.scrollTop);if(f>0){const x=window.innerHeight-St*2,m=parseFloat(h.style.minHeight),y=parseFloat(h.style.height),g=Math.max(m,y);if(g<x){const b=g+f,k=Math.min(x,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})})})]})});Xf.displayName=Xi;var Qf="SelectGroup",[__,S_]=Xn(Qf),C_=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Ot();return l.jsx(__,{scope:n,id:o,children:l.jsx(Ce.div,{role:"group","aria-labelledby":o,...r,ref:t})})});C_.displayName=Qf;var eh="SelectLabel",j_=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=S_(eh,n);return l.jsx(Ce.div,{id:o.id,...r,ref:t})});j_.displayName=eh;var go="SelectItem",[E_,th]=Xn(go),nh=v.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:i,...s}=e,a=sn(go,n),c=an(go,n),u=a.value===r,[d,h]=v.useState(i??""),[p,f]=v.useState(!1),x=Le(t,b=>c.itemRefCallback?.(b,r,o)),m=Ot(),y=v.useRef("touch"),g=()=>{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(E_,{scope:n,value:r,disabled:o,textId:m,isSelected:u,onItemTextChange:v.useCallback(b=>{h(k=>k||(b?.textContent??"").trim())},[]),children:l.jsx(Zo.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,...s,ref:x,onFocus:ke(s.onFocus,()=>f(!0)),onBlur:ke(s.onBlur,()=>f(!1)),onClick:ke(s.onClick,()=>{y.current!=="mouse"&&g()}),onPointerUp:ke(s.onPointerUp,()=>{y.current==="mouse"&&g()}),onPointerDown:ke(s.onPointerDown,b=>{y.current=b.pointerType}),onPointerMove:ke(s.onPointerMove,b=>{y.current=b.pointerType,o?c.onItemLeave?.():y.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ke(s.onPointerLeave,b=>{b.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:ke(s.onKeyDown,b=>{c.searchRef?.current!==""&&b.key===" "||(d_.includes(b.key)&&g(),b.key===" "&&b.preventDefault())})})})})});nh.displayName=go;var dr="SelectItemText",rh=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...i}=e,s=sn(dr,n),a=an(dr,n),c=th(dr,n),u=m_(dr,n),[d,h]=v.useState(null),p=Le(t,g=>h(g),c.onItemTextChange,g=>a.itemTextRefCallback?.(g,c.value,c.disabled)),f=d?.textContent,x=v.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:f},c.value),[c.disabled,c.value,f]),{onNativeOptionAdd:m,onNativeOptionRemove:y}=u;return Qe(()=>(m(x),()=>y(x)),[m,y,x]),l.jsxs(l.Fragment,{children:[l.jsx(Ce.span,{id:c.textId,...i,ref:p}),c.isSelected&&s.valueNode&&!s.valueNodeHasChildren?kr.createPortal(i.children,s.valueNode):null]})});rh.displayName=dr;var oh="SelectItemIndicator",ih=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return th(oh,n).isSelected?l.jsx(Ce.span,{"aria-hidden":!0,...r,ref:t}):null});ih.displayName=oh;var Qi="SelectScrollUpButton",sh=v.forwardRef((e,t)=>{const n=an(Qi,e.__scopeSelect),r=na(Qi,e.__scopeSelect),[o,i]=v.useState(!1),s=Le(t,r.onScrollButtonChange);return Qe(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=c.scrollTop>0;i(u)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?l.jsx(lh,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});sh.displayName=Qi;var es="SelectScrollDownButton",ah=v.forwardRef((e,t)=>{const n=an(es,e.__scopeSelect),r=na(es,e.__scopeSelect),[o,i]=v.useState(!1),s=Le(t,r.onScrollButtonChange);return Qe(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)<u;i(d)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?l.jsx(lh,{...e,ref:s,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});ah.displayName=es;var lh=v.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,i=an("SelectScrollButton",n),s=v.useRef(null),a=Vo(n),c=v.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),Qe(()=>{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:ke(o.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:ke(o.onPointerMove,()=>{i.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:ke(o.onPointerLeave,()=>{c()})})}),N_="SelectSeparator",T_=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return l.jsx(Ce.div,{"aria-hidden":!0,...r,ref:t})});T_.displayName=N_;var ts="SelectArrow",A_=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Wo(n),i=sn(ts,n),s=an(ts,n);return i.open&&s.position==="popper"?l.jsx(wf,{...o,...r,ref:t}):null});A_.displayName=ts;var I_="SelectBubbleInput",ch=v.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=v.useRef(null),i=Le(r,o),s=x2(t);return v.useEffect(()=>{const a=o.current;if(!a)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(s!==t&&d){const h=new Event("change",{bubbles:!0});d.call(a,t),a.dispatchEvent(h)}},[s,t]),l.jsx(Ce.select,{...n,style:{...md,...n.style},ref:i,defaultValue:t})});ch.displayName=I_;function uh(e){return e===""||e===void 0}function dh(e){const t=it(e),n=v.useRef(""),r=v.useRef(0),o=v.useCallback(s=>{const a=n.current+s;t(a),(function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(a)},[t]),i=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,i]}function fh(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=z_(e,Math.max(i,0));o.length===1&&(s=s.filter(u=>u!==n));const c=s.find(u=>u.textValue.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function z_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var P_=Bf,R_=Zf,O_=Wf,D_=Hf,M_=qf,L_=Kf,F_=Xf,$_=nh,B_=rh,U_=ih,Z_=sh,V_=ah,W_="Separator",Il="horizontal",H_=["horizontal","vertical"],hh=v.forwardRef((e,t)=>{const{decorative:n,orientation:r=Il,...o}=e,i=q_(r)?r:Il,a=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return l.jsx(Ce.div,{"data-orientation":i,...a,...o,ref:t})});hh.displayName=W_;function q_(e){return H_.includes(e)}var K_=hh,Ho="Tabs",[G_]=Kt(Ho,[_f]),ph=_f(),[J_,ra]=G_(Ho),mh=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=Io(a),[h,p]=dn({prop:r,onChange:o,defaultProp:i??"",caller:Ho});return l.jsx(J_,{scope:n,baseId:Ot(),value:h,onValueChange:p,orientation:s,dir:d,activationMode:c,children:l.jsx(Ce.div,{dir:d,"data-orientation":s,...u,ref:t})})});mh.displayName=Ho;var gh="TabsList",xh=v.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=ra(gh,n),s=ph(n);return l.jsx(Kk,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:l.jsx(Ce.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});xh.displayName=gh;var yh="TabsTrigger",vh=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=ra(yh,n),a=ph(n),c=kh(s.baseId,r),u=_h(s.baseId,r),d=r===s.value;return l.jsx(Gk,{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,...i,ref:t,onMouseDown:ke(e.onMouseDown,h=>{!o&&h.button===0&&h.ctrlKey===!1?s.onValueChange(r):h.preventDefault()}),onKeyDown:ke(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&s.onValueChange(r)}),onFocus:ke(e.onFocus,()=>{const h=s.activationMode!=="manual";!d&&!o&&h&&s.onValueChange(r)})})})});vh.displayName=yh;var bh="TabsContent",wh=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=ra(bh,n),c=kh(a.baseId,r),u=_h(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(wt,{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,...s,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:p&&i})})});wh.displayName=bh;function kh(e,t){return`${e}-trigger-${t}`}function _h(e,t){return`${e}-content-${t}`}var Y_=mh,X_=xh,Q_=vh,eS=wh,[qo]=Kt("Tooltip",[$o]),Ko=$o(),Sh="TooltipProvider",tS=700,ns="tooltip.open",[nS,oa]=qo(Sh),Ch=e=>{const{__scopeTooltip:t,delayDuration:n=tS,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,s=v.useRef(!0),a=v.useRef(!1),c=v.useRef(0);return v.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),l.jsx(nS,{scope:t,isOpenDelayedRef:s,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(c.current),s.current=!1},[]),onClose:v.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>s.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:v.useCallback(u=>{a.current=u},[]),disableHoverableContent:o,children:i})};Ch.displayName=Sh;var br="Tooltip",[rS,jr]=qo(br),jh=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,c=oa(br,e.__scopeTooltip),u=Ko(t),[d,h]=v.useState(null),p=Ot(),f=v.useRef(0),x=s??c.disableHoverableContent,m=a??c.delayDuration,y=v.useRef(!1),[g,b]=dn({prop:r,defaultProp:o??!1,onChange:E=>{E?(c.onOpen(),document.dispatchEvent(new CustomEvent(ns))):c.onClose(),i?.(E)},caller:br}),k=v.useMemo(()=>g?y.current?"delayed-open":"instant-open":"closed",[g]),S=v.useCallback(()=>{window.clearTimeout(f.current),f.current=0,y.current=!1,b(!0)},[b]),N=v.useCallback(()=>{window.clearTimeout(f.current),f.current=0,b(!1)},[b]),C=v.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{y.current=!0,b(!0),f.current=0},m)},[m,b]);return v.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),l.jsx(yf,{...u,children:l.jsx(rS,{scope:t,contentId:p,open:g,stateAttribute:k,trigger:d,onTriggerChange:h,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayedRef.current?C():S()},[c.isOpenDelayedRef,C,S]),onTriggerLeave:v.useCallback(()=>{x?N():(window.clearTimeout(f.current),f.current=0)},[N,x]),onOpen:S,onClose:N,disableHoverableContent:x,children:n})})};jh.displayName=br;var rs="TooltipTrigger",Eh=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=jr(rs,n),i=oa(rs,n),s=Ko(n),a=v.useRef(null),c=Le(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(vf,{asChild:!0,...s,children:l.jsx(Ce.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:c,onPointerMove:ke(e.onPointerMove,p=>{p.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:ke(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:ke(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:ke(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:ke(e.onBlur,o.onClose),onClick:ke(e.onClick,o.onClose)})})});Eh.displayName=rs;var ia="TooltipPortal",[oS,iS]=qo(ia,{forceMount:void 0}),Nh=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,i=jr(ia,t);return l.jsx(oS,{scope:t,forceMount:n,children:l.jsx(wt,{present:n||i.open,children:l.jsx(Po,{asChild:!0,container:o,children:r})})})};Nh.displayName=ia;var Vn="TooltipContent",Th=v.forwardRef((e,t)=>{const n=iS(Vn,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=jr(Vn,e.__scopeTooltip);return l.jsx(wt,{present:r||s.open,children:s.disableHoverableContent?l.jsx(Ah,{side:o,...i,ref:t}):l.jsx(sS,{side:o,...i,ref:t})})}),sS=v.forwardRef((e,t)=>{const n=jr(Vn,e.__scopeTooltip),r=oa(Vn,e.__scopeTooltip),o=v.useRef(null),i=Le(t,o),[s,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((x,m)=>{const y=x.currentTarget,g={x:x.clientX,y:x.clientY},b=uS(g,y.getBoundingClientRect()),k=dS(g,b),S=fS(m.getBoundingClientRect()),N=pS([...k,...S]);a(N),h(!0)},[h]);return v.useEffect(()=>()=>p(),[p]),v.useEffect(()=>{if(c&&d){const x=y=>f(y,d),m=y=>f(y,c);return c.addEventListener("pointerleave",x),d.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",x),d.removeEventListener("pointerleave",m)}}},[c,d,f,p]),v.useEffect(()=>{if(s){const x=m=>{const y=m.target,g={x:m.clientX,y:m.clientY},b=c?.contains(y)||d?.contains(y),k=!hS(g,s);b?p():k&&(p(),u())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,d,s,u,p]),l.jsx(Ah,{...e,ref:i})}),[aS,lS]=qo(br,{isInside:!1}),cS=A1("TooltipContent"),Ah=v.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,c=jr(Vn,n),u=Ko(n),{onClose:d}=c;return v.useEffect(()=>(document.addEventListener(ns,d),()=>document.removeEventListener(ns,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(zo,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:l.jsxs(bf,{"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(cS,{children:r}),l.jsx(aS,{scope:n,isInside:!0,children:l.jsx(M1,{id:c.contentId,role:"tooltip",children:o||r})})]})})});Th.displayName=Vn;var Ih="TooltipArrow",zh=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Ko(n);return lS(Ih,n).isInside?null:l.jsx(wf,{...o,...r,ref:t})});zh.displayName=Ih;function uS(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function dS(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 fS(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 hS(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;i<t.length;s=i++){const a=t[i],c=t[s],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 pS(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),mS(t)}function mS(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.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 gS=Ch,xS=jh,yS=Eh,vS=Nh,bS=Th,wS=zh;function Te({delayDuration:e=0,...t}){return l.jsx(gS,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Ie({...e}){return l.jsx(xS,{"data-slot":"tooltip",...e})}function ze({...e}){return l.jsx(yS,{"data-slot":"tooltip-trigger",...e})}function Pe({className:e,sideOffset:t=0,children:n,...r}){return l.jsx(vS,{children:l.jsxs(bS,{"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(wS,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}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 bi={exports:{}};var zl;function kS(){return zl||(zl=1,(function(e,t){(function(n){e.exports=n()})(function(){return(function n(r,o,i){function s(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(x){var m=r[u][1][x];return s(m||x)},f,f.exports,n,r,o,i)}return o[u].exports}for(var a=typeof Ur=="function"&&Ur,c=0;c<i.length;c++)s(i[c]);return s})({1:[function(n,r,o){var i=n("./utils"),s=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(c){for(var u,d,h,p,f,x,m,y=[],g=0,b=c.length,k=b,S=i.getTypeOf(c)!=="string";g<c.length;)k=b-g,h=S?(u=c[g++],d=g<b?c[g++]:0,g<b?c[g++]:0):(u=c.charCodeAt(g++),d=g<b?c.charCodeAt(g++):0,g<b?c.charCodeAt(g++):0),p=u>>2,f=(3&u)<<4|d>>4,x=1<k?(15&d)<<2|h>>6:64,m=2<k?63&h:64,y.push(a.charAt(p)+a.charAt(f)+a.charAt(x)+a.charAt(m));return y.join("")},o.decode=function(c){var u,d,h,p,f,x,m=0,y=0,g="data:";if(c.substr(0,g.length)===g)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=s.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|(x=a.indexOf(c.charAt(m++))),b[y++]=u,f!==64&&(b[y++]=d),x!==64&&(b[y++]=h);return b}},{"./support":30,"./utils":32}],2:[function(n,r,o){var i=n("./external"),s=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function u(d,h,p,f,x){this.compressedSize=d,this.uncompressedSize=h,this.crc32=p,this.compression=f,this.compressedContent=x}u.prototype={getContentWorker:function(){var d=new s(i.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 s(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,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 i=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){var i=n("./utils"),s=(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?i.getTypeOf(a)!=="string"?(function(u,d,h,p){var f=s,x=p+h;u^=-1;for(var m=p;m<x;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=s,x=p+h;u^=-1;for(var m=p;m<x;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 i=null;i=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:i}},{lie:37}],7:[function(n,r,o){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=n("pako"),a=n("./utils"),c=n("./stream/GenericWorker"),u=i?"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 s[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 i(f,x){var m,y="";for(m=0;m<x;m++)y+=String.fromCharCode(255&f),f>>>=8;return y}function s(f,x,m,y,g,b){var k,S,N=f.file,C=f.compression,E=b!==u.utf8encode,T=a.transformTo("string",b(N.name)),R=a.transformTo("string",u.utf8encode(N.name)),M=N.comment,L=a.transformTo("string",b(M)),j=a.transformTo("string",u.utf8encode(M)),D=R.length!==N.name.length,w=j.length!==M.length,P="",H="",B="",q=N.dir,X=N.date,A={crc32:0,compressedSize:0,uncompressedSize:0};x&&!m||(A.crc32=f.crc32,A.compressedSize=f.compressedSize,A.uncompressedSize=f.uncompressedSize);var W=0;x&&(W|=8),E||!D&&!w||(W|=2048);var V=0,I=0;q&&(V|=16),g==="UNIX"?(I=798,V|=(function(Y,de){var te=Y;return Y||(te=de?16893:33204),(65535&te)<<16})(N.unixPermissions,q)):(I=20,V|=(function(Y){return 63&(Y||0)})(N.dosPermissions)),k=X.getUTCHours(),k<<=6,k|=X.getUTCMinutes(),k<<=5,k|=X.getUTCSeconds()/2,S=X.getUTCFullYear()-1980,S<<=4,S|=X.getUTCMonth()+1,S<<=5,S|=X.getUTCDate(),D&&(H=i(1,1)+i(d(T),4)+R,P+="up"+i(H.length,2)+H),w&&(B=i(1,1)+i(d(L),4)+j,P+="uc"+i(B.length,2)+B);var oe="";return oe+=`
84
+ \0`,oe+=i(W,2),oe+=C.magic,oe+=i(k,2),oe+=i(S,2),oe+=i(A.crc32,4),oe+=i(A.compressedSize,4),oe+=i(A.uncompressedSize,4),oe+=i(T.length,2),oe+=i(P.length,2),{fileRecord:h.LOCAL_FILE_HEADER+oe+T+P,dirRecord:h.CENTRAL_FILE_HEADER+i(I,2)+oe+i(L.length,2)+"\0\0\0\0"+i(V,4)+i(y,4)+T+P+L}}var a=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),h=n("../signature");function p(f,x,m,y){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=x,this.zipPlatform=m,this.encodeFileName=y,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 x=f.meta.percent||0,m=this.entriesCount,y=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?(x+100*(m-y-1))/m:100}}))},p.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var x=this.streamFiles&&!f.file.dir;if(x){var m=s(f,x,!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 x=this.streamFiles&&!f.file.dir,m=s(f,x,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),x)this.push({data:(function(y){return h.DATA_DESCRIPTOR+i(y.crc32,4)+i(y.compressedSize,4)+i(y.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,x=0;x<this.dirRecords.length;x++)this.push({data:this.dirRecords[x],meta:{percent:100}});var m=this.bytesWritten-f,y=(function(g,b,k,S,N){var C=a.transformTo("string",N(S));return h.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(g,2)+i(g,2)+i(b,4)+i(k,4)+i(C.length,2)+C})(this.dirRecords.length,m,f,this.zipComment,this.encodeFileName);this.push({data:y,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 x=this;return f.on("data",function(m){x.processChunk(m)}),f.on("end",function(){x.closedSource(x.previous.streamInfo),x._sources.length?x.prepareNextSource():x.end()}),f.on("error",function(m){x.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 x=this._sources;if(!c.prototype.error.call(this,f))return!1;for(var m=0;m<x.length;m++)try{x[m].error(f)}catch{}return!0},p.prototype.lock=function(){c.prototype.lock.call(this);for(var f=this._sources,x=0;x<f.length;x++)f[x].lock()},r.exports=p},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){var i=n("../compressions"),s=n("./ZipFileWorker");o.generateWorker=function(a,c,u){var d=new s(c.streamFiles,u,c.platform,c.encodeFileName),h=0;try{a.forEach(function(p,f){h++;var x=(function(b,k){var S=b||k,N=i[S];if(!N)throw new Error(S+" is not a valid compression method !");return N})(f.options.compression,c.compression),m=f.options.compressionOptions||c.compressionOptions||{},y=f.dir,g=f.date;f._compressWorker(x,m).withStreamInfo("file",{name:p,dir:y,date:g,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 i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var s=new i;for(var a in this)typeof this[a]!="function"&&(s[a]=this[a]);return s}}(i.prototype=n("./object")).loadAsync=n("./load"),i.support=n("./support"),i.defaults=n("./defaults"),i.version="3.10.1",i.loadAsync=function(s,a){return new i().loadAsync(s,a)},i.external=n("./external"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){var i=n("./utils"),s=n("./external"),a=n("./utf8"),c=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function h(p){return new s.Promise(function(f,x){var m=p.decompressed.getContentWorker().pipe(new u);m.on("error",function(y){x(y)}).on("end",function(){m.streamInfo.crc32!==p.decompressed.crc32?x(new Error("Corrupted zip : CRC32 mismatch")):f()}).resume()})}r.exports=function(p,f){var x=this;return f=i.extend(f||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),d.isNode&&d.isStream(p)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",p,!0,f.optimizedBinaryString,f.base64).then(function(m){var y=new c(f);return y.load(m),y}).then(function(m){var y=[s.Promise.resolve(m)],g=m.files;if(f.checkCRC32)for(var b=0;b<g.length;b++)y.push(h(g[b]));return s.Promise.all(y)}).then(function(m){for(var y=m.shift(),g=y.files,b=0;b<g.length;b++){var k=g[b],S=k.fileNameStr,N=i.resolve(k.fileNameStr);x.file(N,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||(x.file(N).unsafeOriginalName=S)}return y.zipComment.length&&(x.comment=y.zipComment),x})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){var i=n("../utils"),s=n("../stream/GenericWorker");function a(c,u){s.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(a,s),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!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!s.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 i=n("readable-stream").Readable;function s(a,c,u){i.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(s,i),s.prototype._read=function(){this._helper.resume()},r.exports=s},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,s);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,s)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var s=new Buffer(i);return s.fill(0),s},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(n,r,o){function i(N,C,E){var T,R=a.getTypeOf(C),M=a.extend(E||{},d);M.date=M.date||new Date,M.compression!==null&&(M.compression=M.compression.toUpperCase()),typeof M.unixPermissions=="string"&&(M.unixPermissions=parseInt(M.unixPermissions,8)),M.unixPermissions&&16384&M.unixPermissions&&(M.dir=!0),M.dosPermissions&&16&M.dosPermissions&&(M.dir=!0),M.dir&&(N=g(N)),M.createFolders&&(T=y(N))&&b.call(this,T,!0);var L=R==="string"&&M.binary===!1&&M.base64===!1;E&&E.binary!==void 0||(M.binary=!L),(C instanceof h&&C.uncompressedSize===0||M.dir||!C||C.length===0)&&(M.base64=!1,M.binary=!0,C="",M.compression="STORE",R="string");var j=null;j=C instanceof h||C instanceof c?C:x.isNode&&x.isStream(C)?new m(N,C):a.prepareContent(N,C,M.binary,M.optimizedBinaryString,M.base64);var D=new p(N,j,M);this.files[N]=D}var s=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"),x=n("./nodejsUtils"),m=n("./nodejs/NodejsStreamInputAdapter"),y=function(N){N.slice(-1)==="/"&&(N=N.substring(0,N.length-1));var C=N.lastIndexOf("/");return 0<C?N.substring(0,C):""},g=function(N){return N.slice(-1)!=="/"&&(N+="/"),N},b=function(N,C){return C=C!==void 0?C:d.createFolders,N=g(N),this.files[N]||i.call(this,N,null,{dir:!0,createFolders:C}),this.files[N]};function k(N){return Object.prototype.toString.call(N)==="[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(N){var C,E,T;for(C in this.files)T=this.files[C],(E=C.slice(this.root.length,C.length))&&C.slice(0,this.root.length)===this.root&&N(E,T)},filter:function(N){var C=[];return this.forEach(function(E,T){N(E,T)&&C.push(T)}),C},file:function(N,C,E){if(arguments.length!==1)return N=this.root+N,i.call(this,N,C,E),this;if(k(N)){var T=N;return this.filter(function(M,L){return!L.dir&&T.test(M)})}var R=this.files[this.root+N];return R&&!R.dir?R:null},folder:function(N){if(!N)return this;if(k(N))return this.filter(function(R,M){return M.dir&&N.test(R)});var C=this.root+N,E=b.call(this,C),T=this.clone();return T.root=E.name,T},remove:function(N){N=this.root+N;var C=this.files[N];if(C||(N.slice(-1)!=="/"&&(N+="/"),C=this.files[N]),C&&!C.dir)delete this.files[N];else for(var E=this.filter(function(R,M){return M.name.slice(0,N.length)===N}),T=0;T<E.length;T++)delete this.files[E[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(N){var C,E={};try{if((E=a.extend(N||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=E.type.toLowerCase(),E.compression=E.compression.toUpperCase(),E.type==="binarystring"&&(E.type="string"),!E.type)throw new Error("No output type specified.");a.checkSupport(E.type),E.platform!=="darwin"&&E.platform!=="freebsd"&&E.platform!=="linux"&&E.platform!=="sunos"||(E.platform="UNIX"),E.platform==="win32"&&(E.platform="DOS");var T=E.comment||this.comment||"";C=f.generateWorker(this,E,T)}catch(R){(C=new c("error")).error(R)}return new u(C,E.type||"string",E.mimeType)},generateAsync:function(N,C){return this.generateInternalStream(N).accumulate(C)},generateNodeStream:function(N,C){return(N=N||{}).type||(N.type="nodebuffer"),this.generateInternalStream(N).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 i=n("./DataReader");function s(a){i.call(this,a);for(var c=0;c<this.data.length;c++)a[c]=255&a[c]}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data[this.zero+a]},s.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},s.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]},s.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=s},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){var i=n("../utils");function s(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}s.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 i.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=s},{"../utils":32}],19:[function(n,r,o){var i=n("./Uint8ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.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=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){var i=n("./DataReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},s.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},s.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},s.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=s},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){var i=n("./ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.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=s},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){var i=n("../utils"),s=n("../support"),a=n("./ArrayReader"),c=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(h){var p=i.getTypeOf(h);return i.checkSupport(p),p!=="string"||s.uint8array?p==="nodebuffer"?new u(h):s.uint8array?new d(i.transformTo("uint8array",h)):new a(i.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 i=n("./GenericWorker"),s=n("../utils");function a(c){i.call(this,"ConvertWorker to "+c),this.destType=c}s.inherits(a,i),a.prototype.processChunk=function(c){this.push({data:s.transformTo(this.destType,c.data),meta:c.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){var i=n("./GenericWorker"),s=n("../crc32");function a(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,i),a.prototype.processChunk=function(c){this.streamInfo.crc32=s(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){var i=n("../utils"),s=n("./GenericWorker");function a(c){s.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}i.inherits(a,s),a.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}s.prototype.processChunk.call(this,c)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){var i=n("../utils"),s=n("./GenericWorker");function a(c){s.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=i.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}i.inherits(a,s),a.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.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 i(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,a){return this._listeners[s].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,a){if(this._listeners[s])for(var c=0;c<this._listeners[s].length;c++)this._listeners[s][c].call(this,a)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var a=this;return s.on("data",function(c){a.processChunk(c)}),s.on("end",function(){a.end()}),s.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 s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,a){return this.extraStreamInfo[s]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},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 s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},r.exports=i},{}],29:[function(n,r,o){var i=n("../utils"),s=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(x,m){return new d.Promise(function(y,g){var b=[],k=x._internalType,S=x._outputType,N=x._mimeType;x.on("data",function(C,E){b.push(C),m&&m(E)}).on("error",function(C){b=[],g(C)}).on("end",function(){try{var C=(function(E,T,R){switch(E){case"blob":return i.newBlob(i.transformTo("arraybuffer",T),R);case"base64":return c.encode(T);default:return i.transformTo(E,T)}})(S,(function(E,T){var R,M=0,L=null,j=0;for(R=0;R<T.length;R++)j+=T[R].length;switch(E){case"string":return T.join("");case"array":return Array.prototype.concat.apply([],T);case"uint8array":for(L=new Uint8Array(j),R=0;R<T.length;R++)L.set(T[R],M),M+=T[R].length;return L;case"nodebuffer":return Buffer.concat(T);default:throw new Error("concat : unsupported type '"+E+"'")}})(k,b),N);y(C)}catch(E){g(E)}b=[]}).resume()})}function f(x,m,y){var g=m;switch(m){case"blob":case"arraybuffer":g="uint8array";break;case"base64":g="string"}try{this._internalType=g,this._outputType=m,this._mimeType=y,i.checkSupport(g),this._worker=x.pipe(new s(g)),x.lock()}catch(b){this._worker=new a("error"),this._worker.error(b)}}f.prototype={accumulate:function(x){return p(this,x)},on:function(x,m){var y=this;return x==="data"?this._worker.on(x,function(g){m.call(y,g.data,g.meta)}):this._worker.on(x,function(){i.delay(m,arguments,y)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(x){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new h(this,{objectMode:this._outputType!=="nodebuffer"},x)}},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 i=new ArrayBuffer(0);try{o.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),o.blob=s.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){for(var i=n("./utils"),s=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 s.nodebuffer?a.newBufferFrom(f,"utf-8"):(function(x){var m,y,g,b,k,S=x.length,N=0;for(b=0;b<S;b++)(64512&(y=x.charCodeAt(b)))==55296&&b+1<S&&(64512&(g=x.charCodeAt(b+1)))==56320&&(y=65536+(y-55296<<10)+(g-56320),b++),N+=y<128?1:y<2048?2:y<65536?3:4;for(m=s.uint8array?new Uint8Array(N):new Array(N),b=k=0;k<N;b++)(64512&(y=x.charCodeAt(b)))==55296&&b+1<S&&(64512&(g=x.charCodeAt(b+1)))==56320&&(y=65536+(y-55296<<10)+(g-56320),b++),y<128?m[k++]=y:(y<2048?m[k++]=192|y>>>6:(y<65536?m[k++]=224|y>>>12:(m[k++]=240|y>>>18,m[k++]=128|y>>>12&63),m[k++]=128|y>>>6&63),m[k++]=128|63&y);return m})(f)},o.utf8decode=function(f){return s.nodebuffer?i.transformTo("nodebuffer",f).toString("utf-8"):(function(x){var m,y,g,b,k=x.length,S=new Array(2*k);for(m=y=0;m<k;)if((g=x[m++])<128)S[y++]=g;else if(4<(b=u[g]))S[y++]=65533,m+=b-1;else{for(g&=b===2?31:b===3?15:7;1<b&&m<k;)g=g<<6|63&x[m++],b--;1<b?S[y++]=65533:g<65536?S[y++]=g:(g-=65536,S[y++]=55296|g>>10&1023,S[y++]=56320|1023&g)}return S.length!==y&&(S.subarray?S=S.subarray(0,y):S.length=y),i.applyFromCharCode(S)})(f=i.transformTo(s.uint8array?"uint8array":"array",f))},i.inherits(h,c),h.prototype.processChunk=function(f){var x=i.transformTo(s.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var m=x;(x=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),x.set(m,this.leftOver.length)}else x=this.leftOver.concat(x);this.leftOver=null}var y=(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})(x),g=x;y!==x.length&&(s.uint8array?(g=x.subarray(0,y),this.leftOver=x.subarray(y,x.length)):(g=x.slice(0,y),this.leftOver=x.slice(y,x.length))),this.push({data:o.utf8decode(g),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,i.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 i=n("./support"),s=n("./base64"),a=n("./nodejsUtils"),c=n("./external");function u(m){return m}function d(m,y){for(var g=0;g<m.length;++g)y[g]=255&m.charCodeAt(g);return y}n("setimmediate"),o.newBlob=function(m,y){o.checkSupport("blob");try{return new Blob([m],{type:y})}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return g.append(m),g.getBlob(y)}catch{throw new Error("Bug : can't construct the Blob.")}}};var h={stringifyByChunk:function(m,y,g){var b=[],k=0,S=m.length;if(S<=g)return String.fromCharCode.apply(null,m);for(;k<S;)y==="array"||y==="nodebuffer"?b.push(String.fromCharCode.apply(null,m.slice(k,Math.min(k+g,S)))):b.push(String.fromCharCode.apply(null,m.subarray(k,Math.min(k+g,S)))),k+=g;return b.join("")},stringifyByChar:function(m){for(var y="",g=0;g<m.length;g++)y+=String.fromCharCode(m[g]);return y},applyCanBeUsed:{uint8array:(function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}})()}};function p(m){var y=65536,g=o.getTypeOf(m),b=!0;if(g==="uint8array"?b=h.applyCanBeUsed.uint8array:g==="nodebuffer"&&(b=h.applyCanBeUsed.nodebuffer),b)for(;1<y;)try{return h.stringifyByChunk(m,g,y)}catch{y=Math.floor(y/2)}return h.stringifyByChar(m)}function f(m,y){for(var g=0;g<m.length;g++)y[g]=m[g];return y}o.applyFromCharCode=p;var x={};x.string={string:u,array:function(m){return d(m,new Array(m.length))},arraybuffer:function(m){return x.string.uint8array(m).buffer},uint8array:function(m){return d(m,new Uint8Array(m.length))},nodebuffer:function(m){return d(m,a.allocBuffer(m.length))}},x.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)}},x.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))}},x.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)}},x.nodebuffer={string:p,array:function(m){return f(m,new Array(m.length))},arraybuffer:function(m){return x.nodebuffer.uint8array(m).buffer},uint8array:function(m){return f(m,new Uint8Array(m.length))},nodebuffer:u},o.transformTo=function(m,y){if(y=y||"",!m)return y;o.checkSupport(m);var g=o.getTypeOf(y);return x[g][m](y)},o.resolve=function(m){for(var y=m.split("/"),g=[],b=0;b<y.length;b++){var k=y[b];k==="."||k===""&&b!==0&&b!==y.length-1||(k===".."?g.pop():g.push(k))}return g.join("/")},o.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":i.nodebuffer&&a.isBuffer(m)?"nodebuffer":i.uint8array&&m instanceof Uint8Array?"uint8array":i.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(m){if(!i[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(m){var y,g,b="";for(g=0;g<(m||"").length;g++)b+="\\x"+((y=m.charCodeAt(g))<16?"0":"")+y.toString(16).toUpperCase();return b},o.delay=function(m,y,g){setImmediate(function(){m.apply(g||null,y||[])})},o.inherits=function(m,y){function g(){}g.prototype=y.prototype,m.prototype=new g},o.extend=function(){var m,y,g={};for(m=0;m<arguments.length;m++)for(y in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],y)&&g[y]===void 0&&(g[y]=arguments[m][y]);return g},o.prepareContent=function(m,y,g,b,k){return c.Promise.resolve(y).then(function(S){return i.blob&&(S instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(S))!==-1)&&typeof FileReader<"u"?new c.Promise(function(N,C){var E=new FileReader;E.onload=function(T){N(T.target.result)},E.onerror=function(T){C(T.target.error)},E.readAsArrayBuffer(S)}):S}).then(function(S){var N=o.getTypeOf(S);return N?(N==="arraybuffer"?S=o.transformTo("uint8array",S):N==="string"&&(k?S=s.decode(S):g&&b!==!0&&(S=(function(C){return d(C,i.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 i=n("./reader/readerFor"),s=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 ("+s.pretty(p)+", expected "+s.pretty(h)+")")}},isSignature:function(h,p){var f=this.reader.index;this.reader.setIndex(h);var x=this.reader.readString(4)===p;return this.reader.setIndex(f),x},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=s.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,x=this.zip64EndOfCentralSize-44;0<x;)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===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.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 x=p-f;if(0<x)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=x);else if(x<0)throw new Error("Corrupted zip: missing "+Math.abs(x)+" bytes.")},prepareReader:function(h){this.reader=i(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 i=n("./reader/readerFor"),s=n("./utils"),a=n("./compressedObject"),c=n("./crc32"),u=n("./utf8"),d=n("./compressions"),h=n("./support");function p(f,x){this.options=f,this.loadOptions=x}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(f){var x,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((x=(function(y){for(var g in d)if(Object.prototype.hasOwnProperty.call(d,g)&&d[g].magic===y)return d[g];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,x,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 x=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(x),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=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var x,m,y,g=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4<g;)x=f.readInt(2),m=f.readInt(2),y=f.readData(m),this.extraFields[x]={id:x,length:m,value:y};f.setIndex(g)},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 x=this.findExtraFieldUnicodePath();if(x!==null)this.fileNameStr=x;else{var m=s.transformTo(f,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var y=this.findExtraFieldUnicodeComment();if(y!==null)this.fileCommentStr=y;else{var g=s.transformTo(f,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(g)}}},findExtraFieldUnicodePath:function(){var f=this.extraFields[28789];if(f){var x=i(f.value);return x.readInt(1)!==1||c(this.fileName)!==x.readInt(4)?null:u.utf8decode(x.readData(f.length-5))}return null},findExtraFieldUnicodeComment:function(){var f=this.extraFields[25461];if(f){var x=i(f.value);return x.readInt(1)!==1||c(this.fileComment)!==x.readInt(4)?null:u.utf8decode(x.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 i(x,m,y){this.name=x,this.dir=y.dir,this.date=y.date,this.comment=y.comment,this.unixPermissions=y.unixPermissions,this.dosPermissions=y.dosPermissions,this._data=m,this._dataBinary=y.binary,this.options={compression:y.compression,compressionOptions:y.compressionOptions}}var s=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),c=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");i.prototype={internalStream:function(x){var m=null,y="string";try{if(!x)throw new Error("No output type specified.");var g=(y=x.toLowerCase())==="string"||y==="text";y!=="binarystring"&&y!=="text"||(y="string"),m=this._decompressWorker();var b=!this._dataBinary;b&&!g&&(m=m.pipe(new c.Utf8EncodeWorker)),!b&&g&&(m=m.pipe(new c.Utf8DecodeWorker))}catch(k){(m=new d("error")).error(k)}return new s(m,y,"")},async:function(x,m){return this.internalStream(x).accumulate(m)},nodeStream:function(x,m){return this.internalStream(x||"nodebuffer").toNodejsStream(m)},_compressWorker:function(x,m){if(this._data instanceof u&&this._data.compression.magic===x.magic)return this._data.getCompressedWorker();var y=this._decompressWorker();return this._dataBinary||(y=y.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(y,x,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++)i.prototype[h[f]]=p;r.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(i){var s,a,c=i.MutationObserver||i.WebKitMutationObserver;if(c){var u=0,d=new c(x),h=i.document.createTextNode("");d.observe(h,{characterData:!0}),s=function(){h.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)s="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var m=i.document.createElement("script");m.onreadystatechange=function(){x(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},i.document.documentElement.appendChild(m)}:function(){setTimeout(x,0)};else{var p=new i.MessageChannel;p.port1.onmessage=x,s=function(){p.port2.postMessage(0)}}var f=[];function x(){var m,y;a=!0;for(var g=f.length;g;){for(y=f,f=[],m=-1;++m<g;)y[m]();g=f.length}a=!1}r.exports=function(m){f.push(m)!==1||a||s()}}).call(this,typeof Ar<"u"?Ar:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){var i=n("immediate");function s(){}var a={},c=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function h(g){if(typeof g!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,g!==s&&m(this,g)}function p(g,b,k){this.promise=g,typeof b=="function"&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function f(g,b,k){i(function(){var S;try{S=b(k)}catch(N){return a.reject(g,N)}S===g?a.reject(g,new TypeError("Cannot resolve promise with itself")):a.resolve(g,S)})}function x(g){var b=g&&g.then;if(g&&(typeof g=="object"||typeof g=="function")&&typeof b=="function")return function(){b.apply(g,arguments)}}function m(g,b){var k=!1;function S(E){k||(k=!0,a.reject(g,E))}function N(E){k||(k=!0,a.resolve(g,E))}var C=y(function(){b(N,S)});C.status==="error"&&S(C.value)}function y(g,b){var k={};try{k.value=g(b),k.status="success"}catch(S){k.status="error",k.value=S}return k}(r.exports=h).prototype.finally=function(g){if(typeof g!="function")return this;var b=this.constructor;return this.then(function(k){return b.resolve(g()).then(function(){return k})},function(k){return b.resolve(g()).then(function(){throw k})})},h.prototype.catch=function(g){return this.then(null,g)},h.prototype.then=function(g,b){if(typeof g!="function"&&this.state===u||typeof b!="function"&&this.state===c)return this;var k=new this.constructor(s);return this.state!==d?f(k,this.state===u?g:b,this.outcome):this.queue.push(new p(k,g,b)),k},p.prototype.callFulfilled=function(g){a.resolve(this.promise,g)},p.prototype.otherCallFulfilled=function(g){f(this.promise,this.onFulfilled,g)},p.prototype.callRejected=function(g){a.reject(this.promise,g)},p.prototype.otherCallRejected=function(g){f(this.promise,this.onRejected,g)},a.resolve=function(g,b){var k=y(x,b);if(k.status==="error")return a.reject(g,k.value);var S=k.value;if(S)m(g,S);else{g.state=u,g.outcome=b;for(var N=-1,C=g.queue.length;++N<C;)g.queue[N].callFulfilled(b)}return g},a.reject=function(g,b){g.state=c,g.outcome=b;for(var k=-1,S=g.queue.length;++k<S;)g.queue[k].callRejected(b);return g},h.resolve=function(g){return g instanceof this?g:a.resolve(new this(s),g)},h.reject=function(g){var b=new this(s);return a.reject(b,g)},h.all=function(g){var b=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=g.length,S=!1;if(!k)return this.resolve([]);for(var N=new Array(k),C=0,E=-1,T=new this(s);++E<k;)R(g[E],E);return T;function R(M,L){b.resolve(M).then(function(j){N[L]=j,++C!==k||S||(S=!0,a.resolve(T,N))},function(j){S||(S=!0,a.reject(T,j))})}},h.race=function(g){var b=this;if(Object.prototype.toString.call(g)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=g.length,S=!1;if(!k)return this.resolve([]);for(var N=-1,C=new this(s);++N<k;)E=g[N],b.resolve(E).then(function(T){S||(S=!0,a.resolve(C,T))},function(T){S||(S=!0,a.reject(C,T))});var E;return C}},{immediate:36}],38:[function(n,r,o){var i={};(0,n("./lib/utils/common").assign)(i,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){var i=n("./zlib/deflate"),s=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,x=8;function m(g){if(!(this instanceof m))return new m(g);this.options=s.assign({level:p,method:x,chunkSize:16384,windowBits:15,memLevel:8,strategy:f,to:""},g||{});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=i.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(k!==h)throw new Error(c[k]);if(b.header&&i.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=i.deflateSetDictionary(this.strm,S))!==h)throw new Error(c[k]);this._dict_set=!0}}function y(g,b){var k=new m(b);if(k.push(g,!0),k.err)throw k.msg||c[k.err];return k.result}m.prototype.push=function(g,b){var k,S,N=this.strm,C=this.options.chunkSize;if(this.ended)return!1;S=b===~~b?b:b===!0?4:0,typeof g=="string"?N.input=a.string2buf(g):d.call(g)==="[object ArrayBuffer]"?N.input=new Uint8Array(g):N.input=g,N.next_in=0,N.avail_in=N.input.length;do{if(N.avail_out===0&&(N.output=new s.Buf8(C),N.next_out=0,N.avail_out=C),(k=i.deflate(N,S))!==1&&k!==h)return this.onEnd(k),!(this.ended=!0);N.avail_out!==0&&(N.avail_in!==0||S!==4&&S!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(s.shrinkBuf(N.output,N.next_out))):this.onData(s.shrinkBuf(N.output,N.next_out)))}while((0<N.avail_in||N.avail_out===0)&&k!==1);return S===4?(k=i.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===h):S!==2||(this.onEnd(h),!(N.avail_out=0))},m.prototype.onData=function(g){this.chunks.push(g)},m.prototype.onEnd=function(g){g===h&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},o.Deflate=m,o.deflate=y,o.deflateRaw=function(g,b){return(b=b||{}).raw=!0,y(g,b)},o.gzip=function(g,b){return(b=b||{}).gzip=!0,y(g,b)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){var i=n("./zlib/inflate"),s=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=s.assign({chunkSize:16384,windowBits:0,to:""},m||{});var y=this.options;y.raw&&0<=y.windowBits&&y.windowBits<16&&(y.windowBits=-y.windowBits,y.windowBits===0&&(y.windowBits=-15)),!(0<=y.windowBits&&y.windowBits<16)||m&&m.windowBits||(y.windowBits+=32),15<y.windowBits&&y.windowBits<48&&(15&y.windowBits)==0&&(y.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var g=i.inflateInit2(this.strm,y.windowBits);if(g!==c.Z_OK)throw new Error(u[g]);this.header=new h,i.inflateGetHeader(this.strm,this.header)}function x(m,y){var g=new f(y);if(g.push(m,!0),g.err)throw g.msg||u[g.err];return g.result}f.prototype.push=function(m,y){var g,b,k,S,N,C,E=this.strm,T=this.options.chunkSize,R=this.options.dictionary,M=!1;if(this.ended)return!1;b=y===~~y?y:y===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof m=="string"?E.input=a.binstring2buf(m):p.call(m)==="[object ArrayBuffer]"?E.input=new Uint8Array(m):E.input=m,E.next_in=0,E.avail_in=E.input.length;do{if(E.avail_out===0&&(E.output=new s.Buf8(T),E.next_out=0,E.avail_out=T),(g=i.inflate(E,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&R&&(C=typeof R=="string"?a.string2buf(R):p.call(R)==="[object ArrayBuffer]"?new Uint8Array(R):R,g=i.inflateSetDictionary(this.strm,C)),g===c.Z_BUF_ERROR&&M===!0&&(g=c.Z_OK,M=!1),g!==c.Z_STREAM_END&&g!==c.Z_OK)return this.onEnd(g),!(this.ended=!0);E.next_out&&(E.avail_out!==0&&g!==c.Z_STREAM_END&&(E.avail_in!==0||b!==c.Z_FINISH&&b!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=a.utf8border(E.output,E.next_out),S=E.next_out-k,N=a.buf2string(E.output,k),E.next_out=S,E.avail_out=T-S,S&&s.arraySet(E.output,E.output,k,S,0),this.onData(N)):this.onData(s.shrinkBuf(E.output,E.next_out)))),E.avail_in===0&&E.avail_out===0&&(M=!0)}while((0<E.avail_in||E.avail_out===0)&&g!==c.Z_STREAM_END);return g===c.Z_STREAM_END&&(b=c.Z_FINISH),b===c.Z_FINISH?(g=i.inflateEnd(this.strm),this.onEnd(g),this.ended=!0,g===c.Z_OK):b!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(E.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=s.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},o.Inflate=f,o.inflate=x,o.inflateRaw=function(m,y){return(y=y||{}).raw=!0,x(m,y)},o.ungzip=x},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(c){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var 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 s={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,x;for(u=h=0,d=c.length;u<d;u++)h+=c[u].length;for(x=new Uint8Array(h),u=p=0,d=c.length;u<d;u++)f=c[u],x.set(f,p),p+=f.length;return x}},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,s)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,a))},o.setTyped(i)},{}],42:[function(n,r,o){var i=n("./common"),s=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var c=new i.Buf8(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(h,p){if(p<65537&&(h.subarray&&a||!h.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(h,p));for(var f="",x=0;x<p;x++)f+=String.fromCharCode(h[x]);return f}c[254]=c[254]=1,o.string2buf=function(h){var p,f,x,m,y,g=h.length,b=0;for(m=0;m<g;m++)(64512&(f=h.charCodeAt(m)))==55296&&m+1<g&&(64512&(x=h.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(x-56320),m++),b+=f<128?1:f<2048?2:f<65536?3:4;for(p=new i.Buf8(b),m=y=0;y<b;m++)(64512&(f=h.charCodeAt(m)))==55296&&m+1<g&&(64512&(x=h.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(x-56320),m++),f<128?p[y++]=f:(f<2048?p[y++]=192|f>>>6:(f<65536?p[y++]=224|f>>>12:(p[y++]=240|f>>>18,p[y++]=128|f>>>12&63),p[y++]=128|f>>>6&63),p[y++]=128|63&f);return p},o.buf2binstring=function(h){return d(h,h.length)},o.binstring2buf=function(h){for(var p=new i.Buf8(h.length),f=0,x=p.length;f<x;f++)p[f]=h.charCodeAt(f);return p},o.buf2string=function(h,p){var f,x,m,y,g=p||h.length,b=new Array(2*g);for(f=x=0;f<g;)if((m=h[f++])<128)b[x++]=m;else if(4<(y=c[m]))b[x++]=65533,f+=y-1;else{for(m&=y===2?31:y===3?15:7;1<y&&f<g;)m=m<<6|63&h[f++],y--;1<y?b[x++]=65533:m<65536?b[x++]=m:(m-=65536,b[x++]=55296|m>>10&1023,b[x++]=56320|1023&m)}return d(b,x)},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(i,s,a,c){for(var u=65535&i|0,d=i>>>16&65535|0,h=0;a!==0;){for(a-=h=2e3<a?2e3:a;d=d+(u=u+s[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 i=(function(){for(var s,a=[],c=0;c<256;c++){s=c;for(var u=0;u<8;u++)s=1&s?3988292384^s>>>1:s>>>1;a[c]=s}return a})();r.exports=function(s,a,c,u){var d=i,h=u+c;s^=-1;for(var p=u;p<h;p++)s=s>>>8^d[255&(s^a[p])];return-1^s}},{}],46:[function(n,r,o){var i,s=n("../utils/common"),a=n("./trees"),c=n("./adler32"),u=n("./crc32"),d=n("./messages"),h=0,p=4,f=0,x=-2,m=-1,y=4,g=2,b=8,k=9,S=286,N=30,C=19,E=2*S+1,T=15,R=3,M=258,L=M+R+1,j=42,D=113,w=1,P=2,H=3,B=4;function q(_,ee){return _.msg=d[ee],ee}function X(_){return(_<<1)-(4<_?9:0)}function A(_){for(var ee=_.length;0<=--ee;)_[ee]=0}function W(_){var ee=_.state,G=ee.pending;G>_.avail_out&&(G=_.avail_out),G!==0&&(s.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 I(_,ee){_.pending_buf[_.pending++]=ee}function oe(_,ee){_.pending_buf[_.pending++]=ee>>>8&255,_.pending_buf[_.pending++]=255&ee}function Y(_,ee){var G,O,z=_.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,ie=_.prev,Z=_.strstart+M,re=ne[F+U-1],ue=ne[F+U];_.prev_length>=_.good_match&&(z>>=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(O=M-(Z-F),F=Z-M,U<O){if(_.match_start=ee,J<=(U=O))break;re=ne[F+U-1],ue=ne[F+U]}}while((ee=ie[ee&le])>$&&--z!=0);return U<=_.lookahead?U:_.lookahead}function de(_){var ee,G,O,z,F,U,J,$,ne,le,ie=_.w_size;do{if(z=_.window_size-_.lookahead-_.strstart,_.strstart>=ie+(ie-L)){for(s.arraySet(_.window,_.window,ie,ie,0),_.match_start-=ie,_.strstart-=ie,_.block_start-=ie,ee=G=_.hash_size;O=_.head[--ee],_.head[ee]=ie<=O?O-ie:0,--G;);for(ee=G=ie;O=_.prev[--ee],_.prev[ee]=ie<=O?O-ie:0,--G;);z+=ie}if(_.strm.avail_in===0)break;if(U=_.strm,J=_.window,$=_.strstart+_.lookahead,ne=z,le=void 0,le=U.avail_in,ne<le&&(le=ne),G=le===0?0:(U.avail_in-=le,s.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>=R)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+R-1])&_.hash_mask,_.prev[F&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=F,F++,_.insert--,!(_.lookahead+_.insert<R)););}while(_.lookahead<L&&_.strm.avail_in!==0)}function te(_,ee){for(var G,O;;){if(_.lookahead<L){if(de(_),_.lookahead<L&&ee===h)return w;if(_.lookahead===0)break}if(G=0,_.lookahead>=R&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+R-1])&_.hash_mask,G=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),G!==0&&_.strstart-G<=_.w_size-L&&(_.match_length=Y(_,G)),_.match_length>=R)if(O=a._tr_tally(_,_.strstart-_.match_start,_.match_length-R),_.lookahead-=_.match_length,_.match_length<=_.max_lazy_match&&_.lookahead>=R){for(_.match_length--;_.strstart++,_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+R-1])&_.hash_mask,G=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart,--_.match_length!=0;);_.strstart++}else _.strstart+=_.match_length,_.match_length=0,_.ins_h=_.window[_.strstart],_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+1])&_.hash_mask;else O=a._tr_tally(_,0,_.window[_.strstart]),_.lookahead--,_.strstart++;if(O&&(V(_,!1),_.strm.avail_out===0))return w}return _.insert=_.strstart<R-1?_.strstart:R-1,ee===p?(V(_,!0),_.strm.avail_out===0?H:B):_.last_lit&&(V(_,!1),_.strm.avail_out===0)?w:P}function ce(_,ee){for(var G,O,z;;){if(_.lookahead<L){if(de(_),_.lookahead<L&&ee===h)return w;if(_.lookahead===0)break}if(G=0,_.lookahead>=R&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+R-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=R-1,G!==0&&_.prev_length<_.max_lazy_match&&_.strstart-G<=_.w_size-L&&(_.match_length=Y(_,G),_.match_length<=5&&(_.strategy===1||_.match_length===R&&4096<_.strstart-_.match_start)&&(_.match_length=R-1)),_.prev_length>=R&&_.match_length<=_.prev_length){for(z=_.strstart+_.lookahead-R,O=a._tr_tally(_,_.strstart-1-_.prev_match,_.prev_length-R),_.lookahead-=_.prev_length-1,_.prev_length-=2;++_.strstart<=z&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+R-1])&_.hash_mask,G=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),--_.prev_length!=0;);if(_.match_available=0,_.match_length=R-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<R-1?_.strstart:R-1,ee===p?(V(_,!0),_.strm.avail_out===0?H:B):_.last_lit&&(V(_,!1),_.strm.avail_out===0)?w:P}function fe(_,ee,G,O,z){this.good_length=_,this.max_lazy=ee,this.nice_length=G,this.max_chain=O,this.func=z}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 s.Buf16(2*E),this.dyn_dtree=new s.Buf16(2*(2*N+1)),this.bl_tree=new s.Buf16(2*(2*C+1)),A(this.dyn_ltree),A(this.dyn_dtree),A(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(T+1),this.heap=new s.Buf16(2*S+1),A(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*S+1),A(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=g,(ee=_.state).pending=0,ee.pending_out=0,ee.wrap<0&&(ee.wrap=-ee.wrap),ee.status=ee.wrap?j:D,_.adler=ee.wrap===2?0:1,ee.last_flush=h,a._tr_init(ee),f):q(_,x)}function Ee(_){var ee=xe(_);return ee===f&&(function(G){G.window_size=2*G.w_size,A(G.head),G.max_lazy_match=i[G.level].max_lazy,G.good_match=i[G.level].good_length,G.nice_match=i[G.level].nice_length,G.max_chain_length=i[G.level].max_chain,G.strstart=0,G.block_start=0,G.lookahead=0,G.insert=0,G.match_length=G.prev_length=R-1,G.match_available=0,G.ins_h=0})(_.state),ee}function Fe(_,ee,G,O,z,F){if(!_)return x;var U=1;if(ee===m&&(ee=6),O<0?(U=0,O=-O):15<O&&(U=2,O-=16),z<1||k<z||G!==b||O<8||15<O||ee<0||9<ee||F<0||y<F)return q(_,x);O===8&&(O=9);var J=new ge;return(_.state=J).strm=_,J.wrap=U,J.gzhead=null,J.w_bits=O,J.w_size=1<<J.w_bits,J.w_mask=J.w_size-1,J.hash_bits=z+7,J.hash_size=1<<J.hash_bits,J.hash_mask=J.hash_size-1,J.hash_shift=~~((J.hash_bits+R-1)/R),J.window=new s.Buf8(2*J.w_size),J.head=new s.Buf16(J.hash_size),J.prev=new s.Buf16(J.w_size),J.lit_bufsize=1<<z+6,J.pending_buf_size=4*J.lit_bufsize,J.pending_buf=new s.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(_)}i=[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 O=_.block_start+G;if((_.strstart===0||_.strstart>=O)&&(_.lookahead=_.strstart-O,_.strstart=O,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 Fe(_,ee,b,15,8,0)},o.deflateInit2=Fe,o.deflateReset=Ee,o.deflateResetKeep=xe,o.deflateSetHeader=function(_,ee){return _&&_.state?_.state.wrap!==2?x:(_.state.gzhead=ee,f):x},o.deflate=function(_,ee){var G,O,z,F;if(!_||!_.state||5<ee||ee<0)return _?q(_,x):x;if(O=_.state,!_.output||!_.input&&_.avail_in!==0||O.status===666&&ee!==p)return q(_,_.avail_out===0?-5:x);if(O.strm=_,G=O.last_flush,O.last_flush=ee,O.status===j)if(O.wrap===2)_.adler=0,I(O,31),I(O,139),I(O,8),O.gzhead?(I(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)),I(O,255&O.gzhead.time),I(O,O.gzhead.time>>8&255),I(O,O.gzhead.time>>16&255),I(O,O.gzhead.time>>24&255),I(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),I(O,255&O.gzhead.os),O.gzhead.extra&&O.gzhead.extra.length&&(I(O,255&O.gzhead.extra.length),I(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):(I(O,0),I(O,0),I(O,0),I(O,0),I(O,0),I(O,O.level===9?2:2<=O.strategy||O.level<2?4:0),I(O,3),O.status=D);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=D,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(z=O.pending;O.gzindex<(65535&O.gzhead.extra.length)&&(O.pending!==O.pending_buf_size||(O.gzhead.hcrc&&O.pending>z&&(_.adler=u(_.adler,O.pending_buf,O.pending-z,z)),W(_),z=O.pending,O.pending!==O.pending_buf_size));)I(O,255&O.gzhead.extra[O.gzindex]),O.gzindex++;O.gzhead.hcrc&&O.pending>z&&(_.adler=u(_.adler,O.pending_buf,O.pending-z,z)),O.gzindex===O.gzhead.extra.length&&(O.gzindex=0,O.status=73)}else O.status=73;if(O.status===73)if(O.gzhead.name){z=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>z&&(_.adler=u(_.adler,O.pending_buf,O.pending-z,z)),W(_),z=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,I(O,F)}while(F!==0);O.gzhead.hcrc&&O.pending>z&&(_.adler=u(_.adler,O.pending_buf,O.pending-z,z)),F===0&&(O.gzindex=0,O.status=91)}else O.status=91;if(O.status===91)if(O.gzhead.comment){z=O.pending;do{if(O.pending===O.pending_buf_size&&(O.gzhead.hcrc&&O.pending>z&&(_.adler=u(_.adler,O.pending_buf,O.pending-z,z)),W(_),z=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,I(O,F)}while(F!==0);O.gzhead.hcrc&&O.pending>z&&(_.adler=u(_.adler,O.pending_buf,O.pending-z,z)),F===0&&(O.status=103)}else O.status=103;if(O.status===103&&(O.gzhead.hcrc?(O.pending+2>O.pending_buf_size&&W(_),O.pending+2<=O.pending_buf_size&&(I(O,255&_.adler),I(O,_.adler>>8&255),_.adler=0,O.status=D)):O.status=D),O.pending!==0){if(W(_),_.avail_out===0)return O.last_flush=-1,f}else if(_.avail_in===0&&X(ee)<=X(G)&&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 J=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?H:B):$.last_lit&&(V($,!1),$.strm.avail_out===0)?w:P})(O,ee):O.strategy===3?(function($,ne){for(var le,ie,Z,re,ue=$.window;;){if($.lookahead<=M){if(de($),$.lookahead<=M&&ne===h)return w;if($.lookahead===0)break}if($.match_length=0,$.lookahead>=R&&0<$.strstart&&(ie=ue[Z=$.strstart-1])===ue[++Z]&&ie===ue[++Z]&&ie===ue[++Z]){re=$.strstart+M;do;while(ie===ue[++Z]&&ie===ue[++Z]&&ie===ue[++Z]&&ie===ue[++Z]&&ie===ue[++Z]&&ie===ue[++Z]&&ie===ue[++Z]&&ie===ue[++Z]&&Z<re);$.match_length=M-(re-Z),$.match_length>$.lookahead&&($.match_length=$.lookahead)}if($.match_length>=R?(le=a._tr_tally($,1,$.match_length-R),$.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:P})(O,ee):i[O.level].func(O,ee);if(J!==H&&J!==B||(O.status=666),J===w||J===H)return _.avail_out===0&&(O.last_flush=-1),f;if(J===P&&(ee===1?a._tr_align(O):ee!==5&&(a._tr_stored_block(O,0,0,!1),ee===3&&(A(O.head),O.lookahead===0&&(O.strstart=0,O.block_start=0,O.insert=0))),W(_),_.avail_out===0))return O.last_flush=-1,f}return ee!==p?f:O.wrap<=0?1:(O.wrap===2?(I(O,255&_.adler),I(O,_.adler>>8&255),I(O,_.adler>>16&255),I(O,_.adler>>24&255),I(O,255&_.total_in),I(O,_.total_in>>8&255),I(O,_.total_in>>16&255),I(O,_.total_in>>24&255)):(oe(O,_.adler>>>16),oe(O,65535&_.adler)),W(_),0<O.wrap&&(O.wrap=-O.wrap),O.pending!==0?f:1)},o.deflateEnd=function(_){var ee;return _&&_.state?(ee=_.state.status)!==j&&ee!==69&&ee!==73&&ee!==91&&ee!==103&&ee!==D&&ee!==666?q(_,x):(_.state=null,ee===D?q(_,-3):f):x},o.deflateSetDictionary=function(_,ee){var G,O,z,F,U,J,$,ne,le=ee.length;if(!_||!_.state||(F=(G=_.state).wrap)===2||F===1&&G.status!==j||G.lookahead)return x;for(F===1&&(_.adler=c(_.adler,ee,le,0)),G.wrap=0,le>=G.w_size&&(F===0&&(A(G.head),G.strstart=0,G.block_start=0,G.insert=0),ne=new s.Buf8(G.w_size),s.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>=R;){for(O=G.strstart,z=G.lookahead-(R-1);G.ins_h=(G.ins_h<<G.hash_shift^G.window[O+R-1])&G.hash_mask,G.prev[O&G.w_mask]=G.head[G.ins_h],G.head[G.ins_h]=O,O++,--z;);G.strstart=O,G.lookahead=R-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=R-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(i,s){var a,c,u,d,h,p,f,x,m,y,g,b,k,S,N,C,E,T,R,M,L,j,D,w,P;a=i.state,c=i.next_in,w=i.input,u=c+(i.avail_in-5),d=i.next_out,P=i.output,h=d-(s-i.avail_out),p=d+(i.avail_out-257),f=a.dmax,x=a.wsize,m=a.whave,y=a.wnext,g=a.window,b=a.hold,k=a.bits,S=a.lencode,N=a.distcode,C=(1<<a.lenbits)-1,E=(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>>>=R=T>>>24,k-=R,(R=T>>>16&255)===0)P[d++]=65535&T;else{if(!(16&R)){if((64&R)==0){T=S[(65535&T)+(b&(1<<R)-1)];continue t}if(32&R){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}M=65535&T,(R&=15)&&(k<R&&(b+=w[c++]<<k,k+=8),M+=b&(1<<R)-1,b>>>=R,k-=R),k<15&&(b+=w[c++]<<k,k+=8,b+=w[c++]<<k,k+=8),T=N[b&E];n:for(;;){if(b>>>=R=T>>>24,k-=R,!(16&(R=T>>>16&255))){if((64&R)==0){T=N[(65535&T)+(b&(1<<R)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(L=65535&T,k<(R&=15)&&(b+=w[c++]<<k,(k+=8)<R&&(b+=w[c++]<<k,k+=8)),f<(L+=b&(1<<R)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(b>>>=R,k-=R,(R=d-h)<L){if(m<(R=L-R)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(D=g,(j=0)===y){if(j+=x-R,R<M){for(M-=R;P[d++]=g[j++],--R;);j=d-L,D=P}}else if(y<R){if(j+=x+y-R,(R-=y)<M){for(M-=R;P[d++]=g[j++],--R;);if(j=0,y<M){for(M-=R=y;P[d++]=g[j++],--R;);j=d-L,D=P}}}else if(j+=y-R,R<M){for(M-=R;P[d++]=g[j++],--R;);j=d-L,D=P}for(;2<M;)P[d++]=D[j++],P[d++]=D[j++],P[d++]=D[j++],M-=3;M&&(P[d++]=D[j++],1<M&&(P[d++]=D[j++]))}else{for(j=d-L;P[d++]=P[j++],P[d++]=P[j++],P[d++]=P[j++],2<(M-=3););M&&(P[d++]=P[j++],1<M&&(P[d++]=P[j++]))}break}}break}}while(c<u&&d<p);c-=M=k>>3,b&=(1<<(k-=M<<3))-1,i.next_in=c,i.next_out=d,i.avail_in=c<u?u-c+5:5-(c-u),i.avail_out=d<p?p-d+257:257-(d-p),a.hold=b,a.bits=k}},{}],49:[function(n,r,o){var i=n("../utils/common"),s=n("./adler32"),a=n("./crc32"),c=n("./inffast"),u=n("./inftrees"),d=1,h=2,p=0,f=-2,x=1,m=852,y=592;function g(j){return(j>>>24&255)+(j>>>8&65280)+((65280&j)<<8)+((255&j)<<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 i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function k(j){var D;return j&&j.state?(D=j.state,j.total_in=j.total_out=D.total=0,j.msg="",D.wrap&&(j.adler=1&D.wrap),D.mode=x,D.last=0,D.havedict=0,D.dmax=32768,D.head=null,D.hold=0,D.bits=0,D.lencode=D.lendyn=new i.Buf32(m),D.distcode=D.distdyn=new i.Buf32(y),D.sane=1,D.back=-1,p):f}function S(j){var D;return j&&j.state?((D=j.state).wsize=0,D.whave=0,D.wnext=0,k(j)):f}function N(j,D){var w,P;return j&&j.state?(P=j.state,D<0?(w=0,D=-D):(w=1+(D>>4),D<48&&(D&=15)),D&&(D<8||15<D)?f:(P.window!==null&&P.wbits!==D&&(P.window=null),P.wrap=w,P.wbits=D,S(j))):f}function C(j,D){var w,P;return j?(P=new b,(j.state=P).window=null,(w=N(j,D))!==p&&(j.state=null),w):f}var E,T,R=!0;function M(j){if(R){var D;for(E=new i.Buf32(512),T=new i.Buf32(32),D=0;D<144;)j.lens[D++]=8;for(;D<256;)j.lens[D++]=9;for(;D<280;)j.lens[D++]=7;for(;D<288;)j.lens[D++]=8;for(u(d,j.lens,0,288,E,0,j.work,{bits:9}),D=0;D<32;)j.lens[D++]=5;u(h,j.lens,0,32,T,0,j.work,{bits:5}),R=!1}j.lencode=E,j.lenbits=9,j.distcode=T,j.distbits=5}function L(j,D,w,P){var H,B=j.state;return B.window===null&&(B.wsize=1<<B.wbits,B.wnext=0,B.whave=0,B.window=new i.Buf8(B.wsize)),P>=B.wsize?(i.arraySet(B.window,D,w-B.wsize,B.wsize,0),B.wnext=0,B.whave=B.wsize):(P<(H=B.wsize-B.wnext)&&(H=P),i.arraySet(B.window,D,w-P,H,B.wnext),(P-=H)?(i.arraySet(B.window,D,w-P,P,0),B.wnext=P,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=N,o.inflateResetKeep=k,o.inflateInit=function(j){return C(j,15)},o.inflateInit2=C,o.inflate=function(j,D){var w,P,H,B,q,X,A,W,V,I,oe,Y,de,te,ce,fe,ge,xe,Ee,Fe,_,ee,G,O,z=0,F=new i.Buf8(4),U=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!j||!j.state||!j.output||!j.input&&j.avail_in!==0)return f;(w=j.state).mode===12&&(w.mode=13),q=j.next_out,H=j.output,A=j.avail_out,B=j.next_in,P=j.input,X=j.avail_in,W=w.hold,V=w.bits,I=X,oe=A,ee=p;e:for(;;)switch(w.mode){case x:if(w.wrap===0){w.mode=13;break}for(;V<16;){if(X===0)break e;X--,W+=P[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){j.msg="incorrect header check",w.mode=30;break}if((15&W)!=8){j.msg="unknown compression method",w.mode=30;break}if(V-=4,_=8+(15&(W>>>=4)),w.wbits===0)w.wbits=_;else if(_>w.wbits){j.msg="invalid window size",w.mode=30;break}w.dmax=1<<_,j.adler=w.check=1,w.mode=512&W?10:12,V=W=0;break;case 2:for(;V<16;){if(X===0)break e;X--,W+=P[B++]<<V,V+=8}if(w.flags=W,(255&w.flags)!=8){j.msg="unknown compression method",w.mode=30;break}if(57344&w.flags){j.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(X===0)break e;X--,W+=P[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(X===0)break e;X--,W+=P[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(X===0)break e;X--,W+=P[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&&(X<(Y=w.length)&&(Y=X),Y&&(w.head&&(_=w.head.extra_len-w.length,w.head.extra||(w.head.extra=new Array(w.head.extra_len)),i.arraySet(w.head.extra,P,B,Y,_)),512&w.flags&&(w.check=a(w.check,P,Y,B)),X-=Y,B+=Y,w.length-=Y),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if(X===0)break e;for(Y=0;_=P[B+Y++],w.head&&_&&w.length<65536&&(w.head.name+=String.fromCharCode(_)),_&&Y<X;);if(512&w.flags&&(w.check=a(w.check,P,Y,B)),X-=Y,B+=Y,_)break e}else w.head&&(w.head.name=null);w.length=0,w.mode=8;case 8:if(4096&w.flags){if(X===0)break e;for(Y=0;_=P[B+Y++],w.head&&_&&w.length<65536&&(w.head.comment+=String.fromCharCode(_)),_&&Y<X;);if(512&w.flags&&(w.check=a(w.check,P,Y,B)),X-=Y,B+=Y,_)break e}else w.head&&(w.head.comment=null);w.mode=9;case 9:if(512&w.flags){for(;V<16;){if(X===0)break e;X--,W+=P[B++]<<V,V+=8}if(W!==(65535&w.check)){j.msg="header crc mismatch",w.mode=30;break}V=W=0}w.head&&(w.head.hcrc=w.flags>>9&1,w.head.done=!0),j.adler=w.check=0,w.mode=12;break;case 10:for(;V<32;){if(X===0)break e;X--,W+=P[B++]<<V,V+=8}j.adler=w.check=g(W),V=W=0,w.mode=11;case 11:if(w.havedict===0)return j.next_out=q,j.avail_out=A,j.next_in=B,j.avail_in=X,w.hold=W,w.bits=V,2;j.adler=w.check=1,w.mode=12;case 12:if(D===5||D===6)break e;case 13:if(w.last){W>>>=7&V,V-=7&V,w.mode=27;break}for(;V<3;){if(X===0)break e;X--,W+=P[B++]<<V,V+=8}switch(w.last=1&W,V-=1,3&(W>>>=1)){case 0:w.mode=14;break;case 1:if(M(w),w.mode=20,D!==6)break;W>>>=2,V-=2;break e;case 2:w.mode=17;break;case 3:j.msg="invalid block type",w.mode=30}W>>>=2,V-=2;break;case 14:for(W>>>=7&V,V-=7&V;V<32;){if(X===0)break e;X--,W+=P[B++]<<V,V+=8}if((65535&W)!=(W>>>16^65535)){j.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&W,V=W=0,w.mode=15,D===6)break e;case 15:w.mode=16;case 16:if(Y=w.length){if(X<Y&&(Y=X),A<Y&&(Y=A),Y===0)break e;i.arraySet(H,P,B,Y,q),X-=Y,B+=Y,A-=Y,q+=Y,w.length-=Y;break}w.mode=12;break;case 17:for(;V<14;){if(X===0)break e;X--,W+=P[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){j.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(X===0)break e;X--,W+=P[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){j.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=(z=w.lencode[W&(1<<w.lenbits)-1])>>>16&255,ge=65535&z,!((ce=z>>>24)<=V);){if(X===0)break e;X--,W+=P[B++]<<V,V+=8}if(ge<16)W>>>=ce,V-=ce,w.lens[w.have++]=ge;else{if(ge===16){for(O=ce+2;V<O;){if(X===0)break e;X--,W+=P[B++]<<V,V+=8}if(W>>>=ce,V-=ce,w.have===0){j.msg="invalid bit length repeat",w.mode=30;break}_=w.lens[w.have-1],Y=3+(3&W),W>>>=2,V-=2}else if(ge===17){for(O=ce+3;V<O;){if(X===0)break e;X--,W+=P[B++]<<V,V+=8}V-=ce,_=0,Y=3+(7&(W>>>=ce)),W>>>=3,V-=3}else{for(O=ce+7;V<O;){if(X===0)break e;X--,W+=P[B++]<<V,V+=8}V-=ce,_=0,Y=11+(127&(W>>>=ce)),W>>>=7,V-=7}if(w.have+Y>w.nlen+w.ndist){j.msg="invalid bit length repeat",w.mode=30;break}for(;Y--;)w.lens[w.have++]=_}}if(w.mode===30)break;if(w.lens[256]===0){j.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){j.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){j.msg="invalid distances set",w.mode=30;break}if(w.mode=20,D===6)break e;case 20:w.mode=21;case 21:if(6<=X&&258<=A){j.next_out=q,j.avail_out=A,j.next_in=B,j.avail_in=X,w.hold=W,w.bits=V,c(j,oe),q=j.next_out,H=j.output,A=j.avail_out,B=j.next_in,P=j.input,X=j.avail_in,W=w.hold,V=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;fe=(z=w.lencode[W&(1<<w.lenbits)-1])>>>16&255,ge=65535&z,!((ce=z>>>24)<=V);){if(X===0)break e;X--,W+=P[B++]<<V,V+=8}if(fe&&(240&fe)==0){for(xe=ce,Ee=fe,Fe=ge;fe=(z=w.lencode[Fe+((W&(1<<xe+Ee)-1)>>xe)])>>>16&255,ge=65535&z,!(xe+(ce=z>>>24)<=V);){if(X===0)break e;X--,W+=P[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){j.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(X===0)break e;X--,W+=P[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=(z=w.distcode[W&(1<<w.distbits)-1])>>>16&255,ge=65535&z,!((ce=z>>>24)<=V);){if(X===0)break e;X--,W+=P[B++]<<V,V+=8}if((240&fe)==0){for(xe=ce,Ee=fe,Fe=ge;fe=(z=w.distcode[Fe+((W&(1<<xe+Ee)-1)>>xe)])>>>16&255,ge=65535&z,!(xe+(ce=z>>>24)<=V);){if(X===0)break e;X--,W+=P[B++]<<V,V+=8}W>>>=xe,V-=xe,w.back+=xe}if(W>>>=ce,V-=ce,w.back+=ce,64&fe){j.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(X===0)break e;X--,W+=P[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){j.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(A===0)break e;if(Y=oe-A,w.offset>Y){if((Y=w.offset-Y)>w.whave&&w.sane){j.msg="invalid distance too far back",w.mode=30;break}de=Y>w.wnext?(Y-=w.wnext,w.wsize-Y):w.wnext-Y,Y>w.length&&(Y=w.length),te=w.window}else te=H,de=q-w.offset,Y=w.length;for(A<Y&&(Y=A),A-=Y,w.length-=Y;H[q++]=te[de++],--Y;);w.length===0&&(w.mode=21);break;case 26:if(A===0)break e;H[q++]=w.length,A--,w.mode=21;break;case 27:if(w.wrap){for(;V<32;){if(X===0)break e;X--,W|=P[B++]<<V,V+=8}if(oe-=A,j.total_out+=oe,w.total+=oe,oe&&(j.adler=w.check=w.flags?a(w.check,H,oe,q-oe):s(w.check,H,oe,q-oe)),oe=A,(w.flags?W:g(W))!==w.check){j.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(X===0)break e;X--,W+=P[B++]<<V,V+=8}if(W!==(4294967295&w.total)){j.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 j.next_out=q,j.avail_out=A,j.next_in=B,j.avail_in=X,w.hold=W,w.bits=V,(w.wsize||oe!==j.avail_out&&w.mode<30&&(w.mode<27||D!==4))&&L(j,j.output,j.next_out,oe-j.avail_out)?(w.mode=31,-4):(I-=j.avail_in,oe-=j.avail_out,j.total_in+=I,j.total_out+=oe,w.total+=oe,w.wrap&&oe&&(j.adler=w.check=w.flags?a(w.check,H,oe,j.next_out-oe):s(w.check,H,oe,j.next_out-oe)),j.data_type=w.bits+(w.last?64:0)+(w.mode===12?128:0)+(w.mode===20||w.mode===15?256:0),(I==0&&oe===0||D===4)&&ee===p&&(ee=-5),ee)},o.inflateEnd=function(j){if(!j||!j.state)return f;var D=j.state;return D.window&&(D.window=null),j.state=null,p},o.inflateGetHeader=function(j,D){var w;return j&&j.state?(2&(w=j.state).wrap)==0?f:((w.head=D).done=!1,p):f},o.inflateSetDictionary=function(j,D){var w,P=D.length;return j&&j.state?(w=j.state).wrap!==0&&w.mode!==11?f:w.mode===11&&s(1,D,P,0)!==w.check?-3:L(j,D,P,P)?(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 i=n("../utils/common"),s=[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,x,m,y,g){var b,k,S,N,C,E,T,R,M,L=g.bits,j=0,D=0,w=0,P=0,H=0,B=0,q=0,X=0,A=0,W=0,V=null,I=0,oe=new i.Buf16(16),Y=new i.Buf16(16),de=null,te=0;for(j=0;j<=15;j++)oe[j]=0;for(D=0;D<f;D++)oe[h[p+D]]++;for(H=L,P=15;1<=P&&oe[P]===0;P--);if(P<H&&(H=P),P===0)return x[m++]=20971520,x[m++]=20971520,g.bits=1,0;for(w=1;w<P&&oe[w]===0;w++);for(H<w&&(H=w),j=X=1;j<=15;j++)if(X<<=1,(X-=oe[j])<0)return-1;if(0<X&&(d===0||P!==1))return-1;for(Y[1]=0,j=1;j<15;j++)Y[j+1]=Y[j]+oe[j];for(D=0;D<f;D++)h[p+D]!==0&&(y[Y[h[p+D]]++]=D);if(E=d===0?(V=de=y,19):d===1?(V=s,I-=257,de=a,te-=257,256):(V=c,de=u,-1),j=w,C=m,q=D=W=0,S=-1,N=(A=1<<(B=H))-1,d===1&&852<A||d===2&&592<A)return 1;for(;;){for(T=j-q,M=y[D]<E?(R=0,y[D]):y[D]>E?(R=de[te+y[D]],V[I+y[D]]):(R=96,0),b=1<<j-q,w=k=1<<B;x[C+(W>>q)+(k-=b)]=T<<24|R<<16|M|0,k!==0;);for(b=1<<j-1;W&b;)b>>=1;if(b!==0?(W&=b-1,W+=b):W=0,D++,--oe[j]==0){if(j===P)break;j=h[p+y[D]]}if(H<j&&(W&N)!==S){for(q===0&&(q=H),C+=w,X=1<<(B=j-q);B+q<P&&!((X-=oe[B+q])<=0);)B++,X<<=1;if(A+=1<<B,d===1&&852<A||d===2&&592<A)return 1;x[S=W&N]=H<<24|B<<16|C-m|0}}return W!==0&&(x[C+W]=j-q<<24|64<<16|0),g.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 i=n("../utils/common"),s=0,a=1;function c(z){for(var F=z.length;0<=--F;)z[F]=0}var u=0,d=29,h=256,p=h+1+d,f=30,x=19,m=2*p+1,y=15,g=16,b=7,k=256,S=16,N=17,C=18,E=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],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],R=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],M=[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 j=new Array(2*f);c(j);var D=new Array(512);c(D);var w=new Array(256);c(w);var P=new Array(d);c(P);var H,B,q,X=new Array(f);function A(z,F,U,J,$){this.static_tree=z,this.extra_bits=F,this.extra_base=U,this.elems=J,this.max_length=$,this.has_stree=z&&z.length}function W(z,F){this.dyn_tree=z,this.max_code=0,this.stat_desc=F}function V(z){return z<256?D[z]:D[256+(z>>>7)]}function I(z,F){z.pending_buf[z.pending++]=255&F,z.pending_buf[z.pending++]=F>>>8&255}function oe(z,F,U){z.bi_valid>g-U?(z.bi_buf|=F<<z.bi_valid&65535,I(z,z.bi_buf),z.bi_buf=F>>g-z.bi_valid,z.bi_valid+=U-g):(z.bi_buf|=F<<z.bi_valid&65535,z.bi_valid+=U)}function Y(z,F,U){oe(z,U[2*F],U[2*F+1])}function de(z,F){for(var U=0;U|=1&z,z>>>=1,U<<=1,0<--F;);return U>>>1}function te(z,F,U){var J,$,ne=new Array(y+1),le=0;for(J=1;J<=y;J++)ne[J]=le=le+U[J-1]<<1;for($=0;$<=F;$++){var ie=z[2*$+1];ie!==0&&(z[2*$]=de(ne[ie]++,ie))}}function ce(z){var F;for(F=0;F<p;F++)z.dyn_ltree[2*F]=0;for(F=0;F<f;F++)z.dyn_dtree[2*F]=0;for(F=0;F<x;F++)z.bl_tree[2*F]=0;z.dyn_ltree[2*k]=1,z.opt_len=z.static_len=0,z.last_lit=z.matches=0}function fe(z){8<z.bi_valid?I(z,z.bi_buf):0<z.bi_valid&&(z.pending_buf[z.pending++]=z.bi_buf),z.bi_buf=0,z.bi_valid=0}function ge(z,F,U,J){var $=2*F,ne=2*U;return z[$]<z[ne]||z[$]===z[ne]&&J[F]<=J[U]}function xe(z,F,U){for(var J=z.heap[U],$=U<<1;$<=z.heap_len&&($<z.heap_len&&ge(F,z.heap[$+1],z.heap[$],z.depth)&&$++,!ge(F,J,z.heap[$],z.depth));)z.heap[U]=z.heap[$],U=$,$<<=1;z.heap[U]=J}function Ee(z,F,U){var J,$,ne,le,ie=0;if(z.last_lit!==0)for(;J=z.pending_buf[z.d_buf+2*ie]<<8|z.pending_buf[z.d_buf+2*ie+1],$=z.pending_buf[z.l_buf+ie],ie++,J===0?Y(z,$,F):(Y(z,(ne=w[$])+h+1,F),(le=E[ne])!==0&&oe(z,$-=P[ne],le),Y(z,ne=V(--J),U),(le=T[ne])!==0&&oe(z,J-=X[ne],le)),ie<z.last_lit;);Y(z,k,F)}function Fe(z,F){var U,J,$,ne=F.dyn_tree,le=F.stat_desc.static_tree,ie=F.stat_desc.has_stree,Z=F.stat_desc.elems,re=-1;for(z.heap_len=0,z.heap_max=m,U=0;U<Z;U++)ne[2*U]!==0?(z.heap[++z.heap_len]=re=U,z.depth[U]=0):ne[2*U+1]=0;for(;z.heap_len<2;)ne[2*($=z.heap[++z.heap_len]=re<2?++re:0)]=1,z.depth[$]=0,z.opt_len--,ie&&(z.static_len-=le[2*$+1]);for(F.max_code=re,U=z.heap_len>>1;1<=U;U--)xe(z,ne,U);for($=Z;U=z.heap[1],z.heap[1]=z.heap[z.heap_len--],xe(z,ne,1),J=z.heap[1],z.heap[--z.heap_max]=U,z.heap[--z.heap_max]=J,ne[2*$]=ne[2*U]+ne[2*J],z.depth[$]=(z.depth[U]>=z.depth[J]?z.depth[U]:z.depth[J])+1,ne[2*U+1]=ne[2*J+1]=$,z.heap[1]=$++,xe(z,ne,1),2<=z.heap_len;);z.heap[--z.heap_max]=z.heap[1],(function(ue,we){var Re,qe,ft,De,At,Bt,We=we.dyn_tree,Ut=we.max_code,_t=we.stat_desc.static_tree,jp=we.stat_desc.has_stree,Ep=we.stat_desc.extra_bits,_a=we.stat_desc.extra_base,tr=we.stat_desc.max_length,Tr=0;for(De=0;De<=y;De++)ue.bl_count[De]=0;for(We[2*ue.heap[ue.heap_max]+1]=0,Re=ue.heap_max+1;Re<m;Re++)tr<(De=We[2*We[2*(qe=ue.heap[Re])+1]+1]+1)&&(De=tr,Tr++),We[2*qe+1]=De,Ut<qe||(ue.bl_count[De]++,At=0,_a<=qe&&(At=Ep[qe-_a]),Bt=We[2*qe],ue.opt_len+=Bt*(De+At),jp&&(ue.static_len+=Bt*(_t[2*qe+1]+At)));if(Tr!==0){do{for(De=tr-1;ue.bl_count[De]===0;)De--;ue.bl_count[De]--,ue.bl_count[De+1]+=2,ue.bl_count[tr]--,Tr-=2}while(0<Tr);for(De=tr;De!==0;De--)for(qe=ue.bl_count[De];qe!==0;)Ut<(ft=ue.heap[--Re])||(We[2*ft+1]!==De&&(ue.opt_len+=(De-We[2*ft+1])*We[2*ft],We[2*ft+1]=De),qe--)}})(z,F),te(ne,re,z.bl_count)}function _(z,F,U){var J,$,ne=-1,le=F[1],ie=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],++ie<Z&&$===le||(ie<re?z.bl_tree[2*$]+=ie:$!==0?($!==ne&&z.bl_tree[2*$]++,z.bl_tree[2*S]++):ie<=10?z.bl_tree[2*N]++:z.bl_tree[2*C]++,ne=$,re=(ie=0)===le?(Z=138,3):$===le?(Z=6,3):(Z=7,4))}function ee(z,F,U){var J,$,ne=-1,le=F[1],ie=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],!(++ie<Z&&$===le)){if(ie<re)for(;Y(z,$,z.bl_tree),--ie!=0;);else $!==0?($!==ne&&(Y(z,$,z.bl_tree),ie--),Y(z,S,z.bl_tree),oe(z,ie-3,2)):ie<=10?(Y(z,N,z.bl_tree),oe(z,ie-3,3)):(Y(z,C,z.bl_tree),oe(z,ie-11,7));ne=$,re=(ie=0)===le?(Z=138,3):$===le?(Z=6,3):(Z=7,4)}}c(X);var G=!1;function O(z,F,U,J){oe(z,(u<<1)+(J?1:0),3),(function($,ne,le,ie){fe($),I($,le),I($,~le),i.arraySet($.pending_buf,$.window,ne,le,$.pending),$.pending+=le})(z,F,U)}o._tr_init=function(z){G||((function(){var F,U,J,$,ne,le=new Array(y+1);for($=J=0;$<d-1;$++)for(P[$]=J,F=0;F<1<<E[$];F++)w[J++]=$;for(w[J-1]=$,$=ne=0;$<16;$++)for(X[$]=ne,F=0;F<1<<T[$];F++)D[ne++]=$;for(ne>>=7;$<f;$++)for(X[$]=ne<<7,F=0;F<1<<T[$]-7;F++)D[256+ne++]=$;for(U=0;U<=y;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++)j[2*F+1]=5,j[2*F]=de(F,5);H=new A(L,E,h+1,p,y),B=new A(j,T,0,f,y),q=new A(new Array(0),R,0,x,b)})(),G=!0),z.l_desc=new W(z.dyn_ltree,H),z.d_desc=new W(z.dyn_dtree,B),z.bl_desc=new W(z.bl_tree,q),z.bi_buf=0,z.bi_valid=0,ce(z)},o._tr_stored_block=O,o._tr_flush_block=function(z,F,U,J){var $,ne,le=0;0<z.level?(z.strm.data_type===2&&(z.strm.data_type=(function(ie){var Z,re=4093624447;for(Z=0;Z<=31;Z++,re>>>=1)if(1&re&&ie.dyn_ltree[2*Z]!==0)return s;if(ie.dyn_ltree[18]!==0||ie.dyn_ltree[20]!==0||ie.dyn_ltree[26]!==0)return a;for(Z=32;Z<h;Z++)if(ie.dyn_ltree[2*Z]!==0)return a;return s})(z)),Fe(z,z.l_desc),Fe(z,z.d_desc),le=(function(ie){var Z;for(_(ie,ie.dyn_ltree,ie.l_desc.max_code),_(ie,ie.dyn_dtree,ie.d_desc.max_code),Fe(ie,ie.bl_desc),Z=x-1;3<=Z&&ie.bl_tree[2*M[Z]+1]===0;Z--);return ie.opt_len+=3*(Z+1)+5+5+4,Z})(z),$=z.opt_len+3+7>>>3,(ne=z.static_len+3+7>>>3)<=$&&($=ne)):$=ne=U+5,U+4<=$&&F!==-1?O(z,F,U,J):z.strategy===4||ne===$?(oe(z,2+(J?1:0),3),Ee(z,L,j)):(oe(z,4+(J?1:0),3),(function(ie,Z,re,ue){var we;for(oe(ie,Z-257,5),oe(ie,re-1,5),oe(ie,ue-4,4),we=0;we<ue;we++)oe(ie,ie.bl_tree[2*M[we]+1],3);ee(ie,ie.dyn_ltree,Z-1),ee(ie,ie.dyn_dtree,re-1)})(z,z.l_desc.max_code+1,z.d_desc.max_code+1,le+1),Ee(z,z.dyn_ltree,z.dyn_dtree)),ce(z),J&&fe(z)},o._tr_tally=function(z,F,U){return z.pending_buf[z.d_buf+2*z.last_lit]=F>>>8&255,z.pending_buf[z.d_buf+2*z.last_lit+1]=255&F,z.pending_buf[z.l_buf+z.last_lit]=255&U,z.last_lit++,F===0?z.dyn_ltree[2*U]++:(z.matches++,F--,z.dyn_ltree[2*(w[U]+h+1)]++,z.dyn_dtree[2*V(F)]++),z.last_lit===z.lit_bufsize-1},o._tr_align=function(z){oe(z,2,3),Y(z,k,L),(function(F){F.bi_valid===16?(I(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)})(z)}},{"../utils/common":41}],53:[function(n,r,o){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(i){(function(s,a){if(!s.setImmediate){var c,u,d,h,p=1,f={},x=!1,m=s.document,y=Object.getPrototypeOf&&Object.getPrototypeOf(s);y=y&&y.setTimeout?y:s,c={}.toString.call(s.process)==="[object process]"?function(S){process.nextTick(function(){b(S)})}:(function(){if(s.postMessage&&!s.importScripts){var S=!0,N=s.onmessage;return s.onmessage=function(){S=!1},s.postMessage("","*"),s.onmessage=N,S}})()?(h="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",k,!1):s.attachEvent("onmessage",k),function(S){s.postMessage(h+S,"*")}):s.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 N=m.createElement("script");N.onreadystatechange=function(){b(S),N.onreadystatechange=null,u.removeChild(N),N=null},u.appendChild(N)}):function(S){setTimeout(b,0,S)},y.setImmediate=function(S){typeof S!="function"&&(S=new Function(""+S));for(var N=new Array(arguments.length-1),C=0;C<N.length;C++)N[C]=arguments[C+1];var E={callback:S,args:N};return f[p]=E,c(p),p++},y.clearImmediate=g}function g(S){delete f[S]}function b(S){if(x)setTimeout(b,0,S);else{var N=f[S];if(N){x=!0;try{(function(C){var E=C.callback,T=C.args;switch(T.length){case 0:E();break;case 1:E(T[0]);break;case 2:E(T[0],T[1]);break;case 3:E(T[0],T[1],T[2]);break;default:E.apply(a,T)}})(N)}finally{g(S),x=!1}}}}function k(S){S.source===s&&typeof S.data=="string"&&S.data.indexOf(h)===0&&b(+S.data.slice(h.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof Ar<"u"?Ar:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(bi)),bi.exports}var _S=kS();const SS=bs(_S);async function CS(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 jS(e){const t=new SS;for(const s of e)s.rawRequestBody!==null&&t.file(`#${s.id}.Request.json`,s.rawRequestBody),s.responseText!==null&&t.file(`#${s.id}.Response.json`,s.responseText);const n=e.filter(s=>s.streaming);await Promise.allSettled(n.map(async s=>{const a=await CS(s.id);a!==null&&t.file(`#${s.id}.SSE.Response.json`,a)}));const r=await t.generateAsync({type:"blob"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`llm-inspector-export-${new Date().toISOString().slice(0,10)}.zip`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)}const ES="1.14.9",NS={version:ES};function Pl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ph(e){if(e.responseText===null)return null;try{let t=JSON.parse(e.responseText);return typeof t=="string"&&(t=JSON.parse(t)),Pl(t)?e.apiFormat==="anthropic"&&typeof t.stop_reason=="string"?t.stop_reason==="end_turn"||t.stop_reason==="tool_use"?t.stop_reason:null:e.apiFormat==="openai"&&Array.isArray(t.choices)&&t.choices.length>0&&Pl(t.choices[0])&&typeof t.choices[0].finish_reason=="string"&&t.choices[0].finish_reason==="stop"?"stop":null:null}catch{return null}}const Rl=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ol=Qu,sa=(e,t)=>n=>{var r;if(t?.variants==null)return Ol(e,n?.class,n?.className);const{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(u=>{const d=n?.[u],h=i?.[u];if(d===null)return null;const p=Rl(d)||Rl(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(x=>{let[m,y]=x;return Array.isArray(y)?y.includes({...i,...a}[m]):{...i,...a}[m]===y})?[...u,h,p]:u},[]);return Ol(e,s,c,n?.class,n?.className)},TS=sa("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?N1:"span";return l.jsx(o,{"data-slot":"badge","data-variant":t,className:he(TS({variant:t}),e),...r})}const AS={anthropic:"Anthropic",openai:"OpenAI",unknown:"Unknown"};function Dl(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function IS({conversationId:e,startTime:t,endTime:n,totalCalls:r,totalInputTokens:o,totalOutputTokens:i,apiFormat:s,expanded:a,onToggle:c,hideApiFormat:u=!1,isLoading:d=!1,viewMode:h,onToggleViewMode:p,userAgent:f}){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-muted/30"),onClick:c,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),c())},children:[a?l.jsx(vt,{className:"size-4 text-muted-foreground shrink-0"}):d?l.jsx(yr,{className:"size-4 animate-spin text-muted-foreground shrink-0"}):l.jsx(jt,{className:"size-4 text-muted-foreground shrink-0"}),a&&p!==void 0&&l.jsx("button",{type:"button",onClick:x=>{x.stopPropagation(),p()},className:he("px-1.5 py-0.5 rounded text-[10px] font-mono transition-colors shrink-0 cursor-pointer",h==="thread"?"bg-amber-500/15 text-amber-400 border border-amber-500/30":"bg-muted text-muted-foreground border border-border hover:text-foreground"),title:h==="thread"?"Thread view — click for flat view":"Flat view — click for thread view",children:l.jsx(Vu,{className:"size-3"})}),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}),f!=null&&f!==""&&l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:f,children:[l.jsx(zb,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",children:f})]}),!u&&l.jsx(xt,{variant:"outline",className:he("text-[10px] px-1.5 py-0 h-5 font-mono shrink-0",s==="openai"&&"border-blue-500/40 text-blue-400",s==="anthropic"&&"border-orange-500/40 text-orange-400",s==="unknown"&&"border-muted text-muted-foreground"),children:AS[s]}),l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(To,{className:"size-3"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[Dl(t)," - ",Dl(n)]})]}),l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(Hu,{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(_r,{className:"size-3 text-muted-foreground"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[l.jsx("span",{className:"text-blue-400",children:Ye(o)})," / ",l.jsx("span",{className:"text-amber-400",children:Ye(i)})]})]}),l.jsx("span",{className:"flex-1 min-w-0"})]})}function zS(e){const t=e.find(n=>n.apiFormat!=="unknown");return t!==void 0?t.apiFormat:e[0]?.apiFormat??"unknown"}function PS(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 xo(e){if(e.sessionId!==null&&e.sessionId!=="")return e.sessionId;const t=e.clientPid!==null?`PID:${e.clientPid}`:"unknown",n=e.clientProjectFolder!==null?e.clientProjectFolder:"no-folder";return`${t}|${n}`}function RS(e){const t=new Map;for(const r of e){const o=xo(r),i=t.get(o);i!==void 0?i.push(r):t.set(o,[r])}const n=[];for(const[r,o]of t){const i=[...o].sort((s,a)=>s.timestamp.localeCompare(a.timestamp));n.push({id:r,conversationId:r,logs:i})}return n.sort((r,o)=>(r.logs[0]?.timestamp??"").localeCompare(o.logs[0]?.timestamp??"")),n}const OS="x-anthropic-billing-header:";function DS(e){return e.trimStart().toLowerCase().startsWith(OS)}function Ml(e,t){return Object.getOwnPropertyDescriptor(e,t)?.value}function MS(e){return typeof e!="object"||e===null||Array.isArray(e)?!1:Object.prototype.hasOwnProperty.call(e,"system")}function LS(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const t=Ml(e,"type"),n=Ml(e,"text");return typeof t!="string"||t!=="text"||typeof n!="string"?!1:DS(n)}function FS(e){let t;try{t=JSON.parse(e)}catch{return{body:e,removed:0}}if(!MS(t))return{body:e,removed:0};const n=t.system;if(!Array.isArray(n)||n.length===0)return{body:e,removed:0};const r=[];let o=0;for(const i of n){if(LS(i)){o+=1;continue}r.push(i)}return o===0?{body:e,removed:0}:(r.length===0?delete t.system:t.system=r,{body:JSON.stringify(t),removed:o})}const $S=sa("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($S({variant:t,size:n,className:e})),...r})}function BS(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const US=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,ZS=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,VS={};function Ll(e,t){return(VS.jsx?ZS:US).test(e)}const WS=/[ \t\n\f\r]/g;function HS(e){return typeof e=="object"?e.type==="text"?Fl(e.value):!1:Fl(e)}function Fl(e){return e.replace(WS,"")===""}class Er{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Er.prototype.normal={};Er.prototype.property={};Er.prototype.space=void 0;function Rh(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Er(n,r,t)}function os(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 qS=0;const je=vn(),Ge=vn(),is=vn(),se=vn(),$e=vn(),Dn=vn(),ht=vn();function vn(){return 2**++qS}const ss=Object.freeze(Object.defineProperty({__proto__:null,boolean:je,booleanish:Ge,commaOrSpaceSeparated:ht,commaSeparated:Dn,number:se,overloadedBoolean:is,spaceSeparated:$e},Symbol.toStringTag,{value:"Module"})),wi=Object.keys(ss);class aa extends dt{constructor(t,n,r,o){let i=-1;if(super(t,n),$l(this,"space",o),typeof r=="number")for(;++i<wi.length;){const s=wi[i];$l(this,wi[i],(r&ss[s])===ss[s])}}}aa.prototype.defined=!0;function $l(e,t,n){n&&(e[t]=n)}function Qn(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const i=new aa(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[os(r)]=r,n[os(i.attribute)]=r}return new Er(t,n,e.space)}const Oh=Qn({properties:{ariaActiveDescendant:null,ariaAtomic:Ge,ariaAutoComplete:null,ariaBusy:Ge,ariaChecked:Ge,ariaColCount:se,ariaColIndex:se,ariaColSpan:se,ariaControls:$e,ariaCurrent:null,ariaDescribedBy:$e,ariaDetails:null,ariaDisabled:Ge,ariaDropEffect:$e,ariaErrorMessage:null,ariaExpanded:Ge,ariaFlowTo:$e,ariaGrabbed:Ge,ariaHasPopup:null,ariaHidden:Ge,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:$e,ariaLevel:se,ariaLive:null,ariaModal:Ge,ariaMultiLine:Ge,ariaMultiSelectable:Ge,ariaOrientation:null,ariaOwns:$e,ariaPlaceholder:null,ariaPosInSet:se,ariaPressed:Ge,ariaReadOnly:Ge,ariaRelevant:null,ariaRequired:Ge,ariaRoleDescription:$e,ariaRowCount:se,ariaRowIndex:se,ariaRowSpan:se,ariaSelected:Ge,ariaSetSize:se,ariaSort:null,ariaValueMax:se,ariaValueMin:se,ariaValueNow:se,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Dh(e,t){return t in e?e[t]:t}function Mh(e,t){return Dh(e,t.toLowerCase())}const KS=Qn({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Dn,acceptCharset:$e,accessKey:$e,action:null,allow:null,allowFullScreen:je,allowPaymentRequest:je,allowUserMedia:je,alt:null,as:null,async:je,autoCapitalize:null,autoComplete:$e,autoFocus:je,autoPlay:je,blocking:$e,capture:null,charSet:null,checked:je,cite:null,className:$e,cols:se,colSpan:null,content:null,contentEditable:Ge,controls:je,controlsList:$e,coords:se|Dn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:je,defer:je,dir:null,dirName:null,disabled:je,download:is,draggable:Ge,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:je,formTarget:null,headers:$e,height:se,hidden:is,high:se,href:null,hrefLang:null,htmlFor:$e,httpEquiv:$e,id:null,imageSizes:null,imageSrcSet:null,inert:je,inputMode:null,integrity:null,is:null,isMap:je,itemId:null,itemProp:$e,itemRef:$e,itemScope:je,itemType:$e,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:je,low:se,manifest:null,max:null,maxLength:se,media:null,method:null,min:null,minLength:se,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:se,pattern:null,ping:$e,placeholder:null,playsInline:je,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:je,referrerPolicy:null,rel:$e,required:je,reversed:je,rows:se,rowSpan:se,sandbox:$e,scope:null,scoped:je,seamless:je,selected:je,shadowRootClonable:je,shadowRootDelegatesFocus:je,shadowRootMode:null,shape:null,size:se,sizes:null,slot:null,span:se,spellCheck:Ge,src:null,srcDoc:null,srcLang:null,srcSet:null,start:se,step:null,style:null,tabIndex:se,target:null,title:null,translate:null,type:null,typeMustMatch:je,useMap:null,value:Ge,width:se,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:$e,axis:null,background:null,bgColor:null,border:se,borderColor:null,bottomMargin:se,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:se,leftMargin:se,link:null,longDesc:null,lowSrc:null,marginHeight:se,marginWidth:se,noResize:je,noHref:je,noShade:je,noWrap:je,object:null,profile:null,prompt:null,rev:null,rightMargin:se,rules:null,scheme:null,scrolling:Ge,standby:null,summary:null,text:null,topMargin:se,valueType:null,version:null,vAlign:null,vLink:null,vSpace:se,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:je,disableRemotePlayback:je,prefix:null,property:null,results:se,security:null,unselectable:null},space:"html",transform:Mh}),GS=Qn({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:se,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:se,amplitude:se,arabicForm:null,ascent:se,attributeName:null,attributeType:null,azimuth:se,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:se,by:null,calcMode:null,capHeight:se,className:$e,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:se,diffuseConstant:se,direction:null,display:null,dur:null,divisor:se,dominantBaseline:null,download:je,dx:null,dy:null,edgeMode:null,editable:null,elevation:se,enableBackground:null,end:null,event:null,exponent:se,externalResourcesRequired:null,fill:null,fillOpacity:se,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:Dn,g2:Dn,glyphName:Dn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:se,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:se,horizOriginX:se,horizOriginY:se,id:null,ideographic:se,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:se,k:se,k1:se,k2:se,k3:se,k4:se,kernelMatrix:ht,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:se,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:se,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:se,overlineThickness:se,paintOrder:null,panose1:null,path:null,pathLength:se,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:$e,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:se,pointsAtY:se,pointsAtZ:se,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:se,specularExponent:se,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:se,strikethroughThickness:se,string:null,stroke:null,strokeDashArray:ht,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:se,strokeOpacity:se,strokeWidth:null,style:null,surfaceScale:se,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ht,tabIndex:se,tableValues:null,target:null,targetX:se,targetY:se,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:se,underlineThickness:se,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:se,values:null,vAlphabetic:se,vMathematical:se,vectorEffect:null,vHanging:se,vIdeographic:se,version:null,vertAdvY:se,vertOriginX:se,vertOriginY:se,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:se,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Dh}),Lh=Qn({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()}}),Fh=Qn({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Mh}),$h=Qn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),JS={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"},YS=/[A-Z]/g,Bl=/-[a-z]/g,XS=/^data[-\w.:]+$/i;function QS(e,t){const n=os(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"&&XS.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(Bl,tC);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!Bl.test(i)){let s=i.replace(YS,eC);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}o=aa}return new o(r,t)}function eC(e){return"-"+e.toLowerCase()}function tC(e){return e.charAt(1).toUpperCase()}const nC=Rh([Oh,KS,Lh,Fh,$h],"html"),la=Rh([Oh,GS,Lh,Fh,$h],"svg");function rC(e){return e.join(" ").trim()}var jn={},ki,Ul;function oC(){if(Ul)return ki;Ul=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,s=/^[;\s]*/,a=/^\s+|\s+$/g,c=`
85
+ `,u="/",d="*",h="",p="comment",f="declaration";function x(y,g){if(typeof y!="string")throw new TypeError("First argument must be a string");if(!y)return[];g=g||{};var b=1,k=1;function S(w){var P=w.match(t);P&&(b+=P.length);var H=w.lastIndexOf(c);k=~H?w.length-H:k+w.length}function N(){var w={line:b,column:k};return function(P){return P.position=new C(w),R(),P}}function C(w){this.start=w,this.end={line:b,column:k},this.source=g.source}C.prototype.content=y;function E(w){var P=new Error(g.source+":"+b+":"+k+": "+w);if(P.reason=w,P.filename=g.source,P.line=b,P.column=k,P.source=y,!g.silent)throw P}function T(w){var P=w.exec(y);if(P){var H=P[0];return S(H),y=y.slice(H.length),P}}function R(){T(n)}function M(w){var P;for(w=w||[];P=L();)P!==!1&&w.push(P);return w}function L(){var w=N();if(!(u!=y.charAt(0)||d!=y.charAt(1))){for(var P=2;h!=y.charAt(P)&&(d!=y.charAt(P)||u!=y.charAt(P+1));)++P;if(P+=2,h===y.charAt(P-1))return E("End of comment missing");var H=y.slice(2,P-2);return k+=2,S(H),y=y.slice(P),k+=2,w({type:p,comment:H})}}function j(){var w=N(),P=T(r);if(P){if(L(),!T(o))return E("property missing ':'");var H=T(i),B=w({type:f,property:m(P[0].replace(e,h)),value:H?m(H[0].replace(e,h)):h});return T(s),B}}function D(){var w=[];M(w);for(var P;P=j();)P!==!1&&(w.push(P),M(w));return w}return R(),D()}function m(y){return y?y.replace(a,h):h}return ki=x,ki}var Zl;function iC(){if(Zl)return jn;Zl=1;var e=jn&&jn.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(jn,"__esModule",{value:!0}),jn.default=n;const t=e(oC());function n(r,o){let i=null;if(!r||typeof r!="string")return i;const s=(0,t.default)(r),a=typeof o=="function";return s.forEach(c=>{if(c.type!=="declaration")return;const{property:u,value:d}=c;a?o(u,d,c):d&&(i=i||{},i[u]=d)}),i}return jn}var or={},Vl;function sC(){if(Vl)return or;Vl=1,Object.defineProperty(or,"__esModule",{value:!0}),or.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,i=function(u){return!u||n.test(u)||e.test(u)},s=function(u,d){return d.toUpperCase()},a=function(u,d){return"".concat(d,"-")},c=function(u,d){return d===void 0&&(d={}),i(u)?u:(u=u.toLowerCase(),d.reactCompat?u=u.replace(o,a):u=u.replace(r,a),u.replace(t,s))};return or.camelCase=c,or}var ir,Wl;function aC(){if(Wl)return ir;Wl=1;var e=ir&&ir.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(iC()),n=sC();function r(o,i){var s={};return!o||typeof o!="string"||(0,t.default)(o,function(a,c){a&&c&&(s[(0,n.camelCase)(a,i)]=c)}),s}return r.default=r,ir=r,ir}var lC=aC();const cC=bs(lC),Bh=Uh("end"),ca=Uh("start");function Uh(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 uC(e){const t=ca(e),n=Bh(e);if(t&&n)return{start:t,end:n}}function fr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Hl(e.position):"start"in e||"end"in e?Hl(e):"line"in e||"column"in e?as(e):""}function as(e){return ql(e&&e.line)+":"+ql(e&&e.column)}function Hl(e){return as(e&&e.start)+"-"+as(e&&e.end)}function ql(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="",i={},s=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?o=t:!i.cause&&t&&(s=!0,o=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=a?a.line:void 0,this.name=fr(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=s&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}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 ua={}.hasOwnProperty,dC=new Map,fC=/[A-Z]/g,hC=new Set(["table","tbody","thead","tfoot","tr"]),pC=new Set(["td","th"]),Zh="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function mC(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=_C(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=kC(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"?la:nC,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=Vh(o,e,void 0);return i&&typeof i!="string"?i:o.create(e,o.Fragment,{children:i||void 0},void 0)}function Vh(e,t,n){if(t.type==="element")return gC(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return xC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return vC(e,t,n);if(t.type==="mdxjsEsm")return yC(e,t);if(t.type==="root")return bC(e,t,n);if(t.type==="text")return wC(e,t)}function gC(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=la,e.schema=o),e.ancestors.push(t);const i=Hh(e,t.tagName,!1),s=SC(e,t);let a=fa(e,t);return hC.has(t.tagName)&&(a=a.filter(function(c){return typeof c=="string"?!HS(c):!0})),Wh(e,s,i,t),da(s,a),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function xC(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)}wr(e,t.position)}function yC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);wr(e,t.position)}function vC(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=la,e.schema=o),e.ancestors.push(t);const i=t.name===null?e.Fragment:Hh(e,t.name,!0),s=CC(e,t),a=fa(e,t);return Wh(e,s,i,t),da(s,a),e.ancestors.pop(),e.schema=r,e.create(t,i,s,n)}function bC(e,t,n){const r={};return da(r,fa(e,t)),e.create(t,e.Fragment,r,n)}function wC(e,t){return t.value}function Wh(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function da(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function kC(e,t,n){return r;function r(o,i,s,a){const u=Array.isArray(s.children)?n:t;return a?u(i,s,a):u(i,s)}}function _C(e,t){return n;function n(r,o,i,s){const a=Array.isArray(i.children),c=ca(r);return t(o,i,s,a,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function SC(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&ua.call(t.properties,o)){const i=jC(e,o,t.properties[o]);if(i){const[s,a]=i;e.tableCellAlignToStyle&&s==="align"&&typeof a=="string"&&pC.has(t.tagName)?r=a:n[s]=a}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function CC(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const s=i.expression;s.type;const a=s.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else wr(e,t.position);else{const o=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,i=e.evaluater.evaluateExpression(a.expression)}else wr(e,t.position);else i=r.value===null?!0:r.value;n[o]=i}return n}function fa(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:dC;for(;++r<t.children.length;){const i=t.children[r];let s;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const u=o.get(c)||0;s=c+"-"+u,o.set(c,u+1)}}const a=Vh(e,i,s);a!==void 0&&n.push(a)}return n}function jC(e,t,n){const r=QS(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?BS(n):rC(n)),r.property==="style"){let o=typeof n=="object"?n:EC(e,String(n));return e.stylePropertyNameCase==="css"&&(o=NC(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?JS[r.property]||r.property:r.attribute,n]}}function EC(e,t){try{return cC(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=Zh+"#cannot-parse-style-attribute",o}}function Hh(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let i=-1,s;for(;++i<o.length;){const a=Ll(o[i])?{type:"Identifier",name:o[i]}:{type:"Literal",value:o[i]};s=s?{type:"MemberExpression",object:s,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}r=s}else r=Ll(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return ua.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);wr(e)}function wr(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=Zh+"#cannot-handle-mdx-estrees-without-createevaluater",n}function NC(e){const t={};let n;for(n in e)ua.call(e,n)&&(t[TC(n)]=e[n]);return t}function TC(e){let t=e.replace(fC,AC);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function AC(e){return"-"+e.toLowerCase()}const _i={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"]},IC={};function zC(e,t){const n=IC,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return qh(e,r,o)}function qh(e,t,n){if(PC(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 Kl(e.children,t,n)}return Array.isArray(e)?Kl(e,t,n):""}function Kl(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=qh(e[o],t,n);return r.join("")}function PC(e){return!!(e&&typeof e=="object")}const Gl=document.createElement("i");function ha(e){const t="&"+e+";";Gl.innerHTML=t;const n=Gl.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Lt(e,t,n,r){const o=e.length;let i=0,s;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);i<r.length;)s=r.slice(i,i+1e4),s.unshift(t,0),e.splice(...s),i+=1e4,t+=1e4}function yt(e,t){return e.length>0?(Lt(e,e.length,0,t),e):t}const Jl={}.hasOwnProperty;function RC(e){const t={};let n=-1;for(;++n<e.length;)OC(t,e[n]);return t}function OC(e,t){let n;for(n in t){const o=(Jl.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let s;if(i)for(s in i){Jl.call(o,s)||(o[s]=[]);const a=i[s];DC(o[s],Array.isArray(a)?a:a?[a]:[])}}}function DC(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Lt(e,0,0,r)}function Kh(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 Mn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Pt=ln(/[A-Za-z]/),mt=ln(/[\dA-Za-z]/),MC=ln(/[#-'*+\--9=?A-Z^-~]/);function ls(e){return e!==null&&(e<32||e===127)}const cs=ln(/\d/),LC=ln(/[\dA-Fa-f]/),FC=ln(/[!-/:-@[-`{-~]/);function _e(e){return e!==null&&e<-2}function ct(e){return e!==null&&(e<0||e===32)}function Me(e){return e===-2||e===-1||e===32}const $C=ln(new RegExp("\\p{P}|\\p{S}","u")),BC=ln(/\s/);function ln(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function er(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const i=e.charCodeAt(n);let s="";if(i===37&&mt(e.charCodeAt(n+1))&&mt(e.charCodeAt(n+2)))o=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(s=String.fromCharCode(i));else if(i>55295&&i<57344){const a=e.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(s=String.fromCharCode(i,a),o=1):s="�"}else s=String.fromCharCode(i);s&&(t.push(e.slice(r,n),encodeURIComponent(s)),r=n+o+1,s=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function Be(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let i=0;return s;function s(c){return Me(c)?(e.enter(n),a(c)):t(c)}function a(c){return Me(c)&&i++<o?(e.consume(c),a):(e.exit(n),t(c))}}const UC={tokenize:ZC};function ZC(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"),Be(e,t,"linePrefix")}function o(a){return e.enter("paragraph"),i(a)}function i(a){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,s(a)}function s(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return _e(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),s)}}const VC={tokenize:WC},Yl={tokenize:HC};function WC(e){const t=this,n=[];let r=0,o,i,s;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 N=S,C;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){C=t.events[N][1].end;break}g(r);let E=S;for(;E<t.events.length;)t.events[E][1].end={...C},E++;return Lt(t.events,N+1,0,t.events.slice(S)),t.events.length=E,u(k)}return a(k)}function u(k){if(r===n.length){if(!o)return p(k);if(o.currentConstruct&&o.currentConstruct.concrete)return x(k);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Yl,d,h)(k)}function d(k){return o&&b(),g(r),p(k)}function h(k){return t.parser.lazy[t.now().line]=r!==n.length,s=t.now().offset,x(k)}function p(k){return t.containerState={},e.attempt(Yl,f,x)(k)}function f(k){return r++,n.push([t.currentConstruct,t.containerState]),p(k)}function x(k){if(k===null){o&&b(),g(0),e.consume(k);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:i}),m(k)}function m(k){if(k===null){y(e.exit("chunkFlow"),!0),g(0),e.consume(k);return}return _e(k)?(e.consume(k),y(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(k),m)}function y(k,S){const N=t.sliceStream(k);if(S&&N.push(null),k.previous=i,i&&(i.next=k),i=k,o.defineSkip(k.start),o.write(N),t.parser.lazy[k.start.line]){let C=o.events.length;for(;C--;)if(o.events[C][1].start.offset<s&&(!o.events[C][1].end||o.events[C][1].end.offset>s))return;const E=t.events.length;let T=E,R,M;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(R){M=t.events[T][1].end;break}R=!0}for(g(r),C=E;C<t.events.length;)t.events[C][1].end={...M},C++;Lt(t.events,T+1,0,t.events.slice(E)),t.events.length=C}}function g(k){let S=n.length;for(;S-- >k;){const N=n[S];t.containerState=N[1],N[0].exit.call(t,e)}n.length=k}function b(){o.write([null]),i=void 0,o=void 0,t.containerState._closeFlow=void 0}}function HC(e,t,n){return Be(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Xl(e){if(e===null||ct(e)||BC(e))return 1;if($C(e))return 2}function pa(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const i=e[o].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const us={name:"attention",resolveAll:qC,tokenize:KC};function qC(e,t){let n=-1,r,o,i,s,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};Ql(h,-c),Ql(p,c),s={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},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:c>1?"strong":"emphasis",start:{...s.start},end:{...a.end}},e[r][1].end={...s.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",s,t],["exit",s,t],["enter",i,t]]),u=yt(u,pa(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=yt(u,[["exit",i,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,Lt(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 KC(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=Xl(r);let i;return s;function s(c){return i=c,e.enter("attentionSequence"),a(c)}function a(c){if(c===i)return e.consume(c),a;const u=e.exit("attentionSequence"),d=Xl(c),h=!d||d===2&&o||n.includes(c),p=!o||o===2&&d||n.includes(r);return u._open=!!(i===42?h:h&&(o||!p)),u._close=!!(i===42?p:p&&(d||!h)),t(c)}}function Ql(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const GC={name:"autolink",tokenize:JC};function JC(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"),i}function i(f){return Pt(f)?(e.consume(f),s):f===64?n(f):u(f)}function s(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||ls(f)?n(f):(e.consume(f),c)}function u(f){return f===64?(e.consume(f),d):MC(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 x=f===45?p:h;return e.consume(f),x}return n(f)}}const Go={partial:!0,tokenize:YC};function YC(e,t,n){return r;function r(i){return Me(i)?Be(e,o,"linePrefix")(i):o(i)}function o(i){return i===null||_e(i)?t(i):n(i)}}const Gh={continuation:{tokenize:QC},exit:ej,name:"blockQuote",tokenize:XC};function XC(e,t,n){const r=this;return o;function o(s){if(s===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(s),e.exit("blockQuoteMarker"),i}return n(s)}function i(s){return Me(s)?(e.enter("blockQuotePrefixWhitespace"),e.consume(s),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(s))}}function QC(e,t,n){const r=this;return o;function o(s){return Me(s)?Be(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s):i(s)}function i(s){return e.attempt(Gh,t,n)(s)}}function ej(e){e.exit("blockQuote")}const Jh={name:"characterEscape",tokenize:tj};function tj(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),o}function o(i){return FC(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const Yh={name:"characterReference",tokenize:nj};function nj(e,t,n){const r=this;let o=0,i,s;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"),i=31,s=mt,d(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,s=LC,d):(e.enter("characterReferenceValue"),i=7,s=cs,d(h))}function d(h){if(h===59&&o){const p=e.exit("characterReferenceValue");return s===mt&&!ha(r.sliceSerialize(p))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return s(h)&&o++<i?(e.consume(h),d):n(h)}}const ec={partial:!0,tokenize:oj},tc={concrete:!0,name:"codeFenced",tokenize:rj};function rj(e,t,n){const r=this,o={partial:!0,tokenize:N};let i=0,s=0,a;return c;function c(C){return u(C)}function u(C){const E=r.events[r.events.length-1];return i=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,a=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(C)}function d(C){return C===a?(s++,e.consume(C),d):s<3?n(C):(e.exit("codeFencedFenceSequence"),Me(C)?Be(e,h,"whitespace")(C):h(C))}function h(C){return C===null||_e(C)?(e.exit("codeFencedFence"),r.interrupt?t(C):e.check(ec,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)):Me(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Be(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"}),x(C))}function x(C){return C===null||_e(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(C)):C===96&&C===a?n(C):(e.consume(C),x)}function m(C){return e.attempt(o,S,y)(C)}function y(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),g}function g(C){return i>0&&Me(C)?Be(e,b,"linePrefix",i+1)(C):b(C)}function b(C){return C===null||_e(C)?e.check(ec,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 N(C,E,T){let R=0;return M;function M(P){return C.enter("lineEnding"),C.consume(P),C.exit("lineEnding"),L}function L(P){return C.enter("codeFencedFence"),Me(P)?Be(C,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):j(P)}function j(P){return P===a?(C.enter("codeFencedFenceSequence"),D(P)):T(P)}function D(P){return P===a?(R++,C.consume(P),D):R>=s?(C.exit("codeFencedFenceSequence"),Me(P)?Be(C,w,"whitespace")(P):w(P)):T(P)}function w(P){return P===null||_e(P)?(C.exit("codeFencedFence"),E(P)):T(P)}}}function oj(e,t,n){const r=this;return o;function o(s){return s===null?n(s):(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}const Si={name:"codeIndented",tokenize:sj},ij={partial:!0,tokenize:aj};function sj(e,t,n){const r=this;return o;function o(u){return e.enter("codeIndented"),Be(e,i,"linePrefix",5)(u)}function i(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?c(u):_e(u)?e.attempt(ij,s,c)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||_e(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),a)}function c(u){return e.exit("codeIndented"),t(u)}}function aj(e,t,n){const r=this;return o;function o(s){return r.parser.lazy[r.now().line]?n(s):_e(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),o):Be(e,i,"linePrefix",5)(s)}function i(s){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(s):_e(s)?o(s):n(s)}}const lj={name:"codeText",previous:uj,resolve:cj,tokenize:dj};function cj(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 uj(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function dj(e,t,n){let r=0,o,i;return s;function s(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?(i=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)):(i.type="codeTextData",u(h))}}class fj{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const o=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&sr(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),sr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),sr(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);sr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);sr(this.left,n.reverse())}}}function sr(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 Xh(e){const t={};let n=-1,r,o,i,s,a,c,u;const d=new fj(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,hj(d,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,o=void 0;i--;)if(s=d.get(i),s[1].type==="lineEnding"||s[1].type==="lineEndingBlank")s[0]==="enter"&&(o&&(d.get(o)[1].type="lineEndingBlank"),s[1].type="lineEnding",o=i);else if(!(s[1].type==="linePrefix"||s[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 Lt(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function hj(e,t){const n=e.get(t)[1],r=e.get(t)[2];let o=t-1;const i=[];let s=n._tokenizer;s||(s=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(s._contentTypeTextTrailing=!0));const a=s.events,c=[],u={};let d,h,p=-1,f=n,x=0,m=0;const y=[m];for(;f;){for(;e.get(++o)[1]!==f;);i.push(o),f._tokenizer||(d=r.sliceStream(f),f.next||d.push(null),h&&s.defineSkip(f.start),f._isInFirstContentOfListItem&&(s._gfmTasklistFirstContentOfListItem=!0),s.write(d),f._isInFirstContentOfListItem&&(s._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,y.push(m),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(s.events=[],f?(f._tokenizer=void 0,f.previous=void 0):y.pop(),p=y.length;p--;){const g=a.slice(y[p],y[p+1]),b=i.pop();c.push([b,b+g.length-1]),e.splice(b,2,g)}for(c.reverse(),p=-1;++p<c.length;)u[x+c[p][0]]=x+c[p][1],x+=c[p][1]-c[p][0]-1;return u}const pj={resolve:gj,tokenize:xj},mj={partial:!0,tokenize:yj};function gj(e){return Xh(e),e}function xj(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?i(a):_e(a)?e.check(mj,s,i)(a):(e.consume(a),o)}function i(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function s(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function yj(e,t,n){const r=this;return o;function o(s){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Be(e,i,"linePrefix")}function i(s){if(s===null||_e(s))return n(s);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(s):e.interrupt(r.parser.constructs.flow,n,t)(s)}}function Qh(e,t,n,r,o,i,s,a,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return h;function h(g){return g===60?(e.enter(r),e.enter(o),e.enter(i),e.consume(g),e.exit(i),p):g===null||g===32||g===41||ls(g)?n(g):(e.enter(r),e.enter(s),e.enter(a),e.enter("chunkString",{contentType:"string"}),m(g))}function p(g){return g===62?(e.enter(i),e.consume(g),e.exit(i),e.exit(o),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),f(g))}function f(g){return g===62?(e.exit("chunkString"),e.exit(a),p(g)):g===null||g===60||_e(g)?n(g):(e.consume(g),g===92?x:f)}function x(g){return g===60||g===62||g===92?(e.consume(g),f):f(g)}function m(g){return!d&&(g===null||g===41||ct(g))?(e.exit("chunkString"),e.exit(a),e.exit(s),e.exit(r),t(g)):d<u&&g===40?(e.consume(g),d++,m):g===41?(e.consume(g),d--,m):g===null||g===32||g===40||ls(g)?n(g):(e.consume(g),g===92?y:m)}function y(g){return g===40||g===41||g===92?(e.consume(g),m):m(g)}}function ep(e,t,n,r,o,i){const s=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(i),d}function d(f){return a>999||f===null||f===91||f===93&&!c||f===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(f):f===93?(e.exit(i),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=!Me(f)),f===92?p:h)}function p(f){return f===91||f===92||f===93?(e.consume(f),a++,h):h(f)}}function tp(e,t,n,r,o,i){let s;return a;function a(p){return p===34||p===39||p===40?(e.enter(r),e.enter(o),e.consume(p),e.exit(o),s=p===40?41:p,c):n(p)}function c(p){return p===s?(e.enter(o),e.consume(p),e.exit(o),e.exit(r),t):(e.enter(i),u(p))}function u(p){return p===s?(e.exit(i),c(s)):p===null?n(p):_e(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Be(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===s||p===null||_e(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?h:d)}function h(p){return p===s||p===92?(e.consume(p),d):d(p)}}function hr(e,t){let n;return r;function r(o){return _e(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):Me(o)?Be(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const vj={name:"definition",tokenize:wj},bj={partial:!0,tokenize:kj};function wj(e,t,n){const r=this;let o;return i;function i(f){return e.enter("definition"),s(f)}function s(f){return ep.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return o=Mn(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)?hr(e,u)(f):u(f)}function u(f){return Qh(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function d(f){return e.attempt(bj,h,h)(f)}function h(f){return Me(f)?Be(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 kj(e,t,n){return r;function r(a){return ct(a)?hr(e,o)(a):n(a)}function o(a){return tp(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return Me(a)?Be(e,s,"whitespace")(a):s(a)}function s(a){return a===null||_e(a)?t(a):n(a)}}const _j={name:"hardBreakEscape",tokenize:Sj};function Sj(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),o}function o(i){return _e(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const Cj={name:"headingAtx",resolve:jj,tokenize:Ej};function jj(e,t){let n=e.length-2,r=3,o,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Lt(e,r,n-r+1,[["enter",o,t],["enter",i,t],["exit",i,t],["exit",o,t]])),e}function Ej(e,t,n){let r=0;return o;function o(d){return e.enter("atxHeading"),i(d)}function i(d){return e.enter("atxHeadingSequence"),s(d)}function s(d){return d===35&&r++<6?(e.consume(d),s):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)):Me(d)?Be(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 Nj=["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"],nc=["pre","script","style","textarea"],Tj={concrete:!0,name:"htmlFlow",resolveTo:zj,tokenize:Pj},Aj={partial:!0,tokenize:Oj},Ij={partial:!0,tokenize:Rj};function zj(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 Pj(e,t,n){const r=this;let o,i,s,a,c;return u;function u(I){return d(I)}function d(I){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(I),h}function h(I){return I===33?(e.consume(I),p):I===47?(e.consume(I),i=!0,m):I===63?(e.consume(I),o=3,r.interrupt?t:A):Pt(I)?(e.consume(I),s=String.fromCharCode(I),y):n(I)}function p(I){return I===45?(e.consume(I),o=2,f):I===91?(e.consume(I),o=5,a=0,x):Pt(I)?(e.consume(I),o=4,r.interrupt?t:A):n(I)}function f(I){return I===45?(e.consume(I),r.interrupt?t:A):n(I)}function x(I){const oe="CDATA[";return I===oe.charCodeAt(a++)?(e.consume(I),a===oe.length?r.interrupt?t:j:x):n(I)}function m(I){return Pt(I)?(e.consume(I),s=String.fromCharCode(I),y):n(I)}function y(I){if(I===null||I===47||I===62||ct(I)){const oe=I===47,Y=s.toLowerCase();return!oe&&!i&&nc.includes(Y)?(o=1,r.interrupt?t(I):j(I)):Nj.includes(s.toLowerCase())?(o=6,oe?(e.consume(I),g):r.interrupt?t(I):j(I)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(I):i?b(I):k(I))}return I===45||mt(I)?(e.consume(I),s+=String.fromCharCode(I),y):n(I)}function g(I){return I===62?(e.consume(I),r.interrupt?t:j):n(I)}function b(I){return Me(I)?(e.consume(I),b):M(I)}function k(I){return I===47?(e.consume(I),M):I===58||I===95||Pt(I)?(e.consume(I),S):Me(I)?(e.consume(I),k):M(I)}function S(I){return I===45||I===46||I===58||I===95||mt(I)?(e.consume(I),S):N(I)}function N(I){return I===61?(e.consume(I),C):Me(I)?(e.consume(I),N):k(I)}function C(I){return I===null||I===60||I===61||I===62||I===96?n(I):I===34||I===39?(e.consume(I),c=I,E):Me(I)?(e.consume(I),C):T(I)}function E(I){return I===c?(e.consume(I),c=null,R):I===null||_e(I)?n(I):(e.consume(I),E)}function T(I){return I===null||I===34||I===39||I===47||I===60||I===61||I===62||I===96||ct(I)?N(I):(e.consume(I),T)}function R(I){return I===47||I===62||Me(I)?k(I):n(I)}function M(I){return I===62?(e.consume(I),L):n(I)}function L(I){return I===null||_e(I)?j(I):Me(I)?(e.consume(I),L):n(I)}function j(I){return I===45&&o===2?(e.consume(I),H):I===60&&o===1?(e.consume(I),B):I===62&&o===4?(e.consume(I),W):I===63&&o===3?(e.consume(I),A):I===93&&o===5?(e.consume(I),X):_e(I)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(Aj,V,D)(I)):I===null||_e(I)?(e.exit("htmlFlowData"),D(I)):(e.consume(I),j)}function D(I){return e.check(Ij,w,V)(I)}function w(I){return e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),P}function P(I){return I===null||_e(I)?D(I):(e.enter("htmlFlowData"),j(I))}function H(I){return I===45?(e.consume(I),A):j(I)}function B(I){return I===47?(e.consume(I),s="",q):j(I)}function q(I){if(I===62){const oe=s.toLowerCase();return nc.includes(oe)?(e.consume(I),W):j(I)}return Pt(I)&&s.length<8?(e.consume(I),s+=String.fromCharCode(I),q):j(I)}function X(I){return I===93?(e.consume(I),A):j(I)}function A(I){return I===62?(e.consume(I),W):I===45&&o===2?(e.consume(I),A):j(I)}function W(I){return I===null||_e(I)?(e.exit("htmlFlowData"),V(I)):(e.consume(I),W)}function V(I){return e.exit("htmlFlow"),t(I)}}function Rj(e,t,n){const r=this;return o;function o(s){return _e(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):t(s)}}function Oj(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Go,t,n)}}const Dj={name:"htmlText",tokenize:Mj};function Mj(e,t,n){const r=this;let o,i,s;return a;function a(A){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(A),c}function c(A){return A===33?(e.consume(A),u):A===47?(e.consume(A),N):A===63?(e.consume(A),k):Pt(A)?(e.consume(A),T):n(A)}function u(A){return A===45?(e.consume(A),d):A===91?(e.consume(A),i=0,x):Pt(A)?(e.consume(A),b):n(A)}function d(A){return A===45?(e.consume(A),f):n(A)}function h(A){return A===null?n(A):A===45?(e.consume(A),p):_e(A)?(s=h,B(A)):(e.consume(A),h)}function p(A){return A===45?(e.consume(A),f):h(A)}function f(A){return A===62?H(A):A===45?p(A):h(A)}function x(A){const W="CDATA[";return A===W.charCodeAt(i++)?(e.consume(A),i===W.length?m:x):n(A)}function m(A){return A===null?n(A):A===93?(e.consume(A),y):_e(A)?(s=m,B(A)):(e.consume(A),m)}function y(A){return A===93?(e.consume(A),g):m(A)}function g(A){return A===62?H(A):A===93?(e.consume(A),g):m(A)}function b(A){return A===null||A===62?H(A):_e(A)?(s=b,B(A)):(e.consume(A),b)}function k(A){return A===null?n(A):A===63?(e.consume(A),S):_e(A)?(s=k,B(A)):(e.consume(A),k)}function S(A){return A===62?H(A):k(A)}function N(A){return Pt(A)?(e.consume(A),C):n(A)}function C(A){return A===45||mt(A)?(e.consume(A),C):E(A)}function E(A){return _e(A)?(s=E,B(A)):Me(A)?(e.consume(A),E):H(A)}function T(A){return A===45||mt(A)?(e.consume(A),T):A===47||A===62||ct(A)?R(A):n(A)}function R(A){return A===47?(e.consume(A),H):A===58||A===95||Pt(A)?(e.consume(A),M):_e(A)?(s=R,B(A)):Me(A)?(e.consume(A),R):H(A)}function M(A){return A===45||A===46||A===58||A===95||mt(A)?(e.consume(A),M):L(A)}function L(A){return A===61?(e.consume(A),j):_e(A)?(s=L,B(A)):Me(A)?(e.consume(A),L):R(A)}function j(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),o=A,D):_e(A)?(s=j,B(A)):Me(A)?(e.consume(A),j):(e.consume(A),w)}function D(A){return A===o?(e.consume(A),o=void 0,P):A===null?n(A):_e(A)?(s=D,B(A)):(e.consume(A),D)}function w(A){return A===null||A===34||A===39||A===60||A===61||A===96?n(A):A===47||A===62||ct(A)?R(A):(e.consume(A),w)}function P(A){return A===47||A===62||ct(A)?R(A):n(A)}function H(A){return A===62?(e.consume(A),e.exit("htmlTextData"),e.exit("htmlText"),t):n(A)}function B(A){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),q}function q(A){return Me(A)?Be(e,X,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):X(A)}function X(A){return e.enter("htmlTextData"),s(A)}}const ma={name:"labelEnd",resolveAll:Bj,resolveTo:Uj,tokenize:Zj},Lj={tokenize:Vj},Fj={tokenize:Wj},$j={tokenize:Hj};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&&Lt(e,0,e.length,n),e}function Uj(e,t){let n=e.length,r=0,o,i,s,a;for(;n--;)if(o=e[n][1],i){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(s){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(i=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(s=n);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[s][1].end}},d={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[s-2][1].start}};return a=[["enter",c,t],["enter",u,t]],a=yt(a,e.slice(i+1,i+r+3)),a=yt(a,[["enter",d,t]]),a=yt(a,pa(t.parser.constructs.insideSpan.null,e.slice(i+r+4,s-3),t)),a=yt(a,[["exit",d,t],e[s-2],e[s-1],["exit",u,t]]),a=yt(a,e.slice(s+1)),a=yt(a,[["exit",c,t]]),Lt(e,i,e.length,a),e}function Zj(e,t,n){const r=this;let o=r.events.length,i,s;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){i=r.events[o][1];break}return a;function a(p){return i?i._inactive?h(p):(s=r.parser.defined.includes(Mn(r.sliceSerialize({start:i.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(Lj,d,s?d:h)(p):p===91?e.attempt(Fj,d,s?u:h)(p):s?d(p):h(p)}function u(p){return e.attempt($j,d,h)(p)}function d(p){return t(p)}function h(p){return i._balanced=!0,n(p)}}function Vj(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)?hr(e,i)(h):i(h)}function i(h){return h===41?d(h):Qh(e,s,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function s(h){return ct(h)?hr(e,c)(h):d(h)}function a(h){return n(h)}function c(h){return h===34||h===39||h===40?tp(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return ct(h)?hr(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 Wj(e,t,n){const r=this;return o;function o(a){return ep.call(r,e,i,s,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(Mn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function s(a){return n(a)}}function Hj(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),o}function o(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const qj={name:"labelStartImage",resolveAll:ma.resolveAll,tokenize:Kj};function Kj(e,t,n){const r=this;return o;function o(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),i}function i(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),s):n(a)}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Gj={name:"labelStartLink",resolveAll:ma.resolveAll,tokenize:Jj};function Jj(e,t,n){const r=this;return o;function o(s){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(s),e.exit("labelMarker"),e.exit("labelLink"),i}function i(s){return s===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(s):t(s)}}const Ci={name:"lineEnding",tokenize:Yj};function Yj(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Be(e,t,"linePrefix")}}const Xr={name:"thematicBreak",tokenize:Xj};function Xj(e,t,n){let r=0,o;return i;function i(u){return e.enter("thematicBreak"),s(u)}function s(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"),Me(u)?Be(e,a,"whitespace")(u):a(u))}}const st={continuation:{tokenize:nE},exit:oE,name:"list",tokenize:tE},Qj={partial:!0,tokenize:iE},eE={partial:!0,tokenize:rE};function tE(e,t,n){const r=this,o=r.events[r.events.length-1];let i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,s=0;return a;function a(f){const x=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:cs(f)){if(r.containerState.type||(r.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Xr,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 cs(f)&&++s<10?(e.consume(f),c):(!r.interrupt||s<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(Go,r.interrupt?n:d,e.attempt(Qj,p,h))}function d(f){return r.containerState.initialBlankLine=!0,i++,p(f)}function h(f){return Me(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),p):n(f)}function p(f){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function nE(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Go,o,i);function o(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Be(e,t,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!Me(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(eE,t,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Be(e,e.attempt(st,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function rE(e,t,n){const r=this;return Be(e,o,"listItemIndent",r.containerState.size+1);function o(i){const s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?t(i):n(i)}}function oE(e){e.exit(this.containerState.type)}function iE(e,t,n){const r=this;return Be(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(i){const s=r.events[r.events.length-1];return!Me(i)&&s&&s[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const rc={name:"setextUnderline",resolveTo:sE,tokenize:aE};function sE(e,t){let n=e.length,r,o,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const s={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",i?(e.splice(o,0,["enter",s,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=s,e.push(["exit",s,t]),e}function aE(e,t,n){const r=this;let o;return i;function i(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,s(u)):n(u)}function s(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===o?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),Me(u)?Be(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||_e(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const lE={tokenize:cE};function cE(e){const t=this,n=e.attempt(Go,r,e.attempt(this.parser.constructs.flowInitial,o,Be(e,e.attempt(this.parser.constructs.flow,o,e.attempt(pj,o)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const uE={resolveAll:rp()},dE=np("string"),fE=np("text");function np(e){return{resolveAll:rp(e==="text"?hE:void 0),tokenize:t};function t(n){const r=this,o=this.parser.constructs[e],i=n.attempt(o,s,a);return s;function s(d){return u(d)?i(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"),i(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 rp(e){return t;function t(n,r){let o=-1,i;for(;++o<=n.length;)i===void 0?n[o]&&n[o][1].type==="data"&&(i=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==i+2&&(n[i][1].end=n[o-1][1].end,n.splice(i+2,o-i-2),o=i+2),i=void 0);return e?e(n,r):n}}function hE(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],o=t.sliceStream(r);let i=o.length,s=-1,a=0,c;for(;i--;){const u=o[i];if(typeof u=="string"){for(s=u.length;u.charCodeAt(s-1)===32;)a++,s--;if(s)break;s=-1}else if(u===-2)c=!0,a++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const u={type:n===e.length||c||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?s:r.start._bufferIndex+s,_index:r.start._index+i,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 pE={42:st,43:st,45:st,48:st,49:st,50:st,51:st,52:st,53:st,54:st,55:st,56:st,57:st,62:Gh},mE={91:vj},gE={[-2]:Si,[-1]:Si,32:Si},xE={35:Cj,42:Xr,45:[rc,Xr],60:Tj,61:rc,95:Xr,96:tc,126:tc},yE={38:Yh,92:Jh},vE={[-5]:Ci,[-4]:Ci,[-3]:Ci,33:qj,38:Yh,42:us,60:[GC,Dj],91:Gj,92:[_j,Jh],93:ma,95:us,96:lj},bE={null:[us,uE]},wE={null:[42,95]},kE={null:[]},_E=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:wE,contentInitial:mE,disable:kE,document:pE,flow:xE,flowInitial:gE,insideSpan:bE,string:yE,text:vE},Symbol.toStringTag,{value:"Module"}));function SE(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},i=[];let s=[],a=[];const c={attempt:E(N),check:E(C),consume:b,enter:k,exit:S,interrupt:E(C,{interrupt:!0})},u={code:null,containerState:{},defineSkip:m,events:[],now:x,parser:e,previous:null,sliceSerialize:p,sliceStream:f,write:h};let d=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function h(L){return s=yt(s,L),y(),s[s.length-1]!==null?[]:(T(t,0),u.events=pa(i,u.events,u),u.events)}function p(L,j){return jE(f(L),j)}function f(L){return CE(s,L)}function x(){const{_bufferIndex:L,_index:j,line:D,column:w,offset:P}=r;return{_bufferIndex:L,_index:j,line:D,column:w,offset:P}}function m(L){o[L.line]=L.column,M()}function y(){let L;for(;r._index<s.length;){const j=s[r._index];if(typeof j=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<j.length;)g(j.charCodeAt(r._bufferIndex));else g(j)}}function g(L){d=d(L)}function b(L){_e(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,M()):L!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===s[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=L}function k(L,j){const D=j||{};return D.type=L,D.start=x(),u.events.push(["enter",D,u]),a.push(D),D}function S(L){const j=a.pop();return j.end=x(),u.events.push(["exit",j,u]),j}function N(L,j){T(L,j.from)}function C(L,j){j.restore()}function E(L,j){return D;function D(w,P,H){let B,q,X,A;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:I(de[q])}function I(de){return te;function te(ce){return A=R(),X=de,de.partial||(u.currentConstruct=de),de.name&&u.parser.constructs.disable.null.includes(de.name)?Y():de.tokenize.call(j?Object.assign(Object.create(u),j):u,c,oe,Y)(ce)}}function oe(de){return L(X,A),P}function Y(de){return A.restore(),++q<B.length?I(B[q]):H}}}function T(L,j){L.resolveAll&&!i.includes(L)&&i.push(L),L.resolve&&Lt(u.events,j,u.events.length-j,L.resolve(u.events.slice(j),u)),L.resolveTo&&(u.events=L.resolveTo(u.events,u))}function R(){const L=x(),j=u.previous,D=u.currentConstruct,w=u.events.length,P=Array.from(a);return{from:w,restore:H};function H(){r=L,u.previous=j,u.currentConstruct=D,u.events.length=w,a=P,M()}}function M(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function CE(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,i=t.end._bufferIndex;let s;if(n===o)s=[e[n].slice(r,i)];else{if(s=e.slice(n,o),r>-1){const a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}i>0&&s.push(e[o].slice(0,i))}return s}function jE(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const i=e[n];let s;if(typeof i=="string")s=i;else switch(i){case-5:{s="\r";break}case-4:{s=`
86
+ `;break}case-3:{s=`\r
87
+ `;break}case-2:{s=t?" ":" ";break}case-1:{if(!t&&o)continue;s=" ";break}default:s=String.fromCharCode(i)}o=i===-2,r.push(s)}return r.join("")}function EE(e){const r={constructs:RC([_E,...(e||{}).extensions||[]]),content:o(UC),defined:[],document:o(VC),flow:o(lE),lazy:{},string:o(dE),text:o(fE)};return r;function o(i){return s;function s(a){return SE(r,i,a)}}}function NE(e){for(;!Xh(e););return e}const oc=/[\0\t\n\r]/g;function TE(){let e=1,t="",n=!0,r;return o;function o(i,s,a){const c=[];let u,d,h,p,f;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(s||void 0).decode(i)),h=0,t="",n&&(i.charCodeAt(0)===65279&&h++,n=void 0);h<i.length;){if(oc.lastIndex=h,u=oc.exec(i),p=u&&u.index!==void 0?u.index:i.length,f=i.charCodeAt(p),!u){t=i.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(i.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 AE=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function IE(e){return e.replace(AE,zE)}function zE(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),i=o===120||o===88;return Kh(n.slice(i?2:1),i?16:10)}return ha(n)||e}const op={}.hasOwnProperty;function PE(e,t,n){return typeof t!="string"&&(n=t,t=void 0),RE(n)(NE(EE(n).document().write(TE()(e,t,!0))))}function RE(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(F),autolinkProtocol:R,autolinkEmail:R,atxHeading:i(ee),blockQuote:i(ge),characterEscape:R,characterReference:R,codeFenced:i(xe),codeFencedFenceInfo:s,codeFencedFenceMeta:s,codeIndented:i(xe,s),codeText:i(Ee,s),codeTextData:R,data:R,codeFlowValue:R,definition:i(Fe),definitionDestinationString:s,definitionLabelString:s,definitionTitleString:s,emphasis:i(_),hardBreakEscape:i(G),hardBreakTrailing:i(G),htmlFlow:i(O,s),htmlFlowData:R,htmlText:i(O,s),htmlTextData:R,image:i(z),label:s,link:i(F),listItem:i(J),listItemValue:p,listOrdered:i(U,h),listUnordered:i(U),paragraph:i($),reference:I,referenceString:s,resourceDestinationString:s,resourceTitleString:s,setextHeading:i(ee),strong:i(ne),thematicBreak:i(ie)},exit:{atxHeading:c(),atxHeadingSequence:N,autolink:c(),autolinkEmail:fe,autolinkProtocol:ce,blockQuote:c(),characterEscapeValue:M,characterReferenceMarkerHexadecimal:Y,characterReferenceMarkerNumeric:Y,characterReferenceValue:de,characterReference:te,codeFenced:c(y),codeFencedFence:m,codeFencedFenceInfo:f,codeFencedFenceMeta:x,codeFlowValue:M,codeIndented:c(g),codeText:c(P),codeTextData:M,data:M,definition:c(),definitionDestinationString:S,definitionLabelString:b,definitionTitleString:k,emphasis:c(),hardBreakEscape:c(j),hardBreakTrailing:c(j),htmlFlow:c(D),htmlFlowData:M,htmlText:c(w),htmlTextData:M,image:c(B),label:X,labelText:q,lineEnding:L,link:c(H),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:oe,resourceDestinationString:A,resourceTitleString:W,resource:V,setextHeading:c(T),setextHeadingLineSequence:E,setextHeadingText:C,strong:c(),thematicBreak:c()}};ip(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:s,resume:d,data:n},we=[];let Re=-1;for(;++Re<Z.length;)if(Z[Re][1].type==="listOrdered"||Z[Re][1].type==="listUnordered")if(Z[Re][0]==="enter")we.push(Re);else{const qe=we.pop();Re=o(Z,qe,Re)}for(Re=-1;++Re<Z.length;){const qe=t[Z[Re][0]];op.call(qe,Z[Re][1].type)&&qe[Z[Re][1].type].call(Object.assign({sliceSerialize:Z[Re][2].sliceSerialize},ue),Z[Re][1])}if(ue.tokenStack.length>0){const qe=ue.tokenStack[ue.tokenStack.length-1];(qe[1]||ic).call(ue,void 0,qe[0])}for(re.position={start:Jt(Z.length>0?Z[0][1].start:{line:1,column:1,offset:0}),end:Jt(Z.length>0?Z[Z.length-2][1].end:{line:1,column:1,offset:0})},Re=-1;++Re<t.transforms.length;)re=t.transforms[Re](re)||re;return re}function o(Z,re,ue){let we=re-1,Re=-1,qe=!1,ft,De,At,Bt;for(;++we<=ue;){const We=Z[we];switch(We[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{We[0]==="enter"?Re++:Re--,Bt=void 0;break}case"lineEndingBlank":{We[0]==="enter"&&(ft&&!Bt&&!Re&&!At&&(At=we),Bt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Bt=void 0}if(!Re&&We[0]==="enter"&&We[1].type==="listItemPrefix"||Re===-1&&We[0]==="exit"&&(We[1].type==="listUnordered"||We[1].type==="listOrdered")){if(ft){let Ut=we;for(De=void 0;Ut--;){const _t=Z[Ut];if(_t[1].type==="lineEnding"||_t[1].type==="lineEndingBlank"){if(_t[0]==="exit")continue;De&&(Z[De][1].type="lineEndingBlank",qe=!0),_t[1].type="lineEnding",De=Ut}else if(!(_t[1].type==="linePrefix"||_t[1].type==="blockQuotePrefix"||_t[1].type==="blockQuotePrefixWhitespace"||_t[1].type==="blockQuoteMarker"||_t[1].type==="listItemIndent"))break}At&&(!De||At<De)&&(ft._spread=!0),ft.end=Object.assign({},De?Z[De][1].start:We[1].end),Z.splice(De||we,0,["exit",ft,We[2]]),we++,ue++}if(We[1].type==="listItemPrefix"){const Ut={type:"listItem",_spread:!1,start:Object.assign({},We[1].start),end:void 0};ft=Ut,Z.splice(we,0,["enter",Ut,We[2]]),we++,ue++,At=void 0,Bt=!0}}}return Z[re][1]._spread=qe,ue}function i(Z,re){return ue;function ue(we){a.call(this,Z(we),we),re&&re.call(this,we)}}function s(){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:Jt(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(),we=this.tokenStack.pop();if(we)we[0].type!==Z.type&&(re?re.call(this,Z,we[0]):(we[1]||ic).call(this,Z,we[0]));else throw new Error("Cannot close `"+Z.type+"` ("+fr({start:Z.start,end:Z.end})+"): it’s not open");ue.position.end=Jt(Z.end)}function d(){return zC(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 x(){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 y(){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 g(){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=Mn(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 N(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 E(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 R(Z){const ue=this.stack[this.stack.length-1].children;let we=ue[ue.length-1];(!we||we.type!=="text")&&(we=le(),we.position={start:Jt(Z.start),end:void 0},ue.push(we)),this.stack.push(we)}function M(Z){const re=this.stack.pop();re.value+=this.sliceSerialize(Z),re.position.end=Jt(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=Jt(Z.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(re.type)&&(R.call(this,Z),M.call(this,Z))}function j(){this.data.atHardBreak=!0}function D(){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 P(){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=IE(re),ue.identifier=Mn(re).toLowerCase()}function X(){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 we=Z.children;ue.children=we}else ue.alt=re}function A(){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 I(){this.data.referenceType="collapsed"}function oe(Z){const re=this.resume(),ue=this.stack[this.stack.length-1];ue.label=re,ue.identifier=Mn(this.sliceSerialize(Z)).toLowerCase(),this.data.referenceType="full"}function Y(Z){this.data.characterReferenceType=Z.type}function de(Z){const re=this.sliceSerialize(Z),ue=this.data.characterReferenceType;let we;ue?(we=Kh(re,ue==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):we=ha(re);const Re=this.stack[this.stack.length-1];Re.value+=we}function te(Z){const re=this.stack.pop();re.position.end=Jt(Z.end)}function ce(Z){M.call(this,Z);const re=this.stack[this.stack.length-1];re.url=this.sliceSerialize(Z)}function fe(Z){M.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 Fe(){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 O(){return{type:"html",value:""}}function z(){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 ie(){return{type:"thematicBreak"}}}function Jt(e){return{line:e.line,column:e.column,offset:e.offset}}function ip(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?ip(e,r):OE(e,r)}}function OE(e,t){let n;for(n in t)if(op.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 ic(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+fr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+fr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+fr({start:t.start,end:t.end})+") is still open")}function DE(e){const t=this;t.parser=n;function n(r){return PE(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function ME(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 LE(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
88
+ `}]}function FE(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 i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function $E(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 UE(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=er(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let s,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),s=e.footnoteOrder.length):s=i+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(s)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function ZE(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 VE(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),i=o[0];i&&i.type==="text"?i.value="["+i.value:o.unshift({type:"text",value:"["});const s=o[o.length-1];return s&&s.type==="text"?s.value+=r:o.push({type:"text",value:r}),o}function WE(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return sp(e,t);const o={src:er(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(o.title=r.title);const i={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,i),e.applyData(t,i)}function HE(e,t){const n={src:er(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 qE(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 KE(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return sp(e,t);const o={href:er(r.url||"")};r.title!==null&&r.title!==void 0&&(o.title=r.title);const i={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function GE(e,t){const n={href:er(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 JE(e,t,n){const r=e.all(t),o=n?YE(n):ap(t),i={},s=[];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:[]}),i.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const d=r[a];(o||a!==0||d.type!=="element"||d.tagName!=="p")&&s.push({type:"text",value:`
90
+ `}),d.type==="element"&&d.tagName==="p"&&!o?s.push(...d.children):s.push(d)}const c=r[r.length-1];c&&(o||c.type!=="element"||c.tagName!=="p")&&s.push({type:"text",value:`
91
+ `});const u={type:"element",tagName:"li",properties:i,children:s};return e.patch(t,u),e.applyData(t,u)}function YE(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=ap(n[r])}return t}function ap(e){const t=e.spread;return t??e.children.length>1}function XE(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 s=r[o];if(s.type==="element"&&s.tagName==="li"&&s.properties&&Array.isArray(s.properties.className)&&s.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function QE(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function eN(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function tN(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function nN(e,t){const n=e.all(t),r=n.shift(),o=[];if(r){const s={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],s),o.push(s)}if(n.length>0){const s={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=ca(t.children[1]),c=Bh(t.children[t.children.length-1]);a&&c&&(s.position={start:a,end:c}),o.push(s)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,i),e.applyData(t,i)}function rN(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,a=s?s.length:t.children.length;let c=-1;const u=[];for(;++c<a;){const h=t.children[c],p={},f=s?s[c]:void 0;f&&(p.align=f);let x={type:"element",tagName:i,properties:p,children:[]};h&&(x.children=e.all(h),e.patch(h,x),x=e.applyData(h,x)),u.push(x)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function oN(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const sc=9,ac=32;function iN(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const i=[];for(;r;)i.push(lc(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return i.push(lc(t.slice(o),o>0,!1)),i.join("")}function lc(e,t,n){let r=0,o=e.length;if(t){let i=e.codePointAt(r);for(;i===sc||i===ac;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(o-1);for(;i===sc||i===ac;)o--,i=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function sN(e,t){const n={type:"text",value:iN(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function aN(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const lN={blockquote:ME,break:LE,code:FE,delete:$E,emphasis:BE,footnoteReference:UE,heading:ZE,html:VE,imageReference:WE,image:HE,inlineCode:qE,linkReference:KE,link:GE,listItem:JE,list:XE,paragraph:QE,root:eN,strong:tN,table:nN,tableCell:oN,tableRow:rN,text:sN,thematicBreak:aN,toml:Zr,yaml:Zr,definition:Zr,footnoteDefinition:Zr};function Zr(){}const lp=-1,Jo=0,pr=1,yo=2,ga=3,xa=4,ya=5,va=6,cp=7,up=8,cc=typeof self=="object"?self:globalThis,cN=(e,t)=>{const n=(o,i)=>(e.set(i,o),o),r=o=>{if(e.has(o))return e.get(o);const[i,s]=t[o];switch(i){case Jo:case lp:return n(s,o);case pr:{const a=n([],o);for(const c of s)a.push(r(c));return a}case yo:{const a=n({},o);for(const[c,u]of s)a[r(c)]=r(u);return a}case ga:return n(new Date(s),o);case xa:{const{source:a,flags:c}=s;return n(new RegExp(a,c),o)}case ya:{const a=n(new Map,o);for(const[c,u]of s)a.set(r(c),r(u));return a}case va:{const a=n(new Set,o);for(const c of s)a.add(r(c));return a}case cp:{const{name:a,message:c}=s;return n(new cc[a](c),o)}case up:return n(BigInt(s),o);case"BigInt":return n(Object(BigInt(s)),o);case"ArrayBuffer":return n(new Uint8Array(s).buffer,s);case"DataView":{const{buffer:a}=new Uint8Array(s);return n(new DataView(a),s)}}return n(new cc[i](s),o)};return r},uc=e=>cN(new Map,e)(0),En="",{toString:uN}={},{keys:dN}=Object,ar=e=>{const t=typeof e;if(t!=="object"||!e)return[Jo,t];const n=uN.call(e).slice(8,-1);switch(n){case"Array":return[pr,En];case"Object":return[yo,En];case"Date":return[ga,En];case"RegExp":return[xa,En];case"Map":return[ya,En];case"Set":return[va,En];case"DataView":return[pr,n]}return n.includes("Array")?[pr,n]:n.includes("Error")?[cp,n]:[yo,n]},Vr=([e,t])=>e===Jo&&(t==="function"||t==="symbol"),fN=(e,t,n,r)=>{const o=(s,a)=>{const c=r.push(s)-1;return n.set(a,c),c},i=s=>{if(n.has(s))return n.get(s);let[a,c]=ar(s);switch(a){case Jo:{let d=s;switch(c){case"bigint":a=up,d=s.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return o([lp],s)}return o([a,d],s)}case pr:{if(c){let p=s;return c==="DataView"?p=new Uint8Array(s.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(s)),o([c,[...p]],s)}const d=[],h=o([a,d],s);for(const p of s)d.push(i(p));return h}case yo:{if(c)switch(c){case"BigInt":return o([c,s.toString()],s);case"Boolean":case"Number":case"String":return o([c,s.valueOf()],s)}if(t&&"toJSON"in s)return i(s.toJSON());const d=[],h=o([a,d],s);for(const p of dN(s))(e||!Vr(ar(s[p])))&&d.push([i(p),i(s[p])]);return h}case ga:return o([a,s.toISOString()],s);case xa:{const{source:d,flags:h}=s;return o([a,{source:d,flags:h}],s)}case ya:{const d=[],h=o([a,d],s);for(const[p,f]of s)(e||!(Vr(ar(p))||Vr(ar(f))))&&d.push([i(p),i(f)]);return h}case va:{const d=[],h=o([a,d],s);for(const p of s)(e||!Vr(ar(p)))&&d.push(i(p));return h}}const{message:u}=s;return o([a,{name:c,message:u}],s)};return i},dc=(e,{json:t,lossy:n}={})=>{const r=[];return fN(!(t||n),!!t,new Map,r)(e),r},vo=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?uc(dc(e,t)):structuredClone(e):(e,t)=>uc(dc(e,t));function hN(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 pN(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function mN(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||hN,r=e.options.footnoteBackLabel||pN,o=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",s=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=er(h.toLowerCase());let f=0;const x=[],m=e.footnoteCounts.get(h);for(;m!==void 0&&++f<=m;){x.length>0&&x.push({type:"text",value:" "});let b=typeof n=="string"?n:n(c,f);typeof b=="string"&&(b={type:"text",value:b}),x.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 y=d[d.length-1];if(y&&y.type==="element"&&y.tagName==="p"){const b=y.children[y.children.length-1];b&&b.type==="text"?b.value+=" ":y.children.push({type:"text",value:" "}),y.children.push(...x)}else d.push(...x);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(d,!0)};e.patch(u,g),a.push(g)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...vo(s),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
92
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
93
+ `}]}}const dp=(function(e){if(e==null)return vN;if(typeof e=="function")return Yo(e);if(typeof e=="object")return Array.isArray(e)?gN(e):xN(e);if(typeof e=="string")return yN(e);throw new Error("Expected function, string, or object as test")});function gN(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=dp(e[n]);return Yo(r);function r(...o){let i=-1;for(;++i<t.length;)if(t[i].apply(this,o))return!0;return!1}}function xN(e){const t=e;return Yo(n);function n(r){const o=r;let i;for(i in e)if(o[i]!==t[i])return!1;return!0}}function yN(e){return Yo(t);function t(n){return n&&n.type===e}}function Yo(e){return t;function t(n,r,o){return!!(bN(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function vN(){return!0}function bN(e){return e!==null&&typeof e=="object"&&"type"in e}const fp=[],wN=!0,fc=!1,kN="skip";function _N(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;const i=dp(o),s=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=fp,x,m,y;if((!t||i(c,u,d[d.length-1]||void 0))&&(f=SN(n(c,d)),f[0]===fc))return f;if("children"in c&&c.children){const g=c;if(g.children&&f[0]!==kN)for(m=(r?g.children.length:-1)+s,y=d.concat(g);m>-1&&m<g.children.length;){const b=g.children[m];if(x=a(b,m,y)(),x[0]===fc)return x;m=typeof x[1]=="number"?x[1]:m+s}}return f}}}function SN(e){return Array.isArray(e)?e:typeof e=="number"?[wN,e]:e==null?fp:[e]}function hp(e,t,n,r){let o,i,s;typeof t=="function"&&typeof n!="function"?(i=void 0,s=t,o=n):(i=t,s=n,o=r),_N(e,i,a,o);function a(c,u){const d=u[u.length-1],h=d?d.children.indexOf(c):void 0;return s(c,h,d)}}const ds={}.hasOwnProperty,CN={};function jN(e,t){const n=t||CN,r=new Map,o=new Map,i=new Map,s={...lN,...n.handlers},a={all:u,applyData:NN,definitionById:r,footnoteById:o,footnoteCounts:i,footnoteOrder:[],handlers:s,one:c,options:n,patch:EN,wrap:AN};return hp(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(ds.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,...y}=d,g=vo(y);return g.children=a.all(d),g}return vo(d)}return(a.options.unknownHandler||TN)(a,d,h)}function u(d){const h=[];if("children"in d){const p=d.children;let f=-1;for(;++f<p.length;){const x=a.one(p[f],d);if(x){if(f&&p[f-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=hc(x.value)),!Array.isArray(x)&&x.type==="element")){const m=x.children[0];m&&m.type==="text"&&(m.value=hc(m.value))}Array.isArray(x)?h.push(...x):h.push(x)}}}return h}}function EN(e,t){e.position&&(t.position=uC(e))}function NN(e,t){let n=t;if(e&&e.data){const r=e.data.hName,o=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const s="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:s}}n.type==="element"&&i&&Object.assign(n.properties,vo(i)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function TN(e,t){const n=t.data||{},r="value"in t&&!(ds.call(n,"hProperties")||ds.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 AN(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
94
+ `});++r<e.length;)r&&n.push({type:"text",value:`
95
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
96
+ `}),n}function hc(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function pc(e,t){const n=jN(e,t),r=n.one(e,void 0),o=mN(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&i.children.push({type:"text",value:`
97
+ `},o),i}function IN(e,t){return e&&"run"in e?async function(n,r){const o=pc(n,{file:r,...t});await e.run(o,r)}:function(n,r){return pc(n,{file:r,...e||t})}}function mc(e){if(e)throw e}var ji,gc;function zN(){if(gc)return ji;gc=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},i=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var d=e.call(u,"constructor"),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)},s=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 ji=function c(){var u,d,h,p,f,x,m=arguments[0],y=1,g=arguments.length,b=!1;for(typeof m=="boolean"&&(b=m,m=arguments[1]||{},y=2),(m==null||typeof m!="object"&&typeof m!="function")&&(m={});y<g;++y)if(u=arguments[y],u!=null)for(d in u)h=a(m,d),p=a(u,d),m!==p&&(b&&p&&(i(p)||(f=o(p)))?(f?(f=!1,x=h&&o(h)?h:[]):x=h&&i(h)?h:{},s(m,{name:d,newValue:c(b,x,p)})):typeof p<"u"&&s(m,{name:d,newValue:p}));return m},ji}var PN=zN();const Ei=bs(PN);function fs(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 RN(){const e=[],t={run:n,use:r};return t;function n(...o){let i=-1;const s=o.pop();if(typeof s!="function")throw new TypeError("Expected function as last argument, not "+s);a(null,...o);function a(c,...u){const d=e[++i];let h=-1;if(c){s(c);return}for(;++h<o.length;)(u[h]===null||u[h]===void 0)&&(u[h]=o[h]);o=u,d?ON(d,a)(...u):s(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 ON(e,t){let n;return r;function r(...s){const a=e.length>s.length;let c;a&&s.push(o);try{c=e.apply(this,s)}catch(u){const d=u;if(a&&n)throw d;return o(d)}a||(c&&c.then&&typeof c.then=="function"?c.then(i,o):c instanceof Error?o(c):i(c))}function o(s,...a){n||(n=!0,t(s,...a))}function i(s){o(null,s)}}const It={basename:DN,dirname:MN,extname:LN,join:FN,sep:"/"};function DN(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Nr(e);let n=0,r=-1,o=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else r<0&&(i=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let s=-1,a=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(i){n=o+1;break}}else s<0&&(i=!0,s=o+1),a>-1&&(e.codePointAt(o)===t.codePointAt(a--)?a<0&&(r=o):(a=-1,r=s));return n===r?r=s:r<0&&(r=e.length),e.slice(n,r)}function MN(e){if(Nr(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 LN(e){Nr(e);let t=e.length,n=-1,r=0,o=-1,i=0,s;for(;t--;){const a=e.codePointAt(t);if(a===47){if(s){r=t+1;break}continue}n<0&&(s=!0,n=t+1),a===46?o<0?o=t:i!==1&&(i=1):o>-1&&(i=-1)}return o<0||n<0||i===0||i===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function FN(...e){let t=-1,n;for(;++t<e.length;)Nr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":$N(n)}function $N(e){Nr(e);const t=e.codePointAt(0)===47;let n=BN(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function BN(e,t){let n="",r=0,o=-1,i=0,s=-1,a,c;for(;++s<=e.length;){if(s<e.length)a=e.codePointAt(s);else{if(a===47)break;a=47}if(a===47){if(!(o===s-1||i===1))if(o!==s-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),o=s,i=0;continue}}else if(n.length>0){n="",r=0,o=s,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,s):n=e.slice(o+1,s),r=s-o-1;o=s,i=0}else a===46&&i>-1?i++:i=-1}return n}function Nr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const UN={cwd:ZN};function ZN(){return"/"}function hs(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function VN(e){if(typeof e=="string")e=new URL(e);else if(!hs(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 WN(e)}function WN(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 Ni=["history","path","basename","stem","extname","dirname"];class pp{constructor(t){let n;t?hs(t)?n={path:t}:typeof t=="string"||HN(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":UN.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ni.length;){const i=Ni[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let o;for(o in n)Ni.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?It.basename(this.path):void 0}set basename(t){Ai(t,"basename"),Ti(t,"basename"),this.path=It.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?It.dirname(this.path):void 0}set dirname(t){xc(this.basename,"dirname"),this.path=It.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?It.extname(this.path):void 0}set extname(t){if(Ti(t,"extname"),xc(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=It.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){hs(t)&&(t=VN(t)),Ai(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?It.basename(this.path,this.extname):void 0}set stem(t){Ai(t,"stem"),Ti(t,"stem"),this.path=It.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 Ti(e,t){if(e&&e.includes(It.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+It.sep+"`")}function Ai(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function xc(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function HN(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const qN=(function(e){const r=this.constructor.prototype,o=r[e],i=function(){return o.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),KN={}.hasOwnProperty;class ba extends qN{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=RN()}copy(){const t=new ba;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Ei(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Pi("data",this.frozen),this.namespace[t]=n,this):KN.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Pi("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=Wr(t),r=this.parser||this.Parser;return Ii("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ii("process",this.parser||this.Parser),zi("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(i,s){const a=Wr(t),c=r.parse(a);r.run(c,a,function(d,h,p){if(d||!h||!p)return u(d);const f=h,x=r.stringify(f,p);YN(x)?p.value=x:p.result=x,u(d,p)});function u(d,h){d||!h?s(d):i?i(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),Ii("processSync",this.parser||this.Parser),zi("processSync",this.compiler||this.Compiler),this.process(t,o),vc("processSync","process",n),r;function o(i,s){n=!0,mc(i),r=s}}run(t,n,r){yc(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(s,a){const c=Wr(n);o.run(t,c,u);function u(d,h,p){const f=h||t;d?a(d):s?s(f):r(void 0,f,p)}}}runSync(t,n){let r=!1,o;return this.run(t,n,i),vc("runSync","run",r),o;function i(s,a){mc(s),o=a,r=!0}}stringify(t,n){this.freeze();const r=Wr(n),o=this.compiler||this.Compiler;return zi("stringify",o),yc(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(Pi("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):s(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...h]=u;c(d,h)}else s(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function s(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=Ei(!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];i(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,...x]=d;const m=r[p][1];fs(m)&&fs(f)&&(f=Ei(!0,m,f)),r[p]=[u,f,...x]}}}}const GN=new ba().freeze();function Ii(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function zi(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Pi(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 yc(e){if(!fs(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function vc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Wr(e){return JN(e)?e:new pp(e)}function JN(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function YN(e){return typeof e=="string"||XN(e)}function XN(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const QN="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",bc=[],wc={allowDangerousHtml:!0},e3=/^(https?|ircs?|mailto|xmpp)$/i,t3=[{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 Wn(e){const t=n3(e),n=r3(e);return o3(t.runSync(t.parse(n),n),e)}function n3(e){const t=e.rehypePlugins||bc,n=e.remarkPlugins||bc,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...wc}:wc;return GN().use(DE).use(n).use(IN,r).use(t)}function r3(e){const t=e.children||"",n=new pp;return typeof t=="string"&&(n.value=t),n}function o3(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,i=t.disallowedElements,s=t.skipHtml,a=t.unwrapDisallowed,c=t.urlTransform||i3;for(const d of t3)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+QN+d.id,void 0);return hp(e,u),mC(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 s?p.children.splice(h,1):p.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let f;for(f in _i)if(Object.hasOwn(_i,f)&&Object.hasOwn(d.properties,f)){const x=d.properties[f],m=_i[f];(m===null||m.includes(d.tagName))&&(d.properties[f]=c(String(x||""),f,d))}}if(d.type==="element"){let f=n?!n.includes(d.tagName):i?i.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 i3(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||e3.test(e.slice(0,t))?e:""}function mp(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 bo(e){return e!==null&&(Array.isArray(e)||typeof e=="object")}function s3(e,t){const n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0)return n.value}function wa(e){return Array.isArray(e)?e.map((t,n)=>[String(n),t]):typeof e=="object"&&e!==null?Object.keys(e).map(t=>{const n=s3(e,t);return[t,Hn(n)]}):[]}function kc(e){return Array.isArray(e)?e.length:typeof e=="object"&&e!==null?Object.keys(e).length:0}const _c=120;function a3({text:e}){const[t,n]=v.useState(!1);return e.length>_c?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(Wn,{children:e})}):l.jsxs(Ie,{delayDuration:300,children:[l.jsxs(ze,{onClick:o=>{o.stopPropagation(),n(!0)},className:"text-left cursor-pointer",children:[l.jsx("span",{children:e.slice(0,_c)}),l.jsx("span",{className:"text-emerald-400/50",children:"…"})]}),l.jsxs(Pe,{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(Wn,{children:e})}),'"']})}function gp({value:e}){if(e===null)return l.jsx("span",{className:"text-rose-400 italic",children:"null"});switch(typeof e){case"string":return l.jsx(a3,{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 Sc({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(on,{className:"size-3 text-green-500"}):l.jsx(yn,{className:"size-3"})})}function l3({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(on,{className:"size-3 text-green-500"}):l.jsx(yn,{className:"size-3 text-muted-foreground"})})}function c3(e){return bo(e)?wa(e).some(([,t])=>bo(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(zv,{className:"size-3.5 text-muted-foreground"}):l.jsx(Av,{className:"size-3.5 text-muted-foreground"})})}function xp({name:e,value:t,level:n,defaultExpandDepth:r,isArrayItem:o}){const[i,s]=v.useState(n<r),[a,c]=v.useState(0),[u,d]=v.useState(null),[h,p]=v.useState(!1),f=bo(t),x=mp(t),m=x==="array"?"[":"{",y=x==="array"?"]":"}";function g(k){k.stopPropagation(),h?(s(!1),d(0),c(S=>S+1),p(!1)):(s(!0),d(Number.POSITIVE_INFINITY),c(S=>S+1),p(!0))}const b=u??r;return l.jsxs("div",{className:he(n>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",f&&"cursor-pointer hover:bg-muted/50"),onClick:f?()=>{i&&p(!1),s(!i)}:void 0,onKeyDown:f?k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),s(!i))}:void 0,role:f?"button":void 0,tabIndex:f?0:void 0,children:[f?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(jt,{className:"size-3 text-muted-foreground"})}):l.jsx("span",{className:"w-4 shrink-0"}),l.jsx("span",{className:he("shrink-0",o?"text-muted-foreground":"text-cyan-400"),children:o?e:`"${e}"`}),l.jsx("span",{className:"text-muted-foreground shrink-0",children:f?"":":"}),f?l.jsxs("span",{className:"text-muted-foreground",children:[m,l.jsxs("span",{className:"text-muted-foreground/60 text-xs",children:[" ",kc(t)," ",kc(t)===1?"item":"items"," ",y]})]}):l.jsx("span",{className:"min-w-0",children:l.jsx(gp,{value:t})}),f&&c3(t)&&l.jsx(u3,{allExpanded:h,onClick:g}),l.jsx(l3,{value:t})]}),f&&i&&l.jsxs("div",{className:"pl-4",children:[wa(t).map(([k,S])=>l.jsx(xp,{name:k,value:S,level:n+1,defaultExpandDepth:b,isArrayItem:x==="array"},k)),l.jsx("div",{className:"text-muted-foreground py-0.5 px-1",children:y})]},a)]})}function Xo({data:e,defaultExpandDepth:t=2,className:n,showCopy:r=!1}){if(!bo(e))return l.jsx(Te,{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(gp,{value:e}),r&&l.jsx(Sc,{value:e})]})})});const s=mp(e)==="array";return l.jsx(Te,{children:l.jsxs("div",{className:he("font-mono text-xs leading-relaxed",n),children:[r&&l.jsx(Sc,{value:e}),wa(e).map(([a,c])=>l.jsx(xp,{name:a,value:c,level:0,defaultExpandDepth:t,isArrayItem:s},a))]})})}function un({text:e,defaultExpandDepth:t=2,className:n}){try{const r=JSON.parse(e);return l.jsx(Xo,{data:Hn(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 Hn(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=>Hn(n));const t={};for(const n of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,n);t[n]=Hn(r?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function In({className:e,orientation:t="horizontal",...n}){return l.jsx(Y_,{"data-slot":"tabs","data-orientation":t,orientation:t,className:he("group/tabs flex gap-2 data-[orientation=horizontal]:flex-col",e),...n})}const d3=sa("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 zn({className:e,variant:t="default",...n}){return l.jsx(X_,{"data-slot":"tabs-list","data-variant":t,className:he(d3({variant:t}),e),...n})}function et({className:e,...t}){return l.jsx(Q_,{"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 tt({className:e,...t}){return l.jsx(eS,{"data-slot":"tabs-content",className:he("flex-1 outline-none",e),...t})}class yp{diff(t,n,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);const i=this.castInput(t,r),s=this.castInput(n,r),a=this.removeEmpty(this.tokenize(i,r)),c=this.removeEmpty(this.tokenize(s,r));return this.diffWithOptionsObj(a,c,r,o)}diffWithOptionsObj(t,n,r,o){var i;const s=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=(i=r.timeout)!==null&&i!==void 0?i:1/0,p=Date.now()+h,f=[{oldPos:-1,lastComponent:void 0}];let x=this.extractCommon(f[0],n,t,0,r);if(f[0].oldPos+1>=c&&x+1>=a)return s(this.buildValues(f[0].lastComponent,n,t));let m=-1/0,y=1/0;const g=()=>{for(let b=Math.max(m,-u);b<=Math.min(y,u);b+=2){let k;const S=f[b-1],N=f[b+1];S&&(f[b-1]=void 0);let C=!1;if(N){const T=N.oldPos-b;C=N&&0<=T&&T<a}const E=S&&S.oldPos+1<c;if(!C&&!E){f[b]=void 0;continue}if(!E||C&&S.oldPos<N.oldPos?k=this.addToPath(N,!0,!1,0,r):k=this.addToPath(S,!1,!0,1,r),x=this.extractCommon(k,n,t,b,r),k.oldPos+1>=c&&x+1>=a)return s(this.buildValues(k.lastComponent,n,t))||!0;f[b]=k,k.oldPos+1>=c&&(y=Math.min(y,b-1)),x+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);g()||b()},0)})();else for(;u<=d&&Date.now()<=p;){const b=g();if(b)return b}}addToPath(t,n,r,o,i){const s=t.lastComponent;return s&&!i.oneChangePerToken&&s.added===n&&s.removed===r?{oldPos:t.oldPos+o,lastComponent:{count:s.count+1,added:n,removed:r,previousComponent:s.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:n,removed:r,previousComponent:s}}}extractCommon(t,n,r,o,i){const s=n.length,a=r.length;let c=t.oldPos,u=c-o,d=0;for(;u+1<s&&c+1<a&&this.equals(r[c+1],n[u+1],i);)u++,c++,d++,i.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!i.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const o=[];let i;for(;t;)o.push(t),i=t.previousComponent,delete t.previousComponent,t=i;o.reverse();const s=o.length;let a=0,c=0,u=0;for(;a<s;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 x=r[u+f];return x.length>p.length?x: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 f3 extends yp{constructor(){super(...arguments),this.tokenize=bp}equals(t,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!t.includes(`
98
+ `))&&(t=t.trim()),(!r.newlineIsToken||!n.includes(`
99
+ `))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(t.endsWith(`
100
+ `)&&(t=t.slice(0,-1)),n.endsWith(`
101
+ `)&&(n=n.slice(0,-1))),super.equals(t,n,r)}}const h3=new f3;function vp(e,t,n){return h3.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 i=r[o];o%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}class p3 extends yp{constructor(){super(...arguments),this.tokenize=bp}get useLongestToken(){return!0}castInput(t,n){const{undefinedReplacement:r,stringifyReplacer:o=(i,s)=>typeof s>"u"?r:s}=n;return typeof t=="string"?t:JSON.stringify(ps(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 m3=new p3;function g3(e,t,n){return m3.diff(e,t,n)}function ps(e,t,n,r,o){t=t||[],n=n||[],r&&(e=r(o===void 0?"":o,e));let i;for(i=0;i<t.length;i+=1)if(t[i]===e)return n[i];let s;if(Object.prototype.toString.call(e)==="[object Array]"){for(t.push(e),s=new Array(e.length),n.push(s),i=0;i<e.length;i+=1)s[i]=ps(e[i],t,n,r,String(i));return t.pop(),n.pop(),s}if(e&&e.toJSON&&(e=e.toJSON()),typeof e=="object"&&e!==null){t.push(e),s={},n.push(s);const a=[];let c;for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&a.push(c);for(a.sort(),i=0;i<a.length;i+=1)c=a[i],s[c]=ps(e[c],t,n,r,c);t.pop(),n.pop()}else s=e;return s}function Cc(e){return e===void 0?[]:Object.entries(e).map(t=>[t[0].toLowerCase(),t[1]]).sort(([t],[n])=>t.localeCompare(n))}function jc([e,t]){return`${e}: ${t}`}function ms(e){const t=[];let n=0,r=0;for(const o of e){const i=o.value.split(`
103
+ `);i.length>0&&i[i.length-1]===""&&i.pop();for(const s of i)o.added?(r+=1,t.push({kind:"added",text:s,oldLineNumber:null,newLineNumber:r})):o.removed?(n+=1,t.push({kind:"removed",text:s,oldLineNumber:n,newLineNumber:null})):(n+=1,r+=1,t.push({kind:"context",text:s,oldLineNumber:n,newLineNumber:r}))}return t}function x3(e,t){const n=Cc(e).map(jc).join(`
104
+ `),r=Cc(t).map(jc).join(`
105
+ `);if(n===r)return{lines:[],isEmpty:!0};const o=vp(n,r);return{lines:ms(o),isEmpty:!1}}function Ec(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=Ec(n),i=Ec(r);if(o!==null&&i!==null){const a=g3(o,i)??[];if(a.length===1){const c=a[0];if(c!==void 0&&!c.added&&!c.removed)return{lines:[],isEmpty:!0}}return{lines:ms(a),isEmpty:!1}}const s=vp(n,r);return{lines:ms(s),isEmpty:!1}}const v3=22,Ri=1e4;function b3(e){return e==="added"?"+":e==="removed"?"-":" "}function w3(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"}function Nc({result:e,emptyLabel:t}){const[n,r]=v.useState("unified"),o=v.useRef(null),i=$u({count:e.lines.length,getScrollElement:()=>o.current,estimateSize:()=>v3,overscan:10});if(e.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:t??"No transformation applied — raw and processed are identical."});const s=e.lines.length,a=s>Ri,c=a?e.lines.slice(0,Ri):e.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:[s.toLocaleString()," line",s===1?"":"s",a&&` (showing first ${Ri.toLocaleString()})`]}),l.jsxs("div",{className:"inline-flex rounded-md border border-border overflow-hidden",children:[l.jsxs("button",{type:"button",onClick:()=>r("unified"),"aria-pressed":n==="unified",className:he("flex items-center gap-1 px-2 py-1 transition-colors",n==="unified"?"bg-muted text-foreground":"hover:bg-muted/50"),title:"Unified diff (single column)",children:[l.jsx(Gu,{className:"size-3"}),"Unified"]}),l.jsxs("button",{type:"button",onClick:()=>r("split"),"aria-pressed":n==="split",className:he("flex items-center gap-1 px-2 py-1 transition-colors border-l border-border",n==="split"?"bg-muted text-foreground":"hover:bg-muted/50"),title:"Split diff (side by side)",children:[l.jsx(Zu,{className:"size-3"}),"Split"]})]})]}),l.jsx("div",{ref:o,className:"max-h-[60vh] overflow-auto rounded border border-border bg-background font-mono text-xs","data-testid":"diff-viewport",children:n==="unified"?l.jsx(k3,{virtualizer:i,lines:c}):l.jsx(C3,{lines:c})})]})}function k3({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",w3(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:b3(r.kind)}),l.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:r.text})]},n.key)})})}function _3(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if(r===void 0)break;if(r.kind==="context"){t.push({left:{text:r.text,lineNumber:r.oldLineNumber},right:{text:r.text,lineNumber:r.newLineNumber},kind:"equal"}),n+=1;continue}const o=[],i=[];for(;n<e.length&&e[n]?.kind==="removed";){const 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&&i.push(a),n+=1}const s=Math.max(o.length,i.length);for(let a=0;a<s;a+=1){const c=o[a],u=i[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 S3(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 C3({lines:e}){const t=_3(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",S3(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 j3="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",E3="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",N3="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",T3="/assets/minimax-BPMzvuL-.jpeg",A3="/assets/alibaba-TTwafVwX.svg",I3="/assets/qwen-CONDcHqt.png",z3="/assets/zhipuai-BPNAnxo-.svg",P3={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen","glm-":"zhipuai"};function R3(e){if(e===null)return"unknown";const t=e.toLowerCase();for(const[n,r]of Object.entries(P3))if(t.startsWith(n.toLowerCase()))return r;return"unknown"}const bn={width:24,height:24,objectFit:"contain"},O3=at.memo(({className:e})=>l.jsx("img",{src:j3,alt:"Anthropic",className:e,style:bn})),D3=at.memo(({className:e})=>l.jsx("img",{src:E3,alt:"OpenAI",className:e,style:{...bn,background:"white",borderRadius:"4px"}})),M3=at.memo(({className:e})=>l.jsx("img",{src:N3,alt:"DeepSeek",className:e,style:bn})),L3=at.memo(({className:e})=>l.jsx("img",{src:T3,alt:"MiniMax",className:e,style:bn})),F3=at.memo(({className:e})=>l.jsx("img",{src:A3,alt:"Alibaba",className:e,style:bn})),$3=at.memo(({className:e})=>l.jsx("img",{src:I3,alt:"Qwen",className:e,style:bn})),B3=at.memo(({className:e})=>l.jsx("img",{src:z3,alt:"ZhipuAI",className:e,style:bn}));function U3({provider:e,className:t}){switch(e){case"anthropic":return l.jsx(O3,{className:t});case"openai":return l.jsx(D3,{className:t});case"deepseek":return l.jsx(M3,{className:t});case"minimax":return l.jsx(L3,{className:t});case"alibaba":return l.jsx(F3,{className:t});case"qwen":return l.jsx($3,{className:t});case"zhipuai":return l.jsx(B3,{className:t});case"unknown":return null}}function Z3(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const Tc={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 Ac({trend:e}){if(e===null)return null;const t=e.direction==="up",n=t?wv:vv,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,Ye(e.delta)]})]})}const V3=v.memo(function({log:e,messageCount:t=null,toolCount:n=null,expanded:r,onToggle:o,responseToolNames:i=null,cacheTrend:s=null}){const a=fd(e.responseStatus),c=e.inputTokens!==null||e.outputTokens!==null;return l.jsxs("div",{role:"button",tabIndex:0,className:he("flex items-center gap-2.5 px-3 py-2 cursor-pointer transition-colors","hover:bg-muted/50","select-none"),onClick:o,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.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.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsx("span",{className:"shrink-0",children:l.jsx(U3,{provider:R3(e.model),className:"size-4"})})}),l.jsx(Pe,{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-5 font-mono tabular-nums",children:e.responseStatus}):a==="pending"?l.jsx(xt,{variant:"outline",className:he("text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums",Tc[a]),children:l.jsx(yr,{className:"size-3 animate-spin"})}):l.jsx(xt,{variant:"outline",className:he("text-[10px] px-1.5 py-0 h-5 font-mono tabular-nums",Tc[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(To,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:Z3(e.elapsedMs)})]}),c&&l.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[l.jsx(_r,{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?Ye(e.inputTokens):"—"]})," / ",l.jsxs("span",{className:e.outputTokens!==null?"text-amber-400":"text-muted-foreground",children:["OUT ",e.outputTokens!==null?Ye(e.outputTokens):"—"]})]})]}),e.cacheCreationInputTokens!==null&&e.cacheCreationInputTokens>0&&l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[l.jsx(Ac,{trend:s?.creation??null}),l.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",Ye(e.cacheCreationInputTokens)]})]})}),l.jsx(Pe,{children:"Tokens cached for reuse, reducing future API cost"})]})}),e.cacheReadInputTokens!==null&&e.cacheReadInputTokens>0&&l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[l.jsx(Ac,{trend:s?.read??null}),l.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",Ye(e.cacheReadInputTokens)]})]})}),l.jsx(Pe,{children:"Tokens served from cache, reducing API cost"})]})}),t!==null&&l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(Hu,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:t})]})}),l.jsx(Pe,{children:"Number of messages in the conversation"})]})}),n!==null&&l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(el,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:n})]})}),l.jsx(Pe,{children:"Number of tools defined in the request"})]})}),i!==null&&i.length>0&&l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsxs("span",{className:"flex items-center gap-1 text-amber-400/80 text-xs shrink-0",children:[l.jsx(el,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums truncate max-w-[160px]",children:i.join(", ")})]})}),l.jsxs(Pe,{children:["Tools called by model: ",i.join(", ")]})]})}),e.origin!==null&&l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:`Origin: ${e.origin}`,children:[l.jsx(nb,{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.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsxs("span",{className:"flex items-center gap-1 text-purple-400/80 text-xs shrink-0",children:[l.jsx(Jv,{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(Pe,{children:e.clientCwd!==null?`PID: ${e.clientPid??"?"} CWD: ${e.clientCwd}`:`Process ID: ${e.clientPid??"?"}`})]})}),e.streaming&&l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsx(pb,{className:"size-3 text-muted-foreground/60 shrink-0"})}),l.jsx(Pe,{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(jt,{className:"size-4 text-muted-foreground shrink-0"})]})});function Qo({...e}){return l.jsx(u2,{"data-slot":"dialog",...e})}function W3({...e}){return l.jsx(d2,{"data-slot":"dialog-trigger",...e})}function H3({...e}){return l.jsx(f2,{"data-slot":"dialog-portal",...e})}function q3({className:e,...t}){return l.jsx(h2,{"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 ei({className:e,children:t,...n}){return l.jsxs(H3,{children:[l.jsx(q3,{}),l.jsxs(p2,{"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(g2,{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(Yu,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function ti({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 ni({className:e,...t}){return l.jsx(m2,{"data-slot":"dialog-title",className:he("text-lg font-semibold leading-none tracking-tight",e),...t})}function wp({className:e,orientation:t="horizontal",decorative:n=!0,...r}){return l.jsx(K_,{"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 ri({...e}){return l.jsx(Y1,{"data-slot":"collapsible",...e})}function oi({...e}){return l.jsx(bd,{"data-slot":"collapsible-trigger",...e})}function ii({...e}){return l.jsx(wd,{"data-slot":"collapsible-content",...e})}function ka({className:e,children:t,...n}){return l.jsxs(a_,{"data-slot":"scroll-area",className:he("relative",e),...n,children:[l.jsx(l_,{"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(K3,{}),l.jsx(c_,{})]})}function K3({className:e,orientation:t="vertical",...n}){return l.jsx(zf,{"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(Df,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}function G3(e){return l.jsx(l.Fragment,{})}function J3({text:e}){const[t,n]=v.useState(!1);return l.jsxs(ri,{open:t,onOpenChange:n,children:[l.jsxs(oi,{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(jt,{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(ii,{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(Wn,{children:e})})})})]})}const Y3=/<think>([\s\S]*?)<\/think>/gi,X3=/<think>([\s\S]*?)<\/think>/i;function kp(e){const t=X3.exec(e);if(!t||t[1]===void 0)return{thinking:null,remainingText:e};const n=t[1].trim(),r=e.replace(Y3,"").trim();return{thinking:n,remainingText:r}}function Q3({text:e}){if(e.includes("<system-reminder>"))return l.jsx(J3,{text:e});const{thinking:t,remainingText:n}=kp(e);return l.jsxs("div",{className:"space-y-2",children:[t!==null&&l.jsx(wo,{thinking:t}),n.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(Wn,{children:n})}),t===null&&n.length===0&&l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty text block"})]})}function wo({thinking:e}){const[t,n]=v.useState(!1);return l.jsx(ri,{open:t,onOpenChange:n,children:l.jsxs("div",{className:"border-l-2 border-purple-500/40 my-1",children:[l.jsxs(oi,{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(_v,{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:[e.length.toLocaleString()," chars"]}),l.jsx("span",{className:"flex-1"}),t?l.jsx(vt,{className:"size-3 text-muted-foreground"}):l.jsx(jt,{className:"size-3 text-muted-foreground"})]}),l.jsx(ii,{children:l.jsx("div",{className:"px-3 pb-2",children:l.jsx(ka,{className:"max-h-[60vh]",children:l.jsx("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap font-mono leading-relaxed",children:e})})})})]})})}function e5({name:e,input:t}){const[n,r]=v.useState(!1);return l.jsx(ri,{open:n,onOpenChange:r,children:l.jsxs("div",{className:"border-l-2 border-blue-500/40 my-1",children:[l.jsxs(oi,{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(Ju,{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:e}),l.jsx("span",{className:"flex-1"}),n?l.jsx(vt,{className:"size-3 text-muted-foreground"}):l.jsx(jt,{className:"size-3 text-muted-foreground"})]}),l.jsx(ii,{children:l.jsx("div",{className:"px-3 pb-2",children:l.jsx(ka,{className:"max-h-[60vh]",children:l.jsx(Xo,{data:Hn(t),defaultExpandDepth:2})})})})]})})}function t5({block:e}){switch(e.type){case"text":return l.jsx(Q3,{text:e.text});case"thinking":case"think":return l.jsx(wo,{thinking:e.thinking});case"tool_use":return l.jsx(e5,{name:e.name,input:e.input});default:return G3()}}function n5({response:e}){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:e.model}),e.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(Uu,{className:"size-2.5"}),e.stop_reason]}),l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[l.jsx(_r,{className:"size-3"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[Ye(e.usage.input_tokens??0)," in /"," ",Ye(e.usage.output_tokens??0)," out"]}),e.usage.cache_creation_input_tokens!==void 0&&e.usage.cache_creation_input_tokens!==null&&e.usage.cache_creation_input_tokens>0&&l.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",Ye(e.usage.cache_creation_input_tokens)]}),e.usage.cache_read_input_tokens!==void 0&&e.usage.cache_read_input_tokens!==null&&e.usage.cache_read_input_tokens>0&&l.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",Ye(e.usage.cache_read_input_tokens)]})]})]}),l.jsx(wp,{className:"opacity-50"}),l.jsxs("div",{className:"space-y-2",children:[e.content.map((t,n)=>l.jsx(t5,{block:t},n)),e.content.length===0&&l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty response content"})]})]})}function r5(e){if(e===void 0||e==="")return{};try{return JSON.parse(e)}catch{return null}}function o5({call:e}){const[t,n]=v.useState(!1),r=e.function.name??"(unnamed tool)",o=r5(e.function.arguments);return l.jsx(ri,{open:t,onOpenChange:n,children:l.jsxs("div",{className:"border-l-2 border-blue-500/40 my-1",children:[l.jsxs(oi,{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(Ju,{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(jt,{className:"size-3 text-muted-foreground"})]}),l.jsx(ii,{children:l.jsx("div",{className:"px-3 pb-2",children:l.jsx(ka,{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(Xo,{data:Hn(o),defaultExpandDepth:2})})})})]})})}function i5({response:e}){const t=e.choices[0],n=t?.message,r=n?.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:e.model}),t?.finish_reason!==null&&t?.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(Uu,{className:"size-2.5"}),t.finish_reason]}),l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[l.jsx(_r,{className:"size-3"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[Ye(e.usage.prompt_tokens??0)," in /"," ",Ye(e.usage.completion_tokens??0)," out"]})]})]}),l.jsx(wp,{className:"opacity-50"}),l.jsxs("div",{className:"space-y-2",children:[n?.reasoning_content!==null&&n?.reasoning_content!==void 0&&n.reasoning_content.length>0&&l.jsx(wo,{thinking:n.reasoning_content}),n?.content!==null&&n?.content!==void 0&&n.content.length>0&&(()=>{const o=n.reasoning_content!==null&&n.reasoning_content!==void 0&&n.reasoning_content.length>0,{thinking:i,remainingText:s}=kp(n.content);return l.jsxs("div",{className:"space-y-2",children:[i!==null&&!o&&l.jsx(wo,{thinking:i}),s.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(Wn,{children:s})})]})})(),r.map((o,i)=>l.jsx(o5,{call:o},o.id??`tc-${i}`)),n?.function_call!==null&&n?.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:n.function_call.name}),l.jsxs("span",{className:"text-muted-foreground",children:["(",n.function_call.arguments,")"]})]})]}),(n?.content===null||n?.content===void 0||n.content.length===0)&&(n?.reasoning_content===null||n?.reasoning_content===void 0||n.reasoning_content.length===0)&&(n?.function_call===null||n?.function_call===void 0)&&r.length===0&&l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty response content"})]})]})}function s5(e){return typeof e!="object"||e===null?!1:Object.getOwnPropertyDescriptor(e,"object")?.value==="chat.completion"}function a5(e,t){return s5(t)?l.jsx(i5,{response:t}):l.jsx(n5,{response:t})}function l5(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 c5(e,t){try{let n=JSON.parse(e);if(typeof n=="string"&&(n=JSON.parse(n)),t==="openai"){const o=Ou(e);if(o)return o}const r=Iu.safeParse(n);return r.success?r.data:null}catch{return null}}function lr({status:e}){const t=fd(e),n=l5(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(Nb,{className:"size-3"}),e]})}function Ic({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 u5({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(Wn,{children:e})})}function Qr({responseText:e,responseStatus:t,streaming:n,inputTokens:r,outputTokens:o,cacheCreationInputTokens:i,cacheReadInputTokens:s,apiFormat:a,error:c}){if(e===null&&c===void 0)return l.jsxs("div",{className:"flex items-center gap-2 py-3",children:[l.jsx(lr,{status:t}),l.jsx("span",{className:"text-xs text-muted-foreground italic",children:"No response"})]});if(t!==null&&t>=400)return l.jsxs("div",{className:"space-y-2",children:[l.jsx(lr,{status:t}),l.jsx(Ic,{text:e??""}),c!=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:c})]})]});if(c!=null)return l.jsxs("div",{className:"space-y-2",children:[l.jsx(lr,{status:t}),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:c})]}),e!==null&&l.jsx("div",{className:"mt-2",children:l.jsx(Ic,{text:e})})]});const d=e!==null?c5(e,a):null;return d!==null?l.jsxs("div",{className:"space-y-2",children:[l.jsx(lr,{status:t}),a5(a,d)]}):l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(lr,{status:t}),n&&(r!==null||o!==null)&&l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[l.jsx(_r,{className:"size-3"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[r!==null?Ye(r):"—"," in /"," ",o!==null?Ye(o):"—"," out"]}),i!=null&&i>0&&l.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",Ye(i)]}),s!=null&&s>0&&l.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",Ye(s)]})]})]}),l.jsx(u5,{text:e??""})]})}const d5=ae({success:nt(),error:K().optional(),responseStatus:ve().optional(),responseText:K().optional(),inputTokens:ve().optional(),outputTokens:ve().optional(),elapsedMs:ve().optional(),streaming:nt().optional()});function f5({log:e,open:t,onOpenChange:n}){const[r,o]=v.useState(()=>e.rawRequestBody??"{}"),[i,s]=v.useState(null),[a,c]=v.useState(!1),[u,d]=v.useState(null);async function h(){c(!0),d(null),s(null);try{const x=await(await fetch(`/api/logs/${e.id}/replay`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({modifiedBody:r})})).json(),m=d5.safeParse(x);if(!m.success){d("Invalid response from server"),c(!1);return}const y=m.data;s(y),y.success||d(y.error??"Replay failed")}catch(f){d(f instanceof Error?f.message:"Network error")}finally{c(!1)}}function p(){s(null),d(null),n(!1)}return l.jsx(Qo,{open:t,onOpenChange:p,children:l.jsxs(ei,{className:"max-w-4xl max-h-[85vh] overflow-auto",children:[l.jsx(ti,{children:l.jsxs(ni,{className:"flex items-center gap-2",children:[l.jsx(qu,{className:"size-4"}),"Replay Request #",e.id]})}),l.jsxs(In,{defaultValue:"modified",children:[l.jsxs(zn,{children:[l.jsx(et,{value:"modified",children:"Modified Request"}),l.jsx(et,{value:"original",children:"Original Response"}),i&&l.jsx(et,{value:"replay",children:"Replay Response"})]}),l.jsxs(tt,{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(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{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(Pe,{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"})}),i&&i.success&&l.jsxs(In,{defaultValue:"parsed",children:[l.jsxs(zn,{children:[l.jsx(et,{value:"parsed",children:"Response"}),l.jsx(et,{value:"raw",children:"Raw Response"})]}),l.jsx(tt,{value:"parsed",children:l.jsx(Qr,{responseText:i.responseText??null,responseStatus:i.responseStatus??null,streaming:i.streaming??!1,inputTokens:i.inputTokens??null,outputTokens:i.outputTokens??null,apiFormat:e.apiFormat})}),l.jsx(tt,{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:i.responseText??"No response"})})]})]}),l.jsx(tt,{value:"original",children:e.responseText!==null?l.jsxs(In,{defaultValue:"parsed",children:[l.jsxs(zn,{children:[l.jsx(et,{value:"parsed",children:"Response"}),l.jsx(et,{value:"raw",children:"Raw Response"})]}),l.jsx(tt,{value:"parsed",children:l.jsx(Qr,{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(tt,{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"})}),i&&i.success&&l.jsx(tt,{value:"replay",children:i.responseText!==null?l.jsxs(In,{defaultValue:"parsed",children:[l.jsxs(zn,{children:[l.jsx(et,{value:"parsed",children:"Response"}),l.jsx(et,{value:"raw",children:"Raw Response"})]}),l.jsx(tt,{value:"parsed",children:l.jsx(Qr,{responseText:i.responseText??null,responseStatus:i.responseStatus??null,streaming:i.streaming??!1,inputTokens:i.inputTokens??null,outputTokens:i.outputTokens??null,apiFormat:e.apiFormat})}),l.jsx(tt,{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:i.responseText})})]}):l.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No replay response"})})]})]})})}function h5({logId:e,truncated:t}){const[n,r]=v.useState(!1),[o,i]=v.useState({status:"idle"}),[s,a]=v.useState(new Set);v.useEffect(()=>{if(!n||o.status!=="idle")return;let h=!1;return i({status:"loading"}),fetch(`/api/logs/${e}/chunks`).then(p=>p.ok?p.json():Promise.reject(new Error("Chunks not found"))).then(p=>{h||i({status:"success",chunks:p.chunks})}).catch(()=>{h||i({status:"error",message:"Chunk data unavailable"})}),()=>{h=!0}},[n,e]);const c=v.useMemo(()=>{if(o.status!=="success")return[];const h=new Map;for(const p of o.chunks){const f=h.get(p.index);f?f.push(p):h.set(p.index,[p])}return Array.from(h.entries()).map(([p,f])=>({index:p,chunks:f})).sort((p,f)=>p.index-f.index)},[o]),u=h=>{a(p=>{const f=new Set(p);return f.has(h)?f.delete(h):f.add(h),f})};function d(){return o.status==="idle"||o.status==="loading"?l.jsxs("div",{className:"flex items-center gap-2 py-2 text-xs text-muted-foreground",children:[l.jsx(yr,{className:"size-3 animate-spin"}),l.jsx("span",{children:"Loading chunks..."})]}):o.status==="error"?l.jsx("div",{className:"py-2 text-xs text-muted-foreground italic",children:o.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:[c.length," index group",c.length!==1?"s":""," available"]}),c.map(h=>{const p=s.has(h.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:()=>u(h.index),children:[p?l.jsx(vt,{className:"size-3 text-muted-foreground"}):l.jsx(jt,{className:"size-3 text-muted-foreground"}),l.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:["[",h.index,"] ",h.chunks[0]?.type??""]}),l.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:[h.chunks.length," chunk",h.chunks.length!==1?"s":""]})]}),p&&l.jsx("div",{className:"px-2 pb-2 space-y-1",children:h.chunks.map(f=>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:["+",f.timestamp,"ms"]}),l.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:f.type})]}),l.jsx(Xo,{data:f,defaultExpandDepth:1,showCopy:!0})]},f.index))})]},h.index)})]})}return l.jsxs("div",{className:"space-y-1",children:[l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{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:()=>r(h=>!h),children:[n?l.jsx(vt,{className:"size-3"}):l.jsx(jt,{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:[e,t===!0?"+":""]})]})}),l.jsx(Pe,{children:"Server-Sent Events streaming chunks from the provider"})]})}),n===!0?l.jsx("div",{className:"rounded-md border border-border bg-muted/20 overflow-auto max-h-64",children:d()}):null]})}function zc(e,t,n){return e==="anthropic"&&t==="full"&&n}function p5(e,t){return e==="full"&&t}function m5(e,t,n,r){return e==="anthropic"&&t==="full"&&n&&r}function Oi({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(on,{className:"size-3 text-green-500"}),l.jsx("span",{className:"text-green-500",children:"Copied!"})]}):l.jsxs(l.Fragment,{children:[l.jsx(yn,{className:"size-3"}),l.jsx("span",{children:t})]})})}function Pc({active:e,onClick:t}){return l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{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(Wu,{className:"size-3"}),e?"Showing diff":"Diff with Raw"]})}),l.jsx(Pe,{children:e?"Hide diff view":"Compare proxy output against the original raw version"})]})})}const ko=v.memo(function({log:e,viewMode:t="simple",strip:n,cacheTrend:r=null,onCompareWithPrevious:o}){const[i,s]=v.useState(!1),[a,c]=v.useState(!1),[u,d]=v.useState(!1),[h,p]=v.useState(!1),[f,x]=v.useState(!1),[m,y]=v.useState(!1),[g,b]=v.useState(!1),k=v.useMemo(()=>{if(e.rawRequestBody===null)return null;if(e.apiFormat==="anthropic"){const D=oo(e.rawRequestBody);if(D!==null)return D.messages.length}else if(e.apiFormat==="openai")try{const D=Ha.safeParse(JSON.parse(e.rawRequestBody));if(D.success)return D.data.messages.length}catch{}return null},[e.rawRequestBody,e.apiFormat]),S=v.useMemo(()=>{if(e.rawRequestBody===null)return null;if(e.apiFormat==="anthropic"){const D=oo(e.rawRequestBody);if(D!==null&&D.tools!==void 0&&D.tools.length>0)return D.tools.length}else if(e.apiFormat==="openai")try{const D=Ha.safeParse(JSON.parse(e.rawRequestBody));if(D.success&&D.data.tools!==void 0&&D.data.tools.length>0)return D.data.tools.length}catch{}return null},[e.rawRequestBody,e.apiFormat]),N=v.useMemo(()=>{if(e.responseText===null)return null;if(e.apiFormat==="openai"){const D=Ou(e.responseText);if(D!==null){const w=D.choices[0]?.message?.tool_calls;if(w!=null&&w.length>0)return w.map(P=>P.function?.name??"?").filter(P=>P!=="")}}else if(e.apiFormat==="anthropic")try{const D=Iu.safeParse(JSON.parse(e.responseText));if(D.success){const w=D.data.content.filter(P=>P.type==="tool_use").map(P=>P.name);if(w.length>0)return w}}catch{}return null},[e.responseText,e.apiFormat]),E=v.useMemo(()=>!n||e.apiFormat!=="anthropic"||e.rawRequestBody===null?null:FS(e.rawRequestBody).body,[e.rawRequestBody,e.apiFormat,n])??e.rawRequestBody,T=v.useMemo(()=>x3(e.rawHeaders,e.headers),[e.rawHeaders,e.headers]),R=v.useMemo(()=>y3(e.rawRequestBody,E),[e.rawRequestBody,E]);function M(D){D.stopPropagation(),E!==null&&window.navigator.clipboard.writeText(E).then(()=>{c(!0),setTimeout(()=>c(!1),2e3)})}function L(D){D.stopPropagation(),e.rawRequestBody!==null&&window.navigator.clipboard.writeText(e.rawRequestBody).then(()=>{d(!0),setTimeout(()=>d(!1),2e3)})}function j(D){D.stopPropagation(),e.responseText!==null&&window.navigator.clipboard.writeText(e.responseText).then(()=>{p(!0),setTimeout(()=>p(!1),2e3)})}return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"border border-border rounded-lg mb-3 overflow-hidden",children:[l.jsx(V3,{log:e,messageCount:k,toolCount:S,expanded:i,onToggle:()=>s(!i),responseToolNames:N,cacheTrend:r}),i&&l.jsx("div",{onClick:D=>D.stopPropagation(),onKeyDown:D=>D.stopPropagation(),children:l.jsxs(In,{defaultValue:"request",children:[l.jsxs(zn,{className:"mx-4 mt-2",children:[t==="full"&&l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsx(et,{value:"raw-headers",children:"Raw Headers"})}),l.jsx(Pe,{children:"HTTP headers received from the upstream provider"})]})}),t==="full"&&l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsx(et,{value:"headers",children:"Headers"})}),l.jsx(Pe,{children:"Request and response headers sent and received"})]})}),zc(e.apiFormat,t,n)&&l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsx(et,{value:"raw-request",children:"Raw Request"})}),l.jsx(Pe,{children:"Exact HTTP request sent to the upstream provider"})]})}),l.jsx(et,{value:"request",children:"Request"}),t==="full"&&l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsx(et,{value:"raw",children:"Raw Response"})}),l.jsx(Pe,{children:"Exact HTTP response from the upstream provider"})]})}),l.jsx(et,{value:"parsed",children:"Response"})]}),zc(e.apiFormat,t,n)&&l.jsx(tt,{value:"raw-request",children:l.jsxs("div",{className:"px-4 py-3",children:[l.jsx("div",{className:"flex justify-end mb-2",children:l.jsx(Oi,{text:e.rawRequestBody,label:"Copy Raw Request",copied:u,onCopy:L})}),e.rawRequestBody!==null?l.jsx(un,{text:e.rawRequestBody,defaultExpandDepth:1}):l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"})]})}),l.jsx(tt,{value:"request",children:l.jsxs("div",{className:"px-4 py-3",children:[l.jsxs("div",{className:"flex justify-end gap-2 mb-2",children:[m5(e.apiFormat,t,n,e.rawRequestBody!==null)&&l.jsx(Pc,{active:g,onClick:D=>{D.stopPropagation(),b(!g)}}),o!==void 0&&l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsxs(Xe,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:D=>{D.stopPropagation(),o()},children:[l.jsx(Wu,{className:"size-3 mr-1"}),"Diff with Previous"]})}),l.jsx(Pe,{children:"Compare this request with the immediately preceding one"})]})}),l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsxs(Xe,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:D=>{D.stopPropagation(),x(!0)},children:[l.jsx(qu,{className:"size-3 mr-1"}),"Replay"]})}),l.jsx(Pe,{children:"Re-send this request to the provider"})]})}),l.jsx(Oi,{text:E,label:"Copy Request",copied:a,onCopy:M})]}),g?l.jsx(Nc,{result:R,emptyLabel:"No transformation applied — raw and sent request bodies are identical."}):E!==null?l.jsx(un,{text:E,defaultExpandDepth:1}):l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"})]})}),t==="full"&&l.jsx(tt,{value:"headers",children:l.jsxs("div",{className:"px-4 py-3",children:[l.jsx("div",{className:"flex justify-end gap-2 mb-2",children:p5(t,e.rawHeaders!==void 0&&Object.keys(e.rawHeaders).length>0)&&l.jsx(Pc,{active:m,onClick:D=>{D.stopPropagation(),y(!m)}})}),m?l.jsx(Nc,{result:T,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(([D],[w])=>D.localeCompare(w)).map(([D,w])=>l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[D,":"]}),l.jsx("span",{className:"text-muted-foreground truncate",title:w,children:w})]},D))}):l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No headers captured"})]})}),t==="full"&&l.jsx(tt,{value:"raw-headers",children: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(([D],[w])=>D.localeCompare(w)).map(([D,w])=>l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[D,":"]}),l.jsx("span",{className:"text-muted-foreground truncate",title:w,children:w})]},D))}):l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No raw headers captured"})})}),l.jsx(tt,{value:"raw",children: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(Oi,{text:e.responseText,label:"Copy Response",copied:h,onCopy:j})}),e.responseText!==null?l.jsx(un,{text:e.responseText,defaultExpandDepth:1}):l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No response"}),e.streaming===!0&&l.jsx(h5,{logId:e.id,truncated:e.streamingChunksPath!==null})]})}),l.jsx(tt,{value:"parsed",children:l.jsx("div",{className:"px-4 py-3",children:l.jsx(Qr,{responseText:e.responseText,responseStatus:e.responseStatus,streaming:e.streaming,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens,cacheReadInputTokens:e.cacheReadInputTokens,apiFormat:e.apiFormat,error:e.error})})})]})})]}),l.jsx(f5,{log:e,open:f,onOpenChange:x})]})});function _p({stopReason:e,isPending:t,isFirst:n,isLast:r,isTurnStart:o}){const i=e==="end_turn"||e==="stop",s=e==="tool_use";return l.jsxs("div",{className:"flex flex-col items-center w-6 shrink-0",children:[l.jsx("div",{className:"flex justify-center h-4",children:!n&&l.jsx("div",{className:"w-0.5 bg-muted-foreground/30"})}),l.jsx("div",{className:"flex items-center justify-center py-0.5",children:i?l.jsx("div",{className:he("size-2.5 rounded-full border-2","bg-background border-amber-400","shadow-[0_0_6px_rgba(251,191,36,0.4)]"),title:e==="end_turn"?"End of Turn (Anthropic)":"End of Turn (OpenAI)"}):s?l.jsx("div",{className:he("size-2 rounded-full",o?"bg-emerald-400 shadow-[0_0_6px_rgba(52,211,153,0.5)]":"bg-muted-foreground/25"),title:o?"Tool Use — start of turn":"Tool Use — turn continues"}):t?l.jsx("div",{className:"size-2.5 rounded-full border-2 border-dashed border-muted-foreground/30 animate-pulse",title:"Response pending"}):l.jsx("div",{className:he("size-1.5 rounded-full",o?"bg-emerald-400 shadow-[0_0_6px_rgba(52,211,153,0.5)]":"bg-muted-foreground/30")})}),l.jsx("div",{className:"flex-1 flex justify-center min-h-1",children:i?l.jsx("div",{className:"w-0.5 bg-muted-foreground/10 h-4"}):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 g5(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 x5=v.memo(function({group:e,viewMode:t="simple",strip:n,cacheTrends:r,onCompareWithPrevious:o,defaultGroupViewMode:i="thread"}){const[s,a]=v.useState(!1),[c,u]=v.useState(i);v.useEffect(()=>{u(i)},[i]);const d=g5(e.logs),h=e.logs[0]?.timestamp??new Date().toISOString(),p=e.logs[e.logs.length-1]?.timestamp??new Date().toISOString(),f=PS(e.logs),x=e.logs.some(b=>b.responseStatus===null),m=v.useMemo(()=>e.logs.map(b=>Ph(b)),[e.logs]),y=v.useMemo(()=>{const b=[];let k=0;for(let S=0;S<m.length;S++)S>0&&(m[S-1]==="end_turn"||m[S-1]==="stop")&&k++,b.push(k);return b},[m]),g=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-4",children:[l.jsx(IS,{conversationId:g,startTime:h,endTime:p,totalCalls:e.logs.length,totalInputTokens:d.totalInputTokens,totalOutputTokens:d.totalOutputTokens,apiFormat:zS(e.logs),expanded:s,onToggle:()=>a(!s),hideApiFormat:f,isLoading:x,userAgent:e.logs[0]?.userAgent??null,viewMode:c,onToggleViewMode:()=>u(b=>b==="thread"?"flat":"thread")}),s&&c==="flat"&&l.jsx("div",{className:"pl-4 border-l-2 border-muted ml-3",children:e.logs.map(b=>l.jsx(ko,{log:b,viewMode:t,strip:n,cacheTrend:r?.get(b.id)??null,onCompareWithPrevious:()=>o(b)},b.id))}),s&&c==="thread"&&l.jsx("div",{className:"ml-3",children:e.logs.map((b,k)=>{const S=k===0||m[k-1]==="end_turn"||m[k-1]==="stop";return l.jsxs("div",{className:"flex items-stretch",children:[l.jsx(_p,{stopReason:m[k]??null,isPending:b.responseStatus===null,isFirst:k===0,isLast:k===e.logs.length-1,isTurnStart:S}),l.jsx("div",{className:he("flex-1 min-w-0 mb-2 rounded-lg",(y[k]??0)%2===0?"bg-muted/10":"bg-muted/25"),children:l.jsx(ko,{log:b,viewMode:t,strip:n,cacheTrend:r?.get(b.id)??null,onCompareWithPrevious:()=>o(b)})})]},b.id)})})]})});function y5({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 Rc({...e}){return l.jsx(P_,{"data-slot":"select",...e})}function Oc({...e}){return l.jsx(O_,{"data-slot":"select-value",...e})}function Dc({className:e,size:t="default",children:n,...r}){return l.jsxs(R_,{"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(D_,{asChild:!0,children:l.jsx(vt,{className:"size-4 opacity-50"})})]})}function Mc({className:e,children:t,position:n="popper",align:r="center",...o}){return l.jsx(M_,{children:l.jsxs(L_,{"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(v5,{}),l.jsx(F_,{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(b5,{})]})})}function Hr({className:e,children:t,...n}){return l.jsxs($_,{"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(U_,{children:l.jsx(on,{className:"size-4"})})}),l.jsx(B_,{children:t})]})}function v5({className:e,...t}){return l.jsx(Z_,{"data-slot":"select-scroll-up-button",className:he("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Nv,{className:"size-4"})})}function b5({className:e,...t}){return l.jsx(V_,{"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 w5(){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 k5(){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"})]})}const _5=ae({name:K(),apiKey:K(),format:lt(["anthropic","openai"]),anthropicBaseUrl:K(),openaiBaseUrl:K(),models:Oe(K()),sourceTool:lt(["claude-code","opencode"]),alreadyExists:nt()}),S5=ae({providers:Oe(_5),warnings:Oe(K()).optional()}),C5=ae({success:nt().optional(),imported:ve().optional(),message:K().optional(),errors:Oe(K()).optional()}),j5={"claude-code":w5,opencode:k5};function E5({open:e,onOpenChange:t,onImportComplete:n}){const[r,o]=v.useState(!1),[i,s]=v.useState(null),[a,c]=v.useState([]),[u,d]=v.useState([]),[h,p]=v.useState(new Set),[f,x]=v.useState(!1),[m,y]=v.useState(null),[g,b]=v.useState(null),k=v.useCallback(()=>{o(!0),s(null),d([]),c([]),p(new Set),y(null),b(null),fetch("/api/providers/scan").then(E=>E.ok?E.json().then(T=>{const R=S5.safeParse(T);if(!R.success){s(`Invalid response: ${R.error.message}`);return}c(R.data.providers),d(R.data.warnings??[]);const M=new Set;R.data.providers.forEach((L,j)=>{L.alreadyExists||M.add(j)}),p(M)}):E.text().then(T=>{s(`Scan failed (${E.status}): ${T}`)})).catch(E=>{s(E instanceof Error?E.message:String(E))}).finally(()=>{o(!1)})},[]);v.useEffect(()=>{e&&k()},[e,k]);const S=v.useCallback(E=>{p(T=>{const R=new Set(T);return R.has(E)?R.delete(E):R.add(E),R})},[]),N=v.useCallback(()=>{const E=a.filter((M,L)=>h.has(L));if(E.length===0)return;x(!0),b(null),y(null);const T=new Date().toISOString(),R=E.map(M=>({id:window.crypto.randomUUID(),name:M.name,apiKey:M.apiKey,format:M.format,anthropicBaseUrl:M.anthropicBaseUrl,openaiBaseUrl:M.openaiBaseUrl,models:M.models,createdAt:T,updatedAt:T}));fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providers:R})}).then(M=>M.json()).then(M=>{const L=C5.safeParse(M);if(!L.success){b(`Invalid response: ${L.error.message}`);return}const j=L.data;c(D=>D.map((w,P)=>h.has(P)?{...w,alreadyExists:!0}:w)),p(new Set),j.errors!==void 0&&j.errors.length>0&&j.message!==void 0?y(j.message):y(`Imported ${j.imported??E.length} provider(s)`),n()}).catch(M=>{b(M instanceof Error?M.message:String(M))}).finally(()=>{x(!1)})},[a,h,n]),C=a.some(E=>!E.alreadyExists);return l.jsx(Qo,{open:e,onOpenChange:t,children:l.jsxs(ei,{className:"max-w-xl max-h-[80vh] overflow-hidden flex flex-col",children:[l.jsxs(ti,{children:[l.jsx(ni,{children:"Import from External Tools"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Detect provider configurations from Claude Code and OpenCode."})]}),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(yr,{className:"size-4 animate-spin"}),l.jsx("span",{className:"text-sm",children:"Scanning for external providers..."})]}),i!==null&&l.jsxs("div",{className:"flex items-center gap-2 text-destructive text-sm py-4",children:[l.jsx(xr,{className:"size-4"}),i]}),!r&&i===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)"})]}),!r&&a.map((E,T)=>l.jsxs("label",{className:`flex items-start gap-3 p-3 border rounded-md ${E.alreadyExists?"":"cursor-pointer hover:bg-muted/50"}`,children:[!E.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 R=j5[E.sourceTool];return R===void 0?null:l.jsx(R,{})})(),E.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:[E.models.slice(0,4).join(", "),E.models.length>4?` +${E.models.length-4} more`:""]}),l.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:E.format==="anthropic"?E.anthropicBaseUrl:E.openaiBaseUrl}),l.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 font-mono",children:E.apiKey.length>8?`${E.apiKey.slice(0,4)}••••${E.apiKey.slice(-4)}`:"••••"})]})]},`${E.sourceTool}-${E.name}`)),u.length>0&&l.jsx("div",{className:"text-xs text-muted-foreground space-y-1 border-t pt-2",children:u.map((E,T)=>l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(xr,{className:"size-3"}),E]},T))}),m!==null&&l.jsx("div",{className:"text-sm text-green-500 border-t pt-2",children:m}),g!==null&&l.jsx("div",{className:"text-sm text-destructive border-t pt-2",children:g})]}),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(yr,{className:`size-3 mr-1 ${r?"animate-spin":""}`}),"Rescan"]}),l.jsxs(Xe,{size:"sm",onClick:N,disabled:!C||h.size===0||f,children:[l.jsx(Is,{className:"size-3 mr-1"}),f?"Importing...":`Import Selected (${h.size})`]})]})]})})}function N5({open:e,onOpenChange:t,title:n,description:r,confirmLabel:o="Confirm",variant:i="default",onConfirm:s}){return l.jsx(Qo,{open:e,onOpenChange:t,children:l.jsxs(ei,{children:[l.jsx(ti,{children:l.jsx(ni,{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:i,size:"sm",onClick:()=>{s(),t(!1)},children:o})]})]})})}function Sp(e){return e.length<=8?"••••••••":e.slice(0,4)+"••••••••"+e.slice(-4)}const T5={deepseek:"https://api-docs.deepseek.com/zh-cn/"};function A5(e){return Object.prototype.hasOwnProperty.call(e,"success")}function I5(e){return Object.prototype.hasOwnProperty.call(e,"notConfigured")}function z5(e){const t={className:"size-3",strokeWidth:2};switch(e){case"timeout":return l.jsx(To,{...t});case"network_unreachable":return l.jsx(Rb,{...t});case"connection_refused":return l.jsx(Db,{...t});case"auth_failed":return l.jsx(lb,{...t});case"rate_limited":return l.jsx(Xv,{...t});case"server_error":return l.jsx(wb,{...t});case"invalid_response":return l.jsx(Mv,{...t});case"unknown":return l.jsx(xr,{...t});default:return l.jsx(xr,{...t})}}function qr({result:e}){const[t,n]=v.useState(!1);if(!A5(e))return I5(e)?l.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[l.jsx(Rs,{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(Ku,{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(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["+",e.cacheCreationInputTokens," cache"]})}),l.jsx(Pe,{children:"Tokens cached for reuse, reducing future API cost"})]})},"cache-create")),e.cacheReadInputTokens!==void 0&&e.cacheReadInputTokens>0&&c.push(l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["~",e.cacheReadInputTokens," cached"]})}),l.jsx(Pe,{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(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 shrink-0",children:[l.jsx(Ov,{className:"size-3"}),l.jsx("span",{children:"Connected"}),c.length>0&&l.jsxs("span",{className:"text-muted-foreground",children:["(",u,")"]})]})}),l.jsx(Pe,{children:"Connection test passed"})]})})}const r=e.error,o=r?.message??"Connection failed",i=r?.hint,s=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:[z5(a),l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsx("span",{className:"truncate",children:o})}),l.jsx(Pe,{children:"Connection test failed"})]})}),s!==void 0&&l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{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(zs,{className:"size-3"}):l.jsx(Ps,{className:"size-3"})})}),l.jsx(Pe,{children:t?"Hide error details":"Show detailed error information"})]})})]}),t&&s!==void 0&&l.jsxs("div",{className:"text-xs text-muted-foreground bg-muted/50 rounded p-2 max-w-[300px]",children:[i!==void 0&&l.jsx("div",{className:"mb-1",children:i}),l.jsx("div",{className:"font-mono whitespace-pre-wrap break-all text-red-400/80",children:s})]})]})}function P5(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n,o=Math.floor(r/1e3);if(o<60)return"just now";const i=Math.floor(o/60);if(i<60)return`${i}m ago`;const s=Math.floor(i/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`}function R5({provider:e,testResults:t,isTesting:n,testingTimeLeft:r,isHighlighted:o,onEdit:i,onDelete:s,onTest:a}){const[c,u]=v.useState(!1),[d,h]=v.useState(!1),[p,f]=v.useState(!1),x=v.useRef(null),m=v.useRef(void 0);t?.testedAt!==void 0&&t.testedAt!==m.current&&(m.current=t.testedAt,x.current=null);const y=v.useCallback(()=>{f(k=>{const S=!k;return S&&x.current===null&&t?.models!==void 0&&(x.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 g(){navigator.clipboard.writeText(e.apiKey).catch(()=>{}),h(!0),setTimeout(()=>h(!1),2e3)}const b=e.apiDocsUrl??Object.entries(T5).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(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{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(Pe,{children:"Company-provided API key"})]})}),e.source==="personal"&&l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{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(Pe,{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(Hv,{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:Sp(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(zs,{className:"size-4"}):l.jsx(Ps,{className:"size-4"})}),l.jsx("button",{type:"button",onClick:g,className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":"Copy API key",children:d?l.jsx(on,{className:"size-4 text-green-500"}):l.jsx(yn,{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(qr,{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(qr,{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(To,{className:"size-3"}),l.jsxs("span",{children:["Tested ",P5(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:y,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(qr,{result:S.anthropic.nonStreaming})}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&l.jsx("td",{className:"py-1 px-2",children:l.jsx(qr,{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(Ku,{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:()=>i(e),className:"text-xs h-7 gap-1",disabled:n??!1,children:[l.jsx(Os,{className:"size-3"}),"Edit"]}),l.jsxs(Xe,{variant:"outline",size:"sm",onClick:()=>s(e.id),className:"text-xs h-7 gap-1 text-destructive hover:text-destructive",disabled:n??!1,children:[l.jsx(jb,{className:"size-3"}),"Delete"]})]})]})}const O5={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"}},Lc=["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"],Fc=["glm-5","glm-5.1","qwen3.6-plus","qwen3.7-max"];function D5({provider:e,onSubmit:t,onCancel:n}){const[r,o]=v.useState(e?.name??""),[i,s]=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:[""]),[x,m]=v.useState("anthropic"),[y,g]=v.useState(e?.anthropicBaseUrl??""),[b,k]=v.useState(e?.openaiBaseUrl??""),[S,N]=v.useState(e?.apiDocsUrl??""),[C,E]=v.useState(e?.source),[T,R]=v.useState({}),[M,L]=v.useState(!1),[j,D]=v.useState(null),w=v.useRef([]);v.useEffect(()=>{if(j===null)return;const Y=j;function de(te){if(!(te.target instanceof Node))return;const ce=w.current[Y];ce!=null&&!ce.contains(te.target)&&D(null)}return document.addEventListener("mousedown",de),()=>document.removeEventListener("mousedown",de)},[j]);const[P,H]=v.useState(!1),[B,q]=v.useState(!1),X=r.toLowerCase().includes("minimax"),A=r.toLowerCase().includes("alibaba");function W(){navigator.clipboard.writeText(i).catch(()=>{}),d(!0),setTimeout(()=>d(!1),2e3)}v.useEffect(()=>{e&&(o(e.name),s(e.apiKey),f((e.models?.length??0)>0?e.models:[""]),g(e.anthropicBaseUrl??""),k(e.openaiBaseUrl??""),N(e.apiDocsUrl??""),E(e.source),H(!1),q(!1))},[e]),v.useEffect(()=>{const Y=r.toLowerCase();for(const[de,te]of Object.entries(O5))if(Y.includes(de)){te.format==="anthropic"&&!P?g(te.baseUrl):te.format==="openai"&&!B&&k(te.baseUrl),te.apiDocsUrl!==void 0&&!S&&N(te.apiDocsUrl),de==="minimax"&&p.length===1&&p[0]===""&&f([Lc[0]??""]),de==="alibaba"&&p.length===1&&p[0]===""&&f([Fc[0]??""]);break}},[r]);function V(){const Y={};return r.trim()||(Y.name="Name is required"),i.trim()||(Y.apiKey="API key is required"),(p.length===0||p.every(de=>!de.trim()))&&(Y.models="At least one model is required"),y.trim()&&!I(y.trim())&&(Y.anthropicBaseUrl="Invalid URL format"),b.trim()&&!I(b.trim())&&(Y.openaiBaseUrl="Invalid URL format"),!y.trim()&&!b.trim()&&(Y.format="At least one format URL (Anthropic or OpenAI) is required"),R(Y),Object.keys(Y).length===0}function I(Y){try{return new URL(Y),!0}catch{return!1}}function oe(Y){if(Y.preventDefault(),!!V()){L(!0);try{t({name:r.trim(),apiKey:i.trim(),models:p.map(de=>de.trim()).filter(de=>de!==""),anthropicBaseUrl:y.trim()||void 0,openaiBaseUrl:b.trim()||void 0,apiDocsUrl:S.trim()||void 0,source:C})}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:Y=>o(Y.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:Y=>E(Y.target.value==="company"||Y.target.value==="personal"?Y.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||i.length===0?i:Sp(i),onChange:Y=>s(Y.target.value),onFocus:()=>{!a&&i.length>0&&c(!0)},placeholder:"sk-ant-...",readOnly:!a&&i.length>0,className:"flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),l.jsx("button",{type:"button",onClick:()=>c(Y=>!Y),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(zs,{className:"size-4"}):l.jsx(Ps,{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(on,{className:"size-4 text-green-500"}):l.jsx(yn,{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((Y,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:Y,onChange:te=>{f(ce=>{const fe=[...ce];return fe[de]=te.target.value,fe})},placeholder:X||A?"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"}),(X||A)&&l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",onClick:()=>D(j===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"})}),j===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:(X?Lc:Fc).map(te=>l.jsx("button",{type:"button",onClick:()=>{f(ce=>{const fe=[...ce];return fe[de]=te,fe}),D(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(Y=>[...Y,""]),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(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{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 ${x==="anthropic"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Anthropic Format"})}),l.jsx(Pe,{children:"Anthropic Messages API protocol"})]})}),l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{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 ${x==="openai"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"OpenAI Format"})}),l.jsx(Pe,{children:"OpenAI Chat Completions API protocol"})]})})]}),T.format!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:T.format})]}),x==="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:y,onChange:Y=>{H(!0),g(Y.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."})]}),x==="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:Y=>{q(!0),k(Y.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:Y=>N(Y.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:M,children:"Cancel"}),l.jsx(Xe,{type:"submit",disabled:M,children:M?"Saving...":e?"Update Provider":"Add Provider"})]})]})}const gs=ae({id:K(),name:K(),apiKey:K(),model:K().optional(),models:Oe(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()}),M5=lt(["timeout","network_unreachable","connection_refused","auth_failed","rate_limited","server_error","invalid_response","unknown"]),L5=ae({message:K(),type:M5,details:K().optional(),hint:K().optional()}),F5=ae({type:lt(["text","thinking"]),text:K().optional(),thinking:K().optional()}),$5=ae({success:nt(),error:L5.optional(),model:K().optional(),inputTokens:ve().optional(),outputTokens:ve().optional(),cacheCreationInputTokens:ve().optional(),cacheReadInputTokens:ve().optional(),latencyMs:ve().optional(),content:Oe(F5).optional(),rawResponse:K().optional(),streaming:nt().optional(),streamingChunks:ae({chunks:Oe(Du),truncated:nt().default(!1)}).optional(),requestHeaders:Vt(K(),K()).optional()}),$c=qt([$5,ae({notConfigured:Se(!0)}),ae({testing:Se(!0)})]),_o=ae({nonStreaming:$c,streaming:$c}),B5=ae({anthropic:_o,openai:_o}),U5=ae({anthropic:_o,openai:_o,models:Vt(K(),B5).optional(),testedAt:K().optional()});function Z5(){return{anthropic:{nonStreaming:{testing:!0},streaming:{testing:!0}},openai:{nonStreaming:{testing:!0},streaming:{testing:!0}}}}function Bc(e,t){const n=()=>({nonStreaming:{success:!1,error:{message:e,type:t}},streaming:{notConfigured:!0}});return{anthropic:n(),openai:n()}}const V5=ae({providerConfig:K()}),W5=ae({success:nt().optional(),imported:ve().optional(),message:K().optional(),errors:Oe(K()).optional()}),H5=30,Di="Network error: could not reach the server. Is the proxy running?";function Uc(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 q5({externalProviders:e,isLoading:t=!1,externalTestResults:n,externalTestingProviders:r,externalTestingTimeLeft:o,onProvidersMutate:i,onTestResultsChange:s,onTestingProvidersChange:a,onTestingTimeLeftChange:c}){const[u,d]=v.useState(!1),[h,p]=v.useState(),[f,x]=v.useState(null),[m,y]=v.useState({}),[g,b]=v.useState(new Set),[k,S]=v.useState({}),[N,C]=v.useState(null),[E,T]=v.useState(!1),[R,M]=v.useState(null),[L,j]=v.useState(!1),[D,w]=v.useState(!1),[P,H]=v.useState(null),[B,q]=v.useState("all"),X=v.useRef(null),A=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]),I=n??m,oe=r??g,Y=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 Nn(U,V5);C(J.providerConfig)}}catch{}})()},[]);const te=v.useCallback(U=>{A.current!==null&&clearTimeout(A.current),M(U),X.current?.scrollTo({top:X.current.scrollHeight,behavior:"smooth"}),A.current=setTimeout(()=>{M(null),A.current=null},2e3)},[]);v.useEffect(()=>()=>{A.current!==null&&clearTimeout(A.current)},[]);const ce=v.useCallback(()=>{i?.().catch(()=>{})},[i]),fe=v.useCallback((U,J)=>{s?s(U,J):y($=>({...$,[U]:J}))},[s]),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,Z5()),ge(U,!0);const J=new AbortController;let $=H5;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 ie=await Nn(le,U5);fe(U,ie)}else fe(U,Bc(`HTTP ${le.status}: ${le.statusText}`,"server_error"))}catch(le){le instanceof Error&&le.name==="AbortError"&&fe(U,Bc("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(Uc(U))});if(!J.ok){x(await Kr(J,"Failed to add provider"));return}const $=await Nn(J,gs);d(!1),te($.id),ce(),await xe($.id)}catch{x(Di)}})()}function Fe(U){h&&(async()=>{try{const J=await fetch(`/api/providers/${h.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(Uc(U))});if(!J.ok){x(await Kr(J,"Failed to update provider"));return}const $=await Nn(J,gs);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{x(Di)}})()}function _(U){H(U),w(!0)}function ee(){const U=P;U!==null&&(async()=>{let J;try{J=await fetch(`/api/providers/${U}`,{method:"DELETE"})}catch{x(Di);return}if(!J.ok){x(await Kr(J,"Failed to delete provider"));return}ce()})()}const G=v.useRef(null);function O(U){const J="/api/providers/export";(async()=>{try{const $=await fetch(J);if(!$.ok){x("Failed to export providers");return}const ne=await $.blob(),le=URL.createObjectURL(ne),ie=document.createElement("a");ie.href=le,ie.download=$.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]??"providers.json",document.body.appendChild(ie),ie.click(),document.body.removeChild(ie),URL.revokeObjectURL(le)}catch{x("Failed to export providers")}})()}function z(){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 Nn(ne,W5);ne.ok&&le.imported!==void 0&&le.imported>0?(ce(),x(null)):le.errors&&le.errors.length>0?x(le.errors.join("; ")):x(le.message??"Import failed")}catch{x("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(D5,{provider:h,onSubmit:h?Fe: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(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsxs(Xe,{variant:"outline",size:"sm",onClick:()=>O(),className:"gap-1 hover:bg-muted",children:[l.jsx(Is,{className:"size-3"}),"Export"]})}),l.jsx(Pe,{children:"Download providers as JSON for backup or sharing"})]})}),l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsxs(Xe,{variant:"outline",size:"sm",onClick:z,className:"gap-1 hover:bg-muted",children:[l.jsx(Ab,{className:"size-3"}),"Import"]})}),l.jsx(Pe,{children:"Import providers from an exported JSON file"})]})}),l.jsx("input",{type:"file",ref:G,accept:".json",onChange:F,style:{display:"none"}}),l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsxs(Xe,{variant:"outline",size:"sm",onClick:()=>j(!0),className:"gap-1",children:[l.jsx(vb,{className:"size-3"}),"Scan"]})}),l.jsx(Pe,{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(so,{className:"size-4"}),"Add Provider"]})]})]}),N!==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:N,children:N}),l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>{window.navigator.clipboard.writeText(N).then(()=>{T(!0),setTimeout(()=>T(!1),2e3)})},className:"shrink-0 ml-auto text-muted-foreground hover:text-foreground transition-colors",children:E?l.jsx(on,{className:"size-3 text-green-500"}):l.jsx(yn,{className:"size-3"})})}),l.jsx(Pe,{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(xr,{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(so,{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(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{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(Pe,{children:U==="all"?"Show all providers":U==="personal"?"Providers you configured yourself":"Providers set by your organization"})]})},U))}),l.jsx("div",{ref:X,className:"space-y-3",children:V.map(U=>l.jsx(R5,{provider:U,testResults:I[U.id],isTesting:oe.has(U.id),testingTimeLeft:Y[U.id],isHighlighted:U.id===R,onEdit:J=>p(J),onDelete:_,onTest:J=>{xe(J)}},U.id))})]}),l.jsx(E5,{open:L,onOpenChange:j,onImportComplete:()=>{i!==void 0&&i()}}),l.jsx(N5,{open:D,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 K5(e){return As(e,gs.array(),void 0,t=>`Failed to fetch ${e}: ${t.status}`)}function G5(){const e=Kc("/api/providers",K5,{revalidateOnFocus:!1,revalidateIfStale:!1});return{providers:e.data??[],isLoading:e.isLoading,isError:e.error,mutate:e.mutate}}function J5(){const[e,t]=v.useState(!1),[n,r]=v.useState("providers"),{providers:o,isLoading:i,mutate:s}=G5(),[a,c]=v.useState({}),[u,d]=v.useState(new Set),[h,p]=v.useState({}),f=v.useCallback((y,g)=>{c(b=>({...b,[y]:g}))},[]),x=v.useCallback((y,g)=>{d(b=>{const k=new Set(b);return g?k.add(y):k.delete(y),k})},[]),m=v.useCallback((y,g)=>{p(b=>{if(g===void 0){const k={...b};return delete k[y],k}return{...b,[y]:g}})},[]);return l.jsxs(Qo,{open:e,onOpenChange:t,children:[l.jsx(W3,{asChild:!0,children:l.jsxs(Xe,{variant:"ghost",size:"icon",className:"size-8",children:[l.jsx(_b,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Settings"})]})}),l.jsxs(ei,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[l.jsx(ti,{children:l.jsx(ni,{children:"Settings"})}),l.jsxs(In,{value:n,onValueChange:r,className:"flex-1 overflow-hidden",children:[l.jsxs(zn,{children:[l.jsx(et,{value:"providers",children:"Providers"}),l.jsx(et,{value:"proxy",children:"Proxy"})]}),l.jsxs("div",{className:"mt-4 overflow-y-auto flex-1 pr-3",children:[l.jsx(tt,{value:"providers",children:l.jsx(q5,{externalProviders:o,isLoading:i,externalTestResults:a,externalTestingProviders:u,externalTestingTimeLeft:h,onProvidersMutate:()=>s(),onTestResultsChange:f,onTestingProvidersChange:x,onTestingTimeLeftChange:m})}),l.jsx(tt,{value:"proxy",children:l.jsx(Y5,{})})]})]})]})]})}function Y5(){const{strip:e,isLoading:t,setStrip:n}=Lu(),[r,o]=v.useState(null),[i,s]=v.useState(!1),a=v.useCallback(async c=>{o(null),s(!0);try{await n(c)}catch(u){o(u instanceof Error?u.message:String(u))}finally{s(!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.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsxs("label",{className:"flex items-center gap-3",children:[l.jsx("input",{type:"checkbox",role:"switch",checked:e,disabled:t||i,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"})]})}),l.jsx(Pe,{children:"Strip Claude Code billing header to improve cache hit rates"})]})}),r!==null&&l.jsxs("p",{className:"text-xs text-destructive",children:["Failed to save: ",r]})]})}function X5(e){const t=new Map;for(const n of e){const r=n.logs;for(let o=1;o<r.length;o++){const i=r[o-1],s=r[o];i===void 0||s===void 0||t.set(s.id,{creation:Zc(i.cacheCreationInputTokens,s.cacheCreationInputTokens),read:Zc(i.cacheReadInputTokens,s.cacheReadInputTokens)})}}return t}function Zc(e,t){return t===null||e===null?null:t>e?{direction:"up",delta:t-e}:t<e?{direction:"down",delta:e-t}:null}const Q5="";function cr(e){if(e.length===0)return Q5;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 eT(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Vc(e){if(typeof e=="string")try{return So(JSON.parse(e))}catch{return{kind:"primitive",value:e}}return So(e)}function So(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=>So(t))};if(eT(e)){const t={};for(const n of Object.keys(e).sort())t[n]=So(e[n]);return{kind:"object",value:t}}return{kind:"primitive",value:null}}function tT(e,t){const n=[];return xs([],e,t,n),n}function xs(e,t,n,r){const o=cr(e);if(ys(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 i=Object.keys(t.value),s=Object.keys(n.value),a=new Set(s);for(const c of i){const u=t.value[c];if(u!==void 0)if(!a.has(c))r.push({kind:"removed",path:cr([...e,c]),value:u});else{const d=n.value[c];if(d===void 0)continue;xs([...e,c],u,d,r)}}for(const c of s){if(i.includes(c))continue;const u=n.value[c];u!==void 0&&r.push({kind:"added",path:cr([...e,c]),value:u})}return}if(t.kind==="array"&&n.kind==="array"){const i=Math.min(t.value.length,n.value.length);for(let s=0;s<i;s++){const a=t.value[s],c=n.value[s];a===void 0||c===void 0||xs([...e,s],a,c,r)}for(let s=i;s<n.value.length;s++){const a=n.value[s];a!==void 0&&r.push({kind:"added",path:cr([...e,s]),value:a})}for(let s=i;s<t.value.length;s++){const a=t.value[s];a!==void 0&&r.push({kind:"removed",path:cr([...e,s]),value:a})}}}function ys(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||!ys(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 i=e.value[o],s=t.value[o];if(i===void 0||s===void 0||!ys(i,s))return!1}return!0}return!1}function Ct(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 eo(e,t=2){return JSON.stringify(vs(e),null,t)}function vs(e){switch(e.kind){case"primitive":return e.value;case"array":return e.value.map(vs);case"object":{const t={};for(const[n,r]of Object.entries(e.value))t[n]=vs(r);return t}}}function Wc(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 Hc(e){return e.kind==="equal"&&(e.value.kind==="object"||e.value.kind==="array")}function nT(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if(r!==void 0&&Hc(r)){const o=Wc(r.path);let i=n+1;for(;i<e.length;){const s=e[i];if(s===void 0||!Hc(s)||Wc(s.path)!==o)break;i++}if(i-n>1){const s=[];for(let a=n;a<i;a++){const c=e[a];c!==void 0&&c.kind==="equal"&&s.push(c)}t.push({kind:"equal-run",ops:s}),n=i;continue}}r!==void 0&&t.push({kind:"single",op:r}),n++}return t}const Cp={added:{icon:so,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:Rs,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:Os,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:Vv,accent:"text-muted-foreground/70",bg:"bg-muted/20 hover:bg-muted/30",border:"border-l-muted-foreground/20",label:"EQUAL"}};function rT({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 i=r.path,s=o.path,a=e.length===1?i:`${i} … ${s}`,c=r.value.kind==="array"?`${e.length} equal arrays`:r.value.kind==="object"?`${e.length} equal objects`:"equal",u=Cp.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(jt,{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:`${i} … ${s}`,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(un,{text:eo(d.value),defaultExpandDepth:2})]},d.path))})]})}function oT({op:e,idx:t,copiedPath:n,onCopyPath:r,expanded:o,onToggle:i}){const s=Cp[e.kind],a=s.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:Ct(e.left,400),tone:"text-rose-700 dark:text-rose-300 line-through"},{text:Ct(e.right,400),tone:"text-emerald-700 dark:text-emerald-300"}]:e.kind==="removed"?[{text:Ct(e.value,400),tone:"text-rose-700 dark:text-rose-300 line-through"}]:e.kind==="added"?[{text:Ct(e.value,400),tone:"text-emerald-700 dark:text-emerald-300"}]:[{text:Ct(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",s.border,s.bg),children:[l.jsxs("button",{type:"button",onClick:i,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(jt,{className:he("size-3 shrink-0 transition-transform",s.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",s.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",s.accent,e.kind==="equal"?"bg-muted/40":"bg-background/60"),children:s.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(on,{className:"size-3"}):l.jsx(yn,{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(iT,{op:e}):null})]})}function iT({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(un,{text:eo(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(un,{text:eo(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(un,{text:eo(e.right),defaultExpandDepth:2})]})]})}function sT({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(Rs,{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(so,{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(Os,{className:"size-3"}),e.changed," changed"]})]})}function aT({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(Gu,{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(Zu,{className:"size-3"}),"Split"]})]})}function qc({log:e,side:t}){const n=xo(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 +",Ye(e.cacheCreationInputTokens)]}),e.cacheReadInputTokens!==null&&e.cacheReadInputTokens>0&&l.jsxs("span",{className:"text-purple-400",children:["Cache ~",Ye(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 lT({left:e,right:t,onClose:n}){const r=v.useMemo(()=>{const C=Vc(oo(e.rawRequestBody)??e.rawRequestBody),E=Vc(oo(t.rawRequestBody)??t.rawRequestBody);return tT(C,E)},[e.rawRequestBody,t.rawRequestBody]),o=v.useMemo(()=>nT(r),[r]),i=v.useMemo(()=>{let C=0,E=0,T=0;for(const R of o)if(R.kind==="single")switch(R.op.kind){case"added":C++;break;case"removed":E++;break;case"changed":T++;break}return{added:C,removed:E,changed:T}},[o]),[s,a]=v.useState(new Set),c=C=>{a(E=>{const T=new Set(E);return T.has(C)?T.delete(C):T.add(C),T})},[u,d]=v.useState(new Set),h=C=>{d(E=>{const T=new Set(E);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"),x=v.useRef(null),[m,y]=v.useState(null),g=v.useRef(null),b=C=>{window.navigator.clipboard.writeText(C).then(()=>{y(C),g.current!==null&&clearTimeout(g.current),g.current=setTimeout(()=>y(null),1500)})};v.useEffect(()=>()=>{g.current!==null&&clearTimeout(g.current)},[]);const k=C=>{const E=o.findIndex(M=>M.kind==="single"&&M.op.kind===C);if(E===-1)return;const T=x.current;if(T===null)return;const R=T.querySelector(`[data-diff-idx="${E}"]`);R!==null&&R.scrollIntoView({behavior:"smooth",block:"center"})};v.useEffect(()=>{const C=T=>{T.key==="Escape"&&n()};document.addEventListener("keydown",C);const E=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",C),document.body.style.overflow=E}},[n]);const S=xo(e)===xo(t),N=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(qc,{log:e,side:"left"}),l.jsx(qc,{log:t,side:"right"})]}),l.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[l.jsx(aT,{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(Yu,{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."}),N?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(sT,{counts:i,onJumpTo:k}),l.jsx("div",{ref:x,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,E)=>{if(C.kind==="equal-run")return l.jsx(rT,{ops:C.ops,expanded:s.has(E),onToggle:()=>c(E)},`r${E}`);const T=C.op;return l.jsx(oT,{op:T,idx:E,copiedPath:m,onCopyPath:b,expanded:u.has(E),onToggle:()=>h(E)},`o${E}`)})}):l.jsx(cT,{grouped:o,left:e,right:t})})]})]})]})}function cT({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 i=r.op;return i.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:i.path,children:i.path}),l.jsx("span",{className:"font-mono text-xs break-all opacity-60",children:Ct(i.value,200)}),l.jsx("span",{className:"font-mono text-xs break-all opacity-60",children:Ct(i.value,200)})]},o):i.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:i.path}),l.jsxs("div",{className:"font-mono break-all text-emerald-300/90",children:["+ ",Ct(i.value,400)]})]},o):i.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:i.path}),l.jsxs("div",{className:"font-mono break-all text-rose-300/90 line-through",children:["− ",Ct(i.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:i.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:Ct(i.left,400)}),l.jsx("div",{className:"font-mono text-emerald-300/90 break-all",children:Ct(i.right,400)})]})]},o)})]})}function uT(e){return e.length<=30?e:e.slice(0,12)+"…"+e.slice(-12)}function dT(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 fT({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 hT({logs:e,sessions:t,models:n,selectedSession:r,selectedModel:o,onSessionChange:i,onModelChange:s,onClearAll:a,viewMode:c,onViewModeChange:u,strip:d}){const{totalIn:h,totalOut:p}=dT(e),[f,x]=v.useState(!0),[m,y]=v.useState("thread"),[g,b]=v.useState(!1),[k,S]=v.useState(null),N=v.useCallback(async()=>{b(!0);try{await jS(e)}finally{b(!1)}},[e]),C=v.useRef(null);v.useEffect(()=>{S(null)},[r,o]);const E=v.useCallback(()=>{S(null)},[]),T=v.useCallback(P=>{const H=e.indexOf(P);if(H<=0)return;const B=e[H-1];B!==void 0&&S([B,P])},[e]),R=v.useMemo(()=>RS(e),[e]),M=v.useMemo(()=>X5(R),[R]),L=v.useMemo(()=>e.map(P=>Ph(P)),[e]),j=v.useMemo(()=>{const P=[];let H=0;for(let B=0;B<L.length;B++)B>0&&(L[B-1]==="end_turn"||L[B-1]==="stop")&&H++,P.push(H);return P},[L]),D=e.length>0&&f&&R.length>1,w=$u({count:D?R.length:e.length,getScrollElement:()=>C.current,estimateSize:()=>150,measureElement:typeof window<"u"?P=>P.getBoundingClientRect().height:void 0,overscan:5});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-center gap-4 mb-4 px-6 pt-6",children:[l.jsxs("h1",{className:"text-lg font-bold flex-1 flex items-center gap-2",children:[l.jsx(y5,{className:"size-10 text-amber-500 self-center"}),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",NS.version]})]})]}),l.jsx(Te,{children:l.jsxs(Ie,{children:[l.jsx(ze,{asChild:!0,children:l.jsxs("div",{className:"flex items-center border border-border rounded-md overflow-hidden",children:[l.jsx("button",{type:"button",onClick:()=>u("simple"),className:`px-2 py-1 cursor-pointer transition-colors text-xs ${c==="simple"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Simple"}),l.jsx("button",{type:"button",onClick:()=>u("full"),className:`px-2 py-1 cursor-pointer transition-colors text-xs ${c==="full"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Full"})]})}),l.jsx(Pe,{children:"Simple shows parsed output; Full adds raw headers and tokens"})]})}),l.jsx(J5,{}),l.jsxs("span",{className:"text-muted-foreground text-xs font-mono",children:[e.length," request",e.length!==1?"s":"",h>0||p>0?` · ${h.toLocaleString()} in / ${p.toLocaleString()} out`:""]}),e.length>0&&l.jsx("button",{type:"button",onClick:()=>{N()},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(Is,{className:"size-3"}),l.jsx("span",{children:"Export All"})]})}),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 All"})]}),l.jsxs("div",{className:"flex gap-3 px-6 mb-4",children:[l.jsxs(Rc,{value:r,onValueChange:i,children:[l.jsx(Dc,{className:"flex-1 max-w-[400px] text-xs",children:l.jsx(Oc,{placeholder:"All sessions"})}),l.jsxs(Mc,{children:[l.jsx(Hr,{value:"__all__",children:"All sessions"}),t.map(P=>l.jsx(Hr,{value:P,children:uT(P)},P))]})]}),l.jsxs(Rc,{value:o,onValueChange:s,children:[l.jsx(Dc,{className:"text-xs",children:l.jsx(Oc,{placeholder:"All models"})}),l.jsxs(Mc,{children:[l.jsx(Hr,{value:"__all__",children:"All models"}),n.map(P=>l.jsx(Hr,{value:P,children:P},P))]})]}),l.jsxs("div",{className:"flex items-center border border-border rounded-md overflow-hidden",children:[l.jsx("button",{type:"button",onClick:()=>x(!0),className:`px-2 py-1.5 cursor-pointer transition-colors ${f?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,title:"Grouped view",children:l.jsx(ob,{className:"size-4"})}),l.jsx("button",{type:"button",onClick:()=>x(!1),className:`px-2 py-1.5 cursor-pointer transition-colors ${f?"text-muted-foreground hover:bg-muted/50":"bg-muted text-foreground"}`,title:"Flat view",children:l.jsx(Qa,{className:"size-4"})})]}),l.jsxs("div",{className:"flex items-center border border-border rounded-md overflow-hidden",children:[l.jsx("button",{type:"button",onClick:()=>y("thread"),className:`px-2 py-1.5 cursor-pointer transition-colors ${m==="thread"?"bg-amber-500/15 text-amber-400 border-r border-amber-500/30":"text-muted-foreground hover:bg-muted/50"}`,title:"Thread view (connected timeline)",children:l.jsx(Vu,{className:"size-4"})}),l.jsx("button",{type:"button",onClick:()=>y("flat"),className:`px-2 py-1.5 cursor-pointer transition-colors ${m==="flat"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,title:"Flat view (card list)",children:l.jsx(Qa,{className:"size-4"})})]})]}),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(fT,{command:"LLM_BASE_URL=http://localhost:25947/proxy <your-tool>"})]}):l.jsx("div",{ref:C,className:"overflow-y-auto h-full",children:l.jsx("div",{style:{height:`${w.getTotalSize()}px`,width:"100%",position:"relative"},children:w.getVirtualItems().map(P=>{if(D){const H=R[P.index];return H===void 0?null:l.jsx("div",{"data-index":P.index,ref:w.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${P.start}px)`},children:l.jsx(x5,{group:H,viewMode:c,strip:d,cacheTrends:M,onCompareWithPrevious:T,defaultGroupViewMode:m})},H.id)}else{const H=e[P.index];if(H===void 0)return null;const B=P.index;return l.jsx("div",{"data-index":P.index,ref:w.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${P.start}px)`},children:m==="thread"?l.jsxs("div",{className:"flex items-stretch ml-3",children:[l.jsx(_p,{stopReason:L[B]??null,isPending:H.responseStatus===null,isFirst:B===0,isLast:B===e.length-1,isTurnStart:B===0||L[B-1]==="end_turn"||L[B-1]==="stop"}),l.jsx("div",{className:he("flex-1 min-w-0 mb-2 rounded-lg",(j[B]??0)%2===0?"bg-muted/10":"bg-muted/25"),children:l.jsx(ko,{log:H,viewMode:c,strip:d,cacheTrend:M.get(H.id)??null,onCompareWithPrevious:()=>T(H)})})]}):l.jsx(ko,{log:H,viewMode:c,strip:d,cacheTrend:M.get(H.id)??null,onCompareWithPrevious:()=>T(H)})},H.id)}})})})}),k!==null&&l.jsx(lT,{left:k[0],right:k[1],onClose:E})]})}ae({logs:Oe(Bi),total:ve(),offset:ve(),limit:ve()});const pT=qt([ae({type:Se("init"),logs:Oe(Bi)}),ae({type:Se("update"),log:Bi})]);function mT(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function gT(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function xT(){const[e,t]=v.useState([]),[n,r]=v.useState([]),[o,i]=v.useState([]),[s,a]=v.useState("__all__"),[c,u]=v.useState("__all__"),[d,h]=v.useState("simple"),[p,f]=v.useState(null),x=v.useRef(null),m=v.useRef(null),y=v.useCallback(async()=>{try{const[S,N]=await Promise.all([fetch("/api/sessions"),fetch("/api/models")]);if(S.ok&&N.ok){const C=await S.json(),E=await N.json(),T=Oe(K()).safeParse(C),R=Oe(K()).safeParse(E);T.success&&r(T.data),R.success&&i(R.data)}}catch{}},[]),g=v.useCallback(()=>{x.current&&x.current.close();const S=new URLSearchParams;s!=="__all__"&&S.set("sessionId",s),c!=="__all__"&&S.set("model",c);const N=new EventSource(`/api/logs/stream?${S}`);x.current=N,N.onmessage=C=>{try{const E=String(C.data),T=JSON.parse(E),R=pT.safeParse(T);if(!R.success){f("Failed to parse SSE data");return}const M=R.data;M.type==="init"?(t(M.logs),r(mT(M.logs)),i(gT(M.logs)),f(null)):M.type==="update"&&(t(L=>{const j=s==="__all__"||M.log.sessionId===s,D=c==="__all__"||M.log.model===c;return!j||!D?L:L.findIndex(P=>P.id===M.log.id)>=0?L.map(P=>P.id===M.log.id?M.log:P):[...L,M.log]}),r(L=>{const j=M.log.sessionId;return j!=null&&j!==""?L.includes(j)?L:[...L,j]:L}),i(L=>{const j=M.log.model;return j!=null&&j!==""?L.includes(j)?L:[...L,j]:L}))}catch{f("Failed to parse SSE data")}},N.onerror=()=>{f("SSE connection lost, reconnecting..."),N.close(),m.current!==null&&clearTimeout(m.current),m.current=setTimeout(g,3e3)},y()},[s,c,y]);v.useEffect(()=>(g(),()=>{x.current&&(x.current.close(),x.current=null),m.current!==null&&(clearTimeout(m.current),m.current=null)}),[g]);const b=v.useCallback(()=>{(async()=>{try{if(!(await fetch("/api/logs",{method:"DELETE"})).ok){f("Failed to clear logs");return}t([]),r([]),i([]),f(null)}catch(S){f(S instanceof Error?S.message:"Unknown error clearing logs")}})()},[]),{strip:k}=Lu();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(hT,{logs:e,sessions:n,models:o,selectedSession:s,selectedModel:c,onSessionChange:a,onModelChange:u,onClearAll:b,viewMode:d,onViewModeChange:h,strip:k})]})}const bT=xT;export{bT as component};