@tonyclaw/llm-inspector 1.15.0 → 1.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/nitro.json +1 -1
- package/.output/public/assets/index-BIUbzgJN.css +1 -0
- package/.output/public/assets/index-TwYgzIL4.js +107 -0
- package/.output/public/assets/{main-BLYgekFx.js → main-C2-qvdhC.js} +1 -1
- package/.output/server/_libs/diff.mjs +2 -2
- package/.output/server/_ssr/{index-P66uoVEU.mjs → index-C001qcnM.mjs} +578 -419
- package/.output/server/_ssr/index.mjs +2 -2
- package/.output/server/_ssr/{router-DpLCKk51.mjs → router-D7aEu4dR.mjs} +63 -23
- package/.output/server/{_tanstack-start-manifest_v-C9Wq6YdJ.mjs → _tanstack-start-manifest_v-BXMwlSXD.mjs} +1 -1
- package/.output/server/index.mjs +28 -28
- package/README.md +200 -113
- package/package.json +1 -1
- package/src/components/ProxyViewer.tsx +63 -33
- package/src/components/ProxyViewerContainer.tsx +28 -0
- package/src/components/proxy-viewer/CompareDrawer.tsx +17 -4
- package/src/components/proxy-viewer/ConversationGroup.tsx +12 -44
- package/src/components/proxy-viewer/ConversationHeader.tsx +57 -4
- package/src/components/proxy-viewer/LogEntry.tsx +173 -218
- package/src/components/proxy-viewer/ResponseView.tsx +11 -32
- package/src/components/proxy-viewer/TurnGroup.tsx +23 -19
- package/src/components/proxy-viewer/formats/index.tsx +19 -10
- package/src/components/proxy-viewer/log-formats/anthropic.ts +48 -0
- package/src/components/proxy-viewer/log-formats/index.ts +23 -0
- package/src/components/proxy-viewer/log-formats/openai.ts +40 -0
- package/src/components/proxy-viewer/log-formats/types.ts +33 -0
- package/src/components/proxy-viewer/log-formats/unknown.ts +14 -0
- package/src/components/proxy-viewer/viewerState.ts +58 -0
- package/src/proxy/formats/index.ts +1 -1
- package/src/proxy/formats/registry.ts +9 -0
- package/src/proxy/handler.ts +2 -8
- package/src/proxy/store.ts +16 -0
- package/src/routes/api/logs.ts +31 -2
- package/styles/globals.css +22 -0
- package/.output/public/assets/index-CMuJQyt1.js +0 -105
- package/.output/public/assets/index-DciyfYBk.css +0 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import{u as nu,a as Zp,r as v,b as Nr,j as l,R as at,c as ru,d as Vp,e as Dr,g as Ei}from"./main-C2-qvdhC.js";function Q(e,t,n){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);const u=i.prototype,d=Object.keys(u);for(let h=0;h<d.length;h++){const p=d[h];p in a||(a[p]=u[p].bind(a))}}const o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const u=n?.Parent?new s:this;r(u,a),(c=u._zod).deferred??(c.deferred=[]);for(const d of u._zod.deferred)d();return u}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class Dn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ou extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const su={};function Qt(e){return su}function iu(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 Vs(e,t){return typeof t=="bigint"?t.toString():t}function Io(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ni(e){return e==null}function Ti(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Wp(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}const s=n>o?n:o,i=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return i%a/10**s}const Pa=Symbol("evaluating");function Te(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Pa)return r===void 0&&(r=Pa,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function vn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function rn(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Ra(e){return JSON.stringify(e)}function Hp(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const au="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function br(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const qp=Io(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Un(e){if(br(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(br(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function lu(e){return Un(e)?{...e}:Array.isArray(e)?[...e]:e}const Kp=new Set(["string","number","symbol"]);function Zn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function on(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 Jp(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Gp={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 Yp(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=rn(e._zod.def,{get shape(){const i={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=n.shape[a])}return vn(this,"shape",i),i},checks:[]});return on(e,s)}function Xp(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=rn(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return vn(this,"shape",i),i},checks:[]});return on(e,s)}function Qp(e,t){if(!Un(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=rn(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return vn(this,"shape",s),s}});return on(e,o)}function em(e,t){if(!Un(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=rn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return vn(this,"shape",r),r}});return on(e,n)}function tm(e,t){const n=rn(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return vn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return on(e,n)}function nm(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const i=rn(t._zod.def,{get shape(){const a=t._zod.def.shape,c={...a};if(n)for(const u in n){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(const u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return vn(this,"shape",c),c},checks:[]});return on(t,i)}function rm(e,t,n){const r=rn(t._zod.def,{get shape(){const o=t._zod.def.shape,s={...o};if(n)for(const i in n){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return vn(this,"shape",s),s}});return on(t,r)}function zn(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Pn(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Mr(e){return typeof e=="string"?e:e?.message}function en(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=Mr(e.inst?._zod.def?.error?.(e))??Mr(t?.error?.(e))??Mr(n.customError?.(e))??Mr(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Ai(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function wr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const cu=(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,Vs,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},uu=Q("$ZodError",cu),du=Q("$ZodError",cu,{Parent:Error});function om(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 sm(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>r({issues:i}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)n._errors.push(t(s));else{let i=n,a=0;for(;a<s.path.length;){const c=s.path[a];a===s.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s))):i[c]=i[c]||{_errors:[]},i=i[c],a++}}};return r(e),n}const Ii=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new Dn;if(i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>en(c,s,Qt())));throw au(a,o?.callee),a}return i.value},zi=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(o?.Err??e)(i.issues.map(c=>en(c,s,Qt())));throw au(a,o?.callee),a}return i.value},zo=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new Dn;return s.issues.length?{success:!1,error:new(e??uu)(s.issues.map(i=>en(i,o,Qt())))}:{success:!0,data:s.value}},im=zo(du),Po=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>en(i,o,Qt())))}:{success:!0,data:s.value}},am=Po(du),lm=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ii(e)(t,n,o)},cm=e=>(t,n,r)=>Ii(e)(t,n,r),um=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return zi(e)(t,n,o)},dm=e=>async(t,n,r)=>zi(e)(t,n,r),fm=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return zo(e)(t,n,o)},hm=e=>(t,n,r)=>zo(e)(t,n,r),pm=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Po(e)(t,n,o)},mm=e=>async(t,n,r)=>Po(e)(t,n,r),gm=/^[cC][^\s-]{8,}$/,xm=/^[0-9a-z]+$/,ym=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,vm=/^[0-9a-vA-V]{20}$/,bm=/^[A-Za-z0-9]{27}$/,wm=/^[a-zA-Z0-9_-]{21}$/,km=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,_m=/^([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})$/,Oa=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)$/,Sm=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Cm="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function jm(){return new RegExp(Cm,"u")}const Em=/^(?:(?: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])$/,Nm=/^(([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}|:))$/,Tm=/^((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])$/,Am=/^(([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])$/,Im=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,fu=/^[A-Za-z0-9_-]*$/,zm=/^\+[1-9]\d{6,14}$/,hu="(?:(?:\\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])))",Pm=new RegExp(`^${hu}$`);function pu(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 Rm(e){return new RegExp(`^${pu(e)}$`)}function Om(e){const t=pu({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(`^${hu}T(?:${r})$`)}const Dm=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Mm=/^-?\d+$/,mu=/^-?\d+(?:\.\d+)?$/,Lm=/^(?:true|false)$/i,Fm=/^null$/i,$m=/^[^A-Z]*$/,Bm=/^[^a-z]*$/,ut=Q("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),gu={number:"number",bigint:"bigint",object:"date"},xu=Q("$ZodCheckLessThan",(e,t)=>{ut.init(e,t);const n=gu[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yu=Q("$ZodCheckGreaterThan",(e,t)=>{ut.init(e,t);const n=gu[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Um=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):Wp(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})}}),Zm=Q("$ZodCheckNumberFormat",(e,t)=>{ut.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,s]=Gp[t.format];e._zod.onattach.push(i=>{const a=i._zod.bag;a.format=t.format,a.minimum=o,a.maximum=s,n&&(a.pattern=Mm)}),e._zod.check=i=>{const a=i.value;if(n){if(!Number.isInteger(a)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Vm=Q("$ZodCheckMaxLength",(e,t)=>{var n;ut.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Ni(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const i=Ai(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Wm=Q("$ZodCheckMinLength",(e,t)=>{var n;ut.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Ni(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const i=Ai(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Hm=Q("$ZodCheckLengthEquals",(e,t)=>{var n;ut.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Ni(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const i=Ai(o),a=s>t.length;r.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Ro=Q("$ZodCheckStringFormat",(e,t)=>{var n,r;ut.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),qm=Q("$ZodCheckRegex",(e,t)=>{Ro.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})}}),Km=Q("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=$m),Ro.init(e,t)}),Jm=Q("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Bm),Ro.init(e,t)}),Gm=Q("$ZodCheckIncludes",(e,t)=>{ut.init(e,t);const n=Zn(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Ym=Q("$ZodCheckStartsWith",(e,t)=>{ut.init(e,t);const n=new RegExp(`^${Zn(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Xm=Q("$ZodCheckEndsWith",(e,t)=>{ut.init(e,t);const n=new RegExp(`.*${Zn(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Qm=Q("$ZodCheckOverwrite",(e,t)=>{ut.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class eg{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(i=>i),o=Math.min(...r.map(i=>i.length-i.trimStart().length)),s=r.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,n=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...n,o.join(`
|
|
3
|
+
`))}}const tg={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=tg;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const s of o._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(i,a,c)=>{let u=zn(i),d;for(const h of a){if(h._zod.def.when){if(!h._zod.def.when(i))continue}else if(u)continue;const p=i.issues.length,f=h._zod.check(i);if(f instanceof Promise&&c?.async===!1)throw new Dn;if(d||f instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await f,i.issues.length!==p&&(u||(u=zn(i,p)))});else{if(i.issues.length===p)continue;u||(u=zn(i,p))}}return d?d.then(()=>i):i},s=(i,a,c)=>{if(zn(i))return i.aborted=!0,i;const u=o(a,r,c);if(u instanceof Promise){if(c.async===!1)throw new Dn;return u.then(d=>e._zod.parse(d,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){const u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(d=>s(d,i,a)):s(u,i,a)}const c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Dn;return c.then(u=>o(u,r,a))}return o(c,r,a)}}Te(e,"~standard",()=>({validate:o=>{try{const s=im(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return am(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Pi=Q("$ZodString",(e,t)=>{Ue.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Dm(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)=>{Ro.init(e,t),Pi.init(e,t)}),ng=Q("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=_m),Ve.init(e,t)}),rg=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=Oa(r))}else t.pattern??(t.pattern=Oa());Ve.init(e,t)}),og=Q("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Sm),Ve.init(e,t)}),sg=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})}}}),ig=Q("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=jm()),Ve.init(e,t)}),ag=Q("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=wm),Ve.init(e,t)}),lg=Q("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=gm),Ve.init(e,t)}),cg=Q("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=xm),Ve.init(e,t)}),ug=Q("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ym),Ve.init(e,t)}),dg=Q("$ZodXID",(e,t)=>{t.pattern??(t.pattern=vm),Ve.init(e,t)}),fg=Q("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=bm),Ve.init(e,t)}),hg=Q("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Om(t)),Ve.init(e,t)}),pg=Q("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Pm),Ve.init(e,t)}),mg=Q("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Rm(t)),Ve.init(e,t)}),gg=Q("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=km),Ve.init(e,t)}),xg=Q("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Em),Ve.init(e,t),e._zod.bag.format="ipv4"}),yg=Q("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Nm),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})}}}),vg=Q("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Tm),Ve.init(e,t)}),bg=Q("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Am),Ve.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,s]=r;if(!s)throw new Error;const i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function vu(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const wg=Q("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Im),Ve.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{vu(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function kg(e){if(!fu.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return vu(n)}const _g=Q("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=fu),Ve.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{kg(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Sg=Q("$ZodE164",(e,t)=>{t.pattern??(t.pattern=zm),Ve.init(e,t)});function Cg(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 jg=Q("$ZodJWT",(e,t)=>{Ve.init(e,t),e._zod.check=n=>{Cg(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),bu=Q("$ZodNumber",(e,t)=>{Ue.init(e,t),e._zod.pattern=e._zod.bag.pattern??mu,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),Eg=Q("$ZodNumberFormat",(e,t)=>{Zm.init(e,t),bu.init(e,t)}),Ng=Q("$ZodBoolean",(e,t)=>{Ue.init(e,t),e._zod.pattern=Lm,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}}),Tg=Q("$ZodNull",(e,t)=>{Ue.init(e,t),e._zod.pattern=Fm,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}}),Ag=Q("$ZodUnknown",(e,t)=>{Ue.init(e,t),e._zod.parse=n=>n}),Ig=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 Da(e,t,n){e.issues.length&&t.issues.push(...Pn(n,e.issues)),t.value[n]=e.value}const zg=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 s=[];for(let i=0;i<o.length;i++){const a=o[i],c=t.element._zod.run({value:a,issues:[]},r);c instanceof Promise?s.push(c.then(u=>Da(u,n,i))):Da(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function ao(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Pn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function wu(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=Jp(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ku(e,t,n,r,o,s){const i=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,d=c.optout==="optional";for(const h in t){if(a.has(h))continue;if(u==="never"){i.push(h);continue}const p=c.run({value:t[h],issues:[]},r);p instanceof Promise?e.push(p.then(f=>ao(f,n,h,t,d))):ao(p,n,h,t,d)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}const Pg=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=Io(()=>wu(t));Te(e._zod,"propValues",()=>{const a=t.shape,c={};for(const u in a){const d=a[u]._zod;if(d.values){c[u]??(c[u]=new Set);for(const h of d.values)c[u].add(h)}}return c});const o=br,s=t.catchall;let i;e._zod.parse=(a,c)=>{i??(i=r.value);const u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};const d=[],h=i.shape;for(const p of i.keys){const f=h[p],y=f._zod.optout==="optional",m=f._zod.run({value:u[p],issues:[]},c);m instanceof Promise?d.push(m.then(x=>ao(x,a,p,u,y))):ao(m,a,p,u,y)}return s?ku(d,u,a,c,r.value,e):d.length?Promise.all(d).then(()=>a):a}}),Rg=Q("$ZodObjectJIT",(e,t)=>{Pg.init(e,t);const n=e._zod.parse,r=Io(()=>wu(t)),o=p=>{const f=new eg(["shape","payload","ctx"]),y=r.value,m=w=>{const S=Ra(w);return`shape[${S}]._zod.run({ value: input[${S}], issues: [] }, ctx)`};f.write("const input = payload.value;");const x=Object.create(null);let g=0;for(const w of y.keys)x[w]=`key_${g++}`;f.write("const newResult = {};");for(const w of y.keys){const S=x[w],j=Ra(w),N=p[w]?._zod?.optout==="optional";f.write(`const ${S} = ${m(w)};`),N?f.write(`
|
|
4
|
+
if (${S}.issues.length) {
|
|
5
|
+
if (${j} in input) {
|
|
6
|
+
payload.issues = payload.issues.concat(${S}.issues.map(iss => ({
|
|
7
|
+
...iss,
|
|
8
|
+
path: iss.path ? [${j}, ...iss.path] : [${j}]
|
|
9
|
+
})));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (${S}.value === undefined) {
|
|
14
|
+
if (${j} in input) {
|
|
15
|
+
newResult[${j}] = undefined;
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
newResult[${j}] = ${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 ? [${j}, ...iss.path] : [${j}]
|
|
26
|
+
})));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (${S}.value === undefined) {
|
|
30
|
+
if (${j} in input) {
|
|
31
|
+
newResult[${j}] = undefined;
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
newResult[${j}] = ${S}.value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
`)}f.write("payload.value = newResult;"),f.write("return payload;");const b=f.compile();return(w,S)=>b(p,w,S)};let s;const i=br,a=!su.jitless,u=a&&qp.value,d=t.catchall;let h;e._zod.parse=(p,f)=>{h??(h=r.value);const y=p.value;return i(y)?a&&u&&f?.async===!1&&f.jitless!==!0?(s||(s=o(t.shape)),p=s(p,f),d?ku([],y,p,f,h,e):p):n(p,f):(p.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),p)}});function Ma(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!zn(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(i=>en(i,r,Qt())))}),t)}const _u=Q("$ZodUnion",(e,t)=>{Ue.init(e,t),Te(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Te(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Te(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Te(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>Ti(s.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,s)=>{if(n)return r(o,s);let i=!1;const a=[];for(const c of t.options){const u=c._zod.run({value:o.value,issues:[]},s);if(u instanceof Promise)a.push(u),i=!0;else{if(u.issues.length===0)return u;a.push(u)}}return i?Promise.all(a).then(c=>Ma(c,o,e,s)):Ma(a,o,e,s)}}),Og=Q("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,_u.init(e,t);const n=e._zod.parse;Te(e._zod,"propValues",()=>{const o={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(const u of c)o[a].add(u)}}return o});const r=Io(()=>{const o=t.options,s=new Map;for(const i of o){const a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(o,s)=>{const i=o.value;if(!br(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;const a=r.value.get(i?.[t.discriminator]);return a?a._zod.run(o,s):t.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:i,path:[t.discriminator],inst:e}),o)}}),Dg=Q("$ZodIntersection",(e,t)=>{Ue.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),i=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>La(n,c,u)):La(n,s,i)}});function Ws(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Un(e)&&Un(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of r){const i=Ws(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r],i=Ws(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function La(e,t,n){const r=new Map;let o;for(const a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(a);const s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&o&&e.issues.push({...o,keys:s}),zn(e))return e;const i=Ws(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Mg=Q("$ZodRecord",(e,t)=>{Ue.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Un(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[],i=t.keyType._zod.values;if(i){n.value={};const a=new Set;for(const u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);const d=t.valueType._zod.run({value:o[u],issues:[]},r);d instanceof Promise?s.push(d.then(h=>{h.issues.length&&n.issues.push(...Pn(u,h.issues)),n.value[u]=h.value})):(d.issues.length&&n.issues.push(...Pn(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"&&mu.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=>en(h,r,Qt())),input:a,path:[a],inst:e});continue}const d=t.valueType._zod.run({value:o[a],issues:[]},r);d instanceof Promise?s.push(d.then(h=>{h.issues.length&&n.issues.push(...Pn(a,h.issues)),n.value[c.value]=h.value})):(d.issues.length&&n.issues.push(...Pn(a,d.issues)),n.value[c.value]=d.value)}}return s.length?Promise.all(s).then(()=>n):n}}),Lg=Q("$ZodEnum",(e,t)=>{Ue.init(e,t);const n=iu(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Kp.has(typeof o)).map(o=>typeof o=="string"?Zn(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:n,input:i,inst:e}),o}}),Fg=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"?Zn(r):r?Zn(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),$g=Q("$ZodTransform",(e,t)=>{Ue.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ou(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(n.value=i,n));if(o instanceof Promise)throw new Dn;return n.value=o,n}});function Fa(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Su=Q("$ZodOptional",(e,t)=>{Ue.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Te(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Te(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Ti(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Fa(s,n.value)):Fa(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Bg=Q("$ZodExactOptional",(e,t)=>{Su.init(e,t),Te(e._zod,"values",()=>t.innerType._zod.values),Te(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Ug=Q("$ZodNullable",(e,t)=>{Ue.init(e,t),Te(e._zod,"optin",()=>t.innerType._zod.optin),Te(e._zod,"optout",()=>t.innerType._zod.optout),Te(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Ti(n.source)}|null)$`):void 0}),Te(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Zg=Q("$ZodDefault",(e,t)=>{Ue.init(e,t),e._zod.optin="optional",Te(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>$a(s,t)):$a(o,t)}});function $a(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Vg=Q("$ZodPrefault",(e,t)=>{Ue.init(e,t),e._zod.optin="optional",Te(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Wg=Q("$ZodNonOptional",(e,t)=>{Ue.init(e,t),Te(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Ba(s,e)):Ba(o,e)}});function Ba(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 Hg=Q("$ZodCatch",(e,t)=>{Ue.init(e,t),Te(e._zod,"optin",()=>t.innerType._zod.optin),Te(e._zod,"optout",()=>t.innerType._zod.optout),Te(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>en(i,r,Qt()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>en(s,r,Qt()))},input:n.value}),n.issues=[]),n)}}),qg=Q("$ZodPipe",(e,t)=>{Ue.init(e,t),Te(e._zod,"values",()=>t.in._zod.values),Te(e._zod,"optin",()=>t.in._zod.optin),Te(e._zod,"optout",()=>t.out._zod.optout),Te(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(i=>Lr(i,t.in,r)):Lr(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>Lr(s,t.out,r)):Lr(o,t.out,r)}});function Lr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Kg=Q("$ZodReadonly",(e,t)=>{Ue.init(e,t),Te(e._zod,"propValues",()=>t.innerType._zod.propValues),Te(e._zod,"values",()=>t.innerType._zod.values),Te(e._zod,"optin",()=>t.innerType?._zod?.optin),Te(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Ua):Ua(o)}});function Ua(e){return e.value=Object.freeze(e.value),e}const Jg=Q("$ZodLazy",(e,t)=>{Ue.init(e,t),Te(e._zod,"innerType",()=>t.getter()),Te(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Te(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Te(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Te(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),Gg=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(s=>Za(s,n,r,e));Za(o,n,r,e)}});function Za(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(wr(o))}}var Va;class Yg{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 Xg(){return new Yg}(Va=globalThis).__zod_globalRegistry??(Va.__zod_globalRegistry=Xg());const mr=globalThis.__zod_globalRegistry;function Qg(e,t){return new e({type:"string",...ye(t)})}function ex(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ye(t)})}function Wa(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ye(t)})}function tx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ye(t)})}function nx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ye(t)})}function rx(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ye(t)})}function ox(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ye(t)})}function sx(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ye(t)})}function ix(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ye(t)})}function ax(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ye(t)})}function lx(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ye(t)})}function cx(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ye(t)})}function ux(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ye(t)})}function dx(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ye(t)})}function fx(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ye(t)})}function hx(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ye(t)})}function px(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ye(t)})}function mx(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ye(t)})}function gx(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ye(t)})}function xx(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ye(t)})}function yx(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ye(t)})}function vx(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ye(t)})}function bx(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ye(t)})}function wx(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ye(t)})}function kx(e,t){return new e({type:"string",format:"date",check:"string_format",...ye(t)})}function _x(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ye(t)})}function Sx(e,t){return new e({type:"string",format:"duration",check:"string_format",...ye(t)})}function Cx(e,t){return new e({type:"number",checks:[],...ye(t)})}function jx(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ye(t)})}function Ex(e,t){return new e({type:"boolean",...ye(t)})}function Nx(e,t){return new e({type:"null",...ye(t)})}function Tx(e){return new e({type:"unknown"})}function Ax(e,t){return new e({type:"never",...ye(t)})}function Ha(e,t){return new xu({check:"less_than",...ye(t),value:e,inclusive:!1})}function fs(e,t){return new xu({check:"less_than",...ye(t),value:e,inclusive:!0})}function qa(e,t){return new yu({check:"greater_than",...ye(t),value:e,inclusive:!1})}function hs(e,t){return new yu({check:"greater_than",...ye(t),value:e,inclusive:!0})}function Ka(e,t){return new Um({check:"multiple_of",...ye(t),value:e})}function Cu(e,t){return new Vm({check:"max_length",...ye(t),maximum:e})}function lo(e,t){return new Wm({check:"min_length",...ye(t),minimum:e})}function ju(e,t){return new Hm({check:"length_equals",...ye(t),length:e})}function Ix(e,t){return new qm({check:"string_format",format:"regex",...ye(t),pattern:e})}function zx(e){return new Km({check:"string_format",format:"lowercase",...ye(e)})}function Px(e){return new Jm({check:"string_format",format:"uppercase",...ye(e)})}function Rx(e,t){return new Gm({check:"string_format",format:"includes",...ye(t),includes:e})}function Ox(e,t){return new Ym({check:"string_format",format:"starts_with",...ye(t),prefix:e})}function Dx(e,t){return new Xm({check:"string_format",format:"ends_with",...ye(t),suffix:e})}function Yn(e){return new Qm({check:"overwrite",tx:e})}function Mx(e){return Yn(t=>t.normalize(e))}function Lx(){return Yn(e=>e.trim())}function Fx(){return Yn(e=>e.toLowerCase())}function $x(){return Yn(e=>e.toUpperCase())}function Bx(){return Yn(e=>Hp(e))}function Ux(e,t,n){return new e({type:"array",element:t,...ye(n)})}function Zx(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ye(n)})}function Vx(e){const t=Wx(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(wr(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(wr(o))}},e(n.value,n)));return t}function Wx(e,t){const n=new ut({check:"custom",...ye(t)});return n._zod.check=e,n}function Eu(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??mr,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Ke(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{const d={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,d);else{const p=i.schema,f=t.processors[o.type];if(!f)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);f(e,t,p,d)}const h=e._zod.parent;h&&(i.ref||(i.ref=h),Ke(h,t,d),t.seen.get(h).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&ot(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&i.schema._prefault&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Nu(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const i of e.seen.entries()){const a=e.metadataRegistry.get(i[0])?.id;if(a){const c=r.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,i[0])}}const o=i=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const h=e.external.registry.get(i[0])?.id,p=e.external.uri??(y=>y);if(h)return{ref:p(h)};const f=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=f,{defId:f,ref:`${p("__shared")}#/${a}/${f}`}}if(i[1]===n)return{ref:"#"};const u=`#/${a}/`,d=i[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},s=i=>{if(i[1].schema.$ref)return;const a=i[1],{ref:c,defId:u}=o(i);a.def={...a.schema},u&&(a.defId=u);const d=a.schema;for(const h in d)delete d[h];d.$ref=c};if(e.cycles==="throw")for(const i of e.seen.entries()){const a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
38
|
+
|
|
39
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const a=i[1];if(t===i[0]){s(i);continue}if(e.external){const u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function Tu(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=i=>{const a=e.seen.get(i);if(a.ref===null)return;const c=a.def??a.schema,u={...c},d=a.ref;if(a.ref=null,d){r(d);const p=e.seen.get(d),f=p.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(f)):Object.assign(c,f),Object.assign(c,u),i._zod.parent===d)for(const m in c)m==="$ref"||m==="allOf"||m in u||delete c[m];if(f.$ref&&p.def)for(const m in c)m==="$ref"||m==="allOf"||m in p.def&&JSON.stringify(c[m])===JSON.stringify(p.def[m])&&delete c[m]}const h=i._zod.parent;if(h&&h!==d){r(h);const p=e.seen.get(h);if(p?.schema.$ref&&(c.$ref=p.schema.$ref,p.def))for(const f in c)f==="$ref"||f==="allOf"||f in p.def&&JSON.stringify(c[f])===JSON.stringify(p.def[f])&&delete c[f]}e.override({zodSchema:i,jsonSchema:c,path:a.path??[]})};for(const i of[...e.seen.entries()].reverse())r(i[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const i=e.external.registry.get(t)?.id;if(!i)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(i)}Object.assign(o,n.def??n.schema);const s=e.external?.defs??{};for(const i of e.seen.entries()){const a=i[1];a.def&&a.defId&&(s[a.defId]=a.def)}e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{const i=JSON.parse(JSON.stringify(o));return Object.defineProperty(i,"~standard",{value:{...t["~standard"],jsonSchema:{input:co(t,"input",e.processors),output:co(t,"output",e.processors)}},enumerable:!1,writable:!1}),i}catch{throw new Error("Error converting schema to JSON.")}}function ot(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return ot(r.element,n);if(r.type==="set")return ot(r.valueType,n);if(r.type==="lazy")return ot(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return ot(r.innerType,n);if(r.type==="intersection")return ot(r.left,n)||ot(r.right,n);if(r.type==="record"||r.type==="map")return ot(r.keyType,n)||ot(r.valueType,n);if(r.type==="pipe")return ot(r.in,n)||ot(r.out,n);if(r.type==="object"){for(const o in r.shape)if(ot(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(ot(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(ot(o,n))return!0;return!!(r.rest&&ot(r.rest,n))}return!1}const Hx=(e,t={})=>n=>{const r=Eu({...n,processors:t});return Ke(e,r),Nu(r,e),Tu(r,e)},co=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=Eu({...o??{},target:s,io:t,processors:n});return Ke(e,i),Nu(i,e),Tu(i,e)},qx={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Kx=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=qx[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}))])}},Jx=(e,t,n,r)=>{const o=n,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;typeof a=="string"&&a.includes("int")?o.type="integer":o.type="number",typeof d=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=d,o.exclusiveMinimum=!0):o.exclusiveMinimum=d),typeof s=="number"&&(o.minimum=s,typeof d=="number"&&t.target!=="draft-04"&&(d>=s?delete o.minimum:delete o.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u),typeof i=="number"&&(o.maximum=i,typeof u=="number"&&t.target!=="draft-04"&&(u<=i?delete o.maximum:delete o.exclusiveMaximum)),typeof c=="number"&&(o.multipleOf=c)},Gx=(e,t,n,r)=>{n.type="boolean"},Yx=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},Xx=(e,t,n,r)=>{n.not={}},Qx=(e,t,n,r)=>{},e0=(e,t,n,r)=>{const o=e._zod.def,s=iu(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},t0=(e,t,n,r)=>{const o=e._zod.def,s=[];for(const i of o.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){const i=s[0];n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[i]:n.const=i}else s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),s.every(i=>typeof i=="boolean")&&(n.type="boolean"),s.every(i=>i===null)&&(n.type="null"),n.enum=s},n0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},r0=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},o0=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=Ke(s.element,t,{...r,path:[...r.path,"items"]})},s0=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object",o.properties={};const i=s.shape;for(const u in i)o.properties[u]=Ke(i[u],t,{...r,path:[...r.path,"properties",u]});const a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{const d=s.shape[u]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));c.size>0&&(o.required=Array.from(c)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=Ke(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},i0=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>Ke(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},a0=(e,t,n,r)=>{const o=e._zod.def,s=Ke(o.left,t,{...r,path:[...r.path,"allOf",0]}),i=Ke(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];n.allOf=c},l0=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object";const i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){const d=Ke(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const h of c)o.patternProperties[h.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Ke(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=Ke(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const u=i._zod.values;if(u){const d=[...u].filter(h=>typeof h=="string"||typeof h=="number");d.length>0&&(o.required=d)}},c0=(e,t,n,r)=>{const o=e._zod.def,s=Ke(o.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},u0=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},d0=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},f0=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},h0=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},p0=(e,t,n,r)=>{const o=e._zod.def,s=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Ke(s,t,r);const i=t.seen.get(e);i.ref=s},m0=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},Au=(e,t,n,r)=>{const o=e._zod.def;Ke(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},g0=(e,t,n,r)=>{const o=e._zod.innerType;Ke(o,t,r);const s=t.seen.get(e);s.ref=o},x0=Q("ZodISODateTime",(e,t)=>{hg.init(e,t),He.init(e,t)});function y0(e){return wx(x0,e)}const v0=Q("ZodISODate",(e,t)=>{pg.init(e,t),He.init(e,t)});function b0(e){return kx(v0,e)}const w0=Q("ZodISOTime",(e,t)=>{mg.init(e,t),He.init(e,t)});function k0(e){return _x(w0,e)}const _0=Q("ZodISODuration",(e,t)=>{gg.init(e,t),He.init(e,t)});function S0(e){return Sx(_0,e)}const C0=(e,t)=>{uu.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>sm(e,n)},flatten:{value:n=>om(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Vs,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Vs,2)}},isEmpty:{get(){return e.issues.length===0}}})},wt=Q("ZodError",C0,{Parent:Error}),j0=Ii(wt),E0=zi(wt),N0=zo(wt),T0=Po(wt),A0=lm(wt),I0=cm(wt),z0=um(wt),P0=dm(wt),R0=fm(wt),O0=hm(wt),D0=pm(wt),M0=mm(wt),Ze=Q("ZodType",(e,t)=>(Ue.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:co(e,"input"),output:co(e,"output")}}),e.toJSONSchema=Hx(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(rn(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)=>on(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>j0(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>N0(e,n,r),e.parseAsync=async(n,r)=>E0(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>T0(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>A0(e,n,r),e.decode=(n,r)=>I0(e,n,r),e.encodeAsync=async(n,r)=>z0(e,n,r),e.decodeAsync=async(n,r)=>P0(e,n,r),e.safeEncode=(n,r)=>R0(e,n,r),e.safeDecode=(n,r)=>O0(e,n,r),e.safeEncodeAsync=async(n,r)=>D0(e,n,r),e.safeDecodeAsync=async(n,r)=>M0(e,n,r),e.refine=(n,r)=>e.check(P1(n,r)),e.superRefine=n=>e.check(R1(n)),e.overwrite=n=>e.check(Yn(n)),e.optional=()=>Xa(e),e.exactOptional=()=>y1(e),e.nullable=()=>Qa(e),e.nullish=()=>Xa(Qa(e)),e.nonoptional=n=>S1(e,n),e.array=()=>Re(e),e.or=n=>Kt([e,n]),e.and=n=>f1(e,n),e.transform=n=>el(e,g1(n)),e.default=n=>w1(e,n),e.prefault=n=>_1(e,n),e.catch=n=>j1(e,n),e.pipe=n=>el(e,n),e.readonly=()=>T1(e),e.describe=n=>{const r=e.clone();return mr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return mr.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return mr.get(e);const r=e.clone();return mr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Iu=Q("_ZodString",(e,t)=>{Pi.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Kx(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(Ix(...r)),e.includes=(...r)=>e.check(Rx(...r)),e.startsWith=(...r)=>e.check(Ox(...r)),e.endsWith=(...r)=>e.check(Dx(...r)),e.min=(...r)=>e.check(lo(...r)),e.max=(...r)=>e.check(Cu(...r)),e.length=(...r)=>e.check(ju(...r)),e.nonempty=(...r)=>e.check(lo(1,...r)),e.lowercase=r=>e.check(zx(r)),e.uppercase=r=>e.check(Px(r)),e.trim=()=>e.check(Lx()),e.normalize=(...r)=>e.check(Mx(...r)),e.toLowerCase=()=>e.check(Fx()),e.toUpperCase=()=>e.check($x()),e.slugify=()=>e.check(Bx())}),L0=Q("ZodString",(e,t)=>{Pi.init(e,t),Iu.init(e,t),e.email=n=>e.check(ex(F0,n)),e.url=n=>e.check(sx($0,n)),e.jwt=n=>e.check(bx(t1,n)),e.emoji=n=>e.check(ix(B0,n)),e.guid=n=>e.check(Wa(Ja,n)),e.uuid=n=>e.check(tx(Fr,n)),e.uuidv4=n=>e.check(nx(Fr,n)),e.uuidv6=n=>e.check(rx(Fr,n)),e.uuidv7=n=>e.check(ox(Fr,n)),e.nanoid=n=>e.check(ax(U0,n)),e.guid=n=>e.check(Wa(Ja,n)),e.cuid=n=>e.check(lx(Z0,n)),e.cuid2=n=>e.check(cx(V0,n)),e.ulid=n=>e.check(ux(W0,n)),e.base64=n=>e.check(xx(X0,n)),e.base64url=n=>e.check(yx(Q0,n)),e.xid=n=>e.check(dx(H0,n)),e.ksuid=n=>e.check(fx(q0,n)),e.ipv4=n=>e.check(hx(K0,n)),e.ipv6=n=>e.check(px(J0,n)),e.cidrv4=n=>e.check(mx(G0,n)),e.cidrv6=n=>e.check(gx(Y0,n)),e.e164=n=>e.check(vx(e1,n)),e.datetime=n=>e.check(y0(n)),e.date=n=>e.check(b0(n)),e.time=n=>e.check(k0(n)),e.duration=n=>e.check(S0(n))});function q(e){return Qg(L0,e)}const He=Q("ZodStringFormat",(e,t)=>{Ve.init(e,t),Iu.init(e,t)}),F0=Q("ZodEmail",(e,t)=>{og.init(e,t),He.init(e,t)}),Ja=Q("ZodGUID",(e,t)=>{ng.init(e,t),He.init(e,t)}),Fr=Q("ZodUUID",(e,t)=>{rg.init(e,t),He.init(e,t)}),$0=Q("ZodURL",(e,t)=>{sg.init(e,t),He.init(e,t)}),B0=Q("ZodEmoji",(e,t)=>{ig.init(e,t),He.init(e,t)}),U0=Q("ZodNanoID",(e,t)=>{ag.init(e,t),He.init(e,t)}),Z0=Q("ZodCUID",(e,t)=>{lg.init(e,t),He.init(e,t)}),V0=Q("ZodCUID2",(e,t)=>{cg.init(e,t),He.init(e,t)}),W0=Q("ZodULID",(e,t)=>{ug.init(e,t),He.init(e,t)}),H0=Q("ZodXID",(e,t)=>{dg.init(e,t),He.init(e,t)}),q0=Q("ZodKSUID",(e,t)=>{fg.init(e,t),He.init(e,t)}),K0=Q("ZodIPv4",(e,t)=>{xg.init(e,t),He.init(e,t)}),J0=Q("ZodIPv6",(e,t)=>{yg.init(e,t),He.init(e,t)}),G0=Q("ZodCIDRv4",(e,t)=>{vg.init(e,t),He.init(e,t)}),Y0=Q("ZodCIDRv6",(e,t)=>{bg.init(e,t),He.init(e,t)}),X0=Q("ZodBase64",(e,t)=>{wg.init(e,t),He.init(e,t)}),Q0=Q("ZodBase64URL",(e,t)=>{_g.init(e,t),He.init(e,t)}),e1=Q("ZodE164",(e,t)=>{Sg.init(e,t),He.init(e,t)}),t1=Q("ZodJWT",(e,t)=>{jg.init(e,t),He.init(e,t)}),zu=Q("ZodNumber",(e,t)=>{bu.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,s)=>Jx(e,r,o),e.gt=(r,o)=>e.check(qa(r,o)),e.gte=(r,o)=>e.check(hs(r,o)),e.min=(r,o)=>e.check(hs(r,o)),e.lt=(r,o)=>e.check(Ha(r,o)),e.lte=(r,o)=>e.check(fs(r,o)),e.max=(r,o)=>e.check(fs(r,o)),e.int=r=>e.check(Ga(r)),e.safe=r=>e.check(Ga(r)),e.positive=r=>e.check(qa(0,r)),e.nonnegative=r=>e.check(hs(0,r)),e.negative=r=>e.check(Ha(0,r)),e.nonpositive=r=>e.check(fs(0,r)),e.multipleOf=(r,o)=>e.check(Ka(r,o)),e.step=(r,o)=>e.check(Ka(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 Cx(zu,e)}const n1=Q("ZodNumberFormat",(e,t)=>{Eg.init(e,t),zu.init(e,t)});function Ga(e){return jx(n1,e)}const r1=Q("ZodBoolean",(e,t)=>{Ng.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gx(e,n,r)});function nt(e){return Ex(r1,e)}const o1=Q("ZodNull",(e,t)=>{Tg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yx(e,n,r)});function Hs(e){return Nx(o1,e)}const s1=Q("ZodUnknown",(e,t)=>{Ag.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qx()});function Ya(){return Tx(s1)}const i1=Q("ZodNever",(e,t)=>{Ig.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xx(e,n,r)});function a1(e){return Ax(i1,e)}const l1=Q("ZodArray",(e,t)=>{zg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>o0(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(lo(n,r)),e.nonempty=n=>e.check(lo(1,n)),e.max=(n,r)=>e.check(Cu(n,r)),e.length=(n,r)=>e.check(ju(n,r)),e.unwrap=()=>e.element});function Re(e,t){return Ux(l1,e,t)}const c1=Q("ZodObject",(e,t)=>{Rg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>s0(e,n,r,o),Te(e,"shape",()=>t.shape),e.keyof=()=>lt(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Ya()}),e.loose=()=>e.clone({...e._zod.def,catchall:Ya()}),e.strict=()=>e.clone({...e._zod.def,catchall:a1()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Qp(e,n),e.safeExtend=n=>em(e,n),e.merge=n=>tm(e,n),e.pick=n=>Yp(e,n),e.omit=n=>Xp(e,n),e.partial=(...n)=>nm(Ru,e,n[0]),e.required=(...n)=>rm(Ou,e,n[0])});function ae(e,t){const n={type:"object",shape:e??{},...ye(t)};return new c1(n)}const Pu=Q("ZodUnion",(e,t)=>{_u.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>i0(e,n,r,o),e.options=t.options});function Kt(e,t){return new Pu({type:"union",options:e,...ye(t)})}const u1=Q("ZodDiscriminatedUnion",(e,t)=>{Pu.init(e,t),Og.init(e,t)});function bn(e,t,n){return new u1({type:"union",options:t,discriminator:e,...ye(n)})}const d1=Q("ZodIntersection",(e,t)=>{Dg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>a0(e,n,r,o)});function f1(e,t){return new d1({type:"intersection",left:e,right:t})}const h1=Q("ZodRecord",(e,t)=>{Mg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>l0(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Wt(e,t,n){return new h1({type:"record",keyType:e,valueType:t,...ye(n)})}const qs=Q("ZodEnum",(e,t)=>{Lg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(r,o,s)=>e0(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new qs({...t,checks:[],...ye(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new qs({...t,checks:[],...ye(o),entries:s})}});function lt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new qs({type:"enum",entries:n,...ye(t)})}const p1=Q("ZodLiteral",(e,t)=>{Fg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>t0(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 p1({type:"literal",values:Array.isArray(e)?e:[e],...ye(t)})}const m1=Q("ZodTransform",(e,t)=>{$g.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>r0(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ou(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(wr(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(wr(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function g1(e){return new m1({type:"transform",transform:e})}const Ru=Q("ZodOptional",(e,t)=>{Su.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Au(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Xa(e){return new Ru({type:"optional",innerType:e})}const x1=Q("ZodExactOptional",(e,t)=>{Bg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Au(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function y1(e){return new x1({type:"optional",innerType:e})}const v1=Q("ZodNullable",(e,t)=>{Ug.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>c0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Qa(e){return new v1({type:"nullable",innerType:e})}const b1=Q("ZodDefault",(e,t)=>{Zg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>d0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function w1(e,t){return new b1({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():lu(t)}})}const k1=Q("ZodPrefault",(e,t)=>{Vg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>f0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function _1(e,t){return new k1({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():lu(t)}})}const Ou=Q("ZodNonOptional",(e,t)=>{Wg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>u0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function S1(e,t){return new Ou({type:"nonoptional",innerType:e,...ye(t)})}const C1=Q("ZodCatch",(e,t)=>{Hg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>h0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function j1(e,t){return new C1({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const E1=Q("ZodPipe",(e,t)=>{qg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>p0(e,n,r,o),e.in=t.in,e.out=t.out});function el(e,t){return new E1({type:"pipe",in:e,out:t})}const N1=Q("ZodReadonly",(e,t)=>{Kg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>m0(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function T1(e){return new N1({type:"readonly",innerType:e})}const A1=Q("ZodLazy",(e,t)=>{Jg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>g0(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function I1(e){return new A1({type:"lazy",getter:e})}const z1=Q("ZodCustom",(e,t)=>{Gg.init(e,t),Ze.init(e,t),e._zod.processJSONSchema=(n,r,o)=>n0(e,n)});function P1(e,t={}){return Zx(z1,e,t)}function R1(e){return Vx(e)}const Vn=I1(()=>Kt([q(),ve(),nt(),Hs(),Re(Vn),Wt(q(),Vn)]));const Ri=ae({type:q(),ttl:q().optional(),scope:q().optional()}),Oi=ae({type:Se("text"),text:q(),cache_control:Ri.optional()}),Du=ae({type:Se("thinking"),thinking:q(),signature:q().optional()}),O1=ae({type:Se("think"),thinking:q(),signature:q().optional()}),D1=ae({type:Se("base64"),media_type:q(),data:q()}),Mu=ae({type:Se("image"),source:D1}),Lu=ae({type:Se("tool_use"),id:q(),name:q(),input:Wt(q(),Vn)}),M1=bn("type",[Oi,Mu]),L1=ae({type:Se("tool_result"),tool_use_id:q().optional(),content:Kt([q(),Re(M1)]),is_error:nt().optional()}),F1=bn("type",[Oi,Du,Mu,Lu,L1]),$1=Kt([q(),Re(F1)]),B1=ae({role:lt(["user","assistant"]),content:$1}),U1=ae({type:Se("text"),text:q(),cache_control:Ri.optional()}),Z1=ae({type:q(),properties:Wt(q(),Wt(q(),Vn)).optional(),required:Re(q()).optional(),additionalProperties:nt().optional(),$schema:q().optional()}),V1=ae({name:q(),description:q().optional(),input_schema:Z1.optional(),cache_control:Ri.optional()}),W1=bn("type",[ae({type:Se("enabled"),budget_tokens:ve()}),ae({type:Se("disabled")}),ae({type:Se("adaptive")})]),Fu=ae({model:q(),messages:Re(B1),system:Re(U1).optional(),tools:Re(V1).optional(),max_tokens:ve().optional(),temperature:ve().optional(),stream:nt().optional(),thinking:W1.optional(),metadata:ae({user_id:q().optional()}).optional()}),Di=bn("type",[Oi,Du,O1,Lu]),H1=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(),$u=ae({id:q(),type:Se("message"),model:q(),role:Se("assistant"),content:Re(Di),stop_reason:q().nullable(),stop_sequence:q().nullable().optional(),usage:H1}).passthrough(),q1=ae({type:Se("message_start"),message:ae({id:q(),type:Se("message"),model:q(),role:Se("assistant"),content:Re(Di),stop_reason:Hs(),stop_sequence:Hs(),usage:ae({input_tokens:ve(),cache_creation_input_tokens:ve().optional(),cache_read_input_tokens:ve().optional()}).passthrough()})}),K1=ae({type:Se("content_block_start"),index:ve(),content_block:Di}),J1=bn("type",[ae({type:Se("text_delta"),text:q()}),ae({type:Se("input_json_delta"),partial_json:q()}),ae({type:Se("thinking_delta"),thinking:q()}),ae({type:Se("signature_delta"),signature:q()})]),G1=ae({type:Se("content_block_delta"),index:ve(),delta:J1}),Y1=ae({type:Se("content_block_stop"),index:ve()}),X1=ae({type:Se("message_delta"),delta:ae({stop_reason:q().nullable(),stop_sequence:q().nullable().optional()}),usage:ae({output_tokens:ve(),input_tokens:ve().optional(),cache_creation_input_tokens:ve().optional(),cache_read_input_tokens:ve().optional()}).passthrough()}),Q1=ae({type:Se("message_stop")}),ey=ae({type:Se("ping")}),ty=ae({type:Se("error"),error:ae({type:q(),message:q()})}),ny=bn("type",[q1,K1,G1,Y1,X1,Q1,ey,ty]),ry=Kt([q(),Re(bn("type",[ae({type:Se("text"),text:q()}),ae({type:Se("image_url"),image_url:ae({url:q(),detail:q().optional()})})]))]),Bu=ae({role:lt(["system","user","assistant","tool"]),content:ry,name:q().optional(),reasoning_content:q().optional(),thinking:q().optional(),think:q().optional()}),oy=ae({name:q(),arguments:q()}),Uu=ae({index:ve().optional(),id:q().optional(),type:Se("function").optional(),function:ae({name:q().optional(),arguments:q().optional()})});Bu.extend({content:Kt([q(),Re(ae({type:Se("text"),text:q()}))]).optional(),function_call:oy.optional(),tool_calls:Re(Uu).optional()});const sy=ae({type:Se("function"),function:ae({name:q(),description:q().optional(),parameters:Wt(q(),Vn)})}),Zu=ae({model:q(),messages:Re(Bu),temperature:ve().optional(),max_tokens:ve().optional(),stream:nt().optional(),tools:Re(sy).optional(),tool_choice:Kt([lt(["auto","none","required"]),ae({type:Se("auto")}),ae({type:Se("none")}),ae({type:Se("function"),function:ae({name:q()})})]).optional(),user:q().optional()}),Vu=ae({role:lt(["assistant"]).optional(),content:q().nullable().optional(),reasoning_content:q().nullable().optional(),thinking:q().nullable().optional(),think:q().nullable().optional(),function_call:ae({name:q().optional(),arguments:q().optional()}).nullable().optional(),tool_calls:Re(ae({index:ve(),id:q().optional(),type:Se("function").optional(),function:ae({name:q().optional(),arguments:q().optional()})})).nullable().optional()}),iy=ae({index:ve(),message:ae({role:lt(["assistant"]),content:q().nullable(),reasoning_content:q().optional(),thinking:q().optional(),think:q().optional(),function_call:ae({name:q(),arguments:q()}).nullable().optional(),tool_calls:Re(Uu).optional()}).optional(),delta:Vu.optional(),finish_reason:q().nullable()}),ay=ae({id:q(),object:Se("chat.completion"),created:ve(),model:q(),choices:Re(iy),usage:ae({prompt_tokens:ve().nullable().optional(),completion_tokens:ve().nullable().optional(),total_tokens:ve().nullable().optional()}).passthrough(),service_tier:q().nullable().optional(),system_fingerprint:q().nullable().optional()}).passthrough(),ly=ae({id:q(),object:Se("chat.completion.chunk"),created:ve(),model:q(),choices:Re(ae({index:ve(),delta:Vu,finish_reason:q().nullable().optional()})),usage:ae({prompt_tokens:ve().nullable().optional(),completion_tokens:ve().nullable().optional(),total_tokens:ve().nullable().optional()}).passthrough().nullable().optional()}).passthrough();function Wu(e){try{const t=JSON.parse(e),n=ay.safeParse(t);return n.success?n.data:null}catch{return null}}const Hu=ae({index:ve(),timestamp:ve(),type:q(),data:Vn}),cy=ae({chunks:Re(Hu),truncated:nt().optional().default(!1)}),Ks=ae({id:ve(),timestamp:q(),method:q(),path:q(),model:q().nullable(),sessionId:q().nullable(),rawRequestBody:q().nullable(),responseStatus:ve().nullable(),responseText:q().nullable(),inputTokens:ve().nullable(),outputTokens:ve().nullable(),cacheCreationInputTokens:ve().nullable(),cacheReadInputTokens:ve().nullable(),elapsedMs:ve().nullable(),streaming:nt(),userAgent:q().nullable(),origin:q().nullable(),rawHeaders:Wt(q(),q()).optional(),headers:Wt(q(),q()).optional(),apiFormat:lt(["anthropic","openai","unknown"]).default("unknown"),isTest:nt().optional().default(!1),providerName:q().nullable().optional(),clientPort:ve().nullable().optional(),clientPid:ve().nullable().optional(),clientCwd:q().nullable().optional(),clientProjectFolder:q().nullable().optional(),streamingChunks:cy.optional(),streamingChunksPath:q().nullable().optional(),error:q().nullable().optional()});ae({model:q()});ae({model:q().optional(),metadata:ae({user_id:q().optional()}).passthrough().optional()});const uy=ae({error:q()});async function In(e,t){const n=await e.json();return t.parse(n)}async function eo(e,t){try{const n=await e.json(),r=uy.safeParse(n);return r.success?r.data.error:t}catch{return t}}async function Mi(e,t,n,r){const o=await fetch(e,n);if(!o.ok){const s=r?.(o)??`Request failed with status ${o.status}`;throw new Error(await eo(o,s))}return In(o,t)}const qu=ae({stripClaudeCodeBillingHeader:nt()}),Js="/api/config";async function dy(e){return Mi(e,qu,void 0,t=>`Failed to fetch ${e}: ${t.status}`)}async function fy(e){return Mi(Js,qu,{method:"PATCH",headers:{"content-type":"application/json"},body:JSON.stringify(e)},t=>`PATCH failed with status ${t.status}`)}function Ku(){const e=nu(Js,dy,{revalidateOnFocus:!1,revalidateIfStale:!1}),{mutate:t}=Zp(),n=e.data?.stripClaudeCodeBillingHeader??!1,r=async o=>{await t(Js,fy({stripClaudeCodeBillingHeader:o}),{optimisticData:{stripClaudeCodeBillingHeader:o},rollbackOnError:!0,revalidate:!1})};return{strip:n,isLoading:e.isLoading,isError:e.error!==void 0,setStrip:r}}function hy(e,t,n){const r=new Array(e);return new Proxy(r,{get(o,s,i){if(typeof s=="string"){const a=s.charCodeAt(0);if(a>=48&&a<=57){const c=+s;if(Number.isInteger(c)&&c>=0&&c<e){let u=o[c];if(!u){const d=t[c*2];u=o[c]={index:c,key:n(c),start:d,size:t[c*2+1],end:d+t[c*2+1],lane:0}}return u}}if(s==="length")return e}return Reflect.get(o,s,i)}})}function Sn(e,t,n){let r=n.initialDeps??[],o,s=!0;function i(){const a=e();return(a.length!==r.length||a.some((u,d)=>r[d]!==u))&&(r=a,o=t(...a),n?.onChange&&!(s&&n.skipInitialOnChange)&&n.onChange(o),s=!1),o}return i.updateDeps=a=>{r=a},i}function tl(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const nl=(e,t)=>Math.abs(e-t)<1.01,py=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}};let ar;const rl=()=>{if(ar!==void 0)return ar;if(typeof navigator>"u")return ar=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return ar=!0;const e=navigator.maxTouchPoints;return ar=navigator.platform==="MacIntel"&&e!==void 0&&e>0},ol=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},my=e=>e,gy=e=>{const t=Math.max(e.startIndex-e.overscan,0),r=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,o=new Array(r);for(let s=0;s<r;s++)o[s]=t+s;return o},xy=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=i=>{const{width:a,height:c}=i;t({width:Math.round(a),height:Math.round(c)})};if(o(ol(n)),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(i=>{const a=()=>{const c=i[0];if(c?.borderBoxSize){const u=c.borderBoxSize[0];if(u){o({width:u.inlineSize,height:u.blockSize});return}}o(ol(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},uo={passive:!0},yy=typeof window>"u"?!0:"onscrollend"in window,vy=(e,t,n)=>{const r=e.scrollElement;if(!r)return;const o=e.targetWindow;if(!o)return;const s=e.options.useScrollendEvent&&yy;let i=0;const a=s?null:py(o,()=>t(i,!1),e.options.isScrollingResetDelay),c=h=>()=>{i=n(r),a?.(),t(i,h)},u=c(!0),d=c(!1);return r.addEventListener("scroll",u,uo),s&&r.addEventListener("scrollend",d,uo),()=>{r.removeEventListener("scroll",u),s&&r.removeEventListener("scrollend",d)}},by=(e,t)=>vy(e,t,n=>{const{horizontal:r,isRtl:o}=e.options;return r?n.scrollLeft*(o&&-1||1):n.scrollTop}),wy=(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"]},ky=(e,{adjustments:t=0,behavior:n},r)=>{var o,s;(s=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||s.call(o,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})},_y=ky;class Sy{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,r,o;return((o=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:o.call(r))??Date.now()},this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(o=>{o.forEach(s=>{const i=()=>{const a=s.target,c=this.indexFromElement(a);if(!a.isConnected){this.observer.unobserve(a);for(const[u,d]of this.elementsCache)if(d===a){this.elementsCache.delete(u);break}return}this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(a,s,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var o;(o=r())==null||o.disconnect(),n=null},observe:o=>{var s;return(s=r())==null?void 0:s.observe(o,{box:"border-box"})},unobserve:o=>{var s;return(s=r())==null?void 0:s.unobserve(o)}}})(),this.range=null,this.setOptions=n=>{var r,o;const s={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:my,rangeExtractor:gy,onChange:()=>{},measureElement:wy,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate"};for(const u in n){const d=n[u];d!==void 0&&(s[u]=d)}const i=this.options;let a=null,c=null;if(i!==void 0&&i.enabled&&s.enabled&&s.anchorTo==="end"&&this.scrollElement!==null){const u=i.count,d=s.count,h=this.getMeasurements(),p=u>0?((r=h[0])==null?void 0:r.key)??i.getItemKey(0):null,f=u>0?((o=h[u-1])==null?void 0:o.key)??i.getItemKey(u-1):null;if(d!==u||u>0&&d>0&&(s.getItemKey(0)!==p||s.getItemKey(d-1)!==f)){const x=u>0?this.getVirtualItemForOffset(this.getScrollOffset())??h[0]:null;x&&(a=[x.key,this.getScrollOffset()-x.start]);const g=s.followOnAppend===!0?"auto":s.followOnAppend||null;g&&d>u&&this.isAtEnd(i.scrollEndThreshold)&&(u===0||s.getItemKey(d-1)!==f)&&(c=g)}}this.options=s,(a||c)&&(this.pendingScrollAnchor=[a?.[0]??null,a?.[1]??0,c])},this.notify=n=>{var r,o;(o=(r=this.options).onChange)==null||o.call(r,this,n)},this.maybeNotify=Sn(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,i)=>{this._intendedScrollOffset!==null&&Math.abs(s-this._intendedScrollOffset)<1.5&&(s=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=i,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){const s=this.scrollElement,i=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},a=()=>{this._iosTouching=!1,!(!rl()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};s.addEventListener("touchstart",i,uo),s.addEventListener("touchend",a,uo),this.unsubs.push(()=>{s.removeEventListener("touchstart",i),s.removeEventListener("touchend",a),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const o=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled){const[s,i,a]=o;if(s!==null){const{count:c,getItemKey:u}=this.options;let d=0;for(;d<c&&u(d)!==s;)d++;const h=d<c?this.getMeasurements()[d]:void 0;if(h){const p=h.start+i-this.getScrollOffset();nl(p,0)||this.applyScrollAdjustment(p)}}a&&this.scrollToEnd({behavior:a})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const n=this.getScrollOffset(),r=this.getMaxScrollOffset();if(n<0||n>r)return;const o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=o,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const o=new Map,s=new Map;for(let i=r-1;i>=0;i--){const a=n[i];if(o.has(a.lane))continue;const c=s.get(a.lane);if(c==null||a.end>c.end?s.set(a.lane,a):a.end<c.end&&o.set(a.lane,!0),o.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((i,a)=>i.end===a.end?i.index-a.index:i.end-a.end)[0]:void 0},this.getMeasurementOptions=Sn(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,r,o,s,i,a,c)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:a,laneAssignmentMode:c}),{key:!1}),this.getMeasurements=Sn(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:a,laneAssignmentMode:c},u)=>{const d=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(const y of this.laneAssignments.keys())y>=n&&this.laneAssignments.delete(y);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(y=>{this.itemSizeCache.set(y.key,y.size)}));const h=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),a===1){const y=this.options.gap,m=n*2;let x=this._flatMeasurements;if(!x||x.length<m){const w=new Float64Array(m);x&&h>0&&w.set(x.subarray(0,h*2)),x=w,this._flatMeasurements=x}let g;if(h===0)g=r+o;else{const w=h-1;g=x[w*2]+x[w*2+1]+y}for(let w=h;w<n;w++){const S=s(w),j=d.get(S),C=typeof j=="number"?j:this.options.estimateSize(w);x[w*2]=g,x[w*2+1]=C,g+=C+y}const b=hy(n,x,s);return this.measurementsCache=b,b}const p=this.measurementsCache.slice(0,h),f=new Array(a).fill(void 0);for(let y=0;y<h;y++){const m=p[y];m&&(f[m.lane]=y)}for(let y=h;y<n;y++){const m=s(y),x=this.laneAssignments.get(y);let g,b;const w=c==="estimate"||d.has(m);if(x!==void 0&&this.options.lanes>1){g=x;const N=f[g],T=N!==void 0?p[N]:void 0;b=T?T.end+this.options.gap:r+o}else{const N=this.options.lanes===1?p[y-1]:this.getFurthestMeasurement(p,y);b=N?N.end+this.options.gap:r+o,g=N?N.lane:y%this.options.lanes,this.options.lanes>1&&w&&this.laneAssignments.set(y,g)}const S=d.get(m),j=typeof S=="number"?S:this.options.estimateSize(y),C=b+j;p[y]={index:y,start:b,size:j,end:C,key:m,lane:g},f[g]=y}return this.measurementsCache=p,p},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Sn(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,s)=>this.range=n.length>0&&r>0?Cy({measurements:n,outerSize:r,scrollOffset:o,lanes:s,flat:s===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Sn(()=>{let n=null,r=null;const o=this.calculateRange();return o&&(n=o.startIndex,r=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,o,s,i)=>s===null||i===null?[]:n({startIndex:s,endIndex:i,overscan:r,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,o=n.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(o!==void 0&&this.range){const s=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),i=Math.max(0,o-s),a=Math.min(this.options.count-1,o+s);return n>=i&&n<=a}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((i,a)=>{i.isConnected||(this.observer.unobserve(i),this.elementsCache.delete(a))});return}const r=this.indexFromElement(n),o=this.options.getItemKey(r),s=this.elementsCache.get(o);s!==n&&(s&&this.observer.unobserve(s),this.observer.observe(n),this.elementsCache.set(o,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var o,s;if(n<0||n>=this.options.count)return;let i,a,c;const u=this._flatMeasurements;if(this.options.lanes===1&&u!==null)c=this.options.getItemKey(n),a=u[n*2],i=u[n*2+1];else{const p=this.measurementsCache[n];if(!p)return;c=p.key,a=p.start,i=p.size}const d=this.itemSizeCache.get(c)??i,h=r-d;if(h!==0){const p=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,f=p?this.getTotalSize():0,y=((s=this.scrollState)==null?void 0:s.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:c,start:a,size:i,end:a+i,lane:0},h,this):a<this.getScrollOffset()+this.scrollAdjustments&&this.scrollDirection!=="backward");(this.pendingMin===null||n<this.pendingMin)&&(this.pendingMin=n),this.itemSizeCache.set(c,r),this.itemSizeCacheVersion++,p?this.applyScrollAdjustment(this.getTotalSize()-f):y&&this.applyScrollAdjustment(h),this.notify(!1)}},this.getVirtualItems=Sn(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let s=0,i=n.length;s<i;s++){const a=n[s],c=r[a];o.push(c)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length===0)return;const o=this._flatMeasurements,s=this.options.lanes===1&&o!=null,i=Ju(0,r.length-1,s?a=>o[a*2]:a=>tl(r[a]).start,n);return tl(r[i])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,r,o=0)=>{if(!this.scrollElement)return 0;const s=this.getSize(),i=this.getScrollOffset();r==="auto"&&(r=n>=i+s?"end":"start"),r==="center"?n+=(o-s)/2:r==="end"&&(n-=s);const a=this.getMaxScrollOffset();return Math.max(Math.min(a,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const o=this.getSize(),s=this.getScrollOffset(),i=this.measurementsCache[n];if(!i)return;if(r==="auto")if(i.end>=s+o-this.options.scrollPaddingEnd)r="end";else if(i.start<=s+this.options.scrollPaddingStart)r="start";else return[s,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];const a=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,r,i.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:o="auto"}={})=>{const s=this.getOffsetForAlignment(n,r),i=this.now();this.scrollState={index:null,align:r,behavior:o,startedAt:i,lastTargetOffset:s,stableFrames:0},this._scrollToOffset(s,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:o="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.getOffsetForIndex(n,r);if(!s)return;const[i,a]=s,c=this.now();this.scrollState={index:n,align:a,behavior:o,startedAt:c,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{const o=this.getScrollOffset()+n,s=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:s,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let o;if(r.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const s=r.length-1,i=this._flatMeasurements;i!=null?o=i[s*2]+i[s*2+1]:o=((n=r[s])==null?void 0:n.end)??0}else{const s=Array(this.options.lanes).fill(null);let i=r.length-1;for(;i>=0&&s.some(a=>a===null);){const a=r[i];s[a.lane]===null&&(s[a.lane]=a.end),i--}o=Math.max(...s.filter(a=>a!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const n=[];if(this.itemSizeCache.size===0)return n;const r=this.getMeasurements();for(const o of r)o&&this.itemSizeCache.has(o.key)&&n.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return n},this._scrollToOffset=(n,{adjustments:r,behavior:o})=>{this._intendedScrollOffset=n+(r??0),this.options.scrollToFn(n,{behavior:o,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,n){t!==0&&(rl()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:n}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=r?r[0]:this.scrollState.lastTargetOffset,s=1,i=o!==this.scrollState.lastTargetOffset;if(!i&&nl(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=s){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,i){const a=this.getSize()||600,c=Math.abs(o-this.getScrollOffset()),u=this.scrollState.behavior==="smooth"&&c>a;this.scrollState.lastTargetOffset=o,u||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:u?"smooth":"auto"})}this.scheduleScrollReconcile()}}const Ju=(e,t,n,r)=>{for(;e<=t;){const o=(e+t)/2|0,s=n(o);if(s<r)e=o+1;else if(s>r)t=o-1;else return o}return e>0?e-1:0};function Cy({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:o}){const s=e.length-1,i=o?d=>o[d*2]:d=>e[d].start,a=o?d=>o[d*2]+o[d*2+1]:d=>e[d].end;if(e.length<=r)return{startIndex:0,endIndex:s};let c=Ju(0,s,i,n),u=c;if(r===1)for(;u<s&&a(u)<n+t;)u++;else if(r>1){const d=Array(r).fill(0);for(;u<s&&d.some(p=>p<n+t);){const p=e[u];d[p.lane]=p.end,u++}const h=Array(r).fill(n+t);for(;c>=0&&h.some(p=>p>=n);){const p=e[c];h[p.lane]=p.start,c--}c=Math.max(0,c-c%r),u=Math.min(s,u+(r-1-u%r))}return{startIndex:c,endIndex:u}}const sl=typeof document<"u"?v.useLayoutEffect:v.useEffect;function jy({useFlushSync:e=!0,...t}){const n=v.useReducer(s=>s+1,0)[1],r={...t,onChange:(s,i)=>{var a;e&&i?Nr.flushSync(n):n(),(a=t.onChange)==null||a.call(t,s,i)}},[o]=v.useState(()=>new Sy(r));return o.setOptions(r),sl(()=>o._didMount(),[]),sl(()=>o._willUpdate()),o}function Gu(e){return jy({observeElementRect:xy,observeElementOffset:by,scrollToFn:_y,...e})}const Yu=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();const Ey=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const Ny=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase());const il=e=>{const t=Ny(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Ty={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 Ay=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};const Iy=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:i,...a},c)=>v.createElement("svg",{ref:c,...Ty,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Yu("lucide",o),...!s&&!Ay(a)&&{"aria-hidden":"true"},...a},[...i.map(([u,d])=>v.createElement(u,d)),...Array.isArray(s)?s:[s]]));const ke=(e,t)=>{const n=v.forwardRef(({className:r,...o},s)=>v.createElement(Iy,{ref:s,iconNode:t,className:Yu(`lucide-${Ey(il(e))}`,`lucide-${e}`,r),...o}));return n.displayName=il(e),n};const zy=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Py=ke("arrow-down",zy);const Ry=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Oy=ke("arrow-up",Ry);const Dy=[["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"}]],My=ke("brain",Dy);const Ly=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],sn=ke("check",Ly);const Fy=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],yt=ke("chevron-down",Fy);const $y=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],bt=ke("chevron-right",$y);const By=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Uy=ke("chevron-up",By);const Zy=[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]],Vy=ke("chevrons-down",Zy);const Wy=[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]],Hy=ke("chevrons-up",Wy);const qy=[["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"}]],kr=ke("circle-alert",qy);const Ky=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Jy=ke("circle-check-big",Ky);const Gy=[["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"}]],Yy=ke("circle-question-mark",Gy);const Xy=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],Xu=ke("circle-stop",Xy);const Qy=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Oo=ke("clock",Qy);const ev=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],Qu=ke("columns-2",ev);const tv=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],wn=ke("copy",tv);const nv=[["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"}]],Li=ke("download",nv);const rv=[["line",{x1:"5",x2:"19",y1:"9",y2:"9",key:"1nwqeh"}],["line",{x1:"5",x2:"19",y1:"15",y2:"15",key:"g8yjpy"}]],ov=ke("equal",rv);const sv=[["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"}]],iv=ke("external-link",sv);const av=[["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"}]],Fi=ke("eye-off",av);const lv=[["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"}]],$i=ke("eye",lv);const cv=[["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"}]],uv=ke("file-terminal",cv);const dv=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],fv=ke("gauge",dv);const hv=[["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"}]],ed=ke("git-compare-arrows",hv);const pv=[["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"}]],mv=ke("globe",pv);const gv=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],_r=ke("loader-circle",gv);const xv=[["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"}]],yv=ke("lock",xv);const vv=[["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"}]],td=ke("message-square",vv);const bv=[["path",{d:"M5 12h14",key:"1ays0h"}]],Bi=ke("minus",bv);const wv=[["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"}]],Ui=ke("pencil",wv);const kv=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],fo=ke("plus",kv);const _v=[["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"}]],Sv=ke("radio",_v);const Cv=[["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"}]],nd=ke("rotate-ccw",Cv);const jv=[["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"}]],rd=ke("rotate-cw",jv);const Ev=[["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"}]],od=ke("rows-3",Ev);const Nv=[["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"}]],Tv=ke("scan",Nv);const Av=[["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"}]],Iv=ke("server",Av);const zv=[["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"}]],Pv=ke("settings",zv);const Rv=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],sd=ke("terminal",Rv);const Ov=[["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"}]],id=ke("trash-2",Ov);const Dv=[["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"}]],Mv=ke("triangle-alert",Dv);const Lv=[["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"}]],Fv=ke("upload",Lv);const $v=[["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"}]],Bv=ke("user",$v);const Uv=[["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"}]],Zv=ke("wifi-off",Uv);const Vv=[["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"}]],Wv=ke("wifi",Vv);const Hv=[["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"}]],al=ke("wrench",Hv);const qv=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ad=ke("x",qv);const Kv=[["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"}]],Tr=ke("zap",Kv);function ll(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ld(...e){return t=>{let n=!1;const r=e.map(o=>{const s=ll(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():ll(e[o],null)}}}}function Me(...e){return v.useCallback(ld(...e),e)}function Wn(e){const t=Gv(e),n=v.forwardRef((r,o)=>{const{children:s,...i}=r,a=v.Children.toArray(s),c=a.find(Xv);if(c){const u=c.props.children,d=a.map(h=>h===c?v.Children.count(u)>1?v.Children.only(null):v.isValidElement(u)?u.props.children:null:h);return l.jsx(t,{...i,ref:o,children:v.isValidElement(u)?v.cloneElement(u,void 0,d):null})}return l.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var Jv=Wn("Slot");function Gv(e){const t=v.forwardRef((n,r)=>{const{children:o,...s}=n;if(v.isValidElement(o)){const i=eb(o),a=Qv(s,o.props);return o.type!==v.Fragment&&(a.ref=r?ld(r,i):i),v.cloneElement(o,a)}return v.Children.count(o)>1?v.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var cd=Symbol("radix.slottable");function Yv(e){const t=({children:n})=>l.jsx(l.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=cd,t}function Xv(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===cd}function Qv(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const c=s(...a);return o(...a),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function eb(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 tb=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ce=tb.reduce((e,t)=>{const n=Wn(`Primitive.${t}`),r=v.forwardRef((o,s)=>{const{asChild:i,...a}=o,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function nb(e,t){e&&Nr.flushSync(()=>e.dispatchEvent(t))}var ud=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"}),rb="VisuallyHidden",dd=v.forwardRef((e,t)=>l.jsx(Ce.span,{...e,ref:t,style:{...ud,...e.style}}));dd.displayName=rb;var ob=dd;function sb(e,t){const n=v.createContext(t),r=s=>{const{children:i,...a}=s,c=v.useMemo(()=>a,Object.values(a));return l.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function o(s){const i=v.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function Jt(e,t=[]){let n=[];function r(s,i){const a=v.createContext(i),c=n.length;n=[...n,i];const u=h=>{const{scope:p,children:f,...y}=h,m=p?.[e]?.[c]||a,x=v.useMemo(()=>y,Object.values(y));return l.jsx(m.Provider,{value:x,children:f})};u.displayName=s+"Provider";function d(h,p){const f=p?.[e]?.[c]||a,y=v.useContext(f);if(y)return y;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${s}\``)}return[u,d]}const o=()=>{const s=n.map(i=>v.createContext(i));return function(a){const c=a?.[e]||s;return v.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,ib(o,...t)]}function ib(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:c,scopeName:u})=>{const h=c(s)[`__scope${u}`];return{...a,...h}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function fd(e){const t=e+"CollectionProvider",[n,r]=Jt(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=m=>{const{scope:x,children:g}=m,b=at.useRef(null),w=at.useRef(new Map).current;return l.jsx(o,{scope:x,itemMap:w,collectionRef:b,children:g})};i.displayName=t;const a=e+"CollectionSlot",c=Wn(a),u=at.forwardRef((m,x)=>{const{scope:g,children:b}=m,w=s(a,g),S=Me(x,w.collectionRef);return l.jsx(c,{ref:S,children:b})});u.displayName=a;const d=e+"CollectionItemSlot",h="data-radix-collection-item",p=Wn(d),f=at.forwardRef((m,x)=>{const{scope:g,children:b,...w}=m,S=at.useRef(null),j=Me(x,S),C=s(d,g);return at.useEffect(()=>(C.itemMap.set(S,{ref:S,...w}),()=>{C.itemMap.delete(S)})),l.jsx(p,{[h]:"",ref:j,children:b})});f.displayName=d;function y(m){const x=s(e+"CollectionConsumer",m);return at.useCallback(()=>{const b=x.collectionRef.current;if(!b)return[];const w=Array.from(b.querySelectorAll(`[${h}]`));return Array.from(x.itemMap.values()).sort((C,N)=>w.indexOf(C.ref.current)-w.indexOf(N.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:i,Slot:u,ItemSlot:f},y,r]}function we(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}var Qe=globalThis?.document?v.useLayoutEffect:()=>{},ab=ru[" useInsertionEffect ".trim().toString()]||Qe;function pn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=lb({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=cb(d)?d(e):d;h!==e&&i.current?.(h)}else s(d)},[a,e,s,i]);return[c,u]}function lb({defaultProp:e,onChange:t}){const[n,r]=v.useState(e),o=v.useRef(n),s=v.useRef(t);return ab(()=>{s.current=t},[t]),v.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}function cb(e){return typeof e=="function"}function ub(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var kt=e=>{const{present:t,children:n}=e,r=db(t),o=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),s=Me(r.ref,fb(o));return typeof n=="function"||r.isPresent?v.cloneElement(o,{ref:s}):null};kt.displayName="Presence";function db(e){const[t,n]=v.useState(),r=v.useRef(null),o=v.useRef(e),s=v.useRef("none"),i=e?"mounted":"unmounted",[a,c]=ub(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=$r(r.current);s.current=a==="mounted"?u:"none"},[a]),Qe(()=>{const u=r.current,d=o.current;if(d!==e){const p=s.current,f=$r(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=$r(r.current).includes(CSS.escape(f.animationName));if(f.target===t&&m&&(c("ANIMATION_END"),!o.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},p=f=>{f.target===t&&(s.current=$r(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 $r(e){return e?.animationName||"none"}function fb(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 hb=ru[" useId ".trim().toString()]||(()=>{}),pb=0;function Dt(e){const[t,n]=v.useState(hb());return Qe(()=>{n(r=>r??String(pb++))},[e]),e||(t?`radix-${t}`:"")}var Do="Collapsible",[mb]=Jt(Do),[gb,Zi]=mb(Do),hd=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:s,onOpenChange:i,...a}=e,[c,u]=pn({prop:r,defaultProp:o??!1,onChange:i,caller:Do});return l.jsx(gb,{scope:n,disabled:s,contentId:Dt(),open:c,onOpenToggle:v.useCallback(()=>u(d=>!d),[u]),children:l.jsx(Ce.div,{"data-state":Wi(c),"data-disabled":s?"":void 0,...a,ref:t})})});hd.displayName=Do;var pd="CollapsibleTrigger",md=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=Zi(pd,n);return l.jsx(Ce.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":Wi(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:we(e.onClick,o.onOpenToggle)})});md.displayName=pd;var Vi="CollapsibleContent",gd=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Zi(Vi,e.__scopeCollapsible);return l.jsx(kt,{present:n||o.open,children:({present:s})=>l.jsx(xb,{...r,ref:t,present:s})})});gd.displayName=Vi;var xb=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...s}=e,i=Zi(Vi,n),[a,c]=v.useState(r),u=v.useRef(null),d=Me(t,u),h=v.useRef(0),p=h.current,f=v.useRef(0),y=f.current,m=i.open||a,x=v.useRef(m),g=v.useRef(void 0);return v.useEffect(()=>{const b=requestAnimationFrame(()=>x.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 w=b.getBoundingClientRect();h.current=w.height,f.current=w.width,x.current||(b.style.transitionDuration=g.current.transitionDuration,b.style.animationName=g.current.animationName),c(r)}},[i.open,r]),l.jsx(Ce.div,{"data-state":Wi(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!m,...s,ref:d,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...e.style},children:m&&o})});function Wi(e){return e?"open":"closed"}var yb=hd,vb=v.createContext(void 0);function Mo(e){const t=v.useContext(vb);return e||t||"ltr"}function st(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>t.current?.(...n),[])}function bb(e,t=globalThis?.document){const n=st(e);v.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var wb="DismissableLayer",Gs="dismissableLayer.update",kb="dismissableLayer.pointerDownOutside",_b="dismissableLayer.focusOutside",cl,xd=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Lo=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...c}=e,u=v.useContext(xd),[d,h]=v.useState(null),p=d?.ownerDocument??globalThis?.document,[,f]=v.useState({}),y=Me(t,N=>h(N)),m=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),g=m.indexOf(x),b=d?m.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,S=b>=g,j=jb(N=>{const T=N.target,z=[...u.branches].some(O=>O.contains(T));!S||z||(o?.(N),i?.(N),N.defaultPrevented||a?.())},p),C=Eb(N=>{const T=N.target;[...u.branches].some(O=>O.contains(T))||(s?.(N),i?.(N),N.defaultPrevented||a?.())},p);return bb(N=>{b===u.layers.size-1&&(r?.(N),!N.defaultPrevented&&a&&(N.preventDefault(),a()))},p),v.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(cl=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),ul(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=cl)}},[d,p,n,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),ul())},[d,u]),v.useEffect(()=>{const N=()=>f({});return document.addEventListener(Gs,N),()=>document.removeEventListener(Gs,N)},[]),l.jsx(Ce.div,{...c,ref:y,style:{pointerEvents:w?S?"auto":"none":void 0,...e.style},onFocusCapture:we(e.onFocusCapture,C.onFocusCapture),onBlurCapture:we(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:we(e.onPointerDownCapture,j.onPointerDownCapture)})});Lo.displayName=wb;var Sb="DismissableLayerBranch",Cb=v.forwardRef((e,t)=>{const n=v.useContext(xd),r=v.useRef(null),o=Me(t,r);return v.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),l.jsx(Ce.div,{...e,ref:o})});Cb.displayName=Sb;function jb(e,t=globalThis?.document){const n=st(e),r=v.useRef(!1),o=v.useRef(()=>{});return v.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let c=function(){yd(kb,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Eb(e,t=globalThis?.document){const n=st(e),r=v.useRef(!1);return v.useEffect(()=>{const o=s=>{s.target&&!r.current&&yd(_b,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ul(){const e=new CustomEvent(Gs);document.dispatchEvent(e)}function yd(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?nb(o,s):o.dispatchEvent(s)}var ps="focusScope.autoFocusOnMount",ms="focusScope.autoFocusOnUnmount",dl={bubbles:!1,cancelable:!0},Nb="FocusScope",Hi=v.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[a,c]=v.useState(null),u=st(o),d=st(s),h=v.useRef(null),p=Me(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(w){if(f.paused||!a)return;const S=w.target;a.contains(S)?h.current=S:Xt(h.current,{select:!0})},x=function(w){if(f.paused||!a)return;const S=w.relatedTarget;S!==null&&(a.contains(S)||Xt(h.current,{select:!0}))},g=function(w){if(document.activeElement===document.body)for(const j of w)j.removedNodes.length>0&&Xt(a)};document.addEventListener("focusin",m),document.addEventListener("focusout",x);const b=new MutationObserver(g);return a&&b.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",x),b.disconnect()}}},[r,a,f.paused]),v.useEffect(()=>{if(a){hl.add(f);const m=document.activeElement;if(!a.contains(m)){const g=new CustomEvent(ps,dl);a.addEventListener(ps,u),a.dispatchEvent(g),g.defaultPrevented||(Tb(Rb(vd(a)),{select:!0}),document.activeElement===m&&Xt(a))}return()=>{a.removeEventListener(ps,u),setTimeout(()=>{const g=new CustomEvent(ms,dl);a.addEventListener(ms,d),a.dispatchEvent(g),g.defaultPrevented||Xt(m??document.body,{select:!0}),a.removeEventListener(ms,d),hl.remove(f)},0)}}},[a,u,d,f]);const y=v.useCallback(m=>{if(!n&&!r||f.paused)return;const x=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,g=document.activeElement;if(x&&g){const b=m.currentTarget,[w,S]=Ab(b);w&&S?!m.shiftKey&&g===S?(m.preventDefault(),n&&Xt(w,{select:!0})):m.shiftKey&&g===w&&(m.preventDefault(),n&&Xt(S,{select:!0})):g===b&&m.preventDefault()}},[n,r,f.paused]);return l.jsx(Ce.div,{tabIndex:-1,...i,ref:p,onKeyDown:y})});Hi.displayName=Nb;function Tb(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Xt(r,{select:t}),document.activeElement!==n)return}function Ab(e){const t=vd(e),n=fl(t,e),r=fl(t.reverse(),e);return[n,r]}function vd(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 fl(e,t){for(const n of e)if(!Ib(n,{upTo:t}))return n}function Ib(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 zb(e){return e instanceof HTMLInputElement&&"select"in e}function Xt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&zb(e)&&t&&e.select()}}var hl=Pb();function Pb(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=pl(e,t),e.unshift(t)},remove(t){e=pl(e,t),e[0]?.resume()}}}function pl(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Rb(e){return e.filter(t=>t.tagName!=="A")}var Ob="Portal",Fo=v.forwardRef((e,t)=>{const{container:n,...r}=e,[o,s]=v.useState(!1);Qe(()=>s(!0),[]);const i=n||o&&globalThis?.document?.body;return i?Vp.createPortal(l.jsx(Ce.div,{...r,ref:t}),i):null});Fo.displayName=Ob;var gs=0;function bd(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??ml()),document.body.insertAdjacentElement("beforeend",e[1]??ml()),gs++,()=>{gs===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),gs--}},[])}function ml(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Pt=function(){return Pt=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Pt.apply(this,arguments)};function wd(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 Db(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var to="right-scroll-bar-position",no="width-before-scroll-bar",Mb="with-scroll-bars-hidden",Lb="--removed-body-scroll-bar-size";function xs(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Fb(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 $b=typeof window<"u"?v.useLayoutEffect:v.useEffect,gl=new WeakMap;function Bb(e,t){var n=Fb(null,function(r){return e.forEach(function(o){return xs(o,r)})});return $b(function(){var r=gl.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(a){s.has(a)||xs(a,null)}),s.forEach(function(a){o.has(a)||xs(a,i)})}gl.set(n,e)},[e]),n}function Ub(e){return e}function Zb(e,t){t===void 0&&(t=Ub);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(a){return a!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var a=n;n=[],a.forEach(s),i=n}var c=function(){var d=i;i=[],d.forEach(s)},u=function(){return Promise.resolve().then(c)};u(),n={push:function(d){i.push(d),u()},filter:function(d){return i=i.filter(d),n}}}};return o}function Vb(e){e===void 0&&(e={});var t=Zb(null);return t.options=Pt({async:!0,ssr:!1},e),t}var kd=function(e){var t=e.sideCar,n=wd(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return v.createElement(r,Pt({},n))};kd.isSideCarExport=!0;function Wb(e,t){return e.useMedium(t),kd}var _d=Vb(),ys=function(){},$o=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:ys,onWheelCapture:ys,onTouchMoveCapture:ys}),o=r[0],s=r[1],i=e.forwardProps,a=e.children,c=e.className,u=e.removeScrollBar,d=e.enabled,h=e.shards,p=e.sideCar,f=e.noRelative,y=e.noIsolation,m=e.inert,x=e.allowPinchZoom,g=e.as,b=g===void 0?"div":g,w=e.gapMode,S=wd(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),j=p,C=Bb([n,t]),N=Pt(Pt({},S),o);return v.createElement(v.Fragment,null,d&&v.createElement(j,{sideCar:_d,removeScrollBar:u,shards:h,noRelative:f,noIsolation:y,inert:m,setCallbacks:s,allowPinchZoom:!!x,lockRef:n,gapMode:w}),i?v.cloneElement(v.Children.only(a),Pt(Pt({},N),{ref:C})):v.createElement(b,Pt({},N,{className:c,ref:C}),a))});$o.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};$o.classNames={fullWidth:no,zeroRight:to};var Hb=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function qb(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Hb();return t&&e.setAttribute("nonce",t),e}function Kb(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Jb(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Gb=function(){var e=0,t=null;return{add:function(n){e==0&&(t=qb())&&(Kb(t,n),Jb(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Yb=function(){var e=Gb();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Sd=function(){var e=Yb(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Xb={left:0,top:0,right:0,gap:0},vs=function(e){return parseInt(e||"",10)||0},Qb=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[vs(n),vs(r),vs(o)]},e2=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Xb;var t=Qb(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])}},t2=Sd(),Mn="data-scroll-locked",n2=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
40
|
+
.`.concat(Mb,` {
|
|
41
|
+
overflow: hidden `).concat(r,`;
|
|
42
|
+
padding-right: `).concat(a,"px ").concat(r,`;
|
|
43
|
+
}
|
|
44
|
+
body[`).concat(Mn,`] {
|
|
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(s,`px;
|
|
50
|
+
padding-right: `).concat(i,`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(to,` {
|
|
58
|
+
right: `).concat(a,"px ").concat(r,`;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.`).concat(no,` {
|
|
62
|
+
margin-right: `).concat(a,"px ").concat(r,`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.`).concat(to," .").concat(to,` {
|
|
66
|
+
right: 0 `).concat(r,`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.`).concat(no," .").concat(no,` {
|
|
70
|
+
margin-right: 0 `).concat(r,`;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
body[`).concat(Mn,`] {
|
|
74
|
+
`).concat(Lb,": ").concat(a,`px;
|
|
75
|
+
}
|
|
76
|
+
`)},xl=function(){var e=parseInt(document.body.getAttribute(Mn)||"0",10);return isFinite(e)?e:0},r2=function(){v.useEffect(function(){return document.body.setAttribute(Mn,(xl()+1).toString()),function(){var e=xl()-1;e<=0?document.body.removeAttribute(Mn):document.body.setAttribute(Mn,e.toString())}},[])},o2=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;r2();var s=v.useMemo(function(){return e2(o)},[o]);return v.createElement(t2,{styles:n2(s,!t,o,n?"":"!important")})},Ys=!1;if(typeof window<"u")try{var Br=Object.defineProperty({},"passive",{get:function(){return Ys=!0,!0}});window.addEventListener("test",Br,Br),window.removeEventListener("test",Br,Br)}catch{Ys=!1}var Cn=Ys?{passive:!1}:!1,s2=function(e){return e.tagName==="TEXTAREA"},Cd=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!s2(e)&&n[t]==="visible")},i2=function(e){return Cd(e,"overflowY")},a2=function(e){return Cd(e,"overflowX")},yl=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=jd(e,r);if(o){var s=Ed(e,r),i=s[1],a=s[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},l2=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},c2=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},jd=function(e,t){return e==="v"?i2(t):a2(t)},Ed=function(e,t){return e==="v"?l2(t):c2(t)},u2=function(e,t){return e==="h"&&t==="rtl"?-1:1},d2=function(e,t,n,r,o){var s=u2(e,window.getComputedStyle(t).direction),i=s*r,a=n.target,c=t.contains(a),u=!1,d=i>0,h=0,p=0;do{if(!a)break;var f=Ed(e,a),y=f[0],m=f[1],x=f[2],g=m-x-s*y;(y||g)&&jd(e,a)&&(h+=g,p+=y);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},Ur=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},vl=function(e){return[e.deltaX,e.deltaY]},bl=function(e){return e&&"current"in e?e.current:e},f2=function(e,t){return e[0]===t[0]&&e[1]===t[1]},h2=function(e){return`
|
|
77
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
78
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
79
|
+
`)},p2=0,jn=[];function m2(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),o=v.useState(p2++)[0],s=v.useState(Sd)[0],i=v.useRef(e);v.useEffect(function(){i.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var m=Db([e.lockRef.current],(e.shards||[]).map(bl),!0).filter(Boolean);return m.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=v.useCallback(function(m,x){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!i.current.allowPinchZoom;var g=Ur(m),b=n.current,w="deltaX"in m?m.deltaX:b[0]-g[0],S="deltaY"in m?m.deltaY:b[1]-g[1],j,C=m.target,N=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in m&&N==="h"&&C.type==="range")return!1;var T=window.getSelection(),z=T&&T.anchorNode,O=z?z===C||z.contains(C):!1;if(O)return!1;var L=yl(N,C);if(!L)return!0;if(L?j=N:(j=N==="v"?"h":"v",L=yl(N,C)),!L)return!1;if(!r.current&&"changedTouches"in m&&(w||S)&&(r.current=j),!j)return!0;var E=r.current||j;return d2(E,x,m,E==="h"?w:S)},[]),c=v.useCallback(function(m){var x=m;if(!(!jn.length||jn[jn.length-1]!==s)){var g="deltaY"in x?vl(x):Ur(x),b=t.current.filter(function(j){return j.name===x.type&&(j.target===x.target||x.target===j.shadowParent)&&f2(j.delta,g)})[0];if(b&&b.should){x.cancelable&&x.preventDefault();return}if(!b){var w=(i.current.shards||[]).map(bl).filter(Boolean).filter(function(j){return j.contains(x.target)}),S=w.length>0?a(x,w[0]):!i.current.noIsolation;S&&x.cancelable&&x.preventDefault()}}},[]),u=v.useCallback(function(m,x,g,b){var w={name:m,delta:x,target:g,should:b,shadowParent:g2(g)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(S){return S!==w})},1)},[]),d=v.useCallback(function(m){n.current=Ur(m),r.current=void 0},[]),h=v.useCallback(function(m){u(m.type,vl(m),m.target,a(m,e.lockRef.current))},[]),p=v.useCallback(function(m){u(m.type,Ur(m),m.target,a(m,e.lockRef.current))},[]);v.useEffect(function(){return jn.push(s),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:p}),document.addEventListener("wheel",c,Cn),document.addEventListener("touchmove",c,Cn),document.addEventListener("touchstart",d,Cn),function(){jn=jn.filter(function(m){return m!==s}),document.removeEventListener("wheel",c,Cn),document.removeEventListener("touchmove",c,Cn),document.removeEventListener("touchstart",d,Cn)}},[]);var f=e.removeScrollBar,y=e.inert;return v.createElement(v.Fragment,null,y?v.createElement(s,{styles:h2(o)}):null,f?v.createElement(o2,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function g2(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const x2=Wb(_d,m2);var qi=v.forwardRef(function(e,t){return v.createElement($o,Pt({},e,{ref:t,sideCar:x2}))});qi.classNames=$o.classNames;var y2=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},En=new WeakMap,Zr=new WeakMap,Vr={},bs=0,Nd=function(e){return e&&(e.host||Nd(e.parentNode))},v2=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Nd(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})},b2=function(e,t,n,r){var o=v2(t,Array.isArray(e)?e:[e]);Vr[n]||(Vr[n]=new WeakMap);var s=Vr[n],i=[],a=new Set,c=new Set(o),u=function(h){!h||a.has(h)||(a.add(h),u(h.parentNode))};o.forEach(u);var d=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(p){if(a.has(p))d(p);else try{var f=p.getAttribute(r),y=f!==null&&f!=="false",m=(En.get(p)||0)+1,x=(s.get(p)||0)+1;En.set(p,m),s.set(p,x),i.push(p),m===1&&y&&Zr.set(p,!0),x===1&&p.setAttribute(n,"true"),y||p.setAttribute(r,"true")}catch(g){console.error("aria-hidden: cannot operate on ",p,g)}})};return d(t),a.clear(),bs++,function(){i.forEach(function(h){var p=En.get(h)-1,f=s.get(h)-1;En.set(h,p),s.set(h,f),p||(Zr.has(h)||h.removeAttribute(r),Zr.delete(h)),f||h.removeAttribute(n)}),bs--,bs||(En=new WeakMap,En=new WeakMap,Zr=new WeakMap,Vr={})}},Td=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=y2(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),b2(r,o,n,"aria-hidden")):function(){return null}},Bo="Dialog",[Ad]=Jt(Bo),[w2,At]=Ad(Bo),Id=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!0}=e,a=v.useRef(null),c=v.useRef(null),[u,d]=pn({prop:r,defaultProp:o??!1,onChange:s,caller:Bo});return l.jsx(w2,{scope:t,triggerRef:a,contentRef:c,contentId:Dt(),titleId:Dt(),descriptionId:Dt(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(h=>!h),[d]),modal:i,children:n})};Id.displayName=Bo;var zd="DialogTrigger",Pd=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=At(zd,n),s=Me(t,o.triggerRef);return l.jsx(Ce.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Gi(o.open),...r,ref:s,onClick:we(e.onClick,o.onOpenToggle)})});Pd.displayName=zd;var Ki="DialogPortal",[k2,Rd]=Ad(Ki,{forceMount:void 0}),Od=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=At(Ki,t);return l.jsx(k2,{scope:t,forceMount:n,children:v.Children.map(r,i=>l.jsx(kt,{present:n||s.open,children:l.jsx(Fo,{asChild:!0,container:o,children:i})}))})};Od.displayName=Ki;var ho="DialogOverlay",Dd=v.forwardRef((e,t)=>{const n=Rd(ho,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=At(ho,e.__scopeDialog);return s.modal?l.jsx(kt,{present:r||s.open,children:l.jsx(S2,{...o,ref:t})}):null});Dd.displayName=ho;var _2=Wn("DialogOverlay.RemoveScroll"),S2=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=At(ho,n);return l.jsx(qi,{as:_2,allowPinchZoom:!0,shards:[o.contentRef],children:l.jsx(Ce.div,{"data-state":Gi(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),mn="DialogContent",Md=v.forwardRef((e,t)=>{const n=Rd(mn,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=At(mn,e.__scopeDialog);return l.jsx(kt,{present:r||s.open,children:s.modal?l.jsx(C2,{...o,ref:t}):l.jsx(j2,{...o,ref:t})})});Md.displayName=mn;var C2=v.forwardRef((e,t)=>{const n=At(mn,e.__scopeDialog),r=v.useRef(null),o=Me(t,n.contentRef,r);return v.useEffect(()=>{const s=r.current;if(s)return Td(s)},[]),l.jsx(Ld,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:we(e.onCloseAutoFocus,s=>{s.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:we(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,a=i.button===0&&i.ctrlKey===!0;(i.button===2||a)&&s.preventDefault()}),onFocusOutside:we(e.onFocusOutside,s=>s.preventDefault())})}),j2=v.forwardRef((e,t)=>{const n=At(mn,e.__scopeDialog),r=v.useRef(!1),o=v.useRef(!1);return l.jsx(Ld,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{e.onCloseAutoFocus?.(s),s.defaultPrevented||(r.current||n.triggerRef.current?.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{e.onInteractOutside?.(s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=s.target;n.triggerRef.current?.contains(i)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),Ld=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...i}=e,a=At(mn,n),c=v.useRef(null),u=Me(t,c);return bd(),l.jsxs(l.Fragment,{children:[l.jsx(Hi,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:l.jsx(Lo,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Gi(a.open),...i,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(N2,{titleId:a.titleId}),l.jsx(A2,{contentRef:c,descriptionId:a.descriptionId})]})]})}),Ji="DialogTitle",Fd=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=At(Ji,n);return l.jsx(Ce.h2,{id:o.titleId,...r,ref:t})});Fd.displayName=Ji;var $d="DialogDescription",E2=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=At($d,n);return l.jsx(Ce.p,{id:o.descriptionId,...r,ref:t})});E2.displayName=$d;var Bd="DialogClose",Ud=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=At(Bd,n);return l.jsx(Ce.button,{type:"button",...r,ref:t,onClick:we(e.onClick,()=>o.onOpenChange(!1))})});Ud.displayName=Bd;function Gi(e){return e?"open":"closed"}var Zd="DialogTitleWarning",[pT,Vd]=sb(Zd,{contentName:mn,titleName:Ji,docsSlug:"dialog"}),N2=({titleId:e})=>{const t=Vd(Zd),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},T2="DialogDescriptionWarning",A2=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Vd(T2).contentName}}.`;return v.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},I2=Id,z2=Pd,P2=Od,R2=Dd,O2=Md,D2=Fd,M2=Ud;function L2(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 F2(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 s=o[0];let i,a;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;i=u.inlineSize,a=u.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}const $2=["top","right","bottom","left"],tn=Math.min,pt=Math.max,po=Math.round,Wr=Math.floor,Mt=e=>({x:e,y:e}),B2={left:"right",right:"left",bottom:"top",top:"bottom"},U2={start:"end",end:"start"};function Xs(e,t,n){return pt(e,tn(t,n))}function Ht(e,t){return typeof e=="function"?e(t):e}function qt(e){return e.split("-")[0]}function Xn(e){return e.split("-")[1]}function Yi(e){return e==="x"?"y":"x"}function Xi(e){return e==="y"?"height":"width"}const Z2=new Set(["top","bottom"]);function Ot(e){return Z2.has(qt(e))?"y":"x"}function Qi(e){return Yi(Ot(e))}function V2(e,t,n){n===void 0&&(n=!1);const r=Xn(e),o=Qi(e),s=Xi(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=mo(i)),[i,mo(i)]}function W2(e){const t=mo(e);return[Qs(e),t,Qs(t)]}function Qs(e){return e.replace(/start|end/g,t=>U2[t])}const wl=["left","right"],kl=["right","left"],H2=["top","bottom"],q2=["bottom","top"];function K2(e,t,n){switch(e){case"top":case"bottom":return n?t?kl:wl:t?wl:kl;case"left":case"right":return t?H2:q2;default:return[]}}function J2(e,t,n,r){const o=Xn(e);let s=K2(qt(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Qs)))),s}function mo(e){return e.replace(/left|right|bottom|top/g,t=>B2[t])}function G2(e){return{top:0,right:0,bottom:0,left:0,...e}}function Wd(e){return typeof e!="number"?G2(e):{top:e,right:e,bottom:e,left:e}}function go(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 _l(e,t,n){let{reference:r,floating:o}=e;const s=Ot(t),i=Qi(t),a=Xi(i),c=qt(t),u=s==="y",d=r.x+r.width/2-o.width/2,h=r.y+r.height/2-o.height/2,p=r[a]/2-o[a]/2;let f;switch(c){case"top":f={x:d,y:r.y-o.height};break;case"bottom":f={x:d,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:h};break;case"left":f={x:r.x-o.width,y:h};break;default:f={x:r.x,y:r.y}}switch(Xn(t)){case"start":f[i]-=p*(n&&u?-1:1);break;case"end":f[i]+=p*(n&&u?-1:1);break}return f}async function Y2(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:p=!1,padding:f=0}=Ht(t,e),y=Wd(f),x=a[p?h==="floating"?"reference":"floating":h],g=go(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(x)))==null||n?x:x.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:c})),b=h==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),S=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},j=go(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:w,strategy:c}):b);return{top:(g.top-j.top+y.top)/S.y,bottom:(j.bottom-g.bottom+y.bottom)/S.y,left:(g.left-j.left+y.left)/S.x,right:(j.right-g.right+y.right)/S.x}}const X2=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=s.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:h}=_l(u,r,c),p=r,f={},y=0;for(let x=0;x<a.length;x++){var m;const{name:g,fn:b}=a[x],{x:w,y:S,data:j,reset:C}=await b({x:d,y:h,initialPlacement:r,placement:p,strategy:o,middlewareData:f,rects:u,platform:{...i,detectOverflow:(m=i.detectOverflow)!=null?m:Y2},elements:{reference:e,floating:t}});d=w??d,h=S??h,f={...f,[g]:{...f[g],...j}},C&&y<=50&&(y++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(u=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:d,y:h}=_l(u,p,c)),x=-1)}return{x:d,y:h,placement:p,strategy:o,middlewareData:f}},Q2=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:c}=t,{element:u,padding:d=0}=Ht(e,t)||{};if(u==null)return{};const h=Wd(d),p={x:n,y:r},f=Qi(o),y=Xi(f),m=await i.getDimensions(u),x=f==="y",g=x?"top":"left",b=x?"bottom":"right",w=x?"clientHeight":"clientWidth",S=s.reference[y]+s.reference[f]-p[f]-s.floating[y],j=p[f]-s.reference[f],C=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let N=C?C[w]:0;(!N||!await(i.isElement==null?void 0:i.isElement(C)))&&(N=a.floating[w]||s.floating[y]);const T=S/2-j/2,z=N/2-m[y]/2-1,O=tn(h[g],z),L=tn(h[b],z),E=O,M=N-m[y]-L,k=N/2-m[y]/2+T,D=Xs(E,k,M),G=!c.arrow&&Xn(o)!=null&&k!==D&&s.reference[y]/2-(k<E?O:L)-m[y]/2<0,W=G?k<E?k-E:k-M:0;return{[f]:p[f]+W,data:{[f]:D,centerOffset:k-D-W,...G&&{alignmentOffset:W}},reset:G}}}),ew=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:m=!0,...x}=Ht(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const g=qt(o),b=Ot(a),w=qt(a)===a,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),j=p||(w||!m?[mo(a)]:W2(a)),C=y!=="none";!p&&C&&j.push(...J2(a,m,y,S));const N=[a,...j],T=await c.detectOverflow(t,x),z=[];let O=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&z.push(T[g]),h){const k=V2(o,i,S);z.push(T[k[0]],T[k[1]])}if(O=[...O,{placement:o,overflows:z}],!z.every(k=>k<=0)){var L,E;const k=(((L=s.flip)==null?void 0:L.index)||0)+1,D=N[k];if(D&&(!(h==="alignment"?b!==Ot(D):!1)||O.every(H=>Ot(H.placement)===b?H.overflows[0]>0:!0)))return{data:{index:k,overflows:O},reset:{placement:D}};let G=(E=O.filter(W=>W.overflows[0]<=0).sort((W,H)=>W.overflows[1]-H.overflows[1])[0])==null?void 0:E.placement;if(!G)switch(f){case"bestFit":{var M;const W=(M=O.filter(H=>{if(C){const X=Ot(H.placement);return X===b||X==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(X=>X>0).reduce((X,A)=>X+A,0)]).sort((H,X)=>H[1]-X[1])[0])==null?void 0:M[0];W&&(G=W);break}case"initialPlacement":G=a;break}if(o!==G)return{reset:{placement:G}}}return{}}}};function Sl(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Cl(e){return $2.some(t=>e[t]>=0)}const tw=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=Ht(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=Sl(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Cl(a)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),a=Sl(i,n.floating);return{data:{escapedOffsets:a,escaped:Cl(a)}}}default:return{}}}}},Hd=new Set(["left","top"]);async function nw(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=qt(n),a=Xn(n),c=Ot(n)==="y",u=Hd.has(i)?-1:1,d=s&&c?-1:1,h=Ht(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:y}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof y=="number"&&(f=a==="end"?y*-1:y),c?{x:f*d,y:p*u}:{x:p*u,y:f*d}}const rw=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,c=await nw(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:i}}}}},ow=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:c={fn:g=>{let{x:b,y:w}=g;return{x:b,y:w}}},...u}=Ht(e,t),d={x:n,y:r},h=await s.detectOverflow(t,u),p=Ot(qt(o)),f=Yi(p);let y=d[f],m=d[p];if(i){const g=f==="y"?"top":"left",b=f==="y"?"bottom":"right",w=y+h[g],S=y-h[b];y=Xs(w,y,S)}if(a){const g=p==="y"?"top":"left",b=p==="y"?"bottom":"right",w=m+h[g],S=m-h[b];m=Xs(w,m,S)}const x=c.fn({...t,[f]:y,[p]:m});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[f]:i,[p]:a}}}}}},sw=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:c=!0,crossAxis:u=!0}=Ht(e,t),d={x:n,y:r},h=Ot(o),p=Yi(h);let f=d[p],y=d[h];const m=Ht(a,t),x=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const w=p==="y"?"height":"width",S=s.reference[p]-s.floating[w]+x.mainAxis,j=s.reference[p]+s.reference[w]-x.mainAxis;f<S?f=S:f>j&&(f=j)}if(u){var g,b;const w=p==="y"?"width":"height",S=Hd.has(qt(o)),j=s.reference[h]-s.floating[w]+(S&&((g=i.offset)==null?void 0:g[h])||0)+(S?0:x.crossAxis),C=s.reference[h]+s.reference[w]+(S?0:((b=i.offset)==null?void 0:b[h])||0)-(S?x.crossAxis:0);y<j?y=j:y>C&&(y=C)}return{[p]:f,[h]:y}}}},iw=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:a}=t,{apply:c=()=>{},...u}=Ht(e,t),d=await i.detectOverflow(t,u),h=qt(o),p=Xn(o),f=Ot(o)==="y",{width:y,height:m}=s.floating;let x,g;h==="top"||h==="bottom"?(x=h,g=p===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(g=h,x=p==="end"?"top":"bottom");const b=m-d.top-d.bottom,w=y-d.left-d.right,S=tn(m-d[x],b),j=tn(y-d[g],w),C=!t.middlewareData.shift;let N=S,T=j;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(N=b),C&&!p){const O=pt(d.left,0),L=pt(d.right,0),E=pt(d.top,0),M=pt(d.bottom,0);f?T=y-2*(O!==0||L!==0?O+L:pt(d.left,d.right)):N=m-2*(E!==0||M!==0?E+M:pt(d.top,d.bottom))}await c({...t,availableWidth:T,availableHeight:N});const z=await i.getDimensions(a.floating);return y!==z.width||m!==z.height?{reset:{rects:!0}}:{}}}};function Uo(){return typeof window<"u"}function Qn(e){return qd(e)?(e.nodeName||"").toLowerCase():"#document"}function gt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function $t(e){var t;return(t=(qd(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function qd(e){return Uo()?e instanceof Node||e instanceof gt(e).Node:!1}function Nt(e){return Uo()?e instanceof Element||e instanceof gt(e).Element:!1}function Lt(e){return Uo()?e instanceof HTMLElement||e instanceof gt(e).HTMLElement:!1}function jl(e){return!Uo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof gt(e).ShadowRoot}const aw=new Set(["inline","contents"]);function Ar(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Tt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!aw.has(o)}const lw=new Set(["table","td","th"]);function cw(e){return lw.has(Qn(e))}const uw=[":popover-open",":modal"];function Zo(e){return uw.some(t=>{try{return e.matches(t)}catch{return!1}})}const dw=["transform","translate","scale","rotate","perspective"],fw=["transform","translate","scale","rotate","perspective","filter"],hw=["paint","layout","strict","content"];function ea(e){const t=ta(),n=Nt(e)?Tt(e):e;return dw.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)||fw.some(r=>(n.willChange||"").includes(r))||hw.some(r=>(n.contain||"").includes(r))}function pw(e){let t=nn(e);for(;Lt(t)&&!Hn(t);){if(ea(t))return t;if(Zo(t))return null;t=nn(t)}return null}function ta(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const mw=new Set(["html","body","#document"]);function Hn(e){return mw.has(Qn(e))}function Tt(e){return gt(e).getComputedStyle(e)}function Vo(e){return Nt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function nn(e){if(Qn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||jl(e)&&e.host||$t(e);return jl(t)?t.host:t}function Kd(e){const t=nn(e);return Hn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Lt(t)&&Ar(t)?t:Kd(t)}function Sr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Kd(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=gt(o);if(s){const a=ei(i);return t.concat(i,i.visualViewport||[],Ar(o)?o:[],a&&n?Sr(a):[])}return t.concat(o,Sr(o,[],n))}function ei(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Jd(e){const t=Tt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Lt(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=po(n)!==s||po(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function na(e){return Nt(e)?e:e.contextElement}function Ln(e){const t=na(e);if(!Lt(t))return Mt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Jd(t);let i=(s?po(n.width):n.width)/r,a=(s?po(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const gw=Mt(0);function Gd(e){const t=gt(e);return!ta()||!t.visualViewport?gw:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xw(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==gt(e)?!1:t}function gn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=na(e);let i=Mt(1);t&&(r?Nt(r)&&(i=Ln(r)):i=Ln(e));const a=xw(s,n,r)?Gd(s):Mt(0);let c=(o.left+a.x)/i.x,u=(o.top+a.y)/i.y,d=o.width/i.x,h=o.height/i.y;if(s){const p=gt(s),f=r&&Nt(r)?gt(r):r;let y=p,m=ei(y);for(;m&&r&&f!==y;){const x=Ln(m),g=m.getBoundingClientRect(),b=Tt(m),w=g.left+(m.clientLeft+parseFloat(b.paddingLeft))*x.x,S=g.top+(m.clientTop+parseFloat(b.paddingTop))*x.y;c*=x.x,u*=x.y,d*=x.x,h*=x.y,c+=w,u+=S,y=gt(m),m=ei(y)}}return go({width:d,height:h,x:c,y:u})}function Wo(e,t){const n=Vo(e).scrollLeft;return t?t.left+n:gn($t(e)).left+n}function Yd(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Wo(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function yw(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=$t(r),a=t?Zo(t.floating):!1;if(r===i||a&&s)return n;let c={scrollLeft:0,scrollTop:0},u=Mt(1);const d=Mt(0),h=Lt(r);if((h||!h&&!s)&&((Qn(r)!=="body"||Ar(i))&&(c=Vo(r)),Lt(r))){const f=gn(r);u=Ln(r),d.x=f.x+r.clientLeft,d.y=f.y+r.clientTop}const p=i&&!h&&!s?Yd(i,c):Mt(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-c.scrollTop*u.y+d.y+p.y}}function vw(e){return Array.from(e.getClientRects())}function bw(e){const t=$t(e),n=Vo(e),r=e.ownerDocument.body,o=pt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=pt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Wo(e);const a=-n.scrollTop;return Tt(r).direction==="rtl"&&(i+=pt(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const El=25;function ww(e,t){const n=gt(e),r=$t(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,c=0;if(o){s=o.width,i=o.height;const d=ta();(!d||d&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}const u=Wo(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,y=Math.abs(r.clientWidth-h.clientWidth-f);y<=El&&(s-=y)}else u<=El&&(s+=u);return{width:s,height:i,x:a,y:c}}const kw=new Set(["absolute","fixed"]);function _w(e,t){const n=gn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Lt(e)?Ln(e):Mt(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,c=o*s.x,u=r*s.y;return{width:i,height:a,x:c,y:u}}function Nl(e,t,n){let r;if(t==="viewport")r=ww(e,n);else if(t==="document")r=bw($t(e));else if(Nt(t))r=_w(t,n);else{const o=Gd(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return go(r)}function Xd(e,t){const n=nn(e);return n===t||!Nt(n)||Hn(n)?!1:Tt(n).position==="fixed"||Xd(n,t)}function Sw(e,t){const n=t.get(e);if(n)return n;let r=Sr(e,[],!1).filter(a=>Nt(a)&&Qn(a)!=="body"),o=null;const s=Tt(e).position==="fixed";let i=s?nn(e):e;for(;Nt(i)&&!Hn(i);){const a=Tt(i),c=ea(i);!c&&a.position==="fixed"&&(o=null),(s?!c&&!o:!c&&a.position==="static"&&!!o&&kw.has(o.position)||Ar(i)&&!c&&Xd(e,i))?r=r.filter(d=>d!==i):o=a,i=nn(i)}return t.set(e,r),r}function Cw(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Zo(t)?[]:Sw(t,this._c):[].concat(n),r],a=i[0],c=i.reduce((u,d)=>{const h=Nl(t,d,o);return u.top=pt(h.top,u.top),u.right=tn(h.right,u.right),u.bottom=tn(h.bottom,u.bottom),u.left=pt(h.left,u.left),u},Nl(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function jw(e){const{width:t,height:n}=Jd(e);return{width:t,height:n}}function Ew(e,t,n){const r=Lt(t),o=$t(t),s=n==="fixed",i=gn(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=Mt(0);function u(){c.x=Wo(o)}if(r||!r&&!s)if((Qn(t)!=="body"||Ar(o))&&(a=Vo(t)),r){const f=gn(t,!0,s,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else o&&u();s&&!r&&o&&u();const d=o&&!r&&!s?Yd(o,a):Mt(0),h=i.left+a.scrollLeft-c.x-d.x,p=i.top+a.scrollTop-c.y-d.y;return{x:h,y:p,width:i.width,height:i.height}}function ws(e){return Tt(e).position==="static"}function Tl(e,t){if(!Lt(e)||Tt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return $t(e)===n&&(n=n.ownerDocument.body),n}function Qd(e,t){const n=gt(e);if(Zo(e))return n;if(!Lt(e)){let o=nn(e);for(;o&&!Hn(o);){if(Nt(o)&&!ws(o))return o;o=nn(o)}return n}let r=Tl(e,t);for(;r&&cw(r)&&ws(r);)r=Tl(r,t);return r&&Hn(r)&&ws(r)&&!ea(r)?n:r||pw(e)||n}const Nw=async function(e){const t=this.getOffsetParent||Qd,n=this.getDimensions,r=await n(e.floating);return{reference:Ew(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Tw(e){return Tt(e).direction==="rtl"}const Aw={convertOffsetParentRelativeRectToViewportRelativeRect:yw,getDocumentElement:$t,getClippingRect:Cw,getOffsetParent:Qd,getElementRects:Nw,getClientRects:vw,getDimensions:jw,getScale:Ln,isElement:Nt,isRTL:Tw};function ef(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Iw(e,t){let n=null,r;const o=$t(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const u=e.getBoundingClientRect(),{left:d,top:h,width:p,height:f}=u;if(a||t(),!p||!f)return;const y=Wr(h),m=Wr(o.clientWidth-(d+p)),x=Wr(o.clientHeight-(h+f)),g=Wr(d),w={rootMargin:-y+"px "+-m+"px "+-x+"px "+-g+"px",threshold:pt(0,tn(1,c))||1};let S=!0;function j(C){const N=C[0].intersectionRatio;if(N!==c){if(!S)return i();N?i(!1,N):r=setTimeout(()=>{i(!1,1e-7)},1e3)}N===1&&!ef(u,e.getBoundingClientRect())&&i(),S=!1}try{n=new IntersectionObserver(j,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(j,w)}n.observe(e)}return i(!0),s}function zw(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=na(e),d=o||s?[...u?Sr(u):[],...Sr(t)]:[];d.forEach(g=>{o&&g.addEventListener("scroll",n,{passive:!0}),s&&g.addEventListener("resize",n)});const h=u&&a?Iw(u,n):null;let p=-1,f=null;i&&(f=new ResizeObserver(g=>{let[b]=g;b&&b.target===u&&f&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var w;(w=f)==null||w.observe(t)})),n()}),u&&!c&&f.observe(u),f.observe(t));let y,m=c?gn(e):null;c&&x();function x(){const g=gn(e);m&&!ef(m,g)&&n(),m=g,y=requestAnimationFrame(x)}return n(),()=>{var g;d.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),h?.(),(g=f)==null||g.disconnect(),f=null,c&&cancelAnimationFrame(y)}}const Pw=rw,Rw=ow,Ow=ew,Dw=iw,Mw=tw,Al=Q2,Lw=sw,Fw=(e,t,n)=>{const r=new Map,o={platform:Aw,...n},s={...o.platform,_c:r};return X2(e,t,{...o,platform:s})};var $w=typeof document<"u",Bw=function(){},ro=$w?v.useLayoutEffect:Bw;function xo(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(!xo(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!xo(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function tf(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Il(e,t){const n=tf(e);return Math.round(t*n)/n}function ks(e){const t=v.useRef(e);return ro(()=>{t.current=e}),t}function Uw(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:c,open:u}=e,[d,h]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=v.useState(r);xo(p,r)||f(r);const[y,m]=v.useState(null),[x,g]=v.useState(null),b=v.useCallback(H=>{H!==C.current&&(C.current=H,m(H))},[]),w=v.useCallback(H=>{H!==N.current&&(N.current=H,g(H))},[]),S=s||y,j=i||x,C=v.useRef(null),N=v.useRef(null),T=v.useRef(d),z=c!=null,O=ks(c),L=ks(o),E=ks(u),M=v.useCallback(()=>{if(!C.current||!N.current)return;const H={placement:t,strategy:n,middleware:p};L.current&&(H.platform=L.current),Fw(C.current,N.current,H).then(X=>{const A={...X,isPositioned:E.current!==!1};k.current&&!xo(T.current,A)&&(T.current=A,Nr.flushSync(()=>{h(A)}))})},[p,t,n,L,E]);ro(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,h(H=>({...H,isPositioned:!1})))},[u]);const k=v.useRef(!1);ro(()=>(k.current=!0,()=>{k.current=!1}),[]),ro(()=>{if(S&&(C.current=S),j&&(N.current=j),S&&j){if(O.current)return O.current(S,j,M);M()}},[S,j,M,O,z]);const D=v.useMemo(()=>({reference:C,floating:N,setReference:b,setFloating:w}),[b,w]),G=v.useMemo(()=>({reference:S,floating:j}),[S,j]),W=v.useMemo(()=>{const H={position:n,left:0,top:0};if(!G.floating)return H;const X=Il(G.floating,d.x),A=Il(G.floating,d.y);return a?{...H,transform:"translate("+X+"px, "+A+"px)",...tf(G.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:X,top:A}},[n,a,G.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:M,refs:D,elements:G,floatingStyles:W}),[d,M,D,G,W])}const Zw=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?Al({element:r.current,padding:o}).fn(n):{}:r?Al({element:r,padding:o}).fn(n):{}}}},Vw=(e,t)=>({...Pw(e),options:[e,t]}),Ww=(e,t)=>({...Rw(e),options:[e,t]}),Hw=(e,t)=>({...Lw(e),options:[e,t]}),qw=(e,t)=>({...Ow(e),options:[e,t]}),Kw=(e,t)=>({...Dw(e),options:[e,t]}),Jw=(e,t)=>({...Mw(e),options:[e,t]}),Gw=(e,t)=>({...Zw(e),options:[e,t]});var Yw="Arrow",nf=v.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return l.jsx(Ce.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});nf.displayName=Yw;var Xw=nf,ra="Popper",[rf,Ho]=Jt(ra),[Qw,of]=rf(ra),sf=e=>{const{__scopePopper:t,children:n}=e,[r,o]=v.useState(null);return l.jsx(Qw,{scope:t,anchor:r,onAnchorChange:o,children:n})};sf.displayName=ra;var af="PopperAnchor",lf=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=of(af,n),i=v.useRef(null),a=Me(t,i),c=v.useRef(null);return v.useEffect(()=>{const u=c.current;c.current=r?.current||i.current,u!==c.current&&s.onAnchorChange(c.current)}),r?null:l.jsx(Ce.div,{...o,ref:a})});lf.displayName=af;var oa="PopperContent",[ek,tk]=rf(oa),cf=v.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:p=!1,updatePositionStrategy:f="optimized",onPlaced:y,...m}=e,x=of(oa,n),[g,b]=v.useState(null),w=Me(t,te=>b(te)),[S,j]=v.useState(null),C=F2(S),N=C?.width??0,T=C?.height??0,z=r+(s!=="center"?"-"+s:""),O=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},L=Array.isArray(u)?u:[u],E=L.length>0,M={padding:O,boundary:L.filter(rk),altBoundary:E},{refs:k,floatingStyles:D,placement:G,isPositioned:W,middlewareData:H}=Uw({strategy:"fixed",placement:z,whileElementsMounted:(...te)=>zw(...te,{animationFrame:f==="always"}),elements:{reference:x.anchor},middleware:[Vw({mainAxis:o+T,alignmentAxis:i}),c&&Ww({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?Hw():void 0,...M}),c&&qw({...M}),Kw({...M,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&&Gw({element:S,padding:a}),ok({arrowWidth:N,arrowHeight:T}),p&&Jw({strategy:"referenceHidden",...M})]}),[X,A]=ff(G),V=st(y);Qe(()=>{W&&V?.()},[W,V]);const Z=H.arrow?.x,I=H.arrow?.y,oe=H.arrow?.centerOffset!==0,[Y,de]=v.useState();return Qe(()=>{g&&de(window.getComputedStyle(g).zIndex)},[g]),l.jsx("div",{ref:k.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:W?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,"--radix-popper-transform-origin":[H.transformOrigin?.x,H.transformOrigin?.y].join(" "),...H.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(ek,{scope:n,placedSide:X,onArrowChange:j,arrowX:Z,arrowY:I,shouldHideArrow:oe,children:l.jsx(Ce.div,{"data-side":X,"data-align":A,...m,ref:w,style:{...m.style,animation:W?void 0:"none"}})})})});cf.displayName=oa;var uf="PopperArrow",nk={top:"bottom",right:"left",bottom:"top",left:"right"},df=v.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=tk(uf,r),i=nk[s.placedSide];return l.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:l.jsx(Xw,{...o,ref:n,style:{...o.style,display:"block"}})})});df.displayName=uf;function rk(e){return e!==null}var ok=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=o.arrow?.centerOffset!==0,a=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[u,d]=ff(n),h={start:"0%",center:"50%",end:"100%"}[d],p=(o.arrow?.x??0)+a/2,f=(o.arrow?.y??0)+c/2;let y="",m="";return u==="bottom"?(y=i?h:`${p}px`,m=`${-c}px`):u==="top"?(y=i?h:`${p}px`,m=`${r.floating.height+c}px`):u==="right"?(y=`${-c}px`,m=i?h:`${f}px`):u==="left"&&(y=`${r.floating.width+c}px`,m=i?h:`${f}px`),{data:{x:y,y:m}}}});function ff(e){const[t,n="center"]=e.split("-");return[t,n]}var hf=sf,pf=lf,mf=cf,gf=df,_s="rovingFocusGroup.onEntryFocus",sk={bubbles:!1,cancelable:!0},Ir="RovingFocusGroup",[ti,xf,ik]=fd(Ir),[ak,yf]=Jt(Ir,[ik]),[lk,ck]=ak(Ir),vf=v.forwardRef((e,t)=>l.jsx(ti.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(ti.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(uk,{...e,ref:t})})}));vf.displayName=Ir;var uk=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...h}=e,p=v.useRef(null),f=Me(t,p),y=Mo(s),[m,x]=pn({prop:i,defaultProp:a??null,onChange:c,caller:Ir}),[g,b]=v.useState(!1),w=st(u),S=xf(n),j=v.useRef(!1),[C,N]=v.useState(0);return v.useEffect(()=>{const T=p.current;if(T)return T.addEventListener(_s,w),()=>T.removeEventListener(_s,w)},[w]),l.jsx(lk,{scope:n,orientation:r,dir:y,loop:o,currentTabStopId:m,onItemFocus:v.useCallback(T=>x(T),[x]),onItemShiftTab:v.useCallback(()=>b(!0),[]),onFocusableItemAdd:v.useCallback(()=>N(T=>T+1),[]),onFocusableItemRemove:v.useCallback(()=>N(T=>T-1),[]),children:l.jsx(Ce.div,{tabIndex:g||C===0?-1:0,"data-orientation":r,...h,ref:f,style:{outline:"none",...e.style},onMouseDown:we(e.onMouseDown,()=>{j.current=!0}),onFocus:we(e.onFocus,T=>{const z=!j.current;if(T.target===T.currentTarget&&z&&!g){const O=new CustomEvent(_s,sk);if(T.currentTarget.dispatchEvent(O),!O.defaultPrevented){const L=S().filter(G=>G.focusable),E=L.find(G=>G.active),M=L.find(G=>G.id===m),D=[E,M,...L].filter(Boolean).map(G=>G.ref.current);kf(D,d)}}j.current=!1}),onBlur:we(e.onBlur,()=>b(!1))})})}),bf="RovingFocusGroupItem",wf=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...a}=e,c=Dt(),u=s||c,d=ck(bf,n),h=d.currentTabStopId===u,p=xf(n),{onFocusableItemAdd:f,onFocusableItemRemove:y,currentTabStopId:m}=d;return v.useEffect(()=>{if(r)return f(),()=>y()},[r,f,y]),l.jsx(ti.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:l.jsx(Ce.span,{tabIndex:h?0:-1,"data-orientation":d.orientation,...a,ref:t,onMouseDown:we(e.onMouseDown,x=>{r?d.onItemFocus(u):x.preventDefault()}),onFocus:we(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:we(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){d.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const g=hk(x,d.orientation,d.dir);if(g!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let w=p().filter(S=>S.focusable).map(S=>S.ref.current);if(g==="last")w.reverse();else if(g==="prev"||g==="next"){g==="prev"&&w.reverse();const S=w.indexOf(x.currentTarget);w=d.loop?pk(w,S+1):w.slice(S+1)}setTimeout(()=>kf(w))}}),children:typeof i=="function"?i({isCurrentTabStop:h,hasTabStop:m!=null}):i})})});wf.displayName=bf;var dk={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function fk(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function hk(e,t,n){const r=fk(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return dk[r]}function kf(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function pk(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var mk=vf,gk=wf;function ni(e,[t,n]){return Math.min(n,Math.max(t,e))}function xk(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var sa="ScrollArea",[_f]=Jt(sa),[yk,_t]=_f(sa),Sf=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[a,c]=v.useState(null),[u,d]=v.useState(null),[h,p]=v.useState(null),[f,y]=v.useState(null),[m,x]=v.useState(null),[g,b]=v.useState(0),[w,S]=v.useState(0),[j,C]=v.useState(!1),[N,T]=v.useState(!1),z=Me(t,L=>c(L)),O=Mo(o);return l.jsx(yk,{scope:n,type:r,dir:O,scrollHideDelay:s,scrollArea:a,viewport:u,onViewportChange:d,content:h,onContentChange:p,scrollbarX:f,onScrollbarXChange:y,scrollbarXEnabled:j,onScrollbarXEnabledChange:C,scrollbarY:m,onScrollbarYChange:x,scrollbarYEnabled:N,onScrollbarYEnabledChange:T,onCornerWidthChange:b,onCornerHeightChange:S,children:l.jsx(Ce.div,{dir:O,...i,ref:z,style:{position:"relative","--radix-scroll-area-corner-width":g+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});Sf.displayName=sa;var Cf="ScrollAreaViewport",jf=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,nonce:o,...s}=e,i=_t(Cf,n),a=v.useRef(null),c=Me(t,a,i.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),l.jsx(Ce.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:l.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});jf.displayName=Cf;var Bt="ScrollAreaScrollbar",Ef=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=_t(Bt,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,a=e.orientation==="horizontal";return v.useEffect(()=>(a?s(!0):i(!0),()=>{a?s(!1):i(!1)}),[a,s,i]),o.type==="hover"?l.jsx(vk,{...r,ref:t,forceMount:n}):o.type==="scroll"?l.jsx(bk,{...r,ref:t,forceMount:n}):o.type==="auto"?l.jsx(Nf,{...r,ref:t,forceMount:n}):o.type==="always"?l.jsx(ia,{...r,ref:t}):null});Ef.displayName=Bt;var vk=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=_t(Bt,e.__scopeScrollArea),[s,i]=v.useState(!1);return v.useEffect(()=>{const a=o.scrollArea;let c=0;if(a){const u=()=>{window.clearTimeout(c),i(!0)},d=()=>{c=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",d)}}},[o.scrollArea,o.scrollHideDelay]),l.jsx(kt,{present:n||s,children:l.jsx(Nf,{"data-state":s?"visible":"hidden",...r,ref:t})})}),bk=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=_t(Bt,e.__scopeScrollArea),s=e.orientation==="horizontal",i=Ko(()=>c("SCROLL_END"),100),[a,c]=xk("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return v.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>c("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,o.scrollHideDelay,c]),v.useEffect(()=>{const u=o.viewport,d=s?"scrollLeft":"scrollTop";if(u){let h=u[d];const p=()=>{const f=u[d];h!==f&&(c("SCROLL"),i()),h=f};return u.addEventListener("scroll",p),()=>u.removeEventListener("scroll",p)}},[o.viewport,s,c,i]),l.jsx(kt,{present:n||a!=="hidden",children:l.jsx(ia,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:we(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:we(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Nf=v.forwardRef((e,t)=>{const n=_t(Bt,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=v.useState(!1),a=e.orientation==="horizontal",c=Ko(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;i(a?u:d)}},10);return qn(n.viewport,c),qn(n.content,c),l.jsx(kt,{present:r||s,children:l.jsx(ia,{"data-state":s?"visible":"hidden",...o,ref:t})})}),ia=v.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,o=_t(Bt,e.__scopeScrollArea),s=v.useRef(null),i=v.useRef(0),[a,c]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=Pf(a.viewport,a.content),d={...r,sizes:a,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:p=>s.current=p,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:p=>i.current=p};function h(p,f){return jk(p,i.current,a,f)}return n==="horizontal"?l.jsx(wk,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const p=o.viewport.scrollLeft,f=zl(p,a,o.dir);s.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:p=>{o.viewport&&(o.viewport.scrollLeft=p)},onDragScroll:p=>{o.viewport&&(o.viewport.scrollLeft=h(p,o.dir))}}):n==="vertical"?l.jsx(kk,{...d,ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const p=o.viewport.scrollTop,f=zl(p,a);s.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:p=>{o.viewport&&(o.viewport.scrollTop=p)},onDragScroll:p=>{o.viewport&&(o.viewport.scrollTop=h(p))}}):null}),wk=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=_t(Bt,e.__scopeScrollArea),[i,a]=v.useState(),c=v.useRef(null),u=Me(t,c,s.onScrollbarXChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(Af,{"data-orientation":"horizontal",...o,ref:u,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":qo(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,h)=>{if(s.viewport){const p=s.viewport.scrollLeft+d.deltaX;e.onWheelScroll(p),Of(p,h)&&d.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:vo(i.paddingLeft),paddingEnd:vo(i.paddingRight)}})}})}),kk=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=_t(Bt,e.__scopeScrollArea),[i,a]=v.useState(),c=v.useRef(null),u=Me(t,c,s.onScrollbarYChange);return v.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),l.jsx(Af,{"data-orientation":"vertical",...o,ref:u,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":qo(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,h)=>{if(s.viewport){const p=s.viewport.scrollTop+d.deltaY;e.onWheelScroll(p),Of(p,h)&&d.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:vo(i.paddingTop),paddingEnd:vo(i.paddingBottom)}})}})}),[_k,Tf]=_f(Bt),Af=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:h,...p}=e,f=_t(Bt,n),[y,m]=v.useState(null),x=Me(t,z=>m(z)),g=v.useRef(null),b=v.useRef(""),w=f.viewport,S=r.content-r.viewport,j=st(d),C=st(c),N=Ko(h,10);function T(z){if(g.current){const O=z.clientX-g.current.left,L=z.clientY-g.current.top;u({x:O,y:L})}}return v.useEffect(()=>{const z=O=>{const L=O.target;y?.contains(L)&&j(O,S)};return document.addEventListener("wheel",z,{passive:!1}),()=>document.removeEventListener("wheel",z,{passive:!1})},[w,y,S,j]),v.useEffect(C,[r,C]),qn(y,N),qn(f.content,N),l.jsx(_k,{scope:n,scrollbar:y,hasThumb:o,onThumbChange:st(s),onThumbPointerUp:st(i),onThumbPositionChange:C,onThumbPointerDown:st(a),children:l.jsx(Ce.div,{...p,ref:x,style:{position:"absolute",...p.style},onPointerDown:we(e.onPointerDown,z=>{z.button===0&&(z.target.setPointerCapture(z.pointerId),g.current=y.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),T(z))}),onPointerMove:we(e.onPointerMove,T),onPointerUp:we(e.onPointerUp,z=>{const O=z.target;O.hasPointerCapture(z.pointerId)&&O.releasePointerCapture(z.pointerId),document.body.style.webkitUserSelect=b.current,f.viewport&&(f.viewport.style.scrollBehavior=""),g.current=null})})})}),yo="ScrollAreaThumb",If=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Tf(yo,e.__scopeScrollArea);return l.jsx(kt,{present:n||o.hasThumb,children:l.jsx(Sk,{ref:t,...r})})}),Sk=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=_t(yo,n),i=Tf(yo,n),{onThumbPositionChange:a}=i,c=Me(t,h=>i.onThumbChange(h)),u=v.useRef(void 0),d=Ko(()=>{u.current&&(u.current(),u.current=void 0)},100);return v.useEffect(()=>{const h=s.viewport;if(h){const p=()=>{if(d(),!u.current){const f=Ek(h,a);u.current=f,a()}};return a(),h.addEventListener("scroll",p),()=>h.removeEventListener("scroll",p)}},[s.viewport,d,a]),l.jsx(Ce.div,{"data-state":i.hasThumb?"visible":"hidden",...o,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:we(e.onPointerDownCapture,h=>{const f=h.target.getBoundingClientRect(),y=h.clientX-f.left,m=h.clientY-f.top;i.onThumbPointerDown({x:y,y:m})}),onPointerUp:we(e.onPointerUp,i.onThumbPointerUp)})});If.displayName=yo;var aa="ScrollAreaCorner",zf=v.forwardRef((e,t)=>{const n=_t(aa,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?l.jsx(Ck,{...e,ref:t}):null});zf.displayName=aa;var Ck=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=_t(aa,n),[s,i]=v.useState(0),[a,c]=v.useState(0),u=!!(s&&a);return qn(o.scrollbarX,()=>{const d=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(d),c(d)}),qn(o.scrollbarY,()=>{const d=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(d),i(d)}),u?l.jsx(Ce.div,{...r,ref:t,style:{width:s,height:a,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function vo(e){return e?parseInt(e,10):0}function Pf(e,t){const n=e/t;return isNaN(n)?0:n}function qo(e){const t=Pf(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function jk(e,t,n,r="ltr"){const o=qo(n),s=o/2,i=t||s,a=o-i,c=n.scrollbar.paddingStart+i,u=n.scrollbar.size-n.scrollbar.paddingEnd-a,d=n.content-n.viewport,h=r==="ltr"?[0,d]:[d*-1,0];return Rf([c,u],h)(e)}function zl(e,t,n="ltr"){const r=qo(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,i=t.content-t.viewport,a=s-r,c=n==="ltr"?[0,i]:[i*-1,0],u=ni(e,c);return Rf([0,i],[0,a])(u)}function Rf(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 Of(e,t){return e>0&&e<t}var Ek=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function o(){const s={left:e.scrollLeft,top:e.scrollTop},i=n.left!==s.left,a=n.top!==s.top;(i||a)&&t(),n=s,r=window.requestAnimationFrame(o)})(),()=>window.cancelAnimationFrame(r)};function Ko(e,t){const n=st(e),r=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),v.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function qn(e,t){const n=st(t);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 Nk=Sf,Tk=jf,Ak=zf,Ik=[" ","Enter","ArrowUp","ArrowDown"],zk=[" ","Enter"],xn="Select",[Jo,Go,Pk]=fd(xn),[er]=Jt(xn,[Pk,Ho]),Yo=Ho(),[Rk,an]=er(xn),[Ok,Dk]=er(xn),Df=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:a,onValueChange:c,dir:u,name:d,autoComplete:h,disabled:p,required:f,form:y}=e,m=Yo(t),[x,g]=v.useState(null),[b,w]=v.useState(null),[S,j]=v.useState(!1),C=Mo(u),[N,T]=pn({prop:r,defaultProp:o??!1,onChange:s,caller:xn}),[z,O]=pn({prop:i,defaultProp:a,onChange:c,caller:xn}),L=v.useRef(null),E=x?y||!!x.closest("form"):!0,[M,k]=v.useState(new Set),D=Array.from(M).map(G=>G.props.value).join(";");return l.jsx(hf,{...m,children:l.jsxs(Rk,{required:f,scope:t,trigger:x,onTriggerChange:g,valueNode:b,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:j,contentId:Dt(),value:z,onValueChange:O,open:N,onOpenChange:T,dir:C,triggerPointerDownPosRef:L,disabled:p,children:[l.jsx(Jo.Provider,{scope:t,children:l.jsx(Ok,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(G=>{k(W=>new Set(W).add(G))},[]),onNativeOptionRemove:v.useCallback(G=>{k(W=>{const H=new Set(W);return H.delete(G),H})},[]),children:n})}),E?l.jsxs(oh,{"aria-hidden":!0,required:f,tabIndex:-1,name:d,autoComplete:h,value:z,onChange:G=>O(G.target.value),disabled:p,form:y,children:[z===void 0?l.jsx("option",{value:""}):null,Array.from(M)]},D):null]})})};Df.displayName=xn;var Mf="SelectTrigger",Lf=v.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=Yo(n),i=an(Mf,n),a=i.disabled||r,c=Me(t,i.onTriggerChange),u=Go(n),d=v.useRef("touch"),[h,p,f]=ih(m=>{const x=u().filter(w=>!w.disabled),g=x.find(w=>w.value===i.value),b=ah(x,m,g);b!==void 0&&i.onValueChange(b.value)}),y=m=>{a||(i.onOpenChange(!0),f()),m&&(i.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return l.jsx(pf,{asChild:!0,...s,children:l.jsx(Ce.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":sh(i.value)?"":void 0,...o,ref:c,onClick:we(o.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&y(m)}),onPointerDown:we(o.onPointerDown,m=>{d.current=m.pointerType;const x=m.target;x.hasPointerCapture(m.pointerId)&&x.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(y(m),m.preventDefault())}),onKeyDown:we(o.onKeyDown,m=>{const x=h.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&p(m.key),!(x&&m.key===" ")&&Ik.includes(m.key)&&(y(),m.preventDefault())})})})});Lf.displayName=Mf;var Ff="SelectValue",$f=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...a}=e,c=an(Ff,n),{onValueNodeHasChildrenChange:u}=c,d=s!==void 0,h=Me(t,c.onValueNodeChange);return Qe(()=>{u(d)},[u,d]),l.jsx(Ce.span,{...a,ref:h,style:{pointerEvents:"none"},children:sh(c.value)?l.jsx(l.Fragment,{children:i}):s})});$f.displayName=Ff;var Mk="SelectIcon",Bf=v.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return l.jsx(Ce.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});Bf.displayName=Mk;var Lk="SelectPortal",Uf=e=>l.jsx(Fo,{asChild:!0,...e});Uf.displayName=Lk;var yn="SelectContent",Zf=v.forwardRef((e,t)=>{const n=an(yn,e.__scopeSelect),[r,o]=v.useState();if(Qe(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?Nr.createPortal(l.jsx(Vf,{scope:e.__scopeSelect,children:l.jsx(Jo.Slot,{scope:e.__scopeSelect,children:l.jsx("div",{children:e.children})})}),s):null}return l.jsx(Wf,{...e,ref:t})});Zf.displayName=yn;var jt=10,[Vf,ln]=er(yn),Fk="SelectContentImpl",$k=Wn("SelectContent.RemoveScroll"),Wf=v.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:p,collisionPadding:f,sticky:y,hideWhenDetached:m,avoidCollisions:x,...g}=e,b=an(yn,n),[w,S]=v.useState(null),[j,C]=v.useState(null),N=Me(t,te=>S(te)),[T,z]=v.useState(null),[O,L]=v.useState(null),E=Go(n),[M,k]=v.useState(!1),D=v.useRef(!1);v.useEffect(()=>{if(w)return Td(w)},[w]),bd();const G=v.useCallback(te=>{const[ce,...fe]=E().map(Ee=>Ee.ref.current),[ge]=fe.slice(-1),xe=document.activeElement;for(const Ee of te)if(Ee===xe||(Ee?.scrollIntoView({block:"nearest"}),Ee===ce&&j&&(j.scrollTop=0),Ee===ge&&j&&(j.scrollTop=j.scrollHeight),Ee?.focus(),document.activeElement!==xe))return},[E,j]),W=v.useCallback(()=>G([T,w]),[G,T,w]);v.useEffect(()=>{M&&W()},[M,W]);const{onOpenChange:H,triggerPointerDownPosRef:X}=b;v.useEffect(()=>{if(w){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():w.contains(ge.target)||H(!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})}}},[w,H,X]),v.useEffect(()=>{const te=()=>H(!1);return window.addEventListener("blur",te),window.addEventListener("resize",te),()=>{window.removeEventListener("blur",te),window.removeEventListener("resize",te)}},[H]);const[A,V]=ih(te=>{const ce=E().filter(xe=>!xe.disabled),fe=ce.find(xe=>xe.ref.current===document.activeElement),ge=ah(ce,te,fe);ge&&setTimeout(()=>ge.ref.current.focus())}),Z=v.useCallback((te,ce,fe)=>{const ge=!D.current&&!fe;(b.value!==void 0&&b.value===ce||ge)&&(z(te),ge&&(D.current=!0))},[b.value]),I=v.useCallback(()=>w?.focus(),[w]),oe=v.useCallback((te,ce,fe)=>{const ge=!D.current&&!fe;(b.value!==void 0&&b.value===ce||ge)&&L(te)},[b.value]),Y=r==="popper"?ri:Hf,de=Y===ri?{side:a,sideOffset:c,align:u,alignOffset:d,arrowPadding:h,collisionBoundary:p,collisionPadding:f,sticky:y,hideWhenDetached:m,avoidCollisions:x}:{};return l.jsx(Vf,{scope:n,content:w,viewport:j,onViewportChange:C,itemRefCallback:Z,selectedItem:T,onItemLeave:I,itemTextRefCallback:oe,focusSelectedItem:W,selectedItemText:O,position:r,isPositioned:M,searchRef:A,children:l.jsx(qi,{as:$k,allowPinchZoom:!0,children:l.jsx(Hi,{asChild:!0,trapped:b.open,onMountAutoFocus:te=>{te.preventDefault()},onUnmountAutoFocus:we(o,te=>{b.trigger?.focus({preventScroll:!0}),te.preventDefault()}),children:l.jsx(Lo,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,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:()=>k(!0),ref:N,style:{display:"flex",flexDirection:"column",outline:"none",...g.style},onKeyDown:we(g.onKeyDown,te=>{const ce=te.ctrlKey||te.altKey||te.metaKey;if(te.key==="Tab"&&te.preventDefault(),!ce&&te.key.length===1&&V(te.key),["ArrowUp","ArrowDown","Home","End"].includes(te.key)){let ge=E().filter(xe=>!xe.disabled).map(xe=>xe.ref.current);if(["ArrowUp","End"].includes(te.key)&&(ge=ge.slice().reverse()),["ArrowUp","ArrowDown"].includes(te.key)){const xe=te.target,Ee=ge.indexOf(xe);ge=ge.slice(Ee+1)}setTimeout(()=>G(ge)),te.preventDefault()}})})})})})})});Wf.displayName=Fk;var Bk="SelectItemAlignedPosition",Hf=v.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=an(yn,n),i=ln(yn,n),[a,c]=v.useState(null),[u,d]=v.useState(null),h=Me(t,N=>d(N)),p=Go(n),f=v.useRef(!1),y=v.useRef(!0),{viewport:m,selectedItem:x,selectedItemText:g,focusSelectedItem:b}=i,w=v.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&u&&m&&x&&g){const N=s.trigger.getBoundingClientRect(),T=u.getBoundingClientRect(),z=s.valueNode.getBoundingClientRect(),O=g.getBoundingClientRect();if(s.dir!=="rtl"){const xe=O.left-T.left,Ee=z.left-xe,Fe=N.left-Ee,_=N.width+Fe,ee=Math.max(_,T.width),K=window.innerWidth-jt,R=ni(Ee,[jt,Math.max(jt,K-ee)]);a.style.minWidth=_+"px",a.style.left=R+"px"}else{const xe=T.right-O.right,Ee=window.innerWidth-z.right-xe,Fe=window.innerWidth-N.right-Ee,_=N.width+Fe,ee=Math.max(_,T.width),K=window.innerWidth-jt,R=ni(Ee,[jt,Math.max(jt,K-ee)]);a.style.minWidth=_+"px",a.style.right=R+"px"}const L=p(),E=window.innerHeight-jt*2,M=m.scrollHeight,k=window.getComputedStyle(u),D=parseInt(k.borderTopWidth,10),G=parseInt(k.paddingTop,10),W=parseInt(k.borderBottomWidth,10),H=parseInt(k.paddingBottom,10),X=D+G+M+H+W,A=Math.min(x.offsetHeight*5,X),V=window.getComputedStyle(m),Z=parseInt(V.paddingTop,10),I=parseInt(V.paddingBottom,10),oe=N.top+N.height/2-jt,Y=E-oe,de=x.offsetHeight/2,te=x.offsetTop+de,ce=D+G+te,fe=X-ce;if(ce<=oe){const xe=L.length>0&&x===L[L.length-1].ref.current;a.style.bottom="0px";const Ee=u.clientHeight-m.offsetTop-m.offsetHeight,Fe=Math.max(Y,de+(xe?I:0)+Ee+W),_=ce+Fe;a.style.height=_+"px"}else{const xe=L.length>0&&x===L[0].ref.current;a.style.top="0px";const Fe=Math.max(oe,D+m.offsetTop+(xe?Z:0)+de)+fe;a.style.height=Fe+"px",m.scrollTop=ce-oe+m.offsetTop}a.style.margin=`${jt}px 0`,a.style.minHeight=A+"px",a.style.maxHeight=E+"px",r?.(),requestAnimationFrame(()=>f.current=!0)}},[p,s.trigger,s.valueNode,a,u,m,x,g,s.dir,r]);Qe(()=>w(),[w]);const[S,j]=v.useState();Qe(()=>{u&&j(window.getComputedStyle(u).zIndex)},[u]);const C=v.useCallback(N=>{N&&y.current===!0&&(w(),b?.(),y.current=!1)},[w,b]);return l.jsx(Zk,{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}})})})});Hf.displayName=Bk;var Uk="SelectPopperPosition",ri=v.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=jt,...s}=e,i=Yo(n);return l.jsx(mf,{...i,...s,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});ri.displayName=Uk;var[Zk,la]=er(yn,{}),oi="SelectViewport",qf=v.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=ln(oi,n),i=la(oi,n),a=Me(t,s.onViewportChange),c=v.useRef(0);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),l.jsx(Jo.Slot,{scope:n,children:l.jsx(Ce.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:we(o.onScroll,u=>{const d=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:p}=i;if(p?.current&&h){const f=Math.abs(c.current-d.scrollTop);if(f>0){const y=window.innerHeight-jt*2,m=parseFloat(h.style.minHeight),x=parseFloat(h.style.height),g=Math.max(m,x);if(g<y){const b=g+f,w=Math.min(y,b),S=b-w;h.style.height=w+"px",h.style.bottom==="0px"&&(d.scrollTop=S>0?S:0,h.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});qf.displayName=oi;var Kf="SelectGroup",[Vk,Wk]=er(Kf),Hk=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Dt();return l.jsx(Vk,{scope:n,id:o,children:l.jsx(Ce.div,{role:"group","aria-labelledby":o,...r,ref:t})})});Hk.displayName=Kf;var Jf="SelectLabel",qk=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Wk(Jf,n);return l.jsx(Ce.div,{id:o.id,...r,ref:t})});qk.displayName=Jf;var bo="SelectItem",[Kk,Gf]=er(bo),Yf=v.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,a=an(bo,n),c=ln(bo,n),u=a.value===r,[d,h]=v.useState(s??""),[p,f]=v.useState(!1),y=Me(t,b=>c.itemRefCallback?.(b,r,o)),m=Dt(),x=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(Kk,{scope:n,value:r,disabled:o,textId:m,isSelected:u,onItemTextChange:v.useCallback(b=>{h(w=>w||(b?.textContent??"").trim())},[]),children:l.jsx(Jo.ItemSlot,{scope:n,value:r,disabled:o,textValue:d,children:l.jsx(Ce.div,{role:"option","aria-labelledby":m,"data-highlighted":p?"":void 0,"aria-selected":u&&p,"data-state":u?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:y,onFocus:we(i.onFocus,()=>f(!0)),onBlur:we(i.onBlur,()=>f(!1)),onClick:we(i.onClick,()=>{x.current!=="mouse"&&g()}),onPointerUp:we(i.onPointerUp,()=>{x.current==="mouse"&&g()}),onPointerDown:we(i.onPointerDown,b=>{x.current=b.pointerType}),onPointerMove:we(i.onPointerMove,b=>{x.current=b.pointerType,o?c.onItemLeave?.():x.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:we(i.onPointerLeave,b=>{b.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:we(i.onKeyDown,b=>{c.searchRef?.current!==""&&b.key===" "||(zk.includes(b.key)&&g(),b.key===" "&&b.preventDefault())})})})})});Yf.displayName=bo;var gr="SelectItemText",Xf=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=an(gr,n),a=ln(gr,n),c=Gf(gr,n),u=Dk(gr,n),[d,h]=v.useState(null),p=Me(t,g=>h(g),c.onItemTextChange,g=>a.itemTextRefCallback?.(g,c.value,c.disabled)),f=d?.textContent,y=v.useMemo(()=>l.jsx("option",{value:c.value,disabled:c.disabled,children:f},c.value),[c.disabled,c.value,f]),{onNativeOptionAdd:m,onNativeOptionRemove:x}=u;return Qe(()=>(m(y),()=>x(y)),[m,x,y]),l.jsxs(l.Fragment,{children:[l.jsx(Ce.span,{id:c.textId,...s,ref:p}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Nr.createPortal(s.children,i.valueNode):null]})});Xf.displayName=gr;var Qf="SelectItemIndicator",eh=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Gf(Qf,n).isSelected?l.jsx(Ce.span,{"aria-hidden":!0,...r,ref:t}):null});eh.displayName=Qf;var si="SelectScrollUpButton",th=v.forwardRef((e,t)=>{const n=ln(si,e.__scopeSelect),r=la(si,e.__scopeSelect),[o,s]=v.useState(!1),i=Me(t,r.onScrollButtonChange);return Qe(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=c.scrollTop>0;s(u)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?l.jsx(rh,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop-c.offsetHeight)}}):null});th.displayName=si;var ii="SelectScrollDownButton",nh=v.forwardRef((e,t)=>{const n=ln(ii,e.__scopeSelect),r=la(ii,e.__scopeSelect),[o,s]=v.useState(!1),i=Me(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;s(d)};const c=n.viewport;return a(),c.addEventListener("scroll",a),()=>c.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?l.jsx(rh,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:c}=n;a&&c&&(a.scrollTop=a.scrollTop+c.offsetHeight)}}):null});nh.displayName=ii;var rh=v.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=ln("SelectScrollButton",n),i=v.useRef(null),a=Go(n),c=v.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.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:we(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:we(o.onPointerMove,()=>{s.onItemLeave?.(),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:we(o.onPointerLeave,()=>{c()})})}),Jk="SelectSeparator",Gk=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return l.jsx(Ce.div,{"aria-hidden":!0,...r,ref:t})});Gk.displayName=Jk;var ai="SelectArrow",Yk=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Yo(n),s=an(ai,n),i=ln(ai,n);return s.open&&i.position==="popper"?l.jsx(gf,{...o,...r,ref:t}):null});Yk.displayName=ai;var Xk="SelectBubbleInput",oh=v.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=v.useRef(null),s=Me(r,o),i=L2(t);return v.useEffect(()=>{const a=o.current;if(!a)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const h=new Event("change",{bubbles:!0});d.call(a,t),a.dispatchEvent(h)}},[i,t]),l.jsx(Ce.select,{...n,style:{...ud,...n.style},ref:s,defaultValue:t})});oh.displayName=Xk;function sh(e){return e===""||e===void 0}function ih(e){const t=st(e),n=v.useRef(""),r=v.useRef(0),o=v.useCallback(i=>{const a=n.current+i;t(a),(function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(a)},[t]),s=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function ah(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=Qk(e,Math.max(s,0));o.length===1&&(i=i.filter(u=>u!==n));const c=i.find(u=>u.textValue.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function Qk(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var e_=Df,t_=Lf,n_=$f,r_=Bf,o_=Uf,s_=Zf,i_=qf,a_=Yf,l_=Xf,c_=eh,u_=th,d_=nh,f_="Separator",Pl="horizontal",h_=["horizontal","vertical"],lh=v.forwardRef((e,t)=>{const{decorative:n,orientation:r=Pl,...o}=e,s=p_(r)?r:Pl,a=n?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return l.jsx(Ce.div,{"data-orientation":s,...a,...o,ref:t})});lh.displayName=f_;function p_(e){return h_.includes(e)}var m_=lh,Xo="Tabs",[g_]=Jt(Xo,[yf]),ch=yf(),[x_,ca]=g_(Xo),uh=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=Mo(a),[h,p]=pn({prop:r,onChange:o,defaultProp:s??"",caller:Xo});return l.jsx(x_,{scope:n,baseId:Dt(),value:h,onValueChange:p,orientation:i,dir:d,activationMode:c,children:l.jsx(Ce.div,{dir:d,"data-orientation":i,...u,ref:t})})});uh.displayName=Xo;var dh="TabsList",fh=v.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=ca(dh,n),i=ch(n);return l.jsx(mk,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:l.jsx(Ce.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});fh.displayName=dh;var hh="TabsTrigger",ph=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=ca(hh,n),a=ch(n),c=xh(i.baseId,r),u=yh(i.baseId,r),d=r===i.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,...s,ref:t,onMouseDown:we(e.onMouseDown,h=>{!o&&h.button===0&&h.ctrlKey===!1?i.onValueChange(r):h.preventDefault()}),onKeyDown:we(e.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&i.onValueChange(r)}),onFocus:we(e.onFocus,()=>{const h=i.activationMode!=="manual";!d&&!o&&h&&i.onValueChange(r)})})})});ph.displayName=hh;var mh="TabsContent",gh=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,a=ca(mh,n),c=xh(a.baseId,r),u=yh(a.baseId,r),d=r===a.value,h=v.useRef(d);return v.useEffect(()=>{const p=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(p)},[]),l.jsx(kt,{present:o||d,children:({present:p})=>l.jsx(Ce.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!p,id:u,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:h.current?"0s":void 0},children:p&&s})})});gh.displayName=mh;function xh(e,t){return`${e}-trigger-${t}`}function yh(e,t){return`${e}-content-${t}`}var y_=uh,v_=fh,b_=ph,w_=gh,[Qo]=Jt("Tooltip",[Ho]),es=Ho(),vh="TooltipProvider",k_=700,li="tooltip.open",[__,ua]=Qo(vh),bh=e=>{const{__scopeTooltip:t,delayDuration:n=k_,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=v.useRef(!0),a=v.useRef(!1),c=v.useRef(0);return v.useEffect(()=>{const u=c.current;return()=>window.clearTimeout(u)},[]),l.jsx(__,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:v.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:v.useCallback(u=>{a.current=u},[]),disableHoverableContent:o,children:s})};bh.displayName=vh;var Cr="Tooltip",[S_,zr]=Qo(Cr),wh=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:i,delayDuration:a}=e,c=ua(Cr,e.__scopeTooltip),u=es(t),[d,h]=v.useState(null),p=Dt(),f=v.useRef(0),y=i??c.disableHoverableContent,m=a??c.delayDuration,x=v.useRef(!1),[g,b]=pn({prop:r,defaultProp:o??!1,onChange:N=>{N?(c.onOpen(),document.dispatchEvent(new CustomEvent(li))):c.onClose(),s?.(N)},caller:Cr}),w=v.useMemo(()=>g?x.current?"delayed-open":"instant-open":"closed",[g]),S=v.useCallback(()=>{window.clearTimeout(f.current),f.current=0,x.current=!1,b(!0)},[b]),j=v.useCallback(()=>{window.clearTimeout(f.current),f.current=0,b(!1)},[b]),C=v.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{x.current=!0,b(!0),f.current=0},m)},[m,b]);return v.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),l.jsx(hf,{...u,children:l.jsx(S_,{scope:t,contentId:p,open:g,stateAttribute:w,trigger:d,onTriggerChange:h,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayedRef.current?C():S()},[c.isOpenDelayedRef,C,S]),onTriggerLeave:v.useCallback(()=>{y?j():(window.clearTimeout(f.current),f.current=0)},[j,y]),onOpen:S,onClose:j,disableHoverableContent:y,children:n})})};wh.displayName=Cr;var ci="TooltipTrigger",kh=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=zr(ci,n),s=ua(ci,n),i=es(n),a=v.useRef(null),c=Me(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(pf,{asChild:!0,...i,children:l.jsx(Ce.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:c,onPointerMove:we(e.onPointerMove,p=>{p.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:we(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:we(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:we(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:we(e.onBlur,o.onClose),onClick:we(e.onClick,o.onClose)})})});kh.displayName=ci;var da="TooltipPortal",[C_,j_]=Qo(da,{forceMount:void 0}),_h=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=zr(da,t);return l.jsx(C_,{scope:t,forceMount:n,children:l.jsx(kt,{present:n||s.open,children:l.jsx(Fo,{asChild:!0,container:o,children:r})})})};_h.displayName=da;var Kn="TooltipContent",Sh=v.forwardRef((e,t)=>{const n=j_(Kn,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=zr(Kn,e.__scopeTooltip);return l.jsx(kt,{present:r||i.open,children:i.disableHoverableContent?l.jsx(Ch,{side:o,...s,ref:t}):l.jsx(E_,{side:o,...s,ref:t})})}),E_=v.forwardRef((e,t)=>{const n=zr(Kn,e.__scopeTooltip),r=ua(Kn,e.__scopeTooltip),o=v.useRef(null),s=Me(t,o),[i,a]=v.useState(null),{trigger:c,onClose:u}=n,d=o.current,{onPointerInTransitChange:h}=r,p=v.useCallback(()=>{a(null),h(!1)},[h]),f=v.useCallback((y,m)=>{const x=y.currentTarget,g={x:y.clientX,y:y.clientY},b=I_(g,x.getBoundingClientRect()),w=z_(g,b),S=P_(m.getBoundingClientRect()),j=O_([...w,...S]);a(j),h(!0)},[h]);return v.useEffect(()=>()=>p(),[p]),v.useEffect(()=>{if(c&&d){const y=x=>f(x,d),m=x=>f(x,c);return c.addEventListener("pointerleave",y),d.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",y),d.removeEventListener("pointerleave",m)}}},[c,d,f,p]),v.useEffect(()=>{if(i){const y=m=>{const x=m.target,g={x:m.clientX,y:m.clientY},b=c?.contains(x)||d?.contains(x),w=!R_(g,i);b?p():w&&(p(),u())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,d,i,u,p]),l.jsx(Ch,{...e,ref:s})}),[N_,T_]=Qo(Cr,{isInside:!1}),A_=Yv("TooltipContent"),Ch=v.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...a}=e,c=zr(Kn,n),u=es(n),{onClose:d}=c;return v.useEffect(()=>(document.addEventListener(li,d),()=>document.removeEventListener(li,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(Lo,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:h=>h.preventDefault(),onDismiss:d,children:l.jsxs(mf,{"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(A_,{children:r}),l.jsx(N_,{scope:n,isInside:!0,children:l.jsx(ob,{id:c.contentId,role:"tooltip",children:o||r})})]})})});Sh.displayName=Kn;var jh="TooltipArrow",Eh=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=es(n);return T_(jh,n).isInside?null:l.jsx(gf,{...o,...r,ref:t})});Eh.displayName=jh;function I_(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function z_(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 P_(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 R_(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s],c=t[i],u=a.x,d=a.y,h=c.x,p=c.y;d>r!=p>r&&n<(h-u)*(r-d)/(p-d)+u&&(o=!o)}return o}function O_(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),D_(t)}function D_(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var M_=bh,L_=wh,F_=kh,$_=_h,B_=Sh,U_=Eh;function Nh(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=Nh(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Th(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Nh(e))&&(r&&(r+=" "),r+=t);return r}const Z_=(e,t)=>{const n=new Array(e.length+t.length);for(let r=0;r<e.length;r++)n[r]=e[r];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},V_=(e,t)=>({classGroupId:e,validator:t}),Ah=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),wo="-",Rl=[],W_="arbitrary..",H_=e=>{const t=K_(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{if(i.startsWith("[")&&i.endsWith("]"))return q_(i);const a=i.split(wo),c=a[0]===""&&a.length>1?1:0;return Ih(a,c,t)},getConflictingClassGroupIds:(i,a)=>{if(a){const c=r[i],u=n[i];return c?u?Z_(u,c):c:u||Rl}return n[i]||Rl}}},Ih=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],s=n.nextPart.get(o);if(s){const u=Ih(e,t+1,s);if(u)return u}const i=n.validators;if(i===null)return;const a=t===0?e.join(wo):e.slice(t).join(wo),c=i.length;for(let u=0;u<c;u++){const d=i[u];if(d.validator(a))return d.classGroupId}},q_=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),r=t.slice(0,n);return r?W_+r:void 0})(),K_=e=>{const{theme:t,classGroups:n}=e;return J_(n,t)},J_=(e,t)=>{const n=Ah();for(const r in e){const o=e[r];fa(o,n,r,t)}return n},fa=(e,t,n,r)=>{const o=e.length;for(let s=0;s<o;s++){const i=e[s];G_(i,t,n,r)}},G_=(e,t,n,r)=>{if(typeof e=="string"){Y_(e,t,n);return}if(typeof e=="function"){X_(e,t,n,r);return}Q_(e,t,n,r)},Y_=(e,t,n)=>{const r=e===""?t:zh(t,e);r.classGroupId=n},X_=(e,t,n,r)=>{if(eS(e)){fa(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(V_(n,e))},Q_=(e,t,n,r)=>{const o=Object.entries(e),s=o.length;for(let i=0;i<s;i++){const[a,c]=o[i];fa(c,zh(t,a),n,r)}},zh=(e,t)=>{let n=e;const r=t.split(wo),o=r.length;for(let s=0;s<o;s++){const i=r[s];let a=n.nextPart.get(i);a||(a=Ah(),n.nextPart.set(i,a)),n=a}return n},eS=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,tS=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null);const o=(s,i)=>{n[s]=i,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(s){let i=n[s];if(i!==void 0)return i;if((i=r[s])!==void 0)return o(s,i),i},set(s,i){s in n?n[s]=i:o(s,i)}}},ui="!",Ol=":",nS=[],Dl=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),rS=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let i=0,a=0,c=0,u;const d=o.length;for(let m=0;m<d;m++){const x=o[m];if(i===0&&a===0){if(x===Ol){s.push(o.slice(c,m)),c=m+1;continue}if(x==="/"){u=m;continue}}x==="["?i++:x==="]"?i--:x==="("?a++:x===")"&&a--}const h=s.length===0?o:o.slice(c);let p=h,f=!1;h.endsWith(ui)?(p=h.slice(0,-1),f=!0):h.startsWith(ui)&&(p=h.slice(1),f=!0);const y=u&&u>c?u-c:void 0;return Dl(s,f,p,y)};if(t){const o=t+Ol,s=r;r=i=>i.startsWith(o)?s(i.slice(o.length)):Dl(nS,!1,i,void 0,!0)}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},oS=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,r)=>{t.set(n,1e6+r)}),n=>{const r=[];let o=[];for(let s=0;s<n.length;s++){const i=n[s],a=i[0]==="[",c=t.has(i);a||c?(o.length>0&&(o.sort(),r.push(...o),o=[]),r.push(i)):o.push(i)}return o.length>0&&(o.sort(),r.push(...o)),r}},sS=e=>({cache:tS(e.cacheSize),parseClassName:rS(e),sortModifiers:oS(e),...H_(e)}),iS=/\s+/,aS=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,i=[],a=e.trim().split(iS);let c="";for(let u=a.length-1;u>=0;u-=1){const d=a[u],{isExternal:h,modifiers:p,hasImportantModifier:f,baseClassName:y,maybePostfixModifierPosition:m}=n(d);if(h){c=d+(c.length>0?" "+c:c);continue}let x=!!m,g=r(x?y.substring(0,m):y);if(!g){if(!x){c=d+(c.length>0?" "+c:c);continue}if(g=r(y),!g){c=d+(c.length>0?" "+c:c);continue}x=!1}const b=p.length===0?"":p.length===1?p[0]:s(p).join(":"),w=f?b+ui:b,S=w+g;if(i.indexOf(S)>-1)continue;i.push(S);const j=o(g,x);for(let C=0;C<j.length;++C){const N=j[C];i.push(w+N)}c=d+(c.length>0?" "+c:c)}return c},lS=(...e)=>{let t=0,n,r,o="";for(;t<e.length;)(n=e[t++])&&(r=Ph(n))&&(o&&(o+=" "),o+=r);return o},Ph=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Ph(e[r]))&&(n&&(n+=" "),n+=t);return n},cS=(e,...t)=>{let n,r,o,s;const i=c=>{const u=t.reduce((d,h)=>h(d),e());return n=sS(u),r=n.cache.get,o=n.cache.set,s=a,a(c)},a=c=>{const u=r(c);if(u)return u;const d=aS(c,n);return o(c,d),d};return s=i,(...c)=>s(lS(...c))},uS=[],Ge=e=>{const t=n=>n[e]||uS;return t.isThemeGetter=!0,t},Rh=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Oh=/^\((?:(\w[\w-]*):)?(.+)\)$/i,dS=/^\d+\/\d+$/,fS=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,hS=/\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$/,pS=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,mS=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,gS=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Nn=e=>dS.test(e),Ne=e=>!!e&&!Number.isNaN(Number(e)),Gt=e=>!!e&&Number.isInteger(Number(e)),Ss=e=>e.endsWith("%")&&Ne(e.slice(0,-1)),Vt=e=>fS.test(e),xS=()=>!0,yS=e=>hS.test(e)&&!pS.test(e),Dh=()=>!1,vS=e=>mS.test(e),bS=e=>gS.test(e),wS=e=>!pe(e)&&!me(e),kS=e=>tr(e,Fh,Dh),pe=e=>Rh.test(e),dn=e=>tr(e,$h,yS),Cs=e=>tr(e,ES,Ne),Ml=e=>tr(e,Mh,Dh),_S=e=>tr(e,Lh,bS),Hr=e=>tr(e,Bh,vS),me=e=>Oh.test(e),lr=e=>nr(e,$h),SS=e=>nr(e,NS),Ll=e=>nr(e,Mh),CS=e=>nr(e,Fh),jS=e=>nr(e,Lh),qr=e=>nr(e,Bh,!0),tr=(e,t,n)=>{const r=Rh.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},nr=(e,t,n=!1)=>{const r=Oh.exec(e);return r?r[1]?t(r[1]):n:!1},Mh=e=>e==="position"||e==="percentage",Lh=e=>e==="image"||e==="url",Fh=e=>e==="length"||e==="size"||e==="bg-size",$h=e=>e==="length",ES=e=>e==="number",NS=e=>e==="family-name",Bh=e=>e==="shadow",TS=()=>{const e=Ge("color"),t=Ge("font"),n=Ge("text"),r=Ge("font-weight"),o=Ge("tracking"),s=Ge("leading"),i=Ge("breakpoint"),a=Ge("container"),c=Ge("spacing"),u=Ge("radius"),d=Ge("shadow"),h=Ge("inset-shadow"),p=Ge("text-shadow"),f=Ge("drop-shadow"),y=Ge("blur"),m=Ge("perspective"),x=Ge("aspect"),g=Ge("ease"),b=Ge("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],j=()=>[...S(),me,pe],C=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto","contain","none"],T=()=>[me,pe,c],z=()=>[Nn,"full","auto",...T()],O=()=>[Gt,"none","subgrid",me,pe],L=()=>["auto",{span:["full",Gt,me,pe]},Gt,me,pe],E=()=>[Gt,"auto",me,pe],M=()=>["auto","min","max","fr",me,pe],k=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],D=()=>["start","end","center","stretch","center-safe","end-safe"],G=()=>["auto",...T()],W=()=>[Nn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...T()],H=()=>[e,me,pe],X=()=>[...S(),Ll,Ml,{position:[me,pe]}],A=()=>["no-repeat",{repeat:["","x","y","space","round"]}],V=()=>["auto","cover","contain",CS,kS,{size:[me,pe]}],Z=()=>[Ss,lr,dn],I=()=>["","none","full",u,me,pe],oe=()=>["",Ne,lr,dn],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,Ss,Ll,Ml],ce=()=>["","none",y,me,pe],fe=()=>["none",Ne,me,pe],ge=()=>["none",Ne,me,pe],xe=()=>[Ne,me,pe],Ee=()=>[Nn,"full",...T()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Vt],breakpoint:[Vt],color:[xS],container:[Vt],"drop-shadow":[Vt],ease:["in","out","in-out"],font:[wS],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Vt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Vt],shadow:[Vt],spacing:["px",Ne],text:[Vt],"text-shadow":[Vt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Nn,pe,me,x]}],container:["container"],columns:[{columns:[Ne,pe,me,a]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:j()}],overflow:[{overflow:C()}],"overflow-x":[{"overflow-x":C()}],"overflow-y":[{"overflow-y":C()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{start:z()}],end:[{end:z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[Gt,"auto",me,pe]}],basis:[{basis:[Nn,"full","auto",a,...T()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ne,Nn,"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":O()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":O()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":M()}],"auto-rows":[{"auto-rows":M()}],gap:[{gap:T()}],"gap-x":[{"gap-x":T()}],"gap-y":[{"gap-y":T()}],"justify-content":[{justify:[...k(),"normal"]}],"justify-items":[{"justify-items":[...D(),"normal"]}],"justify-self":[{"justify-self":["auto",...D()]}],"align-content":[{content:["normal",...k()]}],"align-items":[{items:[...D(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...D(),{baseline:["","last"]}]}],"place-content":[{"place-content":k()}],"place-items":[{"place-items":[...D(),"baseline"]}],"place-self":[{"place-self":["auto",...D()]}],p:[{p: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:G()}],mx:[{mx:G()}],my:[{my:G()}],ms:[{ms:G()}],me:[{me:G()}],mt:[{mt:G()}],mr:[{mr:G()}],mb:[{mb:G()}],ml:[{ml:G()}],"space-x":[{"space-x":T()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":T()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],w:[{w:[a,"screen",...W()]}],"min-w":[{"min-w":[a,"screen","none",...W()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[i]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",n,lr,dn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,me,Cs]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ss,pe]}],"font-family":[{font:[SS,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,Cs]}],leading:[{leading:[s,...T()]}],"list-image":[{"list-image":["none",me,pe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",me,pe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:H()}],"text-color":[{text:H()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ne,"from-font","auto",me,dn]}],"text-decoration-color":[{decoration:H()}],"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:V()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Gt,me,pe],radial:["",me,pe],conic:[Gt,me,pe]},jS,_S]}],"bg-color":[{bg:H()}],"gradient-from-pos":[{from:Z()}],"gradient-via-pos":[{via:Z()}],"gradient-to-pos":[{to:Z()}],"gradient-from":[{from:H()}],"gradient-via":[{via:H()}],"gradient-to":[{to:H()}],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:H()}],"border-color-x":[{"border-x":H()}],"border-color-y":[{"border-y":H()}],"border-color-s":[{"border-s":H()}],"border-color-e":[{"border-e":H()}],"border-color-t":[{"border-t":H()}],"border-color-r":[{"border-r":H()}],"border-color-b":[{"border-b":H()}],"border-color-l":[{"border-l":H()}],"divide-color":[{divide:H()}],"outline-style":[{outline:[...Y(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ne,me,pe]}],"outline-w":[{outline:["",Ne,lr,dn]}],"outline-color":[{outline:H()}],shadow:[{shadow:["","none",d,qr,Hr]}],"shadow-color":[{shadow:H()}],"inset-shadow":[{"inset-shadow":["none",h,qr,Hr]}],"inset-shadow-color":[{"inset-shadow":H()}],"ring-w":[{ring:oe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:H()}],"ring-offset-w":[{"ring-offset":[Ne,dn]}],"ring-offset-color":[{"ring-offset":H()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":H()}],"text-shadow":[{"text-shadow":["none",p,qr,Hr]}],"text-shadow-color":[{"text-shadow":H()}],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":H()}],"mask-image-linear-to-color":[{"mask-linear-to":H()}],"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":H()}],"mask-image-t-to-color":[{"mask-t-to":H()}],"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":H()}],"mask-image-r-to-color":[{"mask-r-to":H()}],"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":H()}],"mask-image-b-to-color":[{"mask-b-to":H()}],"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":H()}],"mask-image-l-to-color":[{"mask-l-to":H()}],"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":H()}],"mask-image-x-to-color":[{"mask-x-to":H()}],"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":H()}],"mask-image-y-to-color":[{"mask-y-to":H()}],"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":H()}],"mask-image-radial-to-color":[{"mask-radial-to":H()}],"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":H()}],"mask-image-conic-to-color":[{"mask-conic-to":H()}],"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:V()}],"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,qr,Hr]}],"drop-shadow-color":[{"drop-shadow":H()}],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":j()}],rotate:[{rotate:fe()}],"rotate-x":[{"rotate-x":fe()}],"rotate-y":[{"rotate-y":fe()}],"rotate-z":[{"rotate-z":fe()}],scale:[{scale:ge()}],"scale-x":[{"scale-x":ge()}],"scale-y":[{"scale-y":ge()}],"scale-z":[{"scale-z":ge()}],"scale-3d":["scale-3d"],skew:[{skew:xe()}],"skew-x":[{"skew-x":xe()}],"skew-y":[{"skew-y":xe()}],transform:[{transform:[me,pe,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ee()}],"translate-x":[{"translate-x":Ee()}],"translate-y":[{"translate-y":Ee()}],"translate-z":[{"translate-z":Ee()}],"translate-none":["translate-none"],accent:[{accent:H()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:H()}],"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",...H()]}],"stroke-w":[{stroke:[Ne,lr,dn,Cs]}],stroke:[{stroke:["none",...H()]}],"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"]}},AS=cS(TS);function he(...e){return AS(Th(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 Uh(e){return e===null?"pending":e>=200&&e<300?"success":e>=400&&e<500?"client_error":e>=500?"server_error":"pending"}function Le({delayDuration:e=0,...t}){return l.jsx(M_,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Ae({...e}){return l.jsx(L_,{"data-slot":"tooltip",...e})}function Ie({...e}){return l.jsx(F_,{"data-slot":"tooltip-trigger",...e})}function ze({className:e,sideOffset:t=0,children:n,...r}){return l.jsx($_,{children:l.jsxs(B_,{"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(U_,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function Kr(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 js={exports:{}};var Fl;function IS(){return Fl||(Fl=1,(function(e,t){(function(n){e.exports=n()})(function(){return(function n(r,o,s){function i(u,d){if(!o[u]){if(!r[u]){var h=typeof Kr=="function"&&Kr;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(y){var m=r[u][1][y];return i(m||y)},f,f.exports,n,r,o,s)}return o[u].exports}for(var a=typeof Kr=="function"&&Kr,c=0;c<s.length;c++)i(s[c]);return i})({1:[function(n,r,o){var s=n("./utils"),i=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(c){for(var u,d,h,p,f,y,m,x=[],g=0,b=c.length,w=b,S=s.getTypeOf(c)!=="string";g<c.length;)w=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,y=1<w?(15&d)<<2|h>>6:64,m=2<w?63&h:64,x.push(a.charAt(p)+a.charAt(f)+a.charAt(y)+a.charAt(m));return x.join("")},o.decode=function(c){var u,d,h,p,f,y,m=0,x=0,g="data:";if(c.substr(0,g.length)===g)throw new Error("Invalid base64 input, it looks like a data url.");var b,w=3*(c=c.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(c.charAt(c.length-1)===a.charAt(64)&&w--,c.charAt(c.length-2)===a.charAt(64)&&w--,w%1!=0)throw new Error("Invalid base64 input, bad content length.");for(b=i.uint8array?new Uint8Array(0|w):new Array(0|w);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|(y=a.indexOf(c.charAt(m++))),b[x++]=u,f!==64&&(b[x++]=d),y!==64&&(b[x++]=h);return b}},{"./support":30,"./utils":32}],2:[function(n,r,o){var s=n("./external"),i=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),c=n("./stream/DataLengthProbe");function u(d,h,p,f,y){this.compressedSize=d,this.uncompressedSize=h,this.crc32=p,this.compression=f,this.compressedContent=y}u.prototype={getContentWorker:function(){var d=new i(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new c("data_length")),h=this;return d.on("end",function(){if(this.streamInfo.data_length!==h.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new i(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,h,p){return d.pipe(new a).pipe(new c("uncompressedSize")).pipe(h.compressWorker(p)).pipe(new c("compressedSize")).withStreamInfo("compression",h)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){var s=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){var s=n("./utils"),i=(function(){for(var a,c=[],u=0;u<256;u++){a=u;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;c[u]=a}return c})();r.exports=function(a,c){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?(function(u,d,h,p){var f=i,y=p+h;u^=-1;for(var m=p;m<y;m++)u=u>>>8^f[255&(u^d[m])];return-1^u})(0|c,a,a.length,0):(function(u,d,h,p){var f=i,y=p+h;u^=-1;for(var m=p;m<y;m++)u=u>>>8^f[255&(u^d.charCodeAt(m))];return-1^u})(0|c,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,o){o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){var s=null;s=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:s}},{lie:37}],7:[function(n,r,o){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",i=n("pako"),a=n("./utils"),c=n("./stream/GenericWorker"),u=s?"uint8array":"array";function d(h,p){c.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=p,this.meta={}}o.magic="\b\0",a.inherits(d,c),d.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,h.data),!1)},d.prototype.flush=function(){c.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){c.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var h=this;this._pako.onData=function(p){h.push({data:p,meta:h.meta})}},o.compressWorker=function(h){return new d("Deflate",h)},o.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){function s(f,y){var m,x="";for(m=0;m<y;m++)x+=String.fromCharCode(255&f),f>>>=8;return x}function i(f,y,m,x,g,b){var w,S,j=f.file,C=f.compression,N=b!==u.utf8encode,T=a.transformTo("string",b(j.name)),z=a.transformTo("string",u.utf8encode(j.name)),O=j.comment,L=a.transformTo("string",b(O)),E=a.transformTo("string",u.utf8encode(O)),M=z.length!==j.name.length,k=E.length!==O.length,D="",G="",W="",H=j.dir,X=j.date,A={crc32:0,compressedSize:0,uncompressedSize:0};y&&!m||(A.crc32=f.crc32,A.compressedSize=f.compressedSize,A.uncompressedSize=f.uncompressedSize);var V=0;y&&(V|=8),N||!M&&!k||(V|=2048);var Z=0,I=0;H&&(Z|=16),g==="UNIX"?(I=798,Z|=(function(Y,de){var te=Y;return Y||(te=de?16893:33204),(65535&te)<<16})(j.unixPermissions,H)):(I=20,Z|=(function(Y){return 63&(Y||0)})(j.dosPermissions)),w=X.getUTCHours(),w<<=6,w|=X.getUTCMinutes(),w<<=5,w|=X.getUTCSeconds()/2,S=X.getUTCFullYear()-1980,S<<=4,S|=X.getUTCMonth()+1,S<<=5,S|=X.getUTCDate(),M&&(G=s(1,1)+s(d(T),4)+z,D+="up"+s(G.length,2)+G),k&&(W=s(1,1)+s(d(L),4)+E,D+="uc"+s(W.length,2)+W);var oe="";return oe+=`
|
|
84
|
+
\0`,oe+=s(V,2),oe+=C.magic,oe+=s(w,2),oe+=s(S,2),oe+=s(A.crc32,4),oe+=s(A.compressedSize,4),oe+=s(A.uncompressedSize,4),oe+=s(T.length,2),oe+=s(D.length,2),{fileRecord:h.LOCAL_FILE_HEADER+oe+T+D,dirRecord:h.CENTRAL_FILE_HEADER+s(I,2)+oe+s(L.length,2)+"\0\0\0\0"+s(Z,4)+s(x,4)+T+D+L}}var a=n("../utils"),c=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),h=n("../signature");function p(f,y,m,x){c.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=y,this.zipPlatform=m,this.encodeFileName=x,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,c),p.prototype.push=function(f){var y=f.meta.percent||0,m=this.entriesCount,x=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,c.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:m?(y+100*(m-x-1))/m:100}}))},p.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var y=this.streamFiles&&!f.file.dir;if(y){var m=i(f,y,!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 y=this.streamFiles&&!f.file.dir,m=i(f,y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),y)this.push({data:(function(x){return h.DATA_DESCRIPTOR+s(x.crc32,4)+s(x.compressedSize,4)+s(x.uncompressedSize,4)})(f),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var f=this.bytesWritten,y=0;y<this.dirRecords.length;y++)this.push({data:this.dirRecords[y],meta:{percent:100}});var m=this.bytesWritten-f,x=(function(g,b,w,S,j){var C=a.transformTo("string",j(S));return h.CENTRAL_DIRECTORY_END+"\0\0\0\0"+s(g,2)+s(g,2)+s(b,4)+s(w,4)+s(C.length,2)+C})(this.dirRecords.length,m,f,this.zipComment,this.encodeFileName);this.push({data:x,meta:{percent:100}})},p.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},p.prototype.registerPrevious=function(f){this._sources.push(f);var y=this;return f.on("data",function(m){y.processChunk(m)}),f.on("end",function(){y.closedSource(y.previous.streamInfo),y._sources.length?y.prepareNextSource():y.end()}),f.on("error",function(m){y.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 y=this._sources;if(!c.prototype.error.call(this,f))return!1;for(var m=0;m<y.length;m++)try{y[m].error(f)}catch{}return!0},p.prototype.lock=function(){c.prototype.lock.call(this);for(var f=this._sources,y=0;y<f.length;y++)f[y].lock()},r.exports=p},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){var s=n("../compressions"),i=n("./ZipFileWorker");o.generateWorker=function(a,c,u){var d=new i(c.streamFiles,u,c.platform,c.encodeFileName),h=0;try{a.forEach(function(p,f){h++;var y=(function(b,w){var S=b||w,j=s[S];if(!j)throw new Error(S+" is not a valid compression method !");return j})(f.options.compression,c.compression),m=f.options.compressionOptions||c.compressionOptions||{},x=f.dir,g=f.date;f._compressWorker(y,m).withStreamInfo("file",{name:p,dir:x,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 s(){if(!(this instanceof s))return new s;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var i=new s;for(var a in this)typeof this[a]!="function"&&(i[a]=this[a]);return i}}(s.prototype=n("./object")).loadAsync=n("./load"),s.support=n("./support"),s.defaults=n("./defaults"),s.version="3.10.1",s.loadAsync=function(i,a){return new s().loadAsync(i,a)},s.external=n("./external"),r.exports=s},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){var s=n("./utils"),i=n("./external"),a=n("./utf8"),c=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function h(p){return new i.Promise(function(f,y){var m=p.decompressed.getContentWorker().pipe(new u);m.on("error",function(x){y(x)}).on("end",function(){m.streamInfo.crc32!==p.decompressed.crc32?y(new Error("Corrupted zip : CRC32 mismatch")):f()}).resume()})}r.exports=function(p,f){var y=this;return f=s.extend(f||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),d.isNode&&d.isStream(p)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):s.prepareContent("the loaded zip file",p,!0,f.optimizedBinaryString,f.base64).then(function(m){var x=new c(f);return x.load(m),x}).then(function(m){var x=[i.Promise.resolve(m)],g=m.files;if(f.checkCRC32)for(var b=0;b<g.length;b++)x.push(h(g[b]));return i.Promise.all(x)}).then(function(m){for(var x=m.shift(),g=x.files,b=0;b<g.length;b++){var w=g[b],S=w.fileNameStr,j=s.resolve(w.fileNameStr);y.file(j,w.decompressed,{binary:!0,optimizedBinaryString:!0,date:w.date,dir:w.dir,comment:w.fileCommentStr.length?w.fileCommentStr:null,unixPermissions:w.unixPermissions,dosPermissions:w.dosPermissions,createFolders:f.createFolders}),w.dir||(y.file(j).unsafeOriginalName=S)}return x.zipComment.length&&(y.comment=x.zipComment),y})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){var s=n("../utils"),i=n("../stream/GenericWorker");function a(c,u){i.call(this,"Nodejs stream input adapter for "+c),this._upstreamEnded=!1,this._bindStream(u)}s.inherits(a,i),a.prototype._bindStream=function(c){var u=this;(this._stream=c).pause(),c.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},a.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){var s=n("readable-stream").Readable;function i(a,c,u){s.call(this,c),this._helper=a;var d=this;a.on("data",function(h,p){d.push(h)||d._helper.pause(),u&&u(p)}).on("error",function(h){d.emit("error",h)}).on("end",function(){d.push(null)})}n("../utils").inherits(i,s),i.prototype._read=function(){this._helper.resume()},r.exports=i},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(s,i){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(s,i);if(typeof s=="number")throw new Error('The "data" argument must not be a number');return new Buffer(s,i)},allocBuffer:function(s){if(Buffer.alloc)return Buffer.alloc(s);var i=new Buffer(s);return i.fill(0),i},isBuffer:function(s){return Buffer.isBuffer(s)},isStream:function(s){return s&&typeof s.on=="function"&&typeof s.pause=="function"&&typeof s.resume=="function"}}},{}],15:[function(n,r,o){function s(j,C,N){var T,z=a.getTypeOf(C),O=a.extend(N||{},d);O.date=O.date||new Date,O.compression!==null&&(O.compression=O.compression.toUpperCase()),typeof O.unixPermissions=="string"&&(O.unixPermissions=parseInt(O.unixPermissions,8)),O.unixPermissions&&16384&O.unixPermissions&&(O.dir=!0),O.dosPermissions&&16&O.dosPermissions&&(O.dir=!0),O.dir&&(j=g(j)),O.createFolders&&(T=x(j))&&b.call(this,T,!0);var L=z==="string"&&O.binary===!1&&O.base64===!1;N&&N.binary!==void 0||(O.binary=!L),(C instanceof h&&C.uncompressedSize===0||O.dir||!C||C.length===0)&&(O.base64=!1,O.binary=!0,C="",O.compression="STORE",z="string");var E=null;E=C instanceof h||C instanceof c?C:y.isNode&&y.isStream(C)?new m(j,C):a.prepareContent(j,C,O.binary,O.optimizedBinaryString,O.base64);var M=new p(j,E,O);this.files[j]=M}var i=n("./utf8"),a=n("./utils"),c=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),h=n("./compressedObject"),p=n("./zipObject"),f=n("./generate"),y=n("./nodejsUtils"),m=n("./nodejs/NodejsStreamInputAdapter"),x=function(j){j.slice(-1)==="/"&&(j=j.substring(0,j.length-1));var C=j.lastIndexOf("/");return 0<C?j.substring(0,C):""},g=function(j){return j.slice(-1)!=="/"&&(j+="/"),j},b=function(j,C){return C=C!==void 0?C:d.createFolders,j=g(j),this.files[j]||s.call(this,j,null,{dir:!0,createFolders:C}),this.files[j]};function w(j){return Object.prototype.toString.call(j)==="[object RegExp]"}var S={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(j){var C,N,T;for(C in this.files)T=this.files[C],(N=C.slice(this.root.length,C.length))&&C.slice(0,this.root.length)===this.root&&j(N,T)},filter:function(j){var C=[];return this.forEach(function(N,T){j(N,T)&&C.push(T)}),C},file:function(j,C,N){if(arguments.length!==1)return j=this.root+j,s.call(this,j,C,N),this;if(w(j)){var T=j;return this.filter(function(O,L){return!L.dir&&T.test(O)})}var z=this.files[this.root+j];return z&&!z.dir?z:null},folder:function(j){if(!j)return this;if(w(j))return this.filter(function(z,O){return O.dir&&j.test(z)});var C=this.root+j,N=b.call(this,C),T=this.clone();return T.root=N.name,T},remove:function(j){j=this.root+j;var C=this.files[j];if(C||(j.slice(-1)!=="/"&&(j+="/"),C=this.files[j]),C&&!C.dir)delete this.files[j];else for(var N=this.filter(function(z,O){return O.name.slice(0,j.length)===j}),T=0;T<N.length;T++)delete this.files[N[T].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(j){var C,N={};try{if((N=a.extend(j||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=N.type.toLowerCase(),N.compression=N.compression.toUpperCase(),N.type==="binarystring"&&(N.type="string"),!N.type)throw new Error("No output type specified.");a.checkSupport(N.type),N.platform!=="darwin"&&N.platform!=="freebsd"&&N.platform!=="linux"&&N.platform!=="sunos"||(N.platform="UNIX"),N.platform==="win32"&&(N.platform="DOS");var T=N.comment||this.comment||"";C=f.generateWorker(this,N,T)}catch(z){(C=new c("error")).error(z)}return new u(C,N.type||"string",N.mimeType)},generateAsync:function(j,C){return this.generateInternalStream(j).accumulate(C)},generateNodeStream:function(j,C){return(j=j||{}).type||(j.type="nodebuffer"),this.generateInternalStream(j).toNodejsStream(C)}};r.exports=S},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,o){r.exports=n("stream")},{stream:void 0}],17:[function(n,r,o){var s=n("./DataReader");function i(a){s.call(this,a);for(var c=0;c<this.data.length;c++)a[c]=255&a[c]}n("../utils").inherits(i,s),i.prototype.byteAt=function(a){return this.data[this.zero+a]},i.prototype.lastIndexOfSignature=function(a){for(var c=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),h=a.charCodeAt(3),p=this.length-4;0<=p;--p)if(this.data[p]===c&&this.data[p+1]===u&&this.data[p+2]===d&&this.data[p+3]===h)return p-this.zero;return-1},i.prototype.readAndCheckSignature=function(a){var c=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),h=a.charCodeAt(3),p=this.readData(4);return c===p[0]&&u===p[1]&&d===p[2]&&h===p[3]},i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){var s=n("../utils");function i(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var c,u=0;for(this.checkOffset(a),c=this.index+a-1;c>=this.index;c--)u=(u<<8)+this.byteAt(c);return this.index+=a,u},readString:function(a){return s.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=i},{"../utils":32}],19:[function(n,r,o){var s=n("./Uint8ArrayReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){var s=n("./DataReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},i.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},i.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},i.prototype.readData=function(a){this.checkOffset(a);var c=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){var s=n("./ArrayReader");function i(a){s.call(this,a)}n("../utils").inherits(i,s),i.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var c=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,c},r.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){var s=n("../utils"),i=n("../support"),a=n("./ArrayReader"),c=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(h){var p=s.getTypeOf(h);return s.checkSupport(p),p!=="string"||i.uint8array?p==="nodebuffer"?new u(h):i.uint8array?new d(s.transformTo("uint8array",h)):new a(s.transformTo("array",h)):new c(h)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){var s=n("./GenericWorker"),i=n("../utils");function a(c){s.call(this,"ConvertWorker to "+c),this.destType=c}i.inherits(a,s),a.prototype.processChunk=function(c){this.push({data:i.transformTo(this.destType,c.data),meta:c.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){var s=n("./GenericWorker"),i=n("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,s),a.prototype.processChunk=function(c){this.streamInfo.crc32=i(c.data,this.streamInfo.crc32||0),this.push(c)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function a(c){i.call(this,"DataLengthProbe for "+c),this.propName=c,this.withStreamInfo(c,0)}s.inherits(a,i),a.prototype.processChunk=function(c){if(c){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+c.data.length}i.prototype.processChunk.call(this,c)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){var s=n("../utils"),i=n("./GenericWorker");function a(c){i.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,c.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=s.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}s.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var c=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":c=this.data.substring(this.index,u);break;case"uint8array":c=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":c=this.data.slice(this.index,u)}return this.index=u,this.push({data:c,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){function s(i){this.name=i||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(i){this.emit("data",i)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(i){this.emit("error",i)}return!0},error:function(i){return!this.isFinished&&(this.isPaused?this.generatedError=i:(this.isFinished=!0,this.emit("error",i),this.previous&&this.previous.error(i),this.cleanUp()),!0)},on:function(i,a){return this._listeners[i].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(i,a){if(this._listeners[i])for(var c=0;c<this._listeners[i].length;c++)this._listeners[i][c].call(this,a)},pipe:function(i){return i.registerPrevious(this)},registerPrevious:function(i){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=i.streamInfo,this.mergeStreamInfo(),this.previous=i;var a=this;return i.on("data",function(c){a.processChunk(c)}),i.on("end",function(){a.end()}),i.on("error",function(c){a.error(c)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var i=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),i=!0),this.previous&&this.previous.resume(),!i},flush:function(){},processChunk:function(i){this.push(i)},withStreamInfo:function(i,a){return this.extraStreamInfo[i]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var i in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,i)&&(this.streamInfo[i]=this.extraStreamInfo[i])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var i="Worker "+this.name;return this.previous?this.previous+" -> "+i:i}},r.exports=s},{}],29:[function(n,r,o){var s=n("../utils"),i=n("./ConvertWorker"),a=n("./GenericWorker"),c=n("../base64"),u=n("../support"),d=n("../external"),h=null;if(u.nodestream)try{h=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(y,m){return new d.Promise(function(x,g){var b=[],w=y._internalType,S=y._outputType,j=y._mimeType;y.on("data",function(C,N){b.push(C),m&&m(N)}).on("error",function(C){b=[],g(C)}).on("end",function(){try{var C=(function(N,T,z){switch(N){case"blob":return s.newBlob(s.transformTo("arraybuffer",T),z);case"base64":return c.encode(T);default:return s.transformTo(N,T)}})(S,(function(N,T){var z,O=0,L=null,E=0;for(z=0;z<T.length;z++)E+=T[z].length;switch(N){case"string":return T.join("");case"array":return Array.prototype.concat.apply([],T);case"uint8array":for(L=new Uint8Array(E),z=0;z<T.length;z++)L.set(T[z],O),O+=T[z].length;return L;case"nodebuffer":return Buffer.concat(T);default:throw new Error("concat : unsupported type '"+N+"'")}})(w,b),j);x(C)}catch(N){g(N)}b=[]}).resume()})}function f(y,m,x){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=x,s.checkSupport(g),this._worker=y.pipe(new i(g)),y.lock()}catch(b){this._worker=new a("error"),this._worker.error(b)}}f.prototype={accumulate:function(y){return p(this,y)},on:function(y,m){var x=this;return y==="data"?this._worker.on(y,function(g){m.call(x,g.data,g.meta)}):this._worker.on(y,function(){s.delay(m,arguments,x)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(y){if(s.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new h(this,{objectMode:this._outputType!=="nodebuffer"},y)}},r.exports=f},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var s=new ArrayBuffer(0);try{o.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(s),o.blob=i.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){for(var s=n("./utils"),i=n("./support"),a=n("./nodejsUtils"),c=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function h(){c.call(this,"utf-8 decode"),this.leftOver=null}function p(){c.call(this,"utf-8 encode")}o.utf8encode=function(f){return i.nodebuffer?a.newBufferFrom(f,"utf-8"):(function(y){var m,x,g,b,w,S=y.length,j=0;for(b=0;b<S;b++)(64512&(x=y.charCodeAt(b)))==55296&&b+1<S&&(64512&(g=y.charCodeAt(b+1)))==56320&&(x=65536+(x-55296<<10)+(g-56320),b++),j+=x<128?1:x<2048?2:x<65536?3:4;for(m=i.uint8array?new Uint8Array(j):new Array(j),b=w=0;w<j;b++)(64512&(x=y.charCodeAt(b)))==55296&&b+1<S&&(64512&(g=y.charCodeAt(b+1)))==56320&&(x=65536+(x-55296<<10)+(g-56320),b++),x<128?m[w++]=x:(x<2048?m[w++]=192|x>>>6:(x<65536?m[w++]=224|x>>>12:(m[w++]=240|x>>>18,m[w++]=128|x>>>12&63),m[w++]=128|x>>>6&63),m[w++]=128|63&x);return m})(f)},o.utf8decode=function(f){return i.nodebuffer?s.transformTo("nodebuffer",f).toString("utf-8"):(function(y){var m,x,g,b,w=y.length,S=new Array(2*w);for(m=x=0;m<w;)if((g=y[m++])<128)S[x++]=g;else if(4<(b=u[g]))S[x++]=65533,m+=b-1;else{for(g&=b===2?31:b===3?15:7;1<b&&m<w;)g=g<<6|63&y[m++],b--;1<b?S[x++]=65533:g<65536?S[x++]=g:(g-=65536,S[x++]=55296|g>>10&1023,S[x++]=56320|1023&g)}return S.length!==x&&(S.subarray?S=S.subarray(0,x):S.length=x),s.applyFromCharCode(S)})(f=s.transformTo(i.uint8array?"uint8array":"array",f))},s.inherits(h,c),h.prototype.processChunk=function(f){var y=s.transformTo(i.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var m=y;(y=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),y.set(m,this.leftOver.length)}else y=this.leftOver.concat(y);this.leftOver=null}var x=(function(b,w){var S;for((w=w||b.length)>b.length&&(w=b.length),S=w-1;0<=S&&(192&b[S])==128;)S--;return S<0||S===0?w:S+u[b[S]]>w?S:w})(y),g=y;x!==y.length&&(i.uint8array?(g=y.subarray(0,x),this.leftOver=y.subarray(x,y.length)):(g=y.slice(0,x),this.leftOver=y.slice(x,y.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,s.inherits(p,c),p.prototype.processChunk=function(f){this.push({data:o.utf8encode(f.data),meta:f.meta})},o.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){var s=n("./support"),i=n("./base64"),a=n("./nodejsUtils"),c=n("./external");function u(m){return m}function d(m,x){for(var g=0;g<m.length;++g)x[g]=255&m.charCodeAt(g);return x}n("setimmediate"),o.newBlob=function(m,x){o.checkSupport("blob");try{return new Blob([m],{type:x})}catch{try{var g=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return g.append(m),g.getBlob(x)}catch{throw new Error("Bug : can't construct the Blob.")}}};var h={stringifyByChunk:function(m,x,g){var b=[],w=0,S=m.length;if(S<=g)return String.fromCharCode.apply(null,m);for(;w<S;)x==="array"||x==="nodebuffer"?b.push(String.fromCharCode.apply(null,m.slice(w,Math.min(w+g,S)))):b.push(String.fromCharCode.apply(null,m.subarray(w,Math.min(w+g,S)))),w+=g;return b.join("")},stringifyByChar:function(m){for(var x="",g=0;g<m.length;g++)x+=String.fromCharCode(m[g]);return x},applyCanBeUsed:{uint8array:(function(){try{return s.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return s.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}})()}};function p(m){var x=65536,g=o.getTypeOf(m),b=!0;if(g==="uint8array"?b=h.applyCanBeUsed.uint8array:g==="nodebuffer"&&(b=h.applyCanBeUsed.nodebuffer),b)for(;1<x;)try{return h.stringifyByChunk(m,g,x)}catch{x=Math.floor(x/2)}return h.stringifyByChar(m)}function f(m,x){for(var g=0;g<m.length;g++)x[g]=m[g];return x}o.applyFromCharCode=p;var y={};y.string={string:u,array:function(m){return d(m,new Array(m.length))},arraybuffer:function(m){return y.string.uint8array(m).buffer},uint8array:function(m){return d(m,new Uint8Array(m.length))},nodebuffer:function(m){return d(m,a.allocBuffer(m.length))}},y.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)}},y.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))}},y.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)}},y.nodebuffer={string:p,array:function(m){return f(m,new Array(m.length))},arraybuffer:function(m){return y.nodebuffer.uint8array(m).buffer},uint8array:function(m){return f(m,new Uint8Array(m.length))},nodebuffer:u},o.transformTo=function(m,x){if(x=x||"",!m)return x;o.checkSupport(m);var g=o.getTypeOf(x);return y[g][m](x)},o.resolve=function(m){for(var x=m.split("/"),g=[],b=0;b<x.length;b++){var w=x[b];w==="."||w===""&&b!==0&&b!==x.length-1||(w===".."?g.pop():g.push(w))}return g.join("/")},o.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":s.nodebuffer&&a.isBuffer(m)?"nodebuffer":s.uint8array&&m instanceof Uint8Array?"uint8array":s.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(m){if(!s[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(m){var x,g,b="";for(g=0;g<(m||"").length;g++)b+="\\x"+((x=m.charCodeAt(g))<16?"0":"")+x.toString(16).toUpperCase();return b},o.delay=function(m,x,g){setImmediate(function(){m.apply(g||null,x||[])})},o.inherits=function(m,x){function g(){}g.prototype=x.prototype,m.prototype=new g},o.extend=function(){var m,x,g={};for(m=0;m<arguments.length;m++)for(x in arguments[m])Object.prototype.hasOwnProperty.call(arguments[m],x)&&g[x]===void 0&&(g[x]=arguments[m][x]);return g},o.prepareContent=function(m,x,g,b,w){return c.Promise.resolve(x).then(function(S){return s.blob&&(S instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(S))!==-1)&&typeof FileReader<"u"?new c.Promise(function(j,C){var N=new FileReader;N.onload=function(T){j(T.target.result)},N.onerror=function(T){C(T.target.error)},N.readAsArrayBuffer(S)}):S}).then(function(S){var j=o.getTypeOf(S);return j?(j==="arraybuffer"?S=o.transformTo("uint8array",S):j==="string"&&(w?S=i.decode(S):g&&b!==!0&&(S=(function(C){return d(C,s.uint8array?new Uint8Array(C.length):new Array(C.length))})(S))),S):c.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){var s=n("./reader/readerFor"),i=n("./utils"),a=n("./signature"),c=n("./zipEntry"),u=n("./support");function d(h){this.files=[],this.loadOptions=h}d.prototype={checkSignature:function(h){if(!this.reader.readAndCheckSignature(h)){this.reader.index-=4;var p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(p)+", expected "+i.pretty(h)+")")}},isSignature:function(h,p){var f=this.reader.index;this.reader.setIndex(h);var y=this.reader.readString(4)===p;return this.reader.setIndex(f),y},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var h=this.reader.readData(this.zipCommentLength),p=u.uint8array?"uint8array":"array",f=i.transformTo(p,h);this.zipComment=this.loadOptions.decodeFileName(f)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var h,p,f,y=this.zip64EndOfCentralSize-44;0<y;)h=this.reader.readInt(2),p=this.reader.readInt(4),f=this.reader.readData(p),this.zip64ExtensibleData[h]={id:h,length:p,value:f}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var h,p;for(h=0;h<this.files.length;h++)p=this.files[h],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var h;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(h=new c({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(h);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var h=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(h<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(h);var p=h;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(h=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(h),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var f=this.centralDirOffset+this.centralDirSize;this.zip64&&(f+=20,f+=12+this.zip64EndOfCentralSize);var y=p-f;if(0<y)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=y);else if(y<0)throw new Error("Corrupted zip: missing "+Math.abs(y)+" bytes.")},prepareReader:function(h){this.reader=s(h)},load:function(h){this.prepareReader(h),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){var s=n("./reader/readerFor"),i=n("./utils"),a=n("./compressedObject"),c=n("./crc32"),u=n("./utf8"),d=n("./compressions"),h=n("./support");function p(f,y){this.options=f,this.loadOptions=y}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(f){var y,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((y=(function(x){for(var g in d)if(Object.prototype.hasOwnProperty.call(d,g)&&d[g].magic===x)return d[g];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,y,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 y=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(y),this.readExtraFields(f),this.parseZIP64ExtraField(f),this.fileComment=f.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var f=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=s(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var y,m,x,g=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4<g;)y=f.readInt(2),m=f.readInt(2),x=f.readData(m),this.extraFields[y]={id:y,length:m,value:x};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 y=this.findExtraFieldUnicodePath();if(y!==null)this.fileNameStr=y;else{var m=i.transformTo(f,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(m)}var x=this.findExtraFieldUnicodeComment();if(x!==null)this.fileCommentStr=x;else{var g=i.transformTo(f,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(g)}}},findExtraFieldUnicodePath:function(){var f=this.extraFields[28789];if(f){var y=s(f.value);return y.readInt(1)!==1||c(this.fileName)!==y.readInt(4)?null:u.utf8decode(y.readData(f.length-5))}return null},findExtraFieldUnicodeComment:function(){var f=this.extraFields[25461];if(f){var y=s(f.value);return y.readInt(1)!==1||c(this.fileComment)!==y.readInt(4)?null:u.utf8decode(y.readData(f.length-5))}return null}},r.exports=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){function s(y,m,x){this.name=y,this.dir=x.dir,this.date=x.date,this.comment=x.comment,this.unixPermissions=x.unixPermissions,this.dosPermissions=x.dosPermissions,this._data=m,this._dataBinary=x.binary,this.options={compression:x.compression,compressionOptions:x.compressionOptions}}var i=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),c=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");s.prototype={internalStream:function(y){var m=null,x="string";try{if(!y)throw new Error("No output type specified.");var g=(x=y.toLowerCase())==="string"||x==="text";x!=="binarystring"&&x!=="text"||(x="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(w){(m=new d("error")).error(w)}return new i(m,x,"")},async:function(y,m){return this.internalStream(y).accumulate(m)},nodeStream:function(y,m){return this.internalStream(y||"nodebuffer").toNodejsStream(m)},_compressWorker:function(y,m){if(this._data instanceof u&&this._data.compression.magic===y.magic)return this._data.getCompressedWorker();var x=this._decompressWorker();return this._dataBinary||(x=x.pipe(new c.Utf8EncodeWorker)),u.createWorkerFrom(x,y,m)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new a(this._data)}};for(var h=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},f=0;f<h.length;f++)s.prototype[h[f]]=p;r.exports=s},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(s){var i,a,c=s.MutationObserver||s.WebKitMutationObserver;if(c){var u=0,d=new c(y),h=s.document.createTextNode("");d.observe(h,{characterData:!0}),i=function(){h.data=u=++u%2}}else if(s.setImmediate||s.MessageChannel===void 0)i="document"in s&&"onreadystatechange"in s.document.createElement("script")?function(){var m=s.document.createElement("script");m.onreadystatechange=function(){y(),m.onreadystatechange=null,m.parentNode.removeChild(m),m=null},s.document.documentElement.appendChild(m)}:function(){setTimeout(y,0)};else{var p=new s.MessageChannel;p.port1.onmessage=y,i=function(){p.port2.postMessage(0)}}var f=[];function y(){var m,x;a=!0;for(var g=f.length;g;){for(x=f,f=[],m=-1;++m<g;)x[m]();g=f.length}a=!1}r.exports=function(m){f.push(m)!==1||a||i()}}).call(this,typeof Dr<"u"?Dr:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){var s=n("immediate");function i(){}var a={},c=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function h(g){if(typeof g!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,g!==i&&m(this,g)}function p(g,b,w){this.promise=g,typeof b=="function"&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),typeof w=="function"&&(this.onRejected=w,this.callRejected=this.otherCallRejected)}function f(g,b,w){s(function(){var S;try{S=b(w)}catch(j){return a.reject(g,j)}S===g?a.reject(g,new TypeError("Cannot resolve promise with itself")):a.resolve(g,S)})}function y(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 w=!1;function S(N){w||(w=!0,a.reject(g,N))}function j(N){w||(w=!0,a.resolve(g,N))}var C=x(function(){b(j,S)});C.status==="error"&&S(C.value)}function x(g,b){var w={};try{w.value=g(b),w.status="success"}catch(S){w.status="error",w.value=S}return w}(r.exports=h).prototype.finally=function(g){if(typeof g!="function")return this;var b=this.constructor;return this.then(function(w){return b.resolve(g()).then(function(){return w})},function(w){return b.resolve(g()).then(function(){throw w})})},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 w=new this.constructor(i);return this.state!==d?f(w,this.state===u?g:b,this.outcome):this.queue.push(new p(w,g,b)),w},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 w=x(y,b);if(w.status==="error")return a.reject(g,w.value);var S=w.value;if(S)m(g,S);else{g.state=u,g.outcome=b;for(var j=-1,C=g.queue.length;++j<C;)g.queue[j].callFulfilled(b)}return g},a.reject=function(g,b){g.state=c,g.outcome=b;for(var w=-1,S=g.queue.length;++w<S;)g.queue[w].callRejected(b);return g},h.resolve=function(g){return g instanceof this?g:a.resolve(new this(i),g)},h.reject=function(g){var b=new this(i);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 w=g.length,S=!1;if(!w)return this.resolve([]);for(var j=new Array(w),C=0,N=-1,T=new this(i);++N<w;)z(g[N],N);return T;function z(O,L){b.resolve(O).then(function(E){j[L]=E,++C!==w||S||(S=!0,a.resolve(T,j))},function(E){S||(S=!0,a.reject(T,E))})}},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 w=g.length,S=!1;if(!w)return this.resolve([]);for(var j=-1,C=new this(i);++j<w;)N=g[j],b.resolve(N).then(function(T){S||(S=!0,a.resolve(C,T))},function(T){S||(S=!0,a.reject(C,T))});var N;return C}},{immediate:36}],38:[function(n,r,o){var s={};(0,n("./lib/utils/common").assign)(s,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=s},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){var s=n("./zlib/deflate"),i=n("./utils/common"),a=n("./utils/strings"),c=n("./zlib/messages"),u=n("./zlib/zstream"),d=Object.prototype.toString,h=0,p=-1,f=0,y=8;function m(g){if(!(this instanceof m))return new m(g);this.options=i.assign({level:p,method:y,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 w=s.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(w!==h)throw new Error(c[w]);if(b.header&&s.deflateSetHeader(this.strm,b.header),b.dictionary){var S;if(S=typeof b.dictionary=="string"?a.string2buf(b.dictionary):d.call(b.dictionary)==="[object ArrayBuffer]"?new Uint8Array(b.dictionary):b.dictionary,(w=s.deflateSetDictionary(this.strm,S))!==h)throw new Error(c[w]);this._dict_set=!0}}function x(g,b){var w=new m(b);if(w.push(g,!0),w.err)throw w.msg||c[w.err];return w.result}m.prototype.push=function(g,b){var w,S,j=this.strm,C=this.options.chunkSize;if(this.ended)return!1;S=b===~~b?b:b===!0?4:0,typeof g=="string"?j.input=a.string2buf(g):d.call(g)==="[object ArrayBuffer]"?j.input=new Uint8Array(g):j.input=g,j.next_in=0,j.avail_in=j.input.length;do{if(j.avail_out===0&&(j.output=new i.Buf8(C),j.next_out=0,j.avail_out=C),(w=s.deflate(j,S))!==1&&w!==h)return this.onEnd(w),!(this.ended=!0);j.avail_out!==0&&(j.avail_in!==0||S!==4&&S!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(i.shrinkBuf(j.output,j.next_out))):this.onData(i.shrinkBuf(j.output,j.next_out)))}while((0<j.avail_in||j.avail_out===0)&&w!==1);return S===4?(w=s.deflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===h):S!==2||(this.onEnd(h),!(j.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=i.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},o.Deflate=m,o.deflate=x,o.deflateRaw=function(g,b){return(b=b||{}).raw=!0,x(g,b)},o.gzip=function(g,b){return(b=b||{}).gzip=!0,x(g,b)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){var s=n("./zlib/inflate"),i=n("./utils/common"),a=n("./utils/strings"),c=n("./zlib/constants"),u=n("./zlib/messages"),d=n("./zlib/zstream"),h=n("./zlib/gzheader"),p=Object.prototype.toString;function f(m){if(!(this instanceof f))return new f(m);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},m||{});var x=this.options;x.raw&&0<=x.windowBits&&x.windowBits<16&&(x.windowBits=-x.windowBits,x.windowBits===0&&(x.windowBits=-15)),!(0<=x.windowBits&&x.windowBits<16)||m&&m.windowBits||(x.windowBits+=32),15<x.windowBits&&x.windowBits<48&&(15&x.windowBits)==0&&(x.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var g=s.inflateInit2(this.strm,x.windowBits);if(g!==c.Z_OK)throw new Error(u[g]);this.header=new h,s.inflateGetHeader(this.strm,this.header)}function y(m,x){var g=new f(x);if(g.push(m,!0),g.err)throw g.msg||u[g.err];return g.result}f.prototype.push=function(m,x){var g,b,w,S,j,C,N=this.strm,T=this.options.chunkSize,z=this.options.dictionary,O=!1;if(this.ended)return!1;b=x===~~x?x:x===!0?c.Z_FINISH:c.Z_NO_FLUSH,typeof m=="string"?N.input=a.binstring2buf(m):p.call(m)==="[object ArrayBuffer]"?N.input=new Uint8Array(m):N.input=m,N.next_in=0,N.avail_in=N.input.length;do{if(N.avail_out===0&&(N.output=new i.Buf8(T),N.next_out=0,N.avail_out=T),(g=s.inflate(N,c.Z_NO_FLUSH))===c.Z_NEED_DICT&&z&&(C=typeof z=="string"?a.string2buf(z):p.call(z)==="[object ArrayBuffer]"?new Uint8Array(z):z,g=s.inflateSetDictionary(this.strm,C)),g===c.Z_BUF_ERROR&&O===!0&&(g=c.Z_OK,O=!1),g!==c.Z_STREAM_END&&g!==c.Z_OK)return this.onEnd(g),!(this.ended=!0);N.next_out&&(N.avail_out!==0&&g!==c.Z_STREAM_END&&(N.avail_in!==0||b!==c.Z_FINISH&&b!==c.Z_SYNC_FLUSH)||(this.options.to==="string"?(w=a.utf8border(N.output,N.next_out),S=N.next_out-w,j=a.buf2string(N.output,w),N.next_out=S,N.avail_out=T-S,S&&i.arraySet(N.output,N.output,w,S,0),this.onData(j)):this.onData(i.shrinkBuf(N.output,N.next_out)))),N.avail_in===0&&N.avail_out===0&&(O=!0)}while((0<N.avail_in||N.avail_out===0)&&g!==c.Z_STREAM_END);return g===c.Z_STREAM_END&&(b=c.Z_FINISH),b===c.Z_FINISH?(g=s.inflateEnd(this.strm),this.onEnd(g),this.ended=!0,g===c.Z_OK):b!==c.Z_SYNC_FLUSH||(this.onEnd(c.Z_OK),!(N.avail_out=0))},f.prototype.onData=function(m){this.chunks.push(m)},f.prototype.onEnd=function(m){m===c.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=m,this.msg=this.strm.msg},o.Inflate=f,o.inflate=y,o.inflateRaw=function(m,x){return(x=x||{}).raw=!0,y(m,x)},o.ungzip=y},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(c){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var h in d)d.hasOwnProperty(h)&&(c[h]=d[h])}}return c},o.shrinkBuf=function(c,u){return c.length===u?c:c.subarray?c.subarray(0,u):(c.length=u,c)};var i={arraySet:function(c,u,d,h,p){if(u.subarray&&c.subarray)c.set(u.subarray(d,d+h),p);else for(var f=0;f<h;f++)c[p+f]=u[d+f]},flattenChunks:function(c){var u,d,h,p,f,y;for(u=h=0,d=c.length;u<d;u++)h+=c[u].length;for(y=new Uint8Array(h),u=p=0,d=c.length;u<d;u++)f=c[u],y.set(f,p),p+=f.length;return y}},a={arraySet:function(c,u,d,h,p){for(var f=0;f<h;f++)c[p+f]=u[d+f]},flattenChunks:function(c){return[].concat.apply([],c)}};o.setTyped=function(c){c?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,i)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,a))},o.setTyped(s)},{}],42:[function(n,r,o){var s=n("./common"),i=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var c=new s.Buf8(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(h,p){if(p<65537&&(h.subarray&&a||!h.subarray&&i))return String.fromCharCode.apply(null,s.shrinkBuf(h,p));for(var f="",y=0;y<p;y++)f+=String.fromCharCode(h[y]);return f}c[254]=c[254]=1,o.string2buf=function(h){var p,f,y,m,x,g=h.length,b=0;for(m=0;m<g;m++)(64512&(f=h.charCodeAt(m)))==55296&&m+1<g&&(64512&(y=h.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(y-56320),m++),b+=f<128?1:f<2048?2:f<65536?3:4;for(p=new s.Buf8(b),m=x=0;x<b;m++)(64512&(f=h.charCodeAt(m)))==55296&&m+1<g&&(64512&(y=h.charCodeAt(m+1)))==56320&&(f=65536+(f-55296<<10)+(y-56320),m++),f<128?p[x++]=f:(f<2048?p[x++]=192|f>>>6:(f<65536?p[x++]=224|f>>>12:(p[x++]=240|f>>>18,p[x++]=128|f>>>12&63),p[x++]=128|f>>>6&63),p[x++]=128|63&f);return p},o.buf2binstring=function(h){return d(h,h.length)},o.binstring2buf=function(h){for(var p=new s.Buf8(h.length),f=0,y=p.length;f<y;f++)p[f]=h.charCodeAt(f);return p},o.buf2string=function(h,p){var f,y,m,x,g=p||h.length,b=new Array(2*g);for(f=y=0;f<g;)if((m=h[f++])<128)b[y++]=m;else if(4<(x=c[m]))b[y++]=65533,f+=x-1;else{for(m&=x===2?31:x===3?15:7;1<x&&f<g;)m=m<<6|63&h[f++],x--;1<x?b[y++]=65533:m<65536?b[y++]=m:(m-=65536,b[y++]=55296|m>>10&1023,b[y++]=56320|1023&m)}return d(b,y)},o.utf8border=function(h,p){var f;for((p=p||h.length)>h.length&&(p=h.length),f=p-1;0<=f&&(192&h[f])==128;)f--;return f<0||f===0?p:f+c[h[f]]>p?f:p}},{"./common":41}],43:[function(n,r,o){r.exports=function(s,i,a,c){for(var u=65535&s|0,d=s>>>16&65535|0,h=0;a!==0;){for(a-=h=2e3<a?2e3:a;d=d+(u=u+i[c++]|0)|0,--h;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(n,r,o){r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){var s=(function(){for(var i,a=[],c=0;c<256;c++){i=c;for(var u=0;u<8;u++)i=1&i?3988292384^i>>>1:i>>>1;a[c]=i}return a})();r.exports=function(i,a,c,u){var d=s,h=u+c;i^=-1;for(var p=u;p<h;p++)i=i>>>8^d[255&(i^a[p])];return-1^i}},{}],46:[function(n,r,o){var s,i=n("../utils/common"),a=n("./trees"),c=n("./adler32"),u=n("./crc32"),d=n("./messages"),h=0,p=4,f=0,y=-2,m=-1,x=4,g=2,b=8,w=9,S=286,j=30,C=19,N=2*S+1,T=15,z=3,O=258,L=O+z+1,E=42,M=113,k=1,D=2,G=3,W=4;function H(_,ee){return _.msg=d[ee],ee}function X(_){return(_<<1)-(4<_?9:0)}function A(_){for(var ee=_.length;0<=--ee;)_[ee]=0}function V(_){var ee=_.state,K=ee.pending;K>_.avail_out&&(K=_.avail_out),K!==0&&(i.arraySet(_.output,ee.pending_buf,ee.pending_out,K,_.next_out),_.next_out+=K,ee.pending_out+=K,_.total_out+=K,_.avail_out-=K,ee.pending-=K,ee.pending===0&&(ee.pending_out=0))}function Z(_,ee){a._tr_flush_block(_,0<=_.block_start?_.block_start:-1,_.strstart-_.block_start,ee),_.block_start=_.strstart,V(_.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 K,R,P=_.max_chain_length,F=_.strstart,B=_.prev_length,J=_.nice_match,$=_.strstart>_.w_size-L?_.strstart-(_.w_size-L):0,ne=_.window,le=_.w_mask,se=_.prev,U=_.strstart+O,re=ne[F+B-1],ue=ne[F+B];_.prev_length>=_.good_match&&(P>>=2),J>_.lookahead&&(J=_.lookahead);do if(ne[(K=ee)+B]===ue&&ne[K+B-1]===re&&ne[K]===ne[F]&&ne[++K]===ne[F+1]){F+=2,K++;do;while(ne[++F]===ne[++K]&&ne[++F]===ne[++K]&&ne[++F]===ne[++K]&&ne[++F]===ne[++K]&&ne[++F]===ne[++K]&&ne[++F]===ne[++K]&&ne[++F]===ne[++K]&&ne[++F]===ne[++K]&&F<U);if(R=O-(U-F),F=U-O,B<R){if(_.match_start=ee,J<=(B=R))break;re=ne[F+B-1],ue=ne[F+B]}}while((ee=se[ee&le])>$&&--P!=0);return B<=_.lookahead?B:_.lookahead}function de(_){var ee,K,R,P,F,B,J,$,ne,le,se=_.w_size;do{if(P=_.window_size-_.lookahead-_.strstart,_.strstart>=se+(se-L)){for(i.arraySet(_.window,_.window,se,se,0),_.match_start-=se,_.strstart-=se,_.block_start-=se,ee=K=_.hash_size;R=_.head[--ee],_.head[ee]=se<=R?R-se:0,--K;);for(ee=K=se;R=_.prev[--ee],_.prev[ee]=se<=R?R-se:0,--K;);P+=se}if(_.strm.avail_in===0)break;if(B=_.strm,J=_.window,$=_.strstart+_.lookahead,ne=P,le=void 0,le=B.avail_in,ne<le&&(le=ne),K=le===0?0:(B.avail_in-=le,i.arraySet(J,B.input,B.next_in,le,$),B.state.wrap===1?B.adler=c(B.adler,J,le,$):B.state.wrap===2&&(B.adler=u(B.adler,J,le,$)),B.next_in+=le,B.total_in+=le,le),_.lookahead+=K,_.lookahead+_.insert>=z)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+z-1])&_.hash_mask,_.prev[F&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=F,F++,_.insert--,!(_.lookahead+_.insert<z)););}while(_.lookahead<L&&_.strm.avail_in!==0)}function te(_,ee){for(var K,R;;){if(_.lookahead<L){if(de(_),_.lookahead<L&&ee===h)return k;if(_.lookahead===0)break}if(K=0,_.lookahead>=z&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,K=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),K!==0&&_.strstart-K<=_.w_size-L&&(_.match_length=Y(_,K)),_.match_length>=z)if(R=a._tr_tally(_,_.strstart-_.match_start,_.match_length-z),_.lookahead-=_.match_length,_.match_length<=_.max_lazy_match&&_.lookahead>=z){for(_.match_length--;_.strstart++,_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,K=_.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 R=a._tr_tally(_,0,_.window[_.strstart]),_.lookahead--,_.strstart++;if(R&&(Z(_,!1),_.strm.avail_out===0))return k}return _.insert=_.strstart<z-1?_.strstart:z-1,ee===p?(Z(_,!0),_.strm.avail_out===0?G:W):_.last_lit&&(Z(_,!1),_.strm.avail_out===0)?k:D}function ce(_,ee){for(var K,R,P;;){if(_.lookahead<L){if(de(_),_.lookahead<L&&ee===h)return k;if(_.lookahead===0)break}if(K=0,_.lookahead>=z&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,K=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),_.prev_length=_.match_length,_.prev_match=_.match_start,_.match_length=z-1,K!==0&&_.prev_length<_.max_lazy_match&&_.strstart-K<=_.w_size-L&&(_.match_length=Y(_,K),_.match_length<=5&&(_.strategy===1||_.match_length===z&&4096<_.strstart-_.match_start)&&(_.match_length=z-1)),_.prev_length>=z&&_.match_length<=_.prev_length){for(P=_.strstart+_.lookahead-z,R=a._tr_tally(_,_.strstart-1-_.prev_match,_.prev_length-z),_.lookahead-=_.prev_length-1,_.prev_length-=2;++_.strstart<=P&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+z-1])&_.hash_mask,K=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),--_.prev_length!=0;);if(_.match_available=0,_.match_length=z-1,_.strstart++,R&&(Z(_,!1),_.strm.avail_out===0))return k}else if(_.match_available){if((R=a._tr_tally(_,0,_.window[_.strstart-1]))&&Z(_,!1),_.strstart++,_.lookahead--,_.strm.avail_out===0)return k}else _.match_available=1,_.strstart++,_.lookahead--}return _.match_available&&(R=a._tr_tally(_,0,_.window[_.strstart-1]),_.match_available=0),_.insert=_.strstart<z-1?_.strstart:z-1,ee===p?(Z(_,!0),_.strm.avail_out===0?G:W):_.last_lit&&(Z(_,!1),_.strm.avail_out===0)?k:D}function fe(_,ee,K,R,P){this.good_length=_,this.max_lazy=ee,this.nice_length=K,this.max_chain=R,this.func=P}function ge(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=b,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*N),this.dyn_dtree=new i.Buf16(2*(2*j+1)),this.bl_tree=new i.Buf16(2*(2*C+1)),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 i.Buf16(T+1),this.heap=new i.Buf16(2*S+1),A(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.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?E:M,_.adler=ee.wrap===2?0:1,ee.last_flush=h,a._tr_init(ee),f):H(_,y)}function Ee(_){var ee=xe(_);return ee===f&&(function(K){K.window_size=2*K.w_size,A(K.head),K.max_lazy_match=s[K.level].max_lazy,K.good_match=s[K.level].good_length,K.nice_match=s[K.level].nice_length,K.max_chain_length=s[K.level].max_chain,K.strstart=0,K.block_start=0,K.lookahead=0,K.insert=0,K.match_length=K.prev_length=z-1,K.match_available=0,K.ins_h=0})(_.state),ee}function Fe(_,ee,K,R,P,F){if(!_)return y;var B=1;if(ee===m&&(ee=6),R<0?(B=0,R=-R):15<R&&(B=2,R-=16),P<1||w<P||K!==b||R<8||15<R||ee<0||9<ee||F<0||x<F)return H(_,y);R===8&&(R=9);var J=new ge;return(_.state=J).strm=_,J.wrap=B,J.gzhead=null,J.w_bits=R,J.w_size=1<<J.w_bits,J.w_mask=J.w_size-1,J.hash_bits=P+7,J.hash_size=1<<J.hash_bits,J.hash_mask=J.hash_size-1,J.hash_shift=~~((J.hash_bits+z-1)/z),J.window=new i.Buf8(2*J.w_size),J.head=new i.Buf16(J.hash_size),J.prev=new i.Buf16(J.w_size),J.lit_bufsize=1<<P+6,J.pending_buf_size=4*J.lit_bufsize,J.pending_buf=new i.Buf8(J.pending_buf_size),J.d_buf=1*J.lit_bufsize,J.l_buf=3*J.lit_bufsize,J.level=ee,J.strategy=F,J.method=K,Ee(_)}s=[new fe(0,0,0,0,function(_,ee){var K=65535;for(K>_.pending_buf_size-5&&(K=_.pending_buf_size-5);;){if(_.lookahead<=1){if(de(_),_.lookahead===0&&ee===h)return k;if(_.lookahead===0)break}_.strstart+=_.lookahead,_.lookahead=0;var R=_.block_start+K;if((_.strstart===0||_.strstart>=R)&&(_.lookahead=_.strstart-R,_.strstart=R,Z(_,!1),_.strm.avail_out===0)||_.strstart-_.block_start>=_.w_size-L&&(Z(_,!1),_.strm.avail_out===0))return k}return _.insert=0,ee===p?(Z(_,!0),_.strm.avail_out===0?G:W):(_.strstart>_.block_start&&(Z(_,!1),_.strm.avail_out),k)}),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?y:(_.state.gzhead=ee,f):y},o.deflate=function(_,ee){var K,R,P,F;if(!_||!_.state||5<ee||ee<0)return _?H(_,y):y;if(R=_.state,!_.output||!_.input&&_.avail_in!==0||R.status===666&&ee!==p)return H(_,_.avail_out===0?-5:y);if(R.strm=_,K=R.last_flush,R.last_flush=ee,R.status===E)if(R.wrap===2)_.adler=0,I(R,31),I(R,139),I(R,8),R.gzhead?(I(R,(R.gzhead.text?1:0)+(R.gzhead.hcrc?2:0)+(R.gzhead.extra?4:0)+(R.gzhead.name?8:0)+(R.gzhead.comment?16:0)),I(R,255&R.gzhead.time),I(R,R.gzhead.time>>8&255),I(R,R.gzhead.time>>16&255),I(R,R.gzhead.time>>24&255),I(R,R.level===9?2:2<=R.strategy||R.level<2?4:0),I(R,255&R.gzhead.os),R.gzhead.extra&&R.gzhead.extra.length&&(I(R,255&R.gzhead.extra.length),I(R,R.gzhead.extra.length>>8&255)),R.gzhead.hcrc&&(_.adler=u(_.adler,R.pending_buf,R.pending,0)),R.gzindex=0,R.status=69):(I(R,0),I(R,0),I(R,0),I(R,0),I(R,0),I(R,R.level===9?2:2<=R.strategy||R.level<2?4:0),I(R,3),R.status=M);else{var B=b+(R.w_bits-8<<4)<<8;B|=(2<=R.strategy||R.level<2?0:R.level<6?1:R.level===6?2:3)<<6,R.strstart!==0&&(B|=32),B+=31-B%31,R.status=M,oe(R,B),R.strstart!==0&&(oe(R,_.adler>>>16),oe(R,65535&_.adler)),_.adler=1}if(R.status===69)if(R.gzhead.extra){for(P=R.pending;R.gzindex<(65535&R.gzhead.extra.length)&&(R.pending!==R.pending_buf_size||(R.gzhead.hcrc&&R.pending>P&&(_.adler=u(_.adler,R.pending_buf,R.pending-P,P)),V(_),P=R.pending,R.pending!==R.pending_buf_size));)I(R,255&R.gzhead.extra[R.gzindex]),R.gzindex++;R.gzhead.hcrc&&R.pending>P&&(_.adler=u(_.adler,R.pending_buf,R.pending-P,P)),R.gzindex===R.gzhead.extra.length&&(R.gzindex=0,R.status=73)}else R.status=73;if(R.status===73)if(R.gzhead.name){P=R.pending;do{if(R.pending===R.pending_buf_size&&(R.gzhead.hcrc&&R.pending>P&&(_.adler=u(_.adler,R.pending_buf,R.pending-P,P)),V(_),P=R.pending,R.pending===R.pending_buf_size)){F=1;break}F=R.gzindex<R.gzhead.name.length?255&R.gzhead.name.charCodeAt(R.gzindex++):0,I(R,F)}while(F!==0);R.gzhead.hcrc&&R.pending>P&&(_.adler=u(_.adler,R.pending_buf,R.pending-P,P)),F===0&&(R.gzindex=0,R.status=91)}else R.status=91;if(R.status===91)if(R.gzhead.comment){P=R.pending;do{if(R.pending===R.pending_buf_size&&(R.gzhead.hcrc&&R.pending>P&&(_.adler=u(_.adler,R.pending_buf,R.pending-P,P)),V(_),P=R.pending,R.pending===R.pending_buf_size)){F=1;break}F=R.gzindex<R.gzhead.comment.length?255&R.gzhead.comment.charCodeAt(R.gzindex++):0,I(R,F)}while(F!==0);R.gzhead.hcrc&&R.pending>P&&(_.adler=u(_.adler,R.pending_buf,R.pending-P,P)),F===0&&(R.status=103)}else R.status=103;if(R.status===103&&(R.gzhead.hcrc?(R.pending+2>R.pending_buf_size&&V(_),R.pending+2<=R.pending_buf_size&&(I(R,255&_.adler),I(R,_.adler>>8&255),_.adler=0,R.status=M)):R.status=M),R.pending!==0){if(V(_),_.avail_out===0)return R.last_flush=-1,f}else if(_.avail_in===0&&X(ee)<=X(K)&&ee!==p)return H(_,-5);if(R.status===666&&_.avail_in!==0)return H(_,-5);if(_.avail_in!==0||R.lookahead!==0||ee!==h&&R.status!==666){var J=R.strategy===2?(function($,ne){for(var le;;){if($.lookahead===0&&(de($),$.lookahead===0)){if(ne===h)return k;break}if($.match_length=0,le=a._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++,le&&(Z($,!1),$.strm.avail_out===0))return k}return $.insert=0,ne===p?(Z($,!0),$.strm.avail_out===0?G:W):$.last_lit&&(Z($,!1),$.strm.avail_out===0)?k:D})(R,ee):R.strategy===3?(function($,ne){for(var le,se,U,re,ue=$.window;;){if($.lookahead<=O){if(de($),$.lookahead<=O&&ne===h)return k;if($.lookahead===0)break}if($.match_length=0,$.lookahead>=z&&0<$.strstart&&(se=ue[U=$.strstart-1])===ue[++U]&&se===ue[++U]&&se===ue[++U]){re=$.strstart+O;do;while(se===ue[++U]&&se===ue[++U]&&se===ue[++U]&&se===ue[++U]&&se===ue[++U]&&se===ue[++U]&&se===ue[++U]&&se===ue[++U]&&U<re);$.match_length=O-(re-U),$.match_length>$.lookahead&&($.match_length=$.lookahead)}if($.match_length>=z?(le=a._tr_tally($,1,$.match_length-z),$.lookahead-=$.match_length,$.strstart+=$.match_length,$.match_length=0):(le=a._tr_tally($,0,$.window[$.strstart]),$.lookahead--,$.strstart++),le&&(Z($,!1),$.strm.avail_out===0))return k}return $.insert=0,ne===p?(Z($,!0),$.strm.avail_out===0?G:W):$.last_lit&&(Z($,!1),$.strm.avail_out===0)?k:D})(R,ee):s[R.level].func(R,ee);if(J!==G&&J!==W||(R.status=666),J===k||J===G)return _.avail_out===0&&(R.last_flush=-1),f;if(J===D&&(ee===1?a._tr_align(R):ee!==5&&(a._tr_stored_block(R,0,0,!1),ee===3&&(A(R.head),R.lookahead===0&&(R.strstart=0,R.block_start=0,R.insert=0))),V(_),_.avail_out===0))return R.last_flush=-1,f}return ee!==p?f:R.wrap<=0?1:(R.wrap===2?(I(R,255&_.adler),I(R,_.adler>>8&255),I(R,_.adler>>16&255),I(R,_.adler>>24&255),I(R,255&_.total_in),I(R,_.total_in>>8&255),I(R,_.total_in>>16&255),I(R,_.total_in>>24&255)):(oe(R,_.adler>>>16),oe(R,65535&_.adler)),V(_),0<R.wrap&&(R.wrap=-R.wrap),R.pending!==0?f:1)},o.deflateEnd=function(_){var ee;return _&&_.state?(ee=_.state.status)!==E&&ee!==69&&ee!==73&&ee!==91&&ee!==103&&ee!==M&&ee!==666?H(_,y):(_.state=null,ee===M?H(_,-3):f):y},o.deflateSetDictionary=function(_,ee){var K,R,P,F,B,J,$,ne,le=ee.length;if(!_||!_.state||(F=(K=_.state).wrap)===2||F===1&&K.status!==E||K.lookahead)return y;for(F===1&&(_.adler=c(_.adler,ee,le,0)),K.wrap=0,le>=K.w_size&&(F===0&&(A(K.head),K.strstart=0,K.block_start=0,K.insert=0),ne=new i.Buf8(K.w_size),i.arraySet(ne,ee,le-K.w_size,K.w_size,0),ee=ne,le=K.w_size),B=_.avail_in,J=_.next_in,$=_.input,_.avail_in=le,_.next_in=0,_.input=ee,de(K);K.lookahead>=z;){for(R=K.strstart,P=K.lookahead-(z-1);K.ins_h=(K.ins_h<<K.hash_shift^K.window[R+z-1])&K.hash_mask,K.prev[R&K.w_mask]=K.head[K.ins_h],K.head[K.ins_h]=R,R++,--P;);K.strstart=R,K.lookahead=z-1,de(K)}return K.strstart+=K.lookahead,K.block_start=K.strstart,K.insert=K.lookahead,K.lookahead=0,K.match_length=K.prev_length=z-1,K.match_available=0,_.next_in=J,_.input=$,_.avail_in=B,K.wrap=F,f},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){r.exports=function(s,i){var a,c,u,d,h,p,f,y,m,x,g,b,w,S,j,C,N,T,z,O,L,E,M,k,D;a=s.state,c=s.next_in,k=s.input,u=c+(s.avail_in-5),d=s.next_out,D=s.output,h=d-(i-s.avail_out),p=d+(s.avail_out-257),f=a.dmax,y=a.wsize,m=a.whave,x=a.wnext,g=a.window,b=a.hold,w=a.bits,S=a.lencode,j=a.distcode,C=(1<<a.lenbits)-1,N=(1<<a.distbits)-1;e:do{w<15&&(b+=k[c++]<<w,w+=8,b+=k[c++]<<w,w+=8),T=S[b&C];t:for(;;){if(b>>>=z=T>>>24,w-=z,(z=T>>>16&255)===0)D[d++]=65535&T;else{if(!(16&z)){if((64&z)==0){T=S[(65535&T)+(b&(1<<z)-1)];continue t}if(32&z){a.mode=12;break e}s.msg="invalid literal/length code",a.mode=30;break e}O=65535&T,(z&=15)&&(w<z&&(b+=k[c++]<<w,w+=8),O+=b&(1<<z)-1,b>>>=z,w-=z),w<15&&(b+=k[c++]<<w,w+=8,b+=k[c++]<<w,w+=8),T=j[b&N];n:for(;;){if(b>>>=z=T>>>24,w-=z,!(16&(z=T>>>16&255))){if((64&z)==0){T=j[(65535&T)+(b&(1<<z)-1)];continue n}s.msg="invalid distance code",a.mode=30;break e}if(L=65535&T,w<(z&=15)&&(b+=k[c++]<<w,(w+=8)<z&&(b+=k[c++]<<w,w+=8)),f<(L+=b&(1<<z)-1)){s.msg="invalid distance too far back",a.mode=30;break e}if(b>>>=z,w-=z,(z=d-h)<L){if(m<(z=L-z)&&a.sane){s.msg="invalid distance too far back",a.mode=30;break e}if(M=g,(E=0)===x){if(E+=y-z,z<O){for(O-=z;D[d++]=g[E++],--z;);E=d-L,M=D}}else if(x<z){if(E+=y+x-z,(z-=x)<O){for(O-=z;D[d++]=g[E++],--z;);if(E=0,x<O){for(O-=z=x;D[d++]=g[E++],--z;);E=d-L,M=D}}}else if(E+=x-z,z<O){for(O-=z;D[d++]=g[E++],--z;);E=d-L,M=D}for(;2<O;)D[d++]=M[E++],D[d++]=M[E++],D[d++]=M[E++],O-=3;O&&(D[d++]=M[E++],1<O&&(D[d++]=M[E++]))}else{for(E=d-L;D[d++]=D[E++],D[d++]=D[E++],D[d++]=D[E++],2<(O-=3););O&&(D[d++]=D[E++],1<O&&(D[d++]=D[E++]))}break}}break}}while(c<u&&d<p);c-=O=w>>3,b&=(1<<(w-=O<<3))-1,s.next_in=c,s.next_out=d,s.avail_in=c<u?u-c+5:5-(c-u),s.avail_out=d<p?p-d+257:257-(d-p),a.hold=b,a.bits=w}},{}],49:[function(n,r,o){var s=n("../utils/common"),i=n("./adler32"),a=n("./crc32"),c=n("./inffast"),u=n("./inftrees"),d=1,h=2,p=0,f=-2,y=1,m=852,x=592;function g(E){return(E>>>24&255)+(E>>>8&65280)+((65280&E)<<8)+((255&E)<<24)}function b(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(E){var M;return E&&E.state?(M=E.state,E.total_in=E.total_out=M.total=0,E.msg="",M.wrap&&(E.adler=1&M.wrap),M.mode=y,M.last=0,M.havedict=0,M.dmax=32768,M.head=null,M.hold=0,M.bits=0,M.lencode=M.lendyn=new s.Buf32(m),M.distcode=M.distdyn=new s.Buf32(x),M.sane=1,M.back=-1,p):f}function S(E){var M;return E&&E.state?((M=E.state).wsize=0,M.whave=0,M.wnext=0,w(E)):f}function j(E,M){var k,D;return E&&E.state?(D=E.state,M<0?(k=0,M=-M):(k=1+(M>>4),M<48&&(M&=15)),M&&(M<8||15<M)?f:(D.window!==null&&D.wbits!==M&&(D.window=null),D.wrap=k,D.wbits=M,S(E))):f}function C(E,M){var k,D;return E?(D=new b,(E.state=D).window=null,(k=j(E,M))!==p&&(E.state=null),k):f}var N,T,z=!0;function O(E){if(z){var M;for(N=new s.Buf32(512),T=new s.Buf32(32),M=0;M<144;)E.lens[M++]=8;for(;M<256;)E.lens[M++]=9;for(;M<280;)E.lens[M++]=7;for(;M<288;)E.lens[M++]=8;for(u(d,E.lens,0,288,N,0,E.work,{bits:9}),M=0;M<32;)E.lens[M++]=5;u(h,E.lens,0,32,T,0,E.work,{bits:5}),z=!1}E.lencode=N,E.lenbits=9,E.distcode=T,E.distbits=5}function L(E,M,k,D){var G,W=E.state;return W.window===null&&(W.wsize=1<<W.wbits,W.wnext=0,W.whave=0,W.window=new s.Buf8(W.wsize)),D>=W.wsize?(s.arraySet(W.window,M,k-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(D<(G=W.wsize-W.wnext)&&(G=D),s.arraySet(W.window,M,k-D,G,W.wnext),(D-=G)?(s.arraySet(W.window,M,k-D,D,0),W.wnext=D,W.whave=W.wsize):(W.wnext+=G,W.wnext===W.wsize&&(W.wnext=0),W.whave<W.wsize&&(W.whave+=G))),0}o.inflateReset=S,o.inflateReset2=j,o.inflateResetKeep=w,o.inflateInit=function(E){return C(E,15)},o.inflateInit2=C,o.inflate=function(E,M){var k,D,G,W,H,X,A,V,Z,I,oe,Y,de,te,ce,fe,ge,xe,Ee,Fe,_,ee,K,R,P=0,F=new s.Buf8(4),B=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!E||!E.state||!E.output||!E.input&&E.avail_in!==0)return f;(k=E.state).mode===12&&(k.mode=13),H=E.next_out,G=E.output,A=E.avail_out,W=E.next_in,D=E.input,X=E.avail_in,V=k.hold,Z=k.bits,I=X,oe=A,ee=p;e:for(;;)switch(k.mode){case y:if(k.wrap===0){k.mode=13;break}for(;Z<16;){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}if(2&k.wrap&&V===35615){F[k.check=0]=255&V,F[1]=V>>>8&255,k.check=a(k.check,F,2,0),Z=V=0,k.mode=2;break}if(k.flags=0,k.head&&(k.head.done=!1),!(1&k.wrap)||(((255&V)<<8)+(V>>8))%31){E.msg="incorrect header check",k.mode=30;break}if((15&V)!=8){E.msg="unknown compression method",k.mode=30;break}if(Z-=4,_=8+(15&(V>>>=4)),k.wbits===0)k.wbits=_;else if(_>k.wbits){E.msg="invalid window size",k.mode=30;break}k.dmax=1<<_,E.adler=k.check=1,k.mode=512&V?10:12,Z=V=0;break;case 2:for(;Z<16;){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}if(k.flags=V,(255&k.flags)!=8){E.msg="unknown compression method",k.mode=30;break}if(57344&k.flags){E.msg="unknown header flags set",k.mode=30;break}k.head&&(k.head.text=V>>8&1),512&k.flags&&(F[0]=255&V,F[1]=V>>>8&255,k.check=a(k.check,F,2,0)),Z=V=0,k.mode=3;case 3:for(;Z<32;){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}k.head&&(k.head.time=V),512&k.flags&&(F[0]=255&V,F[1]=V>>>8&255,F[2]=V>>>16&255,F[3]=V>>>24&255,k.check=a(k.check,F,4,0)),Z=V=0,k.mode=4;case 4:for(;Z<16;){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}k.head&&(k.head.xflags=255&V,k.head.os=V>>8),512&k.flags&&(F[0]=255&V,F[1]=V>>>8&255,k.check=a(k.check,F,2,0)),Z=V=0,k.mode=5;case 5:if(1024&k.flags){for(;Z<16;){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}k.length=V,k.head&&(k.head.extra_len=V),512&k.flags&&(F[0]=255&V,F[1]=V>>>8&255,k.check=a(k.check,F,2,0)),Z=V=0}else k.head&&(k.head.extra=null);k.mode=6;case 6:if(1024&k.flags&&(X<(Y=k.length)&&(Y=X),Y&&(k.head&&(_=k.head.extra_len-k.length,k.head.extra||(k.head.extra=new Array(k.head.extra_len)),s.arraySet(k.head.extra,D,W,Y,_)),512&k.flags&&(k.check=a(k.check,D,Y,W)),X-=Y,W+=Y,k.length-=Y),k.length))break e;k.length=0,k.mode=7;case 7:if(2048&k.flags){if(X===0)break e;for(Y=0;_=D[W+Y++],k.head&&_&&k.length<65536&&(k.head.name+=String.fromCharCode(_)),_&&Y<X;);if(512&k.flags&&(k.check=a(k.check,D,Y,W)),X-=Y,W+=Y,_)break e}else k.head&&(k.head.name=null);k.length=0,k.mode=8;case 8:if(4096&k.flags){if(X===0)break e;for(Y=0;_=D[W+Y++],k.head&&_&&k.length<65536&&(k.head.comment+=String.fromCharCode(_)),_&&Y<X;);if(512&k.flags&&(k.check=a(k.check,D,Y,W)),X-=Y,W+=Y,_)break e}else k.head&&(k.head.comment=null);k.mode=9;case 9:if(512&k.flags){for(;Z<16;){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}if(V!==(65535&k.check)){E.msg="header crc mismatch",k.mode=30;break}Z=V=0}k.head&&(k.head.hcrc=k.flags>>9&1,k.head.done=!0),E.adler=k.check=0,k.mode=12;break;case 10:for(;Z<32;){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}E.adler=k.check=g(V),Z=V=0,k.mode=11;case 11:if(k.havedict===0)return E.next_out=H,E.avail_out=A,E.next_in=W,E.avail_in=X,k.hold=V,k.bits=Z,2;E.adler=k.check=1,k.mode=12;case 12:if(M===5||M===6)break e;case 13:if(k.last){V>>>=7&Z,Z-=7&Z,k.mode=27;break}for(;Z<3;){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}switch(k.last=1&V,Z-=1,3&(V>>>=1)){case 0:k.mode=14;break;case 1:if(O(k),k.mode=20,M!==6)break;V>>>=2,Z-=2;break e;case 2:k.mode=17;break;case 3:E.msg="invalid block type",k.mode=30}V>>>=2,Z-=2;break;case 14:for(V>>>=7&Z,Z-=7&Z;Z<32;){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}if((65535&V)!=(V>>>16^65535)){E.msg="invalid stored block lengths",k.mode=30;break}if(k.length=65535&V,Z=V=0,k.mode=15,M===6)break e;case 15:k.mode=16;case 16:if(Y=k.length){if(X<Y&&(Y=X),A<Y&&(Y=A),Y===0)break e;s.arraySet(G,D,W,Y,H),X-=Y,W+=Y,A-=Y,H+=Y,k.length-=Y;break}k.mode=12;break;case 17:for(;Z<14;){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}if(k.nlen=257+(31&V),V>>>=5,Z-=5,k.ndist=1+(31&V),V>>>=5,Z-=5,k.ncode=4+(15&V),V>>>=4,Z-=4,286<k.nlen||30<k.ndist){E.msg="too many length or distance symbols",k.mode=30;break}k.have=0,k.mode=18;case 18:for(;k.have<k.ncode;){for(;Z<3;){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}k.lens[B[k.have++]]=7&V,V>>>=3,Z-=3}for(;k.have<19;)k.lens[B[k.have++]]=0;if(k.lencode=k.lendyn,k.lenbits=7,K={bits:k.lenbits},ee=u(0,k.lens,0,19,k.lencode,0,k.work,K),k.lenbits=K.bits,ee){E.msg="invalid code lengths set",k.mode=30;break}k.have=0,k.mode=19;case 19:for(;k.have<k.nlen+k.ndist;){for(;fe=(P=k.lencode[V&(1<<k.lenbits)-1])>>>16&255,ge=65535&P,!((ce=P>>>24)<=Z);){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}if(ge<16)V>>>=ce,Z-=ce,k.lens[k.have++]=ge;else{if(ge===16){for(R=ce+2;Z<R;){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}if(V>>>=ce,Z-=ce,k.have===0){E.msg="invalid bit length repeat",k.mode=30;break}_=k.lens[k.have-1],Y=3+(3&V),V>>>=2,Z-=2}else if(ge===17){for(R=ce+3;Z<R;){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}Z-=ce,_=0,Y=3+(7&(V>>>=ce)),V>>>=3,Z-=3}else{for(R=ce+7;Z<R;){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}Z-=ce,_=0,Y=11+(127&(V>>>=ce)),V>>>=7,Z-=7}if(k.have+Y>k.nlen+k.ndist){E.msg="invalid bit length repeat",k.mode=30;break}for(;Y--;)k.lens[k.have++]=_}}if(k.mode===30)break;if(k.lens[256]===0){E.msg="invalid code -- missing end-of-block",k.mode=30;break}if(k.lenbits=9,K={bits:k.lenbits},ee=u(d,k.lens,0,k.nlen,k.lencode,0,k.work,K),k.lenbits=K.bits,ee){E.msg="invalid literal/lengths set",k.mode=30;break}if(k.distbits=6,k.distcode=k.distdyn,K={bits:k.distbits},ee=u(h,k.lens,k.nlen,k.ndist,k.distcode,0,k.work,K),k.distbits=K.bits,ee){E.msg="invalid distances set",k.mode=30;break}if(k.mode=20,M===6)break e;case 20:k.mode=21;case 21:if(6<=X&&258<=A){E.next_out=H,E.avail_out=A,E.next_in=W,E.avail_in=X,k.hold=V,k.bits=Z,c(E,oe),H=E.next_out,G=E.output,A=E.avail_out,W=E.next_in,D=E.input,X=E.avail_in,V=k.hold,Z=k.bits,k.mode===12&&(k.back=-1);break}for(k.back=0;fe=(P=k.lencode[V&(1<<k.lenbits)-1])>>>16&255,ge=65535&P,!((ce=P>>>24)<=Z);){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}if(fe&&(240&fe)==0){for(xe=ce,Ee=fe,Fe=ge;fe=(P=k.lencode[Fe+((V&(1<<xe+Ee)-1)>>xe)])>>>16&255,ge=65535&P,!(xe+(ce=P>>>24)<=Z);){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}V>>>=xe,Z-=xe,k.back+=xe}if(V>>>=ce,Z-=ce,k.back+=ce,k.length=ge,fe===0){k.mode=26;break}if(32&fe){k.back=-1,k.mode=12;break}if(64&fe){E.msg="invalid literal/length code",k.mode=30;break}k.extra=15&fe,k.mode=22;case 22:if(k.extra){for(R=k.extra;Z<R;){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}k.length+=V&(1<<k.extra)-1,V>>>=k.extra,Z-=k.extra,k.back+=k.extra}k.was=k.length,k.mode=23;case 23:for(;fe=(P=k.distcode[V&(1<<k.distbits)-1])>>>16&255,ge=65535&P,!((ce=P>>>24)<=Z);){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}if((240&fe)==0){for(xe=ce,Ee=fe,Fe=ge;fe=(P=k.distcode[Fe+((V&(1<<xe+Ee)-1)>>xe)])>>>16&255,ge=65535&P,!(xe+(ce=P>>>24)<=Z);){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}V>>>=xe,Z-=xe,k.back+=xe}if(V>>>=ce,Z-=ce,k.back+=ce,64&fe){E.msg="invalid distance code",k.mode=30;break}k.offset=ge,k.extra=15&fe,k.mode=24;case 24:if(k.extra){for(R=k.extra;Z<R;){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}k.offset+=V&(1<<k.extra)-1,V>>>=k.extra,Z-=k.extra,k.back+=k.extra}if(k.offset>k.dmax){E.msg="invalid distance too far back",k.mode=30;break}k.mode=25;case 25:if(A===0)break e;if(Y=oe-A,k.offset>Y){if((Y=k.offset-Y)>k.whave&&k.sane){E.msg="invalid distance too far back",k.mode=30;break}de=Y>k.wnext?(Y-=k.wnext,k.wsize-Y):k.wnext-Y,Y>k.length&&(Y=k.length),te=k.window}else te=G,de=H-k.offset,Y=k.length;for(A<Y&&(Y=A),A-=Y,k.length-=Y;G[H++]=te[de++],--Y;);k.length===0&&(k.mode=21);break;case 26:if(A===0)break e;G[H++]=k.length,A--,k.mode=21;break;case 27:if(k.wrap){for(;Z<32;){if(X===0)break e;X--,V|=D[W++]<<Z,Z+=8}if(oe-=A,E.total_out+=oe,k.total+=oe,oe&&(E.adler=k.check=k.flags?a(k.check,G,oe,H-oe):i(k.check,G,oe,H-oe)),oe=A,(k.flags?V:g(V))!==k.check){E.msg="incorrect data check",k.mode=30;break}Z=V=0}k.mode=28;case 28:if(k.wrap&&k.flags){for(;Z<32;){if(X===0)break e;X--,V+=D[W++]<<Z,Z+=8}if(V!==(4294967295&k.total)){E.msg="incorrect length check",k.mode=30;break}Z=V=0}k.mode=29;case 29:ee=1;break e;case 30:ee=-3;break e;case 31:return-4;default:return f}return E.next_out=H,E.avail_out=A,E.next_in=W,E.avail_in=X,k.hold=V,k.bits=Z,(k.wsize||oe!==E.avail_out&&k.mode<30&&(k.mode<27||M!==4))&&L(E,E.output,E.next_out,oe-E.avail_out)?(k.mode=31,-4):(I-=E.avail_in,oe-=E.avail_out,E.total_in+=I,E.total_out+=oe,k.total+=oe,k.wrap&&oe&&(E.adler=k.check=k.flags?a(k.check,G,oe,E.next_out-oe):i(k.check,G,oe,E.next_out-oe)),E.data_type=k.bits+(k.last?64:0)+(k.mode===12?128:0)+(k.mode===20||k.mode===15?256:0),(I==0&&oe===0||M===4)&&ee===p&&(ee=-5),ee)},o.inflateEnd=function(E){if(!E||!E.state)return f;var M=E.state;return M.window&&(M.window=null),E.state=null,p},o.inflateGetHeader=function(E,M){var k;return E&&E.state?(2&(k=E.state).wrap)==0?f:((k.head=M).done=!1,p):f},o.inflateSetDictionary=function(E,M){var k,D=M.length;return E&&E.state?(k=E.state).wrap!==0&&k.mode!==11?f:k.mode===11&&i(1,M,D,0)!==k.check?-3:L(E,M,D,D)?(k.mode=31,-4):(k.havedict=1,p):f},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){var s=n("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],c=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(d,h,p,f,y,m,x,g){var b,w,S,j,C,N,T,z,O,L=g.bits,E=0,M=0,k=0,D=0,G=0,W=0,H=0,X=0,A=0,V=0,Z=null,I=0,oe=new s.Buf16(16),Y=new s.Buf16(16),de=null,te=0;for(E=0;E<=15;E++)oe[E]=0;for(M=0;M<f;M++)oe[h[p+M]]++;for(G=L,D=15;1<=D&&oe[D]===0;D--);if(D<G&&(G=D),D===0)return y[m++]=20971520,y[m++]=20971520,g.bits=1,0;for(k=1;k<D&&oe[k]===0;k++);for(G<k&&(G=k),E=X=1;E<=15;E++)if(X<<=1,(X-=oe[E])<0)return-1;if(0<X&&(d===0||D!==1))return-1;for(Y[1]=0,E=1;E<15;E++)Y[E+1]=Y[E]+oe[E];for(M=0;M<f;M++)h[p+M]!==0&&(x[Y[h[p+M]]++]=M);if(N=d===0?(Z=de=x,19):d===1?(Z=i,I-=257,de=a,te-=257,256):(Z=c,de=u,-1),E=k,C=m,H=M=V=0,S=-1,j=(A=1<<(W=G))-1,d===1&&852<A||d===2&&592<A)return 1;for(;;){for(T=E-H,O=x[M]<N?(z=0,x[M]):x[M]>N?(z=de[te+x[M]],Z[I+x[M]]):(z=96,0),b=1<<E-H,k=w=1<<W;y[C+(V>>H)+(w-=b)]=T<<24|z<<16|O|0,w!==0;);for(b=1<<E-1;V&b;)b>>=1;if(b!==0?(V&=b-1,V+=b):V=0,M++,--oe[E]==0){if(E===D)break;E=h[p+x[M]]}if(G<E&&(V&j)!==S){for(H===0&&(H=G),C+=k,X=1<<(W=E-H);W+H<D&&!((X-=oe[W+H])<=0);)W++,X<<=1;if(A+=1<<W,d===1&&852<A||d===2&&592<A)return 1;y[S=V&j]=G<<24|W<<16|C-m|0}}return V!==0&&(y[C+V]=E-H<<24|64<<16|0),g.bits=G,0}},{"../utils/common":41}],51:[function(n,r,o){r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){var s=n("../utils/common"),i=0,a=1;function c(P){for(var F=P.length;0<=--F;)P[F]=0}var u=0,d=29,h=256,p=h+1+d,f=30,y=19,m=2*p+1,x=15,g=16,b=7,w=256,S=16,j=17,C=18,N=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],T=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],z=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],L=new Array(2*(p+2));c(L);var E=new Array(2*f);c(E);var M=new Array(512);c(M);var k=new Array(256);c(k);var D=new Array(d);c(D);var G,W,H,X=new Array(f);function A(P,F,B,J,$){this.static_tree=P,this.extra_bits=F,this.extra_base=B,this.elems=J,this.max_length=$,this.has_stree=P&&P.length}function V(P,F){this.dyn_tree=P,this.max_code=0,this.stat_desc=F}function Z(P){return P<256?M[P]:M[256+(P>>>7)]}function I(P,F){P.pending_buf[P.pending++]=255&F,P.pending_buf[P.pending++]=F>>>8&255}function oe(P,F,B){P.bi_valid>g-B?(P.bi_buf|=F<<P.bi_valid&65535,I(P,P.bi_buf),P.bi_buf=F>>g-P.bi_valid,P.bi_valid+=B-g):(P.bi_buf|=F<<P.bi_valid&65535,P.bi_valid+=B)}function Y(P,F,B){oe(P,B[2*F],B[2*F+1])}function de(P,F){for(var B=0;B|=1&P,P>>>=1,B<<=1,0<--F;);return B>>>1}function te(P,F,B){var J,$,ne=new Array(x+1),le=0;for(J=1;J<=x;J++)ne[J]=le=le+B[J-1]<<1;for($=0;$<=F;$++){var se=P[2*$+1];se!==0&&(P[2*$]=de(ne[se]++,se))}}function ce(P){var F;for(F=0;F<p;F++)P.dyn_ltree[2*F]=0;for(F=0;F<f;F++)P.dyn_dtree[2*F]=0;for(F=0;F<y;F++)P.bl_tree[2*F]=0;P.dyn_ltree[2*w]=1,P.opt_len=P.static_len=0,P.last_lit=P.matches=0}function fe(P){8<P.bi_valid?I(P,P.bi_buf):0<P.bi_valid&&(P.pending_buf[P.pending++]=P.bi_buf),P.bi_buf=0,P.bi_valid=0}function ge(P,F,B,J){var $=2*F,ne=2*B;return P[$]<P[ne]||P[$]===P[ne]&&J[F]<=J[B]}function xe(P,F,B){for(var J=P.heap[B],$=B<<1;$<=P.heap_len&&($<P.heap_len&&ge(F,P.heap[$+1],P.heap[$],P.depth)&&$++,!ge(F,J,P.heap[$],P.depth));)P.heap[B]=P.heap[$],B=$,$<<=1;P.heap[B]=J}function Ee(P,F,B){var J,$,ne,le,se=0;if(P.last_lit!==0)for(;J=P.pending_buf[P.d_buf+2*se]<<8|P.pending_buf[P.d_buf+2*se+1],$=P.pending_buf[P.l_buf+se],se++,J===0?Y(P,$,F):(Y(P,(ne=k[$])+h+1,F),(le=N[ne])!==0&&oe(P,$-=D[ne],le),Y(P,ne=Z(--J),B),(le=T[ne])!==0&&oe(P,J-=X[ne],le)),se<P.last_lit;);Y(P,w,F)}function Fe(P,F){var B,J,$,ne=F.dyn_tree,le=F.stat_desc.static_tree,se=F.stat_desc.has_stree,U=F.stat_desc.elems,re=-1;for(P.heap_len=0,P.heap_max=m,B=0;B<U;B++)ne[2*B]!==0?(P.heap[++P.heap_len]=re=B,P.depth[B]=0):ne[2*B+1]=0;for(;P.heap_len<2;)ne[2*($=P.heap[++P.heap_len]=re<2?++re:0)]=1,P.depth[$]=0,P.opt_len--,se&&(P.static_len-=le[2*$+1]);for(F.max_code=re,B=P.heap_len>>1;1<=B;B--)xe(P,ne,B);for($=U;B=P.heap[1],P.heap[1]=P.heap[P.heap_len--],xe(P,ne,1),J=P.heap[1],P.heap[--P.heap_max]=B,P.heap[--P.heap_max]=J,ne[2*$]=ne[2*B]+ne[2*J],P.depth[$]=(P.depth[B]>=P.depth[J]?P.depth[B]:P.depth[J])+1,ne[2*B+1]=ne[2*J+1]=$,P.heap[1]=$++,xe(P,ne,1),2<=P.heap_len;);P.heap[--P.heap_max]=P.heap[1],(function(ue,be){var Pe,qe,ft,Oe,It,Ut,We=be.dyn_tree,Zt=be.max_code,Ct=be.stat_desc.static_tree,Bp=be.stat_desc.has_stree,Up=be.stat_desc.extra_bits,za=be.stat_desc.extra_base,ir=be.stat_desc.max_length,Or=0;for(Oe=0;Oe<=x;Oe++)ue.bl_count[Oe]=0;for(We[2*ue.heap[ue.heap_max]+1]=0,Pe=ue.heap_max+1;Pe<m;Pe++)ir<(Oe=We[2*We[2*(qe=ue.heap[Pe])+1]+1]+1)&&(Oe=ir,Or++),We[2*qe+1]=Oe,Zt<qe||(ue.bl_count[Oe]++,It=0,za<=qe&&(It=Up[qe-za]),Ut=We[2*qe],ue.opt_len+=Ut*(Oe+It),Bp&&(ue.static_len+=Ut*(Ct[2*qe+1]+It)));if(Or!==0){do{for(Oe=ir-1;ue.bl_count[Oe]===0;)Oe--;ue.bl_count[Oe]--,ue.bl_count[Oe+1]+=2,ue.bl_count[ir]--,Or-=2}while(0<Or);for(Oe=ir;Oe!==0;Oe--)for(qe=ue.bl_count[Oe];qe!==0;)Zt<(ft=ue.heap[--Pe])||(We[2*ft+1]!==Oe&&(ue.opt_len+=(Oe-We[2*ft+1])*We[2*ft],We[2*ft+1]=Oe),qe--)}})(P,F),te(ne,re,P.bl_count)}function _(P,F,B){var J,$,ne=-1,le=F[1],se=0,U=7,re=4;for(le===0&&(U=138,re=3),F[2*(B+1)+1]=65535,J=0;J<=B;J++)$=le,le=F[2*(J+1)+1],++se<U&&$===le||(se<re?P.bl_tree[2*$]+=se:$!==0?($!==ne&&P.bl_tree[2*$]++,P.bl_tree[2*S]++):se<=10?P.bl_tree[2*j]++:P.bl_tree[2*C]++,ne=$,re=(se=0)===le?(U=138,3):$===le?(U=6,3):(U=7,4))}function ee(P,F,B){var J,$,ne=-1,le=F[1],se=0,U=7,re=4;for(le===0&&(U=138,re=3),J=0;J<=B;J++)if($=le,le=F[2*(J+1)+1],!(++se<U&&$===le)){if(se<re)for(;Y(P,$,P.bl_tree),--se!=0;);else $!==0?($!==ne&&(Y(P,$,P.bl_tree),se--),Y(P,S,P.bl_tree),oe(P,se-3,2)):se<=10?(Y(P,j,P.bl_tree),oe(P,se-3,3)):(Y(P,C,P.bl_tree),oe(P,se-11,7));ne=$,re=(se=0)===le?(U=138,3):$===le?(U=6,3):(U=7,4)}}c(X);var K=!1;function R(P,F,B,J){oe(P,(u<<1)+(J?1:0),3),(function($,ne,le,se){fe($),I($,le),I($,~le),s.arraySet($.pending_buf,$.window,ne,le,$.pending),$.pending+=le})(P,F,B)}o._tr_init=function(P){K||((function(){var F,B,J,$,ne,le=new Array(x+1);for($=J=0;$<d-1;$++)for(D[$]=J,F=0;F<1<<N[$];F++)k[J++]=$;for(k[J-1]=$,$=ne=0;$<16;$++)for(X[$]=ne,F=0;F<1<<T[$];F++)M[ne++]=$;for(ne>>=7;$<f;$++)for(X[$]=ne<<7,F=0;F<1<<T[$]-7;F++)M[256+ne++]=$;for(B=0;B<=x;B++)le[B]=0;for(F=0;F<=143;)L[2*F+1]=8,F++,le[8]++;for(;F<=255;)L[2*F+1]=9,F++,le[9]++;for(;F<=279;)L[2*F+1]=7,F++,le[7]++;for(;F<=287;)L[2*F+1]=8,F++,le[8]++;for(te(L,p+1,le),F=0;F<f;F++)E[2*F+1]=5,E[2*F]=de(F,5);G=new A(L,N,h+1,p,x),W=new A(E,T,0,f,x),H=new A(new Array(0),z,0,y,b)})(),K=!0),P.l_desc=new V(P.dyn_ltree,G),P.d_desc=new V(P.dyn_dtree,W),P.bl_desc=new V(P.bl_tree,H),P.bi_buf=0,P.bi_valid=0,ce(P)},o._tr_stored_block=R,o._tr_flush_block=function(P,F,B,J){var $,ne,le=0;0<P.level?(P.strm.data_type===2&&(P.strm.data_type=(function(se){var U,re=4093624447;for(U=0;U<=31;U++,re>>>=1)if(1&re&&se.dyn_ltree[2*U]!==0)return i;if(se.dyn_ltree[18]!==0||se.dyn_ltree[20]!==0||se.dyn_ltree[26]!==0)return a;for(U=32;U<h;U++)if(se.dyn_ltree[2*U]!==0)return a;return i})(P)),Fe(P,P.l_desc),Fe(P,P.d_desc),le=(function(se){var U;for(_(se,se.dyn_ltree,se.l_desc.max_code),_(se,se.dyn_dtree,se.d_desc.max_code),Fe(se,se.bl_desc),U=y-1;3<=U&&se.bl_tree[2*O[U]+1]===0;U--);return se.opt_len+=3*(U+1)+5+5+4,U})(P),$=P.opt_len+3+7>>>3,(ne=P.static_len+3+7>>>3)<=$&&($=ne)):$=ne=B+5,B+4<=$&&F!==-1?R(P,F,B,J):P.strategy===4||ne===$?(oe(P,2+(J?1:0),3),Ee(P,L,E)):(oe(P,4+(J?1:0),3),(function(se,U,re,ue){var be;for(oe(se,U-257,5),oe(se,re-1,5),oe(se,ue-4,4),be=0;be<ue;be++)oe(se,se.bl_tree[2*O[be]+1],3);ee(se,se.dyn_ltree,U-1),ee(se,se.dyn_dtree,re-1)})(P,P.l_desc.max_code+1,P.d_desc.max_code+1,le+1),Ee(P,P.dyn_ltree,P.dyn_dtree)),ce(P),J&&fe(P)},o._tr_tally=function(P,F,B){return P.pending_buf[P.d_buf+2*P.last_lit]=F>>>8&255,P.pending_buf[P.d_buf+2*P.last_lit+1]=255&F,P.pending_buf[P.l_buf+P.last_lit]=255&B,P.last_lit++,F===0?P.dyn_ltree[2*B]++:(P.matches++,F--,P.dyn_ltree[2*(k[B]+h+1)]++,P.dyn_dtree[2*Z(F)]++),P.last_lit===P.lit_bufsize-1},o._tr_align=function(P){oe(P,2,3),Y(P,w,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)})(P)}},{"../utils/common":41}],53:[function(n,r,o){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(s){(function(i,a){if(!i.setImmediate){var c,u,d,h,p=1,f={},y=!1,m=i.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(i);x=x&&x.setTimeout?x:i,c={}.toString.call(i.process)==="[object process]"?function(S){process.nextTick(function(){b(S)})}:(function(){if(i.postMessage&&!i.importScripts){var S=!0,j=i.onmessage;return i.onmessage=function(){S=!1},i.postMessage("","*"),i.onmessage=j,S}})()?(h="setImmediate$"+Math.random()+"$",i.addEventListener?i.addEventListener("message",w,!1):i.attachEvent("onmessage",w),function(S){i.postMessage(h+S,"*")}):i.MessageChannel?((d=new MessageChannel).port1.onmessage=function(S){b(S.data)},function(S){d.port2.postMessage(S)}):m&&"onreadystatechange"in m.createElement("script")?(u=m.documentElement,function(S){var j=m.createElement("script");j.onreadystatechange=function(){b(S),j.onreadystatechange=null,u.removeChild(j),j=null},u.appendChild(j)}):function(S){setTimeout(b,0,S)},x.setImmediate=function(S){typeof S!="function"&&(S=new Function(""+S));for(var j=new Array(arguments.length-1),C=0;C<j.length;C++)j[C]=arguments[C+1];var N={callback:S,args:j};return f[p]=N,c(p),p++},x.clearImmediate=g}function g(S){delete f[S]}function b(S){if(y)setTimeout(b,0,S);else{var j=f[S];if(j){y=!0;try{(function(C){var N=C.callback,T=C.args;switch(T.length){case 0:N();break;case 1:N(T[0]);break;case 2:N(T[0],T[1]);break;case 3:N(T[0],T[1],T[2]);break;default:N.apply(a,T)}})(j)}finally{g(S),y=!1}}}}function w(S){S.source===i&&typeof S.data=="string"&&S.data.indexOf(h)===0&&b(+S.data.slice(h.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof Dr<"u"?Dr:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(js)),js.exports}var zS=IS();const PS=Ei(zS);async function RS(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 OS(e){const t=new PS;for(const i of e)i.rawRequestBody!==null&&t.file(`#${i.id}.Request.json`,i.rawRequestBody),i.responseText!==null&&t.file(`#${i.id}.Response.json`,i.responseText);const n=e.filter(i=>i.streaming);await Promise.allSettled(n.map(async i=>{const a=await RS(i.id);a!==null&&t.file(`#${i.id}.SSE.Response.json`,a)}));const r=await t.generateAsync({type:"blob"}),o=URL.createObjectURL(r),s=document.createElement("a");s.href=o,s.download=`llm-inspector-export-${new Date().toISOString().slice(0,10)}.zip`,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(o)}const DS="1.15.1",MS={version:DS},$l=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Bl=Th,ha=(e,t)=>n=>{var r;if(t?.variants==null)return Bl(e,n?.class,n?.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(u=>{const d=n?.[u],h=s?.[u];if(d===null)return null;const p=$l(d)||$l(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(y=>{let[m,x]=y;return Array.isArray(x)?x.includes({...s,...a}[m]):{...s,...a}[m]===x})?[...u,h,p]:u},[]);return Bl(e,i,c,n?.class,n?.className)},LS=ha("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?Jv:"span";return l.jsx(o,{"data-slot":"badge","data-variant":t,className:he(LS({variant:t}),e),...r})}function ts({...e}){return l.jsx(I2,{"data-slot":"dialog",...e})}function FS({...e}){return l.jsx(z2,{"data-slot":"dialog-trigger",...e})}function $S({...e}){return l.jsx(P2,{"data-slot":"dialog-portal",...e})}function BS({className:e,...t}){return l.jsx(R2,{"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 ns({className:e,children:t,...n}){return l.jsxs($S,{children:[l.jsx(BS,{}),l.jsxs(O2,{"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(M2,{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(ad,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function rs({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 os({className:e,...t}){return l.jsx(D2,{"data-slot":"dialog-title",className:he("text-lg font-semibold leading-none tracking-tight",e),...t})}const US=ha("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(US({variant:t,size:n,className:e})),...r})}function Zh({open:e,onOpenChange:t,title:n,description:r,confirmLabel:o="Confirm",variant:s="default",onConfirm:i}){return l.jsx(ts,{open:e,onOpenChange:t,children:l.jsxs(ns,{children:[l.jsx(rs,{children:l.jsx(os,{children:n})}),l.jsx("p",{className:"text-sm text-muted-foreground",children:r}),l.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[l.jsx(Xe,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Cancel"}),l.jsx(Xe,{variant:s,size:"sm",onClick:()=>{i(),t(!1)},children:o})]})]})})}const ZS={anthropic:"Anthropic",openai:"OpenAI",unknown:"Unknown"};function Ul(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}function VS({conversationId:e,startTime:t,endTime:n,totalCalls:r,totalInputTokens:o,totalOutputTokens:s,apiFormat:i,expanded:a,onToggle:c,hideApiFormat:u=!1,isLoading:d=!1,userAgent:h,onClear:p}){const[f,y]=v.useState(!1),m=x=>{x.stopPropagation(),p!==void 0&&y(!0)};return l.jsxs("div",{role:"button",tabIndex:0,className:he("flex items-center gap-3 px-3 py-2 cursor-pointer transition-colors","hover:bg-muted/50","select-none","border border-border rounded-lg mb-2 bg-muted/30"),onClick:c,onKeyDown:x=>{x.target===x.currentTarget&&(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),c())},children:[a?l.jsx(yt,{className:"size-4 text-muted-foreground shrink-0"}):d?l.jsx(_r,{className:"size-4 animate-spin text-muted-foreground shrink-0"}):l.jsx(bt,{className:"size-4 text-muted-foreground shrink-0"}),l.jsx("span",{className:"text-purple-400/90 font-mono text-xs font-semibold shrink-0",title:e,children:e.length>24?e.slice(0,12)+"…"+e.slice(-12):e}),h!=null&&h!==""&&l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:h,children:[l.jsx(Bv,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums truncate max-w-[120px]",children:h})]}),!u&&l.jsx(xt,{variant:"outline",className:he("text-[10px] px-1.5 py-0 h-5 font-mono shrink-0",i==="openai"&&"border-blue-500/40 text-blue-400",i==="anthropic"&&"border-orange-500/40 text-orange-400",i==="unknown"&&"border-muted text-muted-foreground"),children:ZS[i]}),l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(Oo,{className:"size-3"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[Ul(t)," - ",Ul(n)]})]}),l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(td,{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(Tr,{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(s)})]})]}),l.jsx("span",{className:"flex-1 min-w-0"}),p!==void 0&&l.jsx("button",{type:"button",onClick:m,"aria-label":`Clear group (${r} request${r!==1?"s":""})`,title:"Clear this group",className:"text-muted-foreground hover:text-foreground transition-colors shrink-0 inline-flex items-center justify-center size-6 rounded hover:bg-muted cursor-pointer",children:l.jsx(id,{className:"size-3.5"})}),l.jsx(Zh,{open:f,onOpenChange:y,title:"Clear this group?",description:`This will remove ${r} request${r!==1?"s":""} from this conversation. This action cannot be undone.`,confirmLabel:"Clear",variant:"destructive",onConfirm:()=>{p?.()}})]})}function WS(e){const t=e.find(n=>n.apiFormat!=="unknown");return t!==void 0?t.apiFormat:e[0]?.apiFormat??"unknown"}function HS(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 ko(e){if(e.isTest===!0)return"provider-test";if(e.sessionId!==null&&e.sessionId!==""&&e.sessionId!==void 0)return e.sessionId;const t=e.clientPid!==null&&e.clientPid!==void 0,n=e.clientProjectFolder!==null&&e.clientProjectFolder!==void 0;if(!t&&!n)return"default";const r=t?`PID:${e.clientPid}`:"unknown",o=n?e.clientProjectFolder:"no-folder";return`${r}|${o}`}function qS(e){const t=new Map;for(const r of e){const o=ko(r),s=t.get(o);s!==void 0?s.push(r):t.set(o,[r])}const n=[];for(const[r,o]of t){const s=[...o].sort((i,a)=>i.timestamp.localeCompare(a.timestamp));n.push({id:r,conversationId:r,logs:s})}return n.sort((r,o)=>(r.logs[0]?.timestamp??"").localeCompare(o.logs[0]?.timestamp??"")),n}function Zl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function KS(e){if(e.responseText===null)return null;try{let t=JSON.parse(e.responseText);return typeof t=="string"&&(t=JSON.parse(t)),Zl(t)?typeof t.stop_reason=="string"?t.stop_reason==="end_turn"||t.stop_reason==="tool_use"?t.stop_reason:null:Array.isArray(t.choices)&&t.choices.length>0&&Zl(t.choices[0])&&typeof t.choices[0].finish_reason=="string"&&t.choices[0].finish_reason==="stop"?"stop":null:null}catch{return null}}function Vh(e){return e==="end_turn"||e==="stop"}const JS="x-anthropic-billing-header:";function GS(e){return e.trimStart().toLowerCase().startsWith(JS)}function Vl(e,t){return Object.getOwnPropertyDescriptor(e,t)?.value}function YS(e){return typeof e!="object"||e===null||Array.isArray(e)?!1:Object.prototype.hasOwnProperty.call(e,"system")}function XS(e){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const t=Vl(e,"type"),n=Vl(e,"text");return typeof t!="string"||t!=="text"||typeof n!="string"?!1:GS(n)}function QS(e){let t;try{t=JSON.parse(e)}catch{return{body:e,removed:0}}if(!YS(t))return{body:e,removed:0};const n=t.system;if(!Array.isArray(n)||n.length===0)return{body:e,removed:0};const r=[];let o=0;for(const s of n){if(XS(s)){o+=1;continue}r.push(s)}return o===0?{body:e,removed:0}:(r.length===0?delete t.system:t.system=r,{body:JSON.stringify(t),removed:o})}function eC(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const tC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,rC={};function Wl(e,t){return(rC.jsx?nC:tC).test(e)}const oC=/[ \t\n\f\r]/g;function sC(e){return typeof e=="object"?e.type==="text"?Hl(e.value):!1:Hl(e)}function Hl(e){return e.replace(oC,"")===""}class Pr{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Pr.prototype.normal={};Pr.prototype.property={};Pr.prototype.space=void 0;function Wh(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Pr(n,r,t)}function di(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 iC=0;const je=kn(),Je=kn(),fi=kn(),ie=kn(),$e=kn(),Fn=kn(),ht=kn();function kn(){return 2**++iC}const hi=Object.freeze(Object.defineProperty({__proto__:null,boolean:je,booleanish:Je,commaOrSpaceSeparated:ht,commaSeparated:Fn,number:ie,overloadedBoolean:fi,spaceSeparated:$e},Symbol.toStringTag,{value:"Module"})),Es=Object.keys(hi);class pa extends dt{constructor(t,n,r,o){let s=-1;if(super(t,n),ql(this,"space",o),typeof r=="number")for(;++s<Es.length;){const i=Es[s];ql(this,Es[s],(r&hi[i])===hi[i])}}}pa.prototype.defined=!0;function ql(e,t,n){n&&(e[t]=n)}function rr(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const s=new pa(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[di(r)]=r,n[di(s.attribute)]=r}return new Pr(t,n,e.space)}const Hh=rr({properties:{ariaActiveDescendant:null,ariaAtomic:Je,ariaAutoComplete:null,ariaBusy:Je,ariaChecked:Je,ariaColCount:ie,ariaColIndex:ie,ariaColSpan:ie,ariaControls:$e,ariaCurrent:null,ariaDescribedBy:$e,ariaDetails:null,ariaDisabled:Je,ariaDropEffect:$e,ariaErrorMessage:null,ariaExpanded:Je,ariaFlowTo:$e,ariaGrabbed:Je,ariaHasPopup:null,ariaHidden:Je,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:$e,ariaLevel:ie,ariaLive:null,ariaModal:Je,ariaMultiLine:Je,ariaMultiSelectable:Je,ariaOrientation:null,ariaOwns:$e,ariaPlaceholder:null,ariaPosInSet:ie,ariaPressed:Je,ariaReadOnly:Je,ariaRelevant:null,ariaRequired:Je,ariaRoleDescription:$e,ariaRowCount:ie,ariaRowIndex:ie,ariaRowSpan:ie,ariaSelected:Je,ariaSetSize:ie,ariaSort:null,ariaValueMax:ie,ariaValueMin:ie,ariaValueNow:ie,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function qh(e,t){return t in e?e[t]:t}function Kh(e,t){return qh(e,t.toLowerCase())}const aC=rr({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Fn,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:ie,colSpan:null,content:null,contentEditable:Je,controls:je,controlsList:$e,coords:ie|Fn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:je,defer:je,dir:null,dirName:null,disabled:je,download:fi,draggable:Je,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:je,formTarget:null,headers:$e,height:ie,hidden:fi,high:ie,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:ie,manifest:null,max:null,maxLength:ie,media:null,method:null,min:null,minLength:ie,multiple:je,muted:je,name:null,nonce:null,noModule:je,noValidate:je,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:je,optimum:ie,pattern:null,ping:$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:ie,rowSpan:ie,sandbox:$e,scope:null,scoped:je,seamless:je,selected:je,shadowRootClonable:je,shadowRootDelegatesFocus:je,shadowRootMode:null,shape:null,size:ie,sizes:null,slot:null,span:ie,spellCheck:Je,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ie,step:null,style:null,tabIndex:ie,target:null,title:null,translate:null,type:null,typeMustMatch:je,useMap:null,value:Je,width:ie,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:$e,axis:null,background:null,bgColor:null,border:ie,borderColor:null,bottomMargin:ie,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:je,declare:je,event:null,face:null,frame:null,frameBorder:null,hSpace:ie,leftMargin:ie,link:null,longDesc:null,lowSrc:null,marginHeight:ie,marginWidth:ie,noResize:je,noHref:je,noShade:je,noWrap:je,object:null,profile:null,prompt:null,rev:null,rightMargin:ie,rules:null,scheme:null,scrolling:Je,standby:null,summary:null,text:null,topMargin:ie,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ie,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:je,disableRemotePlayback:je,prefix:null,property:null,results:ie,security:null,unselectable:null},space:"html",transform:Kh}),lC=rr({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ht,accentHeight:ie,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ie,amplitude:ie,arabicForm:null,ascent:ie,attributeName:null,attributeType:null,azimuth:ie,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ie,by:null,calcMode:null,capHeight:ie,className:$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:ie,diffuseConstant:ie,direction:null,display:null,dur:null,divisor:ie,dominantBaseline:null,download:je,dx:null,dy:null,edgeMode:null,editable:null,elevation:ie,enableBackground:null,end:null,event:null,exponent:ie,externalResourcesRequired:null,fill:null,fillOpacity:ie,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Fn,g2:Fn,glyphName:Fn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ie,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ie,horizOriginX:ie,horizOriginY:ie,id:null,ideographic:ie,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ie,k:ie,k1:ie,k2:ie,k3:ie,k4:ie,kernelMatrix:ht,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ie,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ie,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ie,overlineThickness:ie,paintOrder:null,panose1:null,path:null,pathLength:ie,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:$e,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ie,pointsAtY:ie,pointsAtZ:ie,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ht,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ht,rev:ht,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ht,requiredFeatures:ht,requiredFonts:ht,requiredFormats:ht,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ie,specularExponent:ie,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ie,strikethroughThickness:ie,string:null,stroke:null,strokeDashArray:ht,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ie,strokeOpacity:ie,strokeWidth:null,style:null,surfaceScale:ie,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ht,tabIndex:ie,tableValues:null,target:null,targetX:ie,targetY:ie,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ht,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ie,underlineThickness:ie,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ie,values:null,vAlphabetic:ie,vMathematical:ie,vectorEffect:null,vHanging:ie,vIdeographic:ie,version:null,vertAdvY:ie,vertOriginX:ie,vertOriginY:ie,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ie,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:qh}),Jh=rr({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Gh=rr({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Kh}),Yh=rr({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),cC={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"},uC=/[A-Z]/g,Kl=/-[a-z]/g,dC=/^data[-\w.:]+$/i;function fC(e,t){const n=di(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"&&dC.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Kl,pC);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Kl.test(s)){let i=s.replace(uC,hC);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}o=pa}return new o(r,t)}function hC(e){return"-"+e.toLowerCase()}function pC(e){return e.charAt(1).toUpperCase()}const mC=Wh([Hh,aC,Jh,Gh,Yh],"html"),ma=Wh([Hh,lC,Jh,Gh,Yh],"svg");function gC(e){return e.join(" ").trim()}var Tn={},Ns,Jl;function xC(){if(Jl)return Ns;Jl=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,i=/^[;\s]*/,a=/^\s+|\s+$/g,c=`
|
|
85
|
+
`,u="/",d="*",h="",p="comment",f="declaration";function y(x,g){if(typeof x!="string")throw new TypeError("First argument must be a string");if(!x)return[];g=g||{};var b=1,w=1;function S(k){var D=k.match(t);D&&(b+=D.length);var G=k.lastIndexOf(c);w=~G?k.length-G:w+k.length}function j(){var k={line:b,column:w};return function(D){return D.position=new C(k),z(),D}}function C(k){this.start=k,this.end={line:b,column:w},this.source=g.source}C.prototype.content=x;function N(k){var D=new Error(g.source+":"+b+":"+w+": "+k);if(D.reason=k,D.filename=g.source,D.line=b,D.column=w,D.source=x,!g.silent)throw D}function T(k){var D=k.exec(x);if(D){var G=D[0];return S(G),x=x.slice(G.length),D}}function z(){T(n)}function O(k){var D;for(k=k||[];D=L();)D!==!1&&k.push(D);return k}function L(){var k=j();if(!(u!=x.charAt(0)||d!=x.charAt(1))){for(var D=2;h!=x.charAt(D)&&(d!=x.charAt(D)||u!=x.charAt(D+1));)++D;if(D+=2,h===x.charAt(D-1))return N("End of comment missing");var G=x.slice(2,D-2);return w+=2,S(G),x=x.slice(D),w+=2,k({type:p,comment:G})}}function E(){var k=j(),D=T(r);if(D){if(L(),!T(o))return N("property missing ':'");var G=T(s),W=k({type:f,property:m(D[0].replace(e,h)),value:G?m(G[0].replace(e,h)):h});return T(i),W}}function M(){var k=[];O(k);for(var D;D=E();)D!==!1&&(k.push(D),O(k));return k}return z(),M()}function m(x){return x?x.replace(a,h):h}return Ns=y,Ns}var Gl;function yC(){if(Gl)return Tn;Gl=1;var e=Tn&&Tn.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Tn,"__esModule",{value:!0}),Tn.default=n;const t=e(xC());function n(r,o){let s=null;if(!r||typeof r!="string")return s;const i=(0,t.default)(r),a=typeof o=="function";return i.forEach(c=>{if(c.type!=="declaration")return;const{property:u,value:d}=c;a?o(u,d,c):d&&(s=s||{},s[u]=d)}),s}return Tn}var cr={},Yl;function vC(){if(Yl)return cr;Yl=1,Object.defineProperty(cr,"__esModule",{value:!0}),cr.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,s=function(u){return!u||n.test(u)||e.test(u)},i=function(u,d){return d.toUpperCase()},a=function(u,d){return"".concat(d,"-")},c=function(u,d){return d===void 0&&(d={}),s(u)?u:(u=u.toLowerCase(),d.reactCompat?u=u.replace(o,a):u=u.replace(r,a),u.replace(t,i))};return cr.camelCase=c,cr}var ur,Xl;function bC(){if(Xl)return ur;Xl=1;var e=ur&&ur.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(yC()),n=vC();function r(o,s){var i={};return!o||typeof o!="string"||(0,t.default)(o,function(a,c){a&&c&&(i[(0,n.camelCase)(a,s)]=c)}),i}return r.default=r,ur=r,ur}var wC=bC();const kC=Ei(wC),Xh=Qh("end"),ga=Qh("start");function Qh(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 _C(e){const t=ga(e),n=Xh(e);if(t&&n)return{start:t,end:n}}function xr(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ql(e.position):"start"in e||"end"in e?Ql(e):"line"in e||"column"in e?pi(e):""}function pi(e){return ec(e&&e.line)+":"+ec(e&&e.column)}function Ql(e){return pi(e&&e.start)+"-"+pi(e&&e.end)}function ec(e){return e&&typeof e=="number"?e:1}class rt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",s={},i=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?o=t:!s.cause&&t&&(i=!0,o=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?s.ruleId=r:(s.source=r.slice(0,c),s.ruleId=r.slice(c+1))}if(!s.place&&s.ancestors&&s.ancestors){const c=s.ancestors[s.ancestors.length-1];c&&(s.place=c.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=a?a.line:void 0,this.name=xr(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=i&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}rt.prototype.file="";rt.prototype.name="";rt.prototype.reason="";rt.prototype.message="";rt.prototype.stack="";rt.prototype.column=void 0;rt.prototype.line=void 0;rt.prototype.ancestors=void 0;rt.prototype.cause=void 0;rt.prototype.fatal=void 0;rt.prototype.place=void 0;rt.prototype.ruleId=void 0;rt.prototype.source=void 0;const xa={}.hasOwnProperty,SC=new Map,CC=/[A-Z]/g,jC=new Set(["table","tbody","thead","tfoot","tr"]),EC=new Set(["td","th"]),ep="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function NC(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=DC(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=OC(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"?ma:mC,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=tp(o,e,void 0);return s&&typeof s!="string"?s:o.create(e,o.Fragment,{children:s||void 0},void 0)}function tp(e,t,n){if(t.type==="element")return TC(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return AC(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return zC(e,t,n);if(t.type==="mdxjsEsm")return IC(e,t);if(t.type==="root")return PC(e,t,n);if(t.type==="text")return RC(e,t)}function TC(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=ma,e.schema=o),e.ancestors.push(t);const s=rp(e,t.tagName,!1),i=MC(e,t);let a=va(e,t);return jC.has(t.tagName)&&(a=a.filter(function(c){return typeof c=="string"?!sC(c):!0})),np(e,i,s,t),ya(i,a),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function AC(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)}jr(e,t.position)}function IC(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);jr(e,t.position)}function zC(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=ma,e.schema=o),e.ancestors.push(t);const s=t.name===null?e.Fragment:rp(e,t.name,!0),i=LC(e,t),a=va(e,t);return np(e,i,s,t),ya(i,a),e.ancestors.pop(),e.schema=r,e.create(t,s,i,n)}function PC(e,t,n){const r={};return ya(r,va(e,t)),e.create(t,e.Fragment,r,n)}function RC(e,t){return t.value}function np(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ya(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function OC(e,t,n){return r;function r(o,s,i,a){const u=Array.isArray(i.children)?n:t;return a?u(s,i,a):u(s,i)}}function DC(e,t){return n;function n(r,o,s,i){const a=Array.isArray(s.children),c=ga(r);return t(o,s,i,a,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function MC(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&xa.call(t.properties,o)){const s=FC(e,o,t.properties[o]);if(s){const[i,a]=s;e.tableCellAlignToStyle&&i==="align"&&typeof a=="string"&&EC.has(t.tagName)?r=a:n[i]=a}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function LC(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const i=s.expression;i.type;const a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else jr(e,t.position);else{const o=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,s=e.evaluater.evaluateExpression(a.expression)}else jr(e,t.position);else s=r.value===null?!0:r.value;n[o]=s}return n}function va(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:SC;for(;++r<t.children.length;){const s=t.children[r];let i;if(e.passKeys){const c=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(c){const u=o.get(c)||0;i=c+"-"+u,o.set(c,u+1)}}const a=tp(e,s,i);a!==void 0&&n.push(a)}return n}function FC(e,t,n){const r=fC(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?eC(n):gC(n)),r.property==="style"){let o=typeof n=="object"?n:$C(e,String(n));return e.stylePropertyNameCase==="css"&&(o=BC(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?cC[r.property]||r.property:r.attribute,n]}}function $C(e,t){try{return kC(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=ep+"#cannot-parse-style-attribute",o}}function rp(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let s=-1,i;for(;++s<o.length;){const a=Wl(o[s])?{type:"Identifier",name:o[s]}:{type:"Literal",value:o[s]};i=i?{type:"MemberExpression",object:i,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=i}else r=Wl(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return xa.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);jr(e)}function jr(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=ep+"#cannot-handle-mdx-estrees-without-createevaluater",n}function BC(e){const t={};let n;for(n in e)xa.call(e,n)&&(t[UC(n)]=e[n]);return t}function UC(e){let t=e.replace(CC,ZC);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function ZC(e){return"-"+e.toLowerCase()}const Ts={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"]},VC={};function WC(e,t){const n=VC,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return op(e,r,o)}function op(e,t,n){if(HC(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 tc(e.children,t,n)}return Array.isArray(e)?tc(e,t,n):""}function tc(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=op(e[o],t,n);return r.join("")}function HC(e){return!!(e&&typeof e=="object")}const nc=document.createElement("i");function ba(e){const t="&"+e+";";nc.innerHTML=t;const n=nc.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ft(e,t,n,r){const o=e.length;let s=0,i;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)i=Array.from(r),i.unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);s<r.length;)i=r.slice(s,s+1e4),i.unshift(t,0),e.splice(...i),s+=1e4,t+=1e4}function vt(e,t){return e.length>0?(Ft(e,e.length,0,t),e):t}const rc={}.hasOwnProperty;function qC(e){const t={};let n=-1;for(;++n<e.length;)KC(t,e[n]);return t}function KC(e,t){let n;for(n in t){const o=(rc.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let i;if(s)for(i in s){rc.call(o,i)||(o[i]=[]);const a=s[i];JC(o[i],Array.isArray(a)?a:a?[a]:[])}}}function JC(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ft(e,0,0,r)}function sp(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function $n(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Rt=cn(/[A-Za-z]/),mt=cn(/[\dA-Za-z]/),GC=cn(/[#-'*+\--9=?A-Z^-~]/);function mi(e){return e!==null&&(e<32||e===127)}const gi=cn(/\d/),YC=cn(/[\dA-Fa-f]/),XC=cn(/[!-/:-@[-`{-~]/);function _e(e){return e!==null&&e<-2}function ct(e){return e!==null&&(e<0||e===32)}function De(e){return e===-2||e===-1||e===32}const QC=cn(new RegExp("\\p{P}|\\p{S}","u")),ej=cn(/\s/);function cn(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function or(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const s=e.charCodeAt(n);let i="";if(s===37&&mt(e.charCodeAt(n+1))&&mt(e.charCodeAt(n+2)))o=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(i=String.fromCharCode(s));else if(s>55295&&s<57344){const a=e.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(i=String.fromCharCode(s,a),o=1):i="�"}else i=String.fromCharCode(s);i&&(t.push(e.slice(r,n),encodeURIComponent(i)),r=n+o+1,i=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function Be(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let s=0;return i;function i(c){return De(c)?(e.enter(n),a(c)):t(c)}function a(c){return De(c)&&s++<o?(e.consume(c),a):(e.exit(n),t(c))}}const tj={tokenize:nj};function nj(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"),s(a)}function s(a){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,i(a)}function i(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return _e(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),i)}}const rj={tokenize:oj},oc={tokenize:sj};function oj(e){const t=this,n=[];let r=0,o,s,i;return a;function a(w){if(r<n.length){const S=n[r];return t.containerState=S[1],e.attempt(S[0].continuation,c,u)(w)}return u(w)}function c(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&b();const S=t.events.length;let j=S,C;for(;j--;)if(t.events[j][0]==="exit"&&t.events[j][1].type==="chunkFlow"){C=t.events[j][1].end;break}g(r);let N=S;for(;N<t.events.length;)t.events[N][1].end={...C},N++;return Ft(t.events,j+1,0,t.events.slice(S)),t.events.length=N,u(w)}return a(w)}function u(w){if(r===n.length){if(!o)return p(w);if(o.currentConstruct&&o.currentConstruct.concrete)return y(w);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(oc,d,h)(w)}function d(w){return o&&b(),g(r),p(w)}function h(w){return t.parser.lazy[t.now().line]=r!==n.length,i=t.now().offset,y(w)}function p(w){return t.containerState={},e.attempt(oc,f,y)(w)}function f(w){return r++,n.push([t.currentConstruct,t.containerState]),p(w)}function y(w){if(w===null){o&&b(),g(0),e.consume(w);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:s}),m(w)}function m(w){if(w===null){x(e.exit("chunkFlow"),!0),g(0),e.consume(w);return}return _e(w)?(e.consume(w),x(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(w),m)}function x(w,S){const j=t.sliceStream(w);if(S&&j.push(null),w.previous=s,s&&(s.next=w),s=w,o.defineSkip(w.start),o.write(j),t.parser.lazy[w.start.line]){let C=o.events.length;for(;C--;)if(o.events[C][1].start.offset<i&&(!o.events[C][1].end||o.events[C][1].end.offset>i))return;const N=t.events.length;let T=N,z,O;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(z){O=t.events[T][1].end;break}z=!0}for(g(r),C=N;C<t.events.length;)t.events[C][1].end={...O},C++;Ft(t.events,T+1,0,t.events.slice(N)),t.events.length=C}}function g(w){let S=n.length;for(;S-- >w;){const j=n[S];t.containerState=j[1],j[0].exit.call(t,e)}n.length=w}function b(){o.write([null]),s=void 0,o=void 0,t.containerState._closeFlow=void 0}}function sj(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 sc(e){if(e===null||ct(e)||ej(e))return 1;if(QC(e))return 2}function wa(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const s=e[o].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const xi={name:"attention",resolveAll:ij,tokenize:aj};function ij(e,t){let n=-1,r,o,s,i,a,c,u,d;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const h={...e[r][1].end},p={...e[n][1].start};ic(h,-c),ic(p,c),i={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...e[r][1].end}},a={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},s={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:c>1?"strong":"emphasis",start:{...i.start},end:{...a.end}},e[r][1].end={...i.start},e[n][1].start={...a.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=vt(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=vt(u,[["enter",o,t],["enter",i,t],["exit",i,t],["enter",s,t]]),u=vt(u,wa(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=vt(u,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=vt(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Ft(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function aj(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=sc(r);let s;return i;function i(c){return s=c,e.enter("attentionSequence"),a(c)}function a(c){if(c===s)return e.consume(c),a;const u=e.exit("attentionSequence"),d=sc(c),h=!d||d===2&&o||n.includes(c),p=!o||o===2&&d||n.includes(r);return u._open=!!(s===42?h:h&&(o||!p)),u._close=!!(s===42?p:p&&(d||!h)),t(c)}}function ic(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const lj={name:"autolink",tokenize:cj};function cj(e,t,n){let r=0;return o;function o(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(f){return Rt(f)?(e.consume(f),i):f===64?n(f):u(f)}function i(f){return f===43||f===45||f===46||mt(f)?(r=1,a(f)):u(f)}function a(f){return f===58?(e.consume(f),r=0,c):(f===43||f===45||f===46||mt(f))&&r++<32?(e.consume(f),a):(r=0,u(f))}function c(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||mi(f)?n(f):(e.consume(f),c)}function u(f){return f===64?(e.consume(f),d):GC(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 y=f===45?p:h;return e.consume(f),y}return n(f)}}const ss={partial:!0,tokenize:uj};function uj(e,t,n){return r;function r(s){return De(s)?Be(e,o,"linePrefix")(s):o(s)}function o(s){return s===null||_e(s)?t(s):n(s)}}const ip={continuation:{tokenize:fj},exit:hj,name:"blockQuote",tokenize:dj};function dj(e,t,n){const r=this;return o;function o(i){if(i===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(i),e.exit("blockQuoteMarker"),s}return n(i)}function s(i){return De(i)?(e.enter("blockQuotePrefixWhitespace"),e.consume(i),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(i))}}function fj(e,t,n){const r=this;return o;function o(i){return De(i)?Be(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):s(i)}function s(i){return e.attempt(ip,t,n)(i)}}function hj(e){e.exit("blockQuote")}const ap={name:"characterEscape",tokenize:pj};function pj(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),o}function o(s){return XC(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const lp={name:"characterReference",tokenize:mj};function mj(e,t,n){const r=this;let o=0,s,i;return a;function a(h){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),c}function c(h){return h===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(h),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),s=31,i=mt,d(h))}function u(h){return h===88||h===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(h),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,i=YC,d):(e.enter("characterReferenceValue"),s=7,i=gi,d(h))}function d(h){if(h===59&&o){const p=e.exit("characterReferenceValue");return i===mt&&!ba(r.sliceSerialize(p))?n(h):(e.enter("characterReferenceMarker"),e.consume(h),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return i(h)&&o++<s?(e.consume(h),d):n(h)}}const ac={partial:!0,tokenize:xj},lc={concrete:!0,name:"codeFenced",tokenize:gj};function gj(e,t,n){const r=this,o={partial:!0,tokenize:j};let s=0,i=0,a;return c;function c(C){return u(C)}function u(C){const N=r.events[r.events.length-1];return s=N&&N[1].type==="linePrefix"?N[2].sliceSerialize(N[1],!0).length:0,a=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(C)}function d(C){return C===a?(i++,e.consume(C),d):i<3?n(C):(e.exit("codeFencedFenceSequence"),De(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(ac,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)):De(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"}),y(C))}function y(C){return C===null||_e(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),h(C)):C===96&&C===a?n(C):(e.consume(C),y)}function m(C){return e.attempt(o,S,x)(C)}function x(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),g}function g(C){return s>0&&De(C)?Be(e,b,"linePrefix",s+1)(C):b(C)}function b(C){return C===null||_e(C)?e.check(ac,m,S)(C):(e.enter("codeFlowValue"),w(C))}function w(C){return C===null||_e(C)?(e.exit("codeFlowValue"),b(C)):(e.consume(C),w)}function S(C){return e.exit("codeFenced"),t(C)}function j(C,N,T){let z=0;return O;function O(D){return C.enter("lineEnding"),C.consume(D),C.exit("lineEnding"),L}function L(D){return C.enter("codeFencedFence"),De(D)?Be(C,E,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):E(D)}function E(D){return D===a?(C.enter("codeFencedFenceSequence"),M(D)):T(D)}function M(D){return D===a?(z++,C.consume(D),M):z>=i?(C.exit("codeFencedFenceSequence"),De(D)?Be(C,k,"whitespace")(D):k(D)):T(D)}function k(D){return D===null||_e(D)?(C.exit("codeFencedFence"),N(D)):T(D)}}}function xj(e,t,n){const r=this;return o;function o(i){return i===null?n(i):(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s)}function s(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}const As={name:"codeIndented",tokenize:vj},yj={partial:!0,tokenize:bj};function vj(e,t,n){const r=this;return o;function o(u){return e.enter("codeIndented"),Be(e,s,"linePrefix",5)(u)}function s(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?i(u):n(u)}function i(u){return u===null?c(u):_e(u)?e.attempt(yj,i,c)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||_e(u)?(e.exit("codeFlowValue"),i(u)):(e.consume(u),a)}function c(u){return e.exit("codeIndented"),t(u)}}function bj(e,t,n){const r=this;return o;function o(i){return r.parser.lazy[r.now().line]?n(i):_e(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),o):Be(e,s,"linePrefix",5)(i)}function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):_e(i)?o(i):n(i)}}const wj={name:"codeText",previous:_j,resolve:kj,tokenize:Sj};function kj(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 _j(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function Sj(e,t,n){let r=0,o,s;return i;function i(h){return e.enter("codeText"),e.enter("codeTextSequence"),a(h)}function a(h){return h===96?(e.consume(h),r++,a):(e.exit("codeTextSequence"),c(h))}function c(h){return h===null?n(h):h===32?(e.enter("space"),e.consume(h),e.exit("space"),c):h===96?(s=e.enter("codeTextSequence"),o=0,d(h)):_e(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(h))}function u(h){return h===null||h===32||h===96||_e(h)?(e.exit("codeTextData"),c(h)):(e.consume(h),u)}function d(h){return h===96?(e.consume(h),o++,d):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(h)):(s.type="codeTextData",u(h))}}class Cj{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const o=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&dr(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),dr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),dr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);dr(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);dr(this.left,n.reverse())}}}function dr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function cp(e){const t={};let n=-1,r,o,s,i,a,c,u;const d=new Cj(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,s=0,s<c.length&&c[s][1].type==="lineEndingBlank"&&(s+=2),s<c.length&&c[s][1].type==="content"))for(;++s<c.length&&c[s][1].type!=="content";)c[s][1].type==="chunkText"&&(c[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,jj(d,n)),n=t[n],u=!0);else if(r[1]._container){for(s=n,o=void 0;s--;)if(i=d.get(s),i[1].type==="lineEnding"||i[1].type==="lineEndingBlank")i[0]==="enter"&&(o&&(d.get(o)[1].type="lineEndingBlank"),i[1].type="lineEnding",o=s);else if(!(i[1].type==="linePrefix"||i[1].type==="listItemIndent"))break;o&&(r[1].end={...d.get(o)[1].start},a=d.slice(o,n),a.unshift(r),d.splice(o,n-o+1,a))}}return Ft(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function jj(e,t){const n=e.get(t)[1],r=e.get(t)[2];let o=t-1;const s=[];let i=n._tokenizer;i||(i=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(i._contentTypeTextTrailing=!0));const a=i.events,c=[],u={};let d,h,p=-1,f=n,y=0,m=0;const x=[m];for(;f;){for(;e.get(++o)[1]!==f;);s.push(o),f._tokenizer||(d=r.sliceStream(f),f.next||d.push(null),h&&i.defineSkip(f.start),f._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(d),f._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),h=f,f=f.next}for(f=n;++p<a.length;)a[p][0]==="exit"&&a[p-1][0]==="enter"&&a[p][1].type===a[p-1][1].type&&a[p][1].start.line!==a[p][1].end.line&&(m=p+1,x.push(m),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(i.events=[],f?(f._tokenizer=void 0,f.previous=void 0):x.pop(),p=x.length;p--;){const g=a.slice(x[p],x[p+1]),b=s.pop();c.push([b,b+g.length-1]),e.splice(b,2,g)}for(c.reverse(),p=-1;++p<c.length;)u[y+c[p][0]]=y+c[p][1],y+=c[p][1]-c[p][0]-1;return u}const Ej={resolve:Tj,tokenize:Aj},Nj={partial:!0,tokenize:Ij};function Tj(e){return cp(e),e}function Aj(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(a)}function o(a){return a===null?s(a):_e(a)?e.check(Nj,i,s)(a):(e.consume(a),o)}function s(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function i(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function Ij(e,t,n){const r=this;return o;function o(i){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),Be(e,s,"linePrefix")}function s(i){if(i===null||_e(i))return n(i);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function up(e,t,n,r,o,s,i,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(s),e.consume(g),e.exit(s),p):g===null||g===32||g===41||mi(g)?n(g):(e.enter(r),e.enter(i),e.enter(a),e.enter("chunkString",{contentType:"string"}),m(g))}function p(g){return g===62?(e.enter(s),e.consume(g),e.exit(s),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?y:f)}function y(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(i),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||mi(g)?n(g):(e.consume(g),g===92?x:m)}function x(g){return g===40||g===41||g===92?(e.consume(g),m):m(g)}}function dp(e,t,n,r,o,s){const i=this;let a=0,c;return u;function u(f){return e.enter(r),e.enter(o),e.consume(f),e.exit(o),e.enter(s),d}function d(f){return a>999||f===null||f===91||f===93&&!c||f===94&&!a&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):f===93?(e.exit(s),e.enter(o),e.consume(f),e.exit(o),e.exit(r),t):_e(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),h(f))}function h(f){return f===null||f===91||f===93||_e(f)||a++>999?(e.exit("chunkString"),d(f)):(e.consume(f),c||(c=!De(f)),f===92?p:h)}function p(f){return f===91||f===92||f===93?(e.consume(f),a++,h):h(f)}}function fp(e,t,n,r,o,s){let i;return a;function a(p){return p===34||p===39||p===40?(e.enter(r),e.enter(o),e.consume(p),e.exit(o),i=p===40?41:p,c):n(p)}function c(p){return p===i?(e.enter(o),e.consume(p),e.exit(o),e.exit(r),t):(e.enter(s),u(p))}function u(p){return p===i?(e.exit(s),c(i)):p===null?n(p):_e(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Be(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===i||p===null||_e(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?h:d)}function h(p){return p===i||p===92?(e.consume(p),d):d(p)}}function yr(e,t){let n;return r;function r(o){return _e(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):De(o)?Be(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const zj={name:"definition",tokenize:Rj},Pj={partial:!0,tokenize:Oj};function Rj(e,t,n){const r=this;let o;return s;function s(f){return e.enter("definition"),i(f)}function i(f){return dp.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return o=$n(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),c):n(f)}function c(f){return ct(f)?yr(e,u)(f):u(f)}function u(f){return up(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function d(f){return e.attempt(Pj,h,h)(f)}function h(f){return De(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 Oj(e,t,n){return r;function r(a){return ct(a)?yr(e,o)(a):n(a)}function o(a){return fp(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return De(a)?Be(e,i,"whitespace")(a):i(a)}function i(a){return a===null||_e(a)?t(a):n(a)}}const Dj={name:"hardBreakEscape",tokenize:Mj};function Mj(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),o}function o(s){return _e(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const Lj={name:"headingAtx",resolve:Fj,tokenize:$j};function Fj(e,t){let n=e.length-2,r=3,o,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ft(e,r,n-r+1,[["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t]])),e}function $j(e,t,n){let r=0;return o;function o(d){return e.enter("atxHeading"),s(d)}function s(d){return e.enter("atxHeadingSequence"),i(d)}function i(d){return d===35&&r++<6?(e.consume(d),i):d===null||ct(d)?(e.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||_e(d)?(e.exit("atxHeading"),t(d)):De(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 Bj=["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"],cc=["pre","script","style","textarea"],Uj={concrete:!0,name:"htmlFlow",resolveTo:Wj,tokenize:Hj},Zj={partial:!0,tokenize:Kj},Vj={partial:!0,tokenize:qj};function Wj(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 Hj(e,t,n){const r=this;let o,s,i,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),s=!0,m):I===63?(e.consume(I),o=3,r.interrupt?t:A):Rt(I)?(e.consume(I),i=String.fromCharCode(I),x):n(I)}function p(I){return I===45?(e.consume(I),o=2,f):I===91?(e.consume(I),o=5,a=0,y):Rt(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 y(I){const oe="CDATA[";return I===oe.charCodeAt(a++)?(e.consume(I),a===oe.length?r.interrupt?t:E:y):n(I)}function m(I){return Rt(I)?(e.consume(I),i=String.fromCharCode(I),x):n(I)}function x(I){if(I===null||I===47||I===62||ct(I)){const oe=I===47,Y=i.toLowerCase();return!oe&&!s&&cc.includes(Y)?(o=1,r.interrupt?t(I):E(I)):Bj.includes(i.toLowerCase())?(o=6,oe?(e.consume(I),g):r.interrupt?t(I):E(I)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(I):s?b(I):w(I))}return I===45||mt(I)?(e.consume(I),i+=String.fromCharCode(I),x):n(I)}function g(I){return I===62?(e.consume(I),r.interrupt?t:E):n(I)}function b(I){return De(I)?(e.consume(I),b):O(I)}function w(I){return I===47?(e.consume(I),O):I===58||I===95||Rt(I)?(e.consume(I),S):De(I)?(e.consume(I),w):O(I)}function S(I){return I===45||I===46||I===58||I===95||mt(I)?(e.consume(I),S):j(I)}function j(I){return I===61?(e.consume(I),C):De(I)?(e.consume(I),j):w(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,N):De(I)?(e.consume(I),C):T(I)}function N(I){return I===c?(e.consume(I),c=null,z):I===null||_e(I)?n(I):(e.consume(I),N)}function T(I){return I===null||I===34||I===39||I===47||I===60||I===61||I===62||I===96||ct(I)?j(I):(e.consume(I),T)}function z(I){return I===47||I===62||De(I)?w(I):n(I)}function O(I){return I===62?(e.consume(I),L):n(I)}function L(I){return I===null||_e(I)?E(I):De(I)?(e.consume(I),L):n(I)}function E(I){return I===45&&o===2?(e.consume(I),G):I===60&&o===1?(e.consume(I),W):I===62&&o===4?(e.consume(I),V):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(Zj,Z,M)(I)):I===null||_e(I)?(e.exit("htmlFlowData"),M(I)):(e.consume(I),E)}function M(I){return e.check(Vj,k,Z)(I)}function k(I){return e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),D}function D(I){return I===null||_e(I)?M(I):(e.enter("htmlFlowData"),E(I))}function G(I){return I===45?(e.consume(I),A):E(I)}function W(I){return I===47?(e.consume(I),i="",H):E(I)}function H(I){if(I===62){const oe=i.toLowerCase();return cc.includes(oe)?(e.consume(I),V):E(I)}return Rt(I)&&i.length<8?(e.consume(I),i+=String.fromCharCode(I),H):E(I)}function X(I){return I===93?(e.consume(I),A):E(I)}function A(I){return I===62?(e.consume(I),V):I===45&&o===2?(e.consume(I),A):E(I)}function V(I){return I===null||_e(I)?(e.exit("htmlFlowData"),Z(I)):(e.consume(I),V)}function Z(I){return e.exit("htmlFlow"),t(I)}}function qj(e,t,n){const r=this;return o;function o(i){return _e(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s):n(i)}function s(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}function Kj(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(ss,t,n)}}const Jj={name:"htmlText",tokenize:Gj};function Gj(e,t,n){const r=this;let o,s,i;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),j):A===63?(e.consume(A),w):Rt(A)?(e.consume(A),T):n(A)}function u(A){return A===45?(e.consume(A),d):A===91?(e.consume(A),s=0,y):Rt(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)?(i=h,W(A)):(e.consume(A),h)}function p(A){return A===45?(e.consume(A),f):h(A)}function f(A){return A===62?G(A):A===45?p(A):h(A)}function y(A){const V="CDATA[";return A===V.charCodeAt(s++)?(e.consume(A),s===V.length?m:y):n(A)}function m(A){return A===null?n(A):A===93?(e.consume(A),x):_e(A)?(i=m,W(A)):(e.consume(A),m)}function x(A){return A===93?(e.consume(A),g):m(A)}function g(A){return A===62?G(A):A===93?(e.consume(A),g):m(A)}function b(A){return A===null||A===62?G(A):_e(A)?(i=b,W(A)):(e.consume(A),b)}function w(A){return A===null?n(A):A===63?(e.consume(A),S):_e(A)?(i=w,W(A)):(e.consume(A),w)}function S(A){return A===62?G(A):w(A)}function j(A){return Rt(A)?(e.consume(A),C):n(A)}function C(A){return A===45||mt(A)?(e.consume(A),C):N(A)}function N(A){return _e(A)?(i=N,W(A)):De(A)?(e.consume(A),N):G(A)}function T(A){return A===45||mt(A)?(e.consume(A),T):A===47||A===62||ct(A)?z(A):n(A)}function z(A){return A===47?(e.consume(A),G):A===58||A===95||Rt(A)?(e.consume(A),O):_e(A)?(i=z,W(A)):De(A)?(e.consume(A),z):G(A)}function O(A){return A===45||A===46||A===58||A===95||mt(A)?(e.consume(A),O):L(A)}function L(A){return A===61?(e.consume(A),E):_e(A)?(i=L,W(A)):De(A)?(e.consume(A),L):z(A)}function E(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(e.consume(A),o=A,M):_e(A)?(i=E,W(A)):De(A)?(e.consume(A),E):(e.consume(A),k)}function M(A){return A===o?(e.consume(A),o=void 0,D):A===null?n(A):_e(A)?(i=M,W(A)):(e.consume(A),M)}function k(A){return A===null||A===34||A===39||A===60||A===61||A===96?n(A):A===47||A===62||ct(A)?z(A):(e.consume(A),k)}function D(A){return A===47||A===62||ct(A)?z(A):n(A)}function G(A){return A===62?(e.consume(A),e.exit("htmlTextData"),e.exit("htmlText"),t):n(A)}function W(A){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),H}function H(A){return De(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"),i(A)}}const ka={name:"labelEnd",resolveAll:e5,resolveTo:t5,tokenize:n5},Yj={tokenize:r5},Xj={tokenize:o5},Qj={tokenize:s5};function e5(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==n.length&&Ft(e,0,e.length,n),e}function t5(e,t){let n=e.length,r=0,o,s,i,a;for(;n--;)if(o=e[n][1],s){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(i){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(s=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(i=n);const c={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[s][1].start},end:{...e[i][1].end}},d={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[i-2][1].start}};return a=[["enter",c,t],["enter",u,t]],a=vt(a,e.slice(s+1,s+r+3)),a=vt(a,[["enter",d,t]]),a=vt(a,wa(t.parser.constructs.insideSpan.null,e.slice(s+r+4,i-3),t)),a=vt(a,[["exit",d,t],e[i-2],e[i-1],["exit",u,t]]),a=vt(a,e.slice(i+1)),a=vt(a,[["exit",c,t]]),Ft(e,s,e.length,a),e}function n5(e,t,n){const r=this;let o=r.events.length,s,i;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){s=r.events[o][1];break}return a;function a(p){return s?s._inactive?h(p):(i=r.parser.defined.includes($n(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),c):n(p)}function c(p){return p===40?e.attempt(Yj,d,i?d:h)(p):p===91?e.attempt(Xj,d,i?u:h)(p):i?d(p):h(p)}function u(p){return e.attempt(Qj,d,h)(p)}function d(p){return t(p)}function h(p){return s._balanced=!0,n(p)}}function r5(e,t,n){return r;function r(h){return e.enter("resource"),e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),o}function o(h){return ct(h)?yr(e,s)(h):s(h)}function s(h){return h===41?d(h):up(e,i,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(h)}function i(h){return ct(h)?yr(e,c)(h):d(h)}function a(h){return n(h)}function c(h){return h===34||h===39||h===40?fp(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(h):d(h)}function u(h){return ct(h)?yr(e,d)(h):d(h)}function d(h){return h===41?(e.enter("resourceMarker"),e.consume(h),e.exit("resourceMarker"),e.exit("resource"),t):n(h)}}function o5(e,t,n){const r=this;return o;function o(a){return dp.call(r,e,s,i,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes($n(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function i(a){return n(a)}}function s5(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),o}function o(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const i5={name:"labelStartImage",resolveAll:ka.resolveAll,tokenize:a5};function a5(e,t,n){const r=this;return o;function o(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),s}function s(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),i):n(a)}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const l5={name:"labelStartLink",resolveAll:ka.resolveAll,tokenize:c5};function c5(e,t,n){const r=this;return o;function o(i){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(i),e.exit("labelMarker"),e.exit("labelLink"),s}function s(i){return i===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(i):t(i)}}const Is={name:"lineEnding",tokenize:u5};function u5(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Be(e,t,"linePrefix")}}const oo={name:"thematicBreak",tokenize:d5};function d5(e,t,n){let r=0,o;return s;function s(u){return e.enter("thematicBreak"),i(u)}function i(u){return o=u,a(u)}function a(u){return u===o?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||_e(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===o?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),De(u)?Be(e,a,"whitespace")(u):a(u))}}const it={continuation:{tokenize:m5},exit:x5,name:"list",tokenize:p5},f5={partial:!0,tokenize:y5},h5={partial:!0,tokenize:g5};function p5(e,t,n){const r=this,o=r.events[r.events.length-1];let s=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,i=0;return a;function a(f){const y=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:gi(f)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(oo,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 gi(f)&&++i<10?(e.consume(f),c):(!r.interrupt||i<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),u(f)):n(f)}function u(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(ss,r.interrupt?n:d,e.attempt(f5,p,h))}function d(f){return r.containerState.initialBlankLine=!0,s++,p(f)}function h(f){return De(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),p):n(f)}function p(f){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function m5(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ss,o,s);function o(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Be(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!De(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(h5,t,i)(a))}function i(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Be(e,e.attempt(it,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function g5(e,t,n){const r=this;return Be(e,o,"listItemIndent",r.containerState.size+1);function o(s){const i=r.events[r.events.length-1];return i&&i[1].type==="listItemIndent"&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(s):n(s)}}function x5(e){e.exit(this.containerState.type)}function y5(e,t,n){const r=this;return Be(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(s){const i=r.events[r.events.length-1];return!De(s)&&i&&i[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const uc={name:"setextUnderline",resolveTo:v5,tokenize:b5};function v5(e,t){let n=e.length,r,o,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const i={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",s?(e.splice(o,0,["enter",i,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=i,e.push(["exit",i,t]),e}function b5(e,t,n){const r=this;let o;return s;function s(u){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(e.enter("setextHeadingLine"),o=u,i(u)):n(u)}function i(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===o?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),De(u)?Be(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||_e(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const w5={tokenize:k5};function k5(e){const t=this,n=e.attempt(ss,r,e.attempt(this.parser.constructs.flowInitial,o,Be(e,e.attempt(this.parser.constructs.flow,o,e.attempt(Ej,o)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const _5={resolveAll:pp()},S5=hp("string"),C5=hp("text");function hp(e){return{resolveAll:pp(e==="text"?j5:void 0),tokenize:t};function t(n){const r=this,o=this.parser.constructs[e],s=n.attempt(o,i,a);return i;function i(d){return u(d)?s(d):a(d)}function a(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),s(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const h=o[d];let p=-1;if(h)for(;++p<h.length;){const f=h[p];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function pp(e){return t;function t(n,r){let o=-1,s;for(;++o<=n.length;)s===void 0?n[o]&&n[o][1].type==="data"&&(s=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==s+2&&(n[s][1].end=n[o-1][1].end,n.splice(s+2,o-s-2),o=s+2),s=void 0);return e?e(n,r):n}}function j5(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],o=t.sliceStream(r);let s=o.length,i=-1,a=0,c;for(;s--;){const u=o[s];if(typeof u=="string"){for(i=u.length;u.charCodeAt(i-1)===32;)a++,i--;if(i)break;i=-1}else if(u===-2)c=!0,a++;else if(u!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const u={type:n===e.length||c||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?i:r.start._bufferIndex+i,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const E5={42:it,43:it,45:it,48:it,49:it,50:it,51:it,52:it,53:it,54:it,55:it,56:it,57:it,62:ip},N5={91:zj},T5={[-2]:As,[-1]:As,32:As},A5={35:Lj,42:oo,45:[uc,oo],60:Uj,61:uc,95:oo,96:lc,126:lc},I5={38:lp,92:ap},z5={[-5]:Is,[-4]:Is,[-3]:Is,33:i5,38:lp,42:xi,60:[lj,Jj],91:l5,92:[Dj,ap],93:ka,95:xi,96:wj},P5={null:[xi,_5]},R5={null:[42,95]},O5={null:[]},D5=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:R5,contentInitial:N5,disable:O5,document:E5,flow:A5,flowInitial:T5,insideSpan:P5,string:I5,text:z5},Symbol.toStringTag,{value:"Module"}));function M5(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},s=[];let i=[],a=[];const c={attempt:N(j),check:N(C),consume:b,enter:w,exit:S,interrupt:N(C,{interrupt:!0})},u={code:null,containerState:{},defineSkip:m,events:[],now:y,parser:e,previous:null,sliceSerialize:p,sliceStream:f,write:h};let d=t.tokenize.call(u,c);return t.resolveAll&&s.push(t),u;function h(L){return i=vt(i,L),x(),i[i.length-1]!==null?[]:(T(t,0),u.events=wa(s,u.events,u),u.events)}function p(L,E){return F5(f(L),E)}function f(L){return L5(i,L)}function y(){const{_bufferIndex:L,_index:E,line:M,column:k,offset:D}=r;return{_bufferIndex:L,_index:E,line:M,column:k,offset:D}}function m(L){o[L.line]=L.column,O()}function x(){let L;for(;r._index<i.length;){const E=i[r._index];if(typeof E=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<E.length;)g(E.charCodeAt(r._bufferIndex));else g(E)}}function g(L){d=d(L)}function b(L){_e(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,O()):L!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===i[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=L}function w(L,E){const M=E||{};return M.type=L,M.start=y(),u.events.push(["enter",M,u]),a.push(M),M}function S(L){const E=a.pop();return E.end=y(),u.events.push(["exit",E,u]),E}function j(L,E){T(L,E.from)}function C(L,E){E.restore()}function N(L,E){return M;function M(k,D,G){let W,H,X,A;return Array.isArray(k)?Z(k):"tokenize"in k?Z([k]):V(k);function V(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 Z(xe)(ce)}}function Z(de){return W=de,H=0,de.length===0?G:I(de[H])}function I(de){return te;function te(ce){return A=z(),X=de,de.partial||(u.currentConstruct=de),de.name&&u.parser.constructs.disable.null.includes(de.name)?Y():de.tokenize.call(E?Object.assign(Object.create(u),E):u,c,oe,Y)(ce)}}function oe(de){return L(X,A),D}function Y(de){return A.restore(),++H<W.length?I(W[H]):G}}}function T(L,E){L.resolveAll&&!s.includes(L)&&s.push(L),L.resolve&&Ft(u.events,E,u.events.length-E,L.resolve(u.events.slice(E),u)),L.resolveTo&&(u.events=L.resolveTo(u.events,u))}function z(){const L=y(),E=u.previous,M=u.currentConstruct,k=u.events.length,D=Array.from(a);return{from:k,restore:G};function G(){r=L,u.previous=E,u.currentConstruct=M,u.events.length=k,a=D,O()}}function O(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function L5(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,s=t.end._bufferIndex;let i;if(n===o)i=[e[n].slice(r,s)];else{if(i=e.slice(n,o),r>-1){const a=i[0];typeof a=="string"?i[0]=a.slice(r):i.shift()}s>0&&i.push(e[o].slice(0,s))}return i}function F5(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const s=e[n];let i;if(typeof s=="string")i=s;else switch(s){case-5:{i="\r";break}case-4:{i=`
|
|
86
|
+
`;break}case-3:{i=`\r
|
|
87
|
+
`;break}case-2:{i=t?" ":" ";break}case-1:{if(!t&&o)continue;i=" ";break}default:i=String.fromCharCode(s)}o=s===-2,r.push(i)}return r.join("")}function $5(e){const r={constructs:qC([D5,...(e||{}).extensions||[]]),content:o(tj),defined:[],document:o(rj),flow:o(w5),lazy:{},string:o(S5),text:o(C5)};return r;function o(s){return i;function i(a){return M5(r,s,a)}}}function B5(e){for(;!cp(e););return e}const dc=/[\0\t\n\r]/g;function U5(){let e=1,t="",n=!0,r;return o;function o(s,i,a){const c=[];let u,d,h,p,f;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(i||void 0).decode(s)),h=0,t="",n&&(s.charCodeAt(0)===65279&&h++,n=void 0);h<s.length;){if(dc.lastIndex=h,u=dc.exec(s),p=u&&u.index!==void 0?u.index:s.length,f=s.charCodeAt(p),!u){t=s.slice(h);break}if(f===10&&h===p&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),h<p&&(c.push(s.slice(h,p)),e+=p-h),f){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}h=p+1}return a&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const Z5=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function V5(e){return e.replace(Z5,W5)}function W5(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),s=o===120||o===88;return sp(n.slice(s?2:1),s?16:10)}return ba(n)||e}const mp={}.hasOwnProperty;function H5(e,t,n){return typeof t!="string"&&(n=t,t=void 0),q5(n)(B5($5(n).document().write(U5()(e,t,!0))))}function q5(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(F),autolinkProtocol:z,autolinkEmail:z,atxHeading:s(ee),blockQuote:s(ge),characterEscape:z,characterReference:z,codeFenced:s(xe),codeFencedFenceInfo:i,codeFencedFenceMeta:i,codeIndented:s(xe,i),codeText:s(Ee,i),codeTextData:z,data:z,codeFlowValue:z,definition:s(Fe),definitionDestinationString:i,definitionLabelString:i,definitionTitleString:i,emphasis:s(_),hardBreakEscape:s(K),hardBreakTrailing:s(K),htmlFlow:s(R,i),htmlFlowData:z,htmlText:s(R,i),htmlTextData:z,image:s(P),label:i,link:s(F),listItem:s(J),listItemValue:p,listOrdered:s(B,h),listUnordered:s(B),paragraph:s($),reference:I,referenceString:i,resourceDestinationString:i,resourceTitleString:i,setextHeading:s(ee),strong:s(ne),thematicBreak:s(se)},exit:{atxHeading:c(),atxHeadingSequence:j,autolink:c(),autolinkEmail:fe,autolinkProtocol:ce,blockQuote:c(),characterEscapeValue:O,characterReferenceMarkerHexadecimal:Y,characterReferenceMarkerNumeric:Y,characterReferenceValue:de,characterReference:te,codeFenced:c(x),codeFencedFence:m,codeFencedFenceInfo:f,codeFencedFenceMeta:y,codeFlowValue:O,codeIndented:c(g),codeText:c(D),codeTextData:O,data:O,definition:c(),definitionDestinationString:S,definitionLabelString:b,definitionTitleString:w,emphasis:c(),hardBreakEscape:c(E),hardBreakTrailing:c(E),htmlFlow:c(M),htmlFlowData:O,htmlText:c(k),htmlTextData:O,image:c(W),label:X,labelText:H,lineEnding:L,link:c(G),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:oe,resourceDestinationString:A,resourceTitleString:V,resource:Z,setextHeading:c(T),setextHeadingLineSequence:N,setextHeadingText:C,strong:c(),thematicBreak:c()}};gp(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(U){let re={type:"root",children:[]};const ue={stack:[re],tokenStack:[],config:t,enter:a,exit:u,buffer:i,resume:d,data:n},be=[];let Pe=-1;for(;++Pe<U.length;)if(U[Pe][1].type==="listOrdered"||U[Pe][1].type==="listUnordered")if(U[Pe][0]==="enter")be.push(Pe);else{const qe=be.pop();Pe=o(U,qe,Pe)}for(Pe=-1;++Pe<U.length;){const qe=t[U[Pe][0]];mp.call(qe,U[Pe][1].type)&&qe[U[Pe][1].type].call(Object.assign({sliceSerialize:U[Pe][2].sliceSerialize},ue),U[Pe][1])}if(ue.tokenStack.length>0){const qe=ue.tokenStack[ue.tokenStack.length-1];(qe[1]||fc).call(ue,void 0,qe[0])}for(re.position={start:Yt(U.length>0?U[0][1].start:{line:1,column:1,offset:0}),end:Yt(U.length>0?U[U.length-2][1].end:{line:1,column:1,offset:0})},Pe=-1;++Pe<t.transforms.length;)re=t.transforms[Pe](re)||re;return re}function o(U,re,ue){let be=re-1,Pe=-1,qe=!1,ft,Oe,It,Ut;for(;++be<=ue;){const We=U[be];switch(We[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{We[0]==="enter"?Pe++:Pe--,Ut=void 0;break}case"lineEndingBlank":{We[0]==="enter"&&(ft&&!Ut&&!Pe&&!It&&(It=be),Ut=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Ut=void 0}if(!Pe&&We[0]==="enter"&&We[1].type==="listItemPrefix"||Pe===-1&&We[0]==="exit"&&(We[1].type==="listUnordered"||We[1].type==="listOrdered")){if(ft){let Zt=be;for(Oe=void 0;Zt--;){const Ct=U[Zt];if(Ct[1].type==="lineEnding"||Ct[1].type==="lineEndingBlank"){if(Ct[0]==="exit")continue;Oe&&(U[Oe][1].type="lineEndingBlank",qe=!0),Ct[1].type="lineEnding",Oe=Zt}else if(!(Ct[1].type==="linePrefix"||Ct[1].type==="blockQuotePrefix"||Ct[1].type==="blockQuotePrefixWhitespace"||Ct[1].type==="blockQuoteMarker"||Ct[1].type==="listItemIndent"))break}It&&(!Oe||It<Oe)&&(ft._spread=!0),ft.end=Object.assign({},Oe?U[Oe][1].start:We[1].end),U.splice(Oe||be,0,["exit",ft,We[2]]),be++,ue++}if(We[1].type==="listItemPrefix"){const Zt={type:"listItem",_spread:!1,start:Object.assign({},We[1].start),end:void 0};ft=Zt,U.splice(be,0,["enter",Zt,We[2]]),be++,ue++,It=void 0,Ut=!0}}}return U[re][1]._spread=qe,ue}function s(U,re){return ue;function ue(be){a.call(this,U(be),be),re&&re.call(this,be)}}function i(){this.stack.push({type:"fragment",children:[]})}function a(U,re,ue){this.stack[this.stack.length-1].children.push(U),this.stack.push(U),this.tokenStack.push([re,ue||void 0]),U.position={start:Yt(re.start),end:void 0}}function c(U){return re;function re(ue){U&&U.call(this,ue),u.call(this,ue)}}function u(U,re){const ue=this.stack.pop(),be=this.tokenStack.pop();if(be)be[0].type!==U.type&&(re?re.call(this,U,be[0]):(be[1]||fc).call(this,U,be[0]));else throw new Error("Cannot close `"+U.type+"` ("+xr({start:U.start,end:U.end})+"): it’s not open");ue.position.end=Yt(U.end)}function d(){return WC(this.stack.pop())}function h(){this.data.expectingFirstListItemValue=!0}function p(U){if(this.data.expectingFirstListItemValue){const re=this.stack[this.stack.length-2];re.start=Number.parseInt(this.sliceSerialize(U),10),this.data.expectingFirstListItemValue=void 0}}function f(){const U=this.resume(),re=this.stack[this.stack.length-1];re.lang=U}function y(){const U=this.resume(),re=this.stack[this.stack.length-1];re.meta=U}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function x(){const U=this.resume(),re=this.stack[this.stack.length-1];re.value=U.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const U=this.resume(),re=this.stack[this.stack.length-1];re.value=U.replace(/(\r?\n|\r)$/g,"")}function b(U){const re=this.resume(),ue=this.stack[this.stack.length-1];ue.label=re,ue.identifier=$n(this.sliceSerialize(U)).toLowerCase()}function w(){const U=this.resume(),re=this.stack[this.stack.length-1];re.title=U}function S(){const U=this.resume(),re=this.stack[this.stack.length-1];re.url=U}function j(U){const re=this.stack[this.stack.length-1];if(!re.depth){const ue=this.sliceSerialize(U).length;re.depth=ue}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function N(U){const re=this.stack[this.stack.length-1];re.depth=this.sliceSerialize(U).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function z(U){const ue=this.stack[this.stack.length-1].children;let be=ue[ue.length-1];(!be||be.type!=="text")&&(be=le(),be.position={start:Yt(U.start),end:void 0},ue.push(be)),this.stack.push(be)}function O(U){const re=this.stack.pop();re.value+=this.sliceSerialize(U),re.position.end=Yt(U.end)}function L(U){const re=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ue=re.children[re.children.length-1];ue.position.end=Yt(U.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(re.type)&&(z.call(this,U),O.call(this,U))}function E(){this.data.atHardBreak=!0}function M(){const U=this.resume(),re=this.stack[this.stack.length-1];re.value=U}function k(){const U=this.resume(),re=this.stack[this.stack.length-1];re.value=U}function D(){const U=this.resume(),re=this.stack[this.stack.length-1];re.value=U}function G(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const re=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=re,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function W(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const re=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=re,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function H(U){const re=this.sliceSerialize(U),ue=this.stack[this.stack.length-2];ue.label=V5(re),ue.identifier=$n(re).toLowerCase()}function X(){const U=this.stack[this.stack.length-1],re=this.resume(),ue=this.stack[this.stack.length-1];if(this.data.inReference=!0,ue.type==="link"){const be=U.children;ue.children=be}else ue.alt=re}function A(){const U=this.resume(),re=this.stack[this.stack.length-1];re.url=U}function V(){const U=this.resume(),re=this.stack[this.stack.length-1];re.title=U}function Z(){this.data.inReference=void 0}function I(){this.data.referenceType="collapsed"}function oe(U){const re=this.resume(),ue=this.stack[this.stack.length-1];ue.label=re,ue.identifier=$n(this.sliceSerialize(U)).toLowerCase(),this.data.referenceType="full"}function Y(U){this.data.characterReferenceType=U.type}function de(U){const re=this.sliceSerialize(U),ue=this.data.characterReferenceType;let be;ue?(be=sp(re,ue==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):be=ba(re);const Pe=this.stack[this.stack.length-1];Pe.value+=be}function te(U){const re=this.stack.pop();re.position.end=Yt(U.end)}function ce(U){O.call(this,U);const re=this.stack[this.stack.length-1];re.url=this.sliceSerialize(U)}function fe(U){O.call(this,U);const re=this.stack[this.stack.length-1];re.url="mailto:"+this.sliceSerialize(U)}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 K(){return{type:"break"}}function R(){return{type:"html",value:""}}function P(){return{type:"image",title:null,url:"",alt:null}}function F(){return{type:"link",title:null,url:"",children:[]}}function B(U){return{type:"list",ordered:U.type==="listOrdered",start:null,spread:U._spread,children:[]}}function J(U){return{type:"listItem",spread:U._spread,checked:null,children:[]}}function $(){return{type:"paragraph",children:[]}}function ne(){return{type:"strong",children:[]}}function le(){return{type:"text",value:""}}function se(){return{type:"thematicBreak"}}}function Yt(e){return{line:e.line,column:e.column,offset:e.offset}}function gp(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?gp(e,r):K5(e,r)}}function K5(e,t){let n;for(n in t)if(mp.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 fc(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+xr({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+xr({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+xr({start:t.start,end:t.end})+") is still open")}function J5(e){const t=this;t.parser=n;function n(r){return H5(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function G5(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 Y5(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
88
|
+
`}]}function X5(e,t){const n=t.value?t.value+`
|
|
89
|
+
`:"",r={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function Q5(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function eE(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function tE(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),o=or(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let i,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),i=e.footnoteOrder.length):i=s+1,a+=1,e.footnoteCounts.set(r,a);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function nE(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 rE(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function xp(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const o=e.all(t),s=o[0];s&&s.type==="text"?s.value="["+s.value:o.unshift({type:"text",value:"["});const i=o[o.length-1];return i&&i.type==="text"?i.value+=r:o.push({type:"text",value:r}),o}function oE(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return xp(e,t);const o={src:or(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(o.title=r.title);const s={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,s),e.applyData(t,s)}function sE(e,t){const n={src:or(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function iE(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function aE(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return xp(e,t);const o={href:or(r.url||"")};r.title!==null&&r.title!==void 0&&(o.title=r.title);const s={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function lE(e,t){const n={href:or(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function cE(e,t,n){const r=e.all(t),o=n?uE(n):yp(t),s={},i=[];if(typeof t.checked=="boolean"){const d=r[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const d=r[a];(o||a!==0||d.type!=="element"||d.tagName!=="p")&&i.push({type:"text",value:`
|
|
90
|
+
`}),d.type==="element"&&d.tagName==="p"&&!o?i.push(...d.children):i.push(d)}const c=r[r.length-1];c&&(o||c.type!=="element"||c.tagName!=="p")&&i.push({type:"text",value:`
|
|
91
|
+
`});const u={type:"element",tagName:"li",properties:s,children:i};return e.patch(t,u),e.applyData(t,u)}function uE(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=yp(n[r])}return t}function yp(e){const t=e.spread;return t??e.children.length>1}function dE(e,t){const n={},r=e.all(t);let o=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++o<r.length;){const i=r[o];if(i.type==="element"&&i.tagName==="li"&&i.properties&&Array.isArray(i.properties.className)&&i.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function fE(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function hE(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function pE(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function mE(e,t){const n=e.all(t),r=n.shift(),o=[];if(r){const i={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],i),o.push(i)}if(n.length>0){const i={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=ga(t.children[1]),c=Xh(t.children[t.children.length-1]);a&&c&&(i.position={start:a,end:c}),o.push(i)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,s),e.applyData(t,s)}function gE(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",i=n&&n.type==="table"?n.align:void 0,a=i?i.length:t.children.length;let c=-1;const u=[];for(;++c<a;){const h=t.children[c],p={},f=i?i[c]:void 0;f&&(p.align=f);let y={type:"element",tagName:s,properties:p,children:[]};h&&(y.children=e.all(h),e.patch(h,y),y=e.applyData(h,y)),u.push(y)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function xE(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const hc=9,pc=32;function yE(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),o=0;const s=[];for(;r;)s.push(mc(t.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=n.exec(t);return s.push(mc(t.slice(o),o>0,!1)),s.join("")}function mc(e,t,n){let r=0,o=e.length;if(t){let s=e.codePointAt(r);for(;s===hc||s===pc;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(o-1);for(;s===hc||s===pc;)o--,s=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function vE(e,t){const n={type:"text",value:yE(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function bE(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const wE={blockquote:G5,break:Y5,code:X5,delete:Q5,emphasis:eE,footnoteReference:tE,heading:nE,html:rE,imageReference:oE,image:sE,inlineCode:iE,linkReference:aE,link:lE,listItem:cE,list:dE,paragraph:fE,root:hE,strong:pE,table:mE,tableCell:xE,tableRow:gE,text:vE,thematicBreak:bE,toml:Jr,yaml:Jr,definition:Jr,footnoteDefinition:Jr};function Jr(){}const vp=-1,is=0,vr=1,_o=2,_a=3,Sa=4,Ca=5,ja=6,bp=7,wp=8,gc=typeof self=="object"?self:globalThis,kE=(e,t)=>{const n=(o,s)=>(e.set(s,o),o),r=o=>{if(e.has(o))return e.get(o);const[s,i]=t[o];switch(s){case is:case vp:return n(i,o);case vr:{const a=n([],o);for(const c of i)a.push(r(c));return a}case _o:{const a=n({},o);for(const[c,u]of i)a[r(c)]=r(u);return a}case _a:return n(new Date(i),o);case Sa:{const{source:a,flags:c}=i;return n(new RegExp(a,c),o)}case Ca:{const a=n(new Map,o);for(const[c,u]of i)a.set(r(c),r(u));return a}case ja:{const a=n(new Set,o);for(const c of i)a.add(r(c));return a}case bp:{const{name:a,message:c}=i;return n(new gc[a](c),o)}case wp:return n(BigInt(i),o);case"BigInt":return n(Object(BigInt(i)),o);case"ArrayBuffer":return n(new Uint8Array(i).buffer,i);case"DataView":{const{buffer:a}=new Uint8Array(i);return n(new DataView(a),i)}}return n(new gc[s](i),o)};return r},xc=e=>kE(new Map,e)(0),An="",{toString:_E}={},{keys:SE}=Object,fr=e=>{const t=typeof e;if(t!=="object"||!e)return[is,t];const n=_E.call(e).slice(8,-1);switch(n){case"Array":return[vr,An];case"Object":return[_o,An];case"Date":return[_a,An];case"RegExp":return[Sa,An];case"Map":return[Ca,An];case"Set":return[ja,An];case"DataView":return[vr,n]}return n.includes("Array")?[vr,n]:n.includes("Error")?[bp,n]:[_o,n]},Gr=([e,t])=>e===is&&(t==="function"||t==="symbol"),CE=(e,t,n,r)=>{const o=(i,a)=>{const c=r.push(i)-1;return n.set(a,c),c},s=i=>{if(n.has(i))return n.get(i);let[a,c]=fr(i);switch(a){case is:{let d=i;switch(c){case"bigint":a=wp,d=i.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return o([vp],i)}return o([a,d],i)}case vr:{if(c){let p=i;return c==="DataView"?p=new Uint8Array(i.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(i)),o([c,[...p]],i)}const d=[],h=o([a,d],i);for(const p of i)d.push(s(p));return h}case _o:{if(c)switch(c){case"BigInt":return o([c,i.toString()],i);case"Boolean":case"Number":case"String":return o([c,i.valueOf()],i)}if(t&&"toJSON"in i)return s(i.toJSON());const d=[],h=o([a,d],i);for(const p of SE(i))(e||!Gr(fr(i[p])))&&d.push([s(p),s(i[p])]);return h}case _a:return o([a,i.toISOString()],i);case Sa:{const{source:d,flags:h}=i;return o([a,{source:d,flags:h}],i)}case Ca:{const d=[],h=o([a,d],i);for(const[p,f]of i)(e||!(Gr(fr(p))||Gr(fr(f))))&&d.push([s(p),s(f)]);return h}case ja:{const d=[],h=o([a,d],i);for(const p of i)(e||!Gr(fr(p)))&&d.push(s(p));return h}}const{message:u}=i;return o([a,{name:c,message:u}],i)};return s},yc=(e,{json:t,lossy:n}={})=>{const r=[];return CE(!(t||n),!!t,new Map,r)(e),r},So=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?xc(yc(e,t)):structuredClone(e):(e,t)=>xc(yc(e,t));function jE(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function EE(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function NE(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||jE,r=e.options.footnoteBackLabel||EE,o=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",i=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const d=e.all(u),h=String(u.identifier).toUpperCase(),p=or(h.toLowerCase());let f=0;const y=[],m=e.footnoteCounts.get(h);for(;m!==void 0&&++f<=m;){y.length>0&&y.push({type:"text",value:" "});let b=typeof n=="string"?n:n(c,f);typeof b=="string"&&(b={type:"text",value:b}),y.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(f>1?"-"+f:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,f),className:["data-footnote-backref"]},children:Array.isArray(b)?b:[b]})}const x=d[d.length-1];if(x&&x.type==="element"&&x.tagName==="p"){const b=x.children[x.children.length-1];b&&b.type==="text"?b.value+=" ":x.children.push({type:"text",value:" "}),x.children.push(...y)}else d.push(...y);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:s,properties:{...So(i),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 kp=(function(e){if(e==null)return zE;if(typeof e=="function")return as(e);if(typeof e=="object")return Array.isArray(e)?TE(e):AE(e);if(typeof e=="string")return IE(e);throw new Error("Expected function, string, or object as test")});function TE(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=kp(e[n]);return as(r);function r(...o){let s=-1;for(;++s<t.length;)if(t[s].apply(this,o))return!0;return!1}}function AE(e){const t=e;return as(n);function n(r){const o=r;let s;for(s in e)if(o[s]!==t[s])return!1;return!0}}function IE(e){return as(t);function t(n){return n&&n.type===e}}function as(e){return t;function t(n,r,o){return!!(PE(n)&&e.call(this,n,typeof r=="number"?r:void 0,o||void 0))}}function zE(){return!0}function PE(e){return e!==null&&typeof e=="object"&&"type"in e}const _p=[],RE=!0,vc=!1,OE="skip";function DE(e,t,n,r){let o;typeof t=="function"&&typeof n!="function"?(r=n,n=t):o=t;const s=kp(o),i=r?-1:1;a(e,void 0,[])();function a(c,u,d){const h=c&&typeof c=="object"?c:{};if(typeof h.type=="string"){const f=typeof h.tagName=="string"?h.tagName:typeof h.name=="string"?h.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(f?"<"+f+">":""))+")"})}return p;function p(){let f=_p,y,m,x;if((!t||s(c,u,d[d.length-1]||void 0))&&(f=ME(n(c,d)),f[0]===vc))return f;if("children"in c&&c.children){const g=c;if(g.children&&f[0]!==OE)for(m=(r?g.children.length:-1)+i,x=d.concat(g);m>-1&&m<g.children.length;){const b=g.children[m];if(y=a(b,m,x)(),y[0]===vc)return y;m=typeof y[1]=="number"?y[1]:m+i}}return f}}}function ME(e){return Array.isArray(e)?e:typeof e=="number"?[RE,e]:e==null?_p:[e]}function Sp(e,t,n,r){let o,s,i;typeof t=="function"&&typeof n!="function"?(s=void 0,i=t,o=n):(s=t,i=n,o=r),DE(e,s,a,o);function a(c,u){const d=u[u.length-1],h=d?d.children.indexOf(c):void 0;return i(c,h,d)}}const yi={}.hasOwnProperty,LE={};function FE(e,t){const n=t||LE,r=new Map,o=new Map,s=new Map,i={...wE,...n.handlers},a={all:u,applyData:BE,definitionById:r,footnoteById:o,footnoteCounts:s,footnoteOrder:[],handlers:i,one:c,options:n,patch:$E,wrap:ZE};return Sp(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(yi.call(a.handlers,p)&&f)return f(a,d,h);if(a.options.passThrough&&a.options.passThrough.includes(p)){if("children"in d){const{children:m,...x}=d,g=So(x);return g.children=a.all(d),g}return So(d)}return(a.options.unknownHandler||UE)(a,d,h)}function u(d){const h=[];if("children"in d){const p=d.children;let f=-1;for(;++f<p.length;){const y=a.one(p[f],d);if(y){if(f&&p[f-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=bc(y.value)),!Array.isArray(y)&&y.type==="element")){const m=y.children[0];m&&m.type==="text"&&(m.value=bc(m.value))}Array.isArray(y)?h.push(...y):h.push(y)}}}return h}}function $E(e,t){e.position&&(t.position=_C(e))}function BE(e,t){let n=t;if(e&&e.data){const r=e.data.hName,o=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const i="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:i}}n.type==="element"&&s&&Object.assign(n.properties,So(s)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function UE(e,t){const n=t.data||{},r="value"in t&&!(yi.call(n,"hProperties")||yi.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 ZE(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 bc(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function wc(e,t){const n=FE(e,t),r=n.one(e,void 0),o=NE(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&s.children.push({type:"text",value:`
|
|
97
|
+
`},o),s}function VE(e,t){return e&&"run"in e?async function(n,r){const o=wc(n,{file:r,...t});await e.run(o,r)}:function(n,r){return wc(n,{file:r,...e||t})}}function kc(e){if(e)throw e}var zs,_c;function WE(){if(_c)return zs;_c=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(u){return typeof Array.isArray=="function"?Array.isArray(u):t.call(u)==="[object Array]"},s=function(u){if(!u||t.call(u)!=="[object Object]")return!1;var d=e.call(u,"constructor"),h=u.constructor&&u.constructor.prototype&&e.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!d&&!h)return!1;var p;for(p in u);return typeof p>"u"||e.call(u,p)},i=function(u,d){n&&d.name==="__proto__"?n(u,d.name,{enumerable:!0,configurable:!0,value:d.newValue,writable:!0}):u[d.name]=d.newValue},a=function(u,d){if(d==="__proto__")if(e.call(u,d)){if(r)return r(u,d).value}else return;return u[d]};return zs=function c(){var u,d,h,p,f,y,m=arguments[0],x=1,g=arguments.length,b=!1;for(typeof m=="boolean"&&(b=m,m=arguments[1]||{},x=2),(m==null||typeof m!="object"&&typeof m!="function")&&(m={});x<g;++x)if(u=arguments[x],u!=null)for(d in u)h=a(m,d),p=a(u,d),m!==p&&(b&&p&&(s(p)||(f=o(p)))?(f?(f=!1,y=h&&o(h)?h:[]):y=h&&s(h)?h:{},i(m,{name:d,newValue:c(b,y,p)})):typeof p<"u"&&i(m,{name:d,newValue:p}));return m},zs}var HE=WE();const Ps=Ei(HE);function vi(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 qE(){const e=[],t={run:n,use:r};return t;function n(...o){let s=-1;const i=o.pop();if(typeof i!="function")throw new TypeError("Expected function as last argument, not "+i);a(null,...o);function a(c,...u){const d=e[++s];let h=-1;if(c){i(c);return}for(;++h<o.length;)(u[h]===null||u[h]===void 0)&&(u[h]=o[h]);o=u,d?KE(d,a)(...u):i(null,...u)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function KE(e,t){let n;return r;function r(...i){const a=e.length>i.length;let c;a&&i.push(o);try{c=e.apply(this,i)}catch(u){const d=u;if(a&&n)throw d;return o(d)}a||(c&&c.then&&typeof c.then=="function"?c.then(s,o):c instanceof Error?o(c):s(c))}function o(i,...a){n||(n=!0,t(i,...a))}function s(i){o(null,i)}}const zt={basename:JE,dirname:GE,extname:YE,join:XE,sep:"/"};function JE(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Rr(e);let n=0,r=-1,o=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(s){n=o+1;break}}else r<0&&(s=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let i=-1,a=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(s){n=o+1;break}}else i<0&&(s=!0,i=o+1),a>-1&&(e.codePointAt(o)===t.codePointAt(a--)?a<0&&(r=o):(a=-1,r=i));return n===r?r=i:r<0&&(r=e.length),e.slice(n,r)}function GE(e){if(Rr(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 YE(e){Rr(e);let t=e.length,n=-1,r=0,o=-1,s=0,i;for(;t--;){const a=e.codePointAt(t);if(a===47){if(i){r=t+1;break}continue}n<0&&(i=!0,n=t+1),a===46?o<0?o=t:s!==1&&(s=1):o>-1&&(s=-1)}return o<0||n<0||s===0||s===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function XE(...e){let t=-1,n;for(;++t<e.length;)Rr(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":QE(n)}function QE(e){Rr(e);const t=e.codePointAt(0)===47;let n=e3(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function e3(e,t){let n="",r=0,o=-1,s=0,i=-1,a,c;for(;++i<=e.length;){if(i<e.length)a=e.codePointAt(i);else{if(a===47)break;a=47}if(a===47){if(!(o===i-1||s===1))if(o!==i-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),o=i,s=0;continue}}else if(n.length>0){n="",r=0,o=i,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,i):n=e.slice(o+1,i),r=i-o-1;o=i,s=0}else a===46&&s>-1?s++:s=-1}return n}function Rr(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const t3={cwd:n3};function n3(){return"/"}function bi(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function r3(e){if(typeof e=="string")e=new URL(e);else if(!bi(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 o3(e)}function o3(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 Rs=["history","path","basename","stem","extname","dirname"];class Cp{constructor(t){let n;t?bi(t)?n={path:t}:typeof t=="string"||s3(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":t3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Rs.length;){const s=Rs[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let o;for(o in n)Rs.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?zt.basename(this.path):void 0}set basename(t){Ds(t,"basename"),Os(t,"basename"),this.path=zt.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?zt.dirname(this.path):void 0}set dirname(t){Sc(this.basename,"dirname"),this.path=zt.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?zt.extname(this.path):void 0}set extname(t){if(Os(t,"extname"),Sc(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=zt.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){bi(t)&&(t=r3(t)),Ds(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?zt.basename(this.path,this.extname):void 0}set stem(t){Ds(t,"stem"),Os(t,"stem"),this.path=zt.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){const o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){const o=new rt(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Os(e,t){if(e&&e.includes(zt.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+zt.sep+"`")}function Ds(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Sc(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function s3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const i3=(function(e){const r=this.constructor.prototype,o=r[e],s=function(){return o.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),a3={}.hasOwnProperty;class Ea extends i3{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=qE()}copy(){const t=new Ea;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Ps(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Fs("data",this.frozen),this.namespace[t]=n,this):a3.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Fs("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=Yr(t),r=this.parser||this.Parser;return Ms("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Ms("process",this.parser||this.Parser),Ls("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(s,i){const a=Yr(t),c=r.parse(a);r.run(c,a,function(d,h,p){if(d||!h||!p)return u(d);const f=h,y=r.stringify(f,p);u3(y)?p.value=y:p.result=y,u(d,p)});function u(d,h){d||!h?i(d):s?s(h):n(void 0,h)}}}processSync(t){let n=!1,r;return this.freeze(),Ms("processSync",this.parser||this.Parser),Ls("processSync",this.compiler||this.Compiler),this.process(t,o),jc("processSync","process",n),r;function o(s,i){n=!0,kc(s),r=i}}run(t,n,r){Cc(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(i,a){const c=Yr(n);o.run(t,c,u);function u(d,h,p){const f=h||t;d?a(d):i?i(f):r(void 0,f,p)}}}runSync(t,n){let r=!1,o;return this.run(t,n,s),jc("runSync","run",r),o;function s(i,a){kc(i),o=a,r=!0}}stringify(t,n){this.freeze();const r=Yr(n),o=this.compiler||this.Compiler;return Ls("stringify",o),Cc(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(Fs("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):i(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...h]=u;c(d,h)}else i(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function i(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(u.plugins),u.settings&&(o.settings=Ps(!0,o.settings,u.settings))}function a(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const h=u[d];s(h)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let h=-1,p=-1;for(;++h<r.length;)if(r[h][0]===u){p=h;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[f,...y]=d;const m=r[p][1];vi(m)&&vi(f)&&(f=Ps(!0,m,f)),r[p]=[u,f,...y]}}}}const l3=new Ea().freeze();function Ms(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Ls(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Fs(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 Cc(e){if(!vi(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function jc(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Yr(e){return c3(e)?e:new Cp(e)}function c3(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function u3(e){return typeof e=="string"||d3(e)}function d3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const f3="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Ec=[],Nc={allowDangerousHtml:!0},h3=/^(https?|ircs?|mailto|xmpp)$/i,p3=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Jn(e){const t=m3(e),n=g3(e);return x3(t.runSync(t.parse(n),n),e)}function m3(e){const t=e.rehypePlugins||Ec,n=e.remarkPlugins||Ec,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Nc}:Nc;return l3().use(J5).use(n).use(VE,r).use(t)}function g3(e){const t=e.children||"",n=new Cp;return typeof t=="string"&&(n.value=t),n}function x3(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,s=t.disallowedElements,i=t.skipHtml,a=t.unwrapDisallowed,c=t.urlTransform||y3;for(const d of p3)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+f3+d.id,void 0);return Sp(e,u),NC(e,{Fragment:l.Fragment,components:o,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function u(d,h,p){if(d.type==="raw"&&p&&typeof h=="number")return i?p.children.splice(h,1):p.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let f;for(f in Ts)if(Object.hasOwn(Ts,f)&&Object.hasOwn(d.properties,f)){const y=d.properties[f],m=Ts[f];(m===null||m.includes(d.tagName))&&(d.properties[f]=c(String(y||""),f,d))}}if(d.type==="element"){let f=n?!n.includes(d.tagName):s?s.includes(d.tagName):!1;if(!f&&r&&typeof h=="number"&&(f=!r(d,h,p)),f&&p&&typeof h=="number")return a&&d.children?p.children.splice(h,1,...d.children):p.children.splice(h,1),h}}}function y3(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||h3.test(e.slice(0,t))?e:""}function jp(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 Co(e){return e!==null&&(Array.isArray(e)||typeof e=="object")}function v3(e,t){const n=Object.getOwnPropertyDescriptor(e,t);if(n!==void 0)return n.value}function Na(e){return Array.isArray(e)?e.map((t,n)=>[String(n),t]):typeof e=="object"&&e!==null?Object.keys(e).map(t=>{const n=v3(e,t);return[t,Gn(n)]}):[]}function Tc(e){return Array.isArray(e)?e.length:typeof e=="object"&&e!==null?Object.keys(e).length:0}const Ac=120;function b3({text:e}){const[t,n]=v.useState(!1);return e.length>Ac?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(Jn,{children:e})}):l.jsxs(Ae,{delayDuration:300,children:[l.jsxs(Ie,{onClick:o=>{o.stopPropagation(),n(!0)},className:"text-left cursor-pointer",children:[l.jsx("span",{children:e.slice(0,Ac)}),l.jsx("span",{className:"text-emerald-400/50",children:"…"})]}),l.jsxs(ze,{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(Jn,{children:e})}),'"']})}function Ep({value:e}){if(e===null)return l.jsx("span",{className:"text-rose-400 italic",children:"null"});switch(typeof e){case"string":return l.jsx(b3,{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 Ic({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(sn,{className:"size-3 text-green-500"}):l.jsx(wn,{className:"size-3"})})}function w3({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(sn,{className:"size-3 text-green-500"}):l.jsx(wn,{className:"size-3 text-muted-foreground"})})}function k3(e){return Co(e)?Na(e).some(([,t])=>Co(t)):!1}function _3({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(Hy,{className:"size-3.5 text-muted-foreground"}):l.jsx(Vy,{className:"size-3.5 text-muted-foreground"})})}function Np({name:e,value:t,level:n,defaultExpandDepth:r,isArrayItem:o}){const[s,i]=v.useState(n<r),[a,c]=v.useState(0),[u,d]=v.useState(null),[h,p]=v.useState(!1),f=Co(t),y=jp(t),m=y==="array"?"[":"{",x=y==="array"?"]":"}";function g(w){w.stopPropagation(),h?(i(!1),d(0),c(S=>S+1),p(!1)):(i(!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?()=>{s&&p(!1),i(!s)}:void 0,onKeyDown:f?w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),i(!s))}: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:s?l.jsx(yt,{className:"size-3 text-muted-foreground"}):l.jsx(bt,{className:"size-3 text-muted-foreground"})}):l.jsx("span",{className:"w-4 shrink-0"}),l.jsx("span",{className:he("shrink-0",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:[" ",Tc(t)," ",Tc(t)===1?"item":"items"," ",x]})]}):l.jsx("span",{className:"min-w-0",children:l.jsx(Ep,{value:t})}),f&&k3(t)&&l.jsx(_3,{allExpanded:h,onClick:g}),l.jsx(w3,{value:t})]}),f&&s&&l.jsxs("div",{className:"pl-4",children:[Na(t).map(([w,S])=>l.jsx(Np,{name:w,value:S,level:n+1,defaultExpandDepth:b,isArrayItem:y==="array"},w)),l.jsx("div",{className:"text-muted-foreground py-0.5 px-1",children:x})]},a)]})}function ls({data:e,defaultExpandDepth:t=2,className:n,showCopy:r=!1}){if(!Co(e))return l.jsx(Le,{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(Ep,{value:e}),r&&l.jsx(Ic,{value:e})]})})});const i=jp(e)==="array";return l.jsx(Le,{children:l.jsxs("div",{className:he("font-mono text-xs leading-relaxed",n),children:[r&&l.jsx(Ic,{value:e}),Na(e).map(([a,c])=>l.jsx(Np,{name:a,value:c,level:0,defaultExpandDepth:t,isArrayItem:i},a))]})})}function fn({text:e,defaultExpandDepth:t=2,className:n}){try{const r=JSON.parse(e);return l.jsx(ls,{data:Gn(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 Gn(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=>Gn(n));const t={};for(const n of Object.keys(e)){const r=Object.getOwnPropertyDescriptor(e,n);t[n]=Gn(r?.value)}return t}case"bigint":case"symbol":case"function":case"undefined":return String(e)}return null}function Rn({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 S3=ha("rounded-lg p-[3px] group-data-[orientation=horizontal]/tabs:h-9 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function On({className:e,variant:t="default",...n}){return l.jsx(v_,{"data-slot":"tabs-list","data-variant":t,className:he(S3({variant:t}),e),...n})}function et({className:e,...t}){return l.jsx(b_,{"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(w_,{"data-slot":"tabs-content",className:he("flex-1 outline-none",e),...t})}class Tp{diff(t,n,r={}){let o;typeof r=="function"?(o=r,r={}):"callback"in r&&(o=r.callback);const s=this.castInput(t,r),i=this.castInput(n,r),a=this.removeEmpty(this.tokenize(s,r)),c=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(a,c,r,o)}diffWithOptionsObj(t,n,r,o){var s;const i=b=>{if(b=this.postProcess(b,r),o){setTimeout(function(){o(b)},0);return}else return b},a=n.length,c=t.length;let u=1,d=a+c;r.maxEditLength!=null&&(d=Math.min(d,r.maxEditLength));const h=(s=r.timeout)!==null&&s!==void 0?s:1/0,p=Date.now()+h,f=[{oldPos:-1,lastComponent:void 0}];let y=this.extractCommon(f[0],n,t,0,r);if(f[0].oldPos+1>=c&&y+1>=a)return i(this.buildValues(f[0].lastComponent,n,t));let m=-1/0,x=1/0;const g=()=>{for(let b=Math.max(m,-u);b<=Math.min(x,u);b+=2){let w;const S=f[b-1],j=f[b+1];S&&(f[b-1]=void 0);let C=!1;if(j){const T=j.oldPos-b;C=j&&0<=T&&T<a}const N=S&&S.oldPos+1<c;if(!C&&!N){f[b]=void 0;continue}if(!N||C&&S.oldPos<j.oldPos?w=this.addToPath(j,!0,!1,0,r):w=this.addToPath(S,!1,!0,1,r),y=this.extractCommon(w,n,t,b,r),w.oldPos+1>=c&&y+1>=a)return i(this.buildValues(w.lastComponent,n,t))||!0;f[b]=w,w.oldPos+1>=c&&(x=Math.min(x,b-1)),y+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,s){const i=t.lastComponent;return i&&!s.oneChangePerToken&&i.added===n&&i.removed===r?{oldPos:t.oldPos+o,lastComponent:{count:i.count+1,added:n,removed:r,previousComponent:i.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:n,removed:r,previousComponent:i}}}extractCommon(t,n,r,o,s){const i=n.length,a=r.length;let c=t.oldPos,u=c-o,d=0;for(;u+1<i&&c+1<a&&this.equals(r[c+1],n[u+1],s);)u++,c++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=c,u}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const o=[];let s;for(;t;)o.push(t),s=t.previousComponent,delete t.previousComponent,t=s;o.reverse();const i=o.length;let a=0,c=0,u=0;for(;a<i;a++){const d=o[a];if(d.removed)d.value=this.join(r.slice(u,u+d.count)),u+=d.count;else{if(!d.added&&this.useLongestToken){let h=n.slice(c,c+d.count);h=h.map(function(p,f){const y=r[u+f];return y.length>p.length?y: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 C3 extends Tp{constructor(){super(...arguments),this.tokenize=Ip}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 j3=new C3;function Ap(e,t,n){return j3.diff(e,t,n)}function Ip(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
102
|
+
`));const n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let o=0;o<r.length;o++){const s=r[o];o%2&&!t.newlineIsToken?n[n.length-1]+=s:n.push(s)}return n}class E3 extends Tp{constructor(){super(...arguments),this.tokenize=Ip}get useLongestToken(){return!0}castInput(t,n){const{undefinedReplacement:r,stringifyReplacer:o=(s,i)=>typeof i>"u"?r:i}=n;return typeof t=="string"?t:JSON.stringify(wi(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 N3=new E3;function T3(e,t,n){return N3.diff(e,t,n)}function wi(e,t,n,r,o){t=t||[],n=n||[],r&&(e=r(o===void 0?"":o,e));let s;for(s=0;s<t.length;s+=1)if(t[s]===e)return n[s];let i;if(Object.prototype.toString.call(e)==="[object Array]"){for(t.push(e),i=new Array(e.length),n.push(i),s=0;s<e.length;s+=1)i[s]=wi(e[s],t,n,r,String(s));return t.pop(),n.pop(),i}if(e&&e.toJSON&&(e=e.toJSON()),typeof e=="object"&&e!==null){t.push(e),i={},n.push(i);const a=[];let c;for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&a.push(c);for(a.sort(),s=0;s<a.length;s+=1)c=a[s],i[c]=wi(e[c],t,n,r,c);t.pop(),n.pop()}else i=e;return i}function zc(e){return e===void 0?[]:Object.entries(e).map(t=>[t[0].toLowerCase(),t[1]]).sort(([t],[n])=>t.localeCompare(n))}function Pc([e,t]){return`${e}: ${t}`}function ki(e){const t=[];let n=0,r=0;for(const o of e){const s=o.value.split(`
|
|
103
|
+
`);s.length>0&&s[s.length-1]===""&&s.pop();for(const i of s)o.added?(r+=1,t.push({kind:"added",text:i,oldLineNumber:null,newLineNumber:r})):o.removed?(n+=1,t.push({kind:"removed",text:i,oldLineNumber:n,newLineNumber:null})):(n+=1,r+=1,t.push({kind:"context",text:i,oldLineNumber:n,newLineNumber:r}))}return t}function A3(e,t){const n=zc(e).map(Pc).join(`
|
|
104
|
+
`),r=zc(t).map(Pc).join(`
|
|
105
|
+
`);if(n===r)return{lines:[],isEmpty:!0};const o=Ap(n,r);return{lines:ki(o),isEmpty:!1}}function Rc(e){try{const t=JSON.parse(e);return t===null||typeof t=="string"||typeof t=="object"?t:null}catch{return null}}function I3(e,t){const n=e??"",r=t??"";if(n===r)return{lines:[],isEmpty:!0};const o=Rc(n),s=Rc(r);if(o!==null&&s!==null){const a=T3(o,s)??[];if(a.length===1){const c=a[0];if(c!==void 0&&!c.added&&!c.removed)return{lines:[],isEmpty:!0}}return{lines:ki(a),isEmpty:!1}}const i=Ap(n,r);return{lines:ki(i),isEmpty:!1}}const z3=22,$s=1e4;function P3(e){return e==="added"?"+":e==="removed"?"-":" "}function R3(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 zp({result:e,emptyLabel:t}){const[n,r]=v.useState("unified"),o=v.useRef(null),s=Gu({count:e.lines.length,getScrollElement:()=>o.current,estimateSize:()=>z3,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 i=e.lines.length,a=i>$s,c=a?e.lines.slice(0,$s):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:[i.toLocaleString()," line",i===1?"":"s",a&&` (showing first ${$s.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(od,{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(Qu,{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(O3,{virtualizer:s,lines:c}):l.jsx(L3,{lines:c})})]})}function O3({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",R3(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:P3(r.kind)}),l.jsx("span",{className:"whitespace-pre-wrap break-all flex-1",children:r.text})]},n.key)})})}function D3(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if(r===void 0)break;if(r.kind==="context"){t.push({left:{text:r.text,lineNumber:r.oldLineNumber},right:{text:r.text,lineNumber:r.newLineNumber},kind:"equal"}),n+=1;continue}const o=[],s=[];for(;n<e.length&&e[n]?.kind==="removed";){const a=e[n];a!==void 0&&o.push(a),n+=1}for(;n<e.length&&e[n]?.kind==="added";){const a=e[n];a!==void 0&&s.push(a),n+=1}const i=Math.max(o.length,s.length);for(let a=0;a<i;a+=1){const c=o[a],u=s[a];c!==void 0&&u!==void 0?t.push({left:{text:c.text,lineNumber:c.oldLineNumber},right:{text:u.text,lineNumber:u.newLineNumber},kind:"changed"}):c!==void 0?t.push({left:{text:c.text,lineNumber:c.oldLineNumber},right:null,kind:"removed"}):u!==void 0&&t.push({left:null,right:{text:u.text,lineNumber:u.newLineNumber},kind:"added"})}}return t}function M3(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 L3({lines:e}){const t=D3(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",M3(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 F3="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",$3="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",B3="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",U3="/assets/minimax-BPMzvuL-.jpeg",Z3="/assets/alibaba-TTwafVwX.svg",V3="/assets/qwen-CONDcHqt.png",W3="/assets/zhipuai-BPNAnxo-.svg",H3={"claude-":"anthropic","gpt-":"openai","o1-":"openai","o3-":"openai","deepseek-":"deepseek",MiniMax:"minimax",qwen:"qwen","glm-":"zhipuai"};function q3(e){if(e===null)return"unknown";const t=e.toLowerCase();for(const[n,r]of Object.entries(H3))if(t.startsWith(n.toLowerCase()))return r;return"unknown"}const _n={width:24,height:24,objectFit:"contain"},K3=at.memo(({className:e})=>l.jsx("img",{src:F3,alt:"Anthropic",className:e,style:_n})),J3=at.memo(({className:e})=>l.jsx("img",{src:$3,alt:"OpenAI",className:e,style:{..._n,background:"white",borderRadius:"4px"}})),G3=at.memo(({className:e})=>l.jsx("img",{src:B3,alt:"DeepSeek",className:e,style:_n})),Y3=at.memo(({className:e})=>l.jsx("img",{src:U3,alt:"MiniMax",className:e,style:_n})),X3=at.memo(({className:e})=>l.jsx("img",{src:Z3,alt:"Alibaba",className:e,style:_n})),Q3=at.memo(({className:e})=>l.jsx("img",{src:V3,alt:"Qwen",className:e,style:_n})),eN=at.memo(({className:e})=>l.jsx("img",{src:W3,alt:"ZhipuAI",className:e,style:_n}));function tN({provider:e,className:t}){switch(e){case"anthropic":return l.jsx(K3,{className:t});case"openai":return l.jsx(J3,{className:t});case"deepseek":return l.jsx(G3,{className:t});case"minimax":return l.jsx(Y3,{className:t});case"alibaba":return l.jsx(X3,{className:t});case"qwen":return l.jsx(Q3,{className:t});case"zhipuai":return l.jsx(eN,{className:t});case"unknown":return null}}function nN(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}const Oc={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 Dc({trend:e}){if(e===null)return null;const t=e.direction==="up",n=t?Oy:Py,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 rN=v.memo(function({log:e,messageCount:t=null,toolCount:n=null,expanded:r,onToggle:o,responseToolNames:s=null,cacheTrend:i=null}){const a=Uh(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(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsx("span",{className:"shrink-0",children:l.jsx(tN,{provider:q3(e.model),className:"size-4"})})}),l.jsx(ze,{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",Oc[a]),children:l.jsx(_r,{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",Oc[a]),children:e.responseStatus})}),e.elapsedMs!==null&&l.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(Oo,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:nN(e.elapsedMs)})]}),c&&l.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[l.jsx(Tr,{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(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[l.jsx(Dc,{trend:i?.creation??null}),l.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",Ye(e.cacheCreationInputTokens)]})]})}),l.jsx(ze,{children:"Tokens cached for reuse, reducing future API cost"})]})}),e.cacheReadInputTokens!==null&&e.cacheReadInputTokens>0&&l.jsx(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsxs("span",{className:"flex items-center gap-1 text-xs shrink-0",children:[l.jsx(Dc,{trend:i?.read??null}),l.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",Ye(e.cacheReadInputTokens)]})]})}),l.jsx(ze,{children:"Tokens served from cache, reducing API cost"})]})}),t!==null&&l.jsx(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(td,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:t})]})}),l.jsx(ze,{children:"Number of messages in the conversation"})]})}),n!==null&&l.jsx(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs shrink-0",children:[l.jsx(al,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums",children:n})]})}),l.jsx(ze,{children:"Number of tools defined in the request"})]})}),s!==null&&s.length>0&&l.jsx(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsxs("span",{className:"flex items-center gap-1 text-amber-400/80 text-xs shrink-0",children:[l.jsx(al,{className:"size-3"}),l.jsx("span",{className:"font-mono tabular-nums truncate max-w-[160px]",children:s.join(", ")})]})}),l.jsxs(ze,{children:["Tools called by model: ",s.join(", ")]})]})}),e.origin!==null&&l.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-muted-foreground text-xs shrink-0",title:`Origin: ${e.origin}`,children:[l.jsx(mv,{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(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsxs("span",{className:"hidden xl:flex items-center gap-1 text-purple-400/80 text-xs shrink-0",children:[l.jsx(uv,{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(ze,{children:e.clientCwd!==null?`PID: ${e.clientPid??"?"} CWD: ${e.clientCwd}`:`Process ID: ${e.clientPid??"?"}`})]})}),e.streaming&&l.jsx(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsx(Sv,{className:"size-3 text-muted-foreground/60 shrink-0"})}),l.jsx(ze,{children:"Request used SSE streaming"})]})}),l.jsx("span",{className:"flex-1 min-w-0"}),r?l.jsx(yt,{className:"size-4 text-muted-foreground shrink-0"}):l.jsx(bt,{className:"size-4 text-muted-foreground shrink-0"})]})});function Pp({className:e,orientation:t="horizontal",decorative:n=!0,...r}){return l.jsx(m_,{"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 cs({...e}){return l.jsx(yb,{"data-slot":"collapsible",...e})}function us({...e}){return l.jsx(md,{"data-slot":"collapsible-trigger",...e})}function ds({...e}){return l.jsx(gd,{"data-slot":"collapsible-content",...e})}function Ta({className:e,children:t,...n}){return l.jsxs(Nk,{"data-slot":"scroll-area",className:he("relative",e),...n,children:[l.jsx(Tk,{"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(oN,{}),l.jsx(Ak,{})]})}function oN({className:e,orientation:t="vertical",...n}){return l.jsx(Ef,{"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(If,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}function sN(e){return l.jsx(l.Fragment,{})}function iN({text:e}){const[t,n]=v.useState(!1);return l.jsxs(cs,{open:t,onOpenChange:n,children:[l.jsxs(us,{className:"flex items-center gap-1.5 py-0.5 cursor-pointer hover:opacity-80 transition-opacity group",children:[t?l.jsx(yt,{className:"size-3 text-muted-foreground"}):l.jsx(bt,{className:"size-3 text-muted-foreground"}),l.jsx("span",{className:"text-muted-foreground text-xs italic select-none opacity-60",children:"[system-reminder]"})]}),l.jsx(ds,{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(Jn,{children:e})})})})]})}const aN=/<think>([\s\S]*?)<\/think>/gi,lN=/<think>([\s\S]*?)<\/think>/i;function Rp(e){const t=lN.exec(e);if(!t||t[1]===void 0)return{thinking:null,remainingText:e};const n=t[1].trim(),r=e.replace(aN,"").trim();return{thinking:n,remainingText:r}}function cN({text:e}){if(e.includes("<system-reminder>"))return l.jsx(iN,{text:e});const{thinking:t,remainingText:n}=Rp(e);return l.jsxs("div",{className:"space-y-2",children:[t!==null&&l.jsx(jo,{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(Jn,{children:n})}),t===null&&n.length===0&&l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty text block"})]})}function jo({thinking:e}){const[t,n]=v.useState(!1);return l.jsx(cs,{open:t,onOpenChange:n,children:l.jsxs("div",{className:"border-l-2 border-purple-500/40 my-1",children:[l.jsxs(us,{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(My,{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(yt,{className:"size-3 text-muted-foreground"}):l.jsx(bt,{className:"size-3 text-muted-foreground"})]}),l.jsx(ds,{children:l.jsx("div",{className:"px-3 pb-2",children:l.jsx(Ta,{className:"max-h-[60vh]",children:l.jsx("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap font-mono leading-relaxed",children:e})})})})]})})}function uN({name:e,input:t}){const[n,r]=v.useState(!1);return l.jsx(cs,{open:n,onOpenChange:r,children:l.jsxs("div",{className:"border-l-2 border-blue-500/40 my-1",children:[l.jsxs(us,{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(sd,{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(yt,{className:"size-3 text-muted-foreground"}):l.jsx(bt,{className:"size-3 text-muted-foreground"})]}),l.jsx(ds,{children:l.jsx("div",{className:"px-3 pb-2",children:l.jsx(Ta,{className:"max-h-[60vh]",children:l.jsx(ls,{data:Gn(t),defaultExpandDepth:2})})})})]})})}function dN({block:e}){switch(e.type){case"text":return l.jsx(cN,{text:e.text});case"thinking":case"think":return l.jsx(jo,{thinking:e.thinking});case"tool_use":return l.jsx(uN,{name:e.name,input:e.input});default:return sN()}}function fN({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(Xu,{className:"size-2.5"}),e.stop_reason]}),l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[l.jsx(Tr,{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(Pp,{className:"opacity-50"}),l.jsxs("div",{className:"space-y-2",children:[e.content.map((t,n)=>l.jsx(dN,{block:t},n)),e.content.length===0&&l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty response content"})]})]})}function hN(e){if(e===void 0||e==="")return{};try{return JSON.parse(e)}catch{return null}}function pN({call:e}){const[t,n]=v.useState(!1),r=e.function.name??"(unnamed tool)",o=hN(e.function.arguments);return l.jsx(cs,{open:t,onOpenChange:n,children:l.jsxs("div",{className:"border-l-2 border-blue-500/40 my-1",children:[l.jsxs(us,{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(sd,{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(yt,{className:"size-3 text-muted-foreground"}):l.jsx(bt,{className:"size-3 text-muted-foreground"})]}),l.jsx(ds,{children:l.jsx("div",{className:"px-3 pb-2",children:l.jsx(Ta,{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(ls,{data:Gn(o),defaultExpandDepth:2})})})})]})})}function mN({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(Xu,{className:"size-2.5"}),t.finish_reason]}),l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[l.jsx(Tr,{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(Pp,{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(jo,{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:s,remainingText:i}=Rp(n.content);return l.jsxs("div",{className:"space-y-2",children:[s!==null&&!o&&l.jsx(jo,{thinking:s}),i.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(Jn,{children:i})})]})})(),r.map((o,s)=>l.jsx(pN,{call:o},o.id??`tc-${s}`)),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 Op(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function gN(e){return Op(e)&&e.object==="chat.completion"}function xN(e){return Op(e)&&e.type==="message"&&Array.isArray(e.content)}function yN(e,t){return e==="openai"&&gN(t)?l.jsx(mN,{response:t}):e==="anthropic"&&xN(t)?l.jsx(fN,{response:t}):null}const vN="/v1/chat/completions",bN="/chat/completions",wN="/v1/messages";class kN{handlers=new Map;pathMap=new Map;register(t){this.handlers.set(t.format,t)}registerPath(t,n){this.pathMap.set(t,n)}get(t){return this.handlers.get(t)}getByPath(t){const n=t.split("?")[0]??"",r=this.pathMap.get(n);return r===void 0?void 0:this.handlers.get(r)}detectFormat(t){if(t===null)return"unknown";for(const n of this.handlers.values())if(n.detectFormat(t))return n.format;return"unknown"}}const sr=new kN;function _N(e){return sr.getByPath(e)??null}function SN(e){return _N(e)?.format??"unknown"}sr.registerPath(wN,"anthropic");sr.registerPath(vN,"openai");sr.registerPath(bN,"openai");function CN(e){if(e==="")return{};try{const t=JSON.parse(e);return t!==null&&typeof t=="object"&&!Array.isArray(t)?{...t}:{}}catch{return{}}}function jN(e){switch(e.type){case"text":return{type:"text",text:e.text};case"thinking":{const t={type:"thinking",thinking:e.thinking};return e.signature!==""&&(t.signature=e.signature),t}case"think":{const t={type:"think",thinking:e.thinking};return e.signature!==""&&(t.signature=e.signature),t}case"tool_use":return{type:"tool_use",id:e.id,name:e.name,input:CN(e.inputJson)}}}function Dp(e,t,n,r){const o=new Map;let s="",i="",a=null,c=null,u=0,d=0;const h=1e3;let p=0,f=0;const y=[];for(const x of e.split(`
|
|
106
|
+
`)){const g=x.trim();if(g.startsWith("data: "))try{const b=JSON.parse(g.slice(6)),w=ny.safeParse(b);if(!w.success)continue;const S=w.data;switch(p===0&&(f=Date.now()),r===!0&&y.length<h&&y.push({index:p,timestamp:Date.now()-f,type:S.type,data:S}),p++,S.type){case"message_start":s=S.message.id,i=S.message.model,u=S.message.usage.input_tokens,t.inputTokens=u,t.cacheCreationInputTokens=S.message.usage.cache_creation_input_tokens??null,t.cacheReadInputTokens=S.message.usage.cache_read_input_tokens??null,t.model===null&&(t.model=i);break;case"content_block_start":{const j=S.content_block;switch(j.type){case"text":o.set(S.index,{type:"text",text:j.text??""});break;case"thinking":o.set(S.index,{type:"thinking",thinking:j.thinking??"",signature:j.signature??""});break;case"think":o.set(S.index,{type:"think",thinking:j.thinking??"",signature:j.signature??""});break;case"tool_use":o.set(S.index,{type:"tool_use",id:j.id,name:j.name,inputJson:""});break}break}case"content_block_delta":{const j=o.get(S.index);if(j===void 0)break;const C=S.delta;C.type==="text_delta"&&j.type==="text"?j.text+=C.text:C.type==="thinking_delta"&&(j.type==="thinking"||j.type==="think")?j.thinking+=C.thinking:C.type==="signature_delta"&&(j.type==="thinking"||j.type==="think")?j.signature+=C.signature:C.type==="input_json_delta"&&j.type==="tool_use"&&(j.inputJson+=C.partial_json);break}case"message_delta":a=S.delta.stop_reason,c=S.delta.stop_sequence??null,d=S.usage.output_tokens,t.outputTokens=d,S.usage.cache_creation_input_tokens!==void 0&&(t.cacheCreationInputTokens=S.usage.cache_creation_input_tokens),S.usage.cache_read_input_tokens!==void 0&&(t.cacheReadInputTokens=S.usage.cache_read_input_tokens);break;case"error":t.error=S.error.message;break;case"content_block_stop":case"message_stop":case"ping":break}}catch{}}r===!0&&(t.streamingChunks={chunks:y,truncated:p>h});const m=[...o.entries()].sort(([x],[g])=>x-g).map(([,x])=>jN(x));return JSON.stringify({id:s,type:"message",model:i!==""?i:n??"",role:"assistant",content:m,stop_reason:a,stop_sequence:c,usage:{input_tokens:u,output_tokens:d}})}const EN={format:"anthropic",parseRequest(e,t){try{const n=JSON.parse(e),r=Fu.safeParse(n);return r.success?{model:r.data.model,sessionId:r.data.metadata?.user_id??t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){try{const t=JSON.parse(e),n=$u.safeParse(t);if(n.success)return{inputTokens:n.data.usage.input_tokens??null,outputTokens:n.data.usage.output_tokens??null,cacheCreationInputTokens:n.data.usage.cache_creation_input_tokens??null,cacheReadInputTokens:n.data.usage.cache_read_input_tokens??null}}catch{}return{inputTokens:null,outputTokens:null,cacheCreationInputTokens:null,cacheReadInputTokens:null}},extractStream(e,t,n,r){return Dp(e,t,n,r)},detectFormat(e){if(e===null)return!1;try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=Object.keys(t);return n.includes("model")&&n.includes("messages")&&n.includes("system")}return!1}catch{return!1}}};sr.register(EN);class NN{providers=[];register(t){this.providers.push(t)}findProvider(t){let n=null;for(const r of this.providers)if(r.matches(t)){if(r.name!=="anthropic")return r;n=r}return n}getAll(){return[...this.providers]}}const Aa=new NN,TN="https://api.anthropic.com",AN={MiniMax:"https://api.minimaxi.com/anthropic"},IN={name:"anthropic",matches(e){const t=e.toLowerCase();if(t.startsWith("openai-"))return!1;if(t.includes("claude")||t.includes("anthropic"))return!0;for(const n of Object.keys(AN))if(t.startsWith(n.toLowerCase()))return!0;return!0},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:TN},extractStream(e,t,n,r){return Dp(e,t,n,r)}};Aa.register(IN);function Ia(e,t,n,r=!0){let o="",s="",i="",a="",c=null,u=0,d=0,h=!1,p=!1;const f=new Map,y=1e3;let m=0,x=0;const g=[];for(const w of e.split(`
|
|
107
|
+
`)){const S=w.trim();if(!S.startsWith("data: "))continue;const j=S.slice(6);if(j==="[DONE]")break;try{const C=JSON.parse(j);if(typeof C=="object"&&C!==null&&!Array.isArray(C)){const z=Object.getOwnPropertyDescriptor(C,"error");if(z!==void 0&&typeof z.value=="object"&&z.value!==null){const O=Object.getOwnPropertyDescriptor(z.value,"message");O!==void 0&&typeof O.value=="string"&&(t.error=O.value);continue}}const N=ly.safeParse(C);if(!N.success)continue;const T=N.data;if(m===0&&(x=Date.now()),r===!0&&g.length<y&&g.push({index:m,timestamp:Date.now()-x,type:"chat.completion.chunk",data:T}),m++,p||(o=T.id,s=T.model,p=!0),!h&&T.usage!==void 0&&T.usage!==null){if(u=T.usage.prompt_tokens??0,d=T.usage.completion_tokens??0,t.inputTokens=u,typeof C=="object"&&C!==null&&!Array.isArray(C)){const z=Object.getOwnPropertyDescriptor(C,"usage");if(z!==void 0&&typeof z.value=="object"&&z.value!==null){const O=Object.getOwnPropertyDescriptor(z.value,"prompt_tokens_details");if(O!==void 0&&typeof O.value=="object"&&O.value!==null){const L=Object.getOwnPropertyDescriptor(O.value,"cached_tokens");L!==void 0&&typeof L.value=="number"&&(t.cacheReadInputTokens=L.value)}}}h=!0}for(const z of T.choices){const O=z.delta;O.content!==void 0&&O.content!==null&&(i+=O.content),O.reasoning_content!==void 0&&O.reasoning_content!==null&&(a+=O.reasoning_content),O.thinking!==void 0&&O.thinking!==null&&(a+=O.thinking);const L=O.think;if(L!=null&&(a+=L),z.finish_reason!==void 0&&z.finish_reason!==null&&(c=z.finish_reason),O.tool_calls!==void 0&&O.tool_calls!==null)for(const E of O.tool_calls){let M=f.get(E.index);M===void 0&&(M={index:E.index,type:"function",function:{name:"",arguments:""}},f.set(E.index,M)),E.id!==void 0&&(M.id=E.id),E.function?.name!==void 0&&(M.function.name+=E.function.name),E.function?.arguments!==void 0&&(M.function.arguments+=E.function.arguments)}}}catch{}}r===!0&&(t.streamingChunks={chunks:g,truncated:m>y}),h||(d=Math.ceil(i.length/4)),t.outputTokens=d;const b={role:"assistant",content:i};return a&&(b.reasoning_content=a),f.size>0&&(b.tool_calls=[...f.values()]),JSON.stringify({id:o,object:"chat.completion",created:Math.floor(Date.now()/1e3),model:s!==""?s:n??"",choices:[{index:0,message:b,finish_reason:c}],usage:{prompt_tokens:u,completion_tokens:d,total_tokens:u+d}})}const zN={format:"openai",parseRequest(e,t){try{const n=JSON.parse(e),r=Zu.safeParse(n);return r.success?{model:r.data.model,sessionId:t?.get("x-session-affinity")??null}:null}catch{return null}},extractTokens(e){const t=Wu(e);if(t){let n=null;try{const r=JSON.parse(e);if(r!==null&&typeof r=="object"&&!Array.isArray(r)){const o=Object.getOwnPropertyDescriptor(r,"usage");if(o!==void 0&&typeof o.value=="object"&&o.value!==null){const s=Object.getOwnPropertyDescriptor(o.value,"prompt_tokens_details");if(s!==void 0&&typeof s.value=="object"&&s.value!==null){const i=Object.getOwnPropertyDescriptor(s.value,"cached_tokens");i!==void 0&&typeof i.value=="number"&&(n=i.value)}}}}catch{}return{inputTokens:t.usage.prompt_tokens??null,outputTokens:t.usage.completion_tokens??null,cacheCreationInputTokens:null,cacheReadInputTokens:n}}return{inputTokens:null,outputTokens:null,cacheCreationInputTokens:null,cacheReadInputTokens:null}},extractStream(e,t,n,r){return Ia(e,t,n,r)},detectFormat(e){if(e===null)return!1;try{const t=JSON.parse(e);if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=Object.keys(t);return n.includes("model")&&n.includes("messages")&&!n.includes("system")}return!1}catch{return!1}}};sr.register(zN);const PN="https://api.openai.com/v1",RN={name:"openai",matches(e){const t=e.toLowerCase();return!!(t.startsWith("openai-")||t.includes("gpt-")||t.includes("o1")||t.includes("o2")||t.includes("o3"))},getUpstreamBase(e,t){return t?.baseUrl!==void 0?t.baseUrl:PN},extractStream(e,t,n,r){return Ia(e,t,n,r)}};Aa.register(RN);const ON="https://dashscope.aliyuncs.com/compatible-mode/v1",DN={name:"alibaba",matches(e){const t=e.toLowerCase().replace(/\s+/g,"-");return!!(t.startsWith("glm-5")||t.startsWith("qwen"))},getUpstreamBase(e,t){return ON},extractStream(e,t,n){return Ia(e,t,n)}};Aa.register(DN);function hn(e){return{parsed:null,comparisonValue:e,messageCount:null,toolCount:null}}const Bn={parsed:null,toolNames:null},MN={format:"anthropic",analyzeRequest(e){if(e===null)return hn(e);try{const t=Fu.safeParse(JSON.parse(e));return t.success?{parsed:t.data,comparisonValue:t.data,messageCount:t.data.messages.length,toolCount:t.data.tools!==void 0&&t.data.tools.length>0?t.data.tools.length:null}:hn(e)}catch{return hn(e)}},analyzeResponse(e){if(e===null)return Bn;try{let t=JSON.parse(e);typeof t=="string"&&(t=JSON.parse(t));const n=$u.safeParse(t);if(!n.success)return Bn;const r=n.data.content.filter(o=>o.type==="tool_use").map(o=>o.name);return{parsed:n.data,toolNames:r.length>0?r:null}}catch{return Bn}}},LN={format:"openai",analyzeRequest(e){if(e===null)return hn(e);try{const t=Zu.safeParse(JSON.parse(e));return t.success?{parsed:t.data,comparisonValue:t.data,messageCount:t.data.messages.length,toolCount:t.data.tools!==void 0&&t.data.tools.length>0?t.data.tools.length:null}:hn(e)}catch{return hn(e)}},analyzeResponse(e){if(e===null)return Bn;const t=Wu(e);if(t===null)return Bn;const n=t.choices[0]?.message?.tool_calls?.map(r=>r.function?.name??"").filter(r=>r!=="")??[];return{parsed:t,toolNames:n.length>0?n:null}}},FN={format:"unknown",analyzeRequest(e){return hn(e)},analyzeResponse(){return Bn}},$N={anthropic:MN,openai:LN,unknown:FN};function Eo(e){return $N[e]}function Er(e){const t=SN(e.path);return t==="unknown"?e.apiFormat:t}function BN(e){switch(e){case"success":return"text-emerald-400";case"client_error":return"text-amber-400";case"server_error":return"text-red-400";case"pending":return"text-muted-foreground"}}function hr({status:e}){const t=Uh(e),n=BN(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(Mv,{className:"size-3"}),e]})}function Mc({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 UN({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(Jn,{children:e})})}function so({responseText:e,responseStatus:t,streaming:n,inputTokens:r,outputTokens:o,cacheCreationInputTokens:s,cacheReadInputTokens:i,apiFormat:a,error:c}){const u=a??"unknown",d=v.useMemo(()=>Eo(u).analyzeResponse(e).parsed,[u,e]);return e===null&&c===void 0?l.jsxs("div",{className:"flex items-center gap-2 py-3",children:[l.jsx(hr,{status:t}),l.jsx("span",{className:"text-xs text-muted-foreground italic",children:"No response"})]}):t!==null&&t>=400?l.jsxs("div",{className:"space-y-2",children:[l.jsx(hr,{status:t}),l.jsx(Mc,{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})]})]}):c!=null?l.jsxs("div",{className:"space-y-2",children:[l.jsx(hr,{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(Mc,{text:e})})]}):d!==null?l.jsxs("div",{className:"space-y-2",children:[l.jsx(hr,{status:t}),yN(u,d)]}):l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(hr,{status:t}),n&&(r!==null||o!==null)&&l.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[l.jsx(Tr,{className:"size-3"}),l.jsxs("span",{className:"font-mono tabular-nums",children:[r!==null?Ye(r):"—"," in /"," ",o!==null?Ye(o):"—"," out"]}),s!=null&&s>0&&l.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",Ye(s)]}),i!=null&&i>0&&l.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",Ye(i)]})]})]}),l.jsx(UN,{text:e??""})]})}const ZN=ae({success:nt(),error:q().optional(),responseStatus:ve().optional(),responseText:q().optional(),inputTokens:ve().optional(),outputTokens:ve().optional(),elapsedMs:ve().optional(),streaming:nt().optional()});function VN({log:e,open:t,onOpenChange:n}){const[r,o]=v.useState(()=>e.rawRequestBody??"{}"),[s,i]=v.useState(null),[a,c]=v.useState(!1),[u,d]=v.useState(null);async function h(){c(!0),d(null),i(null);try{const y=await(await fetch(`/api/logs/${e.id}/replay`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({modifiedBody:r})})).json(),m=ZN.safeParse(y);if(!m.success){d("Invalid response from server"),c(!1);return}const x=m.data;i(x),x.success||d(x.error??"Replay failed")}catch(f){d(f instanceof Error?f.message:"Network error")}finally{c(!1)}}function p(){i(null),d(null),n(!1)}return l.jsx(ts,{open:t,onOpenChange:p,children:l.jsxs(ns,{className:"max-w-4xl max-h-[85vh] overflow-auto",children:[l.jsx(rs,{children:l.jsxs(os,{className:"flex items-center gap-2",children:[l.jsx(nd,{className:"size-4"}),"Replay Request #",e.id]})}),l.jsxs(Rn,{defaultValue:"modified",children:[l.jsxs(On,{children:[l.jsx(et,{value:"modified",children:"Modified Request"}),l.jsx(et,{value:"original",children:"Original Response"}),s&&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(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{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(ze,{children:"Edit the request body before re-sending to the provider"})]})})]}),u!==null&&u!==""&&l.jsx("div",{className:"text-sm text-destructive bg-destructive/10 px-3 py-2 rounded-md",children:u}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Xe,{onClick:()=>{h()},disabled:a,children:a?"Replaying...":"Replay"})}),s&&s.success&&l.jsxs(Rn,{defaultValue:"parsed",children:[l.jsxs(On,{children:[l.jsx(et,{value:"parsed",children:"Response"}),l.jsx(et,{value:"raw",children:"Raw Response"})]}),l.jsx(tt,{value:"parsed",children:l.jsx(so,{responseText:s.responseText??null,responseStatus:s.responseStatus??null,streaming:s.streaming??!1,inputTokens:s.inputTokens??null,outputTokens:s.outputTokens??null,apiFormat:e.apiFormat})}),l.jsx(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:s.responseText??"No response"})})]})]}),l.jsx(tt,{value:"original",children:e.responseText!==null?l.jsxs(Rn,{defaultValue:"parsed",children:[l.jsxs(On,{children:[l.jsx(et,{value:"parsed",children:"Response"}),l.jsx(et,{value:"raw",children:"Raw Response"})]}),l.jsx(tt,{value:"parsed",children:l.jsx(so,{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"})}),s&&s.success&&l.jsx(tt,{value:"replay",children:s.responseText!==null?l.jsxs(Rn,{defaultValue:"parsed",children:[l.jsxs(On,{children:[l.jsx(et,{value:"parsed",children:"Response"}),l.jsx(et,{value:"raw",children:"Raw Response"})]}),l.jsx(tt,{value:"parsed",children:l.jsx(so,{responseText:s.responseText??null,responseStatus:s.responseStatus??null,streaming:s.streaming??!1,inputTokens:s.inputTokens??null,outputTokens:s.outputTokens??null,apiFormat:e.apiFormat})}),l.jsx(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:s.responseText})})]}):l.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No replay response"})})]})]})})}function WN({logId:e,truncated:t}){const[n,r]=v.useState(!1),[o,s]=v.useState({status:"idle"}),[i,a]=v.useState(new Set);v.useEffect(()=>{if(!n||o.status!=="idle")return;let h=!1;return s({status:"loading"}),fetch(`/api/logs/${e}/chunks`).then(p=>p.ok?p.json():Promise.reject(new Error("Chunks not found"))).then(p=>{h||s({status:"success",chunks:p.chunks})}).catch(()=>{h||s({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(_r,{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=i.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(yt,{className:"size-3 text-muted-foreground"}):l.jsx(bt,{className:"size-3 text-muted-foreground"}),l.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:["[",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(ls,{data:f,defaultExpandDepth:1,showCopy:!0})]},f.index))})]},h.index)})]})}return l.jsxs("div",{className:"space-y-1",children:[l.jsx(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{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(yt,{className:"size-3"}):l.jsx(bt,{className:"size-3"}),l.jsx("span",{children:"Raw SSE Events"}),l.jsxs(xt,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono ml-1",children:[e,t===!0?"+":""]})]})}),l.jsx(ze,{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 Lc(e,t,n){return e==="anthropic"&&t==="full"&&n}function HN(e,t){return e==="full"&&t}function qN(e,t,n,r){return e==="anthropic"&&t==="full"&&n&&r}function Bs({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(sn,{className:"size-3 text-green-500"}),l.jsx("span",{className:"text-green-500",children:"Copied!"})]}):l.jsxs(l.Fragment,{children:[l.jsx(wn,{className:"size-3"}),l.jsx("span",{children:t})]})})}function Fc({active:e,onClick:t}){return l.jsxs(Ae,{children:[l.jsx(Ie,{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(ed,{className:"size-3"}),e?"Showing diff":"Diff with Raw"]})}),l.jsx(ze,{children:e?"Hide diff view":"Compare proxy output against the original raw version"})]})}const KN=v.memo(function({rawBody:e,displayedBody:t,emptyLabel:n}){const r=v.useMemo(()=>I3(e,t),[e,t]);return l.jsx(zp,{result:r,emptyLabel:n})}),JN=v.memo(function({rawHeaders:e,headers:t,emptyLabel:n}){const r=v.useMemo(()=>A3(e,t),[e,t]);return l.jsx(zp,{result:r,emptyLabel:n})});function Us(e){const[t,n]=v.useState(!1),r=v.useRef(null);v.useEffect(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);const o=v.useCallback(s=>{s.stopPropagation(),e!==null&&window.navigator.clipboard.writeText(e).then(()=>{n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),2e3)})},[e]);return{copied:t,copy:o}}const GN=v.memo(function({log:e,viewMode:t="simple",strip:n,cacheTrend:r=null,onCompareWithPrevious:o}){const[s,i]=v.useState(!1),[a,c]=v.useState(!1),[u,d]=v.useState(!1),[h,p]=v.useState(!1),f=Er(e),y=Eo(f),m=v.useMemo(()=>y.analyzeRequest(e.rawRequestBody),[y,e.rawRequestBody]),x=v.useMemo(()=>y.analyzeResponse(e.responseText),[y,e.responseText]),b=v.useMemo(()=>!n||f!=="anthropic"||e.rawRequestBody===null?null:QS(e.rawRequestBody).body,[e.rawRequestBody,f,n])??e.rawRequestBody,w=Us(b),S=Us(e.rawRequestBody),j=Us(e.responseText);return l.jsxs(Le,{children:[l.jsxs("div",{className:"border border-border rounded-lg mb-1.5 overflow-hidden",children:[l.jsx(rN,{log:e,messageCount:m.messageCount,toolCount:m.toolCount,expanded:s,onToggle:()=>i(!s),responseToolNames:x.toolNames,cacheTrend:r}),s&&l.jsx("div",{onClick:C=>C.stopPropagation(),onKeyDown:C=>C.stopPropagation(),children:l.jsxs(Rn,{defaultValue:"request",children:[l.jsxs(On,{className:"mx-4 mt-2",children:[t==="full"&&l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsx(et,{value:"raw-headers",children:"Raw Headers"})}),l.jsx(ze,{children:"HTTP headers received from the upstream provider"})]}),t==="full"&&l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsx(et,{value:"headers",children:"Headers"})}),l.jsx(ze,{children:"Request and response headers sent and received"})]}),Lc(f,t,n)&&l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsx(et,{value:"raw-request",children:"Raw Request"})}),l.jsx(ze,{children:"Exact HTTP request sent to the upstream provider"})]}),l.jsx(et,{value:"request",children:"Request"}),t==="full"&&l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsx(et,{value:"raw",children:"Raw Response"})}),l.jsx(ze,{children:"Exact HTTP response from the upstream provider"})]}),l.jsx(et,{value:"parsed",children:"Response"})]}),Lc(f,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(Bs,{text:e.rawRequestBody,label:"Copy Raw Request",copied:S.copied,onCopy:S.copy})}),e.rawRequestBody!==null?l.jsx(fn,{text:e.rawRequestBody,defaultExpandDepth:1}):l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No request body"})]})}),l.jsx(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:[qN(f,t,n,e.rawRequestBody!==null)&&l.jsx(Fc,{active:h,onClick:C=>{C.stopPropagation(),p(!h)}}),o!==void 0&&l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsxs(Xe,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:C=>{C.stopPropagation(),o(e)},children:[l.jsx(ed,{className:"size-3 mr-1"}),"Diff with Previous"]})}),l.jsx(ze,{children:"Compare this request with the immediately preceding one"})]}),l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsxs(Xe,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:C=>{C.stopPropagation(),c(!0)},children:[l.jsx(nd,{className:"size-3 mr-1"}),"Replay"]})}),l.jsx(ze,{children:"Re-send this request to the provider"})]}),l.jsx(Bs,{text:b,label:"Copy Request",copied:w.copied,onCopy:w.copy})]}),h?l.jsx(KN,{rawBody:e.rawRequestBody,displayedBody:b,emptyLabel:"No transformation applied — raw and sent request bodies are identical."}):b!==null?l.jsx(fn,{text:b,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:HN(t,e.rawHeaders!==void 0&&Object.keys(e.rawHeaders).length>0)&&l.jsx(Fc,{active:u,onClick:C=>{C.stopPropagation(),d(!u)}})}),u?l.jsx(JN,{rawHeaders:e.rawHeaders,headers:e.headers,emptyLabel:"No transformation applied — raw and processed headers are identical."}):e.headers&&Object.keys(e.headers).length>0?l.jsx("div",{className:"space-y-1 font-mono text-xs",children:Object.entries(e.headers).sort(([C],[N])=>C.localeCompare(N)).map(([C,N])=>l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[C,":"]}),l.jsx("span",{className:"text-muted-foreground truncate",title:N,children:N})]},C))}):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(([C],[N])=>C.localeCompare(N)).map(([C,N])=>l.jsxs("div",{className:"flex gap-2",children:[l.jsxs("span",{className:"text-blue-600 dark:text-blue-400 font-semibold shrink-0",children:[C,":"]}),l.jsx("span",{className:"text-muted-foreground truncate",title:N,children:N})]},C))}):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(Bs,{text:e.responseText,label:"Copy Response",copied:j.copied,onCopy:j.copy})}),e.responseText!==null?l.jsx(fn,{text:e.responseText,defaultExpandDepth:1}):l.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No response"}),e.streaming===!0&&l.jsx(WN,{logId:e.id,truncated:e.streamingChunksPath!==null})]})}),l.jsx(tt,{value:"parsed",children:l.jsx("div",{className:"px-4 py-3",children:l.jsx(so,{responseText:e.responseText,responseStatus:e.responseStatus,streaming:e.streaming,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens,cacheReadInputTokens:e.cacheReadInputTokens,apiFormat:f,error:e.error})})})]})})]}),l.jsx(VN,{log:e,open:a,onOpenChange:c})]})});function St({className:e,style:t,d:n,eyeStalks:r,eyes:o,legs:s,extras:i}){return l.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:t,className:he("inline-block size-5",e),children:[l.jsx("path",{d:n}),r,o,s,i]})}const un=l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"6.5",y1:"16",x2:"4.5",y2:"19.5"}),l.jsx("line",{x1:"9",y1:"17.5",x2:"8",y2:"20.5"}),l.jsx("line",{x1:"15",y1:"17.5",x2:"16",y2:"20.5"}),l.jsx("line",{x1:"17.5",y1:"16",x2:"19.5",y2:"19.5"})]}),Mp=l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"7",y1:"16",x2:"5.5",y2:"18.5"}),l.jsx("line",{x1:"9.5",y1:"17",x2:"8.5",y2:"19.5"}),l.jsx("line",{x1:"14.5",y1:"17",x2:"15.5",y2:"19.5"}),l.jsx("line",{x1:"17",y1:"16",x2:"18.5",y2:"18.5"})]});function Lp({className:e}){return l.jsx(St,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"})]}),legs:un,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function YN({className:e}){return l.jsx(St,{className:e,d:"M4 13 C4 7 7.5 5.5 12 5.5 C16.5 5.5 20 7 20 13 C20 17.5 16.5 19 12 19 C7.5 19 4 17.5 4 13 Z",eyeStalks:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"9.5",y1:"6.5",x2:"9.5",y2:"4.5"}),l.jsx("line",{x1:"14.5",y1:"6.5",x2:"14.5",y2:"4.5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"4",r:"1.1",fill:"currentColor",stroke:"none"})]}),legs:Mp,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C4 9.5 2.5 10 3 12 C3.5 13.5 4.5 13 5 12"}),l.jsx("path",{d:"M19 11 C20 9.5 21.5 10 21 12 C20.5 13.5 19.5 13 19 12"})]})})}function XN({className:e}){return l.jsx(St,{className:e,d:"M3 13.5 C3 8 7 6 12 6 C17 6 21 8 21 13.5 C21 17 17 19 12 19 C7 19 3 17 3 13.5 Z",eyeStalks:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"7",y1:"7",x2:"6.5",y2:"4.5"}),l.jsx("line",{x1:"17",y1:"7",x2:"17.5",y2:"4.5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"6.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"17.5",cy:"4",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:un,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M4 12 C2.5 10.5 1 11 1.5 13 C2 14.5 3.5 14 4.5 13"}),l.jsx("path",{d:"M20 12 C21.5 10.5 23 11 22.5 13 C22 14.5 20.5 14 19.5 13"})]})})}function QN({className:e}){return l.jsx(St,{className:e,d:"M6 14 C6 8 9 5.5 12 5.5 C15 5.5 18 8 18 14 C18 18 15 20 12 20 C9 20 6 18 6 14 Z",eyeStalks:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"6.5",x2:"10",y2:"3.5"}),l.jsx("line",{x1:"14",y1:"6.5",x2:"14",y2:"3.5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"10",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14",cy:"3",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"7",y1:"17",x2:"5",y2:"20.5"}),l.jsx("line",{x1:"9.5",y1:"18.5",x2:"8.5",y2:"21.5"}),l.jsx("line",{x1:"14.5",y1:"18.5",x2:"15.5",y2:"21.5"}),l.jsx("line",{x1:"17",y1:"17",x2:"19",y2:"20.5"})]}),extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M6.5 11 C5 8.5 3 9 3.5 11.5 C4 13.5 5 13 6 12"}),l.jsx("path",{d:"M17.5 11 C19 8.5 21 9 20.5 11.5 C20 13.5 19 13 18 12"})]})})}function e4({className:e}){return l.jsx(St,{className:e,d:"M5 13 C5 9 8 7 12 7 L13 4 L14 7 C16 7 19 9 19 13 C19 16 16 18 13 18 L12 21 L11 18 C8 18 5 16 5 13 Z",eyeStalks:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:un,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function t4({className:e}){return l.jsx(St,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.9",fill:"currentColor",stroke:"none"}),l.jsx("line",{x1:"13.5",y1:"4",x2:"15.5",y2:"5"})]}),legs:un,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"})]})})}function n4({className:e}){return l.jsx(St,{className:e,d:"M5.5 13.5 C5.5 10 8.5 8 12 8 C15.5 8 18.5 10 18.5 13.5 C18.5 16 15.5 17.5 12 17.5 C8.5 17.5 5.5 16 5.5 13.5 Z",eyeStalks:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"8",x2:"10",y2:"6"}),l.jsx("line",{x1:"14",y1:"8",x2:"14",y2:"6"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"9",y1:"6",x2:"11",y2:"6.5"}),l.jsx("line",{x1:"13",y1:"6",x2:"15",y2:"6.5"})]}),legs:Mp,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M6 11.5 C4.5 10.5 3 11 3.5 12.5 C4 13.5 5 13 5.5 12.5"}),l.jsx("path",{d:"M18 11.5 C19.5 10.5 21 11 20.5 12.5 C20 13.5 19 13 18.5 12.5"})]})})}function r4({className:e}){return l.jsx(St,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"14.5",cy:"4.5",r:"0.7",fill:"currentColor",stroke:"none"})]}),legs:un,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),l.jsx("line",{x1:"8.5",y1:"4",x2:"10.5",y2:"4.5"}),l.jsx("line",{x1:"15.5",y1:"4",x2:"13.5",y2:"4.5"}),l.jsx("path",{d:"M9 15.5 C10 14.5 14 14.5 15 15.5"})]})})}function o4({className:e}){return l.jsx(St,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"}),l.jsx("circle",{cx:"14.5",cy:"4.5",r:"1.2",fill:"none",stroke:"currentColor"})]}),legs:un,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),l.jsx("ellipse",{cx:"12",cy:"15",rx:"2",ry:"1.5",fill:"currentColor",stroke:"none"})]})})}function s4({className:e}){return l.jsx(St,{className:e,d:"M4.5 13 C4.5 8 7.5 6 12 6 C16.5 6 19.5 8 19.5 13 C19.5 17 16.5 18.5 12 18.5 C7.5 18.5 4.5 17 4.5 13 Z",eyeStalks:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"9.5",y1:"7",x2:"9",y2:"5"}),l.jsx("line",{x1:"14.5",y1:"7",x2:"15",y2:"5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"9",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"15",cy:"4.5",r:"1",fill:"currentColor",stroke:"none"})]}),legs:un,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9 2 9.5 2.5 12 C3 14 4 13 5 12"}),l.jsx("path",{d:"M19 11 C20.5 9 22 9.5 21.5 12 C21 14 20 13 19 12"}),l.jsx("path",{d:"M9 14.5 C10 16 14 16 15 14.5"}),l.jsx("circle",{cx:"7",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"}),l.jsx("circle",{cx:"17",cy:"13",r:"1",fill:"currentColor",stroke:"none",opacity:"0.3"})]})})}function i4({className:e}){return l.jsx(St,{className:e,d:"M5 13 C5 9 8 7 12 7 C16 7 19 9 19 13 C19 16 16 18 12 18 C8 18 5 16 5 13 Z",eyeStalks:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10",y1:"7",x2:"9.5",y2:"5.5"}),l.jsx("line",{x1:"14",y1:"7",x2:"14.5",y2:"5.5"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"7.5",y1:"5.5",x2:"16.5",y2:"5.5"}),l.jsx("rect",{x:"7",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"}),l.jsx("rect",{x:"13",y:"5",width:"4",height:"2",rx:"0.5",fill:"currentColor",stroke:"none"})]}),legs:un,extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M5 11 C3.5 9.5 1.5 10 2 12.5 C2.5 14 4 13.5 5 12.5"}),l.jsx("path",{d:"M19 11 C20.5 9.5 22.5 10 22 12.5 C21.5 14 20 13.5 19 12.5"}),l.jsx("path",{d:"M9.5 15 C10.5 16 13.5 16 14.5 15"})]})})}function a4({className:e}){return l.jsx(St,{className:e,d:"M7 13.5 C7 10.5 9.5 9 12 9 C14.5 9 17 10.5 17 13.5 C17 16 14.5 17.5 12 17.5 C9.5 17.5 7 16 7 13.5 Z",eyeStalks:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"10.5",y1:"9.5",x2:"10.5",y2:"8"}),l.jsx("line",{x1:"13.5",y1:"9.5",x2:"13.5",y2:"8"})]}),eyes:l.jsxs(l.Fragment,{children:[l.jsx("circle",{cx:"10.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"13.5",cy:"7.5",r:"0.8",fill:"currentColor",stroke:"none"})]}),legs:l.jsxs(l.Fragment,{children:[l.jsx("line",{x1:"8",y1:"16",x2:"6.5",y2:"18"}),l.jsx("line",{x1:"10",y1:"17",x2:"9.5",y2:"19"}),l.jsx("line",{x1:"14",y1:"17",x2:"14.5",y2:"19"}),l.jsx("line",{x1:"16",y1:"16",x2:"17.5",y2:"18"})]}),extras:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M7.5 12 C6.5 11 5.5 11.5 6 13 C6.5 14 7 13.5 7.5 13"}),l.jsx("path",{d:"M16.5 12 C17.5 11 18.5 11.5 18 13 C17.5 14 17 13.5 16.5 13"})]})})}const No=[Lp,YN,XN,QN,e4,t4,n4,r4,o4,s4,i4,a4];function l4(e){return No[Math.abs(e)%No.length]??Lp}function c4({stopReason:e,isPending:t,isFirst:n,isTurnStart:r,crabIndex:o=0,collapsible:s=!1,collapsed:i=!1,onToggle:a}){const c=e==="end_turn"||e==="stop",u=t&&!c,d=v.useMemo(()=>l4(o),[o]);return l.jsxs("div",{className:"flex flex-col items-center w-6 shrink-0",children:[l.jsx("div",{className:"flex justify-center h-2.5",children:!n&&l.jsx("div",{className:"w-0.5 bg-muted-foreground/30"})}),s&&l.jsx("button",{type:"button",onClick:a,title:i?"Expand turn":"Collapse turn",className:"cursor-pointer flex justify-center py-0.5",children:i?l.jsx(bt,{className:"size-3 text-muted-foreground hover:text-foreground transition-colors"}):l.jsx(yt,{className:"size-3 text-muted-foreground hover:text-foreground transition-colors"})}),l.jsx("div",{className:"flex items-center justify-center py-0.5",children:c?l.jsx("span",{title:e==="end_turn"?"End of Turn (Anthropic)":"End of Turn (OpenAI)",children:l.jsx(d,{className:he("size-3.5 text-amber-400","animate-crab-settle","drop-shadow-[0_0_4px_rgba(251,191,36,0.5)]")})}):r?l.jsx("span",{title:"Start of turn",children:l.jsx(d,{className:he("size-3.5 text-emerald-400","animate-crab-appear","drop-shadow-[0_0_4px_rgba(52,211,153,0.5)]")})}):u?l.jsx("span",{title:"Processing…",children:l.jsx(d,{className:he("size-3.5 text-amber-300/80","animate-crab-crawl")})}):l.jsx(d,{className:"size-3.5 text-muted-foreground/40"})}),l.jsx("div",{className:"flex-1 flex justify-center min-h-1",children:c?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 u4({entries:e,viewMode:t,strip:n,cacheTrends:r,onCompareWithPrevious:o,comparisonPredecessors:s,turnIndex:i=0}){const a=e.length-1,c=e[a]?.stopReason??null,u=c!==null?Vh(c):!1,d=e[a]?.log.responseStatus===null,h=u&&!d,[p,f]=v.useState(!1),y=v.useCallback(()=>{h&&f(g=>!g)},[h]),m=v.useMemo(()=>{if(!p)return e;const g=e[a];return g!==void 0?[g]:[]},[e,p,a]),x=i%2===0?"bg-muted/10":"bg-muted/25";return l.jsx("div",{className:he("border rounded-lg",d?"border-amber-500/10":"border-transparent"),children:m.map((g,b)=>{const w=p?a:b,{log:S,stopReason:j}=g,C=j==="end_turn"||j==="stop";return l.jsxs("div",{className:"flex items-stretch",children:[l.jsx(c4,{stopReason:j,isPending:S.responseStatus===null,isFirst:w===0,isTurnStart:w===0,crabIndex:S.id%12,collapsible:h&&C&&e.length>1,collapsed:p,onToggle:y}),l.jsx("div",{className:he("flex-1 min-w-0 mb-1 rounded-lg",x),children:l.jsx(GN,{log:S,viewMode:t,strip:n,cacheTrend:r?.get(S.id)??null,onCompareWithPrevious:s.has(S.id)?o:void 0})})]},S.id)})})}function d4(e,t){return e||t}function f4(e){const t=[];let n=[],r=0;for(const o of e){n.push({log:o,stopReason:KS(o)});const s=n[n.length-1];s!==void 0&&Vh(s.stopReason)&&(t.push({entries:n,turnIndex:r}),n=[],r+=1)}return n.length>0&&t.push({entries:n,turnIndex:r}),t}function h4(e){const t=new Map;for(const n of e)for(let r=1;r<n.logs.length;r+=1){const o=n.logs[r],s=n.logs[r-1];if(o===void 0||s===void 0)continue;const i=Er(o),a=Er(s);i==="unknown"||i!==a||t.set(o.id,s)}return t}function p4(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 m4=v.memo(function({group:e,viewMode:t="simple",strip:n,cacheTrends:r,onCompareWithPrevious:o,comparisonPredecessors:s,onClearGroup:i,standalone:a=!1}){const[c,u]=v.useState(!1),d=p4(e.logs),h=e.logs[0]?.timestamp??new Date().toISOString(),p=e.logs[e.logs.length-1]?.timestamp??new Date().toISOString(),f=HS(e.logs),y=e.logs.some(g=>g.responseStatus===null),m=v.useMemo(()=>f4(e.logs),[e.logs]),x=e.conversationId.startsWith("PID:")||e.conversationId.includes("|")?e.conversationId:e.conversationId.length>24?e.conversationId.slice(0,12)+"…"+e.conversationId.slice(-12):e.conversationId;return l.jsxs("div",{className:"mb-4",children:[!a&&l.jsx(VS,{conversationId:x,startTime:h,endTime:p,totalCalls:e.logs.length,totalInputTokens:d.totalInputTokens,totalOutputTokens:d.totalOutputTokens,apiFormat:WS(e.logs),expanded:c,onToggle:()=>u(!c),hideApiFormat:f,isLoading:y,userAgent:e.logs[0]?.userAgent??null,onClear:()=>i(e.logs.map(g=>g.id))}),d4(a,c)&&l.jsx("div",{children:m.map(g=>l.jsx(u4,{entries:g.entries,viewMode:t,strip:n,cacheTrends:r,onCompareWithPrevious:o,comparisonPredecessors:s,turnIndex:g.turnIndex},g.turnIndex))})]})});function g4({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 $c({...e}){return l.jsx(e_,{"data-slot":"select",...e})}function Bc({...e}){return l.jsx(n_,{"data-slot":"select-value",...e})}function Uc({className:e,size:t="default",children:n,...r}){return l.jsxs(t_,{"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(r_,{asChild:!0,children:l.jsx(yt,{className:"size-4 opacity-50"})})]})}function Zc({className:e,children:t,position:n="popper",align:r="center",...o}){return l.jsx(o_,{children:l.jsxs(s_,{"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(x4,{}),l.jsx(i_,{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(y4,{})]})})}function Xr({className:e,children:t,...n}){return l.jsxs(a_,{"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(c_,{children:l.jsx(sn,{className:"size-4"})})}),l.jsx(l_,{children:t})]})}function x4({className:e,...t}){return l.jsx(u_,{"data-slot":"select-scroll-up-button",className:he("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Uy,{className:"size-4"})})}function y4({className:e,...t}){return l.jsx(d_,{"data-slot":"select-scroll-down-button",className:he("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(yt,{className:"size-4"})})}function v4(){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 b4(){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 w4=ae({name:q(),apiKey:q(),format:lt(["anthropic","openai"]),anthropicBaseUrl:q(),openaiBaseUrl:q(),models:Re(q()),sourceTool:lt(["claude-code","opencode"]),alreadyExists:nt()}),k4=ae({providers:Re(w4),warnings:Re(q()).optional()}),_4=ae({success:nt().optional(),imported:ve().optional(),message:q().optional(),errors:Re(q()).optional()}),S4={"claude-code":v4,opencode:b4};function C4({open:e,onOpenChange:t,onImportComplete:n}){const[r,o]=v.useState(!1),[s,i]=v.useState(null),[a,c]=v.useState([]),[u,d]=v.useState([]),[h,p]=v.useState(new Set),[f,y]=v.useState(!1),[m,x]=v.useState(null),[g,b]=v.useState(null),w=v.useCallback(()=>{o(!0),i(null),d([]),c([]),p(new Set),x(null),b(null),fetch("/api/providers/scan").then(N=>N.ok?N.json().then(T=>{const z=k4.safeParse(T);if(!z.success){i(`Invalid response: ${z.error.message}`);return}c(z.data.providers),d(z.data.warnings??[]);const O=new Set;z.data.providers.forEach((L,E)=>{L.alreadyExists||O.add(E)}),p(O)}):N.text().then(T=>{i(`Scan failed (${N.status}): ${T}`)})).catch(N=>{i(N instanceof Error?N.message:String(N))}).finally(()=>{o(!1)})},[]);v.useEffect(()=>{e&&w()},[e,w]);const S=v.useCallback(N=>{p(T=>{const z=new Set(T);return z.has(N)?z.delete(N):z.add(N),z})},[]),j=v.useCallback(()=>{const N=a.filter((O,L)=>h.has(L));if(N.length===0)return;y(!0),b(null),x(null);const T=new Date().toISOString(),z=N.map(O=>({id:window.crypto.randomUUID(),name:O.name,apiKey:O.apiKey,format:O.format,anthropicBaseUrl:O.anthropicBaseUrl,openaiBaseUrl:O.openaiBaseUrl,models:O.models,createdAt:T,updatedAt:T}));fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providers:z})}).then(O=>O.json()).then(O=>{const L=_4.safeParse(O);if(!L.success){b(`Invalid response: ${L.error.message}`);return}const E=L.data;c(M=>M.map((k,D)=>h.has(D)?{...k,alreadyExists:!0}:k)),p(new Set),E.errors!==void 0&&E.errors.length>0&&E.message!==void 0?x(E.message):x(`Imported ${E.imported??N.length} provider(s)`),n()}).catch(O=>{b(O instanceof Error?O.message:String(O))}).finally(()=>{y(!1)})},[a,h,n]),C=a.some(N=>!N.alreadyExists);return l.jsx(ts,{open:e,onOpenChange:t,children:l.jsxs(ns,{className:"max-w-xl max-h-[80vh] overflow-hidden flex flex-col",children:[l.jsxs(rs,{children:[l.jsx(os,{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(_r,{className:"size-4 animate-spin"}),l.jsx("span",{className:"text-sm",children:"Scanning for external providers..."})]}),s!==null&&l.jsxs("div",{className:"flex items-center gap-2 text-destructive text-sm py-4",children:[l.jsx(kr,{className:"size-4"}),s]}),!r&&s===null&&a.length===0&&l.jsxs("p",{className:"text-sm text-muted-foreground py-8 text-center",children:["No external provider configurations found.",l.jsx("br",{}),l.jsx("span",{className:"text-xs",children:"Supported tools: Claude Code (~/.claude/settings.json), OpenCode (~/.config/opencode/opencode.json)"})]}),!r&&a.map((N,T)=>l.jsxs("label",{className:`flex items-start gap-3 p-3 border rounded-md ${N.alreadyExists?"":"cursor-pointer hover:bg-muted/50"}`,children:[!N.alreadyExists&&l.jsx("input",{type:"checkbox",checked:h.has(T),disabled:f,onChange:()=>S(T),className:"mt-0.5 size-4"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[(()=>{const z=S4[N.sourceTool];return z===void 0?null:l.jsx(z,{})})(),N.alreadyExists&&l.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Already added"})]}),l.jsxs("div",{className:"text-xs text-muted-foreground mt-1 truncate",children:[N.models.slice(0,4).join(", "),N.models.length>4?` +${N.models.length-4} more`:""]}),l.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:N.format==="anthropic"?N.anthropicBaseUrl:N.openaiBaseUrl}),l.jsx("div",{className:"text-xs text-muted-foreground mt-0.5 font-mono",children:N.apiKey.length>8?`${N.apiKey.slice(0,4)}••••${N.apiKey.slice(-4)}`:"••••"})]})]},`${N.sourceTool}-${N.name}`)),u.length>0&&l.jsx("div",{className:"text-xs text-muted-foreground space-y-1 border-t pt-2",children:u.map((N,T)=>l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(kr,{className:"size-3"}),N]},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:w,disabled:r,children:[l.jsx(_r,{className:`size-3 mr-1 ${r?"animate-spin":""}`}),"Rescan"]}),l.jsxs(Xe,{size:"sm",onClick:j,disabled:!C||h.size===0||f,children:[l.jsx(Li,{className:"size-3 mr-1"}),f?"Importing...":`Import Selected (${h.size})`]})]})]})})}function Fp(e){return e.length<=8?"••••••••":e.slice(0,4)+"••••••••"+e.slice(-4)}const j4={deepseek:"https://api-docs.deepseek.com/zh-cn/"};function E4(e){return Object.prototype.hasOwnProperty.call(e,"success")}function N4(e){return Object.prototype.hasOwnProperty.call(e,"notConfigured")}function T4(e){const t={className:"size-3",strokeWidth:2};switch(e){case"timeout":return l.jsx(Oo,{...t});case"network_unreachable":return l.jsx(Zv,{...t});case"connection_refused":return l.jsx(Wv,{...t});case"auth_failed":return l.jsx(yv,{...t});case"rate_limited":return l.jsx(fv,{...t});case"server_error":return l.jsx(Iv,{...t});case"invalid_response":return l.jsx(Yy,{...t});case"unknown":return l.jsx(kr,{...t});default:return l.jsx(kr,{...t})}}function Qr({result:e}){const[t,n]=v.useState(!1);if(!E4(e))return N4(e)?l.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground shrink-0",children:[l.jsx(Bi,{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(rd,{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(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["+",e.cacheCreationInputTokens," cache"]})}),l.jsx(ze,{children:"Tokens cached for reuse, reducing future API cost"})]})},"cache-create")),e.cacheReadInputTokens!==void 0&&e.cacheReadInputTokens>0&&c.push(l.jsx(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["~",e.cacheReadInputTokens," cached"]})}),l.jsx(ze,{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(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsxs("div",{className:"flex items-center gap-1 text-xs text-green-600 shrink-0",children:[l.jsx(Jy,{className:"size-3"}),l.jsx("span",{children:"Connected"}),c.length>0&&l.jsxs("span",{className:"text-muted-foreground",children:["(",u,")"]})]})}),l.jsx(ze,{children:"Connection test passed"})]})})}const r=e.error,o=r?.message??"Connection failed",s=r?.hint,i=r?.details,a=r?.type??"unknown";return l.jsxs("div",{className:"flex flex-col gap-1 shrink-0",children:[l.jsxs("div",{className:"flex items-center gap-1 text-xs text-red-600 max-w-[200px]",children:[T4(a),l.jsx(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsx("span",{className:"truncate",children:o})}),l.jsx(ze,{children:"Connection test failed"})]})}),i!==void 0&&l.jsx(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{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(Fi,{className:"size-3"}):l.jsx($i,{className:"size-3"})})}),l.jsx(ze,{children:t?"Hide error details":"Show detailed error information"})]})})]}),t&&i!==void 0&&l.jsxs("div",{className:"text-xs text-muted-foreground bg-muted/50 rounded p-2 max-w-[300px]",children:[s!==void 0&&l.jsx("div",{className:"mb-1",children:s}),l.jsx("div",{className:"font-mono whitespace-pre-wrap break-all text-red-400/80",children:i})]})]})}function A4(e){const t=Date.now(),n=new Date(e).getTime(),r=t-n,o=Math.floor(r/1e3);if(o<60)return"just now";const s=Math.floor(o/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function I4({provider:e,testResults:t,isTesting:n,testingTimeLeft:r,isHighlighted:o,onEdit:s,onDelete:i,onTest:a}){const[c,u]=v.useState(!1),[d,h]=v.useState(!1),[p,f]=v.useState(!1),y=v.useRef(null),m=v.useRef(void 0);t?.testedAt!==void 0&&t.testedAt!==m.current&&(m.current=t.testedAt,y.current=null);const x=v.useCallback(()=>{f(w=>{const S=!w;return S&&y.current===null&&t?.models!==void 0&&(y.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(j4).find(([w])=>e.name.toLowerCase().includes(w))?.[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(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{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(ze,{children:"Company-provided API key"})]})}),e.source==="personal"&&l.jsx(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{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(ze,{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(iv,{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(w=>l.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:w},w))}),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:Fp(e.apiKey)}),l.jsx("button",{type:"button",onClick:()=>u(w=>!w),className:"text-muted-foreground hover:text-foreground transition-colors p-1","aria-label":c?"Hide API key":"Show API key",children:c?l.jsx(Fi,{className:"size-4"}):l.jsx($i,{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(sn,{className:"size-4 text-green-500"}):l.jsx(wn,{className:"size-4"})})]}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&l.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l.jsxs("div",{className:"text-xs text-muted-foreground min-w-0 flex-1",children:[l.jsx("span",{className:"font-medium",children:"Anthropic:"})," ",l.jsx("span",{className:"truncate",children:e.anthropicBaseUrl})]}),t&&l.jsx(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(Oo,{className:"size-3"}),l.jsxs("span",{children:["Tested ",A4(t.testedAt)]})]}),t?.models!==void 0&&Object.keys(t.models).length>0&&l.jsxs("div",{className:"border-t pt-2",children:[l.jsxs("button",{type:"button",onClick:x,className:"text-xs text-muted-foreground hover:text-foreground transition-colors flex items-center gap-1",children:[l.jsx("span",{className:"font-mono",children:p?"▾":"▸"}),"Model Test Results (",Object.keys(t.models).length,")"]}),p&&l.jsx("div",{className:"mt-2 overflow-x-auto",children:l.jsxs("table",{className:"w-full text-xs border-collapse",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-border",children:[l.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Model"}),e.anthropicBaseUrl!==void 0&&e.anthropicBaseUrl!==""&&l.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"Anthropic"}),e.openaiBaseUrl!==void 0&&e.openaiBaseUrl!==""&&l.jsx("th",{className:"text-left py-1 px-2 font-medium text-muted-foreground",children:"OpenAI"})]})}),l.jsx("tbody",{children:Object.entries(t.models).map(([w,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:w}),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})})]},w))})]})})]}),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(rd,{className:`size-3 ${n??!1?"animate-spin":""}`}),n??!1?r!==void 0?`Testing (${r}s)`:"Testing...":"Test"]}),l.jsxs(Xe,{variant:"outline",size:"sm",onClick:()=>s(e),className:"text-xs h-7 gap-1",disabled:n??!1,children:[l.jsx(Ui,{className:"size-3"}),"Edit"]}),l.jsxs(Xe,{variant:"outline",size:"sm",onClick:()=>i(e.id),className:"text-xs h-7 gap-1 text-destructive hover:text-destructive",disabled:n??!1,children:[l.jsx(id,{className:"size-3"}),"Delete"]})]})]})}const z4={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"}},Vc=["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"],Wc=["glm-5","glm-5.1","qwen3.6-plus","qwen3.7-max"];function P4({provider:e,onSubmit:t,onCancel:n}){const[r,o]=v.useState(e?.name??""),[s,i]=v.useState(e?.apiKey??""),[a,c]=v.useState(!1),[u,d]=v.useState(!1),h=e?.models,[p,f]=v.useState(h!==void 0&&h.length>0?h:[""]),[y,m]=v.useState("anthropic"),[x,g]=v.useState(e?.anthropicBaseUrl??""),[b,w]=v.useState(e?.openaiBaseUrl??""),[S,j]=v.useState(e?.apiDocsUrl??""),[C,N]=v.useState(e?.source),[T,z]=v.useState({}),[O,L]=v.useState(!1),[E,M]=v.useState(null),k=v.useRef([]);v.useEffect(()=>{if(E===null)return;const Y=E;function de(te){if(!(te.target instanceof Node))return;const ce=k.current[Y];ce!=null&&!ce.contains(te.target)&&M(null)}return document.addEventListener("mousedown",de),()=>document.removeEventListener("mousedown",de)},[E]);const[D,G]=v.useState(!1),[W,H]=v.useState(!1),X=r.toLowerCase().includes("minimax"),A=r.toLowerCase().includes("alibaba");function V(){navigator.clipboard.writeText(s).catch(()=>{}),d(!0),setTimeout(()=>d(!1),2e3)}v.useEffect(()=>{e&&(o(e.name),i(e.apiKey),f((e.models?.length??0)>0?e.models:[""]),g(e.anthropicBaseUrl??""),w(e.openaiBaseUrl??""),j(e.apiDocsUrl??""),N(e.source),G(!1),H(!1))},[e]),v.useEffect(()=>{const Y=r.toLowerCase();for(const[de,te]of Object.entries(z4))if(Y.includes(de)){te.format==="anthropic"&&!D?g(te.baseUrl):te.format==="openai"&&!W&&w(te.baseUrl),te.apiDocsUrl!==void 0&&!S&&j(te.apiDocsUrl),de==="minimax"&&p.length===1&&p[0]===""&&f([Vc[0]??""]),de==="alibaba"&&p.length===1&&p[0]===""&&f([Wc[0]??""]);break}},[r]);function Z(){const Y={};return r.trim()||(Y.name="Name is required"),s.trim()||(Y.apiKey="API key is required"),(p.length===0||p.every(de=>!de.trim()))&&(Y.models="At least one model is required"),x.trim()&&!I(x.trim())&&(Y.anthropicBaseUrl="Invalid URL format"),b.trim()&&!I(b.trim())&&(Y.openaiBaseUrl="Invalid URL format"),!x.trim()&&!b.trim()&&(Y.format="At least one format URL (Anthropic or OpenAI) is required"),z(Y),Object.keys(Y).length===0}function I(Y){try{return new URL(Y),!0}catch{return!1}}function oe(Y){if(Y.preventDefault(),!!Z()){L(!0);try{t({name:r.trim(),apiKey:s.trim(),models:p.map(de=>de.trim()).filter(de=>de!==""),anthropicBaseUrl:x.trim()||void 0,openaiBaseUrl:b.trim()||void 0,apiDocsUrl:S.trim()||void 0,source: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=>N(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||s.length===0?s:Fp(s),onChange:Y=>i(Y.target.value),onFocus:()=>{!a&&s.length>0&&c(!0)},placeholder:"sk-ant-...",readOnly:!a&&s.length>0,className:"flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:border-ring focus-visible:outline-ring focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50"}),l.jsx("button",{type:"button",onClick:()=>c(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(Fi,{className:"size-4"}):l.jsx($i,{className:"size-4"})}),l.jsx("button",{type:"button",onClick:V,className:"text-muted-foreground hover:text-foreground transition-colors p-1 shrink-0","aria-label":"Copy API key",children:u?l.jsx(sn,{className:"size-4 text-green-500"}):l.jsx(wn,{className:"size-4"})})]}),T.apiKey!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:T.apiKey})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("label",{className:"text-sm font-medium",children:["Models ",l.jsx("span",{className:"text-destructive",children:"*"})]}),p.map((Y,de)=>l.jsxs("div",{ref:te=>{k.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:()=>M(E===de?null:de),className:"absolute right-1 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors p-1 z-10","aria-label":"Show model suggestions",children:l.jsx(yt,{className:"size-4"})}),E===de&&l.jsx("div",{className:"absolute left-0 right-0 top-full mt-1 z-50 bg-popover border border-border rounded-md shadow-md max-h-48 overflow-y-auto",children:(X?Vc:Wc).map(te=>l.jsx("button",{type:"button",onClick:()=>{f(ce=>{const fe=[...ce];return fe[de]=te,fe}),M(null)},className:"w-full text-left px-3 py-2 text-sm hover:bg-muted transition-colors",children:te},te))})]})]}),p.length>1&&l.jsx("button",{type:"button",onClick:()=>f(te=>te.filter((ce,fe)=>fe!==de)),className:"text-muted-foreground hover:text-destructive transition-colors p-1 shrink-0","aria-label":"Remove model",children:l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[l.jsx("path",{d:"M3 6h18"}),l.jsx("path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"}),l.jsx("path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"})]})})]},de)),l.jsx("button",{type:"button",onClick:()=>f(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(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{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 ${y==="anthropic"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"Anthropic Format"})}),l.jsx(ze,{children:"Anthropic Messages API protocol"})]})}),l.jsx(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{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 ${y==="openai"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:"OpenAI Format"})}),l.jsx(ze,{children:"OpenAI Chat Completions API protocol"})]})})]}),T.format!==void 0&&l.jsx("p",{className:"text-xs text-destructive",children:T.format})]}),y==="anthropic"&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("label",{htmlFor:"provider-anthropic-base-url",className:"text-sm font-medium",children:"Anthropic Base URL"}),l.jsx("input",{id:"provider-anthropic-base-url",type:"text",value:x,onChange:Y=>{G(!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."})]}),y==="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=>{H(!0),w(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=>j(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:O,children:"Cancel"}),l.jsx(Xe,{type:"submit",disabled:O,children:O?"Saving...":e?"Update Provider":"Add Provider"})]})]})}const _i=ae({id:q(),name:q(),apiKey:q(),model:q().optional(),models:Re(q()).min(1),format:lt(["anthropic","openai"]).optional(),baseUrl:q().optional(),anthropicBaseUrl:q().optional(),openaiBaseUrl:q().optional(),authHeader:lt(["bearer","x-api-key"]).optional().default("bearer"),apiDocsUrl:q().optional(),source:lt(["company","personal"]).optional(),createdAt:q(),updatedAt:q()}),R4=lt(["timeout","network_unreachable","connection_refused","auth_failed","rate_limited","server_error","invalid_response","unknown"]),O4=ae({message:q(),type:R4,details:q().optional(),hint:q().optional()}),D4=ae({type:lt(["text","thinking"]),text:q().optional(),thinking:q().optional()}),M4=ae({success:nt(),error:O4.optional(),model:q().optional(),inputTokens:ve().optional(),outputTokens:ve().optional(),cacheCreationInputTokens:ve().optional(),cacheReadInputTokens:ve().optional(),latencyMs:ve().optional(),content:Re(D4).optional(),rawResponse:q().optional(),streaming:nt().optional(),streamingChunks:ae({chunks:Re(Hu),truncated:nt().default(!1)}).optional(),requestHeaders:Wt(q(),q()).optional()}),Hc=Kt([M4,ae({notConfigured:Se(!0)}),ae({testing:Se(!0)})]),To=ae({nonStreaming:Hc,streaming:Hc}),L4=ae({anthropic:To,openai:To}),F4=ae({anthropic:To,openai:To,models:Wt(q(),L4).optional(),testedAt:q().optional()});function $4(){return{anthropic:{nonStreaming:{testing:!0},streaming:{testing:!0}},openai:{nonStreaming:{testing:!0},streaming:{testing:!0}}}}function qc(e,t){const n=()=>({nonStreaming:{success:!1,error:{message:e,type:t}},streaming:{notConfigured:!0}});return{anthropic:n(),openai:n()}}const B4=ae({providerConfig:q()}),U4=ae({success:nt().optional(),imported:ve().optional(),message:q().optional(),errors:Re(q()).optional()}),Z4=30,Zs="Network error: could not reach the server. Is the proxy running?";function Kc(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 V4({externalProviders:e,isLoading:t=!1,externalTestResults:n,externalTestingProviders:r,externalTestingTimeLeft:o,onProvidersMutate:s,onTestResultsChange:i,onTestingProvidersChange:a,onTestingTimeLeftChange:c}){const[u,d]=v.useState(!1),[h,p]=v.useState(),[f,y]=v.useState(null),[m,x]=v.useState({}),[g,b]=v.useState(new Set),[w,S]=v.useState({}),[j,C]=v.useState(null),[N,T]=v.useState(!1),[z,O]=v.useState(null),[L,E]=v.useState(!1),[M,k]=v.useState(!1),[D,G]=v.useState(null),[W,H]=v.useState("all"),X=v.useRef(null),A=v.useRef(null),V=e??[],Z=v.useMemo(()=>{const B=W==="all"?V:V.filter(J=>J.source===W);return W==="all"?[...B].sort((J,$)=>{const ne={personal:0,company:1};return(ne[J.source??""]??2)-(ne[$.source??""]??2)}):B},[V,W]),I=n??m,oe=r??g,Y=o??w,de=c?(B,J)=>c(B,J):(B,J)=>{S(J===void 0?$=>{const ne={...$};return delete ne[B],ne}:$=>({...$,[B]:J}))};v.useEffect(()=>{(async()=>{try{const B=await fetch("/api/config/paths");if(B.ok){const J=await In(B,B4);C(J.providerConfig)}}catch{}})()},[]);const te=v.useCallback(B=>{A.current!==null&&clearTimeout(A.current),O(B),X.current?.scrollTo({top:X.current.scrollHeight,behavior:"smooth"}),A.current=setTimeout(()=>{O(null),A.current=null},2e3)},[]);v.useEffect(()=>()=>{A.current!==null&&clearTimeout(A.current)},[]);const ce=v.useCallback(()=>{s?.().catch(()=>{})},[s]),fe=v.useCallback((B,J)=>{i?i(B,J):x($=>({...$,[B]:J}))},[i]),ge=v.useCallback((B,J)=>{if(a){a(B,J);return}b($=>{const ne=new Set($);return J?ne.add(B):ne.delete(B),ne})},[a]),xe=v.useCallback(async B=>{fe(B,$4()),ge(B,!0);const J=new AbortController;let $=Z4;de(B,$);const ne=setInterval(()=>{$--,de(B,$),$<=0&&(clearInterval(ne),J.abort())},1e3);try{const le=await fetch(`/api/providers/${B}/test`,{method:"POST",signal:J.signal});if(le.ok){const se=await In(le,F4);fe(B,se)}else fe(B,qc(`HTTP ${le.status}: ${le.statusText}`,"server_error"))}catch(le){le instanceof Error&&le.name==="AbortError"&&fe(B,qc("Request timed out","timeout"))}finally{clearInterval(ne),de(B,void 0),ge(B,!1)}},[de,fe,ge]);function Ee(B){(async()=>{try{const J=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Kc(B))});if(!J.ok){y(await eo(J,"Failed to add provider"));return}const $=await In(J,_i);d(!1),te($.id),ce(),await xe($.id)}catch{y(Zs)}})()}function Fe(B){h&&(async()=>{try{const J=await fetch(`/api/providers/${h.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(Kc(B))});if(!J.ok){y(await eo(J,"Failed to update provider"));return}const $=await In(J,_i);p(void 0),te($.id),ce(),((B.apiKey??"")!==(h.apiKey??"")||JSON.stringify(B.models)!==JSON.stringify(h.models)||(B.anthropicBaseUrl??"")!==(h.anthropicBaseUrl??"")||(B.openaiBaseUrl??"")!==(h.openaiBaseUrl??""))&&await xe($.id)}catch{y(Zs)}})()}function _(B){G(B),k(!0)}function ee(){const B=D;B!==null&&(async()=>{let J;try{J=await fetch(`/api/providers/${B}`,{method:"DELETE"})}catch{y(Zs);return}if(!J.ok){y(await eo(J,"Failed to delete provider"));return}ce()})()}const K=v.useRef(null);function R(B){const J="/api/providers/export";(async()=>{try{const $=await fetch(J);if(!$.ok){y("Failed to export providers");return}const ne=await $.blob(),le=URL.createObjectURL(ne),se=document.createElement("a");se.href=le,se.download=$.headers.get("Content-Disposition")?.match(/filename="(.+)"/)?.[1]??"providers.json",document.body.appendChild(se),se.click(),document.body.removeChild(se),URL.revokeObjectURL(le)}catch{y("Failed to export providers")}})()}function P(){K.current?.click()}function F(B){const J=B.target.files?.[0];J&&(async()=>{try{const $=await J.text(),ne=await fetch("/api/providers/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)}),le=await In(ne,U4);ne.ok&&le.imported!==void 0&&le.imported>0?(ce(),y(null)):le.errors&&le.errors.length>0?y(le.errors.join("; ")):y(le.message??"Import failed")}catch{y("Failed to import providers")}B.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(P4,{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(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsxs(Xe,{variant:"outline",size:"sm",onClick:()=>R(),className:"gap-1 hover:bg-muted",children:[l.jsx(Li,{className:"size-3"}),"Export"]})}),l.jsx(ze,{children:"Download providers as JSON for backup or sharing"})]})}),l.jsx(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsxs(Xe,{variant:"outline",size:"sm",onClick:P,className:"gap-1 hover:bg-muted",children:[l.jsx(Fv,{className:"size-3"}),"Import"]})}),l.jsx(ze,{children:"Import providers from an exported JSON file"})]})}),l.jsx("input",{type:"file",ref:K,accept:".json",onChange:F,style:{display:"none"}}),l.jsx(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsxs(Xe,{variant:"outline",size:"sm",onClick:()=>E(!0),className:"gap-1",children:[l.jsx(Tv,{className:"size-3"}),"Scan"]})}),l.jsx(ze,{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(fo,{className:"size-4"}),"Add Provider"]})]})]}),j!==null&&l.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground bg-muted/30 rounded-md px-3 py-2",children:[l.jsx("span",{className:"shrink-0",children:"Config:"}),l.jsx("span",{className:"font-mono truncate",title:j,children:j}),l.jsx(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>{window.navigator.clipboard.writeText(j).then(()=>{T(!0),setTimeout(()=>T(!1),2e3)})},className:"shrink-0 ml-auto text-muted-foreground hover:text-foreground transition-colors",children:N?l.jsx(sn,{className:"size-3 text-green-500"}):l.jsx(wn,{className:"size-3"})})}),l.jsx(ze,{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(kr,{className:"size-4 shrink-0"}),f]}),V.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(fo,{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(B=>l.jsx(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsx("button",{type:"button",onClick:()=>H(B),className:`px-3 py-2 text-sm font-medium border-b-2 transition-colors ${W===B?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"}`,children:B==="all"?"All":B==="personal"?"Personal":"Company"})}),l.jsx(ze,{children:B==="all"?"Show all providers":B==="personal"?"Providers you configured yourself":"Providers set by your organization"})]})},B))}),l.jsx("div",{ref:X,className:"space-y-3",children:Z.map(B=>l.jsx(I4,{provider:B,testResults:I[B.id],isTesting:oe.has(B.id),testingTimeLeft:Y[B.id],isHighlighted:B.id===z,onEdit:J=>p(J),onDelete:_,onTest:J=>{xe(J)}},B.id))})]}),l.jsx(C4,{open:L,onOpenChange:E,onImportComplete:()=>{s!==void 0&&s()}}),l.jsx(Zh,{open:M,onOpenChange:k,title:"Delete Provider",description:"Are you sure you want to delete this provider? This action cannot be undone.",confirmLabel:"Delete",variant:"destructive",onConfirm:ee})]})}async function W4(e){return Mi(e,_i.array(),void 0,t=>`Failed to fetch ${e}: ${t.status}`)}function H4(){const e=nu("/api/providers",W4,{revalidateOnFocus:!1,revalidateIfStale:!1});return{providers:e.data??[],isLoading:e.isLoading,isError:e.error,mutate:e.mutate}}function q4(){const[e,t]=v.useState(!1),[n,r]=v.useState("providers"),{providers:o,isLoading:s,mutate:i}=H4(),[a,c]=v.useState({}),[u,d]=v.useState(new Set),[h,p]=v.useState({}),f=v.useCallback((x,g)=>{c(b=>({...b,[x]:g}))},[]),y=v.useCallback((x,g)=>{d(b=>{const w=new Set(b);return g?w.add(x):w.delete(x),w})},[]),m=v.useCallback((x,g)=>{p(b=>{if(g===void 0){const w={...b};return delete w[x],w}return{...b,[x]:g}})},[]);return l.jsxs(ts,{open:e,onOpenChange:t,children:[l.jsx(FS,{asChild:!0,children:l.jsxs(Xe,{variant:"ghost",size:"icon",className:"size-8",children:[l.jsx(Pv,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Settings"})]})}),l.jsxs(ns,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[l.jsx(rs,{children:l.jsx(os,{children:"Settings"})}),l.jsxs(Rn,{value:n,onValueChange:r,className:"flex-1 overflow-hidden",children:[l.jsxs(On,{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(V4,{externalProviders:o,isLoading:s,externalTestResults:a,externalTestingProviders:u,externalTestingTimeLeft:h,onProvidersMutate:()=>i(),onTestResultsChange:f,onTestingProvidersChange:y,onTestingTimeLeftChange:m})}),l.jsx(tt,{value:"proxy",children:l.jsx(K4,{})})]})]})]})]})}function K4(){const{strip:e,isLoading:t,setStrip:n}=Ku(),[r,o]=v.useState(null),[s,i]=v.useState(!1),a=v.useCallback(async c=>{o(null),i(!0);try{await n(c)}catch(u){o(u instanceof Error?u.message:String(u))}finally{i(!1)}},[n]);return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("h3",{className:"text-sm font-semibold",children:"Claude Code billing header"}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["When enabled, the proxy strips the synthetic ",l.jsx("code",{children:"x-anthropic-billing-header"})," text block that Claude Code prepends to the system prompt before forwarding to upstream. Improves prefix-cache hit rates against third-party upstreams. The default at startup is controlled by the ",l.jsx("code",{children:"LLM_INSPECTOR_STRIP_CLAUDE_CODE_BILLING_HEADER"})," environment variable; your choice is persisted to ",l.jsx("code",{children:"config.json"})," and overrides the env var for subsequent requests."]})]}),l.jsx(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsxs("label",{className:"flex items-center gap-3",children:[l.jsx("input",{type:"checkbox",role:"switch",checked:e,disabled:t||s,onChange:c=>{a(c.currentTarget.checked)},className:"size-4 cursor-pointer disabled:cursor-not-allowed disabled:opacity-50"}),l.jsx("span",{className:"text-sm",children:t?"Loading…":e?"Stripping enabled":"Stripping disabled"})]})}),l.jsx(ze,{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 J4(e){const t=new Map;for(const n of e){const r=n.logs;for(let o=1;o<r.length;o++){const s=r[o-1],i=r[o];s===void 0||i===void 0||t.set(i.id,{creation:Jc(s.cacheCreationInputTokens,i.cacheCreationInputTokens),read:Jc(s.cacheReadInputTokens,i.cacheReadInputTokens)})}}return t}function Jc(e,t){return t===null||e===null?null:t>e?{direction:"up",delta:t-e}:t<e?{direction:"down",delta:e-t}:null}const G4="";function pr(e){if(e.length===0)return G4;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 Y4(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Gc(e){if(typeof e=="string")try{return Ao(JSON.parse(e))}catch{return{kind:"primitive",value:e}}return Ao(e)}function Ao(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=>Ao(t))};if(Y4(e)){const t={};for(const n of Object.keys(e).sort())t[n]=Ao(e[n]);return{kind:"object",value:t}}return{kind:"primitive",value:null}}function X4(e,t){const n=[];return Si([],e,t,n),n}function Si(e,t,n,r){const o=pr(e);if(Ci(t,n)){r.push({kind:"equal",path:o,value:t});return}if(t.kind!==n.kind){r.push({kind:"changed",path:o,left:t,right:n});return}if(t.kind==="primitive"&&n.kind==="primitive"){r.push({kind:"changed",path:o,left:t,right:n});return}if(t.kind==="object"&&n.kind==="object"){const s=Object.keys(t.value),i=Object.keys(n.value),a=new Set(i);for(const c of s){const u=t.value[c];if(u!==void 0)if(!a.has(c))r.push({kind:"removed",path:pr([...e,c]),value:u});else{const d=n.value[c];if(d===void 0)continue;Si([...e,c],u,d,r)}}for(const c of i){if(s.includes(c))continue;const u=n.value[c];u!==void 0&&r.push({kind:"added",path:pr([...e,c]),value:u})}return}if(t.kind==="array"&&n.kind==="array"){const s=Math.min(t.value.length,n.value.length);for(let i=0;i<s;i++){const a=t.value[i],c=n.value[i];a===void 0||c===void 0||Si([...e,i],a,c,r)}for(let i=s;i<n.value.length;i++){const a=n.value[i];a!==void 0&&r.push({kind:"added",path:pr([...e,i]),value:a})}for(let i=s;i<t.value.length;i++){const a=t.value[i];a!==void 0&&r.push({kind:"removed",path:pr([...e,i]),value:a})}}}function Ci(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||!Ci(r,o))return!1}return!0}if(e.kind==="object"&&t.kind==="object"){const n=Object.keys(e.value),r=Object.keys(t.value);if(n.length!==r.length)return!1;for(const o of n){const s=e.value[o],i=t.value[o];if(s===void 0||i===void 0||!Ci(s,i))return!1}return!0}return!1}function Et(e,t=80){let n;switch(e.kind){case"primitive":n=e.value===null?"null":JSON.stringify(e.value);break;case"array":n=`[… ${e.value.length} items]`;break;case"object":n=`{… ${Object.keys(e.value).length} keys}`;break}return n.length>t&&(n=`${n.slice(0,t-1)}…`),n}function io(e,t=2){return JSON.stringify(ji(e),null,t)}function ji(e){switch(e.kind){case"primitive":return e.value;case"array":return e.value.map(ji);case"object":{const t={};for(const[n,r]of Object.entries(e.value))t[n]=ji(r);return t}}}function Yc(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 Xc(e){return e.kind==="equal"&&(e.value.kind==="object"||e.value.kind==="array")}function Q4(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];if(r!==void 0&&Xc(r)){const o=Yc(r.path);let s=n+1;for(;s<e.length;){const i=e[s];if(i===void 0||!Xc(i)||Yc(i.path)!==o)break;s++}if(s-n>1){const i=[];for(let a=n;a<s;a++){const c=e[a];c!==void 0&&c.kind==="equal"&&i.push(c)}t.push({kind:"equal-run",ops:i}),n=s;continue}}r!==void 0&&t.push({kind:"single",op:r}),n++}return t}const $p={added:{icon:fo,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:Bi,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:Ui,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:ov,accent:"text-muted-foreground/70",bg:"bg-muted/20 hover:bg-muted/30",border:"border-l-muted-foreground/20",label:"EQUAL"}};function eT({ops:e,expanded:t,onToggle:n}){const r=e[0],o=e[e.length-1];if(r===void 0||o===void 0)return l.jsx("div",{className:"text-muted-foreground/40 text-xs",children:"—"});const s=r.path,i=o.path,a=e.length===1?s:`${s} … ${i}`,c=r.value.kind==="array"?`${e.length} equal arrays`:r.value.kind==="object"?`${e.length} equal objects`:"equal",u=$p.equal;return l.jsxs("div",{className:he("border-l-4 rounded-sm",u.border,u.bg),children:[l.jsxs("button",{type:"button",onClick:n,className:"w-full text-left flex items-center gap-2 px-3 py-1.5 text-xs text-muted-foreground cursor-pointer",children:[l.jsx(bt,{className:he("size-3 transition-transform shrink-0",t&&"rotate-90")}),l.jsx(u.icon,{className:he("size-3 shrink-0",u.accent)}),l.jsx("span",{className:"font-mono truncate flex-1",title:`${s} … ${i}`,children:a}),l.jsx("span",{className:he("text-[10px] uppercase tracking-wider shrink-0",u.accent),children:u.label}),l.jsxs("span",{className:"text-muted-foreground/60 shrink-0",children:["(",c,")"]})]}),t&&l.jsx("div",{className:"ml-5 mt-1 mb-2 space-y-2 pr-2",children:e.map(d=>l.jsxs("div",{className:"border border-border/50 rounded p-2 bg-muted/20",children:[l.jsx("div",{className:"font-mono text-xs text-muted-foreground mb-1",children:d.path}),l.jsx(fn,{text:io(d.value),defaultExpandDepth:2})]},d.path))})]})}function tT({op:e,idx:t,copiedPath:n,onCopyPath:r,expanded:o,onToggle:s}){const i=$p[e.kind],a=i.icon,c=e.kind==="added"||e.kind==="removed"?e.value.kind==="object"||e.value.kind==="array":e.kind==="changed"?e.left.kind==="object"||e.left.kind==="array"||e.right.kind==="object"||e.right.kind==="array":!1,u=e.kind==="changed"?[{text:Et(e.left,400),tone:"text-rose-700 dark:text-rose-300 line-through"},{text:Et(e.right,400),tone:"text-emerald-700 dark:text-emerald-300"}]:e.kind==="removed"?[{text:Et(e.value,400),tone:"text-rose-700 dark:text-rose-300 line-through"}]:e.kind==="added"?[{text:Et(e.value,400),tone:"text-emerald-700 dark:text-emerald-300"}]:[{text:Et(e.value,400),tone:"text-muted-foreground"}],d=n===e.path&&e.path!=="";return l.jsxs("div",{"data-diff-idx":t,"data-diff-kind":e.kind,className:he("border-l-4 rounded-sm px-3 py-2 my-0.5 transition-colors",i.border,i.bg),children:[l.jsxs("button",{type:"button",onClick:s,disabled:!c,className:he("w-full flex items-center gap-2 text-xs text-left rounded-sm",c?"cursor-pointer":"cursor-default"),"aria-expanded":c?o:void 0,"aria-label":c?o?`Collapse ${e.path||"root"}`:`Expand ${e.path||"root"}`:void 0,children:[c?l.jsx(bt,{className:he("size-3 shrink-0 transition-transform",i.accent,o&&"rotate-90")}):l.jsx("span",{className:"size-3 shrink-0","aria-hidden":"true"}),l.jsx(a,{className:he("size-3.5 shrink-0",i.accent),strokeWidth:2.5}),l.jsx("span",{className:"font-mono truncate flex-1 min-w-0",title:e.path||"(root)",children:e.path===""?"(root)":e.path}),l.jsx("span",{className:he("text-[9px] font-bold uppercase tracking-wider shrink-0 px-1.5 py-0.5 rounded",i.accent,e.kind==="equal"?"bg-muted/40":"bg-background/60"),children:i.label}),e.path!==""&&l.jsx("span",{role:"button",tabIndex:0,onClick:h=>{h.stopPropagation(),r(e.path)},onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.stopPropagation(),h.preventDefault(),r(e.path))},className:he("shrink-0 p-1 rounded transition-colors cursor-pointer inline-flex items-center justify-center",d?"text-emerald-500":"text-muted-foreground/50 hover:text-foreground hover:bg-muted"),"aria-label":d?"Copied":"Copy path",title:d?"Copied!":"Copy path",children:d?l.jsx(sn,{className:"size-3"}):l.jsx(wn,{className:"size-3"})})]}),u.map((h,p)=>l.jsx("div",{className:he("font-mono text-xs mt-1 break-all pl-5",h.tone),children:h.text},p)),l.jsx("div",{className:"overflow-hidden transition-all duration-200",style:{maxHeight:o&&c?"2000px":"0"},"aria-hidden":!o,children:o&&c&&e.kind!=="equal"?l.jsx(nT,{op:e}):null})]})}function nT({op:e}){if(e.kind==="added"||e.kind==="removed")return l.jsx("div",{className:"pl-5 mt-2 border border-border/50 rounded p-2 bg-muted/20",children:l.jsx(fn,{text:io(e.value),defaultExpandDepth:2})});const t=e.left.kind==="object"||e.left.kind==="array",n=e.right.kind==="object"||e.right.kind==="array";return!t&&!n?l.jsx("div",{className:"pl-5 mt-2 text-xs text-muted-foreground/70 italic",children:"Primitive values are shown inline above."}):l.jsxs("div",{className:"pl-5 mt-2 grid grid-cols-1 md:grid-cols-2 gap-2",children:[l.jsxs("div",{className:"border border-rose-500/30 rounded p-2 bg-rose-500/5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-wider text-rose-500 mb-1",children:"Old"}),l.jsx(fn,{text:io(e.left),defaultExpandDepth:2})]}),l.jsxs("div",{className:"border border-emerald-500/30 rounded p-2 bg-emerald-500/5",children:[l.jsx("div",{className:"text-[10px] uppercase tracking-wider text-emerald-500 mb-1",children:"New"}),l.jsx(fn,{text:io(e.right),defaultExpandDepth:2})]})]})}function rT({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(Bi,{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(fo,{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(Ui,{className:"size-3"}),e.changed," changed"]})]})}function oT({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(od,{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(Qu,{className:"size-3"}),"Split"]})]})}function Qc({log:e,side:t}){const n=ko(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 sT({left:e,right:t,onClose:n}){const r=v.useMemo(()=>{const C=Eo(Er(e)).analyzeRequest(e.rawRequestBody),N=Eo(Er(t)).analyzeRequest(t.rawRequestBody),T=Gc(C.comparisonValue),z=Gc(N.comparisonValue);return X4(T,z)},[e.apiFormat,e.path,e.rawRequestBody,t.apiFormat,t.path,t.rawRequestBody]),o=v.useMemo(()=>Q4(r),[r]),s=v.useMemo(()=>{let C=0,N=0,T=0;for(const z of o)if(z.kind==="single")switch(z.op.kind){case"added":C++;break;case"removed":N++;break;case"changed":T++;break}return{added:C,removed:N,changed:T}},[o]),[i,a]=v.useState(new Set),c=C=>{a(N=>{const T=new Set(N);return T.has(C)?T.delete(C):T.add(C),T})},[u,d]=v.useState(new Set),h=C=>{d(N=>{const T=new Set(N);return T.has(C)?T.delete(C):T.add(C),T})};v.useEffect(()=>{d(new Set)},[e.id,t.id]);const[p,f]=v.useState("unified"),y=v.useRef(null),[m,x]=v.useState(null),g=v.useRef(null),b=C=>{window.navigator.clipboard.writeText(C).then(()=>{x(C),g.current!==null&&clearTimeout(g.current),g.current=setTimeout(()=>x(null),1500)})};v.useEffect(()=>()=>{g.current!==null&&clearTimeout(g.current)},[]);const w=C=>{const N=o.findIndex(O=>O.kind==="single"&&O.op.kind===C);if(N===-1)return;const T=y.current;if(T===null)return;const z=T.querySelector(`[data-diff-idx="${N}"]`);z!==null&&z.scrollIntoView({behavior:"smooth",block:"center"})};v.useEffect(()=>{const C=T=>{T.key==="Escape"&&n()};document.addEventListener("keydown",C);const N=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",C),document.body.style.overflow=N}},[n]);const S=ko(e)===ko(t),j=r.length===1&&r[0]?.kind==="equal";return l.jsxs("div",{className:"fixed inset-0 z-50 flex justify-end",role:"dialog","aria-modal":"true","aria-label":"Compare two log requests",children:[l.jsx("button",{type:"button",onClick:n,"aria-label":"Close compare drawer",className:"absolute inset-0 bg-black/40 cursor-default",tabIndex:-1}),l.jsxs("div",{className:he("relative bg-background border-l border-border shadow-xl","w-full md:w-[70vw] max-w-[1100px] flex flex-col h-full"),onClick:C=>C.stopPropagation(),onKeyDown:C=>C.stopPropagation(),children:[l.jsxs("div",{className:"flex items-start gap-4 px-4 py-3 border-b border-border",children:[l.jsxs("div",{className:"flex-1 flex gap-4 min-w-0",children:[l.jsx(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(oT,{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(ad,{className:"size-4"})})]})]}),!S&&l.jsx("div",{className:"px-4 py-1.5 text-xs text-amber-400 bg-amber-500/10 border-b border-border",children:"Heads up: the two selected logs are from different sessions."}),j?l.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto flex items-center justify-center text-muted-foreground text-sm",children:"The two Request payloads are identical."}):l.jsxs(l.Fragment,{children:[l.jsx(rT,{counts:s,onJumpTo:w}),l.jsx("div",{ref:y,className:"flex-1 min-h-0 overflow-y-auto",children:p==="unified"?l.jsx("div",{className:"px-3 py-2 space-y-0.5",children:o.map((C,N)=>{if(C.kind==="equal-run")return l.jsx(eT,{ops:C.ops,expanded:i.has(N),onToggle:()=>c(N)},`r${N}`);const T=C.op;return l.jsx(tT,{op:T,idx:N,copiedPath:m,onCopyPath:b,expanded:u.has(N),onToggle:()=>h(N)},`o${N}`)})}):l.jsx(iT,{grouped:o,left:e,right:t})})]})]})]})}function iT({grouped:e,left:t,right:n}){return l.jsxs("div",{className:"grid grid-cols-[200px_1fr_1fr] gap-x-2 gap-y-0.5 px-3 py-2 text-xs",children:[l.jsxs("div",{className:"grid grid-cols-[200px_1fr_1fr] gap-x-2 col-span-3 pb-2 mb-2 border-b border-border text-[10px] uppercase tracking-wider text-muted-foreground",children:[l.jsx("span",{children:"Path"}),l.jsxs("span",{children:["Left (Log #",t.id,")"]}),l.jsxs("span",{children:["Right (Log #",n.id,")"]})]}),e.map((r,o)=>{if(r.kind==="equal-run")return l.jsxs("div",{className:"col-span-3 px-2 py-1 text-xs text-muted-foreground/60",children:[r.ops.length," equal siblings collapsed — switch to Unified to expand"]},o);const s=r.op;return s.kind==="equal"?l.jsxs("div",{className:"col-span-3 grid grid-cols-[200px_1fr_1fr] gap-x-2 px-2 py-0.5 text-muted-foreground",children:[l.jsx("span",{className:"font-mono text-xs truncate",title:s.path,children:s.path}),l.jsx("span",{className:"font-mono text-xs break-all opacity-60",children:Et(s.value,200)}),l.jsx("span",{className:"font-mono text-xs break-all opacity-60",children:Et(s.value,200)})]},o):s.kind==="added"?l.jsxs("div",{className:"col-span-3 px-2 py-1 rounded text-xs border-l-2 border-l-emerald-400/70 bg-emerald-500/5",children:[l.jsx("div",{className:"font-mono text-xs text-muted-foreground mb-0.5",children:s.path}),l.jsxs("div",{className:"font-mono break-all text-emerald-300/90",children:["+ ",Et(s.value,400)]})]},o):s.kind==="removed"?l.jsxs("div",{className:"col-span-3 px-2 py-1 rounded text-xs border-l-2 border-l-rose-400/70 bg-rose-500/5",children:[l.jsx("div",{className:"font-mono text-xs text-muted-foreground mb-0.5",children:s.path}),l.jsxs("div",{className:"font-mono break-all text-rose-300/90 line-through",children:["− ",Et(s.value,400)]})]},o):l.jsxs("div",{className:"col-span-3 px-2 py-1 rounded text-xs border-l-2 border-l-amber-400/70 bg-amber-500/5",children:[l.jsx("div",{className:"font-mono text-xs text-muted-foreground mb-1",children:s.path}),l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsx("div",{className:"font-mono text-rose-300/90 break-all line-through",children:Et(s.left,400)}),l.jsx("div",{className:"font-mono text-emerald-300/90 break-all",children:Et(s.right,400)})]})]},o)})]})}function aT(e){return e.length<=30?e:e.slice(0,12)+"…"+e.slice(-12)}function lT(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 cT({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 uT({logs:e,sessions:t,models:n,selectedSession:r,selectedModel:o,onSessionChange:s,onModelChange:i,onClearAll:a,onClearGroup:c,viewMode:u,onViewModeChange:d,strip:h}){const{totalIn:p,totalOut:f}=lT(e),[y,m]=v.useState(!1),[x,g]=v.useState(null),[b,w]=v.useState("hidden");v.useEffect(()=>{const k=50+No.length*400,D=setTimeout(()=>w("playing"),50),G=setTimeout(()=>w("done"),k);return()=>{clearTimeout(D),clearTimeout(G)}},[]);const S=v.useCallback(async()=>{m(!0);try{await OS(e)}finally{m(!1)}},[e]),j=v.useRef(null);v.useEffect(()=>{g(null)},[r,o]);const C=v.useCallback(()=>{g(null)},[]),N=v.useMemo(()=>qS(e),[e]),T=v.useMemo(()=>J4(N),[N]),z=v.useMemo(()=>h4(N),[N]),O=v.useCallback(E=>{const M=z.get(E.id);M!==void 0&&g([M,E])},[z]),L=Gu({count:N.length,getScrollElement:()=>j.current,estimateSize:()=>150,measureElement:typeof window<"u"?E=>E.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-end px-6 pt-6 pb-8 relative",children:[l.jsxs("h1",{className:"text-lg font-bold flex items-end gap-2 absolute left-1/2 -translate-x-1/2 whitespace-nowrap",children:[l.jsxs("span",{className:"flex items-end gap-1 group cursor-default","aria-hidden":"true",children:[l.jsx(g4,{className:"size-10 text-amber-500 transition-all duration-300 group-hover:scale-125 group-hover:-translate-y-1.5"}),l.jsx("span",{className:"flex items-end gap-0.5",children:No.map((E,M)=>{const k=["text-amber-500","text-rose-500","text-sky-500","text-emerald-500","text-violet-500","text-orange-500","text-cyan-500","text-pink-500","text-lime-500","text-blue-500","text-yellow-500","text-fuchsia-500"][M],D=b==="hidden"?"opacity-0 scale-0":b==="playing"?"animate-crab-piano-pop":"";return l.jsx(E,{className:`size-5 ${k} transition-all duration-300 ease-out group-hover:scale-125 group-hover:-translate-y-1 ${D}`,style:{transitionDelay:`${M*50}ms`,...b==="playing"?{animationDelay:`${M*400}ms`}:{}}},M)})})]}),l.jsxs("span",{className:"flex items-baseline gap-2",children:["LLM Inspector",l.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["v",MS.version]})]})]}),l.jsx("div",{className:"ml-auto",children:l.jsx(q4,{})})]}),l.jsxs("div",{className:"flex items-center gap-3 px-6 mb-4",children:[l.jsxs($c,{value:r,onValueChange:s,children:[l.jsx(Uc,{className:"flex-1 max-w-[350px] text-xs",children:l.jsx(Bc,{placeholder:"All sessions"})}),l.jsxs(Zc,{children:[l.jsx(Xr,{value:"__all__",children:"All sessions"}),t.map(E=>l.jsx(Xr,{value:E,children:aT(E)},E))]})]}),l.jsxs($c,{value:o,onValueChange:i,children:[l.jsx(Uc,{className:"flex-1 max-w-[250px] text-xs",children:l.jsx(Bc,{placeholder:"All models"})}),l.jsxs(Zc,{children:[l.jsx(Xr,{value:"__all__",children:"All models"}),n.map(E=>l.jsx(Xr,{value:E,children:E},E))]})]}),l.jsx(Le,{children:l.jsxs(Ae,{children:[l.jsx(Ie,{asChild:!0,children:l.jsxs("div",{className:"flex items-center border border-border rounded-md overflow-hidden",children:[l.jsx("button",{type:"button",onClick:()=>d("simple"),className:`px-2 py-1 cursor-pointer transition-colors text-xs ${u==="simple"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Simple"}),l.jsx("button",{type:"button",onClick:()=>d("full"),className:`px-2 py-1 cursor-pointer transition-colors text-xs ${u==="full"?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/50"}`,children:"Full"})]})}),l.jsx(ze,{children:"Simple shows parsed output; Full adds raw headers and tokens"})]})}),l.jsx("div",{className:"flex-1"}),l.jsxs("span",{className:"text-muted-foreground text-xs font-mono",children:[e.length," request",e.length!==1?"s":"",p>0||f>0?` · ${p.toLocaleString()} in / ${f.toLocaleString()} out`:""]}),e.length>0&&l.jsx("button",{type:"button",onClick:()=>{S()},disabled:y,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:y?l.jsx("span",{children:"Exporting..."}):l.jsxs(l.Fragment,{children:[l.jsx(Li,{className:"size-3"}),l.jsx("span",{children:"Export"})]})}),l.jsx("button",{type:"button",onClick:a,className:"text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer",title:"Clear all logs",children:"Clear"})]}),l.jsx("div",{className:"flex-1 min-h-0 px-6 pb-6",children:e.length===0?l.jsxs("div",{className:"text-center text-muted-foreground py-16 space-y-4",children:[l.jsx("p",{className:"text-sm",children:"No requests captured yet."}),l.jsx("p",{className:"text-xs",children:"Route AI coding tools through the proxy:"}),l.jsx(cT,{command:"LLM_BASE_URL=http://localhost:25947/proxy <your-tool>"})]}):l.jsx("div",{ref:j,className:"overflow-y-auto h-full",children:l.jsx("div",{style:{height:`${L.getTotalSize()}px`,width:"100%",position:"relative"},children:L.getVirtualItems().map(E=>{const M=N[E.index];return M===void 0?null:l.jsx("div",{"data-index":E.index,ref:L.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${E.start}px)`},children:l.jsx(m4,{group:M,viewMode:u,strip:h,cacheTrends:T,onCompareWithPrevious:O,comparisonPredecessors:z,onClearGroup:c,standalone:N.length===1})},M.id)})})})}),x!==null&&l.jsx(sT,{left:x[0],right:x[1],onClose:C})]})}ae({logs:Re(Ks),total:ve(),offset:ve(),limit:ve()});const dT=Kt([ae({type:Se("init"),logs:Re(Ks)}),ae({type:Se("update"),log:Ks})]);function eu(e){const t=new Set;for(const n of e)n.sessionId!==null&&n.sessionId!==""&&t.add(n.sessionId);return[...t]}function tu(e){const t=new Set;for(const n of e)n.model!==null&&n.model!==""&&t.add(n.model);return[...t]}function fT(){const[e,t]=v.useState([]),[n,r]=v.useState([]),[o,s]=v.useState([]),[i,a]=v.useState("__all__"),[c,u]=v.useState("__all__"),[d,h]=v.useState("simple"),[p,f]=v.useState(null),y=v.useRef(null),m=v.useRef(null),x=v.useCallback(async()=>{try{const[j,C]=await Promise.all([fetch("/api/sessions"),fetch("/api/models")]);if(j.ok&&C.ok){const N=await j.json(),T=await C.json(),z=Re(q()).safeParse(N),O=Re(q()).safeParse(T);z.success&&r(z.data),O.success&&s(O.data)}}catch{}},[]),g=v.useCallback(()=>{y.current&&y.current.close();const j=new URLSearchParams;i!=="__all__"&&j.set("sessionId",i),c!=="__all__"&&j.set("model",c);const C=new EventSource(`/api/logs/stream?${j}`);y.current=C,C.onmessage=N=>{try{const T=String(N.data),z=JSON.parse(T),O=dT.safeParse(z);if(!O.success){f("Failed to parse SSE data");return}const L=O.data;L.type==="init"?(t(L.logs),r(eu(L.logs)),s(tu(L.logs)),f(null)):L.type==="update"&&(t(E=>{const M=i==="__all__"||L.log.sessionId===i,k=c==="__all__"||L.log.model===c;return!M||!k?E:E.findIndex(G=>G.id===L.log.id)>=0?E.map(G=>G.id===L.log.id?L.log:G):[...E,L.log]}),r(E=>{const M=L.log.sessionId;return M!=null&&M!==""?E.includes(M)?E:[...E,M]:E}),s(E=>{const M=L.log.model;return M!=null&&M!==""?E.includes(M)?E:[...E,M]:E}))}catch{f("Failed to parse SSE data")}},C.onerror=()=>{f("SSE connection lost, reconnecting..."),C.close(),m.current!==null&&clearTimeout(m.current),m.current=setTimeout(g,3e3)},x()},[i,c,x]);v.useEffect(()=>(g(),()=>{y.current&&(y.current.close(),y.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([]),s([]),f(null)}catch(j){f(j instanceof Error?j.message:"Unknown error clearing logs")}})()},[]),w=v.useCallback(j=>{j.length!==0&&(async()=>{try{if(!(await fetch("/api/logs",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:j})})).ok){f("Failed to clear group");return}const N=new Set(j);t(T=>{const z=T.filter(O=>!N.has(O.id));return r(eu(z)),s(tu(z)),z}),f(null)}catch(C){f(C instanceof Error?C.message:"Unknown error clearing group")}})()},[]),{strip:S}=Ku();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(uT,{logs:e,sessions:n,models:o,selectedSession:i,selectedModel:c,onSessionChange:a,onModelChange:u,onClearAll:b,onClearGroup:w,viewMode:d,onViewModeChange:h,strip:S})]})}const mT=fT;export{mT as component};
|