@spikonado/sprocket 0.3.7 → 0.3.8

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.
Files changed (39) hide show
  1. package/README.md +41 -10
  2. package/package.json +6 -6
  3. package/web/_app/immutable/assets/0.DhTAbCoa.css +2 -0
  4. package/web/_app/immutable/assets/2.Dxz0Zeak.css +1 -0
  5. package/web/_app/immutable/chunks/B_0TmK76.js +62 -0
  6. package/web/_app/immutable/chunks/BvmBrUGQ.js +3 -0
  7. package/web/_app/immutable/chunks/CDCDXZ4W.js +1 -0
  8. package/web/_app/immutable/chunks/Dq0ey8RK.js +2 -0
  9. package/web/_app/immutable/chunks/DvSrLZhO.js +1 -0
  10. package/web/_app/immutable/chunks/iGtbSQf_.js +1 -0
  11. package/web/_app/immutable/chunks/qZTzdLCS.js +1 -0
  12. package/web/_app/immutable/entry/app.yCm1GdOR.js +2 -0
  13. package/web/_app/immutable/entry/start.Cs39dtv1.js +1 -0
  14. package/web/_app/immutable/nodes/0.DOQ4pqDO.js +1 -0
  15. package/web/_app/immutable/nodes/1.H42GTsIR.js +1 -0
  16. package/web/_app/immutable/nodes/2.CqaChJCi.js +128 -0
  17. package/web/_app/immutable/nodes/3.cOfENrMd.js +1 -0
  18. package/web/_app/version.json +1 -1
  19. package/web/callback.html +15 -17
  20. package/web/index.html +13 -14
  21. package/web/_app/immutable/assets/0.uuS2feYC.css +0 -2
  22. package/web/_app/immutable/assets/2.TF_ZlfD9.css +0 -1
  23. package/web/_app/immutable/chunks/BVPvmVXQ.js +0 -70
  24. package/web/_app/immutable/chunks/C_wyipFZ.js +0 -1
  25. package/web/_app/immutable/chunks/CcS926TY.js +0 -6
  26. package/web/_app/immutable/chunks/Ch1scEjX.js +0 -1
  27. package/web/_app/immutable/chunks/CirtoWSJ.js +0 -3
  28. package/web/_app/immutable/chunks/DXrJmceD.js +0 -1
  29. package/web/_app/immutable/chunks/DjxnDyxT.js +0 -2
  30. package/web/_app/immutable/chunks/VSK6LhsJ.js +0 -1
  31. package/web/_app/immutable/chunks/mWKhuXx1.js +0 -1
  32. package/web/_app/immutable/entry/app.DjIwt1mA.js +0 -2
  33. package/web/_app/immutable/entry/start.CykVHArZ.js +0 -1
  34. package/web/_app/immutable/nodes/0.DJra_MUP.js +0 -1
  35. package/web/_app/immutable/nodes/1.AaeFkx35.js +0 -1
  36. package/web/_app/immutable/nodes/2.CL3tTr-I.js +0 -129
  37. package/web/_app/immutable/nodes/3.CtfToCj8.js +0 -1
  38. package/web/_app/immutable/nodes/4.BcdvHjG_.js +0 -1
  39. package/web/pair.html +0 -52
@@ -0,0 +1,62 @@
1
+ import{ct as e,lt as t,ut as n}from"./BvmBrUGQ.js";import"./iGtbSQf_.js";var r=`localhost`;`${r}`;function i(e){let t=new URL(e);return t.hostname!==`127.0.0.1`&&t.hostname!==`[::1]`?null:(t.hostname=r,t.toString())}function a(e,t){return t||[`127.0.0.1`,`localhost`,`[::1]`].includes(e)}function o(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function s(e,t=`|`){return e.map(e=>he(e)).join(t)}function c(e,t){return typeof t==`bigint`?t.toString():t}var l=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function u(e){return new l(e)}function d(e){return e==null}function f(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function p(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function m(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ee(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function h(e){return ee(e._zod.def)??e._zod.def.shape}function te(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return m(this,t,e),e},enumerable:!0,configurable:!0})}function ne(e,t,n){t in e?m(e,t,n):e[t]=n}function re(e,t,n,r){let i=h(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?te(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):ne(e,a,r?r(n.value,a):n.value))}}function ie(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?te(e,n,()=>t[n]):ne(e,n,r.value))}}function g(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ae(e){return JSON.stringify(e)}function oe(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var se=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ce(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var le=u(()=>{if(S.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ue(e){if(ce(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ce(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function de(e){return ue(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var fe=new Set([`string`,`number`,`symbol`]);function pe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function me(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function _(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw 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 he(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function ge(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var _e={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ve={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function ye(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return re(i,e,be(e,t)),me(e,g(n,{shape:i,checks:[]}))}function be(e,t){let n=h(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function xe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(be(e,t)),a={};return re(a,e,Reflect.ownKeys(h(e)).filter(e=>!i.has(e))),me(e,g(n,{shape:a,checks:[]}))}function Se(e,t){if(!ue(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=h(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return me(e,g(e._zod.def,{shape:Ce(e,t)}))}function Ce(e,t){let n={};return re(n,e,Reflect.ownKeys(h(e))),ie(n,t),n}function we(e,t){if(!ue(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return me(e,g(e._zod.def,{shape:Ce(e,t)}))}function Te(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return re(n,e,Reflect.ownKeys(h(e))),re(n,t,Reflect.ownKeys(h(t))),me(e,g(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Ee(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(be(t,n)):void 0,o={};return re(o,t,Reflect.ownKeys(h(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),me(t,g(t._zod.def,{shape:o,checks:[]}))}function De(e,t,n){let r=n?new Set(be(t,n)):void 0,i={};return re(i,t,Reflect.ownKeys(h(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),me(t,g(t._zod.def,{shape:i}))}function v(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 Oe(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function ke(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ae(e){return typeof e==`string`?e:e?.message}function je(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function y(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:Ae(e.inst?._zod.def?.error?.(e))??Ae(a?.(e))??Ae(t?.error?.(e))??Ae(n.customError?.(e))??Ae(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Me=/[\uD800-\uDBFF]/;function Ne(e){let t=e.length;if(!Me.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Pe(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Fe(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Ie(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Le(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Ve(e,n,r.value)}}function Re(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function ze(e,t,n){return Re(e,t,n,!1)}function Be(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Re(this,n,r(this))},set(e){Re(this,n,e)}})}return t}function Ve(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Re(this,t,n.bind(this))},set(e){Re(this,t,e)}})}function He(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Ue,We=!1,Ge={configurable:!0,get(){We=!0}};function b(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Ue!==e._zod){Ue=void 0;return}Ue=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Ge);let e=We;We=!1;try{let r=n(this);return We?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),We||=e,r}catch(n){throw delete this[t],We||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Ke(e,t,n,r){let i=He(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var qe=`~constantCatch`;function Je(e){let t=()=>e;return t[qe]=!0,t}var Ye,Xe={value:void 0,enumerable:!1},Ze=`captureStackTrace`in Error?Error:null;function Qe(e){let t=Ze;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Ze=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function x(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Xe.value=new a(r);try{Object.defineProperty(n,"_zod",Xe)}finally{Xe.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),Le(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Qe(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var $e=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},et=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Ye=globalThis).__zod_globalConfig??(Ye.__zod_globalConfig={});var S=globalThis.__zod_globalConfig;function C(e){return e&&Object.assign(S,e),S}function tt(){let e=this._zod;return e.message??=JSON.stringify(e.def,c,2),e.message}function nt(e){this._zod.message=e}var rt={get:tt,set:nt,enumerable:!0,configurable:!0},it={value:void 0,enumerable:!1},at=new WeakSet([Object.prototype,Error.prototype]),ot=(e,t)=>{e.name=`$ZodError`,it.value=t,Object.defineProperty(e,"issues",it),it.value=void 0,Object.defineProperty(e,"message",rt);let n=Object.getPrototypeOf(e);at.has(n)||(at.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},st=x(`$ZodError`,ot);x(`$ZodError`,ot,void 0,{Parent:Error});function ct(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function lt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?ct(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ut(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function dt(e,t){return{callee:t?.callee??e,Err:t?.Err}}var ft=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new $e;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>y(e,o,C())));throw se(n,a?.callee??t),n}return s.value};return t},pt=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>y(e,o,C())));throw se(n,a?.callee??t),n}return s.value};return t},mt=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new $e;return a.issues.length?ht(e,a.issues,i):{success:!0,data:a.value}};function ht(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>y(e,n,C()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var gt=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?ht(e,a.issues,i):{success:!0,data:a.value}},_t=Symbol.for(`zod.compile.invalid`),vt=Symbol.for(`zod.compile.fallback`),yt=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==_t)return!0;if(r.definite===!0&&n===void 0)return!1}return bt(e,t,n)});function bt(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[vt]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new $e;return a.issues.length===0}var xt=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},St=e=>{let t=ft(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,dt(n,a))};return n},Ct=e=>{let t=ft(e),n=(e,r,i,a)=>t(e,r,i,dt(n,a));return n},wt=e=>{let t=pt(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,dt(n,a))};return n},Tt=e=>{let t=pt(e),n=async(e,r,i,a)=>await t(e,r,i,dt(n,a));return n},Et=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return mt(e)(t,n,i)},Dt=e=>(t,n,r)=>mt(e)(t,n,r),Ot=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return gt(e)(t,n,i)},kt=e=>async(t,n,r)=>gt(e)(t,n,r),At=/^[cC][0-9a-z]{6,}$/,jt=/^[0-9a-z]+$/,Mt=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Nt=/^[0-9a-vA-V]{20}$/,Pt=/^[A-Za-z0-9]{27}$/,Ft=/^[a-zA-Z0-9_-]{21}$/;function It(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Lt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Rt=/^([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})$/,zt=e=>e?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)$/,Bt=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Vt=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Ht(){return new RegExp(Vt,`u`)}var Ut=/^(?:(?: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])$/,Wt=/^(([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}|:))$/,Gt=/^((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])$/,Kt=/^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,qt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Jt=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Yt=/^https?$/,Xt=/^\+[1-9]\d{6,14}$/,Zt=`(?:(?:\\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])))`;function Qt(e){return RegExp(`^${e}$`)}var $t=Qt(Zt);function en(e){let 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}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function tn(e){return RegExp(`^${en(e)}$`)}function nn(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${en({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${en({precision:e.precision})}`:n;return RegExp(`^${Zt}T(?:${r})$`)}var rn=/^[\s\S]{0,}$/,an=/^-?\d+$/,on=/^-?\d+(?:\.\d+)?$/,sn=/^(?:true|false)$/i,cn=/^null$/i,ln=/^[^A-Z]*$/,un=/^[^a-z]*$/,w=x(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),dn=e=>{let t=e.value;return!d(t)&&t.length!==void 0},fn={number:`number`,bigint:`bigint`,object:`date`},pn=x(`$ZodCheckLessThan`,(e,t)=>{w.init(e,t);let n=fn[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:fn[typeof r.value]??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})}}),mn=x(`$ZodCheckGreaterThan`,(e,t)=>{w.init(e,t);let n=fn[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:fn[typeof r.value]??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})}}),hn=x(`$ZodCheckMultipleOf`,(e,t)=>{w.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):p(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})}}),gn=x(`$ZodCheckNumberFormat`,(e,t)=>{w.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=_e[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),_n=x(`$ZodCheckMaxLength`,(e,t)=>{var n;w.init(e,t),(n=e._zod.def).when??(n.when=dn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Ne(r):i)<=t.maximum)return;let a=Pe(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),vn=x(`$ZodCheckMinLength`,(e,t)=>{var n;w.init(e,t),(n=e._zod.def).when??(n.when=dn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Ne(r):i)>=t.minimum)return;let a=Pe(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),yn=x(`$ZodCheckLengthEquals`,(e,t)=>{var n;w.init(e,t),(n=e._zod.def).when??(n.when=dn),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Ne(r):i;if(a===t.length)return;let o=Pe(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),bn=x(`$ZodCheckStringFormat`,(e,t)=>{var n,r;w.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),xn=x(`$ZodCheckRegex`,(e,t)=>{bn.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})}}),Sn=x(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ln,bn.init(e,t)}),Cn=x(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=un,bn.init(e,t)}),wn=x(`$ZodCheckIncludes`,(e,t)=>{w.init(e,t);let n=pe(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Tn=x(`$ZodCheckStartsWith`,(e,t)=>{w.init(e,t);let n=RegExp(`^${pe(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),En=x(`$ZodCheckEndsWith`,(e,t)=>{w.init(e,t);let n=RegExp(`.*${pe(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Dn=x(`$ZodCheckOverwrite`,(e,t)=>{w.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),On=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
2
+ `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
3
+ `)}\n};`)(...Object.values(this.closed))}},kn={major:4,minor:6,patch:5},T=x(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=kn;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=v(t),a;for(let o of n){if(o._zod.def.when){if(Oe(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new $e;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(je(t.issues,n,e),i||=v(t,n))});else{if(t.issues.length===n)continue;je(t.issues,n,e),i||=v(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(v(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new $e;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new $e;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return ze(this,`~standard`,Mn(this))},set"~standard"(e){Re(this,`~standard`,e)}}),An=(e,t)=>e.issues.length?{issues:e.issues.map(e=>y(e,t,C()))}:{value:e.value};async function jn(e,t){let n={async:!0};return An(await e._zod.run({value:t,issues:[]},n),n)}function Mn(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return An(r,n)}catch{}return jn(e,t)},vendor:`zod`,version:1}}var Nn=x(`$ZodString`,(e,t)=>{T.init(e,t),e._zod.pattern=t.pattern??rn,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}}),E=x(`$ZodStringFormat`,(e,t)=>{bn.init(e,t),Nn.init(e,t)}),Pn=x(`$ZodGUID`,(e,t)=>{t.pattern??=Rt,E.init(e,t)}),Fn=x(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=zt(e)}else t.pattern??=zt();E.init(e,t)}),In=x(`$ZodEmail`,(e,t)=>{t.pattern??=Bt,E.init(e,t)});function Ln(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Rn(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Ln(e)||2:zn(e,t)}function zn(e,t){if(!t.normalize&&t.protocol?.source===Yt.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var Bn=/[\t\n\r]/g;function Vn(e){return e.replace(Bn,``)}function Hn(e,t){return t.lastIndex=0,t.test(e.hostname)}function Un(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Wn=x(`$ZodURL`,(e,t)=>{E.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Rn(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Vn(r);return}t.hostname&&!Hn(i,t.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&&!Un(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Vn(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Gn=x(`$ZodEmoji`,(e,t)=>{t.pattern??=Ht(),E.init(e,t)}),Kn=x(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?Ft:It(t.length),E.init(e,t)}),qn=x(`$ZodCUID`,(e,t)=>{t.pattern??=At,E.init(e,t)}),Jn=x(`$ZodCUID2`,(e,t)=>{t.pattern??=jt,E.init(e,t)}),Yn=x(`$ZodULID`,(e,t)=>{t.pattern??=Mt,E.init(e,t)}),Xn=x(`$ZodXID`,(e,t)=>{t.pattern??=Nt,E.init(e,t)}),Zn=x(`$ZodKSUID`,(e,t)=>{t.pattern??=Pt,E.init(e,t)}),Qn=x(`$ZodISODateTime`,(e,t)=>{t.pattern??=nn(t),E.init(e,t)}),$n=x(`$ZodISODate`,(e,t)=>{t.pattern??=$t,E.init(e,t)}),er=x(`$ZodISOTime`,(e,t)=>{t.pattern??=tn(t),E.init(e,t)}),tr=x(`$ZodISODuration`,(e,t)=>{t.pattern??=Lt,E.init(e,t)}),nr=x(`$ZodIPv4`,(e,t)=>{t.pattern??=Ut,E.init(e,t)}),rr=/^[0-9a-fA-F:.]+$/;function ir(e){return rr.test(e)?Ln(`http://[${e}]`):!1}var ar=x(`$ZodIPv6`,(e,t)=>{t.pattern??=Wt,E.init(e,t),e._zod.check=n=>{ir(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),or=x(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Gt,E.init(e,t)});function sr(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:ir(n)}var cr=x(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Kt,E.init(e,t),e._zod.check=n=>{sr(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function lr(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var ur=/^[0-9a-zA-Z+/]*={0,2}$/,dr=x(`$ZodBase64`,(e,t)=>{t.pattern??=ur,E.init(e,t),e._zod.check=n=>{lr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),fr=/^[A-Za-z0-9_-]*$/;function pr(e){if(!fr.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return lr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var mr=x(`$ZodBase64URL`,(e,t)=>{t.pattern??=fr,E.init(e,t),e._zod.check=n=>{pr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),hr=x(`$ZodE164`,(e,t)=>{t.pattern??=Xt,E.init(e,t)});function gr(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var _r=x(`$ZodJWT`,(e,t)=>{E.init(e,t),e._zod.check=n=>{gr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),vr=x(`$ZodNumber`,(e,t)=>{T.init(e,t),e._zod.pattern=on,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),yr=x(`$ZodNumberFormat`,(e,t)=>{gn.init(e,t),vr.init(e,t)}),br=x(`$ZodBoolean`,(e,t)=>{T.init(e,t),e._zod.pattern=sn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),xr=x(`$ZodNull`,(e,t)=>{T.init(e,t),e._zod.pattern=cn,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),Sr=x(`$ZodUnknown`,(e,t)=>{T.init(e,t),e._zod.parse=e=>e}),Cr=x(`$ZodNever`,(e,t)=>{T.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function wr(e,t,n){e.issues.length&&t.issues.push(...ke(n,e.issues)),t.value[n]=e.value}var Tr=x(`$ZodArray`,(e,t)=>{T.init(e,t);let n=S.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>wr(t,r,e)));else if(wr(c,r,e),s&&c.issues.length!==0&&v(c))break}return o.length?Promise.all(o).then(()=>r):r}});function Er(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...ke(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Dr=[];function Or(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Dr,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=ge(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function kr(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(v(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Er(e,n,i,t,d,f))):Er(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Ar=x(`$ZodObject`,(e,t)=>{T.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=u(()=>Or(t));b(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||m(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=ce,o=t.catchall,s,c=S.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(v(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Er(n,t,e,r,a,o))):Er(s,t,e,r,a,o)}return o?kr(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),jr=x(`$ZodObjectJIT`,(e,t)=>{Ar.init(e,t);let n=e._zod.parse,r=u(()=>Or(t)),i=S.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new On([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
4
+ let ${e}_ab = false;
5
+ for (let i = 0; i < ${e}.issues.length; i++) {
6
+ const iss = ${e}.issues[i];
7
+ iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
8
+ payload.issues.push(iss);
9
+ if (iss.continue !== true) ${e}_ab = true;
10
+ }
11
+ if (${e}_ab && ctx && ctx.abortEarly) {
12
+ payload.value = newResult;
13
+ return payload;
14
+ }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:ae(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
15
+ const ${n}_present = ${i};
16
+ if (!${n}.issues.length || ${n}_present) {
17
+ if (${n}.issues.length) {${c(n,r)}
18
+ }
19
+
20
+ if (${e}) {
21
+ newResult[${r}] = ${n}.value;
22
+ }
23
+ }
24
+
25
+ `)}else f?(o.write(`
26
+ if (${n}.issues.length) {${c(n,r)}
27
+ }
28
+ `),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
29
+ if (${n}.value !== undefined || ${i}) {
30
+ newResult[${r}] = ${n}.value;
31
+ }
32
+ `)):o.write(`
33
+ const ${n}_present = ${i};
34
+ if (${n}.issues.length) {${c(n,r)}
35
+ }
36
+ if (!${n}_present && !${n}.issues.length) {
37
+ payload.issues.push({
38
+ code: "invalid_type",
39
+ expected: "nonoptional",
40
+ input: undefined,
41
+ path: [${r}]
42
+ });
43
+ if (ctx && ctx.abortEarly) {
44
+ payload.value = newResult;
45
+ return payload;
46
+ }
47
+ }
48
+
49
+ if (${n}_present) {
50
+ newResult[${r}] = ${n}.value;
51
+ }
52
+
53
+ `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=ce,c=!S.jitless,l=c&&le.value,d=t.catchall,f;e._zod.parse=(i,u)=>{f??=r.value;let p=i.value;return s(p)?c&&l&&u?.async===!1&&u.jitless!==!0?(o||=a(t.shape),i=o(i,u),d?kr([],p,i,u,f,e,u?.abortEarly===!0):i):n(i,u):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Mr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!v(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>y(e,r,C())))}),t)}var Nr=x(`$ZodUnion`,(e,t)=>{T.init(e,t),b(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),b(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),b(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),b(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>f(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Mr(t,r,e,i)):Mr(o,r,e,i)}});function Pr(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var Fr=x(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Nr.init(e,t);let n=e._zod.parse;b(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||m(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=ee(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=u(()=>Pr(t));e._zod.parse=(i,a)=>{let o=i.value;if(!ce(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Ir=x(`$ZodIntersection`,(e,t)=>{T.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Rr(e,t,n)):Rr(e,i,a)}});function Lr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ue(e)&&ue(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Lr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Lr(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Rr(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Lr(t.value,n.value);if(!c.valid){if(v(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var zr=x(`$ZodRecord`,(e,t)=>{T.init(e,t);let n=S.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!ue(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>y(e,i,C())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...ke(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...ke(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&on.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>y(e,i,C())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...ke(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...ke(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Br=x(`$ZodEnum`,(e,t)=>{T.init(e,t);let n=o(t.entries),r=new Set(n);e._zod.values=r,b(e,`pattern`,e=>{let t=o(e.def.entries).filter(e=>fe.has(typeof e));return RegExp(t.length?`^(${t.map(e=>pe(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Vr=x(`$ZodLiteral`,(e,t)=>{T.init(e,t);let n=new Set(t.values);e._zod.values=n,b(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?pe(e):e?pe(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Hr=x(`$ZodTransform`,(e,t)=>{T.init(e,t),e._zod.optin=`optional`,S.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new et(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new $e;return n.value=i,n}});function Ur(e,t){return e.value=t.issues.length?void 0:t.value,e}var Wr=x(`$ZodOptional`,(e,t)=>{T.init(e,t),b(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,b(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),b(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${f(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Ur(e,t)):Ur(e,r)}return t.innerType._zod.run(e,n)}}),Gr=x(`$ZodExactOptional`,(e,t)=>{Wr.init(e,t),b(e,`values`,e=>e.def.innerType._zod.values),b(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Kr=x(`$ZodNullable`,(e,t)=>{T.init(e,t),b(e,`optin`,e=>e.def.innerType._zod.optin),b(e,`optout`,e=>e.def.innerType._zod.optout),b(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${f(t.source)}|null)$`):void 0}),b(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),qr=x(`$ZodDefault`,(e,t)=>{T.init(e,t),e._zod.optin=`defaulted`,b(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Jr(e,t)):Jr(r,t)}});function Jr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Yr=x(`$ZodPrefault`,(e,t)=>{T.init(e,t),e._zod.optin=`defaulted`,b(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Xr=x(`$ZodNonOptional`,(e,t)=>{T.init(e,t),b(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Zr(t,e)):Zr(i,e)}});function Zr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Qr(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>y(e,r,C()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var $r=x(`$ZodCatch`,(e,t)=>{T.init(e,t),b(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),b(e,`optout`,e=>e.def.innerType._zod.optout),b(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Qr(e,r,t,n)):Qr(e,r,t,n)}}),ei=x(`$ZodPipe`,(e,t)=>{T.init(e,t),b(e,`values`,e=>e.def.in._zod.values),b(e,`optin`,e=>e.def.in._zod.optin),b(e,`optout`,e=>e.def.out._zod.optout),b(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>ti(e,t.in,n)):ti(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>ti(e,t.out,n)):ti(r,t.out,n)}});function ti(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var ni=x(`$ZodReadonly`,(e,t)=>{T.init(e,t),b(e,`propValues`,e=>e.def.innerType._zod.propValues),b(e,`values`,e=>e.def.innerType._zod.values),b(e,`optin`,e=>e.def.innerType?._zod?.optin),b(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(ri):ri(r)}});function ri(e){return e.memo||(e.value=Object.freeze(e.value)),e}var ii=x(`$ZodCustom`,(e,t)=>{w.init(e,t),T.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>ai(t,n,r,e));ai(i,n,r,e)}});function ai(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Ie(e))}}var oi=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},si=`~memo`,ci=[];function li(e){return typeof e==`object`&&!!e}function ui(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var di=new WeakMap,fi=0,pi=1,mi=2;function hi(e,t,n){let r=di.get(e);if(r!==void 0)return r?mi:fi;if(t.has(e))return mi;t.add(e);let i=fi,a=e=>{if(i!==mi&&e?._zod){let r=hi(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=fi;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?pi:o.value?._zod?hi(o.value,t,n):fi;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=ee(c);s(e?o(e,!0):pi),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?hi(r,t,!1):pi);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),gi(e,i)}function gi(e,t){return t!==pi&&di.set(e,t===mi),t}function _i(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var vi,yi=[],bi={alloc(e,t,n){let r=vi;if(!r)return n;vi=void 0;let i={value:n,issues:null};return r.set(t.value,i),yi.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Si(n,e.value))throw new oi;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=hi(e,new Set,!1);if(i===fi)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===mi||r?n=!0:r=!0}let l=s.value;if(!li(l))return t(s,c);let u=c[si];u||(u={buckets:new WeakMap,backEdges:void 0},c[si]=u);let d;i===c?d=a:(d=_i(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...ui(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;vi=d;let p=yi.length,m=t(s,c);vi=void 0;let ee=yi.length>p?yi.pop():void 0;return m instanceof Promise?m.then(e=>(ee&&(ee.issues=e.issues.length?ui(e.issues):ci),e)):(ee&&(ee.issues=m.issues.length?ui(m.issues):ci),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function xi(){return bi}function Si(e,t){let n=e[si]?.backEdges;return n!==void 0&&li(t)&&n.has(t)}var Ci=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Fe(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${he(e.values[0])}`:`Invalid option: expected one of ${s(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${s(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function wi(){return{localeError:Ci()}}var Ti,Ei=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Di(){return new Ei}(Ti=globalThis).__zod_globalRegistry??(Ti.__zod_globalRegistry=Di());var Oi=globalThis.__zod_globalRegistry;function ki(e){return e.checks&&=[...e.checks],e}function Ai(e,t){return new e(ki({type:`string`,..._(t)}))}function ji(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,..._(t)})}function Mi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,..._(t)})}function Ni(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,..._(t)})}function Pi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,..._(t)})}function Fi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,..._(t)})}function Ii(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,..._(t)})}function Li(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,..._(t)})}function Ri(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,..._(t)})}function zi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,..._(t)})}function Bi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,..._(t)})}function Vi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,..._(t)})}function Hi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,..._(t)})}function Ui(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,..._(t)})}function Wi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,..._(t)})}function Gi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,..._(t)})}function Ki(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,..._(t)})}function qi(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,..._(t)})}function Ji(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,..._(t)})}function Yi(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,..._(t)})}function Xi(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,..._(t)})}function Zi(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,..._(t)})}function Qi(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,..._(t)})}function $i(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,..._(t)})}function ea(e,t){return new e({type:`string`,format:`date`,check:`string_format`,..._(t)})}function ta(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,..._(t)})}function na(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,..._(t)})}function ra(e,t){return new e(ki({type:`number`,checks:[],..._(t)}))}function ia(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,..._(t)})}function aa(e,t){return new e({type:`boolean`,..._(t)})}function oa(e,t){return new e({type:`null`,..._(t)})}function sa(e){return new e({type:`unknown`})}function ca(e,t){return new e({type:`never`,..._(t)})}function la(e,t){return new pn({check:`less_than`,..._(t),value:e,inclusive:!1})}function ua(e,t){return new pn({check:`less_than`,..._(t),value:e,inclusive:!0})}function da(e,t){return new mn({check:`greater_than`,..._(t),value:e,inclusive:!1})}function fa(e,t){return new mn({check:`greater_than`,..._(t),value:e,inclusive:!0})}function pa(e,t){return new hn({check:`multiple_of`,..._(t),value:e})}function ma(e,t){return new _n({check:`max_length`,..._(t),maximum:e})}function ha(e,t){return new vn({check:`min_length`,..._(t),minimum:e})}function ga(e,t){return new yn({check:`length_equals`,..._(t),length:e})}function _a(e,t){return new xn({check:`string_format`,format:`regex`,..._(t),pattern:e})}function va(e){return new Sn({check:`string_format`,format:`lowercase`,..._(e)})}function ya(e){return new Cn({check:`string_format`,format:`uppercase`,..._(e)})}function ba(e,t){return new wn({check:`string_format`,format:`includes`,..._(t),includes:e})}function xa(e,t){return new Tn({check:`string_format`,format:`starts_with`,..._(t),prefix:e})}function Sa(e,t){return new En({check:`string_format`,format:`ends_with`,..._(t),suffix:e})}function Ca(e){return new Dn({check:`overwrite`,tx:e})}function wa(e){return Ca(t=>t.normalize(e))}function Ta(){return Ca(e=>e.trim())}function Ea(){return Ca(e=>e.toLowerCase())}function Da(){return Ca(e=>e.toUpperCase())}function Oa(){return Ca(e=>oe(e))}function ka(e,t,n){return new e({type:`array`,element:t,..._(n)})}function Aa(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,..._(n)})}function ja(e,t){let n=Ma(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Ie(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Ie(r))}},e(t.value,t)),t);return n}function Ma(e,t){let n=new w({check:`custom`,..._(t)});return n._zod.check=e,n}function Na(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&m(e,t,n[t]);return e}function Pa(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??Oi,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function D(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function O(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,O(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Na(o.schema,c),t.io===`input`&&k(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Fa(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Ia(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Fa(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Fa(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
54
+
55
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function La(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;La(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Ra=new Set([`type`,`properties`,`required`,`additionalProperties`]),za=[`oneOf`,`anyOf`];function Ba(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Va(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Ra.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Ba(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}m(n,r,e.length===1?e[0]:Va(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Ba(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Ha(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Ra)if(t in e)return;let n=t.filter(e=>za.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Va(t);else{let e=n[0],i=za.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Va([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Na(e,r))}function Ua(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Na(i,s),Na(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())La(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Ha(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Na(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,m(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Ga(t,`input`,e.processors),output:Ga(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function k(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return k(r.element,n);if(r.type===`set`)return k(r.valueType,n);if(r.type===`lazy`)return k(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`||r.type===`catch`)return k(r.innerType,n);if(r.type===`intersection`)return k(r.left,n)||k(r.right,n);if(r.type===`record`||r.type===`map`)return k(r.keyType,n)||k(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:k(r.in,n)||k(r.out,n);if(r.type===`object`){for(let e in r.shape)if(k(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(k(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(k(e,n))return!0;return!!(r.rest&&k(r.rest,n))}return!1}var Wa=(e,t={})=>n=>{let r=Pa({...n,processors:t});return O(e,r),Ia(r,e),Ua(r,e)},Ga=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Pa({...i??{},target:a,io:t,processors:n});return O(e,o),Ia(o,e),Ua(o,e)},Ka=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},qa=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Ja=(e,t)=>{Ka(e,`minimum`,t),qa(e,`maximum`,t)},Ya=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Xa=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Za=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Qa=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},$a=(e,t)=>Ka(e,`minimum`,t.minimum),eo=(e,t)=>qa(e,`maximum`,t.maximum),to=e=>(t,n)=>{Qa(t,n.format);let[r,i]=e[n.format];Ka(t,`minimum`,r),qa(t,`maximum`,i)},no={greater_than:(e,t)=>Ka(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>qa(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Ya(e,t.value),number_format:to(_e),bigint_format:to(ve),min_length:$a,max_length:eo,length_equals:(e,t)=>Ja(e,t.length),min_size:$a,max_size:eo,size_equals:(e,t)=>Ja(e,t.size),string_format:(e,t)=>{Qa(e,t.format),t.pattern&&Xa(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Za(e,t.mime)};function A(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)no[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Ka(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Ka(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&qa(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&qa(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Ya(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Za(t,i.mime);for(let e of i.patterns??[])Xa(t,e);return t}var ro={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},io=new Map([[ur,qt],[fr,Jt]]),ao=e=>io.get(e)??e,oo=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=A(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=ro[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(ao);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},so=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=A(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):D(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},co=(e,t,n,r)=>{n.type=`boolean`},lo=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},uo=(e,t,n,r)=>{n.not={}},fo=(e,t,n,r)=>{let i=e._zod.def,a=o(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},po=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(D(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(D(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},mo=(e,t,n,r)=>{D(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},ho=(e,t,n,r)=>{D(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},go=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=A(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=O(a.element,t,{...r,path:[...r.path,`items`]})};function _o(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?_o(t.out):t.type===`catch`?_o(t.innerType):e._zod.optin}var vo=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&D(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)m(i.properties,e,O(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?_o(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=O(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},yo=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>O(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},bo=(e,t,n,r)=>{let i=e._zod.def,a=O(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=O(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function xo(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=xo(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>xo(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?on:an).source),p):p}var So=new WeakMap;function Co(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of So.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=xo(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var wo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=A(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=O(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)m(i.patternProperties,ao(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=O(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=So.get(t);n||(n=[],So.set(t,n),t.deferred.push(()=>Co(t))),n.push(e)}i.additionalProperties=O(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&_o(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},To=(e,t,n,r)=>{let i=e._zod.def,a=O(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Eo=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Do=Symbol();function Oo(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(D(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Do):JSON.parse(o)}var ko=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Oo(i.defaultValue,e,t,n,r);o!==Do&&(n.default=o)},Ao=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Oo(i.defaultValue,e,t,n,r);o!==Do&&(n._prefault=o)},jo=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{D(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Mo=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;O(o,t,r);let s=t.seen.get(e);s.ref=o},No=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Po=(e,t,n,r)=>{let i=e._zod.def;O(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Fo=new WeakSet([Object.prototype,Error.prototype]);function Io(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var j=x(`ZodError`,(e,t)=>{st.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Fo.has(n)||(Fo.add(n),Io(n,`format`,e=>t=>ut(e,t)),Io(n,`flatten`,e=>t=>lt(e,t)),Io(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,c,2)}),Io(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,c,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Lo=ft(j),Ro=pt(j),zo=mt(j),Bo=gt(j),Vo=St(j),Ho=Ct(j),Uo=wt(j),Wo=Tt(j),Go=Et(j),Ko=Dt(j),qo=Ot(j),Jo=kt(j);function Yo(){S.localeError||C(wi())}function Xo(){S.memoizer||C({memoizer:xi()})}var M=x(`ZodType`,(e,t)=>(Yo(),T.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(g(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return me(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(hc(e,t))},superRefine(e,t){return this.check(gc(e,t))},overwrite(e){return this.check(Ca(e))},optional(){return Zs(this)},exactOptional(){return $s(this)},nullable(){return tc(this)},nullish(){return Zs(tc(this))},nonoptional(e){return sc(this,e)},array(){return L(this)},or(e){return Rs([this,e])},and(e){return Hs(this,e)},transform(e){return dc(this,Ys(e))},default(e){return rc(this,e)},prefault(e){return ac(this,e)},catch(e){return lc(this,e)},pipe(e){return dc(this,e)},readonly(){return pc(this)},describe(e){let t=this.clone();return Oi.add(t,{description:e}),t},meta(...e){if(e.length===0)return Oi.get(this);let t=this.clone();return Oi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return ze(this,`~standard`,{...Mn(this),jsonSchema:{input:Ga(this,`input`),output:Ga(this,`output`)}})},set"~standard"(e){Re(this,`~standard`,e)},parse:function e(t,n){return Lo(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Ro(this,t,n,{callee:e})},safeParse(e,t){return zo(this,e,t)},async safeParseAsync(e,t){return Bo(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Re(this,`spa`,e)},validate(e,t){return yt(this,e,t)},validateAsync(e,t){return xt(this,e,t)},encode:function e(t,n){return Vo(this,t,n,{callee:e})},decode:function e(t,n){return Ho(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Uo(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Wo(this,t,n,{callee:e})},safeEncode(e,t){return Go(this,e,t)},safeDecode(e,t){return Ko(this,e,t)},async safeEncodeAsync(e,t){return qo(this,e,t)},async safeDecodeAsync(e,t){return Jo(this,e,t)},toJSONSchema(e){return Wa(this,{})(e)},get description(){return Oi.get(this)?.description},get _def(){return this._zod.def}}),Zo=x(`_ZodString`,(e,t)=>{Nn.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,n,r)},Be({format:e=>A(e).format??null,minLength:e=>A(e).minimum??null,maxLength:e=>A(e).maximum??null},{regex(...e){return this.check(_a(...e))},includes(...e){return this.check(ba(...e))},startsWith(...e){return this.check(xa(...e))},endsWith(...e){return this.check(Sa(...e))},min(...e){return this.check(ha(...e))},max(...e){return this.check(ma(...e))},length(...e){return this.check(ga(...e))},nonempty(...e){return this.check(ha(1,...e))},lowercase(e){return this.check(va(e))},uppercase(e){return this.check(ya(e))},trim(){return this.check(Ta())},normalize(...e){return this.check(wa(...e))},toLowerCase(){return this.check(Ea())},toUpperCase(){return this.check(Da())},slugify(){return this.check(Oa())}})),Qo=x(`ZodString`,(e,t)=>{Nn.init(e,t),Zo.init(e,t)},{email(e){return this.check(ji(rs,e))},url(e){return this.check(Li(ss,e))},jwt(e){return this.check(Qi(Cs,e))},emoji(e){return this.check(Ri(ls,e))},guid(e){return this.check(Mi(as,e))},uuid(e){return this.check(Ni(os,e))},uuidv4(e){return this.check(Pi(os,e))},uuidv6(e){return this.check(Fi(os,e))},uuidv7(e){return this.check(Ii(os,e))},nanoid(e){return this.check(zi(us,e))},cuid(e){return this.check(Bi(ds,e))},cuid2(e){return this.check(Vi(fs,e))},ulid(e){return this.check(Hi(ps,e))},base64(e){return this.check(Yi(bs,e))},base64url(e){return this.check(Xi(xs,e))},xid(e){return this.check(Ui(ms,e))},ksuid(e){return this.check(Wi(hs,e))},ipv4(e){return this.check(Gi(gs,e))},ipv6(e){return this.check(Ki(_s,e))},cidrv4(e){return this.check(qi(vs,e))},cidrv6(e){return this.check(Ji(ys,e))},e164(e){return this.check(Zi(Ss,e))},datetime(e){return this.check($i($o,e))},date(e){return this.check(ea(es,e))},time(e){return this.check(ta(ts,e))},duration(e){return this.check(na(ns,e))}});function N(e){return Ai(Qo,e)}var P=x(`ZodStringFormat`,(e,t)=>{E.init(e,t),Zo.init(e,t)}),$o=x(`ZodISODateTime`,(e,t)=>{Qn.init(e,t),P.init(e,t)}),es=x(`ZodISODate`,(e,t)=>{$n.init(e,t),P.init(e,t)}),ts=x(`ZodISOTime`,(e,t)=>{er.init(e,t),P.init(e,t)}),ns=x(`ZodISODuration`,(e,t)=>{tr.init(e,t),P.init(e,t)}),rs=x(`ZodEmail`,(e,t)=>{In.init(e,t),P.init(e,t)});function is(e){return ji(rs,e)}var as=x(`ZodGUID`,(e,t)=>{Pn.init(e,t),P.init(e,t)}),os=x(`ZodUUID`,(e,t)=>{Fn.init(e,t),P.init(e,t)}),ss=x(`ZodURL`,(e,t)=>{Wn.init(e,t),P.init(e,t)});function cs(e){return Li(ss,e)}var ls=x(`ZodEmoji`,(e,t)=>{Gn.init(e,t),P.init(e,t)}),us=x(`ZodNanoID`,(e,t)=>{Kn.init(e,t),P.init(e,t)}),ds=x(`ZodCUID`,(e,t)=>{qn.init(e,t),P.init(e,t)}),fs=x(`ZodCUID2`,(e,t)=>{Jn.init(e,t),P.init(e,t)}),ps=x(`ZodULID`,(e,t)=>{Yn.init(e,t),P.init(e,t)}),ms=x(`ZodXID`,(e,t)=>{Xn.init(e,t),P.init(e,t)}),hs=x(`ZodKSUID`,(e,t)=>{Zn.init(e,t),P.init(e,t)}),gs=x(`ZodIPv4`,(e,t)=>{nr.init(e,t),P.init(e,t)}),_s=x(`ZodIPv6`,(e,t)=>{ar.init(e,t),P.init(e,t)}),vs=x(`ZodCIDRv4`,(e,t)=>{or.init(e,t),P.init(e,t)}),ys=x(`ZodCIDRv6`,(e,t)=>{cr.init(e,t),P.init(e,t)}),bs=x(`ZodBase64`,(e,t)=>{dr.init(e,t),P.init(e,t)}),xs=x(`ZodBase64URL`,(e,t)=>{mr.init(e,t),P.init(e,t)}),Ss=x(`ZodE164`,(e,t)=>{hr.init(e,t),P.init(e,t)}),Cs=x(`ZodJWT`,(e,t)=>{_r.init(e,t),P.init(e,t)}),ws=x(`ZodNumber`,(e,t)=>{vr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r),e.isFinite=!0},Be({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=A(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=A(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=A(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>A(e).format??null},{gt(e,t){return this.check(da(e,t))},gte(e,t){return this.check(fa(e,t))},min(e,t){return this.check(fa(e,t))},lt(e,t){return this.check(la(e,t))},lte(e,t){return this.check(ua(e,t))},max(e,t){return this.check(ua(e,t))},int(e){return this.check(F(e))},safe(e){return this.check(F(e))},positive(e){return this.check(da(0,e))},nonnegative(e){return this.check(fa(0,e))},negative(e){return this.check(la(0,e))},nonpositive(e){return this.check(ua(0,e))},multipleOf(e,t){return this.check(pa(e,t))},step(e,t){return this.check(pa(e,t))},finite(){return this}}));function Ts(e){return ra(ws,e)}var Es=x(`ZodNumberFormat`,(e,t)=>{yr.init(e,t),ws.init(e,t)});function F(e){return ia(Es,e)}var Ds=x(`ZodBoolean`,(e,t)=>{br.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(e,t,n,r)});function I(e){return aa(Ds,e)}var Os=x(`ZodNull`,(e,t)=>{xr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(e,t,n,r)});function ks(e){return oa(Os,e)}var As=x(`ZodUnknown`,(e,t)=>{Sr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function js(){return sa(As)}var Ms=x(`ZodNever`,(e,t)=>{Cr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r)});function Ns(e){return ca(Ms,e)}var Ps=x(`ZodArray`,(e,t)=>{Xo(),Tr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r),e.element=t.element},{min(e,t){return this.check(ha(e,t))},nonempty(e){return this.check(ha(1,e))},max(e,t){return this.check(ma(e,t))},length(e,t){return this.check(ga(e,t))},unwrap(){return this.element}});function L(e,t){return ka(Ps,e,t)}var Fs=x(`ZodObject`,(e,t)=>{Xo(),jr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vo(e,t,n,r),Ke(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Ks(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(g(this._zod.def,{catchall:e}))},passthrough(){return this.clone(g(this._zod.def,{catchall:js()}))},loose(){return this.clone(g(this._zod.def,{catchall:js()}))},strict(){return this.clone(g(this._zod.def,{catchall:Ns()}))},strip(){return this.clone(g(this._zod.def,{catchall:void 0}))},extend(e){return Se(this,e)},safeExtend(e){return we(this,e)},merge(e){return Te(this,e)},pick(e){return ye(this,e)},omit(e){return xe(this,e)},partial(...e){return Ee(Xs,this,e[0])},exactPartial(...e){return Ee(Qs,this,e[0],`exactPartial`)},required(...e){return De(oc,this,e[0])}});function R(e,t){return new Fs({type:`object`,shape:e??{},..._(t)})}function Is(e,t){return new Fs({type:`object`,shape:e,catchall:js(),..._(t)})}var Ls=x(`ZodUnion`,(e,t)=>{Nr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yo(e,t,n,r),e.options=t.options});function Rs(e,t){return new Ls({type:`union`,options:e,..._(t)})}var zs=x(`ZodDiscriminatedUnion`,(e,t)=>{Ls.init(e,t),Fr.init(e,t)});function Bs(e,t,n){return new zs({type:`union`,options:t,discriminator:e,..._(n)})}var Vs=x(`ZodIntersection`,(e,t)=>{Ir.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r)});function Hs(e,t){return new Vs({type:`intersection`,left:e,right:t})}var Us=x(`ZodRecord`,(e,t)=>{Xo(),zr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Ws(e,t,n){return!t||!t._zod?new Us({type:`record`,keyType:N(),valueType:e,..._(t)}):new Us({type:`record`,keyType:e,valueType:t,..._(n)})}var Gs=x(`ZodEnum`,(e,t)=>{Br.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Gs({...t,checks:[],..._(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Gs({...t,checks:[],..._(r),entries:i})}});function Ks(e,t){return new Gs({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,..._(t)})}var qs=x(`ZodLiteral`,(e,t)=>{Vr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function z(e,t){return new qs({type:`literal`,values:Array.isArray(e)?e:[e],..._(t)})}var Js=x(`ZodTransform`,(e,t)=>{Xo(),Hr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new et(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ie(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Ie(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Ys(e){return new Js({type:`transform`,transform:e})}var Xs=x(`ZodOptional`,(e,t)=>{Wr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Zs(e){return new Xs({type:`optional`,innerType:e})}var Qs=x(`ZodExactOptional`,(e,t)=>{Gr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $s(e){return new Qs({type:`optional`,innerType:e})}var ec=x(`ZodNullable`,(e,t)=>{Kr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function tc(e){return new ec({type:`nullable`,innerType:e})}var nc=x(`ZodDefault`,(e,t)=>{qr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function rc(e,t){return new nc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():de(t)}})}var ic=x(`ZodPrefault`,(e,t)=>{Yr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ac(e,t){return new ic({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():de(t)}})}var oc=x(`ZodNonOptional`,(e,t)=>{Xr.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function sc(e,t){return new oc({type:`nonoptional`,innerType:e,..._(t)})}var cc=x(`ZodCatch`,(e,t)=>{$r.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function lc(e,t){return new cc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Je(t)})}var uc=x(`ZodPipe`,(e,t)=>{ei.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e.in=t.in,e.out=t.out});function dc(e,t){return new uc({type:`pipe`,in:e,out:t})}var fc=x(`ZodReadonly`,(e,t)=>{ni.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function pc(e){return new fc({type:`readonly`,innerType:e})}var mc=x(`ZodCustom`,(e,t)=>{ii.init(e,t),M.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mo(e,t,n,r)});function hc(e,t={}){return Aa(mc,e,t)}function gc(e,t){return ja(e,t)}var _c=Symbol.for(`functionName`),vc=Symbol.for(`toReferencePath`);function yc(e){return e[vc]??null}function bc(e){return e.startsWith(`function://`)}function xc(e){let t;if(typeof e==`string`)t=bc(e)?{functionHandle:e}:{name:e};else if(e[_c])t={name:e[_c]};else{let n=yc(e);if(!n)throw Error(`${e} is not a functionReference`);t={reference:n}}return t}function Sc(e){let t=xc(e);if(t.name===void 0)throw t.functionHandle===void 0?t.reference===void 0?Error(`Expected function reference like "api.file.func" or "internal.file.func", but received ${JSON.stringify(t)}`):Error(`Expected function reference in the current component like "api.file.func" or "internal.file.func", but received reference ${t.reference}`):Error(`Expected function reference like "api.file.func" or "internal.file.func", but received function handle ${t.functionHandle}`);if(typeof e==`string`)return e;let n=e[_c];if(!n)throw Error(`${e} is not a functionReference`);return n}function Cc(e=[]){return new Proxy({},{get(t,n){if(typeof n==`string`)return Cc([...e,n]);if(n===_c){if(e.length<2){let t=[`api`,...e].join(`.`);throw Error(`API path is expected to be of the form \`api.moduleName.functionName\`. Found: \`${t}\``)}let t=e.slice(0,-1).join(`/`),n=e[e.length-1];return n==="default"?t:t+`:`+n}if(n===Symbol.toStringTag)return`FunctionReference`}})}var wc=Cc();function Tc(e,t){return new Proxy({},{get(n,r){if(typeof r==`string`)return Tc(e,[...t,r]);if(r===vc){if(t.length<1){let n=[e,...t].join(`.`);throw Error(`API path is expected to be of the form \`${e}.childComponent.functionName\`. Found: \`${n}\``)}return`_reference/childComponent/`+t.join(`/`)}}})}var Ec=()=>Tc(`components`,[]),Dc=e=>{throw TypeError(e)},Oc=(e,t,n)=>t.has(e)||Dc(`Cannot `+n),B=(e,t,n)=>(Oc(e,t,`read from private field`),n?n.call(e):t.get(e)),V=(e,t,n)=>t.has(e)?Dc(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),H=(e,t,n,r)=>(Oc(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),U=(e,t,n)=>(Oc(e,t,`access private method`),n),kc=class extends Error{constructor(){super(...arguments),this.status=500,this.name=`NoClientIdProvidedException`,this.message=`Missing Client ID. Pass it to the constructor (createClient("client_01HXRMBQ9BJ3E7QSTQ9X2PHVB7"))`}};function Ac(e,t){if(!t.has(`code`))return!1;let{pathname:n}=window.location,r=new URL(e).pathname;return n===r||n===`${r}/`}function jc(){let e={};function t(t,n){e[t]=n}function n(t){return e[t]}function r(t){delete e[t]}function i(){e={}}return{setItem:t,getItem:n,removeItem:r,reset:i}}var W=jc();async function Mc(){let e=Nc();return{codeVerifier:e,codeChallenge:await Pc(e)}}function Nc(){return Fc(crypto.getRandomValues(new Uint32Array(96)))}async function Pc(e){return Fc(await Ic(e))}function Fc(e){return btoa(Array.from(new Uint8Array(e),e=>String.fromCharCode(e)).join(``)).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function Ic(e){let t=new TextEncoder().encode(e);return crypto.subtle.digest(`SHA-256`,t)}function Lc(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=`=`.repeat((4-t.length%4)%4);return atob(t+n)}function Rc(e){let t=e.split(`.`);if(t.length!==3)throw Error(`Invalid JWT format`);try{return{header:JSON.parse(Lc(t[0])),payload:JSON.parse(Lc(t[1]))}}catch(e){throw Error(`Failed to decode JWT: ${e instanceof Error?e.message:String(e)}`)}}var G={codeVerifier:`workos:code-verifier`,user:`workos:user`,accessToken:`workos:access-token`,refreshToken:`workos:refresh-token`,expiresAt:`workos:expires-at`,authenticationMethod:`workos:authentication-method`};function zc(e){return Rc(e).payload}function Bc(e){return`${G.refreshToken}:${e}`}function Vc(e,{devMode:t=!1,clientId:n}){let{user:r,accessToken:i,refreshToken:a,authenticationMethod:o}=e;W.setItem(G.user,r),W.setItem(G.accessToken,i),W.setItem(G.authenticationMethod,o),(t?window.localStorage:W).setItem(Bc(n),a);let{exp:s,iat:c}=zc(i),l=s-c,u=Date.now()+l*1e3;W.setItem(G.expiresAt,u)}function Hc({devMode:e=!1,clientId:t}){W.removeItem(G.user),W.removeItem(G.accessToken),W.removeItem(G.authenticationMethod);let n=e?window.localStorage:W;n.removeItem(Bc(t)),n.removeItem(G.refreshToken)}function Uc({devMode:e=!1,clientId:t}){let n=e?window.localStorage:W,r=n.getItem(Bc(t))??n.getItem(G.refreshToken);return typeof r==`string`?r:void 0}function Wc(e){let t=new URLSearchParams,n=Object.keys(e).sort();for(let r of n){let n=e[r];n&&t.append(r,n)}return t.toString()}var Gc=class extends Error{},Kc=class extends Gc{constructor(e,t={}){super(e,t.cause==null?void 0:{cause:t.cause}),this.name=`RefreshError`,this.status=t.status,this.error=t.error,this.isTransient=t.isTransient??!1}},qc=class extends Gc{},Jc=class extends Gc{constructor(){super(...arguments),this.message=`No access token available`}},Yc=class extends Kc{constructor(e=`Timed out waiting to refresh the session.`,t){super(e,{cause:t?.cause,isTransient:!0}),this.name=`RefreshTimeoutError`}},Xc=class extends Gc{constructor(){super(...arguments),this.message=`SignOut() called without an active session. Provide a returnTo URL to redirect anyway.`}},Zc=class e{constructor(){this.locked=new Map,this.addToLocked=(e,t)=>{let n=this.locked.get(e);n===void 0?t===void 0?this.locked.set(e,[]):this.locked.set(e,[t]):t!==void 0&&(n.unshift(t),this.locked.set(e,n))},this.isLocked=e=>this.locked.has(e),this.lock=e=>new Promise((t,n)=>{this.isLocked(e)?this.addToLocked(e,t):(this.addToLocked(e),t())}),this.unlock=e=>{let t=this.locked.get(e);if(t===void 0||t.length===0){this.locked.delete(e);return}let n=t.pop();this.locked.set(e,t),n!==void 0&&setTimeout(n,0)}}static getInstance(){return e.instance===void 0&&(e.instance=new e),e.instance}};function Qc(){return Zc.getInstance()}var $c=`browser-tabs-lock-key`,el={key:async e=>{throw Error(`Unsupported`)},getItem:async e=>{throw Error(`Unsupported`)},clear:async()=>window.localStorage.clear(),removeItem:async e=>{throw Error(`Unsupported`)},setItem:async(e,t)=>{throw Error(`Unsupported`)},keySync:e=>window.localStorage.key(e),getItemSync:e=>window.localStorage.getItem(e),clearSync:()=>window.localStorage.clear(),removeItemSync:e=>window.localStorage.removeItem(e),setItemSync:(e,t)=>window.localStorage.setItem(e,t)};function tl(e){return new Promise(t=>setTimeout(t,e))}function nl(e){let t=``;for(let n=0;n<e;n++){let e=Math.floor(Math.random()*61);t+=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz`[e]}return t}function rl(){return Date.now().toString()+nl(15)}var il=class e{constructor(t){this.acquiredIatSet=new Set,this.storageHandler=void 0,this.id=rl(),this.acquireLock=this.acquireLock.bind(this),this.releaseLock=this.releaseLock.bind(this),this.releaseLock__private__=this.releaseLock__private__.bind(this),this.waitForSomethingToChange=this.waitForSomethingToChange.bind(this),this.refreshLockWhileAcquired=this.refreshLockWhileAcquired.bind(this),this.storageHandler=t,e.waiters===void 0&&(e.waiters=[])}async acquireLock(t,n=5e3){let r=Date.now()+nl(4),i=Date.now()+n,a=`${$c}-${t}`,o=this.storageHandler===void 0?el:this.storageHandler;for(;Date.now()<i;){if(await tl(30),o.getItemSync(a)===null){let e=`${this.id}-${t}-${r}`;await tl(Math.floor(Math.random()*25)),o.setItemSync(a,JSON.stringify({id:this.id,iat:r,timeoutKey:e,timeAcquired:Date.now(),timeRefreshed:Date.now()})),await tl(30);let n=o.getItemSync(a);if(n!==null){let e=JSON.parse(n);if(e.id===this.id&&e.iat===r)return this.acquiredIatSet.add(r),this.refreshLockWhileAcquired(a,r),!0}}else e.lockCorrector(this.storageHandler===void 0?el:this.storageHandler),await this.waitForSomethingToChange(i);r=Date.now()+nl(4)}return!1}async refreshLockWhileAcquired(e,t){setTimeout(async()=>{if(await Qc().lock(t),!this.acquiredIatSet.has(t)){Qc().unlock(t);return}let n=this.storageHandler===void 0?el:this.storageHandler,r=n.getItemSync(e);if(r!==null){let i=JSON.parse(r);i.timeRefreshed=Date.now(),n.setItemSync(e,JSON.stringify(i)),Qc().unlock(t)}else{Qc().unlock(t);return}this.refreshLockWhileAcquired(e,t)},1e3)}async waitForSomethingToChange(t){await new Promise(n=>{let r=!1,i=Date.now(),a=!1;function o(){if(a||=(window.removeEventListener(`storage`,o),e.removeFromWaiting(o),clearTimeout(s),!0),!r){r=!0;let e=50-(Date.now()-i);e>0?setTimeout(n,e):n(null)}}window.addEventListener(`storage`,o),e.addToWaiting(o);let s=setTimeout(o,Math.max(0,t-Date.now()))})}static addToWaiting(t){this.removeFromWaiting(t),e.waiters!==void 0&&e.waiters.push(t)}static removeFromWaiting(t){e.waiters!==void 0&&(e.waiters=e.waiters.filter(e=>e!==t))}static notifyWaiters(){e.waiters!==void 0&&[...e.waiters].forEach(e=>e())}async releaseLock(e){return await this.releaseLock__private__(e)}async releaseLock__private__(t){let n=this.storageHandler===void 0?el:this.storageHandler,r=`${$c}-${t}`,i=n.getItemSync(r);if(i===null)return;let a=JSON.parse(i);a.id===this.id&&(await Qc().lock(a.iat),this.acquiredIatSet.delete(a.iat),n.removeItemSync(r),Qc().unlock(a.iat),e.notifyWaiters())}static lockCorrector(t){let n=Date.now()-5e3,r=t,i=[],a=0;for(;;){let e=r.keySync(a);if(e===null)break;i.push(e),a++}let o=!1;for(let e=0;e<i.length;e++){let t=i[e];if(t.includes($c)){let e=r.getItemSync(t);if(e!==null){let i=JSON.parse(e);(i.timeRefreshed===void 0&&i.timeAcquired<n||i.timeRefreshed!==void 0&&i.timeRefreshed<n)&&(r.removeItemSync(t),o=!0)}}}o&&e.notifyWaiters()}};il.waiters=void 0;var al=il,ol=1e4;function sl(e,t,{timeout:n=ol}={}){if(!e)throw TypeError(`lockName is required and must be a non-empty string.`);return`locks`in navigator?cl(e,t,n):ll(e,t,n)}async function cl(e,t,n){try{return await navigator.locks.request(e,{signal:AbortSignal.timeout(n)},t)}catch(t){if(t instanceof DOMException)switch(t.name){case`TimeoutError`:case`AbortError`:throw new ul(`AcquisitionTimeoutError`,e,`Native`)}throw t}}async function ll(e,t,n){let r=new al;try{if(await r.acquireLock(e,n))return await t();throw new ul(`AcquisitionTimeoutError`,e,`Vendor`)}finally{await r.releaseLock(e)}}var ul=class extends Error{constructor(e,t,n){super(`Lock acquisition timed out for "${t}" (${n})`),this.name=e,this.lockName=t}},dl=e=>({object:e.object,id:e.id,email:e.email,emailVerified:e.email_verified,firstName:e.first_name,profilePictureUrl:e.profile_picture_url,lastName:e.last_name,lastSignInAt:e.last_sign_in_at,externalId:e.external_id,createdAt:e.created_at,updatedAt:e.updated_at}),fl=e=>{let{user:t,organization_id:n,access_token:r,refresh_token:i,authentication_method:a,impersonator:o,...s}=e;return{user:dl(t),organizationId:n,accessToken:r,refreshToken:i,authenticationMethod:a,impersonator:o,...s}},pl=`api.workos.com`,ml=new Set([408,429,500,502,503,504]),hl,gl,_l,vl,yl,bl=class{constructor({clientId:e,hostname:t=pl,port:n,https:r=!0}){V(this,_l),V(this,hl),V(this,gl),H(this,hl,`${r?`https`:`http`}://${t}${n?`:${n}`:``}`),H(this,gl,e)}async authenticateWithRefreshToken({refreshToken:e,organizationId:t,useCookie:n}){let r=await U(this,_l,yl).call(this,`/user_management/authenticate`,{useCookie:n,body:{client_id:B(this,gl),grant_type:`refresh_token`,...!n&&{refresh_token:e},organization_id:t}});if(r.ok)return fl(await r.json());let{status:i}=r,a=await U(this,_l,vl).call(this,r);throw new Kc(a.error_description,{status:i,error:a.error,isTransient:ml.has(i)})}async authenticateWithCode({code:e,codeVerifier:t,useCookie:n}){let r=await U(this,_l,yl).call(this,`/user_management/authenticate`,{useCookie:n,body:{code:e,client_id:B(this,gl),grant_type:`authorization_code`,code_verifier:t}});if(r.ok)return fl(await r.json());throw new qc((await r.json()).error_description)}getAuthorizationUrl({connectionId:e,context:t,domainHint:n,loginHint:r,organizationId:i,provider:a=`authkit`,redirectUri:o,state:s,screenHint:c,passwordResetToken:l,invitationToken:u,codeChallenge:d,codeChallengeMethod:f}){if(!a&&!e&&!i)throw TypeError(`Incomplete arguments. Need to specify either a 'connectionId', 'organizationId', or 'provider'.`);if(a!==`authkit`&&c)throw TypeError(`'screenHint' is only supported for 'authkit' provider`);t&&console.warn("`context` is deprecated. We previously required initiate login endpoints to return the\n`context` query parameter when getting the authorization URL. This is no longer necessary.");let p=Wc({connection_id:e,organization_id:i,domain_hint:n,login_hint:r,provider:a,client_id:B(this,gl),redirect_uri:o,response_type:`code`,state:s,screen_hint:c,invitation_token:u,password_reset_token:l,code_challenge:d,code_challenge_method:f});return`${B(this,hl)}/user_management/authorize?${p}`}getLogoutUrl({sessionId:e,returnTo:t}){let n=new URL(`/user_management/sessions/logout`,B(this,hl));return n.searchParams.set(`session_id`,e),t&&n.searchParams.set(`return_to`,t),n}};hl=new WeakMap,gl=new WeakMap,_l=new WeakSet,vl=async function(e){try{return await e.json()}catch{return{}}},yl=function(e,{body:t,useCookie:n}){return fetch(new URL(e,B(this,hl)),{method:`POST`,...n&&{credentials:`include`},headers:{Accept:`application/json, text/plain, */*`,"Content-Type":`application/json`},body:JSON.stringify(t)})};var xl=`workos_organization_id`;function Sl(e){return`workos-org-id:${e}`}var Cl=`WORKOS_REFRESH_SESSION`;function wl(e){let t=document.cookie.match(/(?:^|;\s*)workos-has-session=([^;]*)/);if(!t)return!1;let n=t[1];return n===`1`||n.split(`.`).includes(e)}var K,Tl,q,El,Dl,J,Ol,kl,Al,jl,Ml,Y,Nl,Pl,Fl,Il,Ll,Rl,zl,Bl,Vl,Hl,Ul,Wl=class{constructor(e,{apiHostname:t,https:n,port:r,redirectUri:i=window.origin,devMode:a=location.hostname===`localhost`||location.hostname===`127.0.0.1`,onBeforeAutoRefresh:o=()=>!document.hidden,onRedirectCallback:s=e=>{},onRefresh:c,onRefreshFailure:l,refreshBufferInterval:u=10}={}){if(V(this,Y),V(this,K),V(this,Tl),V(this,q),V(this,El),V(this,Dl),V(this,J),V(this,Ol),V(this,kl),V(this,Al),V(this,jl),V(this,Ml),!e)throw new kc;H(this,q,e),H(this,El,new bl({clientId:e,hostname:t,port:r,https:n})),H(this,J,a),H(this,Dl,i),H(this,K,{tag:`INITIAL`}),H(this,Ol,o),H(this,kl,s),H(this,Al,c),H(this,jl,l),H(this,Ml,u)}async initialize(){if(B(this,K).tag!==`INITIAL`)return;let e=new URLSearchParams(window.location.search);if(Ac(B(this,Dl),e))await U(this,Y,Nl).call(this);else if(wl(B(this,q))||Uc({devMode:B(this,J),clientId:B(this,q)}))try{await U(this,Y,Il).call(this),U(this,Y,Fl).call(this)}catch{U(this,Y,Pl).call(this)}}async getSignInUrl(e={}){return await U(this,Y,zl).call(this,{...e})}async getSignUpUrl(e={}){return await U(this,Y,zl).call(this,{...e,screenHint:`sign-up`})}async signIn(e={}){let t=await U(this,Y,zl).call(this,{...e});window.location.assign(t)}async signUp(e={}){let t=await U(this,Y,zl).call(this,{...e,screenHint:`sign-up`});window.location.assign(t)}signOut(e={navigate:!0}){let{navigate:t=!0,returnTo:n}=e,r=W.getItem(G.accessToken);if(typeof r!=`string`){if(t)throw new Xc;return Promise.reject(new Xc)}let{sid:i}=zc(r),a=B(this,El).getLogoutUrl({sessionId:i,returnTo:n});if(a){if(Hc({devMode:B(this,J),clientId:B(this,q)}),sessionStorage.removeItem(Sl(B(this,q))),sessionStorage.removeItem(xl),t)window.location.assign(a);else return new Promise(async e=>{fetch(a,{mode:`no-cors`,credentials:`include`}).catch(e=>{console.warn(`AuthKit: Failed to send logout request`,e)}).finally(e)})}}async getAccessToken(e){if(e?.forceRefresh||U(this,Y,Rl).call(this))try{await U(this,Y,Il).call(this)}catch(t){if(t instanceof Yc){let t=e?.forceRefresh?void 0:U(this,Y,Vl).call(this);if(t)return t;try{await U(this,Y,Il).call(this)}catch(e){throw e instanceof Yc?e:e instanceof Kc?e.isTransient?e:new Jc:e}}else if(t instanceof Kc){if(t.isTransient){let n=e?.forceRefresh?void 0:U(this,Y,Vl).call(this);if(n)return n;throw t}throw new Jc}else throw t}let t=U(this,Y,Bl).call(this);if(!t)throw new Jc;return t}getUser(){return W.getItem(G.user)||null}dispose(){clearTimeout(B(this,Tl)),W.reset()}async switchToOrganization({organizationId:e,signInOpts:t={}}){try{await U(this,Y,Il).call(this,{organizationId:e})}catch(n){if(n instanceof Yc)console.warn(`Couldn't switch organization: lock acquisition timed out.`);else if(n instanceof Kc){if(n.isTransient)throw n;this.signIn({...t,organizationId:e})}else throw n}}};K=new WeakMap,Tl=new WeakMap,q=new WeakMap,El=new WeakMap,Dl=new WeakMap,J=new WeakMap,Ol=new WeakMap,kl=new WeakMap,Al=new WeakMap,jl=new WeakMap,Ml=new WeakMap,Y=new WeakSet,Nl=async function(){if(B(this,K).tag!==`INITIAL`)return;let e=new URL(window.location.href),t=e.searchParams.get(`code`),n=e.searchParams.get(`state`),r;if(n)try{r=JSON.parse(n)}catch{console.warn("AuthKit: ignoring malformed `state` parameter")}let i=window.sessionStorage.getItem(G.codeVerifier);if(t){if(i)try{H(this,K,{tag:`AUTHENTICATING`,response:B(this,El).authenticateWithCode({code:t,codeVerifier:i,useCookie:B(this,Y,Hl)})});let e=await B(this,K).response;e&&(H(this,K,{tag:`AUTHENTICATED`}),U(this,Y,Fl).call(this),Vc(e,{devMode:B(this,J),clientId:B(this,q)}),U(this,Y,Ul).call(this,e),B(this,kl).call(this,{state:r,...e}))}catch(e){H(this,K,{tag:`ERROR`}),console.error(e)}else H(this,K,{tag:`ERROR`}),console.error(`Couldn't exchange code.
56
+
57
+ An authorization_code was supplied for a login which did not originate at the application. This could happen for various reasons:
58
+
59
+ * This could have been an attempted Login CSRF attack. You were not affected.
60
+ * The developer may not have configured a Login Initiation endpoint.`)}let a=new URL(window.location.toString());a.searchParams.delete(`code`),a.searchParams.delete(`state`),window.sessionStorage.removeItem(G.codeVerifier),window.history.replaceState({},``,a)},Pl=function(){B(this,K).tag===`AUTHENTICATED`&&U(this,Y,Fl).call(this)},Fl=async function(){H(this,Tl,setTimeout(()=>{U(this,Y,Rl).call(this)&&B(this,Ol).call(this)?U(this,Y,Il).call(this).catch(e=>{console.debug(e)}).finally(()=>U(this,Y,Fl).call(this)):U(this,Y,Fl).call(this)},1e3))},Il=async function({organizationId:e}={}){if(B(this,K).tag===`AUTHENTICATING`){await B(this,K).response;return}let t=B(this,K);H(this,K,{tag:`AUTHENTICATING`,response:U(this,Y,Ll).call(this,{organizationId:e,beginningState:t})}),await B(this,K).response},Ll=async function({organizationId:e,beginningState:t}){try{return await sl(Cl,async()=>{if(e)sessionStorage.setItem(Sl(B(this,q)),e);else{let t=U(this,Y,Bl).call(this);e=t?zc(t)?.org_id:sessionStorage.getItem(Sl(B(this,q)))??sessionStorage.getItem(xl)??void 0}let t=await B(this,El).authenticateWithRefreshToken({refreshToken:Uc({devMode:B(this,J),clientId:B(this,q)}),organizationId:e,useCookie:B(this,Y,Hl)});return H(this,K,{tag:`AUTHENTICATED`}),Vc(t,{devMode:B(this,J),clientId:B(this,q)}),U(this,Y,Ul).call(this,t),t})}catch(e){throw e instanceof ul&&e.name===`AcquisitionTimeoutError`?(console.warn(`Couldn't acquire refresh lock.`),H(this,K,t),new Yc(void 0,{cause:e})):(t.tag!==`INITIAL`&&console.debug(e),e instanceof Kc&&!e.isTransient?(Hc({devMode:B(this,J),clientId:B(this,q)}),sessionStorage.removeItem(Sl(B(this,q))),sessionStorage.removeItem(xl),t.tag!==`INITIAL`&&B(this,jl)&&B(this,jl).call(this,{signIn:this.signIn.bind(this)}),H(this,K,{tag:`ERROR`})):H(this,K,{tag:`AUTHENTICATED`}),e)}},Rl=function(){switch(B(this,K).tag){case`INITIAL`:case`AUTHENTICATING`:return!0;case`ERROR`:return!1;case`AUTHENTICATED`:let e=W.getItem(G.accessToken),t=W.getItem(G.expiresAt);return!e||!t||t-B(this,Ml)*1e3<Date.now()}},zl=async function({context:e,invitationToken:t,loginHint:n,organizationId:r,passwordResetToken:i,state:a,screenHint:o}){let{codeVerifier:s,codeChallenge:c}=await Mc();return window.sessionStorage.setItem(G.codeVerifier,s),B(this,El).getAuthorizationUrl({codeChallenge:c,codeChallengeMethod:`S256`,context:e,invitationToken:t,loginHint:n,organizationId:r,passwordResetToken:i,redirectUri:B(this,Dl),screenHint:o,state:a?JSON.stringify(a):void 0})},Bl=function(){return W.getItem(G.accessToken)},Vl=function(){let e=U(this,Y,Bl).call(this),t=W.getItem(G.expiresAt);return e&&t&&t>Date.now()?e:void 0},Hl=function(){return!B(this,J)},Ul=async function(e){if(B(this,Al)){let{refreshToken:t,...n}=e;B(this,Al).call(this,n)}};async function Gl(e,t={}){let n=new Wl(e,t);return await n.initialize(),n}var Kl=wc;Ec();var ql=R({error:N().optional()});function Jl(e,t){let n=e.trim().slice(0,120);return n.startsWith(`<!`)?Error(`The Sprocket API at ${t} returned a web page instead of JSON. Make sure the server is running correctly.`):Error(n.length>0?`Local API returned an unexpected response: ${n}`:`Local API returned an empty response.`)}async function Yl(e,t,n){let r=await e.text();if(!(e.headers.get(`content-type`)??``).includes(`application/json`))throw Jl(r,n);let i;try{i=JSON.parse(r)}catch{throw Jl(r,n)}let a=t.safeParse(i);if(!a.success)throw Error(`Local API returned an unexpected response.`);return a.data}async function Xl(e,t){let n=await e.text(),r;try{r=JSON.parse(n)}catch{return Jl(n,t)}let i=ql.safeParse(r);return i.success?Error(i.data.error?i.data.error:`Local request failed (${e.status}).`):Error(`Local API returned an unexpected response.`)}async function Zl(e,t){if(!e.ok)throw await Xl(e,t);return e}function Ql(e){let t=e.split(`
61
+ `).map(e=>e.endsWith(`\r`)?e.slice(0,-1):e).filter(e=>e===`data`||e.startsWith(`data:`)).map(e=>e===`data`?``:e.slice(5).replace(/^ /,``));return t.length>0?t.join(`
62
+ `):null}async function $l(e,t,n){if(!e.body)return;let r=e.body.getReader(),i=new TextDecoder,a=``,o=()=>void r.cancel(t.reason).catch(()=>void 0);t.addEventListener(`abort`,o,{once:!0});try{for(;!t.aborted;){let{done:e,value:o}=await r.read();a+=i.decode(o,{stream:!e});let s=/\r?\n\r?\n/.exec(a);for(;s;){let e=Ql(a.slice(0,s.index));a=a.slice(s.index+s[0].length),e!==null&&!t.aborted&&n(e),s=/\r?\n\r?\n/.exec(a)}if(e)break}}catch(e){if(!t.aborted)throw e}finally{t.removeEventListener(`abort`,o),await r.cancel().catch(()=>void 0),r.releaseLock()}}function eu(e){async function t(t,n){return await fetch(`${e}${t}`,{...n,credentials:`include`,headers:{"content-type":`application/json`,...n?.headers}})}return{async request(n,r,i){let a=await Zl(await t(n,i),e);if(a.status===204)throw Error(`Local API returned an empty response.`);return await Yl(a,r,e)},async response(n,r){return await Zl(await t(n,r),e)},async postEventStream(n,r,i,a){await $l(await Zl(await t(n,{method:`POST`,body:JSON.stringify(r),signal:i}),e),i,a)}}}var tu=R({error:N().optional()}),nu=R({authenticated:I().optional()}),ru=R({parentPath:N(),entries:L(R({name:N(),fullPath:N()})),volumeList:I().optional()}),iu=R({skills:L(R({name:N(),description:N()})),warnings:L(N())}),au=R({workspacePath:N(),displayName:N(),repositoryKey:N()}),ou=R({workspacePath:N(),repositoryKey:N(),attachmentKey:N(),displayName:N(),availability:Ks([`available`,`unavailable`]),lastValidatedAt:F(),lastUsedAt:F(),unavailableReason:N().optional(),previousRepositoryKey:N().optional()}),su=R({runId:N(),threadId:N()}),cu=R({storageId:N(),name:N(),mediaType:N(),size:F(),url:cs().optional()}),lu=Rs([R({storageId:N(),name:N(),mediaType:N(),size:Ts(),url:N()}),R({error:N()})]);function uu(e){let t=`userId=${encodeURIComponent(e.userId)}&name=${encodeURIComponent(e.name)}`;return e.threadId&&(t+=`&threadId=${encodeURIComponent(e.threadId)}`),`/api/transcript/upload?${t}`}var du=R({id:N(),threadId:N(),runId:N(),sequence:F().nonnegative(),kind:Ks([`prompt`,`text`,`work`,`approval`]),text:N().optional(),attachments:L(cu).optional(),mandateId:N().optional(),approvalUrl:N().optional(),itemCount:F().nonnegative(),pendingTools:F().nonnegative(),provisional:I().optional(),startedAt:Ts().optional(),completedAt:Ts().optional(),closed:I(),revision:F().nonnegative()}).transform(e=>({...e,threadId:X(e.threadId),runId:X(e.runId),attachments:e.attachments?.map(e=>({...e,storageId:X(e.storageId)}))})),fu=R({replicaId:N(),rows:L(du),indexing:I(),stale:I(),nextBefore:F().nonnegative().optional(),endSequence:F().nonnegative(),revision:F().nonnegative(),persistedStreams:L(R({runId:N().transform(e=>X(e)),streamId:N()})),changes:L(R({id:N(),row:du.nullable()})),changesCursor:R({revision:F().nonnegative(),sequence:F().min(-1)}),moreChanges:I()}),pu=R({parts:L(js()),indexing:I(),nextAfter:F().nonnegative().optional(),previousBefore:F().nonnegative().optional(),revision:F().nonnegative(),stale:I()}),mu=R({eventType:N(),totalParts:F().optional(),stale:I()}),hu=R({threadId:N(),runId:N(),runStatus:Ks([`queued`,`running`,`completed`,`failed`,`cancelled`]),streamId:N().min(1),text:N(),parts:L(js()),runStartedAt:F()}),gu=Bs(`eventType`,[R({eventType:z(`updated`),live:hu}),R({eventType:z(`cleared`)})]),_u=Ks([`thread`,`project`]),vu=R({artifacts:L(R({_id:N(),userId:N(),scope:_u,repositoryKey:N(),threadId:N().optional(),localPath:N().optional(),content:N(),type:Ks([`markdown`,`html`,`react`]),title:N(),revision:Ts(),createdAt:Ts(),updatedAt:Ts(),localError:N().optional()})),stale:I(),error:N().optional()});function X(e){return e}function yu(e){return e}function bu(e){return{threadId:X(e.threadId),runId:X(e.runId),runStatus:e.runStatus,streamId:e.streamId,text:e.text,parts:e.parts,runStartedAt:e.runStartedAt}}function xu(e){return e.eventType===`updated`?{eventType:`updated`,live:bu(e.live)}:{eventType:`cleared`}}function Su(e){let{threadId:t,...n}=e;return e.scope===`thread`&&t?{...n,threadId:t}:n}function Cu(e){return{artifacts:e.artifacts.map(Su),stale:e.stale,error:e.error}}function wu(){return globalThis.window?globalThis.window.location.origin:null}function Tu(e){if(!globalThis.window)return null;let t=globalThis.window.location.hash.startsWith(`#`)?globalThis.window.location.hash.slice(1):globalThis.window.location.hash;return new URLSearchParams(t).get(e)}function Eu(){return Tu(`workspace`)}function Du(){if(!globalThis.window)return;let e=new URL(globalThis.window.location.href);e.hash=``,globalThis.window.history.replaceState(null,``,`${e.pathname}${e.search}`)}async function Ou(e){let t=await fetch(`${e}/api/auth/bootstrap`,{method:`POST`,credentials:`include`});if(!t.ok){let e=tu.safeParse(await t.json().catch(()=>null));throw Error(e.success?e.data.error??`Failed to authenticate with the Sprocket server.`:`Failed to authenticate with the Sprocket server.`)}}async function ku(e){let t=await fetch(`${e}/api/auth/session`,{credentials:`include`});if(!t.ok)return!1;let n=nu.safeParse(await t.json());return n.success?!!n.data.authenticated:!1}var Au=new Map;async function ju(e){let t=Au.get(e);if(t)return await t;let n=Mu(e);Au.set(e,n);try{await n}finally{Au.delete(e)}}async function Mu(e){await ku(e)||await Ou(e)}function Nu(e){let t=eu(e),{request:n}=t;return{browseFilesystem:e=>{let t=e.cwd?{partialPath:e.partialPath,cwd:e.cwd}:{partialPath:e.partialPath};return n(`/api/workspace/browse`,ru,{method:`POST`,body:JSON.stringify(t)})},listWorkspaceSkills:e=>n(`/api/workspace/skills`,iu,{method:`POST`,body:JSON.stringify({workspacePath:e.workspacePath})}),resolveWorkspacePath:e=>{let t=e.createIfMissing?{workspacePath:e.workspacePath,createIfMissing:!0}:{workspacePath:e.workspacePath};return n(`/api/workspace/resolve`,au,{method:`POST`,body:JSON.stringify(t)})},listProjectAttachments:async()=>(await n(`/api/workspace/projects`,L(ou))).map(yu),attachProject:async e=>yu(await n(`/api/workspace/projects`,ou,{method:`POST`,body:JSON.stringify(e)})),runAgent:async e=>{let t=await n(`/api/agent/run`,su,{method:`POST`,body:JSON.stringify(e)});return{runId:X(t.runId),threadId:X(t.threadId)}},fetchTranscriptDisplay:async(e,t)=>await n(`/api/transcript/display`,fu,{method:`POST`,body:JSON.stringify(e),signal:t}),fetchTranscriptDisplayDetails:async(e,t)=>{let r=await n(`/api/transcript/display-details`,pu,{method:`POST`,body:JSON.stringify(e),signal:t});return{...r,parts:r.parts}},watchTranscript:async(e,n)=>{await t.postEventStream(`/api/transcript/watch`,e,n.signal,e=>{let t=mu.safeParse(JSON.parse(e));t.success&&n.onEvent(t.data)})},watchLiveCompletion:async(e,n)=>{await t.postEventStream(`/api/agent/live`,e,n.signal,e=>{let t=gu.safeParse(JSON.parse(e));t.success&&n.onEvent(xu(t.data))})},clearTranscriptReplica:async e=>{await t.response(`/api/transcript/clear`,{method:`POST`,body:JSON.stringify(e)})},fetchTranscriptAttachment:async t=>{let n=await fetch(`${e}/api/transcript/attachment`,{method:`POST`,credentials:`include`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});return n.status===404||!n.ok?null:await n.blob()},uploadTranscriptAttachment:async e=>{let t=await n(uu({userId:e.userId,name:e.name,threadId:e.threadId}),lu,{method:`POST`,headers:{"content-type":e.file.type.trim()||`application/octet-stream`},body:e.file});return`error`in t?t:{storageId:X(t.storageId),name:t.name,mediaType:t.mediaType,size:t.size,url:t.url}},discardTranscriptAttachment:async e=>await n(`/api/transcript/discard`,I(),{method:`POST`,body:JSON.stringify({userId:e.userId,storageId:e.storageId,threadId:e.threadId})}),watchArtifacts:async(e,n)=>{await t.postEventStream(`/api/artifacts/watch`,e,n.signal,e=>{let t=vu.parse(JSON.parse(e));n.onEvent(Cu(t))})},rekeyRepository:async e=>await n(`/api/threads/rekey`,F(),{method:`POST`,body:JSON.stringify(e)}),requestRunCancellation:async e=>{await n(`/api/threads/cancel`,I(),{method:`POST`,body:JSON.stringify(e)})},startAccountSession:async e=>{await n(`/api/threads/account-session/start`,ks(),{method:`POST`,body:JSON.stringify(e)})},endAccountSession:async e=>{await n(`/api/threads/account-session/end`,ks(),{method:`POST`,body:JSON.stringify(e)})}}}async function Pu(){let e=wu();if(!e)throw Error(`Unable to resolve the Sprocket server URL.`);return await ju(e),Nu(e)}var Z=n({isLoading:!0,isReady:!1,isConfigured:!0,isWaitingForBrowserSignIn:!1,browserSignInUrl:null,user:null,nativeSession:`notRequired`,error:null}),Fu=e(Z,e=>e.user?.id??null),Iu=e(Z,e=>!e.isReady||e.isLoading),Lu=n(0),Ru=n(!1),zu=1500,Bu=3e5,Vu=`Native sign-in is temporarily unavailable. Try again.`,Hu=null,Uu=`This device is signed in with a different account. Sign out, then sign in with the same account.`,Wu={createAuthKitClient:Gl,resolveLocalApiBaseUrl:wu,ensureLocalSession:ju},Gu=!1;function Ku(){return globalThis.window??null}var qu=null,Ju=null,Yu=null,Xu=!1,Zu=null,Qu=Promise.resolve(),Q=0,$u=null,ed=null,td=R({error:N().optional()}),nd=R({authorizationUrl:cs(),loginId:N()}),rd=R({id:N(),email:is(),firstName:N().nullable().optional(),lastName:N().nullable().optional(),profilePictureUrl:N().nullable().optional()}),id=R({accessToken:N(),user:rd}).nullable(),ad=Bs(`status`,[R({status:z(`signedOut`)}),R({status:z(`pending`)}),R({status:z(`authenticated`),user:R({id:N(),email:is()})}),R({status:z(`unavailable`),error:N()}),R({status:z(`failed`),error:N()})]);function od(e){return{id:e.id,email:e.email,firstName:e.firstName??null,lastName:e.lastName??null,profilePictureUrl:e.profilePictureUrl??null}}function sd(e={}){return{isLoading:!1,isReady:!0,isConfigured:!0,isWaitingForBrowserSignIn:!1,browserSignInUrl:null,user:null,nativeSession:`notRequired`,error:null,...e}}function cd(e){return e===408||e===429||e===500||e===502||e===503||e===504}function $(){return!!(Gu||md()||hd())}function ld(){return Gu&&!md()&&!hd()}function ud(){Kd(),Q+=1,ed=null}function dd(){if(Yu)return Yu;throw Error(`Auth bootstrap is not initialized.`)}async function fd(){if(Ju)return await Ju;Ju=dd().query(Kl.authBootstrap.getClientConfig,{});try{return await Ju}catch(e){throw Ju=null,e}}async function pd(){return(await fd()).workosClientId?.trim()||void 0}function md(){let e=Ku();if(!e)return null;let t=e.sprocketDesktopBridge;return!t?.openExternal||!t.focusWindow?null:t}function hd(){let e=Ku();return e?a(e.location.hostname,!1):!1}async function gd(){let e=Wu.resolveLocalApiBaseUrl();if(!e)throw Error(`Unable to resolve the Sprocket server URL.`);await Wu.ensureLocalSession(e)}async function _d(){return Ku()?(qu||=(async()=>{let e=await pd();if(!e)return Z.set(sd({isConfigured:!1})),null;let n=null;try{n=await Wu.createAuthKitClient(e,{redirectUri:`${Ku()?.location.origin}/callback`,onRedirectCallback:()=>{window.location.replace(`/`)},onRefresh:()=>{let e=n?.getUser()??null;Z.update(t=>({...t,user:e?od(e):null,error:null}))},onRefreshFailure:()=>{let e=n?.getUser()??null;Z.update(t=>({...t,user:e?od(e):null,error:t.user&&!e&&!Xu?`Session refresh failed. Sign in again.`:t.error}))}});let r=n.getUser();return Z.set({isLoading:!1,isReady:!0,isConfigured:!0,isWaitingForBrowserSignIn:!1,browserSignInUrl:null,user:r?od(r):null,nativeSession:t(Z).nativeSession,error:null}),n}catch(e){throw qu=null,e}})(),await qu):null}async function vd(e,n={}){Gu=n.machine===!0,Yu=e;let r=Q,i=t(Z);Z.set({...i,isLoading:!0,nativeSession:$()&&!i.user?`loading`:i.nativeSession});try{if($()){if(ld()&&Ku()?.location.protocol!==`https:`)throw Error(`Remote Sprocket access requires HTTPS.`);if(await gd(),r!==Q)return;await xd(r),yd();return}await bd()}catch(e){if(r!==Q)return;Z.update(t=>({...t,isLoading:!1,isReady:!0,isWaitingForBrowserSignIn:!1,browserSignInUrl:null,nativeSession:t.nativeSession===`loading`?`unavailable`:t.nativeSession,error:e instanceof Error?e.message:`Failed to initialize authentication.`}))}}function yd(){if($u||!globalThis.EventSource)return;let e=new EventSource(`/api/auth/changes`);$u=e,e.onmessage=()=>{$u!==e||Xu||(ud(),xd(Q))}}async function bd(){let e=(await _d())?.getUser()??null;Z.update(t=>t.isConfigured?{isLoading:!1,isReady:!0,isConfigured:!0,isWaitingForBrowserSignIn:!1,browserSignInUrl:null,user:e?od(e):null,nativeSession:`notRequired`,error:null}:{...t,isLoading:!1,isReady:!0})}async function xd(e){let t=await Ed(!1,e);e===Q&&Sd(t)}function Sd(e){switch(e.kind){case`session`:Z.set({isLoading:!1,isReady:!0,isConfigured:!0,isWaitingForBrowserSignIn:!1,browserSignInUrl:null,user:e.user,nativeSession:`ready`,error:null});return;case`signedOut`:Z.set(sd());return;case`transient`:Z.update(t=>({...t,isLoading:!1,isReady:!0,nativeSession:t.nativeSession===`loading`?`unavailable`:t.nativeSession,error:t.nativeSession===`loading`?e.error:t.error}));return;case`unauthorized`:Z.update(t=>({...t,isLoading:!1,isReady:!0,nativeSession:`unavailable`,error:e.error}));return;case`mismatch`:Z.update(t=>({...t,isLoading:!1,isReady:!0,nativeSession:`mismatch`,error:e.error}));return;case`stale`:return;case`error`:Z.update(t=>({...t,isLoading:!1,isReady:!0,nativeSession:t.nativeSession===`loading`?`unavailable`:t.nativeSession,error:e.error}))}}async function Cd(){let e=await fetch(`/api/auth/native-session`,{method:`DELETE`,credentials:`include`});if(!e.ok)throw Error(await Od(e,`Failed to clear native session.`))}async function wd(){let e=await fetch(`/api/auth/session`,{method:`DELETE`,credentials:`include`});if(!e.ok)throw Error(await Od(e,`Failed to clear browser session.`))}async function Td(){if(!$())return;let e=Q,t=await Ed(!1,e);e===Q&&Sd(t)}async function Ed(e,t){if(t!==Q)return{kind:`stale`};let n=ed;if(n&&n.generation===t){let r=await n.promise;if(t!==Q)return{kind:`stale`};if(!e||n.forceRefreshToken)return r}let r=Dd(e);ed={generation:t,forceRefreshToken:e,promise:r};try{let e=await r;return t===Q?e:{kind:`stale`}}finally{ed?.promise===r&&(ed=null)}}async function Dd(e){let t;try{t=await fetch(`/api/auth/native-session/token`,{method:`POST`,credentials:`include`,signal:AbortSignal.timeout(3e4),headers:{"content-type":`application/json`},body:JSON.stringify({forceRefreshToken:e})})}catch(e){return{kind:`transient`,error:e instanceof Error?e.message:Vu}}if(t.status===401)return{kind:`unauthorized`,error:await Od(t,`Your local Sprocket session is unavailable. Reload the app to reconnect.`)};if(t.status===409)return{kind:`mismatch`,error:await Od(t,Uu)};if(cd(t.status))return{kind:`transient`,error:await Od(t,Vu)};if(!t.ok)return{kind:`error`,error:await Od(t,`Failed to read the native session.`)};let n=id.safeParse(await t.json().catch(()=>void 0));return n.success?n.data===null?{kind:`signedOut`}:{kind:`session`,accessToken:n.data.accessToken,user:od(n.data.user)}:{kind:`error`,error:`Local server returned an invalid native session.`}}async function Od(e,t){let n=td.safeParse(await e.json().catch(()=>null));return n.success?n.data.error??t:t}async function kd(e){let t=await fetch(`/api/auth/desktop-login/start`,{method:`POST`,credentials:`include`,headers:{"content-type":`application/json`},body:JSON.stringify({flow:e})});if(!t.ok)throw Error(await Od(t,`Failed to start desktop sign-in.`));let n=nd.safeParse(await t.json());if(!n.success)throw Error(`Local server returned an invalid desktop sign-in URL.`);return n.data}function Ad(e){return Zu===e&&!e.abort.signal.aborted}function jd(e){if(!Ad(e))throw new DOMException(`Aborted`,`AbortError`)}async function Md(e,t){let n=Qu,r;Qu=new Promise(e=>{r=e}),await n;try{jd(e);let{authorizationUrl:n,loginId:r}=await kd(t);return e.loginId=r,jd(e),n}finally{r()}}async function Nd(e){let t;try{t=await fetch(`/api/auth/desktop-login/result`,{method:`POST`,credentials:`include`,signal:AbortSignal.any([e,AbortSignal.timeout(15e3)])})}catch(t){if(e.aborted)throw t;return null}if(cd(t.status))return null;if(!t.ok)throw Error(await Od(t,`Failed to check desktop sign-in status.`));return ad.parse(await t.json())}async function Pd(e){let t=Date.now();for(;!e.aborted;){if(Date.now()-t>Bu)throw Error(`Sign-in timed out. Try again.`);let n=await Nd(e);if(n?.status===`failed`)throw Error(n.error||`Desktop sign-in failed.`);if(n?.status===`authenticated`)return n.user;await new Promise((t,n)=>{let r=setTimeout(()=>{e.removeEventListener(`abort`,i),t()},zu);function i(){clearTimeout(r),n(new DOMException(`Aborted`,`AbortError`))}e.addEventListener(`abort`,i,{once:!0})})}throw new DOMException(`Aborted`,`AbortError`)}async function Fd(e){let t=md();if(!$())throw Error(`Machine browser sign-in is unavailable.`);Rd();let n={abort:new AbortController,loginId:null};Zu=n,Z.update(e=>({...e,isWaitingForBrowserSignIn:!0,browserSignInUrl:null,error:null}));try{await gd(),jd(n);let r=await Md(n,e);if(jd(n),Z.update(e=>({...e,browserSignInUrl:r})),jd(n),t)t.openExternal(r).catch(e=>{if(!Ad(n))return;let t=e instanceof Error?e.message.trim():``;Z.update(e=>({...e,error:t||`Automatic browser open failed.`}))});else{let e=window.open(r,`_blank`);if(e)try{e.opener=null}catch{}else Z.update(e=>({...e,error:`Your browser blocked the sign-in window.`}))}let i=await Pd(n.abort.signal);if(jd(n),t)try{await t.focusWindow()}catch(e){Ad(n)&&console.warn(`Failed to focus desktop window after sign-in`,e)}jd(n),await Id(n,i)}catch(e){if(Zu!==n)return;if(e instanceof DOMException&&e.name===`AbortError`){Z.update(e=>({...e,isWaitingForBrowserSignIn:!1,browserSignInUrl:null,error:null}));return}Z.update(t=>({...t,isWaitingForBrowserSignIn:!1,browserSignInUrl:null,error:e instanceof Error?e.message:`Failed to sign in with the browser.`}))}finally{Zu===n&&(Zu=null)}}async function Id(e,t){ud();let n=await Ed(!1,Q);jd(e),n.kind!==`stale`&&Ld(n,od(t))}function Ld(e,t){switch(e.kind){case`session`:Z.set({isLoading:!1,isReady:!0,isConfigured:!0,isWaitingForBrowserSignIn:!1,browserSignInUrl:null,user:e.user,nativeSession:`ready`,error:null});return;case`transient`:Z.set({isLoading:!1,isReady:!0,isConfigured:!0,isWaitingForBrowserSignIn:!1,browserSignInUrl:null,user:t,nativeSession:`ready`,error:null});return;case`signedOut`:Z.set(sd({error:`Native sign-in finished without a session. Try again.`}));return;case`unauthorized`:Z.update(t=>({...t,isWaitingForBrowserSignIn:!1,browserSignInUrl:null,nativeSession:`unavailable`,error:e.error}));return;case`mismatch`:Z.update(t=>({...t,isWaitingForBrowserSignIn:!1,browserSignInUrl:null,nativeSession:`mismatch`,error:e.error}));return;case`error`:Z.update(t=>({...t,isWaitingForBrowserSignIn:!1,browserSignInUrl:null,nativeSession:`unavailable`,error:e.error}));return;case`stale`:return}}function Rd(){Zu?.abort.abort(),Zu=null}function zd(){let e=Zu,t=Qu;Rd(),Z.update(e=>({...e,isWaitingForBrowserSignIn:!1,browserSignInUrl:null,error:null})),e&&t.then(async()=>{e.loginId&&await fetch(`/api/auth/desktop-login/cancel`,{method:`POST`,credentials:`include`,headers:{"content-type":`application/json`},body:JSON.stringify({loginId:e.loginId})})}).catch(()=>{})}function Bd(){Z.update(e=>!e.isWaitingForBrowserSignIn||e.error===null?e:{...e,error:null})}async function Vd(e){if($()){await Fd(e);return}let t=await _d();if(t&&await pd()){if(e===`signUp`){await t.signUp();return}await t.signIn()}}async function Hd(){await Vd(`signIn`)}async function Ud(){await Vd(`signUp`)}async function Wd(){zd(),Xu=!0,ud(),Z.update(e=>({...e,isLoading:!0}));let e=[],t=!1,n=null;try{if($())try{ld()?await wd():await Cd()}catch(t){e.push(t instanceof Error?t.message:`Failed to clear native session.`)}else{let r=await _d();if(!r){Z.set(sd());return}try{await r.signOut({navigate:!1,returnTo:window.location.origin})}catch(i){t=!0;let a=r.getUser();n=a?od(a):null,e.push(i instanceof Error?i.message:`Failed to clear browser session.`)}}Ru.set(!1),Z.set(sd({user:t?n:null,nativeSession:e.length===0?`notRequired`:`unavailable`,error:e.length===0?null:e.join(` `)}))}catch(e){Z.update(t=>({...t,isLoading:!1,error:e instanceof Error?e.message:`Failed to sign out.`}))}finally{Xu=!1}}async function Gd({forceRefreshToken:e=!1}={}){if($()){let t=Q,n=await Ed(e,t);return t!==Q||n.kind===`stale`?null:Jd(n,t)}return await Yd({forceRefreshToken:e})}function Kd(){Hu!==null&&(clearTimeout(Hu),Hu=null)}async function qd(e){let n=Q;try{if($()&&t(Z).nativeSession===`unavailable`&&(await gd(),n!==Q))return null;let r=await Gd(e);return n===Q?(Kd(),r):null}catch(e){if(n!==Q)return null;Z.update(t=>({...t,error:e instanceof Error?e.message:`Session refresh is temporarily unavailable.`}));let r=t(Z);return r.user&&r.nativeSession!==`mismatch`&&Hu===null&&(Hu=setTimeout(()=>{Hu=null,n===Q&&t(Z).user&&Lu.update(e=>e+1)},5e3)),null}}function Jd(e,t){if(t!==Q)return null;switch(e.kind){case`session`:return Z.update(t=>({...t,user:e.user,nativeSession:`ready`,error:null})),e.accessToken;case`signedOut`:return Z.update(e=>({...e,user:null,nativeSession:`notRequired`,error:null})),null;case`transient`:throw Error(e.error);case`unauthorized`:throw Z.update(t=>({...t,nativeSession:`unavailable`,error:e.error})),Error(e.error);case`mismatch`:throw Z.update(t=>({...t,nativeSession:`mismatch`,error:e.error})),Error(e.error);case`error`:throw Error(e.error);case`stale`:return null}}async function Yd({forceRefreshToken:e}){let t=await _d();if(!t)return null;try{return await t.getAccessToken({forceRefresh:e})}catch(e){if(e instanceof Error&&e.name===`LoginRequiredError`)return Z.update(e=>({...e,user:null})),null;throw e}}function Xd(e){return e.retryPending?e.isAuthenticated?{clearPending:!0,sawLoadingDuringRetry:e.sawLoadingDuringRetry}:e.isLoading?{clearPending:!1,sawLoadingDuringRetry:!0}:e.sawLoadingDuringRetry?{clearPending:!0,sawLoadingDuringRetry:!0}:{clearPending:!1,sawLoadingDuringRetry:!1}:{clearPending:!1,sawLoadingDuringRetry:!1}}async function Zd(){let e=Q;Z.update(e=>({...e,isLoading:!0,error:null})),Ru.set(!0);try{if($()&&(await gd(),e!==Q))return;let t=await Gd({forceRefreshToken:!0});if(e!==Q)return;if(!t)throw Error(`Your session has expired. Sign in again.`);Lu.update(e=>e+1),Z.update(e=>({...e,isLoading:!1,error:null}))}catch(t){if(e!==Q)return;Ru.set(!1),Z.update(e=>({...e,isLoading:!1,error:t instanceof Error?t.message:`Failed to refresh authentication.`}))}}export{Ws as A,L as C,Is as D,z as E,i as M,Ts as O,Ks as S,F as T,Eu as _,Iu as a,Kl as b,Fu as c,Td as d,Zd as f,Du as g,Ud as h,Bd as i,N as j,R as k,qd as l,Wd as m,Z as n,Ru as o,Hd as p,zd as r,Lu as s,Xd as t,vd as u,Pu as v,I as w,Sc as x,wu as y};
@@ -0,0 +1,3 @@
1
+ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},n=Array.isArray,r=Array.prototype.indexOf,i=Array.prototype.includes,a=Array.from,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyDescriptors,l=Object.prototype,u=Array.prototype,d=Object.getPrototypeOf,f=Object.isExtensible;function p(e){return typeof e==`function`}var m=()=>{};function h(e){for(var t=0;t<e.length;t++)e[t]()}function g(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function _(e,t,n=!1){return e===void 0?n?t():t:e}function v(e,t){if(Array.isArray(e))return e;if(t===void 0||!(Symbol.iterator in e))return Array.from(e);let n=[];for(let r of e)if(n.push(r),n.length===t)break;return n}var y=1<<24,b=1024,x=2048,S=4096,ee=8192,te=16384,ne=32768,re=1<<25,ie=65536,ae=1<<18,oe=1<<19,se=1<<20,ce=1<<25,le=65536,ue=1<<21,de=1<<22,fe=1<<23,pe=Symbol(`$state`),me=Symbol(`component`),he=Symbol(`legacy props`),ge=Symbol(``),_e=Symbol(`proxy path`),ve=Symbol(`attributes`),ye=Symbol(`class`),be=Symbol(`style`),xe=Symbol(`text`),Se=Symbol(`form reset`),Ce=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},we=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`),Te={},C=Symbol(`uninitialized`),Ee=`http://www.w3.org/1999/xhtml`,De=`http://www.w3.org/2000/svg`,Oe=`http://www.w3.org/1998/Math/MathML`;function ke(){console.warn(`https://svelte.dev/e/derived_inert`)}function Ae(e){console.warn(`https://svelte.dev/e/hydratable_missing_but_expected`)}function je(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function Me(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function Ne(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var w=!1;function T(e){w=e}var E;function D(e){if(e===null)throw je(),Te;return E=e}function O(){return D(R(E))}function Pe(e){if(w){if(R(E)!==null)throw je(),Te;E=e}}function Fe(e=1){if(w){for(var t=e,n=E;t--;)n=R(n);E=n}}function Ie(e=!0){for(var t=0,n=E;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else(r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=R(n);e&&n.remove(),n=i}}function Le(e){if(!e||e.nodeType!==8)throw je(),Te;return e.data}function Re(e){return e===this.v}function ze(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Be(e){return!ze(e,this.v)}function Ve(e){throw Error(`https://svelte.dev/e/experimental_async_required`)}function He(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function Ue(){throw Error(`https://svelte.dev/e/missing_context`)}function We(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function Ge(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function Ke(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function qe(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function Je(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function Ye(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function Xe(){throw Error(`https://svelte.dev/e/fork_discarded`)}function Ze(){throw Error(`https://svelte.dev/e/fork_timing`)}function Qe(){throw Error(`https://svelte.dev/e/get_abort_signal_outside_reaction`)}function $e(){throw Error(`https://svelte.dev/e/hydration_failed`)}function et(e){throw Error(`https://svelte.dev/e/lifecycle_legacy_only`)}function tt(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function nt(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function rt(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function it(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function at(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var ot=[];function st(e,t=!1,n=!1){return ct(e,new Map,``,ot,null,n)}function ct(e,t,r,i,a=null,o=!1){if(typeof e==`object`&&e){var s=t.get(e);if(s!==void 0)return s;if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(n(e)){var c=Array(e.length);t.set(e,c),a!==null&&t.set(a,c);for(var u=0;u<e.length;u+=1){var f=e[u];u in e&&(c[u]=ct(f,t,r,i,null,o))}return c}if(d(e)===l){c={},t.set(e,c),a!==null&&t.set(a,c);for(var p of Object.keys(e))c[p]=ct(e[p],t,r,i,null,o);return c}if(e instanceof Date)return e.getTime(),structuredClone(e);if(typeof e.toJSON==`function`&&!o)return ct(e.toJSON(),t,r,i,e)}if(e instanceof EventTarget)return e;try{return structuredClone(e)}catch{return e}}function lt(e,t){return e.label=t,ut(e.v,t),e}function ut(e,t){return e?.[_e]?.(t),e}function dt(e){return typeof e==`symbol`?`Symbol(${e.description})`:typeof e==`function`?`<function>`:typeof e==`object`&&e?`<object>`:String(e)}function ft(e,t,n){let r={};return[()=>(n(r)||Ue(),e(r)),e=>t(r,e),()=>n(r)]}function pt(e){let t=e.p;for(;t!==null&&t.c===null;)t=t.p;return t?.c??null}function mt(e,t){return e===null&&He(t),e.c??=new Map(pt(e)||void 0)}var k=null;function ht(e){k=e}function gt(){return ft(_t,vt,yt)}function _t(e){return mt(k,`getContext`).get(e)}function vt(e,t){return mt(k,`setContext`).set(e,t),t}function yt(e){return mt(k,`hasContext`).has(e)}function bt(){return mt(k,`getAllContexts`)}function xt(e,t=!1,n){k={p:k,i:!1,c:null,e:null,s:e,x:null,r:K,l:null}}function St(e){var t=k,n=t.e;if(n!==null){t.e=null;for(var r of n)cr(r)}return e!==void 0&&(t.x=e),t.i=!0,k=t.p,Ct(e)}function Ct(e={}){return o(e,me,{value:!0}),e}function wt(){return!0}var Tt=[];function Et(){var e=Tt;Tt=[],h(e)}function A(e){if(Tt.length===0&&!pn){var t=Tt;queueMicrotask(()=>{t===Tt&&Et()})}Tt.push(e)}function Dt(){for(;Tt.length>0;)Et()}var Ot=~(x|S|b);function j(e,t){e.f=e.f&Ot|t}function kt(e){e.f&512||e.deps===null?j(e,b):j(e,S)}function At(e){if(e!==null)for(let t of e)t.f&2&&t.f&65536&&(t.f^=le,At(t.deps))}function jt(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),At(e.deps),j(e,b)}function Mt(e,t,n){if(e==null)return t(void 0),n&&n(void 0),m;let r=Yr(()=>e.subscribe(t,n));return r.unsubscribe?()=>r.unsubscribe():r}var Nt=[];function Pt(e,t){return{subscribe:Ft(e,t).subscribe}}function Ft(e,t=m){let n=null,r=new Set;function i(t){if(ze(e,t)&&(e=t,n)){let t=!Nt.length;for(let t of r)t[1](),Nt.push(t,e);if(t){for(let e=0;e<Nt.length;e+=2)Nt[e][0](Nt[e+1]);Nt.length=0}}}function a(t){i(t(e))}function o(o,s=m){let c=[o,s];return r.add(c),r.size===1&&(n=t(i,a)||m),o(e),()=>{r.delete(c),r.size===0&&n&&(n(),n=null)}}return{set:i,update:a,subscribe:o}}function It(e,t,n){let r=!Array.isArray(e),i=r?[e]:e;if(!i.every(Boolean))throw Error(`derived() expects stores as input, got a falsy value`);let a=t.length<2;return Pt(n,(e,n)=>{let o=!1,s=[],c=0,l=m,u=()=>{if(c)return;l();let i=t(r?s[0]:s,e,n);a?e(i):l=typeof i==`function`?i:m},d=i.map((e,t)=>Mt(e,e=>{s[t]=e,c&=~(1<<t),o&&u()},()=>{c|=1<<t}));return o=!0,u(),function(){h(d),l(),o=!1}})}function Lt(e){let t;return Mt(e,e=>t=e)(),t}var Rt=!1,zt=Symbol(`unmounted`);function Bt(e,t,n){let r=n[t]??={store:null,source:Pn(void 0),unsubscribe:m};if(r.store!==e&&!(zt in n)){if(r.unsubscribe(),r.store=e??null,e==null)r.source.v=void 0,r.unsubscribe=m;else{var i=!0;r.unsubscribe=Mt(e,e=>{i?r.source.v=e:F(r.source,e)}),i=!1}}return e&&zt in n?Lt(e):Q(r.source)}function Vt(){let e={};function t(){or(()=>{for(var t in e)e[t].unsubscribe();o(e,zt,{enumerable:!1,value:!0})})}return[e,t]}function Ht(e){var t=Rt;try{return Rt=!1,[e(),Rt]}finally{Rt=t}}function Ut(e,t){if(t){let t=document.body;e.autofocus=!0,A(()=>{document.activeElement===t&&e.focus()})}}function Wt(e){w&&L(e)!==null&&Qn(e)}var Gt=!1;function Kt(){Gt||(Gt=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[Se]?.()})},{capture:!0}))}function qt(e){var t=U,n=K;G(null),q(null);try{return e()}finally{G(t),q(n)}}function Jt(e,t,n,r=n){e.addEventListener(t,()=>qt(n));let i=e[Se];e[Se]=i?()=>{i(),r(!0)}:()=>r(!0),Kt()}function Yt(e,t,n,r){let i=wt()?$t:rn;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=K,c=Xt(),l=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function u(e){if(!(s.f&16384)){c();try{r([...o,...e])}catch(e){z(e,s)}Zt()}}var d=Qt();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>tn(e))).then(u).catch(e=>z(e,s)).finally(d)}l?l.then(()=>{c(),f(),Zt()}):f()}function Xt(){var e=K,t=U,n=k,r=M;return function(i=!0){q(e),G(t),ht(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function Zt(e=!0){q(null),G(null),ht(null),e&&M?.deactivate()}function Qt(){var e=K,t=e.b,n=M,r=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(r,e),()=>{t?.update_pending_count(-1,n),n.decrement(r,e)}}function $t(e){var t=2|x;return K!==null&&(K.f|=oe),{ctx:k,deps:null,effects:null,equals:Re,f:t,fn:e,reactions:null,rv:0,v:C,wv:0,parent:K,ac:null}}var en=Symbol(`obsolete`);function tn(e,t,n){let r=K;r===null&&We();var i=void 0,a=Mn(C),o=!U,s=new Set;return fr(()=>{var t=K,n=g();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==Ce&&n.reject(e)}).finally(Zt)}catch(e){n.reject(e),Zt()}var c=M;if(o){if(t.f&32768)var l=Qt();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(en);else for(let e of s.values())e.reject(en);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==en&&(c.activate(),t?(a.f|=fe,Fn(a,t)):(a.f&8388608&&(a.f^=fe),Fn(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),or(()=>{for(let e of s)e.reject(en)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function nn(e){let t=$t(e);return jr(t),t}function rn(e){let t=$t(e);return t.equals=Be,t}function an(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)H(t[n])}}function on(e){var t,n=K,r=e.parent;if(!kr&&r!==null&&e.v!==C&&r.f&24576)return ke(),e.v;q(r);try{e.f&=~le,an(e),t=Br(e)}finally{q(n)}return t}function sn(e){var t=on(e);if(!e.equals(t)&&(e.wv=Lr(),(!M?.is_fork||e.deps===null)&&(M===null?e.v=t:(M.capture(e,t,!0),dn?.capture(e,t,!0)),e.deps===null))){j(e,b);return}kr||(N===null?kt(e):(ar()||M?.is_fork)&&N.set(e,t))}function cn(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac!==null&&qt(()=>{t.ac.abort(Ce),t.ac=null}),t.fn!==null&&(t.teardown=m),Ur(t,0),vr(t))}function ln(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&Wr(t)}var un=null,M=null,dn=null,N=null,fn=null,pn=!1,mn=!1,hn=null,gn=null,_n=0,vn=1,yn=class e{id=vn++;#e=!1;linked=!0;#t=null;#n=null;async_deriveds=new Map;current=new Map;previous=new Map;#r=new Set;#i=new Set;#a=0;#o=new Map;#s=null;#c=[];#l=[];#u=new Set;#d=new Set;#f=new Map;#p=new Set;is_fork=!1;#m=!1;constructor(){un===null?un=this:(un.#n=this,this.#t=un),un=this}#h(){if(this.is_fork)return!0;for(let n of this.#o.keys()){for(var e=n,t=!1;e.parent!==null;){if(this.#f.has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}skip_effect(e){this.#f.has(e)||this.#f.set(e,{d:[],m:[]}),this.#p.delete(e)}unskip_effect(e,t=e=>this.schedule(e)){var n=this.#f.get(e);if(n){this.#f.delete(e);for(var r of n.d)j(r,x),t(r);for(r of n.m)j(r,S),t(r)}this.#p.add(e)}#g(){this.#e=!0,_n++>1e3&&(this.#x(),xn());for(let e of this.#u)this.#d.delete(e),j(e,x),this.schedule(e);for(let e of this.#d)j(e,S),this.schedule(e);let t=this.#c;this.#c=[],this.apply();var n=hn=[],r=[],i=gn=[];for(let e of t)try{this.#_(e,n,r)}catch(t){throw Dn(e),this.#h()||this.discard(),t}if(M=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(hn=null,gn=null,this.#h()){this.#b(r),this.#b(n);for(let[e,t]of this.#f)En(e,t);i.length>0&&M.#g();return}let o=this.#v();if(o){this.#b(r),this.#b(n),o.#y(this);return}this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),dn=this,Cn(r),Cn(n),dn=null,this.#s?.resolve();var s=M;if(this.#a===0&&(this.#c.length===0||s!==null)&&this.#x(),this.#c.length>0){if(s!==null){let e=s;e.#c.push(...this.#c.filter(t=>!e.#c.includes(t)))}else s=this}s!==null&&(P.clear(),s.#g())}#_(e,t,n){e.f^=b;for(var r=e.first;r!==null;){var i=r.f,a=!!(i&96);if(!(a&&i&1024||i&8192||this.#f.has(r))&&r.fn!==null){a?r.f^=b:i&4?t.push(r):Rr(r)&&(i&16&&this.#d.add(r),Wr(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#v(){for(var e=this.#t;e!==null;){if(!e.is_fork){for(let[t,[,n]]of this.current)if(e.current.has(t)&&!n)return e}e=e.#t}return null}#y(e){for(let[t,n]of e.current)!this.previous.has(t)&&e.previous.has(t)&&this.previous.set(t,e.previous.get(t)),this.current.set(t,n);for(let[t,n]of e.async_deriveds){let e=this.async_deriveds.get(t);e&&n.promise.then(e.resolve).catch(e.reject)}e.async_deriveds.clear(),this.transfer_effects(e.#u,e.#d);let t=e=>{var n=e.reactions;if(n!==null&&!(e.f&2&&!(e.f&6144)))for(let e of n){var r=e.f;if(r&2)t(e);else{var i=e;r&4194320&&!this.async_deriveds.has(i)&&(this.#d.delete(i),j(i,x),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#x(),M=this,this.#g()}#b(e){for(var t=0;t<e.length;t+=1)jt(e[t],this.#u,this.#d)}capture(e,t,n=!1){e.v!==C&&!this.previous.has(e)&&this.previous.set(e,e.v),e.f&8388608||(this.current.set(e,[t,n]),N?.set(e,t)),this.is_fork||(e.v=t)}activate(){M=this}deactivate(){M=null,N=null}flush(){try{mn=!0,M=this,this.#g()}finally{_n=0,fn=null,hn=null,gn=null,mn=!1,M=null,N=null,P.clear()}}discard(){for(let e of this.#i)e(this);this.#i.clear();for(let e of this.async_deriveds.values())e.reject(en);this.#x(),this.#s?.resolve()}register_created_effect(e){this.#l.push(e)}increment(e,t){if(this.#a+=1,e){let e=this.#o.get(t)??0;this.#o.set(t,e+1)}}decrement(e,t){if(--this.#a,e){let e=this.#o.get(t)??0;e===1?this.#o.delete(t):this.#o.set(t,e-1)}this.#m||(this.#m=!0,A(()=>{this.#m=!1,this.linked&&this.flush()}))}transfer_effects(e,t){for(let t of e)this.#u.add(t);for(let e of t)this.#d.add(e);e.clear(),t.clear()}oncommit(e){this.#r.add(e)}ondiscard(e){this.#i.add(e)}settled(){return(this.#s??=g()).promise}static ensure(){if(M===null){let t=M=new e;!mn&&!pn&&A(()=>{t.#e||t.flush()})}return M}apply(){N=null}schedule(e){if(fn=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(hn!==null&&t===K&&(U===null||!(U.f&2)))return;if(n&96){if(!(n&1024))return;t.f^=b}}this.#c.push(t)}#x(){if(this.linked){var e=this.#t,t=this.#n;e===null||(e.#n=t),t===null?un=e:t.#t=e,this.linked=!1}}};function bn(e){var t=pn;pn=!0;try{var n;for(e&&(M!==null&&!M.is_fork&&M.flush(),n=e());;){if(Dt(),M===null)return n;M.flush()}}finally{pn=t}}function xn(){try{Ye()}catch(e){z(e,fn)}}var Sn=null;function Cn(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&Rr(r)&&(Sn=new Set,Wr(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&xr(r),Sn?.size>0)){P.clear();for(let e of Sn){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Sn.has(n)&&(Sn.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||Wr(n)}}Sn.clear()}}Sn=null}}function wn(e,t){if(e.reactions!==null)for(let n of e.reactions){let e=n.f;e&2?wn(n,t):e&131072&&(j(n,x),t.add(n))}}function Tn(e){M.schedule(e)}function En(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),j(e,b);for(var n=e.first;n!==null;)En(n,t),n=n.next}}function Dn(e){j(e,b);for(var t=e.first;t!==null;)Dn(t),t=t.next}function On(e){Ve(`fork`),M!==null&&Ze();var t=yn.ensure();t.is_fork=!0,N=new Map;var n=!1,r=t.settled();return bn(e),{commit:async()=>{if(n){await r;return}t.linked||Xe(),n=!0,t.is_fork=!1;for(var[e,[i]]of t.current)e.v=i,e.wv=Lr();bn(()=>{var e=new Set;for(var n of t.current.keys())wn(n,e);An(e),In()}),t.flush(),await r},discard:()=>{for(var e of t.current.keys())e.wv=Lr();!n&&t.linked&&t.discard()}}}var kn=new Set,P=new Map;function An(e){kn=e}var jn=!1;function Mn(e,t){return{f:0,v:e,reactions:null,equals:Re,rv:0,wv:0}}function Nn(e,t){let n=Mn(e,t);return jr(n),n}function Pn(e,t=!1,n=!0){let r=Mn(e);return t||(r.equals=Be),r}function F(e,t,n=!1){return U!==null&&(!W||U.f&131072)&&wt()&&U.f&4325394&&(J===null||!J.has(e))&&it(),Fn(e,n?zn(t):t,gn)}function Fn(e,t,n=null){if(!e.equals(t)){kr?P.set(e,t):P.has(e)||P.set(e,e.v);var r=yn.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&on(t),N===null&&kt(t)}e.wv=Lr(),Rn(e,x,n),wt()&&K!==null&&K.f&1024&&!(K.f&96)&&(Z===null?Mr([e]):Z.push(e)),!r.is_fork&&kn.size>0&&!jn&&In()}return t}function In(){jn=!1;for(let e of kn){e.f&1024&&j(e,S);let t;try{t=Rr(e)}catch{t=!0}t&&Wr(e)}kn.clear()}function Ln(e){F(e,e.v+1)}function Rn(e,t,n){var r=e.reactions;if(r!==null)for(var i=wt(),a=r.length,o=0;o<a;o++){var s=r[o],c=s.f;if(i||s!==K){var l=(c&x)===0;if(l&&j(s,t),c&131072)kn.add(s);else if(c&2){var u=s;N?.delete(u),c&65536||(c&512&&(K===null||!(K.f&2097152))&&(s.f|=le),Rn(u,S,n))}else if(l){var d=s;c&16&&Sn!==null&&Sn.add(d),n===null?Tn(d):n.push(d)}}}}function zn(e){if(typeof e!=`object`||!e||pe in e||me in e)return e;let t=d(e);if(t!==l&&t!==u)return e;var r=new Map,i=n(e),a=Nn(0),o=null,c=Fr,f=e=>{if(Fr===c)return e();var t=U,n=Fr;G(null),Ir(c);var r=e();return G(t),Ir(n),r};return i&&r.set(`length`,Nn(e.length,o)),new Proxy(e,{defineProperty(e,t,n){(!(`value`in n)||n.configurable===!1||n.enumerable===!1||n.writable===!1)&&nt();var i=r.get(t);return i===void 0?f(()=>{var e=Nn(n.value,o);return r.set(t,e),e}):F(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>Nn(C,o));r.set(t,e),Ln(a)}}else F(n,C),Ln(a);return!0},get(t,n,i){if(n===pe)return e;var a=r.get(n),c=n in t;if(a===void 0&&(!c||s(t,n)?.writable)&&(a=f(()=>Nn(zn(c?t[n]:C),o)),r.set(n,a)),a!==void 0){var l=Q(a);return l===C?void 0:l}return Reflect.get(t,n,i)},getOwnPropertyDescriptor(e,t){var n=Reflect.getOwnPropertyDescriptor(e,t);if(n&&`value`in n){var i=r.get(t);i&&(n.value=Q(i))}else if(n===void 0){var a=r.get(t),o=a?.v;if(a!==void 0&&o!==C)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return n},has(e,t){if(t===pe)return!0;var n=r.get(t),i=n!==void 0&&n.v!==C||Reflect.has(e,t);return(n!==void 0||K!==null&&(!i||s(e,t)?.writable))&&(n===void 0&&(n=f(()=>Nn(i?zn(e[t]):C,o)),r.set(t,n)),Q(n)===C)?!1:i},set(e,t,n,c){var l=r.get(t),u=t in e;if(i&&t===`length`)for(var d=n;d<l.v;d+=1){var p=r.get(d+``);p===void 0?d in e&&(p=f(()=>Nn(C,o)),r.set(d+``,p)):F(p,C)}if(l===void 0)(!u||s(e,t)?.writable)&&(l=f(()=>Nn(void 0,o)),F(l,zn(n)),r.set(t,l));else{u=l.v!==C;var m=f(()=>zn(n));F(l,m)}var h=Reflect.getOwnPropertyDescriptor(e,t);if(h?.set&&h.set.call(c,n),!u){if(i&&typeof t==`string`){var g=r.get(`length`),_=Number(t);Number.isInteger(_)&&_>=g.v&&F(g,_+1)}Ln(a)}return!0},ownKeys(e){Q(a);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return t===void 0||t.v!==C});for(var[n,i]of r)i.v!==C&&!(n in e)&&t.push(n);return t},setPrototypeOf(){rt()}})}function Bn(e){try{if(typeof e==`object`&&e&&pe in e)return e[pe]}catch{}return e}function Vn(e,t){return Object.is(Bn(e),Bn(t))}var Hn,Un,Wn,Gn,Kn;function qn(){if(Hn===void 0){Hn=window,Un=document,Wn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Gn=s(t,`firstChild`).get,Kn=s(t,`nextSibling`).get,f(e)&&(e[ye]=void 0,e[ve]=null,e[be]=void 0,e.__e=void 0),f(n)&&(n[xe]=void 0)}}function I(e=``){return document.createTextNode(e)}function L(e){return Gn.call(e)}function R(e){return Kn.call(e)}function Jn(e,t){if(!w)return L(e);var n=L(E);if(n===null)n=E.appendChild(I());else if(t&&n.nodeType!==3){var r=I();return n?.before(r),D(r),r}return t&&tr(n),D(n),n}function Yn(e,t=!1){if(!w){var n=L(e);return n instanceof Comment&&n.data===``?R(n):n}if(t){if(E?.nodeType!==3){var r=I();return E?.before(r),D(r),r}tr(E)}return E}function Xn(e,t=!1){if(!w)return L(e);var n=Jn(e,t);return Pe(e),n}function Zn(e,t=1,n=!1){let r=w?E:e;for(var i;t--;)i=r,r=R(r);if(!w)return r;if(n){if(r?.nodeType!==3){var a=I();return r===null?i?.after(a):r.before(a),D(a),a}tr(r)}return D(r),r}function Qn(e){e.textContent=``}function $n(){return!1}function er(e,t,n){return t==null||t===`http://www.w3.org/1999/xhtml`?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function tr(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function nr(e){var t=K;if(t===null)return U.f|=fe,e;if(!(t.f&32768)&&!(t.f&4))throw e;z(e,t)}function z(e,t){if(!(t!==null&&t.f&16384)){for(;t!==null;){if(t.f&128&&!(t.f&33570816)){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}}function rr(e){K===null&&(U===null&&Je(e),qe()),kr&&Ke(e)}function ir(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function B(e,t){var n=K;n!==null&&n.f&8192&&(e|=ee);var r={ctx:k,deps:null,nodes:null,f:e|x|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};M?.register_created_effect(r);var i=r;if(e&4)hn===null?yn.ensure().schedule(r):hn.push(r);else if(t!==null){try{Wr(r)}catch(e){throw H(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=ie))}if(i!==null&&(i.parent=n,n!==null&&ir(i,n),U!==null&&U.f&2&&!(e&64))){var a=U;(a.effects??=[]).push(i)}return r}function ar(){return U!==null&&!W}function or(e){let t=B(8,null);return j(t,b),t.teardown=e,t}function sr(e){rr(`$effect`);var t=K.f;if(!U&&t&32&&k!==null&&!k.i){var n=k;(n.e??=[]).push(e)}else return cr(e)}function cr(e){return B(4|se,e)}function lr(e){return rr(`$effect.pre`),B(8|se,e)}function ur(e){yn.ensure();let t=B(64|oe,e);return(e={})=>new Promise(n=>{e.outro?Sr(t,()=>{H(t),n(void 0)}):(H(t),n(void 0))})}function dr(e){return B(4,e)}function fr(e){return B(de|oe,e)}function pr(e,t=0){return B(8|t,e)}function mr(e,t=[],n=[],r=[]){Yt(r,t,n,t=>{B(8,()=>{e(...t.map(Q))})})}function hr(e,t=0){return B(16|t,e)}function gr(e,t=0){return B(y|t,e)}function V(e){return B(32|oe,e)}function _r(e){var t=e.teardown;if(t!==null){let n=kr,r=U;Ar(!0),G(null);try{t.call(null)}catch(t){z(t,e.parent)}finally{Ar(n),G(r)}}}function vr(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&qt(()=>{e.abort(Ce)});var r=n.next;n.f&64?n.parent=null:H(n,t),n=r}}function yr(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||H(t),t=n}}function H(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(br(e.nodes.start,e.nodes.end),n=!0),e.f|=re,vr(e,t&&!n),Ur(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();_r(e),e.f^=re,e.f|=te;var i=e.parent;i!==null&&i.first!==null&&xr(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function br(e,t){for(;e!==null;){var n=e===t?null:R(e);e.remove(),e=n}}function xr(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function Sr(e,t,n=!0){var r=[];e.f|=256,Cr(e,r,!0);var i=()=>{n&&H(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function Cr(e,t,n){if(!(e.f&8192)){e.f^=ee;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=!!(i.f&65536)||!!(i.f&32)&&!!(e.f&16);Cr(i,t,o?n:!1)}i=a}}}function wr(e){e.f&=-257,Tr(e,!0)}function Tr(e,t){if(!(e.f&256)&&e.f&8192){e.f^=ee,e.f&1024||(j(e,x),yn.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=!!(n.f&65536)||!!(n.f&32);Tr(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function Er(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:R(n);t.append(n),n=i}}var Dr=null,Or=!1,kr=!1;function Ar(e){kr=e}var U=null,W=!1;function G(e){U=e}var K=null;function q(e){K=e}var J=null;function jr(e){U!==null&&(J??=new Set).add(e)}var Y=null,X=0,Z=null;function Mr(e){Z=e}var Nr=1,Pr=0,Fr=Pr;function Ir(e){Fr=e}function Lr(){return++Nr}function Rr(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~le),t&4096){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if(Rr(a)&&sn(a),a.wv>e.wv)return!0}t&512&&N===null&&j(e,b)}return!1}function zr(e,t,n=!0){var r=e.reactions;if(r!==null&&!(J!==null&&J.has(e)))for(var i=0;i<r.length;i++){var a=r[i];a.f&2?zr(a,t,!1):t===a&&(n?j(a,x):a.f&1024&&j(a,S),Tn(a))}}function Br(e){var t=Y,n=X,r=Z,i=U,a=J,o=k,s=W,c=Fr,l=e.f;Y=null,X=0,Z=null,U=l&96?null:e,J=null,ht(e.ctx),W=!1,Fr=++Pr,e.ac!==null&&(qt(()=>{e.ac.abort(Ce)}),e.ac=null);try{e.f|=ue;var u=e.fn,d=u();e.f|=ne;var f=Vr(e);if(wt()&&Z!==null&&!W&&f!==null&&!(e.f&6146))for(var p=0;p<Z.length;p++)zr(Z[p],e);if(i!==null&&i!==e){if(Pr++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=Pr;if(t!==null)for(let e of t)e.rv=Pr;Z!==null&&(r===null?r=Z:r.push(...Z))}return e.f&8388608&&(e.f^=fe),d}catch(t){return Vr(e),nr(t)}finally{e.f^=ue,Y=t,X=n,Z=r,U=i,J=a,ht(o),W=s,Fr=c}}function Vr(e){var t=e.deps,n=M?.is_fork;if(Y!==null){var r;if(n||Ur(e,X),t!==null&&X>0)for(t.length=X+Y.length,r=0;r<Y.length;r++)t[X+r]=Y[r];else e.deps=t=Y;if(ar()&&e.f&512)for(r=X;r<t.length;r++)(t[r].reactions??=[]).push(e)}else!n&&t!==null&&X<t.length&&(Ur(e,X),t.length=X);return t}function Hr(e,t){let n=t.reactions;if(n!==null){var a=r.call(n,e);if(a!==-1){var o=n.length-1;o===0?n=t.reactions=null:(n[a]=n[o],n.pop())}}if(n===null&&t.f&2&&(Y===null||!i.call(Y,t))){var s=t;s.f&512&&(s.f^=512,s.f&=~le),s.v!==C&&kt(s),s.ac!==null&&qt(()=>{s.ac.abort(Ce),s.ac=null,j(s,x)}),cn(s),Ur(s,0)}}function Ur(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Hr(e,n[r])}function Wr(e){var t=e.f;if(!(t&16384)){j(e,b);var n=K,r=Or;K=e,Or=!(t&96);try{t&16777232?yr(e):vr(e),_r(e);var i=Br(e);e.teardown=typeof i==`function`?i:null,e.wv=Nr}finally{Or=r,K=n}}}async function Gr(){await Promise.resolve(),bn()}function Kr(){return yn.ensure().settled()}function Q(e){var t=!!(e.f&2);if(Dr?.add(e),U!==null&&!W&&!(K!==null&&K.f&16384)&&(J===null||!J.has(e))){var n=U.deps;if(U.f&2097152)e.rv<Pr&&(e.rv=Pr,Y===null&&n!==null&&n[X]===e?X++:Y===null?Y=[e]:Y.push(e));else{U.deps??=[],i.call(U.deps,e)||U.deps.push(e);var r=e.reactions;r===null?e.reactions=[U]:i.call(r,U)||r.push(U)}}if(kr&&P.has(e))return P.get(e);if(t){var a=e;if(kr){var o=a.v;return(!(a.f&1024)&&a.reactions!==null||Jr(a))&&(o=on(a)),P.set(a,o),o}var s=!(a.f&512)&&!W&&U!==null&&(Or||!!(U.f&512)),c=(a.f&ne)===0;Rr(a)&&(s&&(a.f|=512),sn(a)),s&&!c&&(ln(a),qr(a))}if(N?.has(e))return N.get(e);if(e.f&8388608)throw e.v;return e.v}function qr(e){if(e.f|=512,e.deps!==null)for(let t of e.deps)(t.reactions??=[]).push(e),t.f&2&&!(t.f&512)&&(ln(t),qr(t))}function Jr(e){if(e.v===C)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(P.has(t)||t.f&2&&Jr(t))return!0;return!1}function Yr(e){var t=W;try{return W=!0,e()}finally{W=t}}function Xr(e){return e.endsWith(`capture`)&&e!==`gotpointercapture`&&e!==`lostpointercapture`}var Zr=[`beforeinput`,`click`,`change`,`dblclick`,`contextmenu`,`focusin`,`focusout`,`input`,`keydown`,`keyup`,`mousedown`,`mousemove`,`mouseout`,`mouseover`,`mouseup`,`pointerdown`,`pointermove`,`pointerout`,`pointerover`,`pointerup`,`touchend`,`touchmove`,`touchstart`];function Qr(e){return Zr.includes(e)}var $r=`allowfullscreen.async.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.webkitdirectory.defer.disablepictureinpicture.disableremoteplayback`.split(`.`),ei={formnovalidate:`formNoValidate`,ismap:`isMap`,nomodule:`noModule`,playsinline:`playsInline`,readonly:`readOnly`,defaultvalue:`defaultValue`,defaultchecked:`defaultChecked`,srcobject:`srcObject`,novalidate:`noValidate`,allowfullscreen:`allowFullscreen`,disablepictureinpicture:`disablePictureInPicture`,disableremoteplayback:`disableRemotePlayback`};function ti(e){return e=e.toLowerCase(),ei[e]??e}[...$r];var ni=[`touchstart`,`touchmove`];function ri(e){return ni.includes(e)}var ii=[`textarea`,`script`,`style`,`title`];function ai(e){return ii.includes(e)}var oi=Symbol(`events`),si=new Set,ci=new Set;function li(e,t,n,r={}){function i(e){if(r.capture||hi.call(t,e),!e.cancelBubble)return qt(()=>n?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?A(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function ui(e,t,n,r,i){var a={capture:r,passive:i},o=li(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&or(()=>{t.removeEventListener(e,o,a)})}function di(e,t,n){(t[oi]??={})[e]=n}function fi(e){for(var t=0;t<e.length;t++)si.add(e[t]);for(var n of ci)n(e)}var pi=null,mi=!1;function hi(e){var t=this,n=t.ownerDocument,r=e.type,i=e.composedPath?.()||[],a=i[0]||e.target;pi=e,mi||(mi=!0,setTimeout(()=>{mi=!1,pi=null}));var s=0,c=pi===e&&e[oi];if(c){var l=i.indexOf(c);if(l!==-1&&(t===document||t===window)){e[oi]=t;return}var u=i.indexOf(t);if(u===-1)return;l<=u&&(s=l)}if(a=i[s]||e.target,a!==t){o(e,`currentTarget`,{configurable:!0,get(){return a||n}});var d=U,f=K;G(null),q(null);try{for(var p,m=[];a!==null&&a!==t;){try{var h=a[oi]?.[r];h!=null&&(!a.disabled||e.target===a)&&h.call(a,e)}catch(e){p?m.push(e):p=e}if(e.cancelBubble)break;s++,a=s<i.length?i[s]:null}if(p){for(let e of m)queueMicrotask(()=>{throw e});throw p}}finally{e[oi]=t,delete e.currentTarget,G(d),q(f)}}}var gi=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function _i(e){return gi?.createHTML(e)??e}function vi(e){var t=er(`template`);return t.innerHTML=_i(e.replaceAll(`<!>`,`<!---->`)),t.content}function $(e,t){var n=K;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function yi(e,t){var n=!!(t&1),r=!!(t&2),i,a=!e.startsWith(`<!>`);return()=>{if(w)return $(E,null),E;i===void 0&&(i=vi(a?e:`<!>`+e),n||(i=L(i)));var t=r||Wn?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=L(t),s=t.lastChild;$(o,s)}else $(t,t);return t}}function bi(e,t,n=`svg`){var r=!e.startsWith(`<!>`),i=!!(t&1),a=`<${n}>${r?e:`<!>`+e}</${n}>`,o;return()=>{if(w)return $(E,null),E;if(!o){var e=L(vi(a));if(i)for(o=document.createDocumentFragment();L(e);)o.appendChild(L(e));else o=L(e)}var t=o.cloneNode(!0);if(i){var n=L(t),r=t.lastChild;$(n,r)}else $(t,t);return t}}function xi(e,t){return bi(e,t,`svg`)}function Si(e=``){if(!w){var t=I(e+``);return $(t,t),t}var n=E;return n.nodeType===3?tr(n):(n.before(n=I()),D(n)),$(n,n),n}function Ci(){if(w)return $(E,null),E;var e=document.createDocumentFragment(),t=document.createComment(``),n=I();return e.append(t,n),$(t,n),e}function wi(e,t){if(w){var n=K;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=E),O();return}e!==null&&e.before(t)}function Ti(e){let t=0,n=Mn(0),r;return()=>{ar()&&(Q(n),pr(()=>(t===0&&(r=Yr(()=>e(()=>Ln(n)))),t+=1,()=>{A(()=>{--t,t===0&&(r?.(),r=void 0,Ln(n))})})))}}var Ei=ie|oe;function Di(e,t,n,r){new Oi(e,t,n,r)}var Oi=class{parent;is_pending=!1;transform_error;#e;#t=w?E:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Set;#p=new Set;#m=null;#h=Ti(()=>(this.#m=Mn(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=K;t.b=this,t.f|=128,n(e)},this.parent=K.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=hr(()=>{if(w){let e=this.#t;O();let t=e.data===`[!`;if(e.data.startsWith(`[?`)){let t=JSON.parse(e.data.slice(2));this.#_(t)}else t?this.#y():this.#g()}else this.#b()},Ei),w&&(this.#e=E)}#g(){try{this.#a=V(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed,{reset:n,invoke_onerror:r}=this.#v(e);A(r),t&&(this.#s=V(()=>{t(this.#e,()=>e,()=>n)}))}#v(e){var t=!1,n=!1;let r=()=>{if(t){Ne();return}t=!0,n&&at(),this.#s!==null&&Sr(this.#s,()=>{this.#s=null}),this.#S(()=>{this.#b()})};return{reset:r,invoke_onerror:()=>{try{n=!0,this.#n.onerror?.(e,r),n=!1}catch(e){z(e,this.#i&&this.#i.parent)}}}}#y(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=V(()=>e(this.#e)),A(()=>{var e=this.#c=document.createDocumentFragment(),t=I(),n=!1;if(e.append(t),this.#a=this.#S(()=>{try{return V(()=>this.#r(t))}catch(e){try{this.error(e),n=!0}catch(e){z(e,this.#i.parent)}return null}}),this.#a===null){this.#c=null,n&&this.#x(M);return}this.#u===0&&(this.#e.before(e),this.#c=null,Sr(this.#o,()=>{this.#o=null}),this.#x(M))}))}#b(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=V(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();Er(this.#a,e);let t=this.#n.pending;this.#o=V(()=>t(this.#e))}else this.#x(M)}catch(e){this.error(e)}}#x(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){jt(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#S(e){var t=K,n=U,r=k;q(this.#i),G(this.#i),ht(this.#i.ctx);try{return yn.ensure(),e()}finally{q(t),G(n),ht(r)}}#C(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#C(e,t);return}this.#u+=e,this.#u===0&&(this.#x(t),this.#o&&Sr(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))}update_pending_count(e,t){this.#C(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,A(()=>{this.#d=!1,this.#m&&Fn(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),Q(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;M?.is_fork?(this.#a&&M.skip_effect(this.#a),this.#o&&M.skip_effect(this.#o),this.#s&&M.skip_effect(this.#s),M.oncommit(()=>{this.#w(e)})):this.#w(e)}#w(e){this.#a&&=(H(this.#a),null),this.#o&&=(H(this.#o),null),this.#s&&=(H(this.#s),null),w&&(D(this.#t),Fe(),D(Ie()));let t=this.#n.failed,n=e=>{let{reset:n,invoke_onerror:r}=this.#v(e);r(),t&&(this.#s=this.#S(()=>{try{return V(()=>{var r=K;r.b=this,r.f|=128,t(this.#e,()=>e,()=>n)})}catch(e){return z(e,this.#i.parent),null}}))};A(()=>{var t;try{t=this.transform_error(e)}catch(e){z(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(n,e=>z(e,this.#i&&this.#i.parent)):n(t)})}};function ki(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[xe]??=e.nodeValue)&&(e[xe]=n,e.nodeValue=`${n}`)}function Ai(e,t){return Ni(e,t)}function ji(e,t){qn(),t.intro=t.intro??!1;let n=t.target,r=w,i=E;try{for(var a=L(n);a&&(a.nodeType!==8||a.data!==`[`);)a=R(a);if(!a)throw Te;T(!0),D(a);let r=Ni(e,{...t,anchor:a});return T(!1),r}catch(r){if(r instanceof Error&&r.message.split(`
2
+ `).some(e=>e.startsWith(`https://svelte.dev/e/`)))throw r;return r!==Te&&console.warn(`Failed to hydrate: `,r),t.recover===!1&&$e(),qn(),Qn(n),T(!1),Ai(e,t)}finally{T(r),D(i)}}var Mi=new Map;function Ni(e,{target:t,anchor:n,props:r={},events:i,context:o,intro:s=!0,transformError:c}){qn();var l=void 0,u=ur(()=>{var s=n??t.appendChild(I());Di(s,{pending:()=>{}},t=>{xt({});var n=k;if(o&&(n.c=o),i&&(r.$$events=i),w&&$(t,null),l=e(t,r)||Ct(),w&&(K.nodes.end=E,E===null||E.nodeType!==8||E.data!==`]`))throw je(),Te;St()},c);var u=new Set,d=e=>{for(var n=0;n<e.length;n++){var r=e[n];if(!u.has(r)){u.add(r);var i=ri(r);for(let e of[t,document]){var a=Mi.get(e);a===void 0&&(a=new Map,Mi.set(e,a));var o=a.get(r);o===void 0?(e.addEventListener(r,hi,{passive:i}),a.set(r,1)):a.set(r,o+1)}}}};return d(a(si)),ci.add(d),()=>{for(var e of u)for(let n of[t,document]){var r=Mi.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,hi),r.delete(e),r.size===0&&Mi.delete(n)):r.set(e,i)}ci.delete(d),s!==n&&s.parentNode?.removeChild(s)}});return Pi.set(l,u),l}var Pi=new WeakMap;function Fi(e,t){let n=Pi.get(e);return n?(Pi.delete(e),n(t)):Promise.resolve()}var Ii=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)wr(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(wr(r.effect),this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(H(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();Er(r,t),t.append(I()),this.#n.set(e,{effect:r,fragment:t})}else H(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),Sr(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(H(n.effect),this.#n.delete(e))};ensure(e,t){var n=M,r=$n();if(t&&!this.#t.has(e)&&!this.#n.has(e)){if(r){var i=document.createDocumentFragment(),a=I();i.append(a),this.#n.set(e,{effect:V(()=>t(a)),fragment:i})}else this.#t.set(e,V(()=>t(this.anchor)))}if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of this.#n)t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else w&&(this.anchor=E),this.#a(n)}};function Li(e,t,n=!1){var r;w&&(r=E,O());var i=new Ii(e),a=n?ie:0;function o(e,t){if(w){var n=Le(r);if(e!==parseInt(n.substring(1))){var a=Ie();D(a),i.anchor=a,T(!1),i.ensure(e,t),T(!0);return}}i.ensure(e,t)}hr(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}var Ri=Symbol(`NaN`);function zi(e,t,n){w&&O();var r=new Ii(e),i=!wt();hr(()=>{var e=t();e!==e&&(e=Ri),i&&typeof e==`object`&&e&&(e={}),r.ensure(e,n)})}function Bi(e,t){return t}function Vi(e,t,n){for(var r=[],i=t.length,o,s=t.length,c=0;c<i;c++){let n=t[c];Sr(n,()=>{if(o){if(o.pending.delete(n),o.done.add(n),o.pending.size===0){var t=e.outrogroups;Hi(e,a(o.done)),t.delete(o),t.size===0&&(e.outrogroups=null)}}else--s},!1)}if(s===0){var l=r.length===0&&n!==null&&e.pending.size===0;if(l){var u=n,d=u.parentNode;Qn(d),d.append(u),e.items.clear()}Hi(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function Hi(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i<t.length;i++){var a=t[i];r?.has(a)?(a.f|=ce,Er(a,document.createDocumentFragment())):H(t[i],n)}}var Ui;function Wi(e,t,r,i,o,s=null){var c=e,l=new Map;if(t&4){var u=e;c=w?D(L(u)):u.appendChild(I())}w&&O();var d=null,f=rn(()=>{var e=r();return n(e)?e:e==null?[]:a(e)}),p,m=new Map,h=!0;function g(e){v.effect.f&16384||(v.pending.delete(e),v.fallback=d,Ki(v,p,c,t,i),d!==null&&(p.length===0?d.f&33554432?(d.f^=ce,Ji(d,null,c)):wr(d):Sr(d,()=>{d=null})))}function _(e){v.pending.delete(e)}var v={effect:hr(()=>{p=Q(f);var e=p.length;let n=!1;w&&Le(c)===`[!`!=(e===0)&&(c=Ie(),D(c),T(!1),n=!0);for(var a=new Set,u=M,v=$n(),y=0;y<e;y+=1){w&&E.nodeType===8&&E.data===`]`&&(c=E,n=!0,T(!1));var b=p[y],x=i(b,y),S=h?null:l.get(x);S?(S.v&&Fn(S.v,b),S.i&&Fn(S.i,y),v&&u.unskip_effect(S.e)):(S=qi(l,h?c:Ui??=I(),b,x,y,o,t,r),h||(S.e.f|=ce),l.set(x,S)),a.add(x)}if(e===0&&s&&!d&&(h?d=V(()=>s(c)):(d=V(()=>s(Ui??=I())),d.f|=ce)),e>a.size&&Ge(``,``,``),w&&e>0&&D(Ie()),!h){if(m.set(u,a),v){for(let[e,t]of l)a.has(e)||u.skip_effect(t.e);u.oncommit(g),u.ondiscard(_)}else g(u)}n&&T(!0),Q(f)}),flags:t,items:l,pending:m,outrogroups:null,fallback:d};h=!1,w&&(c=E)}function Gi(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function Ki(e,t,n,r,i){var o=!!(r&8),s=t.length,c=e.items,l=Gi(e.effect.first),u,d=null,f,p=[],m=[],h,g,_,v;if(o)for(v=0;v<s;v+=1)h=t[v],g=i(h,v),_=c.get(g).e,_.f&33554432||(_.nodes?.a?.measure(),(f??=new Set).add(_));for(v=0;v<s;v+=1){if(h=t[v],g=i(h,v),_=c.get(g).e,e.outrogroups!==null)for(let t of e.outrogroups)t.pending.delete(_),t.done.delete(_);if(_.f&8192&&(wr(_),o&&(_.nodes?.a?.unfix(),(f??=new Set).delete(_))),_.f&33554432){if(_.f^=ce,_===l)Ji(_,null,n);else{var y=d?d.next:l;_===e.effect.last&&(e.effect.last=_.prev),_.prev&&(_.prev.next=_.next),_.next&&(_.next.prev=_.prev),Yi(e,d,_),Yi(e,_,y),Ji(_,y,n),d=_,p=[],m=[],l=Gi(d.next);continue}}if(_!==l){if(u!==void 0&&u.has(_)){if(p.length<m.length){var b=m[0],x;d=b.prev;var S=p[0],ee=p[p.length-1];for(x=0;x<p.length;x+=1)Ji(p[x],b,n);for(x=0;x<m.length;x+=1)u.delete(m[x]);Yi(e,S.prev,ee.next),Yi(e,d,S),Yi(e,ee,b),l=b,d=ee,--v,p=[],m=[]}else u.delete(_),Ji(_,l,n),Yi(e,_.prev,_.next),Yi(e,_,d===null?e.effect.first:d.next),Yi(e,d,_),d=_;continue}for(p=[],m=[];l!==null&&l!==_;)(u??=new Set).add(l),m.push(l),l=Gi(l.next);if(l===null)continue}_.f&33554432||p.push(_),d=_,l=Gi(_.next)}if(e.outrogroups!==null){for(let t of e.outrogroups)t.pending.size===0&&(Hi(e,a(t.done)),e.outrogroups?.delete(t));e.outrogroups.size===0&&(e.outrogroups=null)}if(l!==null||u!==void 0){var te=[];if(u!==void 0)for(_ of u)_.f&8192||te.push(_);for(;l!==null;)!(l.f&8192)&&l!==e.fallback&&te.push(l),l=Gi(l.next);var ne=te.length;if(ne>0){var re=r&4&&s===0?n:null;if(o){for(v=0;v<ne;v+=1)te[v].nodes?.a?.measure();for(v=0;v<ne;v+=1)te[v].nodes?.a?.fix()}Vi(e,te,re)}}o&&A(()=>{if(f!==void 0)for(_ of f)_.nodes?.a?.apply()})}function qi(e,t,n,r,i,a,o,s){var c=o&1?o&16?Mn(n):Pn(n,!1,!1):null,l=o&2?Mn(i):null;return{v:c,i:l,e:V(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function Ji(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=R(r);if(a.before(r),r===i)return;r=o}}function Yi(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function Xi(e,t,n=!1,r=!1,i=!1,a=!1){var o=e,s=``;if(n){var c=e;w&&(o=D(L(c)))}mr(()=>{var e=K;if(s===(s=t()??``)){w&&O();return}if(n&&!w){e.nodes=null,c.innerHTML=s,s!==``&&$(L(c),c.lastChild);return}if(e.nodes!==null&&(br(e.nodes.start,e.nodes.end),e.nodes=null),s!==``){if(w){for(var a=E.data,l=O(),u=l;l!==null&&(l.nodeType!==8||l.data!==``);)u=l,l=R(l);if(l===null)throw je(),Te;$(E,u),o=D(l);return}var d=er(r?`svg`:i?`math`:`template`,r?De:i?Oe:void 0);d.innerHTML=s;var f=r||i?d:d.content;if($(L(f),f.lastChild),r||i)for(;L(f);)o.before(L(f));else o.before(f)}})}function Zi(e,t,...n){var r=new Ii(e);hr(()=>{let e=t()??null;r.ensure(e,e&&(t=>e(t,...n)))},ie)}function Qi(e){return(t,...n)=>{var r=e(...n),i;w?(i=E,O()):(i=L(vi(r.render().trim())),t.before(i));let a=r.setup?.(i);$(i,i),typeof a==`function`&&or(a)}}function $i(e,t,n){var r;w&&(r=E,O());var i=new Ii(e);hr(()=>{var e=t()??null;if(w&&Le(r)===`[`!=(e!==null)){var a=Ie();D(a),i.anchor=a,T(!1),i.ensure(e,e&&(t=>n(t,e))),T(!0);return}i.ensure(e,e&&(t=>n(t,e)))},ie)}function ea(e,t,n,r,i,a){let o=w;w&&O();var s=null;w&&E.nodeType===1&&(s=E,O());var c=w?E:e,l=new Ii(c,!1);hr(()=>{let e=t()||null;var a=i?i():n||e===`svg`?De:void 0;if(e===null){l.ensure(null,null);return}return l.ensure(e,t=>{if(e){if(s=w?s:er(e,a),$(s,s),r){var n=null;w&&ai(e)&&s.append(n=document.createComment(``));var i=w?L(s):s.appendChild(I());w&&(i===null?T(!1):D(i)),r(s,i),n?.remove()}K.nodes.end=s,t.before(s)}w&&D(t)}),()=>{}},ie),or(()=>{}),o&&(T(!0),D(c))}function ta(e,t){let n=null,r=w;var i;if(w){n=E;for(var a=L(document.head);a!==null&&(a.nodeType!==8||a.data!==e);)a=R(a);if(a===null)T(!1);else{var o=R(a);a.remove(),D(o)}}w||(i=document.head.appendChild(I()));try{hr(()=>{var e=V(()=>t(i));e.f|=ae,w||(e.nodes===null?e.nodes={start:i,end:i,a:null,t:null}:e.nodes.end=i)})}finally{r&&(T(!0),D(n))}}function na(e,t){var n=void 0,r;gr(()=>{n!==(n=t())&&(r&&=(H(r),null),n&&(r=V(()=>{dr(()=>n(e))})))})}function ra(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`){if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=ra(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n)}return r}function ia(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=ra(e))&&(r&&(r+=` `),r+=t);return r}function aa(e){return typeof e==`object`?ia(e):e??``}var oa=[...`
3
+ \r\f\xA0\v`];function sa(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||oa.includes(r[o-1]))&&(s===r.length||oa.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function ca(e,t=!1){var n=t?` !important;`:`;`,r=``;for(var i of Object.keys(e)){var a=e[i];a!=null&&a!==``&&(r+=` `+i+`: `+a+n)}return r}function la(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function ua(e,t){if(t){var n=``,r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\/\*.*?\*\//g,``).trim();var a=!1,o=0,s=!1,c=[];r&&c.push(...Object.keys(r).map(la)),i&&c.push(...Object.keys(i).map(la));var l=0,u=-1;let t=e.length;for(var d=0;d<t;d++){var f=e[d];if(s?f===`/`&&e[d-1]===`*`&&(s=!1):a?a===f&&(a=!1):f===`/`&&e[d+1]===`*`?s=!0:f===`"`||f===`'`?a=f:f===`(`?o++:f===`)`&&o--,!s&&a===!1&&o===0){if(f===`:`&&u===-1)u=d;else if(f===`;`||d===t-1){if(u!==-1){var p=la(e.substring(l,u).trim());if(!c.includes(p)){f!==`;`&&d++;var m=e.substring(l,d).trim();n+=` `+m+`;`}}l=d+1,u=-1}}}}return r&&(n+=ca(r)),i&&(n+=ca(i,!0)),n=n.trim(),n===``?null:n}return e==null?null:String(e)}function da(e,t,n,r,i,a){var o=e[ye];if(w||o!==n||o===void 0){var s=sa(n,r,a);(!w||s!==e.getAttribute(`class`))&&(s==null?e.removeAttribute(`class`):t?e.className=s:e.setAttribute(`class`,s)),e[ye]=n}else if(a&&i!==a)for(var c in a){var l=!!a[c];(i==null||l!==!!i[c])&&e.classList.toggle(c,l)}return a}function fa(e,t={},n,r){for(var i in n){var a=n[i];t[i]!==a&&(n[i]==null?e.style.removeProperty(i):e.style.setProperty(i,a,r))}}function pa(e,t,n,r){var i=e[be];if(w||i!==t){var a=ua(t,r);(!w||a!==e.getAttribute(`style`))&&(a==null?e.removeAttribute(`style`):e.style.cssText=a),e[be]=t}else r&&(Array.isArray(r)?(fa(e,n?.[0],r[0]),fa(e,n?.[1],r[1],`important`)):fa(e,n,r));return r}function ma(e,t){t?e.hasAttribute(`selected`)||e.setAttribute(`selected`,``):e.removeAttribute(`selected`)}function ha(e,t){var n=!(`__defaultValue`in e);(n||e.__defaultValue!==t)&&(e.__defaultValue=t,ga(e,!n||`__value`in e))}function ga(e,t){var r=e.__defaultValue,i=e.multiple,a=i?r??[]:null;if(!i||n(a)){var o=e.selectedIndex,s=t&&i?new Set(e.selectedOptions):null;for(var c of e.options){var l=ba(c);ma(c,i?a.includes(l):Vn(l,r))}if(t){if(s!==null)for(c of e.options){var u=s.has(c);c.selected!==u&&(c.selected=u)}else e.selectedIndex!==o&&(e.selectedIndex=o)}}}function _a(e,t,r=!1){if(e.multiple){if(t==null)return;if(!n(t))return Me();for(var i of e.options)i.selected=t.includes(ba(i));return}for(i of e.options)if(Vn(ba(i),t)){i.selected=!0;return}(!r||t!==void 0)&&(e.selectedIndex=-1)}function va(e){var t=new MutationObserver(t=>{t.every(xa)||(`__defaultValue`in e&&ga(e,!1),`__value`in e&&_a(e,e.__value))});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`]}),or(()=>{t.disconnect()})}function ya(e,t,n=t){var r=new WeakSet,i=!0;Jt(e,`change`,t=>{var i=t?`[selected]`:`:checked`,a;if(e.multiple)a=[].map.call(e.querySelectorAll(i),ba);else{var o=e.querySelector(i)??e.querySelector(`option:not([disabled])`);a=o&&ba(o)}n(a),e.__value=a,M!==null&&r.add(M)}),dr(()=>{var a=t();if(e===document.activeElement){var o=M;if(r.has(o))return}if(_a(e,a,i),i&&a===void 0){var s=e.querySelector(`:checked`);s!==null&&(a=ba(s),n(a))}e.__value=a,i=!1})}function ba(e){return`__value`in e?e.__value:e.value}function xa(e){if(e.target.closest(`selectedcontent`)!==null)return!0;if(e.type===`childList`){var t=[...e.addedNodes,...e.removedNodes];return t.length>0&&t.every(e=>e.nodeName===`SELECTEDCONTENT`)}return!1}var Sa=Symbol(`class`),Ca=Symbol(`style`),wa=Symbol(`is custom element`),Ta=Symbol(`is html`),Ea=we?`link`:`LINK`,Da=we?`input`:`INPUT`,Oa=we?`option`:`OPTION`,ka=we?`select`:`SELECT`;function Aa(e){if(w){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute(`value`)){var n=e.value;ja(e,`value`,null),e.value=n}if(e.hasAttribute(`checked`)){var r=e.checked;ja(e,`checked`,null),e.checked=r}}};e[Se]=n,A(n),Kt()}}function ja(e,t,n,r){var i=Pa(e);w&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===Ea)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[ge]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&Ia(e).has(t)?e[t]=n:e.setAttribute(t,n))}function Ma(e,t,n,r,i=!1,a=!1){w&&i&&e.nodeName===Da&&(`defaultValue`in n||`defaultChecked`in n||Aa(e));var o=Pa(e),s=o[wa],c=!o[Ta];let l=w&&s;l&&T(!1);var u=t||{},d=e.nodeName===Oa,f=e.nodeName===ka;for(var p in t)!(p in n)&&p[0]+p[1]!==`$$`&&(n[p]=null);n.class?n.class=aa(n.class):(r||n[Sa])&&(n.class=null),n[Ca]&&(n.style??=null);var m=Ia(e);if(e.nodeName===Da&&`type`in n&&(`value`in n||`__value`in n)){var h=n.type;(h!==u.type||h===void 0&&e.hasAttribute(`type`))&&(u.type=h,ja(e,`type`,h,a))}for(let i in n){let l=n[i];if(d&&i===`value`&&l==null){e.value=e.__value=``,u[i]=l;continue}if(i===`class`){da(e,e.namespaceURI===`http://www.w3.org/1999/xhtml`,l,r,t?.[Sa],n[Sa]),u[i]=l,u[Sa]=n[Sa];continue}if(i===`style`){pa(e,l,t?.[Ca],n[Ca]),u[i]=l,u[Ca]=n[Ca];continue}var g=u[i];if(l!==g||l===void 0&&e.hasAttribute(i)){u[i]=l;var _=i[0]+i[1];if(_!==`$$`){if(_===`on`){let t={},n=`$$`+i,r=i.slice(2);var v=Qr(r);if(Xr(r)&&(r=r.slice(0,-7),t.capture=!0),!v&&g){if(l!=null)continue;e.removeEventListener(r,u[n],t),u[n]=null}if(v)di(r,e,l),fi([r]);else if(l!=null){function a(e){u[i].call(this,e)}u[n]=li(r,e,a,t)}}else if(i===`style`)ja(e,i,l);else if(i===`autofocus`)Ut(e,!!l);else if(!s&&(i===`__value`||i===`value`&&l!=null))e.value=e.__value=l;else if(i===`selected`&&d)ma(e,l);else{var y=i;c||(y=ti(y));var b=y===`defaultValue`||y===`defaultChecked`;if(f&&y===`defaultValue`)continue;if(l==null&&!s&&!b){if(o[i]=null,y===`value`||y===`checked`){let n=e,r=t===void 0;if(y===`value`){let e=n.defaultValue;n.removeAttribute(y),n.defaultValue=e,n.value=n.__value=r?e:null}else{let e=n.defaultChecked;n.removeAttribute(y),n.defaultChecked=e,n.checked=r?e:!1}}else e.removeAttribute(i)}else b||(s||typeof l!=`string`)&&m.has(y)?(e[y]=l,y in o&&(o[y]=C)):typeof l!=`function`&&ja(e,y,l,a)}}}}return l&&T(!0),u}function Na(e,t,n=[],r=[],i=[],a,o=!1,s=!1){Yt(i,n,r,n=>{var r=void 0,i={},c=e.nodeName===ka,l=!1;if(gr(()=>{var u=t(...n.map(Q)),d=Ma(e,r,u,a,o,s);if(l&&c){var f=e;`defaultValue`in u&&ha(f,u.defaultValue),`value`in u&&_a(f,u.value)}for(let e of Object.getOwnPropertySymbols(i))u[e]||H(i[e]);for(let t of Object.getOwnPropertySymbols(u)){var p=u[t];t.description===`@attach`&&(!r||p!==r[t])&&(i[t]&&H(i[t]),i[t]=V(()=>na(e,()=>p))),d[t]=p}r=d}),c){var u=e;dr(()=>{var e=r;`defaultValue`in e&&ha(u,e.defaultValue),_a(u,e.value,!0),va(u)})}l=!0})}function Pa(e){return e[ve]??={[wa]:e.nodeName.includes(`-`),[Ta]:e.namespaceURI===Ee}}var Fa=new Map;function Ia(e){var t=e.getAttribute(`is`)||e.nodeName,n=Fa.get(t);if(n)return n;Fa.set(t,n=new Set);for(var r,i=e,a=Element.prototype;a!==i;){for(var o in r=c(i),r)r[o].set&&o!==`innerHTML`&&o!==`textContent`&&o!==`innerText`&&n.add(o);i=d(i)}return n}function La(e,t,n=t){var r=new WeakSet;Jt(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=Ra(e)?za(a):a,n(a),M!==null&&r.add(M),await Gr(),a!==(a=t())){var o=e.selectionStart,s=e.selectionEnd,c=e.value.length;if(e.value=a??``,s!==null){var l=e.value.length;o===s&&s===c&&l>c?(e.selectionStart=l,e.selectionEnd=l):(e.selectionStart=o,e.selectionEnd=Math.min(s,l))}}}),(w&&e.defaultValue!==e.value||Yr(t)==null&&e.value)&&(n(Ra(e)?za(e.value):e.value),M!==null&&r.add(M)),pr(()=>{var n=t();if(e===document.activeElement){var i=M;if(r.has(i))return}Ra(e)&&n===za(e.value)||(e.type!==`date`||n||e.value)&&n!==e.value&&(e.value=n??``)})}function Ra(e){var t=e.type;return t===`number`||t===`range`}function za(e){return e===``?null:+e}function Ba(e,t){return e===t||e?.[pe]===t}function Va(e=Ct(),t,n,r){var i=k.r,a=K;return dr(()=>{var o,s;return pr(()=>{o=s,s=r?.()||[],Yr(()=>{Ba(n(...s),e)||(t(e,...s),o&&Ba(n(...o),e)&&t(null,...o))})}),()=>{let r=a;for(;r!==i&&r.parent!==null&&r.parent.f&33554432;)r=r.parent;let o=()=>{s&&Ba(n(...s),e)&&t(null,...s)},c=r.teardown;r.teardown=()=>{o(),c?.()}}}),e}function Ha(e,t,n,r,i){var a=()=>{r(n[e])};n.addEventListener(t,a),i?pr(()=>{n[e]=i()}):a(),(n===document.body||n===window||n===document)&&or(()=>{n.removeEventListener(t,a)})}var Ua={get(e,t){if(!e.exclude.has(t))return e.props[t]},set(e,t){return!1},getOwnPropertyDescriptor(e,t){if(!e.exclude.has(t)&&t in e.props)return{enumerable:!0,configurable:!0,value:e.props[t]}},has(e,t){return!e.exclude.has(t)&&t in e.props},ownKeys(e){return Reflect.ownKeys(e.props).filter(t=>!e.exclude.has(t))}};function Wa(e,t,n){return new Proxy({props:e,exclude:t},Ua)}var Ga={get(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(p(r)&&(r=r()),typeof r==`object`&&r&&t in r)return r[t]}},set(e,t,n){let r=e.props.length;for(;r--;){let i=e.props[r];p(i)&&(i=i());let a=s(i,t);if(a&&a.set)return a.set(n),!0}return!1},getOwnPropertyDescriptor(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(p(r)&&(r=r()),typeof r==`object`&&r&&t in r){let e=s(r,t);return e&&!e.configurable&&(e.configurable=!0),e}}},has(e,t){if(t===pe||t===he)return!1;for(let n of e.props)if(p(n)&&(n=n()),n!=null&&t in n)return!0;return!1},ownKeys(e){let t=[];for(let n of e.props)if(p(n)&&(n=n()),n){for(let e in n)t.includes(e)||t.push(e);for(let e of Object.getOwnPropertySymbols(n))t.includes(e)||t.push(e)}return t}};function Ka(...e){return new Proxy({props:e},Ga)}function qa(e,t,n,r){var i=!0,a=!!(n&8),o=!!(n&16),c=r,l=!0,u=void 0,d=()=>o&&i?(u??=$t(r),Q(u)):(l&&(l=!1,c=o?Yr(r):r),c);let f;if(a){var p=pe in e||he in e;f=s(e,t)?.set??(p&&t in e?n=>e[t]=n:void 0)}var m,h=!1;a?[m,h]=Ht(()=>e[t]):m=e[t],m===void 0&&r!==void 0&&(m=d(),f&&(i&&tt(t),f(m)));var g=i?()=>{var n=e[t];return n===void 0?d():(l=!0,n)}:()=>{var n=e[t];return n!==void 0&&(c=void 0),n===void 0?c:n};if(i&&!(n&4))return g;if(f){var _=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||_||h)&&f(t?g():e),e):g()})}var v=!1,y=(n&1?$t:rn)(()=>(v=!1,g()));a&&Q(y);var b=K;return(function(e,t){if(arguments.length>0){let n=t?Q(y):i&&a?zn(e):e;return F(y,n),v=!0,c!==void 0&&(c=n),e}return kr&&v||b.f&16384?y.v:Q(y)})}function Ja(e){return class extends Ya{constructor(t){super({component:e,...t})}}}var Ya=class{#e;#t;constructor(e){var t=new Map,n=(e,n)=>{var r=Pn(n,!1,!1);return t.set(e,r),r};let r=new Proxy({...e.props||{},$$events:{}},{get(e,r){return Q(t.get(r)??n(r,Reflect.get(e,r)))},has(e,r){return r===he||(Q(t.get(r)??n(r,Reflect.get(e,r))),Reflect.has(e,r))},set(e,r,i){return F(t.get(r)??n(r,i),i),Reflect.set(e,r,i)}});this.#t=(e.hydrate?ji:Ai)(e.component,{target:e.target,anchor:e.anchor,props:r,context:e.context,intro:e.intro??!1,recover:e.recover,transformError:e.transformError}),(!e?.props?.$$host||e.sync===!1)&&bn(),this.#e=r.$$events;for(let e of Object.keys(this.#t))e!==`$set`&&e!==`$destroy`&&e!==`$on`&&o(this,e,{get(){return this.#t[e]},set(t){this.#t[e]=t},enumerable:!0});this.#t.$set=e=>{Object.assign(r,e)},this.#t.$destroy=()=>{Fi(this.#t)}}$set(e){this.#t.$set(e)}$on(e,t){this.#e[e]=this.#e[e]||[];let n=(...e)=>t.call(this,...e);return this.#e[e].push(n),()=>{this.#e[e]=this.#e[e].filter(e=>e!==n)}}$destroy(){this.#t.$destroy()}};function Xa(e,t){if(Ve(`hydratable`),w){let t=window.__svelte?.h;if(t?.has(e))return t.get(e);Ae(e)}return t()}var Za=t({afterUpdate:()=>io,beforeUpdate:()=>ro,createContext:()=>gt,createEventDispatcher:()=>no,createRawSnippet:()=>Qi,flushSync:()=>bn,fork:()=>On,getAbortSignal:()=>Qa,getAllContexts:()=>bt,getContext:()=>_t,hasContext:()=>yt,hydratable:()=>Xa,hydrate:()=>ji,mount:()=>Ai,onDestroy:()=>eo,onMount:()=>$a,setContext:()=>vt,settled:()=>Kr,tick:()=>Gr,unmount:()=>Fi,untrack:()=>Yr});function Qa(){return U===null&&Qe(),(U.ac??=new AbortController).signal}function $a(e){k===null&&He(`onMount`),sr(()=>{let t=Yr(e);if(typeof t==`function`)return t})}function eo(e){k===null&&He(`onDestroy`),$a(()=>()=>Yr(e))}function to(e,t,{bubbles:n=!1,cancelable:r=!1}={}){return new CustomEvent(e,{detail:t,bubbles:n,cancelable:r})}function no(){let e=k;return e===null&&He(`createEventDispatcher`),(t,r,i)=>{let a=e.s.$$events?.[t];if(a){let o=n(a)?a.slice():[a],s=to(t,r,i);for(let t of o)t.call(e.x,s);return!s.defaultPrevented}return!0}}function ro(e){k===null&&He(`beforeUpdate`),k.l===null&&et(`beforeUpdate`),ao(k).b.push(e)}function io(e){k===null&&He(`afterUpdate`),k.l===null&&et(`afterUpdate`),ao(k).a.push(e)}function ao(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}export{zn as $,wi as A,Gr as B,Xi as C,t as Ct,Li as D,zi as E,fi as F,sr as G,Fr as H,di as I,Hn as J,lr as K,ui as L,yi as M,xi as N,ki as O,Si as P,Zn as Q,Q as R,Zi as S,v as St,Bi as T,dr as U,Yr as V,mr as W,Yn as X,Jn as Y,Xn as Z,aa as _,st as _t,Wa as a,Wt as at,ea as b,_ as bt,Va as c,It as ct,Aa as d,_t as dt,Ln as et,ja as f,St as ft,da as g,lt as gt,pa as h,dt as ht,qa as i,nn as it,Ci as j,Ti as k,La as l,Lt as lt,va as m,vt as mt,$a as n,Mn as nt,Ka as o,Vt as ot,ya as p,xt as pt,Un as q,Ja as r,Nn as rt,Ha as s,Bt as st,Za as t,F as tt,Na as u,Ft as ut,ia as v,Fe as vt,Wi as w,$i as x,m as xt,ta as y,Pe as yt,Kr as z};
@@ -0,0 +1 @@
1
+ import"./BvmBrUGQ.js";import{i as e}from"./DvSrLZhO.js";var t={get data(){return e.data},get error(){return e.error},get form(){return e.form},get params(){return e.params},get route(){return e.route},get state(){return e.state},get status(){return e.status},get url(){return e.url}};export{t};